amber-cli.js 2.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307
  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. function installMethod (method, klass) {
  984. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  985. }
  986. DNUBrik.deps = ["selectors", "smalltalkGlobals", "classes"];
  987. function DNUBrik (brikz, st) {
  988. var selectorPairs = brikz.selectors.selectorPairs;
  989. var globals = brikz.smalltalkGlobals.globals;
  990. var nilAsClass = brikz.classes.nilAsClass;
  991. /* Method not implemented handlers */
  992. function makeDnuHandler (pair, targetClasses) {
  993. var jsSelector = pair.js;
  994. var fn = createHandler(pair.st);
  995. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  996. targetClasses.forEach(function (target) {
  997. installJSMethod(target.fn.prototype, jsSelector, fn);
  998. });
  999. }
  1000. this.makeDnuHandler = makeDnuHandler;
  1001. /* Dnu handler method */
  1002. function createHandler (stSelector) {
  1003. return function () {
  1004. return globals.Message._selector_arguments_notUnderstoodBy_(
  1005. stSelector, [].slice.call(arguments), this
  1006. );
  1007. };
  1008. }
  1009. selectorPairs.forEach(function (pair) {
  1010. makeDnuHandler(pair, []);
  1011. });
  1012. }
  1013. RuntimeClassesBrik.deps = ["event", "selectors", "dnu", "behaviors", "classes"];
  1014. function RuntimeClassesBrik (brikz, st) {
  1015. var selectors = brikz.selectors;
  1016. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1017. var wireKlass = brikz.classes.wireKlass;
  1018. var emit = brikz.event.emit;
  1019. var detachedRootClasses = [];
  1020. function markClassDetachedRoot (klass) {
  1021. klass.detachedRoot = true;
  1022. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1023. return klass.detachedRoot;
  1024. });
  1025. }
  1026. this.detachedRootClasses = function () {
  1027. return detachedRootClasses;
  1028. };
  1029. /* Initialize a class in its class hierarchy. Handle both classes and
  1030. metaclasses. */
  1031. function initClassAndMetaclass (klass) {
  1032. initClass(klass);
  1033. if (klass.a$cls && !klass.meta) {
  1034. initClass(klass.a$cls);
  1035. }
  1036. }
  1037. traitsOrClasses.forEach(function (traitOrClass) {
  1038. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1039. });
  1040. emit.classAdded = function (klass) {
  1041. initClassAndMetaclass(klass);
  1042. klass._enterOrganization();
  1043. };
  1044. emit.traitAdded = function (trait) {
  1045. trait._enterOrganization();
  1046. };
  1047. emit.classRemoved = function (klass) {
  1048. klass._leaveOrganization();
  1049. };
  1050. emit.traitRemoved = function (trait) {
  1051. trait._leaveOrganization();
  1052. };
  1053. function initClass (klass) {
  1054. wireKlass(klass);
  1055. if (klass.detachedRoot) {
  1056. copySuperclass(klass);
  1057. }
  1058. installMethods(klass);
  1059. }
  1060. function copySuperclass (klass) {
  1061. var myproto = klass.fn.prototype,
  1062. superproto = klass.superclass.fn.prototype;
  1063. selectors.selectorPairs.forEach(function (selectorPair) {
  1064. var jsSelector = selectorPair.js;
  1065. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1066. });
  1067. }
  1068. function installMethods (klass) {
  1069. var methods = klass.methods;
  1070. Object.keys(methods).forEach(function (selector) {
  1071. installMethod(methods[selector], klass);
  1072. });
  1073. }
  1074. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1075. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1076. markClassDetachedRoot(klass);
  1077. klass.fn = constructor;
  1078. initClass(klass);
  1079. };
  1080. }
  1081. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1082. function FrameBindingBrik (brikz, st) {
  1083. var globals = brikz.smalltalkGlobals.globals;
  1084. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1085. setClassConstructor(globals.Number, Number);
  1086. setClassConstructor(globals.BlockClosure, Function);
  1087. setClassConstructor(globals.Boolean, Boolean);
  1088. setClassConstructor(globals.Date, Date);
  1089. setClassConstructor(globals.String, String);
  1090. setClassConstructor(globals.Array, Array);
  1091. setClassConstructor(globals.RegularExpression, RegExp);
  1092. setClassConstructor(globals.Error, Error);
  1093. setClassConstructor(globals.Promise, Promise);
  1094. this.__init__ = function () {
  1095. st.alias(globals.Array, "OrderedCollection");
  1096. st.alias(globals.Date, "Time");
  1097. }
  1098. }
  1099. RuntimeMethodsBrik.deps = ["event", "dnu", "runtimeClasses"];
  1100. function RuntimeMethodsBrik (brikz, st) {
  1101. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  1102. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  1103. var emit = brikz.event.emit;
  1104. emit.behaviorMethodAdded = function (method, klass) {
  1105. installMethod(method, klass);
  1106. propagateMethodChange(klass, method, klass);
  1107. };
  1108. emit.selectorsAdded = function (newSelectors) {
  1109. var targetClasses = detachedRootClasses();
  1110. newSelectors.forEach(function (pair) {
  1111. makeDnuHandler(pair, targetClasses);
  1112. });
  1113. };
  1114. emit.behaviorMethodRemoved = function (method, klass) {
  1115. delete klass.fn.prototype[method.jsSelector];
  1116. propagateMethodChange(klass, method, null);
  1117. };
  1118. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1119. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1120. };
  1121. function propagateMethodChange (klass, method, exclude) {
  1122. var selector = method.selector;
  1123. var jsSelector = method.jsSelector;
  1124. st.traverseClassTree(klass, function (subclass, sentinel) {
  1125. if (subclass === exclude) return;
  1126. if (subclass.methods[selector]) return sentinel;
  1127. if (subclass.detachedRoot) {
  1128. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1129. }
  1130. });
  1131. }
  1132. }
  1133. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1134. function PrimitivesBrik (brikz, st) {
  1135. var globals = brikz.smalltalkGlobals.globals;
  1136. var oid = 0;
  1137. /* Unique ID number generator */
  1138. st.nextId = function () {
  1139. console.warn("$core.nextId() deprecated. Use your own unique counter.");
  1140. oid += 1;
  1141. return oid;
  1142. };
  1143. /* Converts a JavaScript object to valid Smalltalk Object */
  1144. st.readJSObject = function (js) {
  1145. if (js == null) return null;
  1146. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1147. else if (js.constructor !== Object) return js;
  1148. var pairs = [];
  1149. for (var i in js) {
  1150. pairs.push(i, st.readJSObject(js[i]));
  1151. }
  1152. return globals.Dictionary._newFromPairs_(pairs);
  1153. };
  1154. /* Boolean assertion */
  1155. st.assert = function (shouldBeBoolean) {
  1156. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1157. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1158. shouldBeBoolean = shouldBeBoolean.valueOf();
  1159. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1160. }
  1161. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1162. };
  1163. }
  1164. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1165. function RuntimeBrik (brikz, st) {
  1166. var globals = brikz.smalltalkGlobals.globals;
  1167. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1168. function SmalltalkMethodContext (home, setup) {
  1169. // TODO lazy fill of .sendIdx
  1170. this.sendIdx = {};
  1171. // TODO very likely .senderContext, not .homeContext here
  1172. this.homeContext = home;
  1173. this.setup = setup;
  1174. }
  1175. // Fallbacks
  1176. SmalltalkMethodContext.prototype.supercall = false;
  1177. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1178. SmalltalkMethodContext.prototype.receiver = null;
  1179. SmalltalkMethodContext.prototype.selector = null;
  1180. SmalltalkMethodContext.prototype.lookupClass = null;
  1181. SmalltalkMethodContext.prototype.outerContext = null;
  1182. SmalltalkMethodContext.prototype.index = 0;
  1183. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1184. this.receiver = receiver;
  1185. this.selector = selector;
  1186. if (locals != null) this.locals = locals;
  1187. this.lookupClass = lookupClass;
  1188. if (this.homeContext) {
  1189. this.homeContext.evaluatedSelector = selector;
  1190. }
  1191. });
  1192. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1193. if (locals != null) this.locals = locals;
  1194. this.outerContext = ctx;
  1195. if (index) this.index = index;
  1196. });
  1197. defineMethod(SmalltalkMethodContext, "method", function () {
  1198. var method;
  1199. var lookup = this.lookupClass || this.receiver.a$cls;
  1200. while (!method && lookup) {
  1201. method = lookup.methods[st.js2st(this.selector)];
  1202. lookup = lookup.superclass;
  1203. }
  1204. return method;
  1205. });
  1206. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1207. /* This is the current call context object.
  1208. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1209. In JS code, use api.getThisContext() (see below).
  1210. */
  1211. var thisContext = null;
  1212. /*
  1213. Runs worker function so that error handler is not set up
  1214. if there isn't one. This is accomplished by unconditional
  1215. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1216. which then stops error handler setup (see st.withContext above).
  1217. The effect is, $core.seamless(fn)'s exceptions are not
  1218. handed into ST error handler and caller should process them.
  1219. */
  1220. st.seamless = function (worker) {
  1221. var oldContext = thisContext;
  1222. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1223. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1224. });
  1225. var result = worker(thisContext);
  1226. thisContext = oldContext;
  1227. return result;
  1228. };
  1229. function resultWithErrorHandling (worker) {
  1230. try {
  1231. return worker(thisContext);
  1232. } catch (error) {
  1233. globals.ErrorHandler._handleError_(error);
  1234. thisContext = null;
  1235. // Rethrow the error in any case.
  1236. throw error;
  1237. }
  1238. }
  1239. /*
  1240. Standard way to run within context.
  1241. Sets up error handler if entering first ST context in a stack.
  1242. */
  1243. st.withContext = function (worker, setup) {
  1244. var oldContext = thisContext;
  1245. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1246. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1247. thisContext = oldContext;
  1248. return result;
  1249. };
  1250. /* Handle thisContext pseudo variable */
  1251. st.getThisContext = function () {
  1252. if (!thisContext) return null;
  1253. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1254. frame.setup(frame);
  1255. }
  1256. return thisContext;
  1257. };
  1258. }
  1259. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1260. function MessageSendBrik (brikz, st) {
  1261. var globals = brikz.smalltalkGlobals.globals;
  1262. var nilAsReceiver = brikz.root.nilAsReceiver;
  1263. /* Send message programmatically. Used to implement #perform: & Co. */
  1264. st.send2 = function (self, selector, args, klass) {
  1265. if (self == null) {
  1266. self = nilAsReceiver;
  1267. }
  1268. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1269. return method != null ?
  1270. method.apply(self, args || []) :
  1271. globals.Message._selector_arguments_notUnderstoodBy_(
  1272. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1273. );
  1274. };
  1275. function wrapJavaScript (o) {
  1276. return globals.JSObjectProxy._on_(o);
  1277. }
  1278. st.wrapJavaScript = wrapJavaScript;
  1279. /* If the object property is a function, then call it, except if it starts with
  1280. an uppercase character (we probably want to answer the function itself in this
  1281. case and send it #new from Amber).
  1282. */
  1283. st.accessJavaScript = function (self, propertyName, args) {
  1284. var propertyValue = self[propertyName];
  1285. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1286. return propertyValue.apply(self, args || []);
  1287. } else if (args.length === 0) {
  1288. return propertyValue;
  1289. } else {
  1290. self[propertyName] = args[0];
  1291. return self;
  1292. }
  1293. };
  1294. }
  1295. StartImageBrik.deps = ["smalltalkGlobals"];
  1296. function StartImageBrik (brikz, st) {
  1297. var globals = brikz.smalltalkGlobals.globals;
  1298. this.run = function () {
  1299. globals.AmberBootstrapInitialization._run();
  1300. };
  1301. }
  1302. /* Making smalltalk that can run */
  1303. function configureWithRuntime (brikz) {
  1304. brikz.dnu = DNUBrik;
  1305. brikz.runtimeClasses = RuntimeClassesBrik;
  1306. brikz.frameBinding = FrameBindingBrik;
  1307. brikz.runtimeMethods = RuntimeMethodsBrik;
  1308. brikz.messageSend = MessageSendBrik;
  1309. brikz.runtime = RuntimeBrik;
  1310. brikz.primitives = PrimitivesBrik;
  1311. brikz.startImage = StartImageBrik;
  1312. brikz.rebuild();
  1313. }
  1314. return configureWithRuntime;
  1315. });
  1316. // Depend on each module that is loaded lazily.
  1317. // Add to packager tasks as dependency,
  1318. // so the lazy-loaded modules are included.
  1319. define('amber/lazypack',['./kernel-runtime'], {});
  1320. //jshint eqnull:true
  1321. define('amber/kernel-checks',[],function () {
  1322. "use strict";
  1323. function assert (fn) {
  1324. try {
  1325. if (fn()) return;
  1326. } catch (ex) {
  1327. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1328. }
  1329. throw new Error("Assertion failed:\n" + fn);
  1330. }
  1331. assert(function () {
  1332. return !("hasOwnProperty" in Object.create(null));
  1333. });
  1334. assert(function () {
  1335. return Object.getPrototypeOf(Object.create(null)) === null;
  1336. });
  1337. assert(function () {
  1338. var p = {};
  1339. return Object.getPrototypeOf(Object.create(p)) === p;
  1340. });
  1341. // assert(function () {
  1342. // return new Function("return this")().Object === Object;
  1343. // });
  1344. // assert(function () {
  1345. // return Object.create(new Function("return this")()).Object === Object;
  1346. // });
  1347. assert(function () {
  1348. return typeof global !== "undefined";
  1349. });
  1350. assert(function () {
  1351. return global.Object === Object;
  1352. });
  1353. assert(function () {
  1354. return Object.create(global).Object === Object;
  1355. });
  1356. assert(function () {
  1357. return (function () {
  1358. return this;
  1359. }).apply(void 0) === void 0;
  1360. });
  1361. assert(function () {
  1362. return (function () {
  1363. return this;
  1364. }).apply(null) === null;
  1365. });
  1366. assert(function () {
  1367. return (function () {
  1368. return this;
  1369. }).apply(3) === 3;
  1370. });
  1371. assert(function () {
  1372. return (function () {
  1373. return this;
  1374. }).apply("foo") === "foo";
  1375. });
  1376. assert(function () {
  1377. return (function () {
  1378. return this;
  1379. }).apply(true) === true;
  1380. });
  1381. assert(function () {
  1382. var o = Object.freeze({});
  1383. try {
  1384. o.foo = "bar";
  1385. } catch (ex) {
  1386. }
  1387. return o.foo == null;
  1388. });
  1389. assert(function () {
  1390. return typeof Promise === "function";
  1391. });
  1392. assert(function () {
  1393. return typeof Promise.resolve === "function";
  1394. });
  1395. assert(function () {
  1396. return typeof Promise.reject === "function";
  1397. });
  1398. assert(function () {
  1399. return typeof new Promise(function () {
  1400. }).then === "function";
  1401. });
  1402. });
  1403. define('amber/brikz',[], function () {
  1404. return function Brikz(api, apiKey, initKey) {
  1405. "use strict";
  1406. //jshint eqnull:true
  1407. var brikz = this,
  1408. backup = {};
  1409. apiKey = apiKey || 'exports';
  1410. initKey = initKey || '__init__';
  1411. function mixin(src, target, what) {
  1412. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1413. if (src == null) {
  1414. target[keys[i]] = undefined;
  1415. } else {
  1416. var value = src[keys[i]];
  1417. if (typeof value !== "undefined") {
  1418. target[keys[i]] = value;
  1419. }
  1420. }
  1421. }
  1422. return target;
  1423. }
  1424. Object.defineProperties(this, {
  1425. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1426. });
  1427. var exclude = mixin(this, {});
  1428. this.rebuild = function () {
  1429. Object.keys(backup).forEach(function (key) {
  1430. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1431. });
  1432. var oapi = mixin(api, {}),
  1433. order = [],
  1434. chk = {};
  1435. function ensure(key) {
  1436. if (key in exclude) {
  1437. return null;
  1438. }
  1439. var b = brikz[key],
  1440. bak = backup[key];
  1441. mixin(null, api, api);
  1442. while (typeof b === "function") {
  1443. (b.deps || []).forEach(ensure);
  1444. b = new b(brikz, api, bak);
  1445. }
  1446. brikz[key] = b;
  1447. if (b && !chk[key]) {
  1448. chk[key] = true;
  1449. order.push(b);
  1450. }
  1451. if (b && !b[apiKey]) {
  1452. b[apiKey] = mixin(api, {});
  1453. }
  1454. }
  1455. Object.keys(brikz).forEach(ensure);
  1456. mixin(oapi, mixin(null, api, api));
  1457. order.forEach(function (brik) {
  1458. mixin(brik[apiKey] || {}, api);
  1459. });
  1460. order.forEach(function (brik) {
  1461. if (brik[initKey]) {
  1462. brik[initKey]();
  1463. if (brik[initKey].once) {
  1464. delete brik[initKey];
  1465. }
  1466. }
  1467. });
  1468. backup = mixin(brikz, {});
  1469. };
  1470. };
  1471. });
  1472. /* ====================================================================
  1473. |
  1474. | Amber Smalltalk
  1475. | http://amber-lang.net
  1476. |
  1477. ======================================================================
  1478. ======================================================================
  1479. |
  1480. | Copyright (c) 2010-2014
  1481. | Nicolas Petton <petton.nicolas@gmail.com>
  1482. |
  1483. | Copyright (c) 2012-2017
  1484. | The Amber team https://lolg.it/org/amber/members
  1485. | Amber contributors (see /CONTRIBUTORS)
  1486. |
  1487. | Amber is released under the MIT license
  1488. |
  1489. | Permission is hereby granted, free of charge, to any person obtaining
  1490. | a copy of this software and associated documentation files (the
  1491. | 'Software'), to deal in the Software without restriction, including
  1492. | without limitation the rights to use, copy, modify, merge, publish,
  1493. | distribute, sublicense, and/or sell copies of the Software, and to
  1494. | permit persons to whom the Software is furnished to do so, subject to
  1495. | the following conditions:
  1496. |
  1497. | The above copyright notice and this permission notice shall be
  1498. | included in all copies or substantial portions of the Software.
  1499. |
  1500. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1501. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1502. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1503. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1504. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1505. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1506. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1507. |
  1508. ==================================================================== */
  1509. //jshint eqnull:true
  1510. define('amber/kernel-fundamentals',[],function () {
  1511. "use strict";
  1512. function inherits (child, parent) {
  1513. child.prototype = Object.create(parent.prototype, {
  1514. constructor: {
  1515. value: child,
  1516. enumerable: false, configurable: true, writable: true
  1517. }
  1518. });
  1519. return child;
  1520. }
  1521. function SmalltalkGlobalsBrik (brikz, st) {
  1522. var globals = Object.create(global);
  1523. globals.SmalltalkSettings = {};
  1524. this.globals = globals;
  1525. }
  1526. function EventBrik (brikz, st) {
  1527. var emit = {};
  1528. this.emit = emit;
  1529. this.declareEvent = function (event) {
  1530. if (!emit[event]) emit[event] = function () {
  1531. };
  1532. }
  1533. }
  1534. function RootBrik (brikz, st) {
  1535. /* Smalltalk foundational objects */
  1536. var coreFns = this.coreFns = {};
  1537. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1538. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1539. Detached roots (eg. wrapped JS classes like Number or Date)
  1540. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1541. function SmalltalkRoot () {
  1542. }
  1543. function SmalltalkProtoObject () {
  1544. }
  1545. function SmalltalkObject () {
  1546. }
  1547. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1548. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1549. this.Root = SmalltalkRoot;
  1550. this.Object = SmalltalkObject;
  1551. }
  1552. SelectorsBrik.deps = ["selectorConversion"];
  1553. function SelectorsBrik (brikz, st) {
  1554. var selectorSet = Object.create(null);
  1555. var selectors = this.selectors = [];
  1556. var selectorPairs = this.selectorPairs = [];
  1557. this.registerSelector = function (stSelector) {
  1558. if (selectorSet[stSelector]) return null;
  1559. var jsSelector = st.st2js(stSelector);
  1560. selectorSet[stSelector] = true;
  1561. selectors.push(stSelector);
  1562. var pair = {st: stSelector, js: jsSelector};
  1563. selectorPairs.push(pair);
  1564. return pair;
  1565. };
  1566. st.allSelectors = function () {
  1567. return selectors;
  1568. };
  1569. }
  1570. function PackagesBrik (brikz, st) {
  1571. st.packages = st.packageDescriptors = {};
  1572. /* Add a package load descriptor to the system */
  1573. st.addPackage = function (name, properties) {
  1574. if (!name) return null;
  1575. return st.packageDescriptors[name] = {properties: properties};
  1576. };
  1577. }
  1578. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1579. function BehaviorsBrik (brikz, st) {
  1580. var globals = brikz.smalltalkGlobals.globals;
  1581. var addElement = brikz.arraySet.addElement;
  1582. var removeElement = brikz.arraySet.removeElement;
  1583. /* Smalltalk classes and traits */
  1584. var traitsOrClasses = [];
  1585. this.buildTraitOrClass = function (category, builder) {
  1586. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1587. if (traitOrClass) {
  1588. builder.updateExisting(traitOrClass);
  1589. } else {
  1590. traitOrClass = builder.make();
  1591. traitOrClass.category = category;
  1592. addTraitOrClass(traitOrClass);
  1593. }
  1594. return traitOrClass;
  1595. };
  1596. function addTraitOrClass (traitOrClass) {
  1597. globals[traitOrClass.name] = traitOrClass;
  1598. addElement(traitsOrClasses, traitOrClass);
  1599. traitOrClass.added();
  1600. }
  1601. function removeTraitOrClass (traitOrClass) {
  1602. traitOrClass.removed();
  1603. removeElement(traitsOrClasses, traitOrClass);
  1604. delete globals[traitOrClass.name];
  1605. }
  1606. this.removeTraitOrClass = removeTraitOrClass;
  1607. /* Create an alias for an existing class */
  1608. st.alias = function (traitOrClass, alias) {
  1609. globals[alias] = traitOrClass;
  1610. };
  1611. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1612. }
  1613. MethodsBrik.deps = ["event", "selectors", "root", "selectorConversion"];
  1614. function MethodsBrik (brikz, st) {
  1615. var registerSelector = brikz.selectors.registerSelector;
  1616. var SmalltalkObject = brikz.root.Object;
  1617. var coreFns = brikz.root.coreFns;
  1618. var emit = brikz.event.emit;
  1619. var declareEvent = brikz.event.declareEvent;
  1620. function SmalltalkMethod () {
  1621. }
  1622. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1623. /* Smalltalk method object. To add a method to a class,
  1624. use api.addMethod() */
  1625. st.method = function (spec) {
  1626. var that = new SmalltalkMethod();
  1627. var selector = spec.selector;
  1628. that.selector = selector;
  1629. that.jsSelector = st.st2js(selector);
  1630. that.args = spec.args || {};
  1631. that.protocol = spec.protocol;
  1632. that.source = spec.source;
  1633. that.messageSends = spec.messageSends || [];
  1634. // TODO remove .referencedClasses, have .referencedGlobals
  1635. that.referencedClasses = spec.referencedClasses || [];
  1636. that.fn = spec.fn;
  1637. return that;
  1638. };
  1639. /* Add/remove a method to/from a class */
  1640. st.addMethod = function (method, traitOrBehavior) {
  1641. if (method.owner != null) {
  1642. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1643. }
  1644. method.owner = traitOrBehavior;
  1645. // TODO deprecation helper; remove
  1646. Object.defineProperty(method, "methodClass", {
  1647. get: function () {
  1648. console.warn("Use of .methodClass deprecated, use .owner");
  1649. return method.owner;
  1650. },
  1651. set: function (v) {
  1652. console.warn("Use of .methodClass= deprecated, use .owner=");
  1653. method.owner = v;
  1654. }
  1655. });
  1656. registerNewSelectors(method);
  1657. traitOrBehavior.localMethods[method.selector] = method;
  1658. updateMethod(method.selector, traitOrBehavior);
  1659. };
  1660. declareEvent("selectorsAdded");
  1661. function registerNewSelectors (method) {
  1662. var newSelectors = [];
  1663. function selectorInUse (stSelector) {
  1664. var pair = registerSelector(stSelector);
  1665. if (pair) {
  1666. newSelectors.push(pair);
  1667. }
  1668. }
  1669. selectorInUse(method.selector);
  1670. method.messageSends.forEach(selectorInUse);
  1671. emit.selectorsAdded(newSelectors);
  1672. }
  1673. st.removeMethod = function (method, traitOrBehavior) {
  1674. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1675. delete traitOrBehavior.localMethods[method.selector];
  1676. updateMethod(method.selector, traitOrBehavior);
  1677. };
  1678. this.setupMethods = function (traitOrBehavior) {
  1679. traitOrBehavior.localMethods = Object.create(null);
  1680. traitOrBehavior.methods = Object.create(null);
  1681. };
  1682. declareEvent("methodReplaced");
  1683. function updateMethod (selector, traitOrBehavior) {
  1684. var oldMethod = traitOrBehavior.methods[selector],
  1685. newMethod = traitOrBehavior.localMethods[selector];
  1686. if (oldMethod == null && newMethod == null) {
  1687. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1688. return;
  1689. }
  1690. if (newMethod === oldMethod) return;
  1691. if (newMethod != null) {
  1692. traitOrBehavior.methods[selector] = newMethod;
  1693. traitOrBehavior.methodAdded(newMethod);
  1694. } else {
  1695. delete traitOrBehavior.methods[selector];
  1696. traitOrBehavior.methodRemoved(oldMethod);
  1697. }
  1698. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1699. }
  1700. this.updateMethod = updateMethod;
  1701. }
  1702. function ArraySetBrik (brikz, st) {
  1703. st.addElement = this.addElement = function (array, el) {
  1704. if (typeof el === 'undefined') {
  1705. return;
  1706. }
  1707. if (array.indexOf(el) === -1) {
  1708. array.push(el);
  1709. }
  1710. };
  1711. st.removeElement = this.removeElement = function (array, el) {
  1712. var i = array.indexOf(el);
  1713. if (i !== -1) {
  1714. array.splice(i, 1);
  1715. }
  1716. };
  1717. }
  1718. function SelectorConversionBrik (brikz, st) {
  1719. /* Convert a Smalltalk selector into a JS selector */
  1720. st.st2js = function (string) {
  1721. return '_' + string
  1722. .replace(/:/g, '_')
  1723. .replace(/[\&]/g, '_and')
  1724. .replace(/[\|]/g, '_or')
  1725. .replace(/[+]/g, '_plus')
  1726. .replace(/-/g, '_minus')
  1727. .replace(/[*]/g, '_star')
  1728. .replace(/[\/]/g, '_slash')
  1729. .replace(/[\\]/g, '_backslash')
  1730. .replace(/[\~]/g, '_tild')
  1731. .replace(/%/g, '_percent')
  1732. .replace(/>/g, '_gt')
  1733. .replace(/</g, '_lt')
  1734. .replace(/=/g, '_eq')
  1735. .replace(/,/g, '_comma')
  1736. .replace(/[@]/g, '_at');
  1737. };
  1738. /* Convert a string to a valid smalltalk selector.
  1739. if you modify the following functions, also change st2js
  1740. accordingly */
  1741. st.js2st = function (selector) {
  1742. if (selector.match(/^__/)) {
  1743. return binaryJsToSt(selector);
  1744. } else {
  1745. return keywordJsToSt(selector);
  1746. }
  1747. };
  1748. function keywordJsToSt (selector) {
  1749. return selector.replace(/^_/, '').replace(/_/g, ':');
  1750. }
  1751. function binaryJsToSt (selector) {
  1752. return selector
  1753. .replace(/^_/, '')
  1754. .replace(/_and/g, '&')
  1755. .replace(/_or/g, '|')
  1756. .replace(/_plus/g, '+')
  1757. .replace(/_minus/g, '-')
  1758. .replace(/_star/g, '*')
  1759. .replace(/_slash/g, '/')
  1760. .replace(/_backslash/g, '\\')
  1761. .replace(/_tild/g, '~')
  1762. .replace(/_percent/g, '%')
  1763. .replace(/_gt/g, '>')
  1764. .replace(/_lt/g, '<')
  1765. .replace(/_eq/g, '=')
  1766. .replace(/_comma/g, ',')
  1767. .replace(/_at/g, '@');
  1768. }
  1769. st.st2prop = function (stSelector) {
  1770. var colonPosition = stSelector.indexOf(':');
  1771. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1772. };
  1773. }
  1774. NilBrik.deps = ["root"];
  1775. function NilBrik (brikz, st) {
  1776. var SmalltalkObject = brikz.root.Object;
  1777. var coreFns = brikz.root.coreFns;
  1778. function SmalltalkNil () {
  1779. }
  1780. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1781. this.nilAsReceiver = new SmalltalkNil();
  1782. this.nilAsValue = this.nilAsReceiver; // TODO null
  1783. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1784. // nil objects from one environment to another, doing
  1785. // `anObject == nil` (in JavaScript) does not always answer
  1786. // true as the referenced nil object might come from the other
  1787. // environment.
  1788. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1789. value: true,
  1790. enumerable: false, configurable: false, writable: false
  1791. });
  1792. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1793. value: true,
  1794. enumerable: false, configurable: false, writable: false
  1795. });
  1796. }
  1797. /* Making smalltalk that has basic building blocks */
  1798. function configureWithFundamentals (brikz) {
  1799. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1800. brikz.root = RootBrik;
  1801. brikz.nil = NilBrik;
  1802. brikz.event = EventBrik;
  1803. brikz.arraySet = ArraySetBrik;
  1804. brikz.selectorConversion = SelectorConversionBrik;
  1805. brikz.selectors = SelectorsBrik;
  1806. brikz.packages = PackagesBrik;
  1807. brikz.behaviors = BehaviorsBrik;
  1808. brikz.methods = MethodsBrik;
  1809. brikz.rebuild();
  1810. }
  1811. return configureWithFundamentals;
  1812. });
  1813. /* ====================================================================
  1814. |
  1815. | Amber Smalltalk
  1816. | http://amber-lang.net
  1817. |
  1818. ======================================================================
  1819. ======================================================================
  1820. |
  1821. | Copyright (c) 2010-2014
  1822. | Nicolas Petton <petton.nicolas@gmail.com>
  1823. |
  1824. | Copyright (c) 2012-2017
  1825. | The Amber team https://lolg.it/org/amber/members
  1826. | Amber contributors (see /CONTRIBUTORS)
  1827. |
  1828. | Amber is released under the MIT license
  1829. |
  1830. | Permission is hereby granted, free of charge, to any person obtaining
  1831. | a copy of this software and associated documentation files (the
  1832. | 'Software'), to deal in the Software without restriction, including
  1833. | without limitation the rights to use, copy, modify, merge, publish,
  1834. | distribute, sublicense, and/or sell copies of the Software, and to
  1835. | permit persons to whom the Software is furnished to do so, subject to
  1836. | the following conditions:
  1837. |
  1838. | The above copyright notice and this permission notice shall be
  1839. | included in all copies or substantial portions of the Software.
  1840. |
  1841. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1842. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1843. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1844. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1845. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1846. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1847. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1848. |
  1849. ==================================================================== */
  1850. //jshint eqnull:true
  1851. define('amber/kernel-language',[],function () {
  1852. "use strict";
  1853. function inherits (child, parent) {
  1854. child.prototype = Object.create(parent.prototype, {
  1855. constructor: {
  1856. value: child,
  1857. enumerable: false, configurable: true, writable: true
  1858. }
  1859. });
  1860. return child;
  1861. }
  1862. function defineMethod (klass, name, method) {
  1863. Object.defineProperty(klass.prototype, name, {
  1864. value: method,
  1865. enumerable: false, configurable: true, writable: true
  1866. });
  1867. }
  1868. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1869. function TraitsBrik (brikz, st) {
  1870. var coreFns = brikz.root.coreFns;
  1871. var SmalltalkObject = brikz.root.Object;
  1872. var setupMethods = brikz.methods.setupMethods;
  1873. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1874. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1875. var emit = brikz.event.emit;
  1876. var declareEvent = brikz.event.declareEvent;
  1877. function SmalltalkTrait () {
  1878. }
  1879. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1880. SmalltalkTrait.prototype.trait = true;
  1881. defineMethod(SmalltalkTrait, "toString", function () {
  1882. return 'Smalltalk Trait ' + this.name;
  1883. });
  1884. declareEvent("traitAdded");
  1885. defineMethod(SmalltalkTrait, "added", function () {
  1886. emit.traitAdded(this);
  1887. });
  1888. declareEvent("traitRemoved");
  1889. defineMethod(SmalltalkTrait, "removed", function () {
  1890. emit.traitRemoved(this);
  1891. });
  1892. declareEvent("traitMethodAdded");
  1893. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1894. var self = this;
  1895. this.traitUsers.forEach(function (each) {
  1896. traitMethodChanged(method.selector, method, self, each);
  1897. });
  1898. emit.traitMethodAdded(method, this);
  1899. });
  1900. declareEvent("traitMethodRemoved");
  1901. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1902. var self = this;
  1903. this.traitUsers.forEach(function (each) {
  1904. traitMethodChanged(method.selector, null, self, each);
  1905. });
  1906. emit.traitMethodRemoved(method, this);
  1907. });
  1908. function traitBuilder (traitName) {
  1909. return {
  1910. name: traitName,
  1911. make: function () {
  1912. var that = new SmalltalkTrait();
  1913. // TODO deprecation helper; remove
  1914. Object.defineProperty(that, "className", {
  1915. get: function () {
  1916. console.warn("Use of .className deprecated, use .name");
  1917. return that.name;
  1918. },
  1919. set: function (v) {
  1920. console.warn("Use of .className= deprecated, use .name=");
  1921. that.name = v;
  1922. }
  1923. });
  1924. that.name = traitName;
  1925. that.traitUsers = [];
  1926. setupMethods(that);
  1927. return that;
  1928. },
  1929. updateExisting: function (trait) {
  1930. }
  1931. };
  1932. }
  1933. st.addTrait = function (className, category) {
  1934. return buildTraitOrClass(category, traitBuilder(className));
  1935. };
  1936. }
  1937. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1938. function MethodCompositionBrik (brikz, st) {
  1939. var updateMethod = brikz.methods.updateMethod;
  1940. var addElement = brikz.arraySet.addElement;
  1941. var removeElement = brikz.arraySet.removeElement;
  1942. function aliased (selector, method) {
  1943. if (method.selector === selector) return method;
  1944. var result = st.method({
  1945. selector: selector,
  1946. args: method.args,
  1947. protocol: method.protocol,
  1948. source: '"Aliased as ' + selector + '"\n' + method.source,
  1949. messageSends: method.messageSends,
  1950. referencesClasses: method.referencedClasses,
  1951. fn: method.fn
  1952. });
  1953. result.owner = method.owner;
  1954. return result;
  1955. }
  1956. function deleteKeysFrom (keys, obj) {
  1957. keys.forEach(function (each) {
  1958. delete obj[each];
  1959. });
  1960. }
  1961. function fillTraitTransformation (traitTransformation, obj) {
  1962. // assert(Object.getOwnProperties(obj).length === 0)
  1963. var traitMethods = traitTransformation.trait.methods;
  1964. Object.keys(traitMethods).forEach(function (selector) {
  1965. obj[selector] = traitMethods[selector];
  1966. });
  1967. var traitAliases = traitTransformation.aliases;
  1968. if (traitAliases) {
  1969. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1970. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1971. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1972. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1973. });
  1974. }
  1975. var traitExclusions = traitTransformation.exclusions;
  1976. if (traitExclusions) {
  1977. deleteKeysFrom(traitExclusions, obj);
  1978. }
  1979. return obj;
  1980. }
  1981. function buildCompositionChain (traitComposition) {
  1982. return traitComposition.reduce(function (soFar, each) {
  1983. return fillTraitTransformation(each, Object.create(soFar));
  1984. }, null);
  1985. }
  1986. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1987. var oldLocalMethods = traitOrBehavior.localMethods,
  1988. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1989. Object.keys(oldLocalMethods).forEach(function (selector) {
  1990. newLocalMethods[selector] = oldLocalMethods[selector];
  1991. });
  1992. var selector;
  1993. traitOrBehavior.localMethods = newLocalMethods;
  1994. for (selector in newLocalMethods) {
  1995. updateMethod(selector, traitOrBehavior);
  1996. }
  1997. for (selector in oldLocalMethods) {
  1998. updateMethod(selector, traitOrBehavior);
  1999. }
  2000. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2001. removeElement(each.trait.traitUsers, traitOrBehavior);
  2002. });
  2003. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2004. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2005. addElement(each.trait.traitUsers, traitOrBehavior);
  2006. });
  2007. };
  2008. function aliasesOfSelector (selector, traitAliases) {
  2009. if (!traitAliases) return [selector];
  2010. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2011. return traitAliases[aliasSelector] === selector
  2012. });
  2013. if (!traitAliases[selector]) result.push(selector);
  2014. return result;
  2015. }
  2016. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2017. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2018. changes.forEach(function (aliasSelector) {
  2019. obj[aliasSelector] = aliased(aliasSelector, method);
  2020. });
  2021. var traitExclusions = traitTransformation.exclusions;
  2022. if (traitExclusions) {
  2023. deleteKeysFrom(traitExclusions, obj);
  2024. }
  2025. return changes;
  2026. }
  2027. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2028. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2029. deleteKeysFrom(changes, obj);
  2030. return changes;
  2031. }
  2032. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2033. var traitComposition = traitOrBehavior.traitComposition,
  2034. chain = traitOrBehavior.localMethods,
  2035. changes = [];
  2036. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2037. chain = Object.getPrototypeOf(chain);
  2038. var traitTransformation = traitComposition[i];
  2039. if (traitTransformation.trait !== trait) continue;
  2040. changes.push.apply(changes, method ?
  2041. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2042. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2043. }
  2044. // assert(chain === null);
  2045. changes.forEach(function (each) {
  2046. updateMethod(each, traitOrBehavior);
  2047. });
  2048. }
  2049. this.traitMethodChanged = traitMethodChanged;
  2050. }
  2051. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2052. function ClassesBrik (brikz, st) {
  2053. var SmalltalkRoot = brikz.root.Root;
  2054. var coreFns = brikz.root.coreFns;
  2055. var globals = brikz.smalltalkGlobals.globals;
  2056. var SmalltalkObject = brikz.root.Object;
  2057. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2058. var setupMethods = brikz.methods.setupMethods;
  2059. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2060. var addElement = brikz.arraySet.addElement;
  2061. var removeElement = brikz.arraySet.removeElement;
  2062. var emit = brikz.event.emit;
  2063. var declareEvent = brikz.event.declareEvent;
  2064. function SmalltalkBehavior () {
  2065. }
  2066. function SmalltalkClass () {
  2067. }
  2068. function SmalltalkMetaclass () {
  2069. }
  2070. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2071. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2072. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2073. // Fake root class of the system.
  2074. // Effective superclass of all classes created with `nil subclass: ...`.
  2075. var nilAsClass = this.nilAsClass = {
  2076. fn: SmalltalkRoot,
  2077. a$cls: {fn: SmalltalkClass},
  2078. klass: {fn: SmalltalkClass}
  2079. };
  2080. SmalltalkMetaclass.prototype.meta = true;
  2081. defineMethod(SmalltalkClass, "toString", function () {
  2082. return 'Smalltalk ' + this.name;
  2083. });
  2084. defineMethod(SmalltalkMetaclass, "toString", function () {
  2085. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2086. });
  2087. declareEvent("classAdded");
  2088. defineMethod(SmalltalkClass, "added", function () {
  2089. addSubclass(this);
  2090. emit.classAdded(this);
  2091. });
  2092. declareEvent("classRemoved");
  2093. defineMethod(SmalltalkClass, "removed", function () {
  2094. emit.classRemoved(this);
  2095. removeSubclass(this);
  2096. });
  2097. declareEvent("behaviorMethodAdded");
  2098. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2099. emit.behaviorMethodAdded(method, this);
  2100. });
  2101. declareEvent("behaviorMethodRemove");
  2102. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2103. emit.behaviorMethodRemoved(method, this);
  2104. });
  2105. this.bootstrapHierarchy = function () {
  2106. var nilSubclasses = [globals.ProtoObject];
  2107. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2108. nilSubclasses.forEach(function (each) {
  2109. each.a$cls.superclass = globals.Class;
  2110. addSubclass(each.a$cls);
  2111. });
  2112. };
  2113. /* Smalltalk class creation. A class is an instance of an automatically
  2114. created metaclass object. Newly created classes (not their metaclass)
  2115. should be added to the system, see smalltalk.addClass().
  2116. Superclass linking is *not* handled here, see api.initialize() */
  2117. function classBuilder (className, superclass, iVarNames, fn) {
  2118. var logicalSuperclass = superclass;
  2119. if (superclass == null || superclass.a$nil) {
  2120. superclass = nilAsClass;
  2121. logicalSuperclass = null;
  2122. }
  2123. function klass () {
  2124. var that = metaclass().instanceClass;
  2125. that.superclass = logicalSuperclass;
  2126. that.fn = fn || inherits(function () {
  2127. }, superclass.fn);
  2128. that.iVarNames = iVarNames || [];
  2129. // TODO deprecation helper; remove
  2130. Object.defineProperty(that, "className", {
  2131. get: function () {
  2132. console.warn("Use of .className deprecated, use .name");
  2133. return that.name;
  2134. },
  2135. set: function (v) {
  2136. console.warn("Use of .className= deprecated, use .name=");
  2137. that.name = v;
  2138. }
  2139. });
  2140. that.name = className;
  2141. that.subclasses = [];
  2142. setupMethods(that);
  2143. return that;
  2144. }
  2145. function metaclass () {
  2146. var that = new SmalltalkMetaclass();
  2147. that.superclass = superclass.a$cls;
  2148. that.fn = inherits(function () {
  2149. }, that.superclass.fn);
  2150. that.iVarNames = [];
  2151. that.instanceClass = new that.fn();
  2152. wireKlass(that);
  2153. setupMethods(that);
  2154. return that;
  2155. }
  2156. return {
  2157. name: className,
  2158. make: klass,
  2159. updateExisting: function (klass) {
  2160. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2161. if (iVarNames) klass.iVarNames = iVarNames;
  2162. } else throw new Error("Incompatible change of class: " + klass.name);
  2163. }
  2164. };
  2165. }
  2166. function wireKlass (klass) {
  2167. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2168. value: klass,
  2169. enumerable: false, configurable: true, writable: true
  2170. });
  2171. Object.defineProperty(klass.fn.prototype, "klass", {
  2172. value: klass,
  2173. enumerable: false, configurable: true, writable: true
  2174. });
  2175. }
  2176. this.wireKlass = wireKlass;
  2177. /* Add a class to the system, creating a new one if needed.
  2178. A Package is lazily created if one with given name does not exist. */
  2179. st.addClass = function (className, superclass, iVarNames, category) {
  2180. // While subclassing nil is allowed, it might be an error, so
  2181. // warn about it.
  2182. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2183. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2184. }
  2185. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2186. };
  2187. st.removeClass = removeTraitOrClass;
  2188. function addSubclass (klass) {
  2189. if (klass.superclass) {
  2190. addElement(klass.superclass.subclasses, klass);
  2191. }
  2192. }
  2193. function removeSubclass (klass) {
  2194. if (klass.superclass) {
  2195. removeElement(klass.superclass.subclasses, klass);
  2196. }
  2197. }
  2198. function metaSubclasses (metaclass) {
  2199. return metaclass.instanceClass.subclasses
  2200. .filter(function (each) {
  2201. return !each.meta;
  2202. })
  2203. .map(function (each) {
  2204. return each.a$cls;
  2205. });
  2206. }
  2207. st.metaSubclasses = metaSubclasses;
  2208. st.traverseClassTree = function (klass, fn) {
  2209. var queue = [klass], sentinel = {};
  2210. for (var i = 0; i < queue.length; ++i) {
  2211. var item = queue[i];
  2212. if (fn(item, sentinel) === sentinel) continue;
  2213. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2214. queue.push.apply(queue, subclasses);
  2215. }
  2216. };
  2217. }
  2218. /* Making smalltalk that can load */
  2219. function configureWithHierarchy (brikz) {
  2220. brikz.traits = TraitsBrik;
  2221. brikz.composition = MethodCompositionBrik;
  2222. brikz.classes = ClassesBrik;
  2223. brikz.rebuild();
  2224. }
  2225. return configureWithHierarchy;
  2226. });
  2227. /* ====================================================================
  2228. |
  2229. | Amber Smalltalk
  2230. | http://amber-lang.net
  2231. |
  2232. ======================================================================
  2233. ======================================================================
  2234. |
  2235. | Copyright (c) 2010-2014
  2236. | Nicolas Petton <petton.nicolas@gmail.com>
  2237. |
  2238. | Copyright (c) 2012-2017
  2239. | The Amber team https://lolg.it/org/amber/members
  2240. | Amber contributors (see /CONTRIBUTORS)
  2241. |
  2242. | Amber is released under the MIT license
  2243. |
  2244. | Permission is hereby granted, free of charge, to any person obtaining
  2245. | a copy of this software and associated documentation files (the
  2246. | 'Software'), to deal in the Software without restriction, including
  2247. | without limitation the rights to use, copy, modify, merge, publish,
  2248. | distribute, sublicense, and/or sell copies of the Software, and to
  2249. | permit persons to whom the Software is furnished to do so, subject to
  2250. | the following conditions:
  2251. |
  2252. | The above copyright notice and this permission notice shall be
  2253. | included in all copies or substantial portions of the Software.
  2254. |
  2255. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2256. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2257. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2258. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2259. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2260. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2261. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2262. |
  2263. ==================================================================== */
  2264. //jshint eqnull:true
  2265. define('amber/boot',[
  2266. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2267. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2268. "use strict";
  2269. require(['./kernel-runtime']); // preload
  2270. function SmalltalkInitBrik (brikz, st) {
  2271. var initialized = false;
  2272. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2273. require(['./kernel-runtime'], resolve, reject);
  2274. });
  2275. /* Smalltalk initialization. Called on page load */
  2276. st.initialize = function () {
  2277. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2278. if (initialized) return;
  2279. brikz.classes.bootstrapHierarchy();
  2280. configureWithRuntime(brikz);
  2281. // TODO deprecation helper; remove
  2282. Object.defineProperty(st, "packages", {
  2283. get: function () {
  2284. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2285. return st.packageDescriptors;
  2286. },
  2287. set: function (v) {
  2288. console.trace();
  2289. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2290. }
  2291. });
  2292. brikz.startImage.run();
  2293. initialized = true;
  2294. });
  2295. };
  2296. }
  2297. /* Adds AMD and requirejs related methods to the api */
  2298. function AMDBrik (brikz, st) {
  2299. st.amdRequire = require;
  2300. st.defaultTransportType = st.defaultTransportType || "amd";
  2301. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2302. }
  2303. /* Defines asReceiver to be present at load time */
  2304. /* (logically it belongs more to PrimitiveBrik) */
  2305. AsReceiverBrik.deps = ["nil"];
  2306. function AsReceiverBrik (brikz, st) {
  2307. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2308. /**
  2309. * This function is used all over the compiled amber code.
  2310. * It takes any value (JavaScript or Smalltalk)
  2311. * and returns a proper Amber Smalltalk receiver.
  2312. *
  2313. * null or undefined -> nilAsReceiver,
  2314. * object having Smalltalk signature -> unchanged,
  2315. * otherwise wrapped foreign (JS) object
  2316. */
  2317. this.asReceiver = function (o) {
  2318. if (o == null) return nilAsReceiver;
  2319. else if (o.a$cls != null) return o;
  2320. else return st.wrapJavaScript(o);
  2321. };
  2322. }
  2323. var api = {};
  2324. var brikz = new Brikz(api);
  2325. configureWithFundamentals(brikz);
  2326. configureWithHierarchy(brikz);
  2327. brikz.asReceiver = AsReceiverBrik;
  2328. brikz.stInit = SmalltalkInitBrik;
  2329. brikz.amd = AMDBrik;
  2330. brikz.rebuild();
  2331. return {
  2332. api: api,
  2333. nilAsReceiver: brikz.nil.nilAsReceiver,
  2334. nilAsValue: brikz.nil.nilAsValue,
  2335. nilAsClass: brikz.classes.nilAsClass,
  2336. globals: brikz.smalltalkGlobals.globals,
  2337. asReceiver: brikz.asReceiver.asReceiver
  2338. };
  2339. });
  2340. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2341. var globals = boot.globals,
  2342. exports = {},
  2343. api = boot.api,
  2344. nil = boot.nilAsReceiver;
  2345. // API
  2346. exports.popupHelios = function () {
  2347. require(['helios/index'], function (helios) {
  2348. helios.popup();
  2349. }, function (err) {
  2350. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2351. });
  2352. };
  2353. Object.defineProperty(exports, "api", {
  2354. value: api,
  2355. enumerable: true, configurable: true, writable: false
  2356. });
  2357. Object.defineProperty(exports, "globals", {
  2358. value: globals,
  2359. enumerable: true, configurable: true, writable: false
  2360. });
  2361. Object.defineProperty(exports, "nil", {
  2362. value: nil,
  2363. enumerable: true, configurable: true, writable: false
  2364. });
  2365. function mixinToSettings (source) {
  2366. var settings = globals.SmalltalkSettings;
  2367. Object.keys(source).forEach(function (key) {
  2368. settings[key] = source[key];
  2369. });
  2370. }
  2371. function settingsInLocalStorage () {
  2372. //jshint evil:true
  2373. var storage = 'localStorage' in global && global.localStorage;
  2374. if (storage) {
  2375. var fromStorage;
  2376. try {
  2377. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2378. } catch (ex) {
  2379. // pass
  2380. }
  2381. mixinToSettings(fromStorage || {});
  2382. // TODO find less hackish way to store settings back to storage.
  2383. if (typeof window !== "undefined") {
  2384. requirejs(['jquery'], function ($) {
  2385. $(window).on('beforeunload', function () {
  2386. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2387. });
  2388. });
  2389. }
  2390. }
  2391. }
  2392. exports.initialize = function (options) {
  2393. return Promise.resolve()
  2394. .then(function () {
  2395. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2396. })
  2397. .then(settingsInLocalStorage)
  2398. .then(function () {
  2399. return options || {};
  2400. })
  2401. .then(mixinToSettings)
  2402. .then(function () {
  2403. return api.initialize();
  2404. });
  2405. };
  2406. // Exports
  2407. return exports;
  2408. });
  2409. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2410. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2411. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2412. $core.addPackage("Kernel-Helpers");
  2413. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2414. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2415. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2416. $core.addMethod(
  2417. $core.method({
  2418. selector: "subclass:",
  2419. protocol: "class creation",
  2420. fn: function (aString){
  2421. var self=this,$self=this;
  2422. return $core.withContext(function($ctx1) {
  2423. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2424. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2425. },
  2426. args: ["aString"],
  2427. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2428. referencedClasses: [],
  2429. messageSends: ["subclass:instanceVariableNames:package:"]
  2430. }),
  2431. $globals.TSubclassable);
  2432. $core.addMethod(
  2433. $core.method({
  2434. selector: "subclass:instanceVariableNames:",
  2435. protocol: "class creation",
  2436. fn: function (aString,anotherString){
  2437. var self=this,$self=this;
  2438. return $core.withContext(function($ctx1) {
  2439. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2440. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2441. },
  2442. args: ["aString", "anotherString"],
  2443. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2444. referencedClasses: [],
  2445. messageSends: ["subclass:instanceVariableNames:package:"]
  2446. }),
  2447. $globals.TSubclassable);
  2448. $core.addMethod(
  2449. $core.method({
  2450. selector: "subclass:instanceVariableNames:category:",
  2451. protocol: "class creation",
  2452. fn: function (aString,aString2,aString3){
  2453. var self=this,$self=this;
  2454. return $core.withContext(function($ctx1) {
  2455. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2456. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2457. },
  2458. args: ["aString", "aString2", "aString3"],
  2459. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2460. referencedClasses: [],
  2461. messageSends: ["subclass:instanceVariableNames:package:"]
  2462. }),
  2463. $globals.TSubclassable);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2467. protocol: "class creation",
  2468. fn: function (aString,aString2,classVars,pools,aString3){
  2469. var self=this,$self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2472. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2473. },
  2474. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2475. 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",
  2476. referencedClasses: [],
  2477. messageSends: ["subclass:instanceVariableNames:package:"]
  2478. }),
  2479. $globals.TSubclassable);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "subclass:instanceVariableNames:package:",
  2483. protocol: "class creation",
  2484. fn: function (aString,aString2,aString3){
  2485. var self=this,$self=this;
  2486. return $core.withContext(function($ctx1) {
  2487. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2488. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2489. },
  2490. args: ["aString", "aString2", "aString3"],
  2491. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2492. referencedClasses: ["ClassBuilder"],
  2493. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2494. }),
  2495. $globals.TSubclassable);
  2496. $core.addMethod(
  2497. $core.method({
  2498. selector: "subclass:uses:",
  2499. protocol: "class creation",
  2500. fn: function (aString,aTraitCompositionDescription){
  2501. var self=this,$self=this;
  2502. return $core.withContext(function($ctx1) {
  2503. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2504. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2505. },
  2506. args: ["aString", "aTraitCompositionDescription"],
  2507. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2508. referencedClasses: [],
  2509. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2510. }),
  2511. $globals.TSubclassable);
  2512. $core.addMethod(
  2513. $core.method({
  2514. selector: "subclass:uses:instanceVariableNames:",
  2515. protocol: "class creation",
  2516. fn: function (aString,aTraitCompositionDescription,anotherString){
  2517. var self=this,$self=this;
  2518. return $core.withContext(function($ctx1) {
  2519. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2520. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2521. },
  2522. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2523. 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",
  2524. referencedClasses: [],
  2525. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2526. }),
  2527. $globals.TSubclassable);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "subclass:uses:instanceVariableNames:category:",
  2531. protocol: "class creation",
  2532. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2533. var self=this,$self=this;
  2534. return $core.withContext(function($ctx1) {
  2535. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2536. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2537. },
  2538. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2539. 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",
  2540. referencedClasses: [],
  2541. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2542. }),
  2543. $globals.TSubclassable);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2547. protocol: "class creation",
  2548. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2549. var self=this,$self=this;
  2550. return $core.withContext(function($ctx1) {
  2551. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2552. }, 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)});
  2553. },
  2554. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2555. 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",
  2556. referencedClasses: [],
  2557. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2558. }),
  2559. $globals.TSubclassable);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "subclass:uses:instanceVariableNames:package:",
  2563. protocol: "class creation",
  2564. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2565. var self=this,$self=this;
  2566. var cls;
  2567. return $core.withContext(function($ctx1) {
  2568. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2569. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2570. return cls;
  2571. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2572. },
  2573. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2574. 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",
  2575. referencedClasses: [],
  2576. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2577. }),
  2578. $globals.TSubclassable);
  2579. });
  2580. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2581. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2582. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2583. $core.addPackage("Kernel-Objects");
  2584. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2585. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2586. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2587. $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.";
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "=",
  2591. protocol: "comparing",
  2592. fn: function (anObject){
  2593. var self=this,$self=this;
  2594. return $core.withContext(function($ctx1) {
  2595. return $self.__eq_eq(anObject);
  2596. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2597. },
  2598. args: ["anObject"],
  2599. source: "= anObject\x0a\x09^ self == anObject",
  2600. referencedClasses: [],
  2601. messageSends: ["=="]
  2602. }),
  2603. $globals.ProtoObject);
  2604. $core.addMethod(
  2605. $core.method({
  2606. selector: "==",
  2607. protocol: "comparing",
  2608. fn: function (anObject){
  2609. var self=this,$self=this;
  2610. return $core.withContext(function($ctx1) {
  2611. return self === anObject;
  2612. return self;
  2613. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2614. },
  2615. args: ["anObject"],
  2616. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2617. referencedClasses: [],
  2618. messageSends: []
  2619. }),
  2620. $globals.ProtoObject);
  2621. $core.addMethod(
  2622. $core.method({
  2623. selector: "asJSON",
  2624. protocol: "converting",
  2625. fn: function (){
  2626. var self=this,$self=this;
  2627. return $core.withContext(function($ctx1) {
  2628. $self._deprecatedAPI_("Use #asJavaScriptObject instead.");
  2629. return $self._asJavaScriptObject();
  2630. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.ProtoObject)});
  2631. },
  2632. args: [],
  2633. source: "asJSON\x0a\x09self deprecatedAPI: 'Use #asJavaScriptObject instead.'.\x0a\x09^ self asJavaScriptObject",
  2634. referencedClasses: [],
  2635. messageSends: ["deprecatedAPI:", "asJavaScriptObject"]
  2636. }),
  2637. $globals.ProtoObject);
  2638. $core.addMethod(
  2639. $core.method({
  2640. selector: "asJavascript",
  2641. protocol: "converting",
  2642. fn: function (){
  2643. var self=this,$self=this;
  2644. return $core.withContext(function($ctx1) {
  2645. $self._deprecatedAPI_("Use #asJavaScriptSource instead.");
  2646. return $self._asJavaScriptSource();
  2647. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.ProtoObject)});
  2648. },
  2649. args: [],
  2650. source: "asJavascript\x0a\x09self deprecatedAPI: 'Use #asJavaScriptSource instead.'.\x0a\x09^ self asJavaScriptSource",
  2651. referencedClasses: [],
  2652. messageSends: ["deprecatedAPI:", "asJavaScriptSource"]
  2653. }),
  2654. $globals.ProtoObject);
  2655. $core.addMethod(
  2656. $core.method({
  2657. selector: "asString",
  2658. protocol: "converting",
  2659. fn: function (){
  2660. var self=this,$self=this;
  2661. return $core.withContext(function($ctx1) {
  2662. return $self._printString();
  2663. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2664. },
  2665. args: [],
  2666. source: "asString\x0a\x09^ self printString",
  2667. referencedClasses: [],
  2668. messageSends: ["printString"]
  2669. }),
  2670. $globals.ProtoObject);
  2671. $core.addMethod(
  2672. $core.method({
  2673. selector: "class",
  2674. protocol: "accessing",
  2675. fn: function (){
  2676. var self=this,$self=this;
  2677. return $core.withContext(function($ctx1) {
  2678. return $self.a$cls;
  2679. return self;
  2680. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2681. },
  2682. args: [],
  2683. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2684. referencedClasses: [],
  2685. messageSends: []
  2686. }),
  2687. $globals.ProtoObject);
  2688. $core.addMethod(
  2689. $core.method({
  2690. selector: "doesNotUnderstand:",
  2691. protocol: "error handling",
  2692. fn: function (aMessage){
  2693. var self=this,$self=this;
  2694. return $core.withContext(function($ctx1) {
  2695. var $1;
  2696. $1=$recv($globals.MessageNotUnderstood)._new();
  2697. $recv($1)._receiver_(self);
  2698. $recv($1)._message_(aMessage);
  2699. $recv($1)._signal();
  2700. return self;
  2701. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2702. },
  2703. args: ["aMessage"],
  2704. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2705. referencedClasses: ["MessageNotUnderstood"],
  2706. messageSends: ["receiver:", "new", "message:", "signal"]
  2707. }),
  2708. $globals.ProtoObject);
  2709. $core.addMethod(
  2710. $core.method({
  2711. selector: "evaluate:on:",
  2712. protocol: "evaluating",
  2713. fn: function (aString,anEvaluator){
  2714. var self=this,$self=this;
  2715. return $core.withContext(function($ctx1) {
  2716. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2717. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2718. },
  2719. args: ["aString", "anEvaluator"],
  2720. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2721. referencedClasses: [],
  2722. messageSends: ["evaluate:receiver:"]
  2723. }),
  2724. $globals.ProtoObject);
  2725. $core.addMethod(
  2726. $core.method({
  2727. selector: "identityHash",
  2728. protocol: "accessing",
  2729. fn: function (){
  2730. var self=this,$self=this;
  2731. return $core.withContext(function($ctx1) {
  2732. self._deprecatedAPI();
  2733. var hash=self.identityHash;
  2734. if (hash) return hash;
  2735. hash=$core.nextId();
  2736. Object.defineProperty(self, 'identityHash', {value:hash});
  2737. return hash;
  2738. ;
  2739. return self;
  2740. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2741. },
  2742. args: [],
  2743. 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'>",
  2744. referencedClasses: [],
  2745. messageSends: []
  2746. }),
  2747. $globals.ProtoObject);
  2748. $core.addMethod(
  2749. $core.method({
  2750. selector: "ifNil:",
  2751. protocol: "testing",
  2752. fn: function (aBlock){
  2753. var self=this,$self=this;
  2754. return self;
  2755. },
  2756. args: ["aBlock"],
  2757. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2758. referencedClasses: [],
  2759. messageSends: []
  2760. }),
  2761. $globals.ProtoObject);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: "ifNil:ifNotNil:",
  2765. protocol: "testing",
  2766. fn: function (aBlock,anotherBlock){
  2767. var self=this,$self=this;
  2768. return $core.withContext(function($ctx1) {
  2769. return $recv(anotherBlock)._value_(self);
  2770. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2771. },
  2772. args: ["aBlock", "anotherBlock"],
  2773. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2774. referencedClasses: [],
  2775. messageSends: ["value:"]
  2776. }),
  2777. $globals.ProtoObject);
  2778. $core.addMethod(
  2779. $core.method({
  2780. selector: "ifNotNil:",
  2781. protocol: "testing",
  2782. fn: function (aBlock){
  2783. var self=this,$self=this;
  2784. return $core.withContext(function($ctx1) {
  2785. return $recv(aBlock)._value_(self);
  2786. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2787. },
  2788. args: ["aBlock"],
  2789. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2790. referencedClasses: [],
  2791. messageSends: ["value:"]
  2792. }),
  2793. $globals.ProtoObject);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "ifNotNil:ifNil:",
  2797. protocol: "testing",
  2798. fn: function (aBlock,anotherBlock){
  2799. var self=this,$self=this;
  2800. return $core.withContext(function($ctx1) {
  2801. return $recv(aBlock)._value_(self);
  2802. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2803. },
  2804. args: ["aBlock", "anotherBlock"],
  2805. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2806. referencedClasses: [],
  2807. messageSends: ["value:"]
  2808. }),
  2809. $globals.ProtoObject);
  2810. $core.addMethod(
  2811. $core.method({
  2812. selector: "initialize",
  2813. protocol: "initialization",
  2814. fn: function (){
  2815. var self=this,$self=this;
  2816. return self;
  2817. },
  2818. args: [],
  2819. source: "initialize",
  2820. referencedClasses: [],
  2821. messageSends: []
  2822. }),
  2823. $globals.ProtoObject);
  2824. $core.addMethod(
  2825. $core.method({
  2826. selector: "inspect",
  2827. protocol: "inspecting",
  2828. fn: function (){
  2829. var self=this,$self=this;
  2830. return $core.withContext(function($ctx1) {
  2831. $recv($globals.Inspector)._inspect_(self);
  2832. return self;
  2833. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2834. },
  2835. args: [],
  2836. source: "inspect\x0a\x09Inspector inspect: self",
  2837. referencedClasses: ["Inspector"],
  2838. messageSends: ["inspect:"]
  2839. }),
  2840. $globals.ProtoObject);
  2841. $core.addMethod(
  2842. $core.method({
  2843. selector: "inspectOn:",
  2844. protocol: "inspecting",
  2845. fn: function (anInspector){
  2846. var self=this,$self=this;
  2847. return self;
  2848. },
  2849. args: ["anInspector"],
  2850. source: "inspectOn: anInspector",
  2851. referencedClasses: [],
  2852. messageSends: []
  2853. }),
  2854. $globals.ProtoObject);
  2855. $core.addMethod(
  2856. $core.method({
  2857. selector: "instVarAt:",
  2858. protocol: "accessing",
  2859. fn: function (aString){
  2860. var self=this,$self=this;
  2861. return $core.withContext(function($ctx1) {
  2862. return $self['@'+aString];
  2863. return self;
  2864. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2865. },
  2866. args: ["aString"],
  2867. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2868. referencedClasses: [],
  2869. messageSends: []
  2870. }),
  2871. $globals.ProtoObject);
  2872. $core.addMethod(
  2873. $core.method({
  2874. selector: "instVarAt:put:",
  2875. protocol: "accessing",
  2876. fn: function (aString,anObject){
  2877. var self=this,$self=this;
  2878. return $core.withContext(function($ctx1) {
  2879. $self['@' + aString] = anObject;
  2880. return self;
  2881. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2882. },
  2883. args: ["aString", "anObject"],
  2884. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2885. referencedClasses: [],
  2886. messageSends: []
  2887. }),
  2888. $globals.ProtoObject);
  2889. $core.addMethod(
  2890. $core.method({
  2891. selector: "isKindOf:",
  2892. protocol: "testing",
  2893. fn: function (aClass){
  2894. var self=this,$self=this;
  2895. return $core.withContext(function($ctx1) {
  2896. var $1;
  2897. $1=$self._isMemberOf_(aClass);
  2898. if($core.assert($1)){
  2899. return true;
  2900. } else {
  2901. return $recv($self._class())._inheritsFrom_(aClass);
  2902. }
  2903. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2904. },
  2905. args: ["aClass"],
  2906. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2907. referencedClasses: [],
  2908. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2909. }),
  2910. $globals.ProtoObject);
  2911. $core.addMethod(
  2912. $core.method({
  2913. selector: "isNil",
  2914. protocol: "testing",
  2915. fn: function (){
  2916. var self=this,$self=this;
  2917. return false;
  2918. },
  2919. args: [],
  2920. source: "isNil\x0a\x09^ false",
  2921. referencedClasses: [],
  2922. messageSends: []
  2923. }),
  2924. $globals.ProtoObject);
  2925. $core.addMethod(
  2926. $core.method({
  2927. selector: "notNil",
  2928. protocol: "testing",
  2929. fn: function (){
  2930. var self=this,$self=this;
  2931. return $core.withContext(function($ctx1) {
  2932. return $recv($self._isNil())._not();
  2933. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2934. },
  2935. args: [],
  2936. source: "notNil\x0a\x09^ self isNil not",
  2937. referencedClasses: [],
  2938. messageSends: ["not", "isNil"]
  2939. }),
  2940. $globals.ProtoObject);
  2941. $core.addMethod(
  2942. $core.method({
  2943. selector: "perform:",
  2944. protocol: "message handling",
  2945. fn: function (aString){
  2946. var self=this,$self=this;
  2947. return $core.withContext(function($ctx1) {
  2948. return $self._perform_withArguments_(aString,[]);
  2949. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2950. },
  2951. args: ["aString"],
  2952. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2953. referencedClasses: [],
  2954. messageSends: ["perform:withArguments:"]
  2955. }),
  2956. $globals.ProtoObject);
  2957. $core.addMethod(
  2958. $core.method({
  2959. selector: "perform:withArguments:",
  2960. protocol: "message handling",
  2961. fn: function (aString,aCollection){
  2962. var self=this,$self=this;
  2963. return $core.withContext(function($ctx1) {
  2964. return $core.send2(self, aString, aCollection);
  2965. return self;
  2966. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2967. },
  2968. args: ["aString", "aCollection"],
  2969. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2970. referencedClasses: [],
  2971. messageSends: []
  2972. }),
  2973. $globals.ProtoObject);
  2974. $core.addMethod(
  2975. $core.method({
  2976. selector: "printOn:",
  2977. protocol: "printing",
  2978. fn: function (aStream){
  2979. var self=this,$self=this;
  2980. return $core.withContext(function($ctx1) {
  2981. var $5,$4,$3,$2,$1;
  2982. $5=$self._class();
  2983. $ctx1.sendIdx["class"]=1;
  2984. $4=$recv($5)._name();
  2985. $ctx1.sendIdx["name"]=1;
  2986. $3=$recv($4)._first();
  2987. $2=$recv($3)._isVowel();
  2988. if($core.assert($2)){
  2989. $1="an ";
  2990. } else {
  2991. $1="a ";
  2992. }
  2993. $recv(aStream)._nextPutAll_($1);
  2994. $ctx1.sendIdx["nextPutAll:"]=1;
  2995. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  2996. return self;
  2997. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2998. },
  2999. args: ["aStream"],
  3000. 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",
  3001. referencedClasses: [],
  3002. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3003. }),
  3004. $globals.ProtoObject);
  3005. $core.addMethod(
  3006. $core.method({
  3007. selector: "printString",
  3008. protocol: "printing",
  3009. fn: function (){
  3010. var self=this,$self=this;
  3011. return $core.withContext(function($ctx1) {
  3012. return $recv($globals.String)._streamContents_((function(str){
  3013. return $core.withContext(function($ctx2) {
  3014. return $self._printOn_(str);
  3015. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3016. }));
  3017. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3018. },
  3019. args: [],
  3020. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3021. referencedClasses: ["String"],
  3022. messageSends: ["streamContents:", "printOn:"]
  3023. }),
  3024. $globals.ProtoObject);
  3025. $core.addMethod(
  3026. $core.method({
  3027. selector: "yourself",
  3028. protocol: "accessing",
  3029. fn: function (){
  3030. var self=this,$self=this;
  3031. return self;
  3032. },
  3033. args: [],
  3034. source: "yourself\x0a\x09^ self",
  3035. referencedClasses: [],
  3036. messageSends: []
  3037. }),
  3038. $globals.ProtoObject);
  3039. $core.addMethod(
  3040. $core.method({
  3041. selector: "~=",
  3042. protocol: "comparing",
  3043. fn: function (anObject){
  3044. var self=this,$self=this;
  3045. return $core.withContext(function($ctx1) {
  3046. var $1;
  3047. $1=$recv($self.__eq(anObject)).__eq(false);
  3048. $ctx1.sendIdx["="]=1;
  3049. return $1;
  3050. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3051. },
  3052. args: ["anObject"],
  3053. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3054. referencedClasses: [],
  3055. messageSends: ["="]
  3056. }),
  3057. $globals.ProtoObject);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "~~",
  3061. protocol: "comparing",
  3062. fn: function (anObject){
  3063. var self=this,$self=this;
  3064. return $core.withContext(function($ctx1) {
  3065. return $recv($self.__eq_eq(anObject)).__eq(false);
  3066. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3067. },
  3068. args: ["anObject"],
  3069. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3070. referencedClasses: [],
  3071. messageSends: ["=", "=="]
  3072. }),
  3073. $globals.ProtoObject);
  3074. $core.addMethod(
  3075. $core.method({
  3076. selector: "initialize",
  3077. protocol: "initialization",
  3078. fn: function (){
  3079. var self=this,$self=this;
  3080. return self;
  3081. },
  3082. args: [],
  3083. source: "initialize",
  3084. referencedClasses: [],
  3085. messageSends: []
  3086. }),
  3087. $globals.ProtoObject.a$cls);
  3088. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3089. $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.";
  3090. $core.addMethod(
  3091. $core.method({
  3092. selector: "->",
  3093. protocol: "converting",
  3094. fn: function (anObject){
  3095. var self=this,$self=this;
  3096. return $core.withContext(function($ctx1) {
  3097. return $recv($globals.Association)._key_value_(self,anObject);
  3098. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3099. },
  3100. args: ["anObject"],
  3101. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3102. referencedClasses: ["Association"],
  3103. messageSends: ["key:value:"]
  3104. }),
  3105. $globals.Object);
  3106. $core.addMethod(
  3107. $core.method({
  3108. selector: "asJSONString",
  3109. protocol: "converting",
  3110. fn: function (){
  3111. var self=this,$self=this;
  3112. return $core.withContext(function($ctx1) {
  3113. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3114. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3115. },
  3116. args: [],
  3117. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3118. referencedClasses: ["JSON"],
  3119. messageSends: ["stringify:", "asJavaScriptObject"]
  3120. }),
  3121. $globals.Object);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "asJavaScriptObject",
  3125. protocol: "converting",
  3126. fn: function (){
  3127. var self=this,$self=this;
  3128. var variables;
  3129. return $core.withContext(function($ctx1) {
  3130. variables=$recv($globals.HashedCollection)._new();
  3131. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3132. return $core.withContext(function($ctx2) {
  3133. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3135. }));
  3136. return variables;
  3137. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3138. },
  3139. args: [],
  3140. 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",
  3141. referencedClasses: ["HashedCollection"],
  3142. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3143. }),
  3144. $globals.Object);
  3145. $core.addMethod(
  3146. $core.method({
  3147. selector: "asJavaScriptSource",
  3148. protocol: "converting",
  3149. fn: function (){
  3150. var self=this,$self=this;
  3151. return $core.withContext(function($ctx1) {
  3152. return $self._asString();
  3153. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3154. },
  3155. args: [],
  3156. source: "asJavaScriptSource\x0a\x09^ self asString",
  3157. referencedClasses: [],
  3158. messageSends: ["asString"]
  3159. }),
  3160. $globals.Object);
  3161. $core.addMethod(
  3162. $core.method({
  3163. selector: "basicAt:",
  3164. protocol: "accessing",
  3165. fn: function (aString){
  3166. var self=this,$self=this;
  3167. return $core.withContext(function($ctx1) {
  3168. return self[aString];
  3169. return self;
  3170. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3171. },
  3172. args: ["aString"],
  3173. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3174. referencedClasses: [],
  3175. messageSends: []
  3176. }),
  3177. $globals.Object);
  3178. $core.addMethod(
  3179. $core.method({
  3180. selector: "basicAt:put:",
  3181. protocol: "accessing",
  3182. fn: function (aString,anObject){
  3183. var self=this,$self=this;
  3184. return $core.withContext(function($ctx1) {
  3185. return self[aString] = anObject;
  3186. return self;
  3187. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3188. },
  3189. args: ["aString", "anObject"],
  3190. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3191. referencedClasses: [],
  3192. messageSends: []
  3193. }),
  3194. $globals.Object);
  3195. $core.addMethod(
  3196. $core.method({
  3197. selector: "basicDelete:",
  3198. protocol: "accessing",
  3199. fn: function (aString){
  3200. var self=this,$self=this;
  3201. return $core.withContext(function($ctx1) {
  3202. delete self[aString]; return aString;
  3203. return self;
  3204. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3205. },
  3206. args: ["aString"],
  3207. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3208. referencedClasses: [],
  3209. messageSends: []
  3210. }),
  3211. $globals.Object);
  3212. $core.addMethod(
  3213. $core.method({
  3214. selector: "basicPerform:",
  3215. protocol: "message handling",
  3216. fn: function (aString){
  3217. var self=this,$self=this;
  3218. return $core.withContext(function($ctx1) {
  3219. return $self._basicPerform_withArguments_(aString,[]);
  3220. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3221. },
  3222. args: ["aString"],
  3223. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3224. referencedClasses: [],
  3225. messageSends: ["basicPerform:withArguments:"]
  3226. }),
  3227. $globals.Object);
  3228. $core.addMethod(
  3229. $core.method({
  3230. selector: "basicPerform:withArguments:",
  3231. protocol: "message handling",
  3232. fn: function (aString,aCollection){
  3233. var self=this,$self=this;
  3234. return $core.withContext(function($ctx1) {
  3235. return self[aString].apply(self, aCollection);;
  3236. return self;
  3237. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3238. },
  3239. args: ["aString", "aCollection"],
  3240. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3241. referencedClasses: [],
  3242. messageSends: []
  3243. }),
  3244. $globals.Object);
  3245. $core.addMethod(
  3246. $core.method({
  3247. selector: "browse",
  3248. protocol: "browsing",
  3249. fn: function (){
  3250. var self=this,$self=this;
  3251. return $core.withContext(function($ctx1) {
  3252. $recv($globals.Finder)._findClass_($self._class());
  3253. return self;
  3254. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3255. },
  3256. args: [],
  3257. source: "browse\x0a\x09Finder findClass: self class",
  3258. referencedClasses: ["Finder"],
  3259. messageSends: ["findClass:", "class"]
  3260. }),
  3261. $globals.Object);
  3262. $core.addMethod(
  3263. $core.method({
  3264. selector: "copy",
  3265. protocol: "copying",
  3266. fn: function (){
  3267. var self=this,$self=this;
  3268. return $core.withContext(function($ctx1) {
  3269. return $recv($self._shallowCopy())._postCopy();
  3270. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3271. },
  3272. args: [],
  3273. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3274. referencedClasses: [],
  3275. messageSends: ["postCopy", "shallowCopy"]
  3276. }),
  3277. $globals.Object);
  3278. $core.addMethod(
  3279. $core.method({
  3280. selector: "deepCopy",
  3281. protocol: "copying",
  3282. fn: function (){
  3283. var self=this,$self=this;
  3284. return $core.withContext(function($ctx1) {
  3285. var copy = self.a$cls._new();
  3286. Object.keys(self).forEach(function (i) {
  3287. if(/^@.+/.test(i)) {
  3288. copy[i] = $recv(self[i])._deepCopy();
  3289. }
  3290. });
  3291. return copy;
  3292. ;
  3293. return self;
  3294. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3295. },
  3296. args: [],
  3297. 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'>",
  3298. referencedClasses: [],
  3299. messageSends: []
  3300. }),
  3301. $globals.Object);
  3302. $core.addMethod(
  3303. $core.method({
  3304. selector: "deprecatedAPI",
  3305. protocol: "error handling",
  3306. fn: function (){
  3307. var self=this,$self=this;
  3308. return $core.withContext(function($ctx1) {
  3309. var $1,$6,$5,$4,$8,$7,$3,$2;
  3310. $1=console;
  3311. $6=$core.getThisContext()._home();
  3312. $ctx1.sendIdx["home"]=1;
  3313. $5=$recv($6)._asString();
  3314. $ctx1.sendIdx["asString"]=1;
  3315. $4=$recv($5).__comma(" is deprecated! (in ");
  3316. $8=$recv($core.getThisContext()._home())._home();
  3317. $ctx1.sendIdx["home"]=2;
  3318. $7=$recv($8)._asString();
  3319. $3=$recv($4).__comma($7);
  3320. $ctx1.sendIdx[","]=2;
  3321. $2=$recv($3).__comma(")");
  3322. $ctx1.sendIdx[","]=1;
  3323. $recv($1)._warn_($2);
  3324. return self;
  3325. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3326. },
  3327. args: [],
  3328. 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, ')'.",
  3329. referencedClasses: [],
  3330. messageSends: ["warn:", ",", "asString", "home"]
  3331. }),
  3332. $globals.Object);
  3333. $core.addMethod(
  3334. $core.method({
  3335. selector: "deprecatedAPI:",
  3336. protocol: "error handling",
  3337. fn: function (aString){
  3338. var self=this,$self=this;
  3339. return $core.withContext(function($ctx1) {
  3340. var $1,$6,$5,$4,$8,$7,$3,$2;
  3341. $1=console;
  3342. $6=$core.getThisContext()._home();
  3343. $ctx1.sendIdx["home"]=1;
  3344. $5=$recv($6)._asString();
  3345. $ctx1.sendIdx["asString"]=1;
  3346. $4=$recv($5).__comma(" is deprecated! (in ");
  3347. $8=$recv($core.getThisContext()._home())._home();
  3348. $ctx1.sendIdx["home"]=2;
  3349. $7=$recv($8)._asString();
  3350. $3=$recv($4).__comma($7);
  3351. $ctx1.sendIdx[","]=2;
  3352. $2=$recv($3).__comma(")");
  3353. $ctx1.sendIdx[","]=1;
  3354. $recv($1)._warn_($2);
  3355. $ctx1.sendIdx["warn:"]=1;
  3356. $recv(console)._warn_(aString);
  3357. return self;
  3358. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3359. },
  3360. args: ["aString"],
  3361. 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",
  3362. referencedClasses: [],
  3363. messageSends: ["warn:", ",", "asString", "home"]
  3364. }),
  3365. $globals.Object);
  3366. $core.addMethod(
  3367. $core.method({
  3368. selector: "error:",
  3369. protocol: "error handling",
  3370. fn: function (aString){
  3371. var self=this,$self=this;
  3372. return $core.withContext(function($ctx1) {
  3373. $recv($globals.Error)._signal_(aString);
  3374. return self;
  3375. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3376. },
  3377. args: ["aString"],
  3378. source: "error: aString\x0a\x09Error signal: aString",
  3379. referencedClasses: ["Error"],
  3380. messageSends: ["signal:"]
  3381. }),
  3382. $globals.Object);
  3383. $core.addMethod(
  3384. $core.method({
  3385. selector: "halt",
  3386. protocol: "error handling",
  3387. fn: function (){
  3388. var self=this,$self=this;
  3389. return $core.withContext(function($ctx1) {
  3390. $recv($globals.Halt)._signal();
  3391. return self;
  3392. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3393. },
  3394. args: [],
  3395. source: "halt\x0a\x09Halt signal",
  3396. referencedClasses: ["Halt"],
  3397. messageSends: ["signal"]
  3398. }),
  3399. $globals.Object);
  3400. $core.addMethod(
  3401. $core.method({
  3402. selector: "in:",
  3403. protocol: "evaluating",
  3404. fn: function (aValuable){
  3405. var self=this,$self=this;
  3406. return $core.withContext(function($ctx1) {
  3407. return $recv(aValuable)._value_(self);
  3408. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3409. },
  3410. args: ["aValuable"],
  3411. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3412. referencedClasses: [],
  3413. messageSends: ["value:"]
  3414. }),
  3415. $globals.Object);
  3416. $core.addMethod(
  3417. $core.method({
  3418. selector: "isBehavior",
  3419. protocol: "testing",
  3420. fn: function (){
  3421. var self=this,$self=this;
  3422. return false;
  3423. },
  3424. args: [],
  3425. source: "isBehavior\x0a\x09^ false",
  3426. referencedClasses: [],
  3427. messageSends: []
  3428. }),
  3429. $globals.Object);
  3430. $core.addMethod(
  3431. $core.method({
  3432. selector: "isBoolean",
  3433. protocol: "testing",
  3434. fn: function (){
  3435. var self=this,$self=this;
  3436. return false;
  3437. },
  3438. args: [],
  3439. source: "isBoolean\x0a\x09^ false",
  3440. referencedClasses: [],
  3441. messageSends: []
  3442. }),
  3443. $globals.Object);
  3444. $core.addMethod(
  3445. $core.method({
  3446. selector: "isClass",
  3447. protocol: "testing",
  3448. fn: function (){
  3449. var self=this,$self=this;
  3450. return false;
  3451. },
  3452. args: [],
  3453. source: "isClass\x0a\x09^ false",
  3454. referencedClasses: [],
  3455. messageSends: []
  3456. }),
  3457. $globals.Object);
  3458. $core.addMethod(
  3459. $core.method({
  3460. selector: "isCompiledMethod",
  3461. protocol: "testing",
  3462. fn: function (){
  3463. var self=this,$self=this;
  3464. return false;
  3465. },
  3466. args: [],
  3467. source: "isCompiledMethod\x0a\x09^ false",
  3468. referencedClasses: [],
  3469. messageSends: []
  3470. }),
  3471. $globals.Object);
  3472. $core.addMethod(
  3473. $core.method({
  3474. selector: "isImmutable",
  3475. protocol: "testing",
  3476. fn: function (){
  3477. var self=this,$self=this;
  3478. return false;
  3479. },
  3480. args: [],
  3481. source: "isImmutable\x0a\x09^ false",
  3482. referencedClasses: [],
  3483. messageSends: []
  3484. }),
  3485. $globals.Object);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "isMemberOf:",
  3489. protocol: "testing",
  3490. fn: function (aClass){
  3491. var self=this,$self=this;
  3492. return $core.withContext(function($ctx1) {
  3493. return $recv($self._class()).__eq(aClass);
  3494. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3495. },
  3496. args: ["aClass"],
  3497. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3498. referencedClasses: [],
  3499. messageSends: ["=", "class"]
  3500. }),
  3501. $globals.Object);
  3502. $core.addMethod(
  3503. $core.method({
  3504. selector: "isMetaclass",
  3505. protocol: "testing",
  3506. fn: function (){
  3507. var self=this,$self=this;
  3508. return false;
  3509. },
  3510. args: [],
  3511. source: "isMetaclass\x0a\x09^ false",
  3512. referencedClasses: [],
  3513. messageSends: []
  3514. }),
  3515. $globals.Object);
  3516. $core.addMethod(
  3517. $core.method({
  3518. selector: "isNumber",
  3519. protocol: "testing",
  3520. fn: function (){
  3521. var self=this,$self=this;
  3522. return false;
  3523. },
  3524. args: [],
  3525. source: "isNumber\x0a\x09^ false",
  3526. referencedClasses: [],
  3527. messageSends: []
  3528. }),
  3529. $globals.Object);
  3530. $core.addMethod(
  3531. $core.method({
  3532. selector: "isPackage",
  3533. protocol: "testing",
  3534. fn: function (){
  3535. var self=this,$self=this;
  3536. return false;
  3537. },
  3538. args: [],
  3539. source: "isPackage\x0a\x09^ false",
  3540. referencedClasses: [],
  3541. messageSends: []
  3542. }),
  3543. $globals.Object);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "isParseFailure",
  3547. protocol: "testing",
  3548. fn: function (){
  3549. var self=this,$self=this;
  3550. return false;
  3551. },
  3552. args: [],
  3553. source: "isParseFailure\x0a\x09^ false",
  3554. referencedClasses: [],
  3555. messageSends: []
  3556. }),
  3557. $globals.Object);
  3558. $core.addMethod(
  3559. $core.method({
  3560. selector: "isString",
  3561. protocol: "testing",
  3562. fn: function (){
  3563. var self=this,$self=this;
  3564. return false;
  3565. },
  3566. args: [],
  3567. source: "isString\x0a\x09^ false",
  3568. referencedClasses: [],
  3569. messageSends: []
  3570. }),
  3571. $globals.Object);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "isSymbol",
  3575. protocol: "testing",
  3576. fn: function (){
  3577. var self=this,$self=this;
  3578. return false;
  3579. },
  3580. args: [],
  3581. source: "isSymbol\x0a\x09^ false",
  3582. referencedClasses: [],
  3583. messageSends: []
  3584. }),
  3585. $globals.Object);
  3586. $core.addMethod(
  3587. $core.method({
  3588. selector: "postCopy",
  3589. protocol: "copying",
  3590. fn: function (){
  3591. var self=this,$self=this;
  3592. return self;
  3593. },
  3594. args: [],
  3595. source: "postCopy",
  3596. referencedClasses: [],
  3597. messageSends: []
  3598. }),
  3599. $globals.Object);
  3600. $core.addMethod(
  3601. $core.method({
  3602. selector: "putOn:",
  3603. protocol: "streaming",
  3604. fn: function (aStream){
  3605. var self=this,$self=this;
  3606. return $core.withContext(function($ctx1) {
  3607. $recv(aStream)._nextPut_(self);
  3608. return self;
  3609. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3610. },
  3611. args: ["aStream"],
  3612. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3613. referencedClasses: [],
  3614. messageSends: ["nextPut:"]
  3615. }),
  3616. $globals.Object);
  3617. $core.addMethod(
  3618. $core.method({
  3619. selector: "respondsTo:",
  3620. protocol: "testing",
  3621. fn: function (aSelector){
  3622. var self=this,$self=this;
  3623. return $core.withContext(function($ctx1) {
  3624. return $recv($self._class())._canUnderstand_(aSelector);
  3625. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3626. },
  3627. args: ["aSelector"],
  3628. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3629. referencedClasses: [],
  3630. messageSends: ["canUnderstand:", "class"]
  3631. }),
  3632. $globals.Object);
  3633. $core.addMethod(
  3634. $core.method({
  3635. selector: "shallowCopy",
  3636. protocol: "copying",
  3637. fn: function (){
  3638. var self=this,$self=this;
  3639. return $core.withContext(function($ctx1) {
  3640. var copy = self.a$cls._new();
  3641. Object.keys(self).forEach(function(i) {
  3642. if(/^@.+/.test(i)) {
  3643. copy[i] = self[i];
  3644. }
  3645. });
  3646. return copy;
  3647. ;
  3648. return self;
  3649. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3650. },
  3651. args: [],
  3652. 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'>",
  3653. referencedClasses: [],
  3654. messageSends: []
  3655. }),
  3656. $globals.Object);
  3657. $core.addMethod(
  3658. $core.method({
  3659. selector: "shouldNotImplement",
  3660. protocol: "error handling",
  3661. fn: function (){
  3662. var self=this,$self=this;
  3663. return $core.withContext(function($ctx1) {
  3664. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3665. return self;
  3666. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3667. },
  3668. args: [],
  3669. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3670. referencedClasses: [],
  3671. messageSends: ["error:", ",", "name", "class"]
  3672. }),
  3673. $globals.Object);
  3674. $core.addMethod(
  3675. $core.method({
  3676. selector: "size",
  3677. protocol: "accessing",
  3678. fn: function (){
  3679. var self=this,$self=this;
  3680. return $core.withContext(function($ctx1) {
  3681. $self._error_("Object not indexable");
  3682. return self;
  3683. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3684. },
  3685. args: [],
  3686. source: "size\x0a\x09self error: 'Object not indexable'",
  3687. referencedClasses: [],
  3688. messageSends: ["error:"]
  3689. }),
  3690. $globals.Object);
  3691. $core.addMethod(
  3692. $core.method({
  3693. selector: "subclassResponsibility",
  3694. protocol: "error handling",
  3695. fn: function (){
  3696. var self=this,$self=this;
  3697. return $core.withContext(function($ctx1) {
  3698. $self._error_("This method is a responsibility of a subclass");
  3699. return self;
  3700. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3701. },
  3702. args: [],
  3703. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3704. referencedClasses: [],
  3705. messageSends: ["error:"]
  3706. }),
  3707. $globals.Object);
  3708. $core.addMethod(
  3709. $core.method({
  3710. selector: "value",
  3711. protocol: "evaluating",
  3712. fn: function (){
  3713. var self=this,$self=this;
  3714. return $core.withContext(function($ctx1) {
  3715. return self.valueOf();
  3716. return self;
  3717. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3718. },
  3719. args: [],
  3720. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3721. referencedClasses: [],
  3722. messageSends: []
  3723. }),
  3724. $globals.Object);
  3725. $core.addMethod(
  3726. $core.method({
  3727. selector: "accessorProtocolWith:",
  3728. protocol: "helios",
  3729. fn: function (aGenerator){
  3730. var self=this,$self=this;
  3731. return $core.withContext(function($ctx1) {
  3732. $recv(aGenerator)._accessorProtocolForObject();
  3733. return self;
  3734. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3735. },
  3736. args: ["aGenerator"],
  3737. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3738. referencedClasses: [],
  3739. messageSends: ["accessorProtocolForObject"]
  3740. }),
  3741. $globals.Object.a$cls);
  3742. $core.addMethod(
  3743. $core.method({
  3744. selector: "accessorsSourceCodesWith:",
  3745. protocol: "helios",
  3746. fn: function (aGenerator){
  3747. var self=this,$self=this;
  3748. return $core.withContext(function($ctx1) {
  3749. $recv(aGenerator)._accessorsForObject();
  3750. return self;
  3751. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3752. },
  3753. args: ["aGenerator"],
  3754. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3755. referencedClasses: [],
  3756. messageSends: ["accessorsForObject"]
  3757. }),
  3758. $globals.Object.a$cls);
  3759. $core.addMethod(
  3760. $core.method({
  3761. selector: "initialize",
  3762. protocol: "initialization",
  3763. fn: function (){
  3764. var self=this,$self=this;
  3765. return self;
  3766. },
  3767. args: [],
  3768. source: "initialize\x0a\x09\x22no op\x22",
  3769. referencedClasses: [],
  3770. messageSends: []
  3771. }),
  3772. $globals.Object.a$cls);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "initializeProtocolWith:",
  3776. protocol: "helios",
  3777. fn: function (aGenerator){
  3778. var self=this,$self=this;
  3779. return $core.withContext(function($ctx1) {
  3780. $recv(aGenerator)._initializeProtocolForObject();
  3781. return self;
  3782. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3783. },
  3784. args: ["aGenerator"],
  3785. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3786. referencedClasses: [],
  3787. messageSends: ["initializeProtocolForObject"]
  3788. }),
  3789. $globals.Object.a$cls);
  3790. $core.addMethod(
  3791. $core.method({
  3792. selector: "initializeSourceCodesWith:",
  3793. protocol: "helios",
  3794. fn: function (aGenerator){
  3795. var self=this,$self=this;
  3796. return $core.withContext(function($ctx1) {
  3797. $recv(aGenerator)._initializeForObject();
  3798. return self;
  3799. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3800. },
  3801. args: ["aGenerator"],
  3802. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3803. referencedClasses: [],
  3804. messageSends: ["initializeForObject"]
  3805. }),
  3806. $globals.Object.a$cls);
  3807. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3808. $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: [ ... ]";
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "&",
  3812. protocol: "controlling",
  3813. fn: function (aBoolean){
  3814. var self=this,$self=this;
  3815. return $core.withContext(function($ctx1) {
  3816. if(self == true) {
  3817. return aBoolean;
  3818. } else {
  3819. return false;
  3820. }
  3821. ;
  3822. return self;
  3823. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3824. },
  3825. args: ["aBoolean"],
  3826. 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'>",
  3827. referencedClasses: [],
  3828. messageSends: []
  3829. }),
  3830. $globals.Boolean);
  3831. $core.addMethod(
  3832. $core.method({
  3833. selector: "==",
  3834. protocol: "comparing",
  3835. fn: function (aBoolean){
  3836. var self=this,$self=this;
  3837. return $core.withContext(function($ctx1) {
  3838. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3839. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3840. else return false;;
  3841. return self;
  3842. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3843. },
  3844. args: ["aBoolean"],
  3845. 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'>",
  3846. referencedClasses: [],
  3847. messageSends: []
  3848. }),
  3849. $globals.Boolean);
  3850. $core.addMethod(
  3851. $core.method({
  3852. selector: "and:",
  3853. protocol: "controlling",
  3854. fn: function (aBlock){
  3855. var self=this,$self=this;
  3856. return $core.withContext(function($ctx1) {
  3857. if($core.assert(self)){
  3858. return $recv(aBlock)._value();
  3859. } else {
  3860. return false;
  3861. }
  3862. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3863. },
  3864. args: ["aBlock"],
  3865. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3866. referencedClasses: [],
  3867. messageSends: ["ifTrue:ifFalse:", "value"]
  3868. }),
  3869. $globals.Boolean);
  3870. $core.addMethod(
  3871. $core.method({
  3872. selector: "asBit",
  3873. protocol: "converting",
  3874. fn: function (){
  3875. var self=this,$self=this;
  3876. return $core.withContext(function($ctx1) {
  3877. if($core.assert(self)){
  3878. return (1);
  3879. } else {
  3880. return (0);
  3881. }
  3882. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3883. },
  3884. args: [],
  3885. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3886. referencedClasses: [],
  3887. messageSends: ["ifTrue:ifFalse:"]
  3888. }),
  3889. $globals.Boolean);
  3890. $core.addMethod(
  3891. $core.method({
  3892. selector: "asJavaScriptObject",
  3893. protocol: "converting",
  3894. fn: function (){
  3895. var self=this,$self=this;
  3896. return self;
  3897. },
  3898. args: [],
  3899. source: "asJavaScriptObject\x0a\x09^ self",
  3900. referencedClasses: [],
  3901. messageSends: []
  3902. }),
  3903. $globals.Boolean);
  3904. $core.addMethod(
  3905. $core.method({
  3906. selector: "asString",
  3907. protocol: "converting",
  3908. fn: function (){
  3909. var self=this,$self=this;
  3910. return $core.withContext(function($ctx1) {
  3911. return self.toString();
  3912. return self;
  3913. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3914. },
  3915. args: [],
  3916. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3917. referencedClasses: [],
  3918. messageSends: []
  3919. }),
  3920. $globals.Boolean);
  3921. $core.addMethod(
  3922. $core.method({
  3923. selector: "deepCopy",
  3924. protocol: "copying",
  3925. fn: function (){
  3926. var self=this,$self=this;
  3927. return self;
  3928. },
  3929. args: [],
  3930. source: "deepCopy\x0a\x09^ self",
  3931. referencedClasses: [],
  3932. messageSends: []
  3933. }),
  3934. $globals.Boolean);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "ifFalse:",
  3938. protocol: "controlling",
  3939. fn: function (aBlock){
  3940. var self=this,$self=this;
  3941. return $core.withContext(function($ctx1) {
  3942. return $self._ifTrue_ifFalse_((function(){
  3943. }),aBlock);
  3944. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3945. },
  3946. args: ["aBlock"],
  3947. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3948. referencedClasses: [],
  3949. messageSends: ["ifTrue:ifFalse:"]
  3950. }),
  3951. $globals.Boolean);
  3952. $core.addMethod(
  3953. $core.method({
  3954. selector: "ifFalse:ifTrue:",
  3955. protocol: "controlling",
  3956. fn: function (aBlock,anotherBlock){
  3957. var self=this,$self=this;
  3958. return $core.withContext(function($ctx1) {
  3959. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3960. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3961. },
  3962. args: ["aBlock", "anotherBlock"],
  3963. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3964. referencedClasses: [],
  3965. messageSends: ["ifTrue:ifFalse:"]
  3966. }),
  3967. $globals.Boolean);
  3968. $core.addMethod(
  3969. $core.method({
  3970. selector: "ifTrue:",
  3971. protocol: "controlling",
  3972. fn: function (aBlock){
  3973. var self=this,$self=this;
  3974. return $core.withContext(function($ctx1) {
  3975. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3976. }));
  3977. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3978. },
  3979. args: ["aBlock"],
  3980. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3981. referencedClasses: [],
  3982. messageSends: ["ifTrue:ifFalse:"]
  3983. }),
  3984. $globals.Boolean);
  3985. $core.addMethod(
  3986. $core.method({
  3987. selector: "ifTrue:ifFalse:",
  3988. protocol: "controlling",
  3989. fn: function (aBlock,anotherBlock){
  3990. var self=this,$self=this;
  3991. return $core.withContext(function($ctx1) {
  3992. if(self == true) {
  3993. return aBlock._value();
  3994. } else {
  3995. return anotherBlock._value();
  3996. }
  3997. ;
  3998. return self;
  3999. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4000. },
  4001. args: ["aBlock", "anotherBlock"],
  4002. 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'>",
  4003. referencedClasses: [],
  4004. messageSends: []
  4005. }),
  4006. $globals.Boolean);
  4007. $core.addMethod(
  4008. $core.method({
  4009. selector: "isBoolean",
  4010. protocol: "testing",
  4011. fn: function (){
  4012. var self=this,$self=this;
  4013. return true;
  4014. },
  4015. args: [],
  4016. source: "isBoolean\x0a\x09^ true",
  4017. referencedClasses: [],
  4018. messageSends: []
  4019. }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "isImmutable",
  4024. protocol: "testing",
  4025. fn: function (){
  4026. var self=this,$self=this;
  4027. return true;
  4028. },
  4029. args: [],
  4030. source: "isImmutable\x0a\x09^ true",
  4031. referencedClasses: [],
  4032. messageSends: []
  4033. }),
  4034. $globals.Boolean);
  4035. $core.addMethod(
  4036. $core.method({
  4037. selector: "not",
  4038. protocol: "controlling",
  4039. fn: function (){
  4040. var self=this,$self=this;
  4041. return $core.withContext(function($ctx1) {
  4042. return $self.__eq(false);
  4043. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4044. },
  4045. args: [],
  4046. source: "not\x0a\x09^ self = false",
  4047. referencedClasses: [],
  4048. messageSends: ["="]
  4049. }),
  4050. $globals.Boolean);
  4051. $core.addMethod(
  4052. $core.method({
  4053. selector: "or:",
  4054. protocol: "controlling",
  4055. fn: function (aBlock){
  4056. var self=this,$self=this;
  4057. return $core.withContext(function($ctx1) {
  4058. if($core.assert(self)){
  4059. return true;
  4060. } else {
  4061. return $recv(aBlock)._value();
  4062. }
  4063. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4064. },
  4065. args: ["aBlock"],
  4066. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4067. referencedClasses: [],
  4068. messageSends: ["ifTrue:ifFalse:", "value"]
  4069. }),
  4070. $globals.Boolean);
  4071. $core.addMethod(
  4072. $core.method({
  4073. selector: "printOn:",
  4074. protocol: "printing",
  4075. fn: function (aStream){
  4076. var self=this,$self=this;
  4077. return $core.withContext(function($ctx1) {
  4078. $recv(aStream)._nextPutAll_($self._asString());
  4079. return self;
  4080. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4081. },
  4082. args: ["aStream"],
  4083. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4084. referencedClasses: [],
  4085. messageSends: ["nextPutAll:", "asString"]
  4086. }),
  4087. $globals.Boolean);
  4088. $core.addMethod(
  4089. $core.method({
  4090. selector: "shallowCopy",
  4091. protocol: "copying",
  4092. fn: function (){
  4093. var self=this,$self=this;
  4094. return self;
  4095. },
  4096. args: [],
  4097. source: "shallowCopy\x0a\x09^ self",
  4098. referencedClasses: [],
  4099. messageSends: []
  4100. }),
  4101. $globals.Boolean);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "|",
  4105. protocol: "controlling",
  4106. fn: function (aBoolean){
  4107. var self=this,$self=this;
  4108. return $core.withContext(function($ctx1) {
  4109. if(self == true) {
  4110. return true;
  4111. } else {
  4112. return aBoolean;
  4113. }
  4114. ;
  4115. return self;
  4116. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4117. },
  4118. args: ["aBoolean"],
  4119. 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'>",
  4120. referencedClasses: [],
  4121. messageSends: []
  4122. }),
  4123. $globals.Boolean);
  4124. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4125. $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.).";
  4126. $core.addMethod(
  4127. $core.method({
  4128. selector: "+",
  4129. protocol: "arithmetic",
  4130. fn: function (aDate){
  4131. var self=this,$self=this;
  4132. return $core.withContext(function($ctx1) {
  4133. return self + aDate;
  4134. return self;
  4135. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4136. },
  4137. args: ["aDate"],
  4138. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4139. referencedClasses: [],
  4140. messageSends: []
  4141. }),
  4142. $globals.Date);
  4143. $core.addMethod(
  4144. $core.method({
  4145. selector: "-",
  4146. protocol: "arithmetic",
  4147. fn: function (aDate){
  4148. var self=this,$self=this;
  4149. return $core.withContext(function($ctx1) {
  4150. return self - aDate;
  4151. return self;
  4152. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4153. },
  4154. args: ["aDate"],
  4155. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4156. referencedClasses: [],
  4157. messageSends: []
  4158. }),
  4159. $globals.Date);
  4160. $core.addMethod(
  4161. $core.method({
  4162. selector: "<",
  4163. protocol: "comparing",
  4164. fn: function (aDate){
  4165. var self=this,$self=this;
  4166. return $core.withContext(function($ctx1) {
  4167. return self < aDate;
  4168. return self;
  4169. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4170. },
  4171. args: ["aDate"],
  4172. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4173. referencedClasses: [],
  4174. messageSends: []
  4175. }),
  4176. $globals.Date);
  4177. $core.addMethod(
  4178. $core.method({
  4179. selector: "<=",
  4180. protocol: "comparing",
  4181. fn: function (aDate){
  4182. var self=this,$self=this;
  4183. return $core.withContext(function($ctx1) {
  4184. return self <= aDate;
  4185. return self;
  4186. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4187. },
  4188. args: ["aDate"],
  4189. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4190. referencedClasses: [],
  4191. messageSends: []
  4192. }),
  4193. $globals.Date);
  4194. $core.addMethod(
  4195. $core.method({
  4196. selector: "=",
  4197. protocol: "comparing",
  4198. fn: function (aDate){
  4199. var self=this,$self=this;
  4200. return $core.withContext(function($ctx1) {
  4201. var $2,$1,$3;
  4202. $2=$recv(aDate)._class();
  4203. $ctx1.sendIdx["class"]=1;
  4204. $1=$recv($2).__eq_eq($self._class());
  4205. $ctx1.sendIdx["=="]=1;
  4206. return $recv($1)._and_((function(){
  4207. return $core.withContext(function($ctx2) {
  4208. $3=$self._asMilliseconds();
  4209. $ctx2.sendIdx["asMilliseconds"]=1;
  4210. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4212. }));
  4213. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4214. },
  4215. args: ["aDate"],
  4216. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4217. referencedClasses: [],
  4218. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4219. }),
  4220. $globals.Date);
  4221. $core.addMethod(
  4222. $core.method({
  4223. selector: ">",
  4224. protocol: "comparing",
  4225. fn: function (aDate){
  4226. var self=this,$self=this;
  4227. return $core.withContext(function($ctx1) {
  4228. return self > aDate;
  4229. return self;
  4230. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4231. },
  4232. args: ["aDate"],
  4233. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4234. referencedClasses: [],
  4235. messageSends: []
  4236. }),
  4237. $globals.Date);
  4238. $core.addMethod(
  4239. $core.method({
  4240. selector: ">=",
  4241. protocol: "comparing",
  4242. fn: function (aDate){
  4243. var self=this,$self=this;
  4244. return $core.withContext(function($ctx1) {
  4245. return self >= aDate;
  4246. return self;
  4247. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4248. },
  4249. args: ["aDate"],
  4250. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4251. referencedClasses: [],
  4252. messageSends: []
  4253. }),
  4254. $globals.Date);
  4255. $core.addMethod(
  4256. $core.method({
  4257. selector: "asDateString",
  4258. protocol: "converting",
  4259. fn: function (){
  4260. var self=this,$self=this;
  4261. return $core.withContext(function($ctx1) {
  4262. return self.toDateString();
  4263. return self;
  4264. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4265. },
  4266. args: [],
  4267. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4268. referencedClasses: [],
  4269. messageSends: []
  4270. }),
  4271. $globals.Date);
  4272. $core.addMethod(
  4273. $core.method({
  4274. selector: "asLocaleString",
  4275. protocol: "converting",
  4276. fn: function (){
  4277. var self=this,$self=this;
  4278. return $core.withContext(function($ctx1) {
  4279. return self.toLocaleString();
  4280. return self;
  4281. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4282. },
  4283. args: [],
  4284. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4285. referencedClasses: [],
  4286. messageSends: []
  4287. }),
  4288. $globals.Date);
  4289. $core.addMethod(
  4290. $core.method({
  4291. selector: "asMilliseconds",
  4292. protocol: "converting",
  4293. fn: function (){
  4294. var self=this,$self=this;
  4295. return $core.withContext(function($ctx1) {
  4296. return $self._time();
  4297. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4298. },
  4299. args: [],
  4300. source: "asMilliseconds\x0a\x09^ self time",
  4301. referencedClasses: [],
  4302. messageSends: ["time"]
  4303. }),
  4304. $globals.Date);
  4305. $core.addMethod(
  4306. $core.method({
  4307. selector: "asNumber",
  4308. protocol: "converting",
  4309. fn: function (){
  4310. var self=this,$self=this;
  4311. return $core.withContext(function($ctx1) {
  4312. return $self._asMilliseconds();
  4313. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4314. },
  4315. args: [],
  4316. source: "asNumber\x0a\x09^ self asMilliseconds",
  4317. referencedClasses: [],
  4318. messageSends: ["asMilliseconds"]
  4319. }),
  4320. $globals.Date);
  4321. $core.addMethod(
  4322. $core.method({
  4323. selector: "asString",
  4324. protocol: "converting",
  4325. fn: function (){
  4326. var self=this,$self=this;
  4327. return $core.withContext(function($ctx1) {
  4328. return self.toString();
  4329. return self;
  4330. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4331. },
  4332. args: [],
  4333. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4334. referencedClasses: [],
  4335. messageSends: []
  4336. }),
  4337. $globals.Date);
  4338. $core.addMethod(
  4339. $core.method({
  4340. selector: "asTimeString",
  4341. protocol: "converting",
  4342. fn: function (){
  4343. var self=this,$self=this;
  4344. return $core.withContext(function($ctx1) {
  4345. return self.toTimeString();
  4346. return self;
  4347. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4348. },
  4349. args: [],
  4350. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4351. referencedClasses: [],
  4352. messageSends: []
  4353. }),
  4354. $globals.Date);
  4355. $core.addMethod(
  4356. $core.method({
  4357. selector: "day",
  4358. protocol: "accessing",
  4359. fn: function (){
  4360. var self=this,$self=this;
  4361. return $core.withContext(function($ctx1) {
  4362. return $self._dayOfWeek();
  4363. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4364. },
  4365. args: [],
  4366. source: "day\x0a\x09^ self dayOfWeek",
  4367. referencedClasses: [],
  4368. messageSends: ["dayOfWeek"]
  4369. }),
  4370. $globals.Date);
  4371. $core.addMethod(
  4372. $core.method({
  4373. selector: "day:",
  4374. protocol: "accessing",
  4375. fn: function (aNumber){
  4376. var self=this,$self=this;
  4377. return $core.withContext(function($ctx1) {
  4378. $self._dayOfWeek_(aNumber);
  4379. return self;
  4380. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4381. },
  4382. args: ["aNumber"],
  4383. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4384. referencedClasses: [],
  4385. messageSends: ["dayOfWeek:"]
  4386. }),
  4387. $globals.Date);
  4388. $core.addMethod(
  4389. $core.method({
  4390. selector: "dayOfMonth",
  4391. protocol: "accessing",
  4392. fn: function (){
  4393. var self=this,$self=this;
  4394. return $core.withContext(function($ctx1) {
  4395. return self.getDate();
  4396. return self;
  4397. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4398. },
  4399. args: [],
  4400. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4401. referencedClasses: [],
  4402. messageSends: []
  4403. }),
  4404. $globals.Date);
  4405. $core.addMethod(
  4406. $core.method({
  4407. selector: "dayOfMonth:",
  4408. protocol: "accessing",
  4409. fn: function (aNumber){
  4410. var self=this,$self=this;
  4411. return $core.withContext(function($ctx1) {
  4412. self.setDate(aNumber);
  4413. return self;
  4414. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4415. },
  4416. args: ["aNumber"],
  4417. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4418. referencedClasses: [],
  4419. messageSends: []
  4420. }),
  4421. $globals.Date);
  4422. $core.addMethod(
  4423. $core.method({
  4424. selector: "dayOfWeek",
  4425. protocol: "accessing",
  4426. fn: function (){
  4427. var self=this,$self=this;
  4428. return $core.withContext(function($ctx1) {
  4429. return self.getDay() + 1;
  4430. return self;
  4431. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4432. },
  4433. args: [],
  4434. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4435. referencedClasses: [],
  4436. messageSends: []
  4437. }),
  4438. $globals.Date);
  4439. $core.addMethod(
  4440. $core.method({
  4441. selector: "dayOfWeek:",
  4442. protocol: "accessing",
  4443. fn: function (aNumber){
  4444. var self=this,$self=this;
  4445. return $core.withContext(function($ctx1) {
  4446. return self.setDay(aNumber - 1);
  4447. return self;
  4448. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4449. },
  4450. args: ["aNumber"],
  4451. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4452. referencedClasses: [],
  4453. messageSends: []
  4454. }),
  4455. $globals.Date);
  4456. $core.addMethod(
  4457. $core.method({
  4458. selector: "hours",
  4459. protocol: "accessing",
  4460. fn: function (){
  4461. var self=this,$self=this;
  4462. return $core.withContext(function($ctx1) {
  4463. return self.getHours();
  4464. return self;
  4465. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4466. },
  4467. args: [],
  4468. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4469. referencedClasses: [],
  4470. messageSends: []
  4471. }),
  4472. $globals.Date);
  4473. $core.addMethod(
  4474. $core.method({
  4475. selector: "hours:",
  4476. protocol: "accessing",
  4477. fn: function (aNumber){
  4478. var self=this,$self=this;
  4479. return $core.withContext(function($ctx1) {
  4480. self.setHours(aNumber);
  4481. return self;
  4482. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4483. },
  4484. args: ["aNumber"],
  4485. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4486. referencedClasses: [],
  4487. messageSends: []
  4488. }),
  4489. $globals.Date);
  4490. $core.addMethod(
  4491. $core.method({
  4492. selector: "milliseconds",
  4493. protocol: "accessing",
  4494. fn: function (){
  4495. var self=this,$self=this;
  4496. return $core.withContext(function($ctx1) {
  4497. return self.getMilliseconds();
  4498. return self;
  4499. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4500. },
  4501. args: [],
  4502. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4503. referencedClasses: [],
  4504. messageSends: []
  4505. }),
  4506. $globals.Date);
  4507. $core.addMethod(
  4508. $core.method({
  4509. selector: "milliseconds:",
  4510. protocol: "accessing",
  4511. fn: function (aNumber){
  4512. var self=this,$self=this;
  4513. return $core.withContext(function($ctx1) {
  4514. self.setMilliseconds(aNumber);
  4515. return self;
  4516. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4517. },
  4518. args: ["aNumber"],
  4519. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4520. referencedClasses: [],
  4521. messageSends: []
  4522. }),
  4523. $globals.Date);
  4524. $core.addMethod(
  4525. $core.method({
  4526. selector: "minutes",
  4527. protocol: "accessing",
  4528. fn: function (){
  4529. var self=this,$self=this;
  4530. return $core.withContext(function($ctx1) {
  4531. return self.getMinutes();
  4532. return self;
  4533. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4534. },
  4535. args: [],
  4536. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4537. referencedClasses: [],
  4538. messageSends: []
  4539. }),
  4540. $globals.Date);
  4541. $core.addMethod(
  4542. $core.method({
  4543. selector: "minutes:",
  4544. protocol: "accessing",
  4545. fn: function (aNumber){
  4546. var self=this,$self=this;
  4547. return $core.withContext(function($ctx1) {
  4548. self.setMinutes(aNumber);
  4549. return self;
  4550. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4551. },
  4552. args: ["aNumber"],
  4553. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4554. referencedClasses: [],
  4555. messageSends: []
  4556. }),
  4557. $globals.Date);
  4558. $core.addMethod(
  4559. $core.method({
  4560. selector: "month",
  4561. protocol: "accessing",
  4562. fn: function (){
  4563. var self=this,$self=this;
  4564. return $core.withContext(function($ctx1) {
  4565. return self.getMonth() + 1;
  4566. return self;
  4567. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4568. },
  4569. args: [],
  4570. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4571. referencedClasses: [],
  4572. messageSends: []
  4573. }),
  4574. $globals.Date);
  4575. $core.addMethod(
  4576. $core.method({
  4577. selector: "month:",
  4578. protocol: "accessing",
  4579. fn: function (aNumber){
  4580. var self=this,$self=this;
  4581. return $core.withContext(function($ctx1) {
  4582. self.setMonth(aNumber - 1);
  4583. return self;
  4584. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4585. },
  4586. args: ["aNumber"],
  4587. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4588. referencedClasses: [],
  4589. messageSends: []
  4590. }),
  4591. $globals.Date);
  4592. $core.addMethod(
  4593. $core.method({
  4594. selector: "printOn:",
  4595. protocol: "printing",
  4596. fn: function (aStream){
  4597. var self=this,$self=this;
  4598. return $core.withContext(function($ctx1) {
  4599. $recv(aStream)._nextPutAll_($self._asString());
  4600. return self;
  4601. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4602. },
  4603. args: ["aStream"],
  4604. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4605. referencedClasses: [],
  4606. messageSends: ["nextPutAll:", "asString"]
  4607. }),
  4608. $globals.Date);
  4609. $core.addMethod(
  4610. $core.method({
  4611. selector: "seconds",
  4612. protocol: "accessing",
  4613. fn: function (){
  4614. var self=this,$self=this;
  4615. return $core.withContext(function($ctx1) {
  4616. return self.getSeconds();
  4617. return self;
  4618. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4619. },
  4620. args: [],
  4621. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4622. referencedClasses: [],
  4623. messageSends: []
  4624. }),
  4625. $globals.Date);
  4626. $core.addMethod(
  4627. $core.method({
  4628. selector: "seconds:",
  4629. protocol: "accessing",
  4630. fn: function (aNumber){
  4631. var self=this,$self=this;
  4632. return $core.withContext(function($ctx1) {
  4633. self.setSeconds(aNumber);
  4634. return self;
  4635. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4636. },
  4637. args: ["aNumber"],
  4638. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4639. referencedClasses: [],
  4640. messageSends: []
  4641. }),
  4642. $globals.Date);
  4643. $core.addMethod(
  4644. $core.method({
  4645. selector: "time",
  4646. protocol: "accessing",
  4647. fn: function (){
  4648. var self=this,$self=this;
  4649. return $core.withContext(function($ctx1) {
  4650. return self.getTime();
  4651. return self;
  4652. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4653. },
  4654. args: [],
  4655. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4656. referencedClasses: [],
  4657. messageSends: []
  4658. }),
  4659. $globals.Date);
  4660. $core.addMethod(
  4661. $core.method({
  4662. selector: "time:",
  4663. protocol: "accessing",
  4664. fn: function (aNumber){
  4665. var self=this,$self=this;
  4666. return $core.withContext(function($ctx1) {
  4667. self.setTime(aNumber);
  4668. return self;
  4669. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4670. },
  4671. args: ["aNumber"],
  4672. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4673. referencedClasses: [],
  4674. messageSends: []
  4675. }),
  4676. $globals.Date);
  4677. $core.addMethod(
  4678. $core.method({
  4679. selector: "year",
  4680. protocol: "accessing",
  4681. fn: function (){
  4682. var self=this,$self=this;
  4683. return $core.withContext(function($ctx1) {
  4684. return self.getFullYear();
  4685. return self;
  4686. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4687. },
  4688. args: [],
  4689. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4690. referencedClasses: [],
  4691. messageSends: []
  4692. }),
  4693. $globals.Date);
  4694. $core.addMethod(
  4695. $core.method({
  4696. selector: "year:",
  4697. protocol: "accessing",
  4698. fn: function (aNumber){
  4699. var self=this,$self=this;
  4700. return $core.withContext(function($ctx1) {
  4701. self.setFullYear(aNumber);
  4702. return self;
  4703. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4704. },
  4705. args: ["aNumber"],
  4706. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4707. referencedClasses: [],
  4708. messageSends: []
  4709. }),
  4710. $globals.Date);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "classTag",
  4714. protocol: "accessing",
  4715. fn: function (){
  4716. var self=this,$self=this;
  4717. return "magnitude";
  4718. },
  4719. args: [],
  4720. 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'",
  4721. referencedClasses: [],
  4722. messageSends: []
  4723. }),
  4724. $globals.Date.a$cls);
  4725. $core.addMethod(
  4726. $core.method({
  4727. selector: "fromMilliseconds:",
  4728. protocol: "instance creation",
  4729. fn: function (aNumber){
  4730. var self=this,$self=this;
  4731. return $core.withContext(function($ctx1) {
  4732. return $self._new_(aNumber);
  4733. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4734. },
  4735. args: ["aNumber"],
  4736. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4737. referencedClasses: [],
  4738. messageSends: ["new:"]
  4739. }),
  4740. $globals.Date.a$cls);
  4741. $core.addMethod(
  4742. $core.method({
  4743. selector: "fromSeconds:",
  4744. protocol: "instance creation",
  4745. fn: function (aNumber){
  4746. var self=this,$self=this;
  4747. return $core.withContext(function($ctx1) {
  4748. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4749. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4750. },
  4751. args: ["aNumber"],
  4752. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4753. referencedClasses: [],
  4754. messageSends: ["fromMilliseconds:", "*"]
  4755. }),
  4756. $globals.Date.a$cls);
  4757. $core.addMethod(
  4758. $core.method({
  4759. selector: "fromString:",
  4760. protocol: "instance creation",
  4761. fn: function (aString){
  4762. var self=this,$self=this;
  4763. return $core.withContext(function($ctx1) {
  4764. return $self._new_(aString);
  4765. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4766. },
  4767. args: ["aString"],
  4768. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4769. referencedClasses: [],
  4770. messageSends: ["new:"]
  4771. }),
  4772. $globals.Date.a$cls);
  4773. $core.addMethod(
  4774. $core.method({
  4775. selector: "millisecondsToRun:",
  4776. protocol: "instance creation",
  4777. fn: function (aBlock){
  4778. var self=this,$self=this;
  4779. var t;
  4780. return $core.withContext(function($ctx1) {
  4781. t=$recv($globals.Date)._now();
  4782. $ctx1.sendIdx["now"]=1;
  4783. $recv(aBlock)._value();
  4784. return $recv($recv($globals.Date)._now()).__minus(t);
  4785. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4786. },
  4787. args: ["aBlock"],
  4788. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4789. referencedClasses: ["Date"],
  4790. messageSends: ["now", "value", "-"]
  4791. }),
  4792. $globals.Date.a$cls);
  4793. $core.addMethod(
  4794. $core.method({
  4795. selector: "new:",
  4796. protocol: "instance creation",
  4797. fn: function (anObject){
  4798. var self=this,$self=this;
  4799. return $core.withContext(function($ctx1) {
  4800. return new Date(anObject);
  4801. return self;
  4802. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4803. },
  4804. args: ["anObject"],
  4805. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4806. referencedClasses: [],
  4807. messageSends: []
  4808. }),
  4809. $globals.Date.a$cls);
  4810. $core.addMethod(
  4811. $core.method({
  4812. selector: "now",
  4813. protocol: "instance creation",
  4814. fn: function (){
  4815. var self=this,$self=this;
  4816. return $core.withContext(function($ctx1) {
  4817. return $self._today();
  4818. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4819. },
  4820. args: [],
  4821. source: "now\x0a\x09^ self today",
  4822. referencedClasses: [],
  4823. messageSends: ["today"]
  4824. }),
  4825. $globals.Date.a$cls);
  4826. $core.addMethod(
  4827. $core.method({
  4828. selector: "today",
  4829. protocol: "instance creation",
  4830. fn: function (){
  4831. var self=this,$self=this;
  4832. return $core.withContext(function($ctx1) {
  4833. return $self._new();
  4834. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4835. },
  4836. args: [],
  4837. source: "today\x0a\x09^ self new",
  4838. referencedClasses: [],
  4839. messageSends: ["new"]
  4840. }),
  4841. $globals.Date.a$cls);
  4842. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4843. $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 ].";
  4844. $core.addMethod(
  4845. $core.method({
  4846. selector: "&",
  4847. protocol: "converting",
  4848. fn: function (aNumber){
  4849. var self=this,$self=this;
  4850. return $core.withContext(function($ctx1) {
  4851. return self & aNumber;
  4852. return self;
  4853. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4854. },
  4855. args: ["aNumber"],
  4856. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4857. referencedClasses: [],
  4858. messageSends: []
  4859. }),
  4860. $globals.Number);
  4861. $core.addMethod(
  4862. $core.method({
  4863. selector: "*",
  4864. protocol: "arithmetic",
  4865. fn: function (aNumber){
  4866. var self=this,$self=this;
  4867. return $core.withContext(function($ctx1) {
  4868. return self * aNumber;
  4869. return self;
  4870. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4871. },
  4872. args: ["aNumber"],
  4873. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4874. referencedClasses: [],
  4875. messageSends: []
  4876. }),
  4877. $globals.Number);
  4878. $core.addMethod(
  4879. $core.method({
  4880. selector: "**",
  4881. protocol: "mathematical functions",
  4882. fn: function (exponent){
  4883. var self=this,$self=this;
  4884. return $core.withContext(function($ctx1) {
  4885. return $self._raisedTo_(exponent);
  4886. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4887. },
  4888. args: ["exponent"],
  4889. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4890. referencedClasses: [],
  4891. messageSends: ["raisedTo:"]
  4892. }),
  4893. $globals.Number);
  4894. $core.addMethod(
  4895. $core.method({
  4896. selector: "+",
  4897. protocol: "arithmetic",
  4898. fn: function (aNumber){
  4899. var self=this,$self=this;
  4900. return $core.withContext(function($ctx1) {
  4901. return self + aNumber;
  4902. return self;
  4903. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4904. },
  4905. args: ["aNumber"],
  4906. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4907. referencedClasses: [],
  4908. messageSends: []
  4909. }),
  4910. $globals.Number);
  4911. $core.addMethod(
  4912. $core.method({
  4913. selector: "-",
  4914. protocol: "arithmetic",
  4915. fn: function (aNumber){
  4916. var self=this,$self=this;
  4917. return $core.withContext(function($ctx1) {
  4918. return self - aNumber;
  4919. return self;
  4920. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4921. },
  4922. args: ["aNumber"],
  4923. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4924. referencedClasses: [],
  4925. messageSends: []
  4926. }),
  4927. $globals.Number);
  4928. $core.addMethod(
  4929. $core.method({
  4930. selector: "/",
  4931. protocol: "arithmetic",
  4932. fn: function (aNumber){
  4933. var self=this,$self=this;
  4934. return $core.withContext(function($ctx1) {
  4935. return self / aNumber;
  4936. return self;
  4937. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4938. },
  4939. args: ["aNumber"],
  4940. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4941. referencedClasses: [],
  4942. messageSends: []
  4943. }),
  4944. $globals.Number);
  4945. $core.addMethod(
  4946. $core.method({
  4947. selector: "//",
  4948. protocol: "arithmetic",
  4949. fn: function (aNumber){
  4950. var self=this,$self=this;
  4951. return $core.withContext(function($ctx1) {
  4952. return $recv($self.__slash(aNumber))._floor();
  4953. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4954. },
  4955. args: ["aNumber"],
  4956. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4957. referencedClasses: [],
  4958. messageSends: ["floor", "/"]
  4959. }),
  4960. $globals.Number);
  4961. $core.addMethod(
  4962. $core.method({
  4963. selector: "<",
  4964. protocol: "comparing",
  4965. fn: function (aNumber){
  4966. var self=this,$self=this;
  4967. return $core.withContext(function($ctx1) {
  4968. return self < aNumber;
  4969. return self;
  4970. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4971. },
  4972. args: ["aNumber"],
  4973. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4974. referencedClasses: [],
  4975. messageSends: []
  4976. }),
  4977. $globals.Number);
  4978. $core.addMethod(
  4979. $core.method({
  4980. selector: "<=",
  4981. protocol: "comparing",
  4982. fn: function (aNumber){
  4983. var self=this,$self=this;
  4984. return $core.withContext(function($ctx1) {
  4985. return self <= aNumber;
  4986. return self;
  4987. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4988. },
  4989. args: ["aNumber"],
  4990. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4991. referencedClasses: [],
  4992. messageSends: []
  4993. }),
  4994. $globals.Number);
  4995. $core.addMethod(
  4996. $core.method({
  4997. selector: "==",
  4998. protocol: "comparing",
  4999. fn: function (aNumber){
  5000. var self=this,$self=this;
  5001. return $core.withContext(function($ctx1) {
  5002. if (typeof aNumber === "number") return Number(self) === aNumber;
  5003. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5004. else return false;;
  5005. return self;
  5006. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5007. },
  5008. args: ["aNumber"],
  5009. 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'>",
  5010. referencedClasses: [],
  5011. messageSends: []
  5012. }),
  5013. $globals.Number);
  5014. $core.addMethod(
  5015. $core.method({
  5016. selector: ">",
  5017. protocol: "comparing",
  5018. fn: function (aNumber){
  5019. var self=this,$self=this;
  5020. return $core.withContext(function($ctx1) {
  5021. return self > aNumber;
  5022. return self;
  5023. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5024. },
  5025. args: ["aNumber"],
  5026. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5027. referencedClasses: [],
  5028. messageSends: []
  5029. }),
  5030. $globals.Number);
  5031. $core.addMethod(
  5032. $core.method({
  5033. selector: ">=",
  5034. protocol: "comparing",
  5035. fn: function (aNumber){
  5036. var self=this,$self=this;
  5037. return $core.withContext(function($ctx1) {
  5038. return self >= aNumber;
  5039. return self;
  5040. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5041. },
  5042. args: ["aNumber"],
  5043. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5044. referencedClasses: [],
  5045. messageSends: []
  5046. }),
  5047. $globals.Number);
  5048. $core.addMethod(
  5049. $core.method({
  5050. selector: "@",
  5051. protocol: "converting",
  5052. fn: function (aNumber){
  5053. var self=this,$self=this;
  5054. return $core.withContext(function($ctx1) {
  5055. return $recv($globals.Point)._x_y_(self,aNumber);
  5056. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5057. },
  5058. args: ["aNumber"],
  5059. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5060. referencedClasses: ["Point"],
  5061. messageSends: ["x:y:"]
  5062. }),
  5063. $globals.Number);
  5064. $core.addMethod(
  5065. $core.method({
  5066. selector: "\x5c\x5c",
  5067. protocol: "arithmetic",
  5068. fn: function (aNumber){
  5069. var self=this,$self=this;
  5070. return $core.withContext(function($ctx1) {
  5071. return self % aNumber;
  5072. return self;
  5073. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5074. },
  5075. args: ["aNumber"],
  5076. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5077. referencedClasses: [],
  5078. messageSends: []
  5079. }),
  5080. $globals.Number);
  5081. $core.addMethod(
  5082. $core.method({
  5083. selector: "abs",
  5084. protocol: "arithmetic",
  5085. fn: function (){
  5086. var self=this,$self=this;
  5087. return $core.withContext(function($ctx1) {
  5088. return Math.abs(self);;
  5089. return self;
  5090. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5091. },
  5092. args: [],
  5093. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5094. referencedClasses: [],
  5095. messageSends: []
  5096. }),
  5097. $globals.Number);
  5098. $core.addMethod(
  5099. $core.method({
  5100. selector: "arcCos",
  5101. protocol: "mathematical functions",
  5102. fn: function (){
  5103. var self=this,$self=this;
  5104. return $core.withContext(function($ctx1) {
  5105. return Math.acos(self);;
  5106. return self;
  5107. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5108. },
  5109. args: [],
  5110. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5111. referencedClasses: [],
  5112. messageSends: []
  5113. }),
  5114. $globals.Number);
  5115. $core.addMethod(
  5116. $core.method({
  5117. selector: "arcSin",
  5118. protocol: "mathematical functions",
  5119. fn: function (){
  5120. var self=this,$self=this;
  5121. return $core.withContext(function($ctx1) {
  5122. return Math.asin(self);;
  5123. return self;
  5124. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5125. },
  5126. args: [],
  5127. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5128. referencedClasses: [],
  5129. messageSends: []
  5130. }),
  5131. $globals.Number);
  5132. $core.addMethod(
  5133. $core.method({
  5134. selector: "arcTan",
  5135. protocol: "mathematical functions",
  5136. fn: function (){
  5137. var self=this,$self=this;
  5138. return $core.withContext(function($ctx1) {
  5139. return Math.atan(self);;
  5140. return self;
  5141. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5142. },
  5143. args: [],
  5144. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5145. referencedClasses: [],
  5146. messageSends: []
  5147. }),
  5148. $globals.Number);
  5149. $core.addMethod(
  5150. $core.method({
  5151. selector: "arcTan:",
  5152. protocol: "mathematical functions",
  5153. fn: function (aNumber){
  5154. var self=this,$self=this;
  5155. return $core.withContext(function($ctx1) {
  5156. return Math.atan2(self, aNumber);;
  5157. return self;
  5158. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5159. },
  5160. args: ["aNumber"],
  5161. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5162. referencedClasses: [],
  5163. messageSends: []
  5164. }),
  5165. $globals.Number);
  5166. $core.addMethod(
  5167. $core.method({
  5168. selector: "asJavaScriptObject",
  5169. protocol: "converting",
  5170. fn: function (){
  5171. var self=this,$self=this;
  5172. return self;
  5173. },
  5174. args: [],
  5175. source: "asJavaScriptObject\x0a\x09^ self",
  5176. referencedClasses: [],
  5177. messageSends: []
  5178. }),
  5179. $globals.Number);
  5180. $core.addMethod(
  5181. $core.method({
  5182. selector: "asJavaScriptSource",
  5183. protocol: "converting",
  5184. fn: function (){
  5185. var self=this,$self=this;
  5186. return $core.withContext(function($ctx1) {
  5187. var $1;
  5188. $1=$recv("(".__comma($self._printString())).__comma(")");
  5189. $ctx1.sendIdx[","]=1;
  5190. return $1;
  5191. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5192. },
  5193. args: [],
  5194. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5195. referencedClasses: [],
  5196. messageSends: [",", "printString"]
  5197. }),
  5198. $globals.Number);
  5199. $core.addMethod(
  5200. $core.method({
  5201. selector: "asNumber",
  5202. protocol: "converting",
  5203. fn: function (){
  5204. var self=this,$self=this;
  5205. return self;
  5206. },
  5207. args: [],
  5208. source: "asNumber\x0a\x09^ self",
  5209. referencedClasses: [],
  5210. messageSends: []
  5211. }),
  5212. $globals.Number);
  5213. $core.addMethod(
  5214. $core.method({
  5215. selector: "asPoint",
  5216. protocol: "converting",
  5217. fn: function (){
  5218. var self=this,$self=this;
  5219. return $core.withContext(function($ctx1) {
  5220. return $recv($globals.Point)._x_y_(self,self);
  5221. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5222. },
  5223. args: [],
  5224. source: "asPoint\x0a\x09^ Point x: self y: self",
  5225. referencedClasses: ["Point"],
  5226. messageSends: ["x:y:"]
  5227. }),
  5228. $globals.Number);
  5229. $core.addMethod(
  5230. $core.method({
  5231. selector: "asString",
  5232. protocol: "converting",
  5233. fn: function (){
  5234. var self=this,$self=this;
  5235. return $core.withContext(function($ctx1) {
  5236. return String(self);
  5237. return self;
  5238. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5239. },
  5240. args: [],
  5241. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5242. referencedClasses: [],
  5243. messageSends: []
  5244. }),
  5245. $globals.Number);
  5246. $core.addMethod(
  5247. $core.method({
  5248. selector: "atRandom",
  5249. protocol: "converting",
  5250. fn: function (){
  5251. var self=this,$self=this;
  5252. return $core.withContext(function($ctx1) {
  5253. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5254. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5255. },
  5256. args: [],
  5257. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5258. referencedClasses: ["Random"],
  5259. messageSends: ["+", "truncated", "*", "next", "new"]
  5260. }),
  5261. $globals.Number);
  5262. $core.addMethod(
  5263. $core.method({
  5264. selector: "between:and:",
  5265. protocol: "testing",
  5266. fn: function (min,max){
  5267. var self=this,$self=this;
  5268. return $core.withContext(function($ctx1) {
  5269. return $recv($self.__gt_eq(min))._and_((function(){
  5270. return $core.withContext(function($ctx2) {
  5271. return $self.__lt_eq(max);
  5272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5273. }));
  5274. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5275. },
  5276. args: ["min", "max"],
  5277. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5278. referencedClasses: [],
  5279. messageSends: ["and:", ">=", "<="]
  5280. }),
  5281. $globals.Number);
  5282. $core.addMethod(
  5283. $core.method({
  5284. selector: "bitAnd:",
  5285. protocol: "converting",
  5286. fn: function (aNumber){
  5287. var self=this,$self=this;
  5288. return $core.withContext(function($ctx1) {
  5289. return self & aNumber;
  5290. return self;
  5291. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5292. },
  5293. args: ["aNumber"],
  5294. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5295. referencedClasses: [],
  5296. messageSends: []
  5297. }),
  5298. $globals.Number);
  5299. $core.addMethod(
  5300. $core.method({
  5301. selector: "bitNot",
  5302. protocol: "converting",
  5303. fn: function (){
  5304. var self=this,$self=this;
  5305. return $core.withContext(function($ctx1) {
  5306. return ~self;
  5307. return self;
  5308. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5309. },
  5310. args: [],
  5311. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5312. referencedClasses: [],
  5313. messageSends: []
  5314. }),
  5315. $globals.Number);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "bitOr:",
  5319. protocol: "converting",
  5320. fn: function (aNumber){
  5321. var self=this,$self=this;
  5322. return $core.withContext(function($ctx1) {
  5323. return self | aNumber;
  5324. return self;
  5325. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5326. },
  5327. args: ["aNumber"],
  5328. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5329. referencedClasses: [],
  5330. messageSends: []
  5331. }),
  5332. $globals.Number);
  5333. $core.addMethod(
  5334. $core.method({
  5335. selector: "bitXor:",
  5336. protocol: "converting",
  5337. fn: function (aNumber){
  5338. var self=this,$self=this;
  5339. return $core.withContext(function($ctx1) {
  5340. return self ^ aNumber;
  5341. return self;
  5342. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5343. },
  5344. args: ["aNumber"],
  5345. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5346. referencedClasses: [],
  5347. messageSends: []
  5348. }),
  5349. $globals.Number);
  5350. $core.addMethod(
  5351. $core.method({
  5352. selector: "ceiling",
  5353. protocol: "converting",
  5354. fn: function (){
  5355. var self=this,$self=this;
  5356. return $core.withContext(function($ctx1) {
  5357. return Math.ceil(self);;
  5358. return self;
  5359. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5360. },
  5361. args: [],
  5362. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5363. referencedClasses: [],
  5364. messageSends: []
  5365. }),
  5366. $globals.Number);
  5367. $core.addMethod(
  5368. $core.method({
  5369. selector: "copy",
  5370. protocol: "copying",
  5371. fn: function (){
  5372. var self=this,$self=this;
  5373. return self;
  5374. },
  5375. args: [],
  5376. source: "copy\x0a\x09^ self",
  5377. referencedClasses: [],
  5378. messageSends: []
  5379. }),
  5380. $globals.Number);
  5381. $core.addMethod(
  5382. $core.method({
  5383. selector: "cos",
  5384. protocol: "mathematical functions",
  5385. fn: function (){
  5386. var self=this,$self=this;
  5387. return $core.withContext(function($ctx1) {
  5388. return Math.cos(self);;
  5389. return self;
  5390. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5391. },
  5392. args: [],
  5393. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5394. referencedClasses: [],
  5395. messageSends: []
  5396. }),
  5397. $globals.Number);
  5398. $core.addMethod(
  5399. $core.method({
  5400. selector: "deepCopy",
  5401. protocol: "copying",
  5402. fn: function (){
  5403. var self=this,$self=this;
  5404. return $core.withContext(function($ctx1) {
  5405. return $self._copy();
  5406. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5407. },
  5408. args: [],
  5409. source: "deepCopy\x0a\x09^ self copy",
  5410. referencedClasses: [],
  5411. messageSends: ["copy"]
  5412. }),
  5413. $globals.Number);
  5414. $core.addMethod(
  5415. $core.method({
  5416. selector: "degreesToRadians",
  5417. protocol: "converting",
  5418. fn: function (){
  5419. var self=this,$self=this;
  5420. return $core.withContext(function($ctx1) {
  5421. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5422. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5423. },
  5424. args: [],
  5425. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5426. referencedClasses: ["Number"],
  5427. messageSends: ["*", "radiansPerDegree"]
  5428. }),
  5429. $globals.Number);
  5430. $core.addMethod(
  5431. $core.method({
  5432. selector: "even",
  5433. protocol: "testing",
  5434. fn: function (){
  5435. var self=this,$self=this;
  5436. return $core.withContext(function($ctx1) {
  5437. return (0).__eq($self.__backslash_backslash((2)));
  5438. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5439. },
  5440. args: [],
  5441. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5442. referencedClasses: [],
  5443. messageSends: ["=", "\x5c\x5c"]
  5444. }),
  5445. $globals.Number);
  5446. $core.addMethod(
  5447. $core.method({
  5448. selector: "floor",
  5449. protocol: "converting",
  5450. fn: function (){
  5451. var self=this,$self=this;
  5452. return $core.withContext(function($ctx1) {
  5453. return Math.floor(self);;
  5454. return self;
  5455. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5456. },
  5457. args: [],
  5458. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5459. referencedClasses: [],
  5460. messageSends: []
  5461. }),
  5462. $globals.Number);
  5463. $core.addMethod(
  5464. $core.method({
  5465. selector: "isImmutable",
  5466. protocol: "testing",
  5467. fn: function (){
  5468. var self=this,$self=this;
  5469. return true;
  5470. },
  5471. args: [],
  5472. source: "isImmutable\x0a\x09^ true",
  5473. referencedClasses: [],
  5474. messageSends: []
  5475. }),
  5476. $globals.Number);
  5477. $core.addMethod(
  5478. $core.method({
  5479. selector: "isNumber",
  5480. protocol: "testing",
  5481. fn: function (){
  5482. var self=this,$self=this;
  5483. return true;
  5484. },
  5485. args: [],
  5486. source: "isNumber\x0a\x09^ true",
  5487. referencedClasses: [],
  5488. messageSends: []
  5489. }),
  5490. $globals.Number);
  5491. $core.addMethod(
  5492. $core.method({
  5493. selector: "isZero",
  5494. protocol: "testing",
  5495. fn: function (){
  5496. var self=this,$self=this;
  5497. return $core.withContext(function($ctx1) {
  5498. return $self.__eq((0));
  5499. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5500. },
  5501. args: [],
  5502. source: "isZero\x0a\x09^ self = 0",
  5503. referencedClasses: [],
  5504. messageSends: ["="]
  5505. }),
  5506. $globals.Number);
  5507. $core.addMethod(
  5508. $core.method({
  5509. selector: "ln",
  5510. protocol: "mathematical functions",
  5511. fn: function (){
  5512. var self=this,$self=this;
  5513. return $core.withContext(function($ctx1) {
  5514. return Math.log(self);;
  5515. return self;
  5516. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5517. },
  5518. args: [],
  5519. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5520. referencedClasses: [],
  5521. messageSends: []
  5522. }),
  5523. $globals.Number);
  5524. $core.addMethod(
  5525. $core.method({
  5526. selector: "log",
  5527. protocol: "mathematical functions",
  5528. fn: function (){
  5529. var self=this,$self=this;
  5530. return $core.withContext(function($ctx1) {
  5531. return Math.log(self) / Math.LN10;;
  5532. return self;
  5533. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5534. },
  5535. args: [],
  5536. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5537. referencedClasses: [],
  5538. messageSends: []
  5539. }),
  5540. $globals.Number);
  5541. $core.addMethod(
  5542. $core.method({
  5543. selector: "log:",
  5544. protocol: "mathematical functions",
  5545. fn: function (aNumber){
  5546. var self=this,$self=this;
  5547. return $core.withContext(function($ctx1) {
  5548. return Math.log(self) / Math.log(aNumber);;
  5549. return self;
  5550. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5551. },
  5552. args: ["aNumber"],
  5553. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5554. referencedClasses: [],
  5555. messageSends: []
  5556. }),
  5557. $globals.Number);
  5558. $core.addMethod(
  5559. $core.method({
  5560. selector: "max:",
  5561. protocol: "arithmetic",
  5562. fn: function (aNumber){
  5563. var self=this,$self=this;
  5564. return $core.withContext(function($ctx1) {
  5565. return Math.max(self, aNumber);;
  5566. return self;
  5567. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5568. },
  5569. args: ["aNumber"],
  5570. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5571. referencedClasses: [],
  5572. messageSends: []
  5573. }),
  5574. $globals.Number);
  5575. $core.addMethod(
  5576. $core.method({
  5577. selector: "min:",
  5578. protocol: "arithmetic",
  5579. fn: function (aNumber){
  5580. var self=this,$self=this;
  5581. return $core.withContext(function($ctx1) {
  5582. return Math.min(self, aNumber);;
  5583. return self;
  5584. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5585. },
  5586. args: ["aNumber"],
  5587. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5588. referencedClasses: [],
  5589. messageSends: []
  5590. }),
  5591. $globals.Number);
  5592. $core.addMethod(
  5593. $core.method({
  5594. selector: "min:max:",
  5595. protocol: "arithmetic",
  5596. fn: function (aMin,aMax){
  5597. var self=this,$self=this;
  5598. return $core.withContext(function($ctx1) {
  5599. return $recv($self._min_(aMin))._max_(aMax);
  5600. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5601. },
  5602. args: ["aMin", "aMax"],
  5603. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5604. referencedClasses: [],
  5605. messageSends: ["max:", "min:"]
  5606. }),
  5607. $globals.Number);
  5608. $core.addMethod(
  5609. $core.method({
  5610. selector: "negated",
  5611. protocol: "arithmetic",
  5612. fn: function (){
  5613. var self=this,$self=this;
  5614. return $core.withContext(function($ctx1) {
  5615. return (0).__minus(self);
  5616. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5617. },
  5618. args: [],
  5619. source: "negated\x0a\x09^ 0 - self",
  5620. referencedClasses: [],
  5621. messageSends: ["-"]
  5622. }),
  5623. $globals.Number);
  5624. $core.addMethod(
  5625. $core.method({
  5626. selector: "negative",
  5627. protocol: "testing",
  5628. fn: function (){
  5629. var self=this,$self=this;
  5630. return $core.withContext(function($ctx1) {
  5631. return $self.__lt((0));
  5632. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5633. },
  5634. args: [],
  5635. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5636. referencedClasses: [],
  5637. messageSends: ["<"]
  5638. }),
  5639. $globals.Number);
  5640. $core.addMethod(
  5641. $core.method({
  5642. selector: "odd",
  5643. protocol: "testing",
  5644. fn: function (){
  5645. var self=this,$self=this;
  5646. return $core.withContext(function($ctx1) {
  5647. return $recv($self._even())._not();
  5648. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5649. },
  5650. args: [],
  5651. source: "odd\x0a\x09^ self even not",
  5652. referencedClasses: [],
  5653. messageSends: ["not", "even"]
  5654. }),
  5655. $globals.Number);
  5656. $core.addMethod(
  5657. $core.method({
  5658. selector: "positive",
  5659. protocol: "testing",
  5660. fn: function (){
  5661. var self=this,$self=this;
  5662. return $core.withContext(function($ctx1) {
  5663. return $self.__gt_eq((0));
  5664. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5665. },
  5666. args: [],
  5667. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5668. referencedClasses: [],
  5669. messageSends: [">="]
  5670. }),
  5671. $globals.Number);
  5672. $core.addMethod(
  5673. $core.method({
  5674. selector: "printOn:",
  5675. protocol: "printing",
  5676. fn: function (aStream){
  5677. var self=this,$self=this;
  5678. return $core.withContext(function($ctx1) {
  5679. $recv(aStream)._nextPutAll_($self._asString());
  5680. return self;
  5681. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5682. },
  5683. args: ["aStream"],
  5684. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5685. referencedClasses: [],
  5686. messageSends: ["nextPutAll:", "asString"]
  5687. }),
  5688. $globals.Number);
  5689. $core.addMethod(
  5690. $core.method({
  5691. selector: "printShowingDecimalPlaces:",
  5692. protocol: "printing",
  5693. fn: function (placesDesired){
  5694. var self=this,$self=this;
  5695. return $core.withContext(function($ctx1) {
  5696. return self.toFixed(placesDesired);
  5697. return self;
  5698. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5699. },
  5700. args: ["placesDesired"],
  5701. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5702. referencedClasses: [],
  5703. messageSends: []
  5704. }),
  5705. $globals.Number);
  5706. $core.addMethod(
  5707. $core.method({
  5708. selector: "printStringBase:",
  5709. protocol: "converting",
  5710. fn: function (aBase){
  5711. var self=this,$self=this;
  5712. return $core.withContext(function($ctx1) {
  5713. return self.toString(aBase);
  5714. return self;
  5715. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5716. },
  5717. args: ["aBase"],
  5718. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5719. referencedClasses: [],
  5720. messageSends: []
  5721. }),
  5722. $globals.Number);
  5723. $core.addMethod(
  5724. $core.method({
  5725. selector: "radiansToDegrees",
  5726. protocol: "converting",
  5727. fn: function (){
  5728. var self=this,$self=this;
  5729. return $core.withContext(function($ctx1) {
  5730. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5731. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5732. },
  5733. args: [],
  5734. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5735. referencedClasses: ["Number"],
  5736. messageSends: ["/", "radiansPerDegree"]
  5737. }),
  5738. $globals.Number);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "raisedTo:",
  5742. protocol: "mathematical functions",
  5743. fn: function (exponent){
  5744. var self=this,$self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. return Math.pow(self, exponent);;
  5747. return self;
  5748. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5749. },
  5750. args: ["exponent"],
  5751. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5752. referencedClasses: [],
  5753. messageSends: []
  5754. }),
  5755. $globals.Number);
  5756. $core.addMethod(
  5757. $core.method({
  5758. selector: "rounded",
  5759. protocol: "converting",
  5760. fn: function (){
  5761. var self=this,$self=this;
  5762. return $core.withContext(function($ctx1) {
  5763. return Math.round(self);;
  5764. return self;
  5765. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5766. },
  5767. args: [],
  5768. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5769. referencedClasses: [],
  5770. messageSends: []
  5771. }),
  5772. $globals.Number);
  5773. $core.addMethod(
  5774. $core.method({
  5775. selector: "sign",
  5776. protocol: "mathematical functions",
  5777. fn: function (){
  5778. var self=this,$self=this;
  5779. return $core.withContext(function($ctx1) {
  5780. var $1,$2;
  5781. $1=$self._isZero();
  5782. if($core.assert($1)){
  5783. return (0);
  5784. }
  5785. $2=$self._positive();
  5786. if($core.assert($2)){
  5787. return (1);
  5788. } else {
  5789. return (-1);
  5790. }
  5791. return self;
  5792. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5793. },
  5794. args: [],
  5795. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5796. referencedClasses: [],
  5797. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5798. }),
  5799. $globals.Number);
  5800. $core.addMethod(
  5801. $core.method({
  5802. selector: "sin",
  5803. protocol: "mathematical functions",
  5804. fn: function (){
  5805. var self=this,$self=this;
  5806. return $core.withContext(function($ctx1) {
  5807. return Math.sin(self);;
  5808. return self;
  5809. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5810. },
  5811. args: [],
  5812. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5813. referencedClasses: [],
  5814. messageSends: []
  5815. }),
  5816. $globals.Number);
  5817. $core.addMethod(
  5818. $core.method({
  5819. selector: "sqrt",
  5820. protocol: "mathematical functions",
  5821. fn: function (){
  5822. var self=this,$self=this;
  5823. return $core.withContext(function($ctx1) {
  5824. return Math.sqrt(self);
  5825. return self;
  5826. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5827. },
  5828. args: [],
  5829. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5830. referencedClasses: [],
  5831. messageSends: []
  5832. }),
  5833. $globals.Number);
  5834. $core.addMethod(
  5835. $core.method({
  5836. selector: "squared",
  5837. protocol: "mathematical functions",
  5838. fn: function (){
  5839. var self=this,$self=this;
  5840. return $core.withContext(function($ctx1) {
  5841. return $self.__star(self);
  5842. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5843. },
  5844. args: [],
  5845. source: "squared\x0a\x09^ self * self",
  5846. referencedClasses: [],
  5847. messageSends: ["*"]
  5848. }),
  5849. $globals.Number);
  5850. $core.addMethod(
  5851. $core.method({
  5852. selector: "tan",
  5853. protocol: "mathematical functions",
  5854. fn: function (){
  5855. var self=this,$self=this;
  5856. return $core.withContext(function($ctx1) {
  5857. return Math.tan(self);;
  5858. return self;
  5859. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5860. },
  5861. args: [],
  5862. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5863. referencedClasses: [],
  5864. messageSends: []
  5865. }),
  5866. $globals.Number);
  5867. $core.addMethod(
  5868. $core.method({
  5869. selector: "timesRepeat:",
  5870. protocol: "enumerating",
  5871. fn: function (aBlock){
  5872. var self=this,$self=this;
  5873. var count;
  5874. return $core.withContext(function($ctx1) {
  5875. count=(1);
  5876. $recv((function(){
  5877. return $core.withContext(function($ctx2) {
  5878. return $recv(count).__gt(self);
  5879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5880. }))._whileFalse_((function(){
  5881. return $core.withContext(function($ctx2) {
  5882. $recv(aBlock)._value();
  5883. count=$recv(count).__plus((1));
  5884. return count;
  5885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5886. }));
  5887. return self;
  5888. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5889. },
  5890. args: ["aBlock"],
  5891. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5892. referencedClasses: [],
  5893. messageSends: ["whileFalse:", ">", "value", "+"]
  5894. }),
  5895. $globals.Number);
  5896. $core.addMethod(
  5897. $core.method({
  5898. selector: "to:",
  5899. protocol: "converting",
  5900. fn: function (aNumber){
  5901. var self=this,$self=this;
  5902. var array,first,last,count;
  5903. return $core.withContext(function($ctx1) {
  5904. first=$self._truncated();
  5905. $ctx1.sendIdx["truncated"]=1;
  5906. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5907. $ctx1.sendIdx["+"]=1;
  5908. count=(1);
  5909. array=$recv($globals.Array)._new();
  5910. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5911. return $core.withContext(function($ctx2) {
  5912. $recv(array)._at_put_(count,first);
  5913. count=$recv(count).__plus((1));
  5914. $ctx2.sendIdx["+"]=2;
  5915. count;
  5916. first=$recv(first).__plus((1));
  5917. return first;
  5918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5919. }));
  5920. return array;
  5921. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5922. },
  5923. args: ["aNumber"],
  5924. 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",
  5925. referencedClasses: ["Array"],
  5926. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5927. }),
  5928. $globals.Number);
  5929. $core.addMethod(
  5930. $core.method({
  5931. selector: "to:by:",
  5932. protocol: "converting",
  5933. fn: function (stop,step){
  5934. var self=this,$self=this;
  5935. var array,value,pos;
  5936. return $core.withContext(function($ctx1) {
  5937. var $1,$2;
  5938. value=self;
  5939. array=$recv($globals.Array)._new();
  5940. pos=(1);
  5941. $1=$recv(step).__eq((0));
  5942. if($core.assert($1)){
  5943. $self._error_("step must be non-zero");
  5944. }
  5945. $2=$recv(step).__lt((0));
  5946. if($core.assert($2)){
  5947. $recv((function(){
  5948. return $core.withContext(function($ctx2) {
  5949. return $recv(value).__gt_eq(stop);
  5950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5951. }))._whileTrue_((function(){
  5952. return $core.withContext(function($ctx2) {
  5953. $recv(array)._at_put_(pos,value);
  5954. $ctx2.sendIdx["at:put:"]=1;
  5955. pos=$recv(pos).__plus((1));
  5956. $ctx2.sendIdx["+"]=1;
  5957. pos;
  5958. value=$recv(value).__plus(step);
  5959. $ctx2.sendIdx["+"]=2;
  5960. return value;
  5961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5962. }));
  5963. $ctx1.sendIdx["whileTrue:"]=1;
  5964. } else {
  5965. $recv((function(){
  5966. return $core.withContext(function($ctx2) {
  5967. return $recv(value).__lt_eq(stop);
  5968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5969. }))._whileTrue_((function(){
  5970. return $core.withContext(function($ctx2) {
  5971. $recv(array)._at_put_(pos,value);
  5972. pos=$recv(pos).__plus((1));
  5973. $ctx2.sendIdx["+"]=3;
  5974. pos;
  5975. value=$recv(value).__plus(step);
  5976. return value;
  5977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5978. }));
  5979. }
  5980. return array;
  5981. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5982. },
  5983. args: ["stop", "step"],
  5984. 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",
  5985. referencedClasses: ["Array"],
  5986. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5987. }),
  5988. $globals.Number);
  5989. $core.addMethod(
  5990. $core.method({
  5991. selector: "to:by:do:",
  5992. protocol: "enumerating",
  5993. fn: function (stop,step,aBlock){
  5994. var self=this,$self=this;
  5995. var value;
  5996. return $core.withContext(function($ctx1) {
  5997. var $1,$2;
  5998. value=self;
  5999. $1=$recv(step).__eq((0));
  6000. if($core.assert($1)){
  6001. $self._error_("step must be non-zero");
  6002. }
  6003. $2=$recv(step).__lt((0));
  6004. if($core.assert($2)){
  6005. $recv((function(){
  6006. return $core.withContext(function($ctx2) {
  6007. return $recv(value).__gt_eq(stop);
  6008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6009. }))._whileTrue_((function(){
  6010. return $core.withContext(function($ctx2) {
  6011. $recv(aBlock)._value_(value);
  6012. $ctx2.sendIdx["value:"]=1;
  6013. value=$recv(value).__plus(step);
  6014. $ctx2.sendIdx["+"]=1;
  6015. return value;
  6016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6017. }));
  6018. $ctx1.sendIdx["whileTrue:"]=1;
  6019. } else {
  6020. $recv((function(){
  6021. return $core.withContext(function($ctx2) {
  6022. return $recv(value).__lt_eq(stop);
  6023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6024. }))._whileTrue_((function(){
  6025. return $core.withContext(function($ctx2) {
  6026. $recv(aBlock)._value_(value);
  6027. value=$recv(value).__plus(step);
  6028. return value;
  6029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6030. }));
  6031. }
  6032. return self;
  6033. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6034. },
  6035. args: ["stop", "step", "aBlock"],
  6036. 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 ]]",
  6037. referencedClasses: [],
  6038. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6039. }),
  6040. $globals.Number);
  6041. $core.addMethod(
  6042. $core.method({
  6043. selector: "to:do:",
  6044. protocol: "enumerating",
  6045. fn: function (stop,aBlock){
  6046. var self=this,$self=this;
  6047. var nextValue;
  6048. return $core.withContext(function($ctx1) {
  6049. nextValue=self;
  6050. $recv((function(){
  6051. return $core.withContext(function($ctx2) {
  6052. return $recv(nextValue).__lt_eq(stop);
  6053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6054. }))._whileTrue_((function(){
  6055. return $core.withContext(function($ctx2) {
  6056. $recv(aBlock)._value_(nextValue);
  6057. nextValue=$recv(nextValue).__plus((1));
  6058. return nextValue;
  6059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6060. }));
  6061. return self;
  6062. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6063. },
  6064. args: ["stop", "aBlock"],
  6065. 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 ]",
  6066. referencedClasses: [],
  6067. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6068. }),
  6069. $globals.Number);
  6070. $core.addMethod(
  6071. $core.method({
  6072. selector: "truncated",
  6073. protocol: "converting",
  6074. fn: function (){
  6075. var self=this,$self=this;
  6076. return $core.withContext(function($ctx1) {
  6077. if(self >= 0) {
  6078. return Math.floor(self);
  6079. } else {
  6080. return Math.floor(self * (-1)) * (-1);
  6081. };
  6082. ;
  6083. return self;
  6084. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6085. },
  6086. args: [],
  6087. 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'>",
  6088. referencedClasses: [],
  6089. messageSends: []
  6090. }),
  6091. $globals.Number);
  6092. $core.addMethod(
  6093. $core.method({
  6094. selector: "|",
  6095. protocol: "converting",
  6096. fn: function (aNumber){
  6097. var self=this,$self=this;
  6098. return $core.withContext(function($ctx1) {
  6099. return self | aNumber;
  6100. return self;
  6101. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6102. },
  6103. args: ["aNumber"],
  6104. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6105. referencedClasses: [],
  6106. messageSends: []
  6107. }),
  6108. $globals.Number);
  6109. $core.addMethod(
  6110. $core.method({
  6111. selector: "classTag",
  6112. protocol: "accessing",
  6113. fn: function (){
  6114. var self=this,$self=this;
  6115. return "magnitude";
  6116. },
  6117. args: [],
  6118. 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'",
  6119. referencedClasses: [],
  6120. messageSends: []
  6121. }),
  6122. $globals.Number.a$cls);
  6123. $core.addMethod(
  6124. $core.method({
  6125. selector: "e",
  6126. protocol: "instance creation",
  6127. fn: function (){
  6128. var self=this,$self=this;
  6129. return $core.withContext(function($ctx1) {
  6130. return Math.E;;
  6131. return self;
  6132. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6133. },
  6134. args: [],
  6135. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6136. referencedClasses: [],
  6137. messageSends: []
  6138. }),
  6139. $globals.Number.a$cls);
  6140. $core.addMethod(
  6141. $core.method({
  6142. selector: "pi",
  6143. protocol: "instance creation",
  6144. fn: function (){
  6145. var self=this,$self=this;
  6146. return $core.withContext(function($ctx1) {
  6147. return Math.PI;
  6148. return self;
  6149. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6150. },
  6151. args: [],
  6152. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6153. referencedClasses: [],
  6154. messageSends: []
  6155. }),
  6156. $globals.Number.a$cls);
  6157. $core.addMethod(
  6158. $core.method({
  6159. selector: "radiansPerDegree",
  6160. protocol: "instance creation",
  6161. fn: function (){
  6162. var self=this,$self=this;
  6163. return $core.withContext(function($ctx1) {
  6164. return $recv($self._pi()).__slash((180));
  6165. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6166. },
  6167. args: [],
  6168. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6169. referencedClasses: [],
  6170. messageSends: ["/", "pi"]
  6171. }),
  6172. $globals.Number.a$cls);
  6173. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6174. $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";
  6175. $core.addMethod(
  6176. $core.method({
  6177. selector: "*",
  6178. protocol: "arithmetic",
  6179. fn: function (aPoint){
  6180. var self=this,$self=this;
  6181. return $core.withContext(function($ctx1) {
  6182. var $2,$4,$3,$1,$6,$5;
  6183. $2=$self._x();
  6184. $ctx1.sendIdx["x"]=1;
  6185. $4=$recv(aPoint)._asPoint();
  6186. $ctx1.sendIdx["asPoint"]=1;
  6187. $3=$recv($4)._x();
  6188. $1=$recv($2).__star($3);
  6189. $ctx1.sendIdx["*"]=1;
  6190. $6=$self._y();
  6191. $ctx1.sendIdx["y"]=1;
  6192. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6193. return $recv($globals.Point)._x_y_($1,$5);
  6194. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6195. },
  6196. args: ["aPoint"],
  6197. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6198. referencedClasses: ["Point"],
  6199. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6200. }),
  6201. $globals.Point);
  6202. $core.addMethod(
  6203. $core.method({
  6204. selector: "+",
  6205. protocol: "arithmetic",
  6206. fn: function (aPoint){
  6207. var self=this,$self=this;
  6208. return $core.withContext(function($ctx1) {
  6209. var $2,$4,$3,$1,$6,$5;
  6210. $2=$self._x();
  6211. $ctx1.sendIdx["x"]=1;
  6212. $4=$recv(aPoint)._asPoint();
  6213. $ctx1.sendIdx["asPoint"]=1;
  6214. $3=$recv($4)._x();
  6215. $1=$recv($2).__plus($3);
  6216. $ctx1.sendIdx["+"]=1;
  6217. $6=$self._y();
  6218. $ctx1.sendIdx["y"]=1;
  6219. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6220. return $recv($globals.Point)._x_y_($1,$5);
  6221. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6222. },
  6223. args: ["aPoint"],
  6224. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6225. referencedClasses: ["Point"],
  6226. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6227. }),
  6228. $globals.Point);
  6229. $core.addMethod(
  6230. $core.method({
  6231. selector: "-",
  6232. protocol: "arithmetic",
  6233. fn: function (aPoint){
  6234. var self=this,$self=this;
  6235. return $core.withContext(function($ctx1) {
  6236. var $2,$4,$3,$1,$6,$5;
  6237. $2=$self._x();
  6238. $ctx1.sendIdx["x"]=1;
  6239. $4=$recv(aPoint)._asPoint();
  6240. $ctx1.sendIdx["asPoint"]=1;
  6241. $3=$recv($4)._x();
  6242. $1=$recv($2).__minus($3);
  6243. $ctx1.sendIdx["-"]=1;
  6244. $6=$self._y();
  6245. $ctx1.sendIdx["y"]=1;
  6246. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6247. return $recv($globals.Point)._x_y_($1,$5);
  6248. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6249. },
  6250. args: ["aPoint"],
  6251. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6252. referencedClasses: ["Point"],
  6253. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6254. }),
  6255. $globals.Point);
  6256. $core.addMethod(
  6257. $core.method({
  6258. selector: "/",
  6259. protocol: "arithmetic",
  6260. fn: function (aPoint){
  6261. var self=this,$self=this;
  6262. return $core.withContext(function($ctx1) {
  6263. var $2,$4,$3,$1,$6,$5;
  6264. $2=$self._x();
  6265. $ctx1.sendIdx["x"]=1;
  6266. $4=$recv(aPoint)._asPoint();
  6267. $ctx1.sendIdx["asPoint"]=1;
  6268. $3=$recv($4)._x();
  6269. $1=$recv($2).__slash($3);
  6270. $ctx1.sendIdx["/"]=1;
  6271. $6=$self._y();
  6272. $ctx1.sendIdx["y"]=1;
  6273. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6274. return $recv($globals.Point)._x_y_($1,$5);
  6275. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6276. },
  6277. args: ["aPoint"],
  6278. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6279. referencedClasses: ["Point"],
  6280. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6281. }),
  6282. $globals.Point);
  6283. $core.addMethod(
  6284. $core.method({
  6285. selector: "<",
  6286. protocol: "comparing",
  6287. fn: function (aPoint){
  6288. var self=this,$self=this;
  6289. return $core.withContext(function($ctx1) {
  6290. var $2,$1,$3;
  6291. $2=$self._x();
  6292. $ctx1.sendIdx["x"]=1;
  6293. $1=$recv($2).__lt($recv(aPoint)._x());
  6294. $ctx1.sendIdx["<"]=1;
  6295. return $recv($1)._and_((function(){
  6296. return $core.withContext(function($ctx2) {
  6297. $3=$self._y();
  6298. $ctx2.sendIdx["y"]=1;
  6299. return $recv($3).__lt($recv(aPoint)._y());
  6300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6301. }));
  6302. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6303. },
  6304. args: ["aPoint"],
  6305. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6306. referencedClasses: [],
  6307. messageSends: ["and:", "<", "x", "y"]
  6308. }),
  6309. $globals.Point);
  6310. $core.addMethod(
  6311. $core.method({
  6312. selector: "<=",
  6313. protocol: "comparing",
  6314. fn: function (aPoint){
  6315. var self=this,$self=this;
  6316. return $core.withContext(function($ctx1) {
  6317. var $2,$1,$3;
  6318. $2=$self._x();
  6319. $ctx1.sendIdx["x"]=1;
  6320. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6321. $ctx1.sendIdx["<="]=1;
  6322. return $recv($1)._and_((function(){
  6323. return $core.withContext(function($ctx2) {
  6324. $3=$self._y();
  6325. $ctx2.sendIdx["y"]=1;
  6326. return $recv($3).__lt_eq($recv(aPoint)._y());
  6327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6328. }));
  6329. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6330. },
  6331. args: ["aPoint"],
  6332. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6333. referencedClasses: [],
  6334. messageSends: ["and:", "<=", "x", "y"]
  6335. }),
  6336. $globals.Point);
  6337. $core.addMethod(
  6338. $core.method({
  6339. selector: "=",
  6340. protocol: "comparing",
  6341. fn: function (aPoint){
  6342. var self=this,$self=this;
  6343. return $core.withContext(function($ctx1) {
  6344. var $2,$1,$4,$3,$6,$5;
  6345. $2=$recv(aPoint)._class();
  6346. $ctx1.sendIdx["class"]=1;
  6347. $1=$recv($2).__eq($self._class());
  6348. $ctx1.sendIdx["="]=1;
  6349. return $recv($1)._and_((function(){
  6350. return $core.withContext(function($ctx2) {
  6351. $4=$recv(aPoint)._x();
  6352. $ctx2.sendIdx["x"]=1;
  6353. $3=$recv($4).__eq($self._x());
  6354. $ctx2.sendIdx["="]=2;
  6355. $6=$recv(aPoint)._y();
  6356. $ctx2.sendIdx["y"]=1;
  6357. $5=$recv($6).__eq($self._y());
  6358. return $recv($3).__and($5);
  6359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6360. }));
  6361. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6362. },
  6363. args: ["aPoint"],
  6364. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6365. referencedClasses: [],
  6366. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6367. }),
  6368. $globals.Point);
  6369. $core.addMethod(
  6370. $core.method({
  6371. selector: ">",
  6372. protocol: "comparing",
  6373. fn: function (aPoint){
  6374. var self=this,$self=this;
  6375. return $core.withContext(function($ctx1) {
  6376. var $2,$1,$3;
  6377. $2=$self._x();
  6378. $ctx1.sendIdx["x"]=1;
  6379. $1=$recv($2).__gt($recv(aPoint)._x());
  6380. $ctx1.sendIdx[">"]=1;
  6381. return $recv($1)._and_((function(){
  6382. return $core.withContext(function($ctx2) {
  6383. $3=$self._y();
  6384. $ctx2.sendIdx["y"]=1;
  6385. return $recv($3).__gt($recv(aPoint)._y());
  6386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6387. }));
  6388. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6389. },
  6390. args: ["aPoint"],
  6391. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6392. referencedClasses: [],
  6393. messageSends: ["and:", ">", "x", "y"]
  6394. }),
  6395. $globals.Point);
  6396. $core.addMethod(
  6397. $core.method({
  6398. selector: ">=",
  6399. protocol: "comparing",
  6400. fn: function (aPoint){
  6401. var self=this,$self=this;
  6402. return $core.withContext(function($ctx1) {
  6403. var $2,$1,$3;
  6404. $2=$self._x();
  6405. $ctx1.sendIdx["x"]=1;
  6406. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6407. $ctx1.sendIdx[">="]=1;
  6408. return $recv($1)._and_((function(){
  6409. return $core.withContext(function($ctx2) {
  6410. $3=$self._y();
  6411. $ctx2.sendIdx["y"]=1;
  6412. return $recv($3).__gt_eq($recv(aPoint)._y());
  6413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6414. }));
  6415. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6416. },
  6417. args: ["aPoint"],
  6418. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6419. referencedClasses: [],
  6420. messageSends: ["and:", ">=", "x", "y"]
  6421. }),
  6422. $globals.Point);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "angle",
  6426. protocol: "geometry",
  6427. fn: function (){
  6428. var self=this,$self=this;
  6429. return $core.withContext(function($ctx1) {
  6430. return $recv($self._y())._arcTan_($self._x());
  6431. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6432. },
  6433. args: [],
  6434. source: "angle\x0a\x09^ self y arcTan: self x",
  6435. referencedClasses: [],
  6436. messageSends: ["arcTan:", "y", "x"]
  6437. }),
  6438. $globals.Point);
  6439. $core.addMethod(
  6440. $core.method({
  6441. selector: "asPoint",
  6442. protocol: "converting",
  6443. fn: function (){
  6444. var self=this,$self=this;
  6445. return self;
  6446. },
  6447. args: [],
  6448. source: "asPoint\x0a\x09^ self",
  6449. referencedClasses: [],
  6450. messageSends: []
  6451. }),
  6452. $globals.Point);
  6453. $core.addMethod(
  6454. $core.method({
  6455. selector: "corner:",
  6456. protocol: "rectangle creation",
  6457. fn: function (aPoint){
  6458. var self=this,$self=this;
  6459. return $core.withContext(function($ctx1) {
  6460. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6461. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6462. },
  6463. args: ["aPoint"],
  6464. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6465. referencedClasses: ["Rectangle"],
  6466. messageSends: ["origin:corner:"]
  6467. }),
  6468. $globals.Point);
  6469. $core.addMethod(
  6470. $core.method({
  6471. selector: "dist:",
  6472. protocol: "transforming",
  6473. fn: function (aPoint){
  6474. var self=this,$self=this;
  6475. var dx,dy;
  6476. return $core.withContext(function($ctx1) {
  6477. var $2,$1;
  6478. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6479. $ctx1.sendIdx["-"]=1;
  6480. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6481. $2=$recv(dx).__star(dx);
  6482. $ctx1.sendIdx["*"]=1;
  6483. $1=$recv($2).__plus($recv(dy).__star(dy));
  6484. return $recv($1)._sqrt();
  6485. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6486. },
  6487. args: ["aPoint"],
  6488. 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",
  6489. referencedClasses: [],
  6490. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6491. }),
  6492. $globals.Point);
  6493. $core.addMethod(
  6494. $core.method({
  6495. selector: "dotProduct:",
  6496. protocol: "point functions",
  6497. fn: function (aPoint){
  6498. var self=this,$self=this;
  6499. return $core.withContext(function($ctx1) {
  6500. var $1;
  6501. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6502. $ctx1.sendIdx["*"]=1;
  6503. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6504. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6505. },
  6506. args: ["aPoint"],
  6507. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6508. referencedClasses: [],
  6509. messageSends: ["+", "*", "x", "y"]
  6510. }),
  6511. $globals.Point);
  6512. $core.addMethod(
  6513. $core.method({
  6514. selector: "extent:",
  6515. protocol: "rectangle creation",
  6516. fn: function (aPoint){
  6517. var self=this,$self=this;
  6518. return $core.withContext(function($ctx1) {
  6519. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6520. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6521. },
  6522. args: ["aPoint"],
  6523. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6524. referencedClasses: ["Rectangle"],
  6525. messageSends: ["origin:extent:"]
  6526. }),
  6527. $globals.Point);
  6528. $core.addMethod(
  6529. $core.method({
  6530. selector: "normal",
  6531. protocol: "point functions",
  6532. fn: function (){
  6533. var self=this,$self=this;
  6534. var n,d;
  6535. return $core.withContext(function($ctx1) {
  6536. var $4,$3,$6,$5,$2,$1;
  6537. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6538. $ctx1.sendIdx["@"]=1;
  6539. $4=$recv(n)._x();
  6540. $ctx1.sendIdx["x"]=1;
  6541. $3=$recv($4).__star($recv(n)._x());
  6542. $ctx1.sendIdx["*"]=1;
  6543. $6=$recv(n)._y();
  6544. $ctx1.sendIdx["y"]=1;
  6545. $5=$recv($6).__star($recv(n)._y());
  6546. d=$recv($3).__plus($5);
  6547. $2=d;
  6548. $1=$recv($2).__eq((0));
  6549. if($core.assert($1)){
  6550. return (-1).__at((0));
  6551. }
  6552. return $recv(n).__slash($recv(d)._sqrt());
  6553. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6554. },
  6555. args: [],
  6556. 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",
  6557. referencedClasses: [],
  6558. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6559. }),
  6560. $globals.Point);
  6561. $core.addMethod(
  6562. $core.method({
  6563. selector: "normalized",
  6564. protocol: "point functions",
  6565. fn: function (){
  6566. var self=this,$self=this;
  6567. var r;
  6568. return $core.withContext(function($ctx1) {
  6569. var $1,$2,$3;
  6570. r=$self._r();
  6571. $1=$recv(r).__eq((0));
  6572. if($core.assert($1)){
  6573. $2=$recv($globals.Point)._x_y_((0),(0));
  6574. $ctx1.sendIdx["x:y:"]=1;
  6575. return $2;
  6576. } else {
  6577. $3=$recv($self["@x"]).__slash(r);
  6578. $ctx1.sendIdx["/"]=1;
  6579. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6580. }
  6581. return self;
  6582. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6583. },
  6584. args: [],
  6585. 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 ]",
  6586. referencedClasses: ["Point"],
  6587. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6588. }),
  6589. $globals.Point);
  6590. $core.addMethod(
  6591. $core.method({
  6592. selector: "printOn:",
  6593. protocol: "printing",
  6594. fn: function (aStream){
  6595. var self=this,$self=this;
  6596. return $core.withContext(function($ctx1) {
  6597. var $1;
  6598. $recv($self["@x"])._printOn_(aStream);
  6599. $ctx1.sendIdx["printOn:"]=1;
  6600. $recv(aStream)._nextPutAll_("@");
  6601. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6602. return $core.withContext(function($ctx2) {
  6603. return $recv($self["@y"])._negative();
  6604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6605. }));
  6606. if($core.assert($1)){
  6607. $recv(aStream)._space();
  6608. }
  6609. $recv($self["@y"])._printOn_(aStream);
  6610. return self;
  6611. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6612. },
  6613. args: ["aStream"],
  6614. 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",
  6615. referencedClasses: [],
  6616. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6617. }),
  6618. $globals.Point);
  6619. $core.addMethod(
  6620. $core.method({
  6621. selector: "r",
  6622. protocol: "polar coordinates",
  6623. fn: function (){
  6624. var self=this,$self=this;
  6625. return $core.withContext(function($ctx1) {
  6626. var $2,$1;
  6627. $2=$recv($self["@x"]).__star($self["@x"]);
  6628. $ctx1.sendIdx["*"]=1;
  6629. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6630. return $recv($1)._sqrt();
  6631. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6632. },
  6633. args: [],
  6634. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6635. referencedClasses: [],
  6636. messageSends: ["sqrt", "+", "*"]
  6637. }),
  6638. $globals.Point);
  6639. $core.addMethod(
  6640. $core.method({
  6641. selector: "rectangle:",
  6642. protocol: "rectangle creation",
  6643. fn: function (aPoint){
  6644. var self=this,$self=this;
  6645. return $core.withContext(function($ctx1) {
  6646. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6647. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6648. },
  6649. args: ["aPoint"],
  6650. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6651. referencedClasses: ["Rectangle"],
  6652. messageSends: ["point:point:"]
  6653. }),
  6654. $globals.Point);
  6655. $core.addMethod(
  6656. $core.method({
  6657. selector: "translateBy:",
  6658. protocol: "transforming",
  6659. fn: function (delta){
  6660. var self=this,$self=this;
  6661. return $core.withContext(function($ctx1) {
  6662. var $1;
  6663. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6664. $ctx1.sendIdx["+"]=1;
  6665. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6666. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6667. },
  6668. args: ["delta"],
  6669. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6670. referencedClasses: [],
  6671. messageSends: ["@", "+", "x", "y"]
  6672. }),
  6673. $globals.Point);
  6674. $core.addMethod(
  6675. $core.method({
  6676. selector: "x",
  6677. protocol: "accessing",
  6678. fn: function (){
  6679. var self=this,$self=this;
  6680. return $self["@x"];
  6681. },
  6682. args: [],
  6683. source: "x\x0a\x09^ x",
  6684. referencedClasses: [],
  6685. messageSends: []
  6686. }),
  6687. $globals.Point);
  6688. $core.addMethod(
  6689. $core.method({
  6690. selector: "x:",
  6691. protocol: "accessing",
  6692. fn: function (aNumber){
  6693. var self=this,$self=this;
  6694. $self["@x"]=aNumber;
  6695. return self;
  6696. },
  6697. args: ["aNumber"],
  6698. source: "x: aNumber\x0a\x09x := aNumber",
  6699. referencedClasses: [],
  6700. messageSends: []
  6701. }),
  6702. $globals.Point);
  6703. $core.addMethod(
  6704. $core.method({
  6705. selector: "y",
  6706. protocol: "accessing",
  6707. fn: function (){
  6708. var self=this,$self=this;
  6709. return $self["@y"];
  6710. },
  6711. args: [],
  6712. source: "y\x0a\x09^ y",
  6713. referencedClasses: [],
  6714. messageSends: []
  6715. }),
  6716. $globals.Point);
  6717. $core.addMethod(
  6718. $core.method({
  6719. selector: "y:",
  6720. protocol: "accessing",
  6721. fn: function (aNumber){
  6722. var self=this,$self=this;
  6723. $self["@y"]=aNumber;
  6724. return self;
  6725. },
  6726. args: ["aNumber"],
  6727. source: "y: aNumber\x0a\x09y := aNumber",
  6728. referencedClasses: [],
  6729. messageSends: []
  6730. }),
  6731. $globals.Point);
  6732. $core.addMethod(
  6733. $core.method({
  6734. selector: "classTag",
  6735. protocol: "accessing",
  6736. fn: function (){
  6737. var self=this,$self=this;
  6738. return "magnitude";
  6739. },
  6740. args: [],
  6741. 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'",
  6742. referencedClasses: [],
  6743. messageSends: []
  6744. }),
  6745. $globals.Point.a$cls);
  6746. $core.addMethod(
  6747. $core.method({
  6748. selector: "x:y:",
  6749. protocol: "instance creation",
  6750. fn: function (aNumber,anotherNumber){
  6751. var self=this,$self=this;
  6752. return $core.withContext(function($ctx1) {
  6753. var $1;
  6754. $1=$self._new();
  6755. $recv($1)._x_(aNumber);
  6756. $recv($1)._y_(anotherNumber);
  6757. return $recv($1)._yourself();
  6758. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6759. },
  6760. args: ["aNumber", "anotherNumber"],
  6761. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6762. referencedClasses: [],
  6763. messageSends: ["x:", "new", "y:", "yourself"]
  6764. }),
  6765. $globals.Point.a$cls);
  6766. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6767. $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'`.";
  6768. $core.addMethod(
  6769. $core.method({
  6770. selector: "next",
  6771. protocol: "accessing",
  6772. fn: function (){
  6773. var self=this,$self=this;
  6774. return $core.withContext(function($ctx1) {
  6775. return Math.random();
  6776. return self;
  6777. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6778. },
  6779. args: [],
  6780. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6781. referencedClasses: [],
  6782. messageSends: []
  6783. }),
  6784. $globals.Random);
  6785. $core.addMethod(
  6786. $core.method({
  6787. selector: "next:",
  6788. protocol: "accessing",
  6789. fn: function (anInteger){
  6790. var self=this,$self=this;
  6791. return $core.withContext(function($ctx1) {
  6792. return $recv((1)._to_(anInteger))._collect_((function(each){
  6793. return $core.withContext(function($ctx2) {
  6794. return $self._next();
  6795. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6796. }));
  6797. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6798. },
  6799. args: ["anInteger"],
  6800. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6801. referencedClasses: [],
  6802. messageSends: ["collect:", "to:", "next"]
  6803. }),
  6804. $globals.Random);
  6805. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6806. $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.";
  6807. $core.addMethod(
  6808. $core.method({
  6809. selector: "=",
  6810. protocol: "testing",
  6811. fn: function (aRectangle){
  6812. var self=this,$self=this;
  6813. return $core.withContext(function($ctx1) {
  6814. var $1;
  6815. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6816. $ctx1.sendIdx["="]=1;
  6817. return $recv($1)._and_((function(){
  6818. return $core.withContext(function($ctx2) {
  6819. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6821. }));
  6822. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6823. },
  6824. args: ["aRectangle"],
  6825. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6826. referencedClasses: [],
  6827. messageSends: ["and:", "=", "origin", "corner"]
  6828. }),
  6829. $globals.Rectangle);
  6830. $core.addMethod(
  6831. $core.method({
  6832. selector: "containsPoint:",
  6833. protocol: "testing",
  6834. fn: function (aPoint){
  6835. var self=this,$self=this;
  6836. return $core.withContext(function($ctx1) {
  6837. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6838. return $core.withContext(function($ctx2) {
  6839. return $recv($self["@corner"]).__gt_eq(aPoint);
  6840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6841. }));
  6842. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6843. },
  6844. args: ["aPoint"],
  6845. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6846. referencedClasses: [],
  6847. messageSends: ["and:", "<=", ">="]
  6848. }),
  6849. $globals.Rectangle);
  6850. $core.addMethod(
  6851. $core.method({
  6852. selector: "containsRect:",
  6853. protocol: "testing",
  6854. fn: function (aRect){
  6855. var self=this,$self=this;
  6856. return $core.withContext(function($ctx1) {
  6857. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6858. return $core.withContext(function($ctx2) {
  6859. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6861. }));
  6862. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6863. },
  6864. args: ["aRect"],
  6865. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6866. referencedClasses: [],
  6867. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6868. }),
  6869. $globals.Rectangle);
  6870. $core.addMethod(
  6871. $core.method({
  6872. selector: "corner",
  6873. protocol: "accessing",
  6874. fn: function (){
  6875. var self=this,$self=this;
  6876. return $self["@corner"];
  6877. },
  6878. args: [],
  6879. source: "corner\x0a\x09^ corner",
  6880. referencedClasses: [],
  6881. messageSends: []
  6882. }),
  6883. $globals.Rectangle);
  6884. $core.addMethod(
  6885. $core.method({
  6886. selector: "origin",
  6887. protocol: "accessing",
  6888. fn: function (){
  6889. var self=this,$self=this;
  6890. return $self["@origin"];
  6891. },
  6892. args: [],
  6893. source: "origin\x0a\x09^ origin",
  6894. referencedClasses: [],
  6895. messageSends: []
  6896. }),
  6897. $globals.Rectangle);
  6898. $core.addMethod(
  6899. $core.method({
  6900. selector: "printOn:",
  6901. protocol: "testing",
  6902. fn: function (aStream){
  6903. var self=this,$self=this;
  6904. return $core.withContext(function($ctx1) {
  6905. $recv($self["@origin"])._printOn_(aStream);
  6906. $ctx1.sendIdx["printOn:"]=1;
  6907. $recv(aStream)._nextPutAll_(" corner: ");
  6908. $recv($self["@corner"])._printOn_(aStream);
  6909. return self;
  6910. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6911. },
  6912. args: ["aStream"],
  6913. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6914. referencedClasses: [],
  6915. messageSends: ["printOn:", "nextPutAll:"]
  6916. }),
  6917. $globals.Rectangle);
  6918. $core.addMethod(
  6919. $core.method({
  6920. selector: "setPoint:point:",
  6921. protocol: "private",
  6922. fn: function (pt1,pt2){
  6923. var self=this,$self=this;
  6924. return $core.withContext(function($ctx1) {
  6925. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6926. $2=$recv(pt1)._x();
  6927. $ctx1.sendIdx["x"]=1;
  6928. $3=$recv(pt2)._x();
  6929. $ctx1.sendIdx["x"]=2;
  6930. $1=$recv($2)._min_($3);
  6931. $ctx1.sendIdx["min:"]=1;
  6932. $5=$recv(pt1)._y();
  6933. $ctx1.sendIdx["y"]=1;
  6934. $6=$recv(pt2)._y();
  6935. $ctx1.sendIdx["y"]=2;
  6936. $4=$recv($5)._min_($6);
  6937. $self["@origin"]=$recv($1).__at($4);
  6938. $ctx1.sendIdx["@"]=1;
  6939. $8=$recv(pt1)._x();
  6940. $ctx1.sendIdx["x"]=3;
  6941. $7=$recv($8)._max_($recv(pt2)._x());
  6942. $ctx1.sendIdx["max:"]=1;
  6943. $10=$recv(pt1)._y();
  6944. $ctx1.sendIdx["y"]=3;
  6945. $9=$recv($10)._max_($recv(pt2)._y());
  6946. $self["@corner"]=$recv($7).__at($9);
  6947. return self;
  6948. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6949. },
  6950. args: ["pt1", "pt2"],
  6951. 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).",
  6952. referencedClasses: [],
  6953. messageSends: ["@", "min:", "x", "y", "max:"]
  6954. }),
  6955. $globals.Rectangle);
  6956. $core.addMethod(
  6957. $core.method({
  6958. selector: "origin:corner:",
  6959. protocol: "instance creation",
  6960. fn: function (anOrigin,aCorner){
  6961. var self=this,$self=this;
  6962. return $core.withContext(function($ctx1) {
  6963. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6964. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6965. },
  6966. args: ["anOrigin", "aCorner"],
  6967. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6968. referencedClasses: [],
  6969. messageSends: ["setPoint:point:", "basicNew"]
  6970. }),
  6971. $globals.Rectangle.a$cls);
  6972. $core.addMethod(
  6973. $core.method({
  6974. selector: "origin:extent:",
  6975. protocol: "instance creation",
  6976. fn: function (anOrigin,anExtent){
  6977. var self=this,$self=this;
  6978. return $core.withContext(function($ctx1) {
  6979. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  6980. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  6981. },
  6982. args: ["anOrigin", "anExtent"],
  6983. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  6984. referencedClasses: [],
  6985. messageSends: ["setPoint:point:", "basicNew", "+"]
  6986. }),
  6987. $globals.Rectangle.a$cls);
  6988. $core.addMethod(
  6989. $core.method({
  6990. selector: "point:point:",
  6991. protocol: "instance creation",
  6992. fn: function (anOrigin,aCorner){
  6993. var self=this,$self=this;
  6994. return $core.withContext(function($ctx1) {
  6995. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6996. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6997. },
  6998. args: ["anOrigin", "aCorner"],
  6999. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7000. referencedClasses: [],
  7001. messageSends: ["setPoint:point:", "basicNew"]
  7002. }),
  7003. $globals.Rectangle.a$cls);
  7004. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7005. $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`.";
  7006. $core.addMethod(
  7007. $core.method({
  7008. selector: "==",
  7009. protocol: "testing",
  7010. fn: function (anObject){
  7011. var self=this,$self=this;
  7012. return $core.withContext(function($ctx1) {
  7013. return $recv(anObject)._isNil();
  7014. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7015. },
  7016. args: ["anObject"],
  7017. source: "== anObject\x0a\x09^ anObject isNil",
  7018. referencedClasses: [],
  7019. messageSends: ["isNil"]
  7020. }),
  7021. $globals.UndefinedObject);
  7022. $core.addMethod(
  7023. $core.method({
  7024. selector: "asJavaScriptObject",
  7025. protocol: "converting",
  7026. fn: function (){
  7027. var self=this,$self=this;
  7028. return null;
  7029. },
  7030. args: [],
  7031. source: "asJavaScriptObject\x0a\x09^ null",
  7032. referencedClasses: [],
  7033. messageSends: []
  7034. }),
  7035. $globals.UndefinedObject);
  7036. $core.addMethod(
  7037. $core.method({
  7038. selector: "deepCopy",
  7039. protocol: "copying",
  7040. fn: function (){
  7041. var self=this,$self=this;
  7042. return self;
  7043. },
  7044. args: [],
  7045. source: "deepCopy\x0a\x09^ self",
  7046. referencedClasses: [],
  7047. messageSends: []
  7048. }),
  7049. $globals.UndefinedObject);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "identityHash",
  7053. protocol: "accessing",
  7054. fn: function (){
  7055. var self=this,$self=this;
  7056. return "NIL";
  7057. },
  7058. args: [],
  7059. source: "identityHash\x0a\x09^ 'NIL'",
  7060. referencedClasses: [],
  7061. messageSends: []
  7062. }),
  7063. $globals.UndefinedObject);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "ifNil:",
  7067. protocol: "testing",
  7068. fn: function (aBlock){
  7069. var self=this,$self=this;
  7070. return $core.withContext(function($ctx1) {
  7071. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7072. }));
  7073. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7074. },
  7075. args: ["aBlock"],
  7076. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7077. referencedClasses: [],
  7078. messageSends: ["ifNil:ifNotNil:"]
  7079. }),
  7080. $globals.UndefinedObject);
  7081. $core.addMethod(
  7082. $core.method({
  7083. selector: "ifNil:ifNotNil:",
  7084. protocol: "testing",
  7085. fn: function (aBlock,anotherBlock){
  7086. var self=this,$self=this;
  7087. return $core.withContext(function($ctx1) {
  7088. return $recv(aBlock)._value();
  7089. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7090. },
  7091. args: ["aBlock", "anotherBlock"],
  7092. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7093. referencedClasses: [],
  7094. messageSends: ["value"]
  7095. }),
  7096. $globals.UndefinedObject);
  7097. $core.addMethod(
  7098. $core.method({
  7099. selector: "ifNotNil:",
  7100. protocol: "testing",
  7101. fn: function (aBlock){
  7102. var self=this,$self=this;
  7103. return self;
  7104. },
  7105. args: ["aBlock"],
  7106. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7107. referencedClasses: [],
  7108. messageSends: []
  7109. }),
  7110. $globals.UndefinedObject);
  7111. $core.addMethod(
  7112. $core.method({
  7113. selector: "ifNotNil:ifNil:",
  7114. protocol: "testing",
  7115. fn: function (aBlock,anotherBlock){
  7116. var self=this,$self=this;
  7117. return $core.withContext(function($ctx1) {
  7118. return $recv(anotherBlock)._value();
  7119. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7120. },
  7121. args: ["aBlock", "anotherBlock"],
  7122. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7123. referencedClasses: [],
  7124. messageSends: ["value"]
  7125. }),
  7126. $globals.UndefinedObject);
  7127. $core.addMethod(
  7128. $core.method({
  7129. selector: "isImmutable",
  7130. protocol: "testing",
  7131. fn: function (){
  7132. var self=this,$self=this;
  7133. return true;
  7134. },
  7135. args: [],
  7136. source: "isImmutable\x0a\x09^ true",
  7137. referencedClasses: [],
  7138. messageSends: []
  7139. }),
  7140. $globals.UndefinedObject);
  7141. $core.addMethod(
  7142. $core.method({
  7143. selector: "isNil",
  7144. protocol: "testing",
  7145. fn: function (){
  7146. var self=this,$self=this;
  7147. return true;
  7148. },
  7149. args: [],
  7150. source: "isNil\x0a\x09^ true",
  7151. referencedClasses: [],
  7152. messageSends: []
  7153. }),
  7154. $globals.UndefinedObject);
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "notNil",
  7158. protocol: "testing",
  7159. fn: function (){
  7160. var self=this,$self=this;
  7161. return false;
  7162. },
  7163. args: [],
  7164. source: "notNil\x0a\x09^ false",
  7165. referencedClasses: [],
  7166. messageSends: []
  7167. }),
  7168. $globals.UndefinedObject);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "printOn:",
  7172. protocol: "printing",
  7173. fn: function (aStream){
  7174. var self=this,$self=this;
  7175. return $core.withContext(function($ctx1) {
  7176. $recv(aStream)._nextPutAll_("nil");
  7177. return self;
  7178. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7179. },
  7180. args: ["aStream"],
  7181. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7182. referencedClasses: [],
  7183. messageSends: ["nextPutAll:"]
  7184. }),
  7185. $globals.UndefinedObject);
  7186. $core.addMethod(
  7187. $core.method({
  7188. selector: "shallowCopy",
  7189. protocol: "copying",
  7190. fn: function (){
  7191. var self=this,$self=this;
  7192. return self;
  7193. },
  7194. args: [],
  7195. source: "shallowCopy\x0a\x09^ self",
  7196. referencedClasses: [],
  7197. messageSends: []
  7198. }),
  7199. $globals.UndefinedObject);
  7200. $core.addMethod(
  7201. $core.method({
  7202. selector: "value",
  7203. protocol: "evaluating",
  7204. fn: function (){
  7205. var self=this,$self=this;
  7206. return $core.withContext(function($ctx1) {
  7207. return null;
  7208. return self;
  7209. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7210. },
  7211. args: [],
  7212. source: "value\x0a\x09<inlineJS: 'return null'>",
  7213. referencedClasses: [],
  7214. messageSends: []
  7215. }),
  7216. $globals.UndefinedObject);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "new",
  7220. protocol: "instance creation",
  7221. fn: function (){
  7222. var self=this,$self=this;
  7223. return $core.withContext(function($ctx1) {
  7224. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7225. return self;
  7226. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7227. },
  7228. args: [],
  7229. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7230. referencedClasses: [],
  7231. messageSends: ["error:"]
  7232. }),
  7233. $globals.UndefinedObject.a$cls);
  7234. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7235. });
  7236. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7237. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7238. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7239. $core.addPackage("Kernel-Collections");
  7240. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7241. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7242. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7243. $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:`";
  7244. $core.addMethod(
  7245. $core.method({
  7246. selector: "=",
  7247. protocol: "comparing",
  7248. fn: function (anAssociation){
  7249. var self=this,$self=this;
  7250. return $core.withContext(function($ctx1) {
  7251. var $3,$2,$5,$4,$6,$1;
  7252. $3=$self._class();
  7253. $ctx1.sendIdx["class"]=1;
  7254. $2=$recv($3).__eq($recv(anAssociation)._class());
  7255. $ctx1.sendIdx["="]=1;
  7256. $1=$recv($2)._and_((function(){
  7257. return $core.withContext(function($ctx2) {
  7258. $5=$self._key();
  7259. $ctx2.sendIdx["key"]=1;
  7260. $4=$recv($5).__eq($recv(anAssociation)._key());
  7261. $ctx2.sendIdx["="]=2;
  7262. return $recv($4)._and_((function(){
  7263. return $core.withContext(function($ctx3) {
  7264. $6=$self._value();
  7265. $ctx3.sendIdx["value"]=1;
  7266. return $recv($6).__eq($recv(anAssociation)._value());
  7267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7268. }));
  7269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7270. }));
  7271. $ctx1.sendIdx["and:"]=1;
  7272. return $1;
  7273. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7274. },
  7275. args: ["anAssociation"],
  7276. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7277. referencedClasses: [],
  7278. messageSends: ["and:", "=", "class", "key", "value"]
  7279. }),
  7280. $globals.Association);
  7281. $core.addMethod(
  7282. $core.method({
  7283. selector: "key",
  7284. protocol: "accessing",
  7285. fn: function (){
  7286. var self=this,$self=this;
  7287. return $self["@key"];
  7288. },
  7289. args: [],
  7290. source: "key\x0a\x09^ key",
  7291. referencedClasses: [],
  7292. messageSends: []
  7293. }),
  7294. $globals.Association);
  7295. $core.addMethod(
  7296. $core.method({
  7297. selector: "key:",
  7298. protocol: "accessing",
  7299. fn: function (aKey){
  7300. var self=this,$self=this;
  7301. $self["@key"]=aKey;
  7302. return self;
  7303. },
  7304. args: ["aKey"],
  7305. source: "key: aKey\x0a\x09key := aKey",
  7306. referencedClasses: [],
  7307. messageSends: []
  7308. }),
  7309. $globals.Association);
  7310. $core.addMethod(
  7311. $core.method({
  7312. selector: "printOn:",
  7313. protocol: "printing",
  7314. fn: function (aStream){
  7315. var self=this,$self=this;
  7316. return $core.withContext(function($ctx1) {
  7317. $recv($self._key())._printOn_(aStream);
  7318. $ctx1.sendIdx["printOn:"]=1;
  7319. $recv(aStream)._nextPutAll_(" -> ");
  7320. $recv($self._value())._printOn_(aStream);
  7321. return self;
  7322. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7323. },
  7324. args: ["aStream"],
  7325. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7326. referencedClasses: [],
  7327. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7328. }),
  7329. $globals.Association);
  7330. $core.addMethod(
  7331. $core.method({
  7332. selector: "value",
  7333. protocol: "accessing",
  7334. fn: function (){
  7335. var self=this,$self=this;
  7336. return $self["@value"];
  7337. },
  7338. args: [],
  7339. source: "value\x0a\x09^ value",
  7340. referencedClasses: [],
  7341. messageSends: []
  7342. }),
  7343. $globals.Association);
  7344. $core.addMethod(
  7345. $core.method({
  7346. selector: "value:",
  7347. protocol: "accessing",
  7348. fn: function (aValue){
  7349. var self=this,$self=this;
  7350. $self["@value"]=aValue;
  7351. return self;
  7352. },
  7353. args: ["aValue"],
  7354. source: "value: aValue\x0a\x09value := aValue",
  7355. referencedClasses: [],
  7356. messageSends: []
  7357. }),
  7358. $globals.Association);
  7359. $core.addMethod(
  7360. $core.method({
  7361. selector: "key:value:",
  7362. protocol: "instance creation",
  7363. fn: function (aKey,aValue){
  7364. var self=this,$self=this;
  7365. return $core.withContext(function($ctx1) {
  7366. var $1;
  7367. $1=$self._new();
  7368. $recv($1)._key_(aKey);
  7369. $recv($1)._value_(aValue);
  7370. return $recv($1)._yourself();
  7371. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7372. },
  7373. args: ["aKey", "aValue"],
  7374. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7375. referencedClasses: [],
  7376. messageSends: ["key:", "new", "value:", "yourself"]
  7377. }),
  7378. $globals.Association.a$cls);
  7379. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7380. $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`.";
  7381. $core.addMethod(
  7382. $core.method({
  7383. selector: "bucketOfElement:",
  7384. protocol: "accessing",
  7385. fn: function (anObject){
  7386. var self=this,$self=this;
  7387. return $core.withContext(function($ctx1) {
  7388. var hash = $self['@hashBlock'](anObject);
  7389. if (!hash) return null;
  7390. var buckets = $self['@buckets'],
  7391. bucket = buckets[hash];
  7392. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7393. return bucket;
  7394. ;
  7395. return self;
  7396. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7397. },
  7398. args: ["anObject"],
  7399. 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'>",
  7400. referencedClasses: [],
  7401. messageSends: []
  7402. }),
  7403. $globals.BucketStore);
  7404. $core.addMethod(
  7405. $core.method({
  7406. selector: "do:",
  7407. protocol: "enumerating",
  7408. fn: function (aBlock){
  7409. var self=this,$self=this;
  7410. return $core.withContext(function($ctx1) {
  7411. var buckets = $self['@buckets'];
  7412. var keys = Object.keys(buckets);
  7413. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7414. ;
  7415. return self;
  7416. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7417. },
  7418. args: ["aBlock"],
  7419. 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'>",
  7420. referencedClasses: [],
  7421. messageSends: []
  7422. }),
  7423. $globals.BucketStore);
  7424. $core.addMethod(
  7425. $core.method({
  7426. selector: "hashBlock:",
  7427. protocol: "accessing",
  7428. fn: function (aBlock){
  7429. var self=this,$self=this;
  7430. $self["@hashBlock"]=aBlock;
  7431. return self;
  7432. },
  7433. args: ["aBlock"],
  7434. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7435. referencedClasses: [],
  7436. messageSends: []
  7437. }),
  7438. $globals.BucketStore);
  7439. $core.addMethod(
  7440. $core.method({
  7441. selector: "initialize",
  7442. protocol: "initialization",
  7443. fn: function (){
  7444. var self=this,$self=this;
  7445. return $core.withContext(function($ctx1) {
  7446. (
  7447. $ctx1.supercall = true,
  7448. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7449. $ctx1.supercall = false;
  7450. $self._removeAll();
  7451. return self;
  7452. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7453. },
  7454. args: [],
  7455. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7456. referencedClasses: [],
  7457. messageSends: ["initialize", "removeAll"]
  7458. }),
  7459. $globals.BucketStore);
  7460. $core.addMethod(
  7461. $core.method({
  7462. selector: "newBucket",
  7463. protocol: "private",
  7464. fn: function (){
  7465. var self=this,$self=this;
  7466. return $core.withContext(function($ctx1) {
  7467. $self._subclassResponsibility();
  7468. return self;
  7469. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7470. },
  7471. args: [],
  7472. source: "newBucket\x0a\x09self subclassResponsibility",
  7473. referencedClasses: [],
  7474. messageSends: ["subclassResponsibility"]
  7475. }),
  7476. $globals.BucketStore);
  7477. $core.addMethod(
  7478. $core.method({
  7479. selector: "removeAll",
  7480. protocol: "adding/removing",
  7481. fn: function (){
  7482. var self=this,$self=this;
  7483. return $core.withContext(function($ctx1) {
  7484. $self['@buckets'] = Object.create(null);;
  7485. return self;
  7486. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7487. },
  7488. args: [],
  7489. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7490. referencedClasses: [],
  7491. messageSends: []
  7492. }),
  7493. $globals.BucketStore);
  7494. $core.addMethod(
  7495. $core.method({
  7496. selector: "hashBlock:",
  7497. protocol: "instance creation",
  7498. fn: function (aBlock){
  7499. var self=this,$self=this;
  7500. return $core.withContext(function($ctx1) {
  7501. var $1;
  7502. $1=$self._new();
  7503. $recv($1)._hashBlock_(aBlock);
  7504. return $recv($1)._yourself();
  7505. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7506. },
  7507. args: ["aBlock"],
  7508. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7509. referencedClasses: [],
  7510. messageSends: ["hashBlock:", "new", "yourself"]
  7511. }),
  7512. $globals.BucketStore.a$cls);
  7513. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7514. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7515. $core.addMethod(
  7516. $core.method({
  7517. selector: "newBucket",
  7518. protocol: "private",
  7519. fn: function (){
  7520. var self=this,$self=this;
  7521. return [];
  7522. },
  7523. args: [],
  7524. source: "newBucket\x0a\x09^ #()",
  7525. referencedClasses: [],
  7526. messageSends: []
  7527. }),
  7528. $globals.ArrayBucketStore);
  7529. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7530. $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.";
  7531. $core.addMethod(
  7532. $core.method({
  7533. selector: ",",
  7534. protocol: "copying",
  7535. fn: function (aCollection){
  7536. var self=this,$self=this;
  7537. return $core.withContext(function($ctx1) {
  7538. var $1;
  7539. $1=$self._copy();
  7540. $recv($1)._addAll_(aCollection);
  7541. return $recv($1)._yourself();
  7542. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7543. },
  7544. args: ["aCollection"],
  7545. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7546. referencedClasses: [],
  7547. messageSends: ["addAll:", "copy", "yourself"]
  7548. }),
  7549. $globals.Collection);
  7550. $core.addMethod(
  7551. $core.method({
  7552. selector: "add:",
  7553. protocol: "adding/removing",
  7554. fn: function (anObject){
  7555. var self=this,$self=this;
  7556. return $core.withContext(function($ctx1) {
  7557. $self._subclassResponsibility();
  7558. return self;
  7559. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7560. },
  7561. args: ["anObject"],
  7562. source: "add: anObject\x0a\x09self subclassResponsibility",
  7563. referencedClasses: [],
  7564. messageSends: ["subclassResponsibility"]
  7565. }),
  7566. $globals.Collection);
  7567. $core.addMethod(
  7568. $core.method({
  7569. selector: "addAll:",
  7570. protocol: "adding/removing",
  7571. fn: function (aCollection){
  7572. var self=this,$self=this;
  7573. return $core.withContext(function($ctx1) {
  7574. $recv(aCollection)._do_((function(each){
  7575. return $core.withContext(function($ctx2) {
  7576. return $self._add_(each);
  7577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7578. }));
  7579. return aCollection;
  7580. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7581. },
  7582. args: ["aCollection"],
  7583. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7584. referencedClasses: [],
  7585. messageSends: ["do:", "add:"]
  7586. }),
  7587. $globals.Collection);
  7588. $core.addMethod(
  7589. $core.method({
  7590. selector: "allSatisfy:",
  7591. protocol: "enumerating",
  7592. fn: function (aBlock){
  7593. var self=this,$self=this;
  7594. return $core.withContext(function($ctx1) {
  7595. var $1;
  7596. var $early={};
  7597. try {
  7598. $self._do_((function(each){
  7599. return $core.withContext(function($ctx2) {
  7600. $1=$recv(aBlock)._value_(each);
  7601. if(!$core.assert($1)){
  7602. throw $early=[false];
  7603. }
  7604. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7605. }));
  7606. return true;
  7607. }
  7608. catch(e) {if(e===$early)return e[0]; throw e}
  7609. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7610. },
  7611. args: ["aBlock"],
  7612. 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",
  7613. referencedClasses: [],
  7614. messageSends: ["do:", "ifFalse:", "value:"]
  7615. }),
  7616. $globals.Collection);
  7617. $core.addMethod(
  7618. $core.method({
  7619. selector: "anyOne",
  7620. protocol: "accessing",
  7621. fn: function (){
  7622. var self=this,$self=this;
  7623. return $core.withContext(function($ctx1) {
  7624. var $early={};
  7625. try {
  7626. $self._ifEmpty_((function(){
  7627. return $core.withContext(function($ctx2) {
  7628. return $self._error_("Collection is empty");
  7629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7630. }));
  7631. $self._do_((function(each){
  7632. throw $early=[each];
  7633. }));
  7634. return self;
  7635. }
  7636. catch(e) {if(e===$early)return e[0]; throw e}
  7637. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7638. },
  7639. args: [],
  7640. 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 ]",
  7641. referencedClasses: [],
  7642. messageSends: ["ifEmpty:", "error:", "do:"]
  7643. }),
  7644. $globals.Collection);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "anySatisfy:",
  7648. protocol: "enumerating",
  7649. fn: function (aBlock){
  7650. var self=this,$self=this;
  7651. return $core.withContext(function($ctx1) {
  7652. var $1;
  7653. var $early={};
  7654. try {
  7655. $self._do_((function(each){
  7656. return $core.withContext(function($ctx2) {
  7657. $1=$recv(aBlock)._value_(each);
  7658. if($core.assert($1)){
  7659. throw $early=[true];
  7660. }
  7661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7662. }));
  7663. return false;
  7664. }
  7665. catch(e) {if(e===$early)return e[0]; throw e}
  7666. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7667. },
  7668. args: ["aBlock"],
  7669. 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",
  7670. referencedClasses: [],
  7671. messageSends: ["do:", "ifTrue:", "value:"]
  7672. }),
  7673. $globals.Collection);
  7674. $core.addMethod(
  7675. $core.method({
  7676. selector: "asArray",
  7677. protocol: "converting",
  7678. fn: function (){
  7679. var self=this,$self=this;
  7680. return $core.withContext(function($ctx1) {
  7681. return $recv($globals.Array)._withAll_(self);
  7682. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7683. },
  7684. args: [],
  7685. source: "asArray\x0a\x09^ Array withAll: self",
  7686. referencedClasses: ["Array"],
  7687. messageSends: ["withAll:"]
  7688. }),
  7689. $globals.Collection);
  7690. $core.addMethod(
  7691. $core.method({
  7692. selector: "asJavaScriptObject",
  7693. protocol: "converting",
  7694. fn: function (){
  7695. var self=this,$self=this;
  7696. return $core.withContext(function($ctx1) {
  7697. return $recv($self._asArray())._collect_((function(each){
  7698. return $core.withContext(function($ctx2) {
  7699. return $recv(each)._asJavaScriptObject();
  7700. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7701. }));
  7702. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7703. },
  7704. args: [],
  7705. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7706. referencedClasses: [],
  7707. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7708. }),
  7709. $globals.Collection);
  7710. $core.addMethod(
  7711. $core.method({
  7712. selector: "asOrderedCollection",
  7713. protocol: "converting",
  7714. fn: function (){
  7715. var self=this,$self=this;
  7716. return $core.withContext(function($ctx1) {
  7717. return $self._asArray();
  7718. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7719. },
  7720. args: [],
  7721. source: "asOrderedCollection\x0a\x09^ self asArray",
  7722. referencedClasses: [],
  7723. messageSends: ["asArray"]
  7724. }),
  7725. $globals.Collection);
  7726. $core.addMethod(
  7727. $core.method({
  7728. selector: "asSet",
  7729. protocol: "converting",
  7730. fn: function (){
  7731. var self=this,$self=this;
  7732. return $core.withContext(function($ctx1) {
  7733. return $recv($globals.Set)._withAll_(self);
  7734. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7735. },
  7736. args: [],
  7737. source: "asSet\x0a\x09^ Set withAll: self",
  7738. referencedClasses: ["Set"],
  7739. messageSends: ["withAll:"]
  7740. }),
  7741. $globals.Collection);
  7742. $core.addMethod(
  7743. $core.method({
  7744. selector: "collect:",
  7745. protocol: "enumerating",
  7746. fn: function (aBlock){
  7747. var self=this,$self=this;
  7748. var stream;
  7749. return $core.withContext(function($ctx1) {
  7750. stream=$recv($recv($self._class())._new())._writeStream();
  7751. $self._do_((function(each){
  7752. return $core.withContext(function($ctx2) {
  7753. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7755. }));
  7756. return $recv(stream)._contents();
  7757. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7758. },
  7759. args: ["aBlock"],
  7760. 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",
  7761. referencedClasses: [],
  7762. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7763. }),
  7764. $globals.Collection);
  7765. $core.addMethod(
  7766. $core.method({
  7767. selector: "copyWith:",
  7768. protocol: "copying",
  7769. fn: function (anObject){
  7770. var self=this,$self=this;
  7771. return $core.withContext(function($ctx1) {
  7772. var $1;
  7773. $1=$self._copy();
  7774. $recv($1)._add_(anObject);
  7775. return $recv($1)._yourself();
  7776. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7777. },
  7778. args: ["anObject"],
  7779. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7780. referencedClasses: [],
  7781. messageSends: ["add:", "copy", "yourself"]
  7782. }),
  7783. $globals.Collection);
  7784. $core.addMethod(
  7785. $core.method({
  7786. selector: "copyWithAll:",
  7787. protocol: "copying",
  7788. fn: function (aCollection){
  7789. var self=this,$self=this;
  7790. return $core.withContext(function($ctx1) {
  7791. var $1;
  7792. $1=$self._copy();
  7793. $recv($1)._addAll_(aCollection);
  7794. return $recv($1)._yourself();
  7795. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7796. },
  7797. args: ["aCollection"],
  7798. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  7799. referencedClasses: [],
  7800. messageSends: ["addAll:", "copy", "yourself"]
  7801. }),
  7802. $globals.Collection);
  7803. $core.addMethod(
  7804. $core.method({
  7805. selector: "copyWithout:",
  7806. protocol: "copying",
  7807. fn: function (anObject){
  7808. var self=this,$self=this;
  7809. return $core.withContext(function($ctx1) {
  7810. return $self._reject_((function(each){
  7811. return $core.withContext(function($ctx2) {
  7812. return $recv(each).__eq(anObject);
  7813. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7814. }));
  7815. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7816. },
  7817. args: ["anObject"],
  7818. 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 ]",
  7819. referencedClasses: [],
  7820. messageSends: ["reject:", "="]
  7821. }),
  7822. $globals.Collection);
  7823. $core.addMethod(
  7824. $core.method({
  7825. selector: "copyWithoutAll:",
  7826. protocol: "copying",
  7827. fn: function (aCollection){
  7828. var self=this,$self=this;
  7829. return $core.withContext(function($ctx1) {
  7830. return $self._reject_((function(each){
  7831. return $core.withContext(function($ctx2) {
  7832. return $recv(aCollection)._includes_(each);
  7833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7834. }));
  7835. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7836. },
  7837. args: ["aCollection"],
  7838. 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 ]",
  7839. referencedClasses: [],
  7840. messageSends: ["reject:", "includes:"]
  7841. }),
  7842. $globals.Collection);
  7843. $core.addMethod(
  7844. $core.method({
  7845. selector: "deepCopy",
  7846. protocol: "copying",
  7847. fn: function (){
  7848. var self=this,$self=this;
  7849. return $core.withContext(function($ctx1) {
  7850. return $self._collect_((function(each){
  7851. return $core.withContext(function($ctx2) {
  7852. return $recv(each)._deepCopy();
  7853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7854. }));
  7855. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7856. },
  7857. args: [],
  7858. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7859. referencedClasses: [],
  7860. messageSends: ["collect:", "deepCopy"]
  7861. }),
  7862. $globals.Collection);
  7863. $core.addMethod(
  7864. $core.method({
  7865. selector: "detect:",
  7866. protocol: "enumerating",
  7867. fn: function (aBlock){
  7868. var self=this,$self=this;
  7869. return $core.withContext(function($ctx1) {
  7870. return $self._detect_ifNone_(aBlock,(function(){
  7871. return $core.withContext(function($ctx2) {
  7872. return $self._errorNotFound();
  7873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7874. }));
  7875. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7876. },
  7877. args: ["aBlock"],
  7878. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7879. referencedClasses: [],
  7880. messageSends: ["detect:ifNone:", "errorNotFound"]
  7881. }),
  7882. $globals.Collection);
  7883. $core.addMethod(
  7884. $core.method({
  7885. selector: "detect:ifNone:",
  7886. protocol: "enumerating",
  7887. fn: function (aBlock,anotherBlock){
  7888. var self=this,$self=this;
  7889. return $core.withContext(function($ctx1) {
  7890. $self._subclassResponsibility();
  7891. return self;
  7892. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7893. },
  7894. args: ["aBlock", "anotherBlock"],
  7895. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  7896. referencedClasses: [],
  7897. messageSends: ["subclassResponsibility"]
  7898. }),
  7899. $globals.Collection);
  7900. $core.addMethod(
  7901. $core.method({
  7902. selector: "do:",
  7903. protocol: "enumerating",
  7904. fn: function (aBlock){
  7905. var self=this,$self=this;
  7906. return $core.withContext(function($ctx1) {
  7907. $self._subclassResponsibility();
  7908. return self;
  7909. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7910. },
  7911. args: ["aBlock"],
  7912. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7913. referencedClasses: [],
  7914. messageSends: ["subclassResponsibility"]
  7915. }),
  7916. $globals.Collection);
  7917. $core.addMethod(
  7918. $core.method({
  7919. selector: "do:separatedBy:",
  7920. protocol: "enumerating",
  7921. fn: function (aBlock,anotherBlock){
  7922. var self=this,$self=this;
  7923. var actionBeforeElement;
  7924. return $core.withContext(function($ctx1) {
  7925. actionBeforeElement=(function(){
  7926. actionBeforeElement=anotherBlock;
  7927. return actionBeforeElement;
  7928. });
  7929. $self._do_((function(each){
  7930. return $core.withContext(function($ctx2) {
  7931. $recv(actionBeforeElement)._value();
  7932. return $recv(aBlock)._value_(each);
  7933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7934. }));
  7935. return self;
  7936. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7937. },
  7938. args: ["aBlock", "anotherBlock"],
  7939. 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 ]",
  7940. referencedClasses: [],
  7941. messageSends: ["do:", "value", "value:"]
  7942. }),
  7943. $globals.Collection);
  7944. $core.addMethod(
  7945. $core.method({
  7946. selector: "errorNotFound",
  7947. protocol: "error handling",
  7948. fn: function (){
  7949. var self=this,$self=this;
  7950. return $core.withContext(function($ctx1) {
  7951. $self._error_("Object is not in the collection");
  7952. return self;
  7953. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7954. },
  7955. args: [],
  7956. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7957. referencedClasses: [],
  7958. messageSends: ["error:"]
  7959. }),
  7960. $globals.Collection);
  7961. $core.addMethod(
  7962. $core.method({
  7963. selector: "ifEmpty:",
  7964. protocol: "testing",
  7965. fn: function (aBlock){
  7966. var self=this,$self=this;
  7967. return $core.withContext(function($ctx1) {
  7968. var $1;
  7969. $1=$self._isEmpty();
  7970. if($core.assert($1)){
  7971. return $recv(aBlock)._value();
  7972. } else {
  7973. return self;
  7974. }
  7975. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7976. },
  7977. args: ["aBlock"],
  7978. 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 ]",
  7979. referencedClasses: [],
  7980. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7981. }),
  7982. $globals.Collection);
  7983. $core.addMethod(
  7984. $core.method({
  7985. selector: "ifEmpty:ifNotEmpty:",
  7986. protocol: "testing",
  7987. fn: function (aBlock,anotherBlock){
  7988. var self=this,$self=this;
  7989. return $core.withContext(function($ctx1) {
  7990. var $1;
  7991. $1=$self._isEmpty();
  7992. if($core.assert($1)){
  7993. return $recv(aBlock)._value();
  7994. } else {
  7995. return $recv(anotherBlock)._value_(self);
  7996. }
  7997. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7998. },
  7999. args: ["aBlock", "anotherBlock"],
  8000. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8001. referencedClasses: [],
  8002. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8003. }),
  8004. $globals.Collection);
  8005. $core.addMethod(
  8006. $core.method({
  8007. selector: "ifNotEmpty:",
  8008. protocol: "testing",
  8009. fn: function (aBlock){
  8010. var self=this,$self=this;
  8011. return $core.withContext(function($ctx1) {
  8012. var $1;
  8013. $1=$self._notEmpty();
  8014. if($core.assert($1)){
  8015. return $recv(aBlock)._value_(self);
  8016. } else {
  8017. return self;
  8018. }
  8019. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8020. },
  8021. args: ["aBlock"],
  8022. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8023. referencedClasses: [],
  8024. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8025. }),
  8026. $globals.Collection);
  8027. $core.addMethod(
  8028. $core.method({
  8029. selector: "ifNotEmpty:ifEmpty:",
  8030. protocol: "testing",
  8031. fn: function (aBlock,anotherBlock){
  8032. var self=this,$self=this;
  8033. return $core.withContext(function($ctx1) {
  8034. var $1;
  8035. $1=$self._notEmpty();
  8036. if($core.assert($1)){
  8037. return $recv(aBlock)._value_(self);
  8038. } else {
  8039. return $recv(anotherBlock)._value();
  8040. }
  8041. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8042. },
  8043. args: ["aBlock", "anotherBlock"],
  8044. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8045. referencedClasses: [],
  8046. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8047. }),
  8048. $globals.Collection);
  8049. $core.addMethod(
  8050. $core.method({
  8051. selector: "includes:",
  8052. protocol: "testing",
  8053. fn: function (anObject){
  8054. var self=this,$self=this;
  8055. return $core.withContext(function($ctx1) {
  8056. return $self._anySatisfy_((function(each){
  8057. return $core.withContext(function($ctx2) {
  8058. return $recv(each).__eq(anObject);
  8059. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8060. }));
  8061. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8062. },
  8063. args: ["anObject"],
  8064. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8065. referencedClasses: [],
  8066. messageSends: ["anySatisfy:", "="]
  8067. }),
  8068. $globals.Collection);
  8069. $core.addMethod(
  8070. $core.method({
  8071. selector: "inject:into:",
  8072. protocol: "enumerating",
  8073. fn: function (anObject,aBlock){
  8074. var self=this,$self=this;
  8075. var result;
  8076. return $core.withContext(function($ctx1) {
  8077. result=anObject;
  8078. $self._do_((function(each){
  8079. return $core.withContext(function($ctx2) {
  8080. result=$recv(aBlock)._value_value_(result,each);
  8081. return result;
  8082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8083. }));
  8084. return result;
  8085. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8086. },
  8087. args: ["anObject", "aBlock"],
  8088. 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",
  8089. referencedClasses: [],
  8090. messageSends: ["do:", "value:value:"]
  8091. }),
  8092. $globals.Collection);
  8093. $core.addMethod(
  8094. $core.method({
  8095. selector: "intersection:",
  8096. protocol: "enumerating",
  8097. fn: function (aCollection){
  8098. var self=this,$self=this;
  8099. var set,outputSet;
  8100. return $core.withContext(function($ctx1) {
  8101. var $2,$1;
  8102. set=$self._asSet();
  8103. outputSet=$recv($globals.Set)._new();
  8104. $recv(aCollection)._do_((function(each){
  8105. return $core.withContext(function($ctx2) {
  8106. $2=$recv(set)._includes_(each);
  8107. $ctx2.sendIdx["includes:"]=1;
  8108. $1=$recv($2)._and_((function(){
  8109. return $core.withContext(function($ctx3) {
  8110. return $recv($recv(outputSet)._includes_(each))._not();
  8111. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8112. }));
  8113. if($core.assert($1)){
  8114. return $recv(outputSet)._add_(each);
  8115. }
  8116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8117. }));
  8118. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8119. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8120. },
  8121. args: ["aCollection"],
  8122. 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",
  8123. referencedClasses: ["Set"],
  8124. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8125. }),
  8126. $globals.Collection);
  8127. $core.addMethod(
  8128. $core.method({
  8129. selector: "isEmpty",
  8130. protocol: "testing",
  8131. fn: function (){
  8132. var self=this,$self=this;
  8133. return $core.withContext(function($ctx1) {
  8134. return $recv($self._size()).__eq((0));
  8135. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8136. },
  8137. args: [],
  8138. source: "isEmpty\x0a\x09^ self size = 0",
  8139. referencedClasses: [],
  8140. messageSends: ["=", "size"]
  8141. }),
  8142. $globals.Collection);
  8143. $core.addMethod(
  8144. $core.method({
  8145. selector: "noneSatisfy:",
  8146. protocol: "enumerating",
  8147. fn: function (aBlock){
  8148. var self=this,$self=this;
  8149. return $core.withContext(function($ctx1) {
  8150. var $1;
  8151. var $early={};
  8152. try {
  8153. $self._do_((function(item){
  8154. return $core.withContext(function($ctx2) {
  8155. $1=$recv(aBlock)._value_(item);
  8156. if($core.assert($1)){
  8157. throw $early=[false];
  8158. }
  8159. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8160. }));
  8161. return true;
  8162. }
  8163. catch(e) {if(e===$early)return e[0]; throw e}
  8164. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8165. },
  8166. args: ["aBlock"],
  8167. 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",
  8168. referencedClasses: [],
  8169. messageSends: ["do:", "ifTrue:", "value:"]
  8170. }),
  8171. $globals.Collection);
  8172. $core.addMethod(
  8173. $core.method({
  8174. selector: "notEmpty",
  8175. protocol: "testing",
  8176. fn: function (){
  8177. var self=this,$self=this;
  8178. return $core.withContext(function($ctx1) {
  8179. return $recv($self._isEmpty())._not();
  8180. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8181. },
  8182. args: [],
  8183. source: "notEmpty\x0a\x09^ self isEmpty not",
  8184. referencedClasses: [],
  8185. messageSends: ["not", "isEmpty"]
  8186. }),
  8187. $globals.Collection);
  8188. $core.addMethod(
  8189. $core.method({
  8190. selector: "occurrencesOf:",
  8191. protocol: "accessing",
  8192. fn: function (anObject){
  8193. var self=this,$self=this;
  8194. var tally;
  8195. return $core.withContext(function($ctx1) {
  8196. var $1;
  8197. tally=(0);
  8198. $self._do_((function(each){
  8199. return $core.withContext(function($ctx2) {
  8200. $1=$recv(anObject).__eq(each);
  8201. if($core.assert($1)){
  8202. tally=$recv(tally).__plus((1));
  8203. return tally;
  8204. }
  8205. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8206. }));
  8207. return tally;
  8208. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8209. },
  8210. args: ["anObject"],
  8211. 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",
  8212. referencedClasses: [],
  8213. messageSends: ["do:", "ifTrue:", "=", "+"]
  8214. }),
  8215. $globals.Collection);
  8216. $core.addMethod(
  8217. $core.method({
  8218. selector: "putOn:",
  8219. protocol: "streaming",
  8220. fn: function (aStream){
  8221. var self=this,$self=this;
  8222. return $core.withContext(function($ctx1) {
  8223. $self._do_((function(each){
  8224. return $core.withContext(function($ctx2) {
  8225. return $recv(each)._putOn_(aStream);
  8226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8227. }));
  8228. return self;
  8229. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8230. },
  8231. args: ["aStream"],
  8232. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8233. referencedClasses: [],
  8234. messageSends: ["do:", "putOn:"]
  8235. }),
  8236. $globals.Collection);
  8237. $core.addMethod(
  8238. $core.method({
  8239. selector: "reject:",
  8240. protocol: "enumerating",
  8241. fn: function (aBlock){
  8242. var self=this,$self=this;
  8243. return $core.withContext(function($ctx1) {
  8244. return $self._select_((function(each){
  8245. return $core.withContext(function($ctx2) {
  8246. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8248. }));
  8249. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8250. },
  8251. args: ["aBlock"],
  8252. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8253. referencedClasses: [],
  8254. messageSends: ["select:", "=", "value:"]
  8255. }),
  8256. $globals.Collection);
  8257. $core.addMethod(
  8258. $core.method({
  8259. selector: "remove:",
  8260. protocol: "adding/removing",
  8261. fn: function (anObject){
  8262. var self=this,$self=this;
  8263. return $core.withContext(function($ctx1) {
  8264. return $self._remove_ifAbsent_(anObject,(function(){
  8265. return $core.withContext(function($ctx2) {
  8266. return $self._errorNotFound();
  8267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8268. }));
  8269. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8270. },
  8271. args: ["anObject"],
  8272. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8273. referencedClasses: [],
  8274. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8275. }),
  8276. $globals.Collection);
  8277. $core.addMethod(
  8278. $core.method({
  8279. selector: "remove:ifAbsent:",
  8280. protocol: "adding/removing",
  8281. fn: function (anObject,aBlock){
  8282. var self=this,$self=this;
  8283. return $core.withContext(function($ctx1) {
  8284. $self._subclassResponsibility();
  8285. return self;
  8286. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8287. },
  8288. args: ["anObject", "aBlock"],
  8289. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8290. referencedClasses: [],
  8291. messageSends: ["subclassResponsibility"]
  8292. }),
  8293. $globals.Collection);
  8294. $core.addMethod(
  8295. $core.method({
  8296. selector: "removeAll",
  8297. protocol: "adding/removing",
  8298. fn: function (){
  8299. var self=this,$self=this;
  8300. return $core.withContext(function($ctx1) {
  8301. $self._subclassResponsibility();
  8302. return self;
  8303. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8304. },
  8305. args: [],
  8306. source: "removeAll\x0a\x09self subclassResponsibility",
  8307. referencedClasses: [],
  8308. messageSends: ["subclassResponsibility"]
  8309. }),
  8310. $globals.Collection);
  8311. $core.addMethod(
  8312. $core.method({
  8313. selector: "select:",
  8314. protocol: "enumerating",
  8315. fn: function (aBlock){
  8316. var self=this,$self=this;
  8317. var stream;
  8318. return $core.withContext(function($ctx1) {
  8319. var $1;
  8320. stream=$recv($recv($self._class())._new())._writeStream();
  8321. $self._do_((function(each){
  8322. return $core.withContext(function($ctx2) {
  8323. $1=$recv(aBlock)._value_(each);
  8324. if($core.assert($1)){
  8325. return $recv(stream)._nextPut_(each);
  8326. }
  8327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8328. }));
  8329. return $recv(stream)._contents();
  8330. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8331. },
  8332. args: ["aBlock"],
  8333. 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",
  8334. referencedClasses: [],
  8335. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8336. }),
  8337. $globals.Collection);
  8338. $core.addMethod(
  8339. $core.method({
  8340. selector: "select:thenCollect:",
  8341. protocol: "enumerating",
  8342. fn: function (selectBlock,collectBlock){
  8343. var self=this,$self=this;
  8344. var stream;
  8345. return $core.withContext(function($ctx1) {
  8346. var $1;
  8347. stream=$recv($recv($self._class())._new())._writeStream();
  8348. $self._do_((function(each){
  8349. return $core.withContext(function($ctx2) {
  8350. $1=$recv(selectBlock)._value_(each);
  8351. $ctx2.sendIdx["value:"]=1;
  8352. if($core.assert($1)){
  8353. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8354. }
  8355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8356. }));
  8357. return $recv(stream)._contents();
  8358. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8359. },
  8360. args: ["selectBlock", "collectBlock"],
  8361. 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",
  8362. referencedClasses: [],
  8363. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8364. }),
  8365. $globals.Collection);
  8366. $core.addMethod(
  8367. $core.method({
  8368. selector: "shallowCopy",
  8369. protocol: "copying",
  8370. fn: function (){
  8371. var self=this,$self=this;
  8372. return $core.withContext(function($ctx1) {
  8373. return $self._collect_((function(each){
  8374. return each;
  8375. }));
  8376. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8377. },
  8378. args: [],
  8379. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8380. referencedClasses: [],
  8381. messageSends: ["collect:"]
  8382. }),
  8383. $globals.Collection);
  8384. $core.addMethod(
  8385. $core.method({
  8386. selector: "single",
  8387. protocol: "accessing",
  8388. fn: function (){
  8389. var self=this,$self=this;
  8390. return $core.withContext(function($ctx1) {
  8391. var $1;
  8392. $self._ifEmpty_((function(){
  8393. return $core.withContext(function($ctx2) {
  8394. return $self._error_("Collection is empty");
  8395. $ctx2.sendIdx["error:"]=1;
  8396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8397. }));
  8398. $1=$recv($self._size()).__gt((1));
  8399. if($core.assert($1)){
  8400. $self._error_("Collection holds more than one element");
  8401. }
  8402. return $self._anyOne();
  8403. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8404. },
  8405. args: [],
  8406. 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",
  8407. referencedClasses: [],
  8408. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8409. }),
  8410. $globals.Collection);
  8411. $core.addMethod(
  8412. $core.method({
  8413. selector: "size",
  8414. protocol: "accessing",
  8415. fn: function (){
  8416. var self=this,$self=this;
  8417. return $core.withContext(function($ctx1) {
  8418. $self._subclassResponsibility();
  8419. return self;
  8420. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8421. },
  8422. args: [],
  8423. source: "size\x0a\x09self subclassResponsibility",
  8424. referencedClasses: [],
  8425. messageSends: ["subclassResponsibility"]
  8426. }),
  8427. $globals.Collection);
  8428. $core.addMethod(
  8429. $core.method({
  8430. selector: "classTag",
  8431. protocol: "accessing",
  8432. fn: function (){
  8433. var self=this,$self=this;
  8434. return "collection";
  8435. },
  8436. args: [],
  8437. 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'",
  8438. referencedClasses: [],
  8439. messageSends: []
  8440. }),
  8441. $globals.Collection.a$cls);
  8442. $core.addMethod(
  8443. $core.method({
  8444. selector: "new:",
  8445. protocol: "instance creation",
  8446. fn: function (anInteger){
  8447. var self=this,$self=this;
  8448. return $core.withContext(function($ctx1) {
  8449. return $self._new();
  8450. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8451. },
  8452. args: ["anInteger"],
  8453. source: "new: anInteger\x0a\x09^ self new",
  8454. referencedClasses: [],
  8455. messageSends: ["new"]
  8456. }),
  8457. $globals.Collection.a$cls);
  8458. $core.addMethod(
  8459. $core.method({
  8460. selector: "with:",
  8461. protocol: "instance creation",
  8462. fn: function (anObject){
  8463. var self=this,$self=this;
  8464. return $core.withContext(function($ctx1) {
  8465. var $1;
  8466. $1=$self._new();
  8467. $recv($1)._add_(anObject);
  8468. return $recv($1)._yourself();
  8469. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8470. },
  8471. args: ["anObject"],
  8472. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8473. referencedClasses: [],
  8474. messageSends: ["add:", "new", "yourself"]
  8475. }),
  8476. $globals.Collection.a$cls);
  8477. $core.addMethod(
  8478. $core.method({
  8479. selector: "with:with:",
  8480. protocol: "instance creation",
  8481. fn: function (anObject,anotherObject){
  8482. var self=this,$self=this;
  8483. return $core.withContext(function($ctx1) {
  8484. var $1;
  8485. $1=$self._new();
  8486. $recv($1)._add_(anObject);
  8487. $ctx1.sendIdx["add:"]=1;
  8488. $recv($1)._add_(anotherObject);
  8489. return $recv($1)._yourself();
  8490. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8491. },
  8492. args: ["anObject", "anotherObject"],
  8493. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8494. referencedClasses: [],
  8495. messageSends: ["add:", "new", "yourself"]
  8496. }),
  8497. $globals.Collection.a$cls);
  8498. $core.addMethod(
  8499. $core.method({
  8500. selector: "with:with:with:",
  8501. protocol: "instance creation",
  8502. fn: function (firstObject,secondObject,thirdObject){
  8503. var self=this,$self=this;
  8504. return $core.withContext(function($ctx1) {
  8505. var $1;
  8506. $1=$self._new();
  8507. $recv($1)._add_(firstObject);
  8508. $ctx1.sendIdx["add:"]=1;
  8509. $recv($1)._add_(secondObject);
  8510. $ctx1.sendIdx["add:"]=2;
  8511. $recv($1)._add_(thirdObject);
  8512. return $recv($1)._yourself();
  8513. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8514. },
  8515. args: ["firstObject", "secondObject", "thirdObject"],
  8516. 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",
  8517. referencedClasses: [],
  8518. messageSends: ["add:", "new", "yourself"]
  8519. }),
  8520. $globals.Collection.a$cls);
  8521. $core.addMethod(
  8522. $core.method({
  8523. selector: "withAll:",
  8524. protocol: "instance creation",
  8525. fn: function (aCollection){
  8526. var self=this,$self=this;
  8527. return $core.withContext(function($ctx1) {
  8528. var $1;
  8529. $1=$self._new();
  8530. $recv($1)._addAll_(aCollection);
  8531. return $recv($1)._yourself();
  8532. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8533. },
  8534. args: ["aCollection"],
  8535. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8536. referencedClasses: [],
  8537. messageSends: ["addAll:", "new", "yourself"]
  8538. }),
  8539. $globals.Collection.a$cls);
  8540. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  8541. $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.";
  8542. $core.addMethod(
  8543. $core.method({
  8544. selector: "at:",
  8545. protocol: "accessing",
  8546. fn: function (anIndex){
  8547. var self=this,$self=this;
  8548. return $core.withContext(function($ctx1) {
  8549. return $self._at_ifAbsent_(anIndex,(function(){
  8550. return $core.withContext(function($ctx2) {
  8551. return $self._errorNotFound();
  8552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8553. }));
  8554. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  8555. },
  8556. args: ["anIndex"],
  8557. 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 ]",
  8558. referencedClasses: [],
  8559. messageSends: ["at:ifAbsent:", "errorNotFound"]
  8560. }),
  8561. $globals.IndexableCollection);
  8562. $core.addMethod(
  8563. $core.method({
  8564. selector: "at:ifAbsent:",
  8565. protocol: "accessing",
  8566. fn: function (anIndex,aBlock){
  8567. var self=this,$self=this;
  8568. return $core.withContext(function($ctx1) {
  8569. $self._subclassResponsibility();
  8570. return self;
  8571. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8572. },
  8573. args: ["anIndex", "aBlock"],
  8574. 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",
  8575. referencedClasses: [],
  8576. messageSends: ["subclassResponsibility"]
  8577. }),
  8578. $globals.IndexableCollection);
  8579. $core.addMethod(
  8580. $core.method({
  8581. selector: "at:ifAbsentPut:",
  8582. protocol: "accessing",
  8583. fn: function (aKey,aBlock){
  8584. var self=this,$self=this;
  8585. return $core.withContext(function($ctx1) {
  8586. return $self._at_ifAbsent_(aKey,(function(){
  8587. return $core.withContext(function($ctx2) {
  8588. return $self._at_put_(aKey,$recv(aBlock)._value());
  8589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8590. }));
  8591. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  8592. },
  8593. args: ["aKey", "aBlock"],
  8594. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  8595. referencedClasses: [],
  8596. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  8597. }),
  8598. $globals.IndexableCollection);
  8599. $core.addMethod(
  8600. $core.method({
  8601. selector: "at:ifPresent:",
  8602. protocol: "accessing",
  8603. fn: function (anIndex,aBlock){
  8604. var self=this,$self=this;
  8605. return $core.withContext(function($ctx1) {
  8606. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  8607. return nil;
  8608. }));
  8609. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8610. },
  8611. args: ["anIndex", "aBlock"],
  8612. 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 ]",
  8613. referencedClasses: [],
  8614. messageSends: ["at:ifPresent:ifAbsent:"]
  8615. }),
  8616. $globals.IndexableCollection);
  8617. $core.addMethod(
  8618. $core.method({
  8619. selector: "at:ifPresent:ifAbsent:",
  8620. protocol: "accessing",
  8621. fn: function (anIndex,aBlock,anotherBlock){
  8622. var self=this,$self=this;
  8623. return $core.withContext(function($ctx1) {
  8624. $self._subclassResponsibility();
  8625. return self;
  8626. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  8627. },
  8628. args: ["anIndex", "aBlock", "anotherBlock"],
  8629. 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",
  8630. referencedClasses: [],
  8631. messageSends: ["subclassResponsibility"]
  8632. }),
  8633. $globals.IndexableCollection);
  8634. $core.addMethod(
  8635. $core.method({
  8636. selector: "at:put:",
  8637. protocol: "accessing",
  8638. fn: function (anIndex,anObject){
  8639. var self=this,$self=this;
  8640. return $core.withContext(function($ctx1) {
  8641. $self._subclassResponsibility();
  8642. return self;
  8643. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  8644. },
  8645. args: ["anIndex", "anObject"],
  8646. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  8647. referencedClasses: [],
  8648. messageSends: ["subclassResponsibility"]
  8649. }),
  8650. $globals.IndexableCollection);
  8651. $core.addMethod(
  8652. $core.method({
  8653. selector: "indexOf:",
  8654. protocol: "accessing",
  8655. fn: function (anObject){
  8656. var self=this,$self=this;
  8657. return $core.withContext(function($ctx1) {
  8658. return $self._indexOf_ifAbsent_(anObject,(function(){
  8659. return $core.withContext(function($ctx2) {
  8660. return $self._errorNotFound();
  8661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8662. }));
  8663. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  8664. },
  8665. args: ["anObject"],
  8666. 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 ]",
  8667. referencedClasses: [],
  8668. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  8669. }),
  8670. $globals.IndexableCollection);
  8671. $core.addMethod(
  8672. $core.method({
  8673. selector: "indexOf:ifAbsent:",
  8674. protocol: "accessing",
  8675. fn: function (anObject,aBlock){
  8676. var self=this,$self=this;
  8677. return $core.withContext(function($ctx1) {
  8678. $self._subclassResponsibility();
  8679. return self;
  8680. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  8681. },
  8682. args: ["anObject", "aBlock"],
  8683. 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",
  8684. referencedClasses: [],
  8685. messageSends: ["subclassResponsibility"]
  8686. }),
  8687. $globals.IndexableCollection);
  8688. $core.addMethod(
  8689. $core.method({
  8690. selector: "with:do:",
  8691. protocol: "enumerating",
  8692. fn: function (anotherCollection,aBlock){
  8693. var self=this,$self=this;
  8694. return $core.withContext(function($ctx1) {
  8695. $self._withIndexDo_((function(each,index){
  8696. return $core.withContext(function($ctx2) {
  8697. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  8698. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  8699. }));
  8700. return self;
  8701. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  8702. },
  8703. args: ["anotherCollection", "aBlock"],
  8704. 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) ]",
  8705. referencedClasses: [],
  8706. messageSends: ["withIndexDo:", "value:value:", "at:"]
  8707. }),
  8708. $globals.IndexableCollection);
  8709. $core.addMethod(
  8710. $core.method({
  8711. selector: "withIndexDo:",
  8712. protocol: "enumerating",
  8713. fn: function (aBlock){
  8714. var self=this,$self=this;
  8715. return $core.withContext(function($ctx1) {
  8716. $self._subclassResponsibility();
  8717. return self;
  8718. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  8719. },
  8720. args: ["aBlock"],
  8721. 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",
  8722. referencedClasses: [],
  8723. messageSends: ["subclassResponsibility"]
  8724. }),
  8725. $globals.IndexableCollection);
  8726. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8727. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "=",
  8731. protocol: "comparing",
  8732. fn: function (anAssocitativeCollection){
  8733. var self=this,$self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. var $2,$1,$4,$3,$5;
  8736. $2=$self._class();
  8737. $ctx1.sendIdx["class"]=1;
  8738. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8739. $ctx1.sendIdx["="]=1;
  8740. if(!$core.assert($1)){
  8741. return false;
  8742. }
  8743. $4=$self._size();
  8744. $ctx1.sendIdx["size"]=1;
  8745. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8746. $ctx1.sendIdx["="]=2;
  8747. if(!$core.assert($3)){
  8748. return false;
  8749. }
  8750. $5=$self._associations();
  8751. $ctx1.sendIdx["associations"]=1;
  8752. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8753. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8754. },
  8755. args: ["anAssocitativeCollection"],
  8756. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8757. referencedClasses: [],
  8758. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8759. }),
  8760. $globals.AssociativeCollection);
  8761. $core.addMethod(
  8762. $core.method({
  8763. selector: "add:",
  8764. protocol: "adding/removing",
  8765. fn: function (anAssociation){
  8766. var self=this,$self=this;
  8767. return $core.withContext(function($ctx1) {
  8768. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8769. return self;
  8770. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8771. },
  8772. args: ["anAssociation"],
  8773. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8774. referencedClasses: [],
  8775. messageSends: ["at:put:", "key", "value"]
  8776. }),
  8777. $globals.AssociativeCollection);
  8778. $core.addMethod(
  8779. $core.method({
  8780. selector: "addAll:",
  8781. protocol: "adding/removing",
  8782. fn: function (anAssociativeCollection){
  8783. var self=this,$self=this;
  8784. return $core.withContext(function($ctx1) {
  8785. (
  8786. $ctx1.supercall = true,
  8787. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8788. $ctx1.supercall = false;
  8789. return anAssociativeCollection;
  8790. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8791. },
  8792. args: ["anAssociativeCollection"],
  8793. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8794. referencedClasses: [],
  8795. messageSends: ["addAll:", "associations"]
  8796. }),
  8797. $globals.AssociativeCollection);
  8798. $core.addMethod(
  8799. $core.method({
  8800. selector: "asDictionary",
  8801. protocol: "converting",
  8802. fn: function (){
  8803. var self=this,$self=this;
  8804. return $core.withContext(function($ctx1) {
  8805. return $recv($globals.Dictionary)._from_($self._associations());
  8806. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8807. },
  8808. args: [],
  8809. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8810. referencedClasses: ["Dictionary"],
  8811. messageSends: ["from:", "associations"]
  8812. }),
  8813. $globals.AssociativeCollection);
  8814. $core.addMethod(
  8815. $core.method({
  8816. selector: "asHashedCollection",
  8817. protocol: "converting",
  8818. fn: function (){
  8819. var self=this,$self=this;
  8820. return $core.withContext(function($ctx1) {
  8821. return $recv($globals.HashedCollection)._from_($self._associations());
  8822. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8823. },
  8824. args: [],
  8825. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8826. referencedClasses: ["HashedCollection"],
  8827. messageSends: ["from:", "associations"]
  8828. }),
  8829. $globals.AssociativeCollection);
  8830. $core.addMethod(
  8831. $core.method({
  8832. selector: "asJavaScriptObject",
  8833. protocol: "converting",
  8834. fn: function (){
  8835. var self=this,$self=this;
  8836. var hash;
  8837. return $core.withContext(function($ctx1) {
  8838. hash=$recv($globals.HashedCollection)._new();
  8839. $self._keysAndValuesDo_((function(key,value){
  8840. return $core.withContext(function($ctx2) {
  8841. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8842. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8843. }));
  8844. return hash;
  8845. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8846. },
  8847. args: [],
  8848. 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",
  8849. referencedClasses: ["HashedCollection"],
  8850. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8851. }),
  8852. $globals.AssociativeCollection);
  8853. $core.addMethod(
  8854. $core.method({
  8855. selector: "associations",
  8856. protocol: "accessing",
  8857. fn: function (){
  8858. var self=this,$self=this;
  8859. var associations;
  8860. return $core.withContext(function($ctx1) {
  8861. associations=[];
  8862. $self._associationsDo_((function(each){
  8863. return $core.withContext(function($ctx2) {
  8864. return $recv(associations)._add_(each);
  8865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8866. }));
  8867. return associations;
  8868. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8869. },
  8870. args: [],
  8871. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8872. referencedClasses: [],
  8873. messageSends: ["associationsDo:", "add:"]
  8874. }),
  8875. $globals.AssociativeCollection);
  8876. $core.addMethod(
  8877. $core.method({
  8878. selector: "associationsDo:",
  8879. protocol: "enumerating",
  8880. fn: function (aBlock){
  8881. var self=this,$self=this;
  8882. return $core.withContext(function($ctx1) {
  8883. $self._keysAndValuesDo_((function(key,value){
  8884. return $core.withContext(function($ctx2) {
  8885. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8886. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8887. }));
  8888. return self;
  8889. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8890. },
  8891. args: ["aBlock"],
  8892. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8893. referencedClasses: ["Association"],
  8894. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8895. }),
  8896. $globals.AssociativeCollection);
  8897. $core.addMethod(
  8898. $core.method({
  8899. selector: "at:ifPresent:ifAbsent:",
  8900. protocol: "accessing",
  8901. fn: function (aKey,aBlock,anotherBlock){
  8902. var self=this,$self=this;
  8903. return $core.withContext(function($ctx1) {
  8904. var $1;
  8905. $1=$self._includesKey_(aKey);
  8906. if($core.assert($1)){
  8907. return $recv(aBlock)._value_($self._at_(aKey));
  8908. } else {
  8909. return $recv(anotherBlock)._value();
  8910. }
  8911. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8912. },
  8913. args: ["aKey", "aBlock", "anotherBlock"],
  8914. 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 ]",
  8915. referencedClasses: [],
  8916. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8917. }),
  8918. $globals.AssociativeCollection);
  8919. $core.addMethod(
  8920. $core.method({
  8921. selector: "collect:",
  8922. protocol: "enumerating",
  8923. fn: function (aBlock){
  8924. var self=this,$self=this;
  8925. var newDict;
  8926. return $core.withContext(function($ctx1) {
  8927. newDict=$recv($self._class())._new();
  8928. $self._keysAndValuesDo_((function(key,value){
  8929. return $core.withContext(function($ctx2) {
  8930. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8931. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8932. }));
  8933. return newDict;
  8934. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8935. },
  8936. args: ["aBlock"],
  8937. 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",
  8938. referencedClasses: [],
  8939. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8940. }),
  8941. $globals.AssociativeCollection);
  8942. $core.addMethod(
  8943. $core.method({
  8944. selector: "deepCopy",
  8945. protocol: "copying",
  8946. fn: function (){
  8947. var self=this,$self=this;
  8948. var copy;
  8949. return $core.withContext(function($ctx1) {
  8950. copy=$recv($self._class())._new();
  8951. $self._keysAndValuesDo_((function(key,value){
  8952. return $core.withContext(function($ctx2) {
  8953. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8954. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8955. }));
  8956. return copy;
  8957. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8958. },
  8959. args: [],
  8960. 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",
  8961. referencedClasses: [],
  8962. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8963. }),
  8964. $globals.AssociativeCollection);
  8965. $core.addMethod(
  8966. $core.method({
  8967. selector: "detect:ifNone:",
  8968. protocol: "enumerating",
  8969. fn: function (aBlock,anotherBlock){
  8970. var self=this,$self=this;
  8971. return $core.withContext(function($ctx1) {
  8972. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8973. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8974. },
  8975. args: ["aBlock", "anotherBlock"],
  8976. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8977. referencedClasses: [],
  8978. messageSends: ["detect:ifNone:", "values"]
  8979. }),
  8980. $globals.AssociativeCollection);
  8981. $core.addMethod(
  8982. $core.method({
  8983. selector: "do:",
  8984. protocol: "enumerating",
  8985. fn: function (aBlock){
  8986. var self=this,$self=this;
  8987. return $core.withContext(function($ctx1) {
  8988. $self._valuesDo_(aBlock);
  8989. return self;
  8990. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8991. },
  8992. args: ["aBlock"],
  8993. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8994. referencedClasses: [],
  8995. messageSends: ["valuesDo:"]
  8996. }),
  8997. $globals.AssociativeCollection);
  8998. $core.addMethod(
  8999. $core.method({
  9000. selector: "includes:",
  9001. protocol: "enumerating",
  9002. fn: function (anObject){
  9003. var self=this,$self=this;
  9004. return $core.withContext(function($ctx1) {
  9005. return $recv($self._values())._includes_(anObject);
  9006. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  9007. },
  9008. args: ["anObject"],
  9009. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  9010. referencedClasses: [],
  9011. messageSends: ["includes:", "values"]
  9012. }),
  9013. $globals.AssociativeCollection);
  9014. $core.addMethod(
  9015. $core.method({
  9016. selector: "includesKey:",
  9017. protocol: "testing",
  9018. fn: function (aKey){
  9019. var self=this,$self=this;
  9020. return $core.withContext(function($ctx1) {
  9021. $self._subclassResponsibility();
  9022. return self;
  9023. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9024. },
  9025. args: ["aKey"],
  9026. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  9027. referencedClasses: [],
  9028. messageSends: ["subclassResponsibility"]
  9029. }),
  9030. $globals.AssociativeCollection);
  9031. $core.addMethod(
  9032. $core.method({
  9033. selector: "indexOf:ifAbsent:",
  9034. protocol: "accessing",
  9035. fn: function (anObject,aBlock){
  9036. var self=this,$self=this;
  9037. return $core.withContext(function($ctx1) {
  9038. return $recv($self._keys())._detect_ifNone_((function(each){
  9039. return $core.withContext(function($ctx2) {
  9040. return $recv($self._at_(each)).__eq(anObject);
  9041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9042. }),aBlock);
  9043. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9044. },
  9045. args: ["anObject", "aBlock"],
  9046. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  9047. referencedClasses: [],
  9048. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  9049. }),
  9050. $globals.AssociativeCollection);
  9051. $core.addMethod(
  9052. $core.method({
  9053. selector: "keyAtValue:",
  9054. protocol: "accessing",
  9055. fn: function (anObject){
  9056. var self=this,$self=this;
  9057. return $core.withContext(function($ctx1) {
  9058. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  9059. return $core.withContext(function($ctx2) {
  9060. return $self._errorNotFound();
  9061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9062. }));
  9063. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  9064. },
  9065. args: ["anObject"],
  9066. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9067. referencedClasses: [],
  9068. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  9069. }),
  9070. $globals.AssociativeCollection);
  9071. $core.addMethod(
  9072. $core.method({
  9073. selector: "keyAtValue:ifAbsent:",
  9074. protocol: "accessing",
  9075. fn: function (anObject,aBlock){
  9076. var self=this,$self=this;
  9077. return $core.withContext(function($ctx1) {
  9078. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9079. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9080. },
  9081. args: ["anObject", "aBlock"],
  9082. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9083. referencedClasses: [],
  9084. messageSends: ["indexOf:ifAbsent:"]
  9085. }),
  9086. $globals.AssociativeCollection);
  9087. $core.addMethod(
  9088. $core.method({
  9089. selector: "keys",
  9090. protocol: "accessing",
  9091. fn: function (){
  9092. var self=this,$self=this;
  9093. return $core.withContext(function($ctx1) {
  9094. $self._subclassResponsibility();
  9095. return self;
  9096. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  9097. },
  9098. args: [],
  9099. source: "keys\x0a\x09self subclassResponsibility",
  9100. referencedClasses: [],
  9101. messageSends: ["subclassResponsibility"]
  9102. }),
  9103. $globals.AssociativeCollection);
  9104. $core.addMethod(
  9105. $core.method({
  9106. selector: "keysAndValuesDo:",
  9107. protocol: "enumerating",
  9108. fn: function (aBlock){
  9109. var self=this,$self=this;
  9110. return $core.withContext(function($ctx1) {
  9111. $self._keysDo_((function(each){
  9112. return $core.withContext(function($ctx2) {
  9113. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9115. }));
  9116. return self;
  9117. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9118. },
  9119. args: ["aBlock"],
  9120. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9121. referencedClasses: [],
  9122. messageSends: ["keysDo:", "value:value:", "at:"]
  9123. }),
  9124. $globals.AssociativeCollection);
  9125. $core.addMethod(
  9126. $core.method({
  9127. selector: "keysDo:",
  9128. protocol: "enumerating",
  9129. fn: function (aBlock){
  9130. var self=this,$self=this;
  9131. return $core.withContext(function($ctx1) {
  9132. $self._subclassResponsibility();
  9133. return self;
  9134. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9135. },
  9136. args: ["aBlock"],
  9137. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9138. referencedClasses: [],
  9139. messageSends: ["subclassResponsibility"]
  9140. }),
  9141. $globals.AssociativeCollection);
  9142. $core.addMethod(
  9143. $core.method({
  9144. selector: "printOn:",
  9145. protocol: "printing",
  9146. fn: function (aStream){
  9147. var self=this,$self=this;
  9148. return $core.withContext(function($ctx1) {
  9149. (
  9150. $ctx1.supercall = true,
  9151. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9152. $ctx1.supercall = false;
  9153. $ctx1.sendIdx["printOn:"]=1;
  9154. $recv(aStream)._nextPutAll_(" (");
  9155. $ctx1.sendIdx["nextPutAll:"]=1;
  9156. $recv($self._associations())._do_separatedBy_((function(each){
  9157. return $core.withContext(function($ctx2) {
  9158. return $recv(each)._printOn_(aStream);
  9159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9160. }),(function(){
  9161. return $core.withContext(function($ctx2) {
  9162. return $recv(aStream)._nextPutAll_(" , ");
  9163. $ctx2.sendIdx["nextPutAll:"]=2;
  9164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9165. }));
  9166. $recv(aStream)._nextPutAll_(")");
  9167. return self;
  9168. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9169. },
  9170. args: ["aStream"],
  9171. 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: ')'",
  9172. referencedClasses: [],
  9173. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9174. }),
  9175. $globals.AssociativeCollection);
  9176. $core.addMethod(
  9177. $core.method({
  9178. selector: "remove:ifAbsent:",
  9179. protocol: "adding/removing",
  9180. fn: function (aKey,aBlock){
  9181. var self=this,$self=this;
  9182. return $core.withContext(function($ctx1) {
  9183. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9184. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9185. },
  9186. args: ["aKey", "aBlock"],
  9187. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9188. referencedClasses: [],
  9189. messageSends: ["removeKey:ifAbsent:"]
  9190. }),
  9191. $globals.AssociativeCollection);
  9192. $core.addMethod(
  9193. $core.method({
  9194. selector: "removeAll",
  9195. protocol: "adding/removing",
  9196. fn: function (){
  9197. var self=this,$self=this;
  9198. return $core.withContext(function($ctx1) {
  9199. return $recv($self._keys())._do_((function(each){
  9200. return $core.withContext(function($ctx2) {
  9201. return $self._removeKey_(each);
  9202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9203. }));
  9204. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9205. },
  9206. args: [],
  9207. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9208. referencedClasses: [],
  9209. messageSends: ["do:", "keys", "removeKey:"]
  9210. }),
  9211. $globals.AssociativeCollection);
  9212. $core.addMethod(
  9213. $core.method({
  9214. selector: "removeKey:",
  9215. protocol: "adding/removing",
  9216. fn: function (aKey){
  9217. var self=this,$self=this;
  9218. return $core.withContext(function($ctx1) {
  9219. return $self._remove_(aKey);
  9220. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9221. },
  9222. args: ["aKey"],
  9223. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9224. referencedClasses: [],
  9225. messageSends: ["remove:"]
  9226. }),
  9227. $globals.AssociativeCollection);
  9228. $core.addMethod(
  9229. $core.method({
  9230. selector: "removeKey:ifAbsent:",
  9231. protocol: "adding/removing",
  9232. fn: function (aKey,aBlock){
  9233. var self=this,$self=this;
  9234. return $core.withContext(function($ctx1) {
  9235. $self._subclassResponsibility();
  9236. return self;
  9237. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9238. },
  9239. args: ["aKey", "aBlock"],
  9240. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9241. referencedClasses: [],
  9242. messageSends: ["subclassResponsibility"]
  9243. }),
  9244. $globals.AssociativeCollection);
  9245. $core.addMethod(
  9246. $core.method({
  9247. selector: "select:",
  9248. protocol: "enumerating",
  9249. fn: function (aBlock){
  9250. var self=this,$self=this;
  9251. var newDict;
  9252. return $core.withContext(function($ctx1) {
  9253. var $1;
  9254. newDict=$recv($self._class())._new();
  9255. $self._keysAndValuesDo_((function(key,value){
  9256. return $core.withContext(function($ctx2) {
  9257. $1=$recv(aBlock)._value_(value);
  9258. if($core.assert($1)){
  9259. return $recv(newDict)._at_put_(key,value);
  9260. }
  9261. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9262. }));
  9263. return newDict;
  9264. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9265. },
  9266. args: ["aBlock"],
  9267. 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",
  9268. referencedClasses: [],
  9269. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9270. }),
  9271. $globals.AssociativeCollection);
  9272. $core.addMethod(
  9273. $core.method({
  9274. selector: "select:thenCollect:",
  9275. protocol: "enumerating",
  9276. fn: function (selectBlock,collectBlock){
  9277. var self=this,$self=this;
  9278. var newDict;
  9279. return $core.withContext(function($ctx1) {
  9280. var $1;
  9281. newDict=$recv($self._class())._new();
  9282. $self._keysAndValuesDo_((function(key,value){
  9283. return $core.withContext(function($ctx2) {
  9284. $1=$recv(selectBlock)._value_(value);
  9285. $ctx2.sendIdx["value:"]=1;
  9286. if($core.assert($1)){
  9287. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9288. }
  9289. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9290. }));
  9291. return newDict;
  9292. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9293. },
  9294. args: ["selectBlock", "collectBlock"],
  9295. 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",
  9296. referencedClasses: [],
  9297. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9298. }),
  9299. $globals.AssociativeCollection);
  9300. $core.addMethod(
  9301. $core.method({
  9302. selector: "shallowCopy",
  9303. protocol: "copying",
  9304. fn: function (){
  9305. var self=this,$self=this;
  9306. var copy;
  9307. return $core.withContext(function($ctx1) {
  9308. copy=$recv($self._class())._new();
  9309. $self._keysAndValuesDo_((function(key,value){
  9310. return $core.withContext(function($ctx2) {
  9311. return $recv(copy)._at_put_(key,value);
  9312. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9313. }));
  9314. return copy;
  9315. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9316. },
  9317. args: [],
  9318. 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",
  9319. referencedClasses: [],
  9320. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9321. }),
  9322. $globals.AssociativeCollection);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "size",
  9326. protocol: "accessing",
  9327. fn: function (){
  9328. var self=this,$self=this;
  9329. return $core.withContext(function($ctx1) {
  9330. return $recv($self._keys())._size();
  9331. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9332. },
  9333. args: [],
  9334. source: "size\x0a\x09^ self keys size",
  9335. referencedClasses: [],
  9336. messageSends: ["size", "keys"]
  9337. }),
  9338. $globals.AssociativeCollection);
  9339. $core.addMethod(
  9340. $core.method({
  9341. selector: "values",
  9342. protocol: "accessing",
  9343. fn: function (){
  9344. var self=this,$self=this;
  9345. return $core.withContext(function($ctx1) {
  9346. $self._subclassResponsibility();
  9347. return self;
  9348. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9349. },
  9350. args: [],
  9351. source: "values\x0a\x09self subclassResponsibility",
  9352. referencedClasses: [],
  9353. messageSends: ["subclassResponsibility"]
  9354. }),
  9355. $globals.AssociativeCollection);
  9356. $core.addMethod(
  9357. $core.method({
  9358. selector: "valuesDo:",
  9359. protocol: "enumerating",
  9360. fn: function (aBlock){
  9361. var self=this,$self=this;
  9362. return $core.withContext(function($ctx1) {
  9363. $self._subclassResponsibility();
  9364. return self;
  9365. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9366. },
  9367. args: ["aBlock"],
  9368. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9369. referencedClasses: [],
  9370. messageSends: ["subclassResponsibility"]
  9371. }),
  9372. $globals.AssociativeCollection);
  9373. $core.addMethod(
  9374. $core.method({
  9375. selector: "withIndexDo:",
  9376. protocol: "enumerating",
  9377. fn: function (aBlock){
  9378. var self=this,$self=this;
  9379. return $core.withContext(function($ctx1) {
  9380. $self._keysAndValuesDo_((function(key,value){
  9381. return $core.withContext(function($ctx2) {
  9382. return $recv(aBlock)._value_value_(value,key);
  9383. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9384. }));
  9385. return self;
  9386. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9387. },
  9388. args: ["aBlock"],
  9389. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9390. referencedClasses: [],
  9391. messageSends: ["keysAndValuesDo:", "value:value:"]
  9392. }),
  9393. $globals.AssociativeCollection);
  9394. $core.addMethod(
  9395. $core.method({
  9396. selector: "from:",
  9397. protocol: "instance creation",
  9398. fn: function (aCollection){
  9399. var self=this,$self=this;
  9400. var newCollection;
  9401. return $core.withContext(function($ctx1) {
  9402. newCollection=$self._new();
  9403. $recv(aCollection)._do_((function(each){
  9404. return $core.withContext(function($ctx2) {
  9405. return $recv(newCollection)._add_(each);
  9406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9407. }));
  9408. return newCollection;
  9409. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9410. },
  9411. args: ["aCollection"],
  9412. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9413. referencedClasses: [],
  9414. messageSends: ["new", "do:", "add:"]
  9415. }),
  9416. $globals.AssociativeCollection.a$cls);
  9417. $core.addMethod(
  9418. $core.method({
  9419. selector: "fromPairs:",
  9420. protocol: "instance creation",
  9421. fn: function (aCollection){
  9422. var self=this,$self=this;
  9423. return $core.withContext(function($ctx1) {
  9424. return $self._from_(aCollection);
  9425. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9426. },
  9427. args: ["aCollection"],
  9428. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9429. referencedClasses: [],
  9430. messageSends: ["from:"]
  9431. }),
  9432. $globals.AssociativeCollection.a$cls);
  9433. $core.addMethod(
  9434. $core.method({
  9435. selector: "newFromPairs:",
  9436. protocol: "instance creation",
  9437. fn: function (aCollection){
  9438. var self=this,$self=this;
  9439. var newCollection;
  9440. return $core.withContext(function($ctx1) {
  9441. var $2,$1,$3,$4;
  9442. $2=$recv(aCollection)._size();
  9443. $ctx1.sendIdx["size"]=1;
  9444. $1=$recv($2)._even();
  9445. if(!$core.assert($1)){
  9446. $self._error_("#newFromPairs only accepts arrays of an even length");
  9447. }
  9448. newCollection=$self._new();
  9449. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9450. return $core.withContext(function($ctx2) {
  9451. $3=newCollection;
  9452. $4=$recv(aCollection)._at_(each);
  9453. $ctx2.sendIdx["at:"]=1;
  9454. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9456. }));
  9457. return newCollection;
  9458. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9459. },
  9460. args: ["aCollection"],
  9461. 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",
  9462. referencedClasses: [],
  9463. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9464. }),
  9465. $globals.AssociativeCollection.a$cls);
  9466. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9467. $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.";
  9468. $core.addMethod(
  9469. $core.method({
  9470. selector: "at:ifAbsent:",
  9471. protocol: "accessing",
  9472. fn: function (aKey,aBlock){
  9473. var self=this,$self=this;
  9474. return $core.withContext(function($ctx1) {
  9475. var index = $self._positionOfKey_(aKey);
  9476. return index >=0 ? $self['@values'][index] : aBlock._value();
  9477. ;
  9478. return self;
  9479. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9480. },
  9481. args: ["aKey", "aBlock"],
  9482. 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'>",
  9483. referencedClasses: [],
  9484. messageSends: []
  9485. }),
  9486. $globals.Dictionary);
  9487. $core.addMethod(
  9488. $core.method({
  9489. selector: "at:put:",
  9490. protocol: "accessing",
  9491. fn: function (aKey,aValue){
  9492. var self=this,$self=this;
  9493. return $core.withContext(function($ctx1) {
  9494. var index = $self._positionOfKey_(aKey);
  9495. if(index === -1) {
  9496. var keys = $self['@keys'];
  9497. index = keys.length;
  9498. keys.push(aKey);
  9499. }
  9500. return $self['@values'][index] = aValue;
  9501. ;
  9502. return self;
  9503. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9504. },
  9505. args: ["aKey", "aValue"],
  9506. 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'>",
  9507. referencedClasses: [],
  9508. messageSends: []
  9509. }),
  9510. $globals.Dictionary);
  9511. $core.addMethod(
  9512. $core.method({
  9513. selector: "includesKey:",
  9514. protocol: "testing",
  9515. fn: function (aKey){
  9516. var self=this,$self=this;
  9517. return $core.withContext(function($ctx1) {
  9518. return $self._positionOfKey_(aKey) >= 0;;
  9519. return self;
  9520. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9521. },
  9522. args: ["aKey"],
  9523. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9524. referencedClasses: [],
  9525. messageSends: []
  9526. }),
  9527. $globals.Dictionary);
  9528. $core.addMethod(
  9529. $core.method({
  9530. selector: "indexOf:ifAbsent:",
  9531. protocol: "accessing",
  9532. fn: function (anObject,aBlock){
  9533. var self=this,$self=this;
  9534. var index;
  9535. return $core.withContext(function($ctx1) {
  9536. var $1;
  9537. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9538. return (0);
  9539. }));
  9540. $1=$recv(index).__eq((0));
  9541. if($core.assert($1)){
  9542. return $recv(aBlock)._value();
  9543. } else {
  9544. return $recv($self["@keys"])._at_(index);
  9545. }
  9546. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9547. },
  9548. args: ["anObject", "aBlock"],
  9549. 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 ]",
  9550. referencedClasses: [],
  9551. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9552. }),
  9553. $globals.Dictionary);
  9554. $core.addMethod(
  9555. $core.method({
  9556. selector: "initialize",
  9557. protocol: "initialization",
  9558. fn: function (){
  9559. var self=this,$self=this;
  9560. return $core.withContext(function($ctx1) {
  9561. (
  9562. $ctx1.supercall = true,
  9563. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9564. $ctx1.supercall = false;
  9565. $self["@keys"]=[];
  9566. $self["@values"]=[];
  9567. return self;
  9568. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9569. },
  9570. args: [],
  9571. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9572. referencedClasses: [],
  9573. messageSends: ["initialize"]
  9574. }),
  9575. $globals.Dictionary);
  9576. $core.addMethod(
  9577. $core.method({
  9578. selector: "keys",
  9579. protocol: "accessing",
  9580. fn: function (){
  9581. var self=this,$self=this;
  9582. return $core.withContext(function($ctx1) {
  9583. return $recv($self["@keys"])._copy();
  9584. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9585. },
  9586. args: [],
  9587. source: "keys\x0a\x09^ keys copy",
  9588. referencedClasses: [],
  9589. messageSends: ["copy"]
  9590. }),
  9591. $globals.Dictionary);
  9592. $core.addMethod(
  9593. $core.method({
  9594. selector: "keysAndValuesDo:",
  9595. protocol: "enumerating",
  9596. fn: function (aBlock){
  9597. var self=this,$self=this;
  9598. return $core.withContext(function($ctx1) {
  9599. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9600. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9601. },
  9602. args: ["aBlock"],
  9603. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9604. referencedClasses: [],
  9605. messageSends: ["with:do:"]
  9606. }),
  9607. $globals.Dictionary);
  9608. $core.addMethod(
  9609. $core.method({
  9610. selector: "keysDo:",
  9611. protocol: "enumerating",
  9612. fn: function (aBlock){
  9613. var self=this,$self=this;
  9614. return $core.withContext(function($ctx1) {
  9615. return $recv($self["@keys"])._do_(aBlock);
  9616. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9617. },
  9618. args: ["aBlock"],
  9619. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9620. referencedClasses: [],
  9621. messageSends: ["do:"]
  9622. }),
  9623. $globals.Dictionary);
  9624. $core.addMethod(
  9625. $core.method({
  9626. selector: "positionOfKey:",
  9627. protocol: "private",
  9628. fn: function (anObject){
  9629. var self=this,$self=this;
  9630. return $core.withContext(function($ctx1) {
  9631. var keys = $self['@keys'];
  9632. for(var i=0;i<keys.length;i++){
  9633. if(keys[i].__eq(anObject)) { return i;}
  9634. }
  9635. return -1;
  9636. ;
  9637. return self;
  9638. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9639. },
  9640. args: ["anObject"],
  9641. 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'>",
  9642. referencedClasses: [],
  9643. messageSends: []
  9644. }),
  9645. $globals.Dictionary);
  9646. $core.addMethod(
  9647. $core.method({
  9648. selector: "removeAll",
  9649. protocol: "adding/removing",
  9650. fn: function (){
  9651. var self=this,$self=this;
  9652. return $core.withContext(function($ctx1) {
  9653. $recv($self["@keys"])._removeAll();
  9654. $ctx1.sendIdx["removeAll"]=1;
  9655. $recv($self["@values"])._removeAll();
  9656. return self;
  9657. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9658. },
  9659. args: [],
  9660. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9661. referencedClasses: [],
  9662. messageSends: ["removeAll"]
  9663. }),
  9664. $globals.Dictionary);
  9665. $core.addMethod(
  9666. $core.method({
  9667. selector: "removeKey:ifAbsent:",
  9668. protocol: "adding/removing",
  9669. fn: function (aKey,aBlock){
  9670. var self=this,$self=this;
  9671. return $core.withContext(function($ctx1) {
  9672. var index = $self._positionOfKey_(aKey);
  9673. if(index === -1) {
  9674. return aBlock._value()
  9675. } else {
  9676. var keys = $self['@keys'], values = $self['@values'];
  9677. var value = values[index], l = keys.length;
  9678. keys[index] = keys[l-1];
  9679. keys.pop();
  9680. values[index] = values[l-1];
  9681. values.pop();
  9682. return value;
  9683. }
  9684. ;
  9685. return self;
  9686. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9687. },
  9688. args: ["aKey", "aBlock"],
  9689. 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'>",
  9690. referencedClasses: [],
  9691. messageSends: []
  9692. }),
  9693. $globals.Dictionary);
  9694. $core.addMethod(
  9695. $core.method({
  9696. selector: "values",
  9697. protocol: "accessing",
  9698. fn: function (){
  9699. var self=this,$self=this;
  9700. return $self["@values"];
  9701. },
  9702. args: [],
  9703. source: "values\x0a\x09^ values",
  9704. referencedClasses: [],
  9705. messageSends: []
  9706. }),
  9707. $globals.Dictionary);
  9708. $core.addMethod(
  9709. $core.method({
  9710. selector: "valuesDo:",
  9711. protocol: "enumerating",
  9712. fn: function (aBlock){
  9713. var self=this,$self=this;
  9714. return $core.withContext(function($ctx1) {
  9715. return $recv($self["@values"])._do_(aBlock);
  9716. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9717. },
  9718. args: ["aBlock"],
  9719. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9720. referencedClasses: [],
  9721. messageSends: ["do:"]
  9722. }),
  9723. $globals.Dictionary);
  9724. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9725. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9726. $core.addMethod(
  9727. $core.method({
  9728. selector: "at:ifAbsent:",
  9729. protocol: "accessing",
  9730. fn: function (aKey,aBlock){
  9731. var self=this,$self=this;
  9732. return $core.withContext(function($ctx1) {
  9733. var $1;
  9734. $1=$self._includesKey_(aKey);
  9735. if($core.assert($1)){
  9736. return $self._basicAt_(aKey);
  9737. } else {
  9738. return $recv(aBlock)._value();
  9739. }
  9740. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9741. },
  9742. args: ["aKey", "aBlock"],
  9743. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9744. referencedClasses: [],
  9745. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9746. }),
  9747. $globals.HashedCollection);
  9748. $core.addMethod(
  9749. $core.method({
  9750. selector: "at:put:",
  9751. protocol: "accessing",
  9752. fn: function (aKey,aValue){
  9753. var self=this,$self=this;
  9754. return $core.withContext(function($ctx1) {
  9755. return $self._basicAt_put_(aKey,aValue);
  9756. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9757. },
  9758. args: ["aKey", "aValue"],
  9759. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9760. referencedClasses: [],
  9761. messageSends: ["basicAt:put:"]
  9762. }),
  9763. $globals.HashedCollection);
  9764. $core.addMethod(
  9765. $core.method({
  9766. selector: "includesKey:",
  9767. protocol: "testing",
  9768. fn: function (aKey){
  9769. var self=this,$self=this;
  9770. return $core.withContext(function($ctx1) {
  9771. return self.hasOwnProperty(aKey);
  9772. return self;
  9773. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9774. },
  9775. args: ["aKey"],
  9776. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9777. referencedClasses: [],
  9778. messageSends: []
  9779. }),
  9780. $globals.HashedCollection);
  9781. $core.addMethod(
  9782. $core.method({
  9783. selector: "keys",
  9784. protocol: "accessing",
  9785. fn: function (){
  9786. var self=this,$self=this;
  9787. return $core.withContext(function($ctx1) {
  9788. return Object.keys(self);
  9789. return self;
  9790. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9791. },
  9792. args: [],
  9793. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9794. referencedClasses: [],
  9795. messageSends: []
  9796. }),
  9797. $globals.HashedCollection);
  9798. $core.addMethod(
  9799. $core.method({
  9800. selector: "keysDo:",
  9801. protocol: "enumerating",
  9802. fn: function (aBlock){
  9803. var self=this,$self=this;
  9804. return $core.withContext(function($ctx1) {
  9805. $recv($self._keys())._do_(aBlock);
  9806. return self;
  9807. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9808. },
  9809. args: ["aBlock"],
  9810. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9811. referencedClasses: [],
  9812. messageSends: ["do:", "keys"]
  9813. }),
  9814. $globals.HashedCollection);
  9815. $core.addMethod(
  9816. $core.method({
  9817. selector: "removeKey:ifAbsent:",
  9818. protocol: "adding/removing",
  9819. fn: function (aKey,aBlock){
  9820. var self=this,$self=this;
  9821. return $core.withContext(function($ctx1) {
  9822. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9823. return $core.withContext(function($ctx2) {
  9824. $self._basicDelete_(aKey);
  9825. return removed;
  9826. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9827. }),(function(){
  9828. return $core.withContext(function($ctx2) {
  9829. return $recv(aBlock)._value();
  9830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9831. }));
  9832. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9833. },
  9834. args: ["aKey", "aBlock"],
  9835. 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 ]",
  9836. referencedClasses: [],
  9837. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9838. }),
  9839. $globals.HashedCollection);
  9840. $core.addMethod(
  9841. $core.method({
  9842. selector: "values",
  9843. protocol: "accessing",
  9844. fn: function (){
  9845. var self=this,$self=this;
  9846. return $core.withContext(function($ctx1) {
  9847. return $self._keys().map(function(key){
  9848. return $self._at_(key);
  9849. });
  9850. ;
  9851. return self;
  9852. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9853. },
  9854. args: [],
  9855. 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'>",
  9856. referencedClasses: [],
  9857. messageSends: []
  9858. }),
  9859. $globals.HashedCollection);
  9860. $core.addMethod(
  9861. $core.method({
  9862. selector: "valuesDo:",
  9863. protocol: "enumerating",
  9864. fn: function (aBlock){
  9865. var self=this,$self=this;
  9866. return $core.withContext(function($ctx1) {
  9867. $recv($self._values())._do_(aBlock);
  9868. return self;
  9869. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9870. },
  9871. args: ["aBlock"],
  9872. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9873. referencedClasses: [],
  9874. messageSends: ["do:", "values"]
  9875. }),
  9876. $globals.HashedCollection);
  9877. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  9878. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9879. $core.addMethod(
  9880. $core.method({
  9881. selector: "=",
  9882. protocol: "comparing",
  9883. fn: function (aCollection){
  9884. var self=this,$self=this;
  9885. return $core.withContext(function($ctx1) {
  9886. var $3,$2,$4,$1,$5;
  9887. var $early={};
  9888. try {
  9889. $3=$self._class();
  9890. $ctx1.sendIdx["class"]=1;
  9891. $2=$recv($3).__eq($recv(aCollection)._class());
  9892. $ctx1.sendIdx["="]=1;
  9893. $1=$recv($2)._and_((function(){
  9894. return $core.withContext(function($ctx2) {
  9895. $4=$self._size();
  9896. $ctx2.sendIdx["size"]=1;
  9897. return $recv($4).__eq($recv(aCollection)._size());
  9898. $ctx2.sendIdx["="]=2;
  9899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9900. }));
  9901. if(!$core.assert($1)){
  9902. return false;
  9903. }
  9904. $self._withIndexDo_((function(each,i){
  9905. return $core.withContext(function($ctx2) {
  9906. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9907. if(!$core.assert($5)){
  9908. throw $early=[false];
  9909. }
  9910. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9911. }));
  9912. return true;
  9913. }
  9914. catch(e) {if(e===$early)return e[0]; throw e}
  9915. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9916. },
  9917. args: ["aCollection"],
  9918. 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",
  9919. referencedClasses: [],
  9920. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9921. }),
  9922. $globals.SequenceableCollection);
  9923. $core.addMethod(
  9924. $core.method({
  9925. selector: "addLast:",
  9926. protocol: "adding/removing",
  9927. fn: function (anObject){
  9928. var self=this,$self=this;
  9929. return $core.withContext(function($ctx1) {
  9930. $self._add_(anObject);
  9931. return self;
  9932. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9933. },
  9934. args: ["anObject"],
  9935. source: "addLast: anObject\x0a\x09self add: anObject",
  9936. referencedClasses: [],
  9937. messageSends: ["add:"]
  9938. }),
  9939. $globals.SequenceableCollection);
  9940. $core.addMethod(
  9941. $core.method({
  9942. selector: "allButFirst",
  9943. protocol: "accessing",
  9944. fn: function (){
  9945. var self=this,$self=this;
  9946. return $core.withContext(function($ctx1) {
  9947. return $self._copyFrom_to_((2),$self._size());
  9948. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9949. },
  9950. args: [],
  9951. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9952. referencedClasses: [],
  9953. messageSends: ["copyFrom:to:", "size"]
  9954. }),
  9955. $globals.SequenceableCollection);
  9956. $core.addMethod(
  9957. $core.method({
  9958. selector: "allButLast",
  9959. protocol: "accessing",
  9960. fn: function (){
  9961. var self=this,$self=this;
  9962. return $core.withContext(function($ctx1) {
  9963. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9964. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9965. },
  9966. args: [],
  9967. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9968. referencedClasses: [],
  9969. messageSends: ["copyFrom:to:", "-", "size"]
  9970. }),
  9971. $globals.SequenceableCollection);
  9972. $core.addMethod(
  9973. $core.method({
  9974. selector: "anyOne",
  9975. protocol: "accessing",
  9976. fn: function (){
  9977. var self=this,$self=this;
  9978. return $core.withContext(function($ctx1) {
  9979. return $self._at_((1));
  9980. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9981. },
  9982. args: [],
  9983. source: "anyOne\x0a\x09^ self at: 1",
  9984. referencedClasses: [],
  9985. messageSends: ["at:"]
  9986. }),
  9987. $globals.SequenceableCollection);
  9988. $core.addMethod(
  9989. $core.method({
  9990. selector: "atRandom",
  9991. protocol: "accessing",
  9992. fn: function (){
  9993. var self=this,$self=this;
  9994. return $core.withContext(function($ctx1) {
  9995. return $self._at_($recv($self._size())._atRandom());
  9996. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9997. },
  9998. args: [],
  9999. source: "atRandom\x0a\x09^ self at: self size atRandom",
  10000. referencedClasses: [],
  10001. messageSends: ["at:", "atRandom", "size"]
  10002. }),
  10003. $globals.SequenceableCollection);
  10004. $core.addMethod(
  10005. $core.method({
  10006. selector: "beginsWith:",
  10007. protocol: "testing",
  10008. fn: function (prefix){
  10009. var self=this,$self=this;
  10010. return $core.withContext(function($ctx1) {
  10011. var $2,$3,$1;
  10012. $2=$self._size();
  10013. $ctx1.sendIdx["size"]=1;
  10014. $3=$recv(prefix)._size();
  10015. $ctx1.sendIdx["size"]=2;
  10016. $1=$recv($2).__lt($3);
  10017. if($core.assert($1)){
  10018. return false;
  10019. }
  10020. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  10021. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  10022. },
  10023. args: ["prefix"],
  10024. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  10025. referencedClasses: [],
  10026. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  10027. }),
  10028. $globals.SequenceableCollection);
  10029. $core.addMethod(
  10030. $core.method({
  10031. selector: "copyFrom:to:",
  10032. protocol: "copying",
  10033. fn: function (anIndex,anotherIndex){
  10034. var self=this,$self=this;
  10035. return $core.withContext(function($ctx1) {
  10036. $self._subclassResponsibility();
  10037. return self;
  10038. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  10039. },
  10040. args: ["anIndex", "anotherIndex"],
  10041. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  10042. referencedClasses: [],
  10043. messageSends: ["subclassResponsibility"]
  10044. }),
  10045. $globals.SequenceableCollection);
  10046. $core.addMethod(
  10047. $core.method({
  10048. selector: "detect:ifNone:",
  10049. protocol: "enumerating",
  10050. fn: function (aBlock,anotherBlock){
  10051. var self=this,$self=this;
  10052. return $core.withContext(function($ctx1) {
  10053. var nself = $self._numericallyIndexable();
  10054. for(var i = 0; i < nself.length; i++)
  10055. if(aBlock._value_(nself[i]))
  10056. return nself[i];
  10057. return anotherBlock._value();
  10058. ;
  10059. return self;
  10060. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  10061. },
  10062. args: ["aBlock", "anotherBlock"],
  10063. 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'>",
  10064. referencedClasses: [],
  10065. messageSends: []
  10066. }),
  10067. $globals.SequenceableCollection);
  10068. $core.addMethod(
  10069. $core.method({
  10070. selector: "do:",
  10071. protocol: "enumerating",
  10072. fn: function (aBlock){
  10073. var self=this,$self=this;
  10074. return $core.withContext(function($ctx1) {
  10075. var nself = $self._numericallyIndexable();
  10076. for(var i=0; i < nself.length; i++) {
  10077. aBlock._value_(nself[i]);
  10078. }
  10079. ;
  10080. return self;
  10081. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10082. },
  10083. args: ["aBlock"],
  10084. 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'>",
  10085. referencedClasses: [],
  10086. messageSends: []
  10087. }),
  10088. $globals.SequenceableCollection);
  10089. $core.addMethod(
  10090. $core.method({
  10091. selector: "endsWith:",
  10092. protocol: "testing",
  10093. fn: function (suffix){
  10094. var self=this,$self=this;
  10095. return $core.withContext(function($ctx1) {
  10096. var $2,$3,$1;
  10097. $2=$self._size();
  10098. $ctx1.sendIdx["size"]=1;
  10099. $3=$recv(suffix)._size();
  10100. $ctx1.sendIdx["size"]=2;
  10101. $1=$recv($2).__lt($3);
  10102. if($core.assert($1)){
  10103. return false;
  10104. }
  10105. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10106. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  10107. },
  10108. args: ["suffix"],
  10109. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10110. referencedClasses: [],
  10111. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10112. }),
  10113. $globals.SequenceableCollection);
  10114. $core.addMethod(
  10115. $core.method({
  10116. selector: "first",
  10117. protocol: "accessing",
  10118. fn: function (){
  10119. var self=this,$self=this;
  10120. return $core.withContext(function($ctx1) {
  10121. return $self._at_((1));
  10122. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10123. },
  10124. args: [],
  10125. source: "first\x0a\x09^ self at: 1",
  10126. referencedClasses: [],
  10127. messageSends: ["at:"]
  10128. }),
  10129. $globals.SequenceableCollection);
  10130. $core.addMethod(
  10131. $core.method({
  10132. selector: "first:",
  10133. protocol: "accessing",
  10134. fn: function (aNumber){
  10135. var self=this,$self=this;
  10136. return $core.withContext(function($ctx1) {
  10137. var $1;
  10138. $1=$recv($self._size()).__lt(aNumber);
  10139. if($core.assert($1)){
  10140. $self._error_("Invalid number of elements");
  10141. }
  10142. return $self._copyFrom_to_((1),aNumber);
  10143. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10144. },
  10145. args: ["aNumber"],
  10146. 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",
  10147. referencedClasses: [],
  10148. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10149. }),
  10150. $globals.SequenceableCollection);
  10151. $core.addMethod(
  10152. $core.method({
  10153. selector: "fourth",
  10154. protocol: "accessing",
  10155. fn: function (){
  10156. var self=this,$self=this;
  10157. return $core.withContext(function($ctx1) {
  10158. return $self._at_((4));
  10159. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10160. },
  10161. args: [],
  10162. source: "fourth\x0a\x09^ self at: 4",
  10163. referencedClasses: [],
  10164. messageSends: ["at:"]
  10165. }),
  10166. $globals.SequenceableCollection);
  10167. $core.addMethod(
  10168. $core.method({
  10169. selector: "includes:",
  10170. protocol: "testing",
  10171. fn: function (anObject){
  10172. var self=this,$self=this;
  10173. return $core.withContext(function($ctx1) {
  10174. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10175. return nil;
  10176. })))._notNil();
  10177. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10178. },
  10179. args: ["anObject"],
  10180. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10181. referencedClasses: [],
  10182. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10183. }),
  10184. $globals.SequenceableCollection);
  10185. $core.addMethod(
  10186. $core.method({
  10187. selector: "indexOf:ifAbsent:",
  10188. protocol: "accessing",
  10189. fn: function (anObject,aBlock){
  10190. var self=this,$self=this;
  10191. return $core.withContext(function($ctx1) {
  10192. var nself = $self._numericallyIndexable();
  10193. for(var i=0; i < nself.length; i++) {
  10194. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10195. };
  10196. return aBlock._value();
  10197. ;
  10198. return self;
  10199. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  10200. },
  10201. args: ["anObject", "aBlock"],
  10202. 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'>",
  10203. referencedClasses: [],
  10204. messageSends: []
  10205. }),
  10206. $globals.SequenceableCollection);
  10207. $core.addMethod(
  10208. $core.method({
  10209. selector: "indexOf:startingAt:",
  10210. protocol: "accessing",
  10211. fn: function (anObject,start){
  10212. var self=this,$self=this;
  10213. return $core.withContext(function($ctx1) {
  10214. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10215. return (0);
  10216. }));
  10217. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10218. },
  10219. args: ["anObject", "start"],
  10220. 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 ]",
  10221. referencedClasses: [],
  10222. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10223. }),
  10224. $globals.SequenceableCollection);
  10225. $core.addMethod(
  10226. $core.method({
  10227. selector: "indexOf:startingAt:ifAbsent:",
  10228. protocol: "accessing",
  10229. fn: function (anObject,start,aBlock){
  10230. var self=this,$self=this;
  10231. return $core.withContext(function($ctx1) {
  10232. var nself = $self._numericallyIndexable();
  10233. for(var i=start - 1; i < nself.length; i++){
  10234. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10235. }
  10236. return aBlock._value();
  10237. ;
  10238. return self;
  10239. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10240. },
  10241. args: ["anObject", "start", "aBlock"],
  10242. 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'>",
  10243. referencedClasses: [],
  10244. messageSends: []
  10245. }),
  10246. $globals.SequenceableCollection);
  10247. $core.addMethod(
  10248. $core.method({
  10249. selector: "last",
  10250. protocol: "accessing",
  10251. fn: function (){
  10252. var self=this,$self=this;
  10253. return $core.withContext(function($ctx1) {
  10254. return $self._at_($self._size());
  10255. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10256. },
  10257. args: [],
  10258. source: "last\x0a\x09^ self at: self size",
  10259. referencedClasses: [],
  10260. messageSends: ["at:", "size"]
  10261. }),
  10262. $globals.SequenceableCollection);
  10263. $core.addMethod(
  10264. $core.method({
  10265. selector: "last:",
  10266. protocol: "accessing",
  10267. fn: function (aNumber){
  10268. var self=this,$self=this;
  10269. return $core.withContext(function($ctx1) {
  10270. var $2,$1,$5,$4,$3;
  10271. $2=$self._size();
  10272. $ctx1.sendIdx["size"]=1;
  10273. $1=$recv($2).__lt(aNumber);
  10274. if($core.assert($1)){
  10275. $self._error_("Invalid number of elements");
  10276. }
  10277. $5=$self._size();
  10278. $ctx1.sendIdx["size"]=2;
  10279. $4=$recv($5).__minus(aNumber);
  10280. $3=$recv($4).__plus((1));
  10281. return $self._copyFrom_to_($3,$self._size());
  10282. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10283. },
  10284. args: ["aNumber"],
  10285. 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",
  10286. referencedClasses: [],
  10287. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10288. }),
  10289. $globals.SequenceableCollection);
  10290. $core.addMethod(
  10291. $core.method({
  10292. selector: "newStream",
  10293. protocol: "streaming",
  10294. fn: function (){
  10295. var self=this,$self=this;
  10296. return $core.withContext(function($ctx1) {
  10297. return $recv($self._streamClass())._on_(self);
  10298. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10299. },
  10300. args: [],
  10301. source: "newStream\x0a\x09^ self streamClass on: self",
  10302. referencedClasses: [],
  10303. messageSends: ["on:", "streamClass"]
  10304. }),
  10305. $globals.SequenceableCollection);
  10306. $core.addMethod(
  10307. $core.method({
  10308. selector: "numericallyIndexable",
  10309. protocol: "private",
  10310. fn: function (){
  10311. var self=this,$self=this;
  10312. return $core.withContext(function($ctx1) {
  10313. $self._subclassResponsibility();
  10314. return self;
  10315. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  10316. },
  10317. args: [],
  10318. 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",
  10319. referencedClasses: [],
  10320. messageSends: ["subclassResponsibility"]
  10321. }),
  10322. $globals.SequenceableCollection);
  10323. $core.addMethod(
  10324. $core.method({
  10325. selector: "readStream",
  10326. protocol: "streaming",
  10327. fn: function (){
  10328. var self=this,$self=this;
  10329. return $core.withContext(function($ctx1) {
  10330. return $self._stream();
  10331. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10332. },
  10333. args: [],
  10334. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10335. referencedClasses: [],
  10336. messageSends: ["stream"]
  10337. }),
  10338. $globals.SequenceableCollection);
  10339. $core.addMethod(
  10340. $core.method({
  10341. selector: "removeLast",
  10342. protocol: "adding/removing",
  10343. fn: function (){
  10344. var self=this,$self=this;
  10345. return $core.withContext(function($ctx1) {
  10346. return $self._remove_($self._last());
  10347. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10348. },
  10349. args: [],
  10350. source: "removeLast\x0a\x09^ self remove: self last",
  10351. referencedClasses: [],
  10352. messageSends: ["remove:", "last"]
  10353. }),
  10354. $globals.SequenceableCollection);
  10355. $core.addMethod(
  10356. $core.method({
  10357. selector: "reverseDo:",
  10358. protocol: "enumerating",
  10359. fn: function (aBlock){
  10360. var self=this,$self=this;
  10361. return $core.withContext(function($ctx1) {
  10362. $recv($self._reversed())._do_(aBlock);
  10363. return self;
  10364. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10365. },
  10366. args: ["aBlock"],
  10367. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10368. referencedClasses: [],
  10369. messageSends: ["do:", "reversed"]
  10370. }),
  10371. $globals.SequenceableCollection);
  10372. $core.addMethod(
  10373. $core.method({
  10374. selector: "reversed",
  10375. protocol: "converting",
  10376. fn: function (){
  10377. var self=this,$self=this;
  10378. return $core.withContext(function($ctx1) {
  10379. $self._subclassResponsibility();
  10380. return self;
  10381. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10382. },
  10383. args: [],
  10384. source: "reversed\x0a\x09self subclassResponsibility",
  10385. referencedClasses: [],
  10386. messageSends: ["subclassResponsibility"]
  10387. }),
  10388. $globals.SequenceableCollection);
  10389. $core.addMethod(
  10390. $core.method({
  10391. selector: "second",
  10392. protocol: "accessing",
  10393. fn: function (){
  10394. var self=this,$self=this;
  10395. return $core.withContext(function($ctx1) {
  10396. return $self._at_((2));
  10397. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10398. },
  10399. args: [],
  10400. source: "second\x0a\x09^ self at: 2",
  10401. referencedClasses: [],
  10402. messageSends: ["at:"]
  10403. }),
  10404. $globals.SequenceableCollection);
  10405. $core.addMethod(
  10406. $core.method({
  10407. selector: "single",
  10408. protocol: "accessing",
  10409. fn: function (){
  10410. var self=this,$self=this;
  10411. return $core.withContext(function($ctx1) {
  10412. if (self.length == 0) throw new Error("Collection is empty");
  10413. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10414. return $self._numericallyIndexable()[0];;
  10415. return self;
  10416. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  10417. },
  10418. args: [],
  10419. 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'>",
  10420. referencedClasses: [],
  10421. messageSends: []
  10422. }),
  10423. $globals.SequenceableCollection);
  10424. $core.addMethod(
  10425. $core.method({
  10426. selector: "stream",
  10427. protocol: "streaming",
  10428. fn: function (){
  10429. var self=this,$self=this;
  10430. return $core.withContext(function($ctx1) {
  10431. return $self._newStream();
  10432. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10433. },
  10434. args: [],
  10435. source: "stream\x0a\x09^ self newStream",
  10436. referencedClasses: [],
  10437. messageSends: ["newStream"]
  10438. }),
  10439. $globals.SequenceableCollection);
  10440. $core.addMethod(
  10441. $core.method({
  10442. selector: "streamClass",
  10443. protocol: "streaming",
  10444. fn: function (){
  10445. var self=this,$self=this;
  10446. return $core.withContext(function($ctx1) {
  10447. return $recv($self._class())._streamClass();
  10448. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10449. },
  10450. args: [],
  10451. source: "streamClass\x0a\x09^ self class streamClass",
  10452. referencedClasses: [],
  10453. messageSends: ["streamClass", "class"]
  10454. }),
  10455. $globals.SequenceableCollection);
  10456. $core.addMethod(
  10457. $core.method({
  10458. selector: "third",
  10459. protocol: "accessing",
  10460. fn: function (){
  10461. var self=this,$self=this;
  10462. return $core.withContext(function($ctx1) {
  10463. return $self._at_((3));
  10464. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10465. },
  10466. args: [],
  10467. source: "third\x0a\x09^ self at: 3",
  10468. referencedClasses: [],
  10469. messageSends: ["at:"]
  10470. }),
  10471. $globals.SequenceableCollection);
  10472. $core.addMethod(
  10473. $core.method({
  10474. selector: "with:do:",
  10475. protocol: "enumerating",
  10476. fn: function (anotherCollection,aBlock){
  10477. var self=this,$self=this;
  10478. return $core.withContext(function($ctx1) {
  10479. var nself = $self._numericallyIndexable();
  10480. anotherCollection = anotherCollection._numericallyIndexable();
  10481. for(var i=0; i<nself.length; i++) {
  10482. aBlock._value_value_(nself[i], anotherCollection[i]);
  10483. }
  10484. ;
  10485. return self;
  10486. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  10487. },
  10488. args: ["anotherCollection", "aBlock"],
  10489. 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'>",
  10490. referencedClasses: [],
  10491. messageSends: []
  10492. }),
  10493. $globals.SequenceableCollection);
  10494. $core.addMethod(
  10495. $core.method({
  10496. selector: "withIndexDo:",
  10497. protocol: "enumerating",
  10498. fn: function (aBlock){
  10499. var self=this,$self=this;
  10500. return $core.withContext(function($ctx1) {
  10501. var nself = $self._numericallyIndexable();
  10502. for(var i=0; i < nself.length; i++) {
  10503. aBlock._value_value_(nself[i], i+1);
  10504. }
  10505. ;
  10506. return self;
  10507. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10508. },
  10509. args: ["aBlock"],
  10510. 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'>",
  10511. referencedClasses: [],
  10512. messageSends: []
  10513. }),
  10514. $globals.SequenceableCollection);
  10515. $core.addMethod(
  10516. $core.method({
  10517. selector: "writeStream",
  10518. protocol: "streaming",
  10519. fn: function (){
  10520. var self=this,$self=this;
  10521. return $core.withContext(function($ctx1) {
  10522. return $self._stream();
  10523. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10524. },
  10525. args: [],
  10526. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10527. referencedClasses: [],
  10528. messageSends: ["stream"]
  10529. }),
  10530. $globals.SequenceableCollection);
  10531. $core.addMethod(
  10532. $core.method({
  10533. selector: "streamClass",
  10534. protocol: "accessing",
  10535. fn: function (){
  10536. var self=this,$self=this;
  10537. return $globals.Stream;
  10538. },
  10539. args: [],
  10540. source: "streamClass\x0a\x09\x09^ Stream",
  10541. referencedClasses: ["Stream"],
  10542. messageSends: []
  10543. }),
  10544. $globals.SequenceableCollection.a$cls);
  10545. $core.addMethod(
  10546. $core.method({
  10547. selector: "streamContents:",
  10548. protocol: "streaming",
  10549. fn: function (aBlock){
  10550. var self=this,$self=this;
  10551. var stream;
  10552. return $core.withContext(function($ctx1) {
  10553. stream=$recv($self._streamClass())._on_($self._new());
  10554. $recv(aBlock)._value_(stream);
  10555. return $recv(stream)._contents();
  10556. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10557. },
  10558. args: ["aBlock"],
  10559. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10560. referencedClasses: [],
  10561. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10562. }),
  10563. $globals.SequenceableCollection.a$cls);
  10564. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10565. $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`.";
  10566. $core.addMethod(
  10567. $core.method({
  10568. selector: "add:",
  10569. protocol: "adding/removing",
  10570. fn: function (anObject){
  10571. var self=this,$self=this;
  10572. return $core.withContext(function($ctx1) {
  10573. self.push(anObject); return anObject;;
  10574. return self;
  10575. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10576. },
  10577. args: ["anObject"],
  10578. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10579. referencedClasses: [],
  10580. messageSends: []
  10581. }),
  10582. $globals.Array);
  10583. $core.addMethod(
  10584. $core.method({
  10585. selector: "addAll:",
  10586. protocol: "adding/removing",
  10587. fn: function (aCollection){
  10588. var self=this,$self=this;
  10589. return $core.withContext(function($ctx1) {
  10590. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10591. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10592. return aCollection;;
  10593. return self;
  10594. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10595. },
  10596. args: ["aCollection"],
  10597. 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'>",
  10598. referencedClasses: [],
  10599. messageSends: []
  10600. }),
  10601. $globals.Array);
  10602. $core.addMethod(
  10603. $core.method({
  10604. selector: "addFirst:",
  10605. protocol: "adding/removing",
  10606. fn: function (anObject){
  10607. var self=this,$self=this;
  10608. return $core.withContext(function($ctx1) {
  10609. self.unshift(anObject); return anObject;;
  10610. return self;
  10611. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10612. },
  10613. args: ["anObject"],
  10614. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10615. referencedClasses: [],
  10616. messageSends: []
  10617. }),
  10618. $globals.Array);
  10619. $core.addMethod(
  10620. $core.method({
  10621. selector: "asJavaScriptSource",
  10622. protocol: "converting",
  10623. fn: function (){
  10624. var self=this,$self=this;
  10625. return $core.withContext(function($ctx1) {
  10626. var $1;
  10627. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10628. return $core.withContext(function($ctx2) {
  10629. return $recv(each)._asJavaScriptSource();
  10630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10631. })))._join_(", "))).__comma("]");
  10632. $ctx1.sendIdx[","]=1;
  10633. return $1;
  10634. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10635. },
  10636. args: [],
  10637. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10638. referencedClasses: [],
  10639. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10640. }),
  10641. $globals.Array);
  10642. $core.addMethod(
  10643. $core.method({
  10644. selector: "at:ifAbsent:",
  10645. protocol: "accessing",
  10646. fn: function (anIndex,aBlock){
  10647. var self=this,$self=this;
  10648. return $core.withContext(function($ctx1) {
  10649. return anIndex >= 1 && anIndex <= self.length
  10650. ? self[anIndex - 1]
  10651. : aBlock._value()
  10652. ;
  10653. return self;
  10654. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  10655. },
  10656. args: ["anIndex", "aBlock"],
  10657. 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'>",
  10658. referencedClasses: [],
  10659. messageSends: []
  10660. }),
  10661. $globals.Array);
  10662. $core.addMethod(
  10663. $core.method({
  10664. selector: "at:ifPresent:ifAbsent:",
  10665. protocol: "accessing",
  10666. fn: function (anIndex,aBlock,anotherBlock){
  10667. var self=this,$self=this;
  10668. return $core.withContext(function($ctx1) {
  10669. return anIndex >= 1 && anIndex <= self.length
  10670. ? aBlock._value_(self[anIndex - 1])
  10671. : anotherBlock._value()
  10672. ;
  10673. return self;
  10674. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  10675. },
  10676. args: ["anIndex", "aBlock", "anotherBlock"],
  10677. 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'>",
  10678. referencedClasses: [],
  10679. messageSends: []
  10680. }),
  10681. $globals.Array);
  10682. $core.addMethod(
  10683. $core.method({
  10684. selector: "at:put:",
  10685. protocol: "accessing",
  10686. fn: function (anIndex,anObject){
  10687. var self=this,$self=this;
  10688. return $core.withContext(function($ctx1) {
  10689. return self[anIndex - 1] = anObject;
  10690. return self;
  10691. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10692. },
  10693. args: ["anIndex", "anObject"],
  10694. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10695. referencedClasses: [],
  10696. messageSends: []
  10697. }),
  10698. $globals.Array);
  10699. $core.addMethod(
  10700. $core.method({
  10701. selector: "collect:",
  10702. protocol: "enumerating",
  10703. fn: function (aBlock){
  10704. var self=this,$self=this;
  10705. return $core.withContext(function($ctx1) {
  10706. return self.map(function(each) {return aBlock._value_(each)});
  10707. return self;
  10708. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10709. },
  10710. args: ["aBlock"],
  10711. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10712. referencedClasses: [],
  10713. messageSends: []
  10714. }),
  10715. $globals.Array);
  10716. $core.addMethod(
  10717. $core.method({
  10718. selector: "copyFrom:to:",
  10719. protocol: "copying",
  10720. fn: function (anIndex,anotherIndex){
  10721. var self=this,$self=this;
  10722. return $core.withContext(function($ctx1) {
  10723. if (anIndex >= 1 && anotherIndex <= self.length) {
  10724. return self.slice(anIndex - 1, anotherIndex);
  10725. } else {
  10726. self._at_(anIndex);
  10727. self._at_(self.length + 1);
  10728. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10729. };
  10730. return self;
  10731. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10732. },
  10733. args: ["anIndex", "anotherIndex"],
  10734. 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'>",
  10735. referencedClasses: [],
  10736. messageSends: []
  10737. }),
  10738. $globals.Array);
  10739. $core.addMethod(
  10740. $core.method({
  10741. selector: "join:",
  10742. protocol: "enumerating",
  10743. fn: function (aString){
  10744. var self=this,$self=this;
  10745. return $core.withContext(function($ctx1) {
  10746. return self.join(aString);
  10747. return self;
  10748. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10749. },
  10750. args: ["aString"],
  10751. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10752. referencedClasses: [],
  10753. messageSends: []
  10754. }),
  10755. $globals.Array);
  10756. $core.addMethod(
  10757. $core.method({
  10758. selector: "numericallyIndexable",
  10759. protocol: "private",
  10760. fn: function (){
  10761. var self=this,$self=this;
  10762. return self;
  10763. },
  10764. args: [],
  10765. source: "numericallyIndexable\x0a\x09^ self",
  10766. referencedClasses: [],
  10767. messageSends: []
  10768. }),
  10769. $globals.Array);
  10770. $core.addMethod(
  10771. $core.method({
  10772. selector: "printOn:",
  10773. protocol: "printing",
  10774. fn: function (aStream){
  10775. var self=this,$self=this;
  10776. return $core.withContext(function($ctx1) {
  10777. (
  10778. $ctx1.supercall = true,
  10779. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10780. $ctx1.supercall = false;
  10781. $ctx1.sendIdx["printOn:"]=1;
  10782. $recv(aStream)._nextPutAll_(" (");
  10783. $ctx1.sendIdx["nextPutAll:"]=1;
  10784. $self._do_separatedBy_((function(each){
  10785. return $core.withContext(function($ctx2) {
  10786. return $recv(each)._printOn_(aStream);
  10787. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10788. }),(function(){
  10789. return $core.withContext(function($ctx2) {
  10790. return $recv(aStream)._nextPutAll_(" ");
  10791. $ctx2.sendIdx["nextPutAll:"]=2;
  10792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10793. }));
  10794. $recv(aStream)._nextPutAll_(")");
  10795. return self;
  10796. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10797. },
  10798. args: ["aStream"],
  10799. 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: ')'",
  10800. referencedClasses: [],
  10801. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10802. }),
  10803. $globals.Array);
  10804. $core.addMethod(
  10805. $core.method({
  10806. selector: "remove:ifAbsent:",
  10807. protocol: "adding/removing",
  10808. fn: function (anObject,aBlock){
  10809. var self=this,$self=this;
  10810. var index;
  10811. return $core.withContext(function($ctx1) {
  10812. var $1;
  10813. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10814. return (0);
  10815. }));
  10816. $1=$recv(index).__eq((0));
  10817. if($core.assert($1)){
  10818. return $recv(aBlock)._value();
  10819. } else {
  10820. $self._removeIndex_(index);
  10821. return anObject;
  10822. }
  10823. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10824. },
  10825. args: ["anObject", "aBlock"],
  10826. 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 ]",
  10827. referencedClasses: [],
  10828. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10829. }),
  10830. $globals.Array);
  10831. $core.addMethod(
  10832. $core.method({
  10833. selector: "removeAll",
  10834. protocol: "adding/removing",
  10835. fn: function (){
  10836. var self=this,$self=this;
  10837. return $core.withContext(function($ctx1) {
  10838. self.length = 0;
  10839. return self;
  10840. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10841. },
  10842. args: [],
  10843. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10844. referencedClasses: [],
  10845. messageSends: []
  10846. }),
  10847. $globals.Array);
  10848. $core.addMethod(
  10849. $core.method({
  10850. selector: "removeFrom:to:",
  10851. protocol: "adding/removing",
  10852. fn: function (aNumber,anotherNumber){
  10853. var self=this,$self=this;
  10854. return $core.withContext(function($ctx1) {
  10855. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10856. return self;
  10857. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10858. },
  10859. args: ["aNumber", "anotherNumber"],
  10860. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10861. referencedClasses: [],
  10862. messageSends: []
  10863. }),
  10864. $globals.Array);
  10865. $core.addMethod(
  10866. $core.method({
  10867. selector: "removeIndex:",
  10868. protocol: "adding/removing",
  10869. fn: function (anInteger){
  10870. var self=this,$self=this;
  10871. return $core.withContext(function($ctx1) {
  10872. self.splice(anInteger - 1, 1);
  10873. return self;
  10874. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10875. },
  10876. args: ["anInteger"],
  10877. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10878. referencedClasses: [],
  10879. messageSends: []
  10880. }),
  10881. $globals.Array);
  10882. $core.addMethod(
  10883. $core.method({
  10884. selector: "removeLast",
  10885. protocol: "adding/removing",
  10886. fn: function (){
  10887. var self=this,$self=this;
  10888. return $core.withContext(function($ctx1) {
  10889. return self.pop();;
  10890. return self;
  10891. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10892. },
  10893. args: [],
  10894. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10895. referencedClasses: [],
  10896. messageSends: []
  10897. }),
  10898. $globals.Array);
  10899. $core.addMethod(
  10900. $core.method({
  10901. selector: "reversed",
  10902. protocol: "converting",
  10903. fn: function (){
  10904. var self=this,$self=this;
  10905. return $core.withContext(function($ctx1) {
  10906. return self.slice().reverse();
  10907. return self;
  10908. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10909. },
  10910. args: [],
  10911. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10912. referencedClasses: [],
  10913. messageSends: []
  10914. }),
  10915. $globals.Array);
  10916. $core.addMethod(
  10917. $core.method({
  10918. selector: "select:",
  10919. protocol: "enumerating",
  10920. fn: function (aBlock){
  10921. var self=this,$self=this;
  10922. return $core.withContext(function($ctx1) {
  10923. return self.filter(function(each) {return aBlock._value_(each)});
  10924. return self;
  10925. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10926. },
  10927. args: ["aBlock"],
  10928. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10929. referencedClasses: [],
  10930. messageSends: []
  10931. }),
  10932. $globals.Array);
  10933. $core.addMethod(
  10934. $core.method({
  10935. selector: "shallowCopy",
  10936. protocol: "copying",
  10937. fn: function (){
  10938. var self=this,$self=this;
  10939. return $core.withContext(function($ctx1) {
  10940. return self.slice();
  10941. return self;
  10942. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10943. },
  10944. args: [],
  10945. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10946. referencedClasses: [],
  10947. messageSends: []
  10948. }),
  10949. $globals.Array);
  10950. $core.addMethod(
  10951. $core.method({
  10952. selector: "size",
  10953. protocol: "accessing",
  10954. fn: function (){
  10955. var self=this,$self=this;
  10956. return $core.withContext(function($ctx1) {
  10957. return self.length;
  10958. return self;
  10959. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10960. },
  10961. args: [],
  10962. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10963. referencedClasses: [],
  10964. messageSends: []
  10965. }),
  10966. $globals.Array);
  10967. $core.addMethod(
  10968. $core.method({
  10969. selector: "sort",
  10970. protocol: "enumerating",
  10971. fn: function (){
  10972. var self=this,$self=this;
  10973. return $core.withContext(function($ctx1) {
  10974. return $self._sort_((function(a,b){
  10975. return $core.withContext(function($ctx2) {
  10976. return $recv(a).__lt(b);
  10977. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10978. }));
  10979. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10980. },
  10981. args: [],
  10982. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10983. referencedClasses: [],
  10984. messageSends: ["sort:", "<"]
  10985. }),
  10986. $globals.Array);
  10987. $core.addMethod(
  10988. $core.method({
  10989. selector: "sort:",
  10990. protocol: "enumerating",
  10991. fn: function (aBlock){
  10992. var self=this,$self=this;
  10993. return $core.withContext(function($ctx1) {
  10994. return self.sort(function(a, b) {
  10995. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10996. })
  10997. ;
  10998. return self;
  10999. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  11000. },
  11001. args: ["aBlock"],
  11002. 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'>",
  11003. referencedClasses: [],
  11004. messageSends: []
  11005. }),
  11006. $globals.Array);
  11007. $core.addMethod(
  11008. $core.method({
  11009. selector: "sorted",
  11010. protocol: "enumerating",
  11011. fn: function (){
  11012. var self=this,$self=this;
  11013. return $core.withContext(function($ctx1) {
  11014. return $recv($self._copy())._sort();
  11015. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  11016. },
  11017. args: [],
  11018. source: "sorted\x0a\x09^ self copy sort",
  11019. referencedClasses: [],
  11020. messageSends: ["sort", "copy"]
  11021. }),
  11022. $globals.Array);
  11023. $core.addMethod(
  11024. $core.method({
  11025. selector: "sorted:",
  11026. protocol: "enumerating",
  11027. fn: function (aBlock){
  11028. var self=this,$self=this;
  11029. return $core.withContext(function($ctx1) {
  11030. return $recv($self._copy())._sort_(aBlock);
  11031. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  11032. },
  11033. args: ["aBlock"],
  11034. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  11035. referencedClasses: [],
  11036. messageSends: ["sort:", "copy"]
  11037. }),
  11038. $globals.Array);
  11039. $core.addMethod(
  11040. $core.method({
  11041. selector: "new:",
  11042. protocol: "instance creation",
  11043. fn: function (anInteger){
  11044. var self=this,$self=this;
  11045. return $core.withContext(function($ctx1) {
  11046. return new Array(anInteger);
  11047. return self;
  11048. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  11049. },
  11050. args: ["anInteger"],
  11051. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  11052. referencedClasses: [],
  11053. messageSends: []
  11054. }),
  11055. $globals.Array.a$cls);
  11056. $core.addMethod(
  11057. $core.method({
  11058. selector: "with:",
  11059. protocol: "instance creation",
  11060. fn: function (anObject){
  11061. var self=this,$self=this;
  11062. return $core.withContext(function($ctx1) {
  11063. var $1;
  11064. $1=$self._new_((1));
  11065. $recv($1)._at_put_((1),anObject);
  11066. return $recv($1)._yourself();
  11067. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  11068. },
  11069. args: ["anObject"],
  11070. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11071. referencedClasses: [],
  11072. messageSends: ["at:put:", "new:", "yourself"]
  11073. }),
  11074. $globals.Array.a$cls);
  11075. $core.addMethod(
  11076. $core.method({
  11077. selector: "with:with:",
  11078. protocol: "instance creation",
  11079. fn: function (anObject,anObject2){
  11080. var self=this,$self=this;
  11081. return $core.withContext(function($ctx1) {
  11082. var $1;
  11083. $1=$self._new_((2));
  11084. $recv($1)._at_put_((1),anObject);
  11085. $ctx1.sendIdx["at:put:"]=1;
  11086. $recv($1)._at_put_((2),anObject2);
  11087. return $recv($1)._yourself();
  11088. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  11089. },
  11090. args: ["anObject", "anObject2"],
  11091. 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",
  11092. referencedClasses: [],
  11093. messageSends: ["at:put:", "new:", "yourself"]
  11094. }),
  11095. $globals.Array.a$cls);
  11096. $core.addMethod(
  11097. $core.method({
  11098. selector: "with:with:with:",
  11099. protocol: "instance creation",
  11100. fn: function (anObject,anObject2,anObject3){
  11101. var self=this,$self=this;
  11102. return $core.withContext(function($ctx1) {
  11103. var $1;
  11104. $1=$self._new_((3));
  11105. $recv($1)._at_put_((1),anObject);
  11106. $ctx1.sendIdx["at:put:"]=1;
  11107. $recv($1)._at_put_((2),anObject2);
  11108. $ctx1.sendIdx["at:put:"]=2;
  11109. $recv($1)._at_put_((3),anObject3);
  11110. return $recv($1)._yourself();
  11111. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  11112. },
  11113. args: ["anObject", "anObject2", "anObject3"],
  11114. 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",
  11115. referencedClasses: [],
  11116. messageSends: ["at:put:", "new:", "yourself"]
  11117. }),
  11118. $globals.Array.a$cls);
  11119. $core.addMethod(
  11120. $core.method({
  11121. selector: "withAll:",
  11122. protocol: "instance creation",
  11123. fn: function (aCollection){
  11124. var self=this,$self=this;
  11125. var instance,index;
  11126. return $core.withContext(function($ctx1) {
  11127. index=(1);
  11128. instance=$self._new_($recv(aCollection)._size());
  11129. $recv(aCollection)._do_((function(each){
  11130. return $core.withContext(function($ctx2) {
  11131. $recv(instance)._at_put_(index,each);
  11132. index=$recv(index).__plus((1));
  11133. return index;
  11134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11135. }));
  11136. return instance;
  11137. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  11138. },
  11139. args: ["aCollection"],
  11140. 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",
  11141. referencedClasses: [],
  11142. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11143. }),
  11144. $globals.Array.a$cls);
  11145. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  11146. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11147. $core.addMethod(
  11148. $core.method({
  11149. selector: ",",
  11150. protocol: "copying",
  11151. fn: function (aString){
  11152. var self=this,$self=this;
  11153. return $core.withContext(function($ctx1) {
  11154. var $1;
  11155. $1=$self._asString();
  11156. $ctx1.sendIdx["asString"]=1;
  11157. return $recv($1).__comma($recv(aString)._asString());
  11158. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  11159. },
  11160. args: ["aString"],
  11161. source: ", aString\x0a\x09^ self asString, aString asString",
  11162. referencedClasses: [],
  11163. messageSends: [",", "asString"]
  11164. }),
  11165. $globals.CharacterArray);
  11166. $core.addMethod(
  11167. $core.method({
  11168. selector: "add:",
  11169. protocol: "adding/removing",
  11170. fn: function (anObject){
  11171. var self=this,$self=this;
  11172. return $core.withContext(function($ctx1) {
  11173. $self._errorReadOnly();
  11174. return self;
  11175. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  11176. },
  11177. args: ["anObject"],
  11178. source: "add: anObject\x0a\x09self errorReadOnly",
  11179. referencedClasses: [],
  11180. messageSends: ["errorReadOnly"]
  11181. }),
  11182. $globals.CharacterArray);
  11183. $core.addMethod(
  11184. $core.method({
  11185. selector: "asLowercase",
  11186. protocol: "converting",
  11187. fn: function (){
  11188. var self=this,$self=this;
  11189. return $core.withContext(function($ctx1) {
  11190. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  11191. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  11192. },
  11193. args: [],
  11194. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  11195. referencedClasses: [],
  11196. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  11197. }),
  11198. $globals.CharacterArray);
  11199. $core.addMethod(
  11200. $core.method({
  11201. selector: "asNumber",
  11202. protocol: "converting",
  11203. fn: function (){
  11204. var self=this,$self=this;
  11205. return $core.withContext(function($ctx1) {
  11206. return $recv($self._asString())._asNumber();
  11207. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  11208. },
  11209. args: [],
  11210. source: "asNumber\x0a\x09^ self asString asNumber",
  11211. referencedClasses: [],
  11212. messageSends: ["asNumber", "asString"]
  11213. }),
  11214. $globals.CharacterArray);
  11215. $core.addMethod(
  11216. $core.method({
  11217. selector: "asString",
  11218. protocol: "converting",
  11219. fn: function (){
  11220. var self=this,$self=this;
  11221. return $core.withContext(function($ctx1) {
  11222. return $self._subclassResponsibility();
  11223. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  11224. },
  11225. args: [],
  11226. source: "asString\x0a\x09^ self subclassResponsibility",
  11227. referencedClasses: [],
  11228. messageSends: ["subclassResponsibility"]
  11229. }),
  11230. $globals.CharacterArray);
  11231. $core.addMethod(
  11232. $core.method({
  11233. selector: "asSymbol",
  11234. protocol: "converting",
  11235. fn: function (){
  11236. var self=this,$self=this;
  11237. return $core.withContext(function($ctx1) {
  11238. return $self._asString();
  11239. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  11240. },
  11241. args: [],
  11242. source: "asSymbol\x0a\x09^ self asString",
  11243. referencedClasses: [],
  11244. messageSends: ["asString"]
  11245. }),
  11246. $globals.CharacterArray);
  11247. $core.addMethod(
  11248. $core.method({
  11249. selector: "asSymbolPrintOn:",
  11250. protocol: "printing",
  11251. fn: function (aStream){
  11252. var self=this,$self=this;
  11253. return $core.withContext(function($ctx1) {
  11254. var $1;
  11255. $recv(aStream)._nextPutAll_("#");
  11256. $1=$recv($self._asString())._isSelector();
  11257. if($core.assert($1)){
  11258. $recv(aStream)._nextPut_(self);
  11259. } else {
  11260. $self._printOn_(aStream);
  11261. }
  11262. return self;
  11263. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  11264. },
  11265. args: ["aStream"],
  11266. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11267. referencedClasses: [],
  11268. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11269. }),
  11270. $globals.CharacterArray);
  11271. $core.addMethod(
  11272. $core.method({
  11273. selector: "asUppercase",
  11274. protocol: "converting",
  11275. fn: function (){
  11276. var self=this,$self=this;
  11277. return $core.withContext(function($ctx1) {
  11278. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  11279. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  11280. },
  11281. args: [],
  11282. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  11283. referencedClasses: [],
  11284. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  11285. }),
  11286. $globals.CharacterArray);
  11287. $core.addMethod(
  11288. $core.method({
  11289. selector: "at:put:",
  11290. protocol: "accessing",
  11291. fn: function (anIndex,anObject){
  11292. var self=this,$self=this;
  11293. return $core.withContext(function($ctx1) {
  11294. $self._errorReadOnly();
  11295. return self;
  11296. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  11297. },
  11298. args: ["anIndex", "anObject"],
  11299. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11300. referencedClasses: [],
  11301. messageSends: ["errorReadOnly"]
  11302. }),
  11303. $globals.CharacterArray);
  11304. $core.addMethod(
  11305. $core.method({
  11306. selector: "errorReadOnly",
  11307. protocol: "error handling",
  11308. fn: function (){
  11309. var self=this,$self=this;
  11310. return $core.withContext(function($ctx1) {
  11311. $self._error_("Object is read-only");
  11312. return self;
  11313. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  11314. },
  11315. args: [],
  11316. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11317. referencedClasses: [],
  11318. messageSends: ["error:"]
  11319. }),
  11320. $globals.CharacterArray);
  11321. $core.addMethod(
  11322. $core.method({
  11323. selector: "printOn:",
  11324. protocol: "printing",
  11325. fn: function (aStream){
  11326. var self=this,$self=this;
  11327. return $core.withContext(function($ctx1) {
  11328. $recv($self._asString())._printOn_(aStream);
  11329. return self;
  11330. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  11331. },
  11332. args: ["aStream"],
  11333. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11334. referencedClasses: [],
  11335. messageSends: ["printOn:", "asString"]
  11336. }),
  11337. $globals.CharacterArray);
  11338. $core.addMethod(
  11339. $core.method({
  11340. selector: "putOn:",
  11341. protocol: "streaming",
  11342. fn: function (aStream){
  11343. var self=this,$self=this;
  11344. return $core.withContext(function($ctx1) {
  11345. $recv(aStream)._nextPutString_(self);
  11346. return self;
  11347. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  11348. },
  11349. args: ["aStream"],
  11350. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11351. referencedClasses: [],
  11352. messageSends: ["nextPutString:"]
  11353. }),
  11354. $globals.CharacterArray);
  11355. $core.addMethod(
  11356. $core.method({
  11357. selector: "remove:",
  11358. protocol: "adding/removing",
  11359. fn: function (anObject){
  11360. var self=this,$self=this;
  11361. return $core.withContext(function($ctx1) {
  11362. $self._errorReadOnly();
  11363. return self;
  11364. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  11365. },
  11366. args: ["anObject"],
  11367. source: "remove: anObject\x0a\x09self errorReadOnly",
  11368. referencedClasses: [],
  11369. messageSends: ["errorReadOnly"]
  11370. }),
  11371. $globals.CharacterArray);
  11372. $core.addMethod(
  11373. $core.method({
  11374. selector: "remove:ifAbsent:",
  11375. protocol: "adding/removing",
  11376. fn: function (anObject,aBlock){
  11377. var self=this,$self=this;
  11378. return $core.withContext(function($ctx1) {
  11379. $self._errorReadOnly();
  11380. return self;
  11381. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  11382. },
  11383. args: ["anObject", "aBlock"],
  11384. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11385. referencedClasses: [],
  11386. messageSends: ["errorReadOnly"]
  11387. }),
  11388. $globals.CharacterArray);
  11389. $core.addMethod(
  11390. $core.method({
  11391. selector: "symbolPrintString",
  11392. protocol: "printing",
  11393. fn: function (){
  11394. var self=this,$self=this;
  11395. return $core.withContext(function($ctx1) {
  11396. return $recv($globals.String)._streamContents_((function(str){
  11397. return $core.withContext(function($ctx2) {
  11398. return $self._asSymbolPrintOn_(str);
  11399. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11400. }));
  11401. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  11402. },
  11403. args: [],
  11404. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11405. referencedClasses: ["String"],
  11406. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11407. }),
  11408. $globals.CharacterArray);
  11409. $core.addMethod(
  11410. $core.method({
  11411. selector: "fromString:",
  11412. protocol: "instance creation",
  11413. fn: function (aString){
  11414. var self=this,$self=this;
  11415. return $core.withContext(function($ctx1) {
  11416. $self._subclassResponsibility();
  11417. return self;
  11418. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  11419. },
  11420. args: ["aString"],
  11421. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11422. referencedClasses: [],
  11423. messageSends: ["subclassResponsibility"]
  11424. }),
  11425. $globals.CharacterArray.a$cls);
  11426. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  11427. $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 >> #,`";
  11428. $core.addMethod(
  11429. $core.method({
  11430. selector: ",",
  11431. protocol: "copying",
  11432. fn: function (aString){
  11433. var self=this,$self=this;
  11434. return $core.withContext(function($ctx1) {
  11435. return String(self) + aString;
  11436. return self;
  11437. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  11438. },
  11439. args: ["aString"],
  11440. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11441. referencedClasses: [],
  11442. messageSends: []
  11443. }),
  11444. $globals.String);
  11445. $core.addMethod(
  11446. $core.method({
  11447. selector: "<",
  11448. protocol: "comparing",
  11449. fn: function (aString){
  11450. var self=this,$self=this;
  11451. return $core.withContext(function($ctx1) {
  11452. return String(self) < aString._asString();
  11453. return self;
  11454. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  11455. },
  11456. args: ["aString"],
  11457. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11458. referencedClasses: [],
  11459. messageSends: []
  11460. }),
  11461. $globals.String);
  11462. $core.addMethod(
  11463. $core.method({
  11464. selector: "<=",
  11465. protocol: "comparing",
  11466. fn: function (aString){
  11467. var self=this,$self=this;
  11468. return $core.withContext(function($ctx1) {
  11469. return String(self) <= aString._asString();
  11470. return self;
  11471. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  11472. },
  11473. args: ["aString"],
  11474. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11475. referencedClasses: [],
  11476. messageSends: []
  11477. }),
  11478. $globals.String);
  11479. $core.addMethod(
  11480. $core.method({
  11481. selector: "=",
  11482. protocol: "comparing",
  11483. fn: function (aString){
  11484. var self=this,$self=this;
  11485. return $core.withContext(function($ctx1) {
  11486. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11487. return self;
  11488. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  11489. },
  11490. args: ["aString"],
  11491. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11492. referencedClasses: [],
  11493. messageSends: []
  11494. }),
  11495. $globals.String);
  11496. $core.addMethod(
  11497. $core.method({
  11498. selector: "==",
  11499. protocol: "comparing",
  11500. fn: function (aString){
  11501. var self=this,$self=this;
  11502. return $core.withContext(function($ctx1) {
  11503. if (typeof aString === "string") return String(self) === aString;
  11504. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11505. else return false;;
  11506. return self;
  11507. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  11508. },
  11509. args: ["aString"],
  11510. 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'>",
  11511. referencedClasses: [],
  11512. messageSends: []
  11513. }),
  11514. $globals.String);
  11515. $core.addMethod(
  11516. $core.method({
  11517. selector: ">",
  11518. protocol: "comparing",
  11519. fn: function (aString){
  11520. var self=this,$self=this;
  11521. return $core.withContext(function($ctx1) {
  11522. return String(self) > aString._asString();
  11523. return self;
  11524. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  11525. },
  11526. args: ["aString"],
  11527. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11528. referencedClasses: [],
  11529. messageSends: []
  11530. }),
  11531. $globals.String);
  11532. $core.addMethod(
  11533. $core.method({
  11534. selector: ">=",
  11535. protocol: "comparing",
  11536. fn: function (aString){
  11537. var self=this,$self=this;
  11538. return $core.withContext(function($ctx1) {
  11539. return String(self) >= aString._asString();
  11540. return self;
  11541. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  11542. },
  11543. args: ["aString"],
  11544. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11545. referencedClasses: [],
  11546. messageSends: []
  11547. }),
  11548. $globals.String);
  11549. $core.addMethod(
  11550. $core.method({
  11551. selector: "asJavaScriptMethodName",
  11552. protocol: "converting",
  11553. fn: function (){
  11554. var self=this,$self=this;
  11555. return $core.withContext(function($ctx1) {
  11556. return $core.st2js(self);
  11557. return self;
  11558. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11559. },
  11560. args: [],
  11561. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11562. referencedClasses: [],
  11563. messageSends: []
  11564. }),
  11565. $globals.String);
  11566. $core.addMethod(
  11567. $core.method({
  11568. selector: "asJavaScriptObject",
  11569. protocol: "converting",
  11570. fn: function (){
  11571. var self=this,$self=this;
  11572. return self;
  11573. },
  11574. args: [],
  11575. source: "asJavaScriptObject\x0a\x09^ self",
  11576. referencedClasses: [],
  11577. messageSends: []
  11578. }),
  11579. $globals.String);
  11580. $core.addMethod(
  11581. $core.method({
  11582. selector: "asJavaScriptSource",
  11583. protocol: "converting",
  11584. fn: function (){
  11585. var self=this,$self=this;
  11586. return $core.withContext(function($ctx1) {
  11587. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11588. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11589. else
  11590. return "\"" + self + "\"";
  11591. ;
  11592. return self;
  11593. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11594. },
  11595. args: [],
  11596. 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'>",
  11597. referencedClasses: [],
  11598. messageSends: []
  11599. }),
  11600. $globals.String);
  11601. $core.addMethod(
  11602. $core.method({
  11603. selector: "asLowercase",
  11604. protocol: "converting",
  11605. fn: function (){
  11606. var self=this,$self=this;
  11607. return $core.withContext(function($ctx1) {
  11608. return self.toLowerCase();
  11609. return self;
  11610. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11611. },
  11612. args: [],
  11613. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11614. referencedClasses: [],
  11615. messageSends: []
  11616. }),
  11617. $globals.String);
  11618. $core.addMethod(
  11619. $core.method({
  11620. selector: "asMutator",
  11621. protocol: "converting",
  11622. fn: function (){
  11623. var self=this,$self=this;
  11624. return $core.withContext(function($ctx1) {
  11625. var $1;
  11626. $1=$recv($self._last()).__eq(":");
  11627. if(!$core.assert($1)){
  11628. return $self.__comma(":");
  11629. }
  11630. return self;
  11631. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11632. },
  11633. args: [],
  11634. 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",
  11635. referencedClasses: [],
  11636. messageSends: ["ifFalse:", "=", "last", ","]
  11637. }),
  11638. $globals.String);
  11639. $core.addMethod(
  11640. $core.method({
  11641. selector: "asNumber",
  11642. protocol: "converting",
  11643. fn: function (){
  11644. var self=this,$self=this;
  11645. return $core.withContext(function($ctx1) {
  11646. return Number(self);
  11647. return self;
  11648. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11649. },
  11650. args: [],
  11651. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11652. referencedClasses: [],
  11653. messageSends: []
  11654. }),
  11655. $globals.String);
  11656. $core.addMethod(
  11657. $core.method({
  11658. selector: "asRegexp",
  11659. protocol: "converting",
  11660. fn: function (){
  11661. var self=this,$self=this;
  11662. return $core.withContext(function($ctx1) {
  11663. return $recv($globals.RegularExpression)._fromString_(self);
  11664. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11665. },
  11666. args: [],
  11667. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11668. referencedClasses: ["RegularExpression"],
  11669. messageSends: ["fromString:"]
  11670. }),
  11671. $globals.String);
  11672. $core.addMethod(
  11673. $core.method({
  11674. selector: "asString",
  11675. protocol: "converting",
  11676. fn: function (){
  11677. var self=this,$self=this;
  11678. return self;
  11679. },
  11680. args: [],
  11681. source: "asString\x0a\x09^ self",
  11682. referencedClasses: [],
  11683. messageSends: []
  11684. }),
  11685. $globals.String);
  11686. $core.addMethod(
  11687. $core.method({
  11688. selector: "asSymbol",
  11689. protocol: "converting",
  11690. fn: function (){
  11691. var self=this,$self=this;
  11692. return self;
  11693. },
  11694. args: [],
  11695. source: "asSymbol\x0a\x09^ self",
  11696. referencedClasses: [],
  11697. messageSends: []
  11698. }),
  11699. $globals.String);
  11700. $core.addMethod(
  11701. $core.method({
  11702. selector: "asUppercase",
  11703. protocol: "converting",
  11704. fn: function (){
  11705. var self=this,$self=this;
  11706. return $core.withContext(function($ctx1) {
  11707. return self.toUpperCase();
  11708. return self;
  11709. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11710. },
  11711. args: [],
  11712. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11713. referencedClasses: [],
  11714. messageSends: []
  11715. }),
  11716. $globals.String);
  11717. $core.addMethod(
  11718. $core.method({
  11719. selector: "asciiValue",
  11720. protocol: "accessing",
  11721. fn: function (){
  11722. var self=this,$self=this;
  11723. return $core.withContext(function($ctx1) {
  11724. return self.charCodeAt(0);;
  11725. return self;
  11726. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11727. },
  11728. args: [],
  11729. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11730. referencedClasses: [],
  11731. messageSends: []
  11732. }),
  11733. $globals.String);
  11734. $core.addMethod(
  11735. $core.method({
  11736. selector: "at:ifAbsent:",
  11737. protocol: "accessing",
  11738. fn: function (anIndex,aBlock){
  11739. var self=this,$self=this;
  11740. return $core.withContext(function($ctx1) {
  11741. return String(self)[anIndex - 1] || aBlock._value();
  11742. return self;
  11743. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11744. },
  11745. args: ["anIndex", "aBlock"],
  11746. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11747. referencedClasses: [],
  11748. messageSends: []
  11749. }),
  11750. $globals.String);
  11751. $core.addMethod(
  11752. $core.method({
  11753. selector: "at:ifPresent:ifAbsent:",
  11754. protocol: "accessing",
  11755. fn: function (anIndex,aBlock,anotherBlock){
  11756. var self=this,$self=this;
  11757. return $core.withContext(function($ctx1) {
  11758. var result = String(self)[anIndex - 1];
  11759. return result ? aBlock._value_(result) : anotherBlock._value();
  11760. ;
  11761. return self;
  11762. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11763. },
  11764. args: ["anIndex", "aBlock", "anotherBlock"],
  11765. 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'>",
  11766. referencedClasses: [],
  11767. messageSends: []
  11768. }),
  11769. $globals.String);
  11770. $core.addMethod(
  11771. $core.method({
  11772. selector: "capitalized",
  11773. protocol: "converting",
  11774. fn: function (){
  11775. var self=this,$self=this;
  11776. return $core.withContext(function($ctx1) {
  11777. return $self._ifNotEmpty_((function(){
  11778. return $core.withContext(function($ctx2) {
  11779. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11781. }));
  11782. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11783. },
  11784. args: [],
  11785. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11786. referencedClasses: [],
  11787. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11788. }),
  11789. $globals.String);
  11790. $core.addMethod(
  11791. $core.method({
  11792. selector: "charCodeAt:",
  11793. protocol: "accessing",
  11794. fn: function (anInteger){
  11795. var self=this,$self=this;
  11796. return $core.withContext(function($ctx1) {
  11797. return self.charCodeAt(anInteger - 1);
  11798. return self;
  11799. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11800. },
  11801. args: ["anInteger"],
  11802. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11803. referencedClasses: [],
  11804. messageSends: []
  11805. }),
  11806. $globals.String);
  11807. $core.addMethod(
  11808. $core.method({
  11809. selector: "copyFrom:to:",
  11810. protocol: "copying",
  11811. fn: function (anIndex,anotherIndex){
  11812. var self=this,$self=this;
  11813. return $core.withContext(function($ctx1) {
  11814. return self.substring(anIndex - 1, anotherIndex);
  11815. return self;
  11816. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11817. },
  11818. args: ["anIndex", "anotherIndex"],
  11819. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11820. referencedClasses: [],
  11821. messageSends: []
  11822. }),
  11823. $globals.String);
  11824. $core.addMethod(
  11825. $core.method({
  11826. selector: "crlfSanitized",
  11827. protocol: "converting",
  11828. fn: function (){
  11829. var self=this,$self=this;
  11830. return $core.withContext(function($ctx1) {
  11831. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11832. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11833. },
  11834. args: [],
  11835. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11836. referencedClasses: ["String"],
  11837. messageSends: ["join:", "lines", "lf"]
  11838. }),
  11839. $globals.String);
  11840. $core.addMethod(
  11841. $core.method({
  11842. selector: "deepCopy",
  11843. protocol: "copying",
  11844. fn: function (){
  11845. var self=this,$self=this;
  11846. return $core.withContext(function($ctx1) {
  11847. return $self._shallowCopy();
  11848. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11849. },
  11850. args: [],
  11851. source: "deepCopy\x0a\x09^ self shallowCopy",
  11852. referencedClasses: [],
  11853. messageSends: ["shallowCopy"]
  11854. }),
  11855. $globals.String);
  11856. $core.addMethod(
  11857. $core.method({
  11858. selector: "escaped",
  11859. protocol: "converting",
  11860. fn: function (){
  11861. var self=this,$self=this;
  11862. return $core.withContext(function($ctx1) {
  11863. return escape(self);
  11864. return self;
  11865. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11866. },
  11867. args: [],
  11868. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11869. referencedClasses: [],
  11870. messageSends: []
  11871. }),
  11872. $globals.String);
  11873. $core.addMethod(
  11874. $core.method({
  11875. selector: "includesSubString:",
  11876. protocol: "testing",
  11877. fn: function (subString){
  11878. var self=this,$self=this;
  11879. return $core.withContext(function($ctx1) {
  11880. return self.indexOf(subString) != -1;
  11881. return self;
  11882. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11883. },
  11884. args: ["subString"],
  11885. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11886. referencedClasses: [],
  11887. messageSends: []
  11888. }),
  11889. $globals.String);
  11890. $core.addMethod(
  11891. $core.method({
  11892. selector: "isCapitalized",
  11893. protocol: "testing",
  11894. fn: function (){
  11895. var self=this,$self=this;
  11896. return $core.withContext(function($ctx1) {
  11897. var $2,$1;
  11898. $2=$self._first();
  11899. $ctx1.sendIdx["first"]=1;
  11900. $1=$recv($2)._asUppercase();
  11901. return $recv($1).__eq_eq($self._first());
  11902. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11903. },
  11904. args: [],
  11905. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11906. referencedClasses: [],
  11907. messageSends: ["==", "asUppercase", "first"]
  11908. }),
  11909. $globals.String);
  11910. $core.addMethod(
  11911. $core.method({
  11912. selector: "isImmutable",
  11913. protocol: "testing",
  11914. fn: function (){
  11915. var self=this,$self=this;
  11916. return true;
  11917. },
  11918. args: [],
  11919. source: "isImmutable\x0a\x09^ true",
  11920. referencedClasses: [],
  11921. messageSends: []
  11922. }),
  11923. $globals.String);
  11924. $core.addMethod(
  11925. $core.method({
  11926. selector: "isSelector",
  11927. protocol: "testing",
  11928. fn: function (){
  11929. var self=this,$self=this;
  11930. return $core.withContext(function($ctx1) {
  11931. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11932. return self;
  11933. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11934. },
  11935. args: [],
  11936. 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>",
  11937. referencedClasses: [],
  11938. messageSends: []
  11939. }),
  11940. $globals.String);
  11941. $core.addMethod(
  11942. $core.method({
  11943. selector: "isString",
  11944. protocol: "testing",
  11945. fn: function (){
  11946. var self=this,$self=this;
  11947. return true;
  11948. },
  11949. args: [],
  11950. source: "isString\x0a\x09^ true",
  11951. referencedClasses: [],
  11952. messageSends: []
  11953. }),
  11954. $globals.String);
  11955. $core.addMethod(
  11956. $core.method({
  11957. selector: "isVowel",
  11958. protocol: "testing",
  11959. fn: function (){
  11960. var self=this,$self=this;
  11961. return $core.withContext(function($ctx1) {
  11962. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11963. return $core.withContext(function($ctx2) {
  11964. return "aeiou"._includes_($self._asLowercase());
  11965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11966. }));
  11967. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11968. },
  11969. args: [],
  11970. 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 ]",
  11971. referencedClasses: [],
  11972. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11973. }),
  11974. $globals.String);
  11975. $core.addMethod(
  11976. $core.method({
  11977. selector: "join:",
  11978. protocol: "split join",
  11979. fn: function (aCollection){
  11980. var self=this,$self=this;
  11981. return $core.withContext(function($ctx1) {
  11982. return $recv($globals.String)._streamContents_((function(stream){
  11983. return $core.withContext(function($ctx2) {
  11984. return $recv(aCollection)._do_separatedBy_((function(each){
  11985. return $core.withContext(function($ctx3) {
  11986. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11987. $ctx3.sendIdx["nextPutAll:"]=1;
  11988. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11989. }),(function(){
  11990. return $core.withContext(function($ctx3) {
  11991. return $recv(stream)._nextPutAll_(self);
  11992. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11993. }));
  11994. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11995. }));
  11996. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11997. },
  11998. args: ["aCollection"],
  11999. 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 ]]",
  12000. referencedClasses: ["String"],
  12001. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  12002. }),
  12003. $globals.String);
  12004. $core.addMethod(
  12005. $core.method({
  12006. selector: "lineIndicesDo:",
  12007. protocol: "split join",
  12008. fn: function (aBlock){
  12009. var self=this,$self=this;
  12010. var cr,lf,start,sz,nextLF,nextCR;
  12011. return $core.withContext(function($ctx1) {
  12012. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  12013. var $early={};
  12014. try {
  12015. start=(1);
  12016. sz=$self._size();
  12017. cr=$recv($globals.String)._cr();
  12018. nextCR=$self._indexOf_startingAt_(cr,(1));
  12019. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  12020. lf=$recv($globals.String)._lf();
  12021. nextLF=$self._indexOf_startingAt_(lf,(1));
  12022. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  12023. $recv((function(){
  12024. return $core.withContext(function($ctx2) {
  12025. return $recv(start).__lt_eq(sz);
  12026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12027. }))._whileTrue_((function(){
  12028. return $core.withContext(function($ctx2) {
  12029. $2=$recv(nextLF).__eq((0));
  12030. $ctx2.sendIdx["="]=1;
  12031. $1=$recv($2)._and_((function(){
  12032. return $core.withContext(function($ctx3) {
  12033. return $recv(nextCR).__eq((0));
  12034. $ctx3.sendIdx["="]=2;
  12035. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  12036. }));
  12037. $ctx2.sendIdx["and:"]=1;
  12038. if($core.assert($1)){
  12039. $recv(aBlock)._value_value_value_(start,sz,sz);
  12040. $ctx2.sendIdx["value:value:value:"]=1;
  12041. throw $early=[self];
  12042. }
  12043. $4=$recv(nextCR).__eq((0));
  12044. $ctx2.sendIdx["="]=3;
  12045. $3=$recv($4)._or_((function(){
  12046. return $core.withContext(function($ctx3) {
  12047. $5=(0).__lt(nextLF);
  12048. $ctx3.sendIdx["<"]=1;
  12049. return $recv($5)._and_((function(){
  12050. return $core.withContext(function($ctx4) {
  12051. return $recv(nextLF).__lt(nextCR);
  12052. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  12053. }));
  12054. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  12055. }));
  12056. if($core.assert($3)){
  12057. $6=start;
  12058. $7=$recv(nextLF).__minus((1));
  12059. $ctx2.sendIdx["-"]=1;
  12060. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  12061. $ctx2.sendIdx["value:value:value:"]=2;
  12062. start=(1).__plus(nextLF);
  12063. $ctx2.sendIdx["+"]=1;
  12064. start;
  12065. nextLF=$self._indexOf_startingAt_(lf,start);
  12066. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  12067. return nextLF;
  12068. } else {
  12069. $9=(1).__plus(nextCR);
  12070. $ctx2.sendIdx["+"]=2;
  12071. $8=$recv($9).__eq(nextLF);
  12072. if($core.assert($8)){
  12073. $10=start;
  12074. $11=$recv(nextCR).__minus((1));
  12075. $ctx2.sendIdx["-"]=2;
  12076. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  12077. $ctx2.sendIdx["value:value:value:"]=3;
  12078. start=(1).__plus(nextLF);
  12079. $ctx2.sendIdx["+"]=3;
  12080. start;
  12081. nextCR=$self._indexOf_startingAt_(cr,start);
  12082. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  12083. nextCR;
  12084. nextLF=$self._indexOf_startingAt_(lf,start);
  12085. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  12086. return nextLF;
  12087. } else {
  12088. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12089. start=(1).__plus(nextCR);
  12090. start;
  12091. nextCR=$self._indexOf_startingAt_(cr,start);
  12092. return nextCR;
  12093. }
  12094. }
  12095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12096. }));
  12097. return self;
  12098. }
  12099. catch(e) {if(e===$early)return e[0]; throw e}
  12100. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  12101. },
  12102. args: ["aBlock"],
  12103. 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 ] ]]",
  12104. referencedClasses: ["String"],
  12105. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12106. }),
  12107. $globals.String);
  12108. $core.addMethod(
  12109. $core.method({
  12110. selector: "lineNumber:",
  12111. protocol: "split join",
  12112. fn: function (anIndex){
  12113. var self=this,$self=this;
  12114. var lineCount;
  12115. return $core.withContext(function($ctx1) {
  12116. var $2,$1;
  12117. var $early={};
  12118. try {
  12119. lineCount=(0);
  12120. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12121. return $core.withContext(function($ctx2) {
  12122. lineCount=$recv(lineCount).__plus((1));
  12123. $2=lineCount;
  12124. $1=$recv($2).__eq(anIndex);
  12125. if($core.assert($1)){
  12126. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12127. }
  12128. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12129. }));
  12130. return nil;
  12131. }
  12132. catch(e) {if(e===$early)return e[0]; throw e}
  12133. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  12134. },
  12135. args: ["anIndex"],
  12136. 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",
  12137. referencedClasses: [],
  12138. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12139. }),
  12140. $globals.String);
  12141. $core.addMethod(
  12142. $core.method({
  12143. selector: "lines",
  12144. protocol: "split join",
  12145. fn: function (){
  12146. var self=this,$self=this;
  12147. return $core.withContext(function($ctx1) {
  12148. var result = self.split(/\r\n|\r|\n/);
  12149. if (!result[result.length-1]) result.pop();
  12150. return result;;
  12151. return self;
  12152. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  12153. },
  12154. args: [],
  12155. 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'>",
  12156. referencedClasses: [],
  12157. messageSends: []
  12158. }),
  12159. $globals.String);
  12160. $core.addMethod(
  12161. $core.method({
  12162. selector: "linesDo:",
  12163. protocol: "split join",
  12164. fn: function (aBlock){
  12165. var self=this,$self=this;
  12166. return $core.withContext(function($ctx1) {
  12167. $recv($self._lines())._do_(aBlock);
  12168. return self;
  12169. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  12170. },
  12171. args: ["aBlock"],
  12172. 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",
  12173. referencedClasses: [],
  12174. messageSends: ["do:", "lines"]
  12175. }),
  12176. $globals.String);
  12177. $core.addMethod(
  12178. $core.method({
  12179. selector: "match:",
  12180. protocol: "regular expressions",
  12181. fn: function (aRegexp){
  12182. var self=this,$self=this;
  12183. return $core.withContext(function($ctx1) {
  12184. return self.search(aRegexp) != -1;
  12185. return self;
  12186. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  12187. },
  12188. args: ["aRegexp"],
  12189. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12190. referencedClasses: [],
  12191. messageSends: []
  12192. }),
  12193. $globals.String);
  12194. $core.addMethod(
  12195. $core.method({
  12196. selector: "matchesOf:",
  12197. protocol: "regular expressions",
  12198. fn: function (aRegularExpression){
  12199. var self=this,$self=this;
  12200. return $core.withContext(function($ctx1) {
  12201. return self.match(aRegularExpression);
  12202. return self;
  12203. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  12204. },
  12205. args: ["aRegularExpression"],
  12206. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12207. referencedClasses: [],
  12208. messageSends: []
  12209. }),
  12210. $globals.String);
  12211. $core.addMethod(
  12212. $core.method({
  12213. selector: "numericallyIndexable",
  12214. protocol: "private",
  12215. fn: function (){
  12216. var self=this,$self=this;
  12217. return $core.withContext(function($ctx1) {
  12218. return String(self);
  12219. return self;
  12220. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  12221. },
  12222. args: [],
  12223. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  12224. referencedClasses: [],
  12225. messageSends: []
  12226. }),
  12227. $globals.String);
  12228. $core.addMethod(
  12229. $core.method({
  12230. selector: "printNl",
  12231. protocol: "printing",
  12232. fn: function (){
  12233. var self=this,$self=this;
  12234. return $core.withContext(function($ctx1) {
  12235. console.log(self);
  12236. return self;
  12237. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  12238. },
  12239. args: [],
  12240. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12241. referencedClasses: [],
  12242. messageSends: []
  12243. }),
  12244. $globals.String);
  12245. $core.addMethod(
  12246. $core.method({
  12247. selector: "printOn:",
  12248. protocol: "printing",
  12249. fn: function (aStream){
  12250. var self=this,$self=this;
  12251. return $core.withContext(function($ctx1) {
  12252. $recv(aStream)._nextPutAll_("'");
  12253. $ctx1.sendIdx["nextPutAll:"]=1;
  12254. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12255. $ctx1.sendIdx["nextPutAll:"]=2;
  12256. $recv(aStream)._nextPutAll_("'");
  12257. return self;
  12258. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  12259. },
  12260. args: ["aStream"],
  12261. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12262. referencedClasses: [],
  12263. messageSends: ["nextPutAll:", "replace:with:"]
  12264. }),
  12265. $globals.String);
  12266. $core.addMethod(
  12267. $core.method({
  12268. selector: "replace:with:",
  12269. protocol: "regular expressions",
  12270. fn: function (aString,anotherString){
  12271. var self=this,$self=this;
  12272. return $core.withContext(function($ctx1) {
  12273. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12274. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  12275. },
  12276. args: ["aString", "anotherString"],
  12277. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12278. referencedClasses: ["RegularExpression"],
  12279. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12280. }),
  12281. $globals.String);
  12282. $core.addMethod(
  12283. $core.method({
  12284. selector: "replaceRegexp:with:",
  12285. protocol: "regular expressions",
  12286. fn: function (aRegexp,aString){
  12287. var self=this,$self=this;
  12288. return $core.withContext(function($ctx1) {
  12289. return self.replace(aRegexp, aString);
  12290. return self;
  12291. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  12292. },
  12293. args: ["aRegexp", "aString"],
  12294. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12295. referencedClasses: [],
  12296. messageSends: []
  12297. }),
  12298. $globals.String);
  12299. $core.addMethod(
  12300. $core.method({
  12301. selector: "reversed",
  12302. protocol: "converting",
  12303. fn: function (){
  12304. var self=this,$self=this;
  12305. return $core.withContext(function($ctx1) {
  12306. return self.split("").reverse().join("");
  12307. return self;
  12308. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  12309. },
  12310. args: [],
  12311. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12312. referencedClasses: [],
  12313. messageSends: []
  12314. }),
  12315. $globals.String);
  12316. $core.addMethod(
  12317. $core.method({
  12318. selector: "shallowCopy",
  12319. protocol: "copying",
  12320. fn: function (){
  12321. var self=this,$self=this;
  12322. return self;
  12323. },
  12324. args: [],
  12325. source: "shallowCopy\x0a\x09^ self",
  12326. referencedClasses: [],
  12327. messageSends: []
  12328. }),
  12329. $globals.String);
  12330. $core.addMethod(
  12331. $core.method({
  12332. selector: "size",
  12333. protocol: "accessing",
  12334. fn: function (){
  12335. var self=this,$self=this;
  12336. return $core.withContext(function($ctx1) {
  12337. return self.length;
  12338. return self;
  12339. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  12340. },
  12341. args: [],
  12342. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  12343. referencedClasses: [],
  12344. messageSends: []
  12345. }),
  12346. $globals.String);
  12347. $core.addMethod(
  12348. $core.method({
  12349. selector: "subStrings:",
  12350. protocol: "split join",
  12351. fn: function (aString){
  12352. var self=this,$self=this;
  12353. return $core.withContext(function($ctx1) {
  12354. return $self._tokenize_(aString);
  12355. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  12356. },
  12357. args: ["aString"],
  12358. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12359. referencedClasses: [],
  12360. messageSends: ["tokenize:"]
  12361. }),
  12362. $globals.String);
  12363. $core.addMethod(
  12364. $core.method({
  12365. selector: "tokenize:",
  12366. protocol: "split join",
  12367. fn: function (aString){
  12368. var self=this,$self=this;
  12369. return $core.withContext(function($ctx1) {
  12370. return self.split(aString);
  12371. return self;
  12372. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  12373. },
  12374. args: ["aString"],
  12375. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12376. referencedClasses: [],
  12377. messageSends: []
  12378. }),
  12379. $globals.String);
  12380. $core.addMethod(
  12381. $core.method({
  12382. selector: "trimBoth",
  12383. protocol: "regular expressions",
  12384. fn: function (){
  12385. var self=this,$self=this;
  12386. return $core.withContext(function($ctx1) {
  12387. return $self._trimBoth_("\x5cs");
  12388. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  12389. },
  12390. args: [],
  12391. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12392. referencedClasses: [],
  12393. messageSends: ["trimBoth:"]
  12394. }),
  12395. $globals.String);
  12396. $core.addMethod(
  12397. $core.method({
  12398. selector: "trimBoth:",
  12399. protocol: "regular expressions",
  12400. fn: function (separators){
  12401. var self=this,$self=this;
  12402. return $core.withContext(function($ctx1) {
  12403. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12404. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  12405. },
  12406. args: ["separators"],
  12407. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12408. referencedClasses: [],
  12409. messageSends: ["trimRight:", "trimLeft:"]
  12410. }),
  12411. $globals.String);
  12412. $core.addMethod(
  12413. $core.method({
  12414. selector: "trimLeft",
  12415. protocol: "regular expressions",
  12416. fn: function (){
  12417. var self=this,$self=this;
  12418. return $core.withContext(function($ctx1) {
  12419. return $self._trimLeft_("\x5cs");
  12420. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  12421. },
  12422. args: [],
  12423. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12424. referencedClasses: [],
  12425. messageSends: ["trimLeft:"]
  12426. }),
  12427. $globals.String);
  12428. $core.addMethod(
  12429. $core.method({
  12430. selector: "trimLeft:",
  12431. protocol: "regular expressions",
  12432. fn: function (separators){
  12433. var self=this,$self=this;
  12434. return $core.withContext(function($ctx1) {
  12435. var $2,$1;
  12436. $2=$recv("^[".__comma(separators)).__comma("]+");
  12437. $ctx1.sendIdx[","]=1;
  12438. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12439. return $self._replaceRegexp_with_($1,"");
  12440. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  12441. },
  12442. args: ["separators"],
  12443. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12444. referencedClasses: ["RegularExpression"],
  12445. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12446. }),
  12447. $globals.String);
  12448. $core.addMethod(
  12449. $core.method({
  12450. selector: "trimRight",
  12451. protocol: "regular expressions",
  12452. fn: function (){
  12453. var self=this,$self=this;
  12454. return $core.withContext(function($ctx1) {
  12455. return $self._trimRight_("\x5cs");
  12456. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  12457. },
  12458. args: [],
  12459. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12460. referencedClasses: [],
  12461. messageSends: ["trimRight:"]
  12462. }),
  12463. $globals.String);
  12464. $core.addMethod(
  12465. $core.method({
  12466. selector: "trimRight:",
  12467. protocol: "regular expressions",
  12468. fn: function (separators){
  12469. var self=this,$self=this;
  12470. return $core.withContext(function($ctx1) {
  12471. var $2,$1;
  12472. $2=$recv("[".__comma(separators)).__comma("]+$");
  12473. $ctx1.sendIdx[","]=1;
  12474. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12475. return $self._replaceRegexp_with_($1,"");
  12476. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12477. },
  12478. args: ["separators"],
  12479. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12480. referencedClasses: ["RegularExpression"],
  12481. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12482. }),
  12483. $globals.String);
  12484. $core.addMethod(
  12485. $core.method({
  12486. selector: "unescaped",
  12487. protocol: "converting",
  12488. fn: function (){
  12489. var self=this,$self=this;
  12490. return $core.withContext(function($ctx1) {
  12491. return unescape(self);
  12492. return self;
  12493. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12494. },
  12495. args: [],
  12496. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12497. referencedClasses: [],
  12498. messageSends: []
  12499. }),
  12500. $globals.String);
  12501. $core.addMethod(
  12502. $core.method({
  12503. selector: "uriComponentDecoded",
  12504. protocol: "converting",
  12505. fn: function (){
  12506. var self=this,$self=this;
  12507. return $core.withContext(function($ctx1) {
  12508. return decodeURIComponent(self);
  12509. return self;
  12510. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12511. },
  12512. args: [],
  12513. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12514. referencedClasses: [],
  12515. messageSends: []
  12516. }),
  12517. $globals.String);
  12518. $core.addMethod(
  12519. $core.method({
  12520. selector: "uriComponentEncoded",
  12521. protocol: "converting",
  12522. fn: function (){
  12523. var self=this,$self=this;
  12524. return $core.withContext(function($ctx1) {
  12525. return encodeURIComponent(self);
  12526. return self;
  12527. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12528. },
  12529. args: [],
  12530. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12531. referencedClasses: [],
  12532. messageSends: []
  12533. }),
  12534. $globals.String);
  12535. $core.addMethod(
  12536. $core.method({
  12537. selector: "uriDecoded",
  12538. protocol: "converting",
  12539. fn: function (){
  12540. var self=this,$self=this;
  12541. return $core.withContext(function($ctx1) {
  12542. return decodeURI(self);
  12543. return self;
  12544. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12545. },
  12546. args: [],
  12547. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12548. referencedClasses: [],
  12549. messageSends: []
  12550. }),
  12551. $globals.String);
  12552. $core.addMethod(
  12553. $core.method({
  12554. selector: "uriEncoded",
  12555. protocol: "converting",
  12556. fn: function (){
  12557. var self=this,$self=this;
  12558. return $core.withContext(function($ctx1) {
  12559. return encodeURI(self);
  12560. return self;
  12561. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12562. },
  12563. args: [],
  12564. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12565. referencedClasses: [],
  12566. messageSends: []
  12567. }),
  12568. $globals.String);
  12569. $core.addMethod(
  12570. $core.method({
  12571. selector: "value:",
  12572. protocol: "evaluating",
  12573. fn: function (anObject){
  12574. var self=this,$self=this;
  12575. return $core.withContext(function($ctx1) {
  12576. return $recv(anObject)._perform_(self);
  12577. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12578. },
  12579. args: ["anObject"],
  12580. source: "value: anObject \x0a\x09^ anObject perform: self",
  12581. referencedClasses: [],
  12582. messageSends: ["perform:"]
  12583. }),
  12584. $globals.String);
  12585. $core.addMethod(
  12586. $core.method({
  12587. selector: "cr",
  12588. protocol: "accessing",
  12589. fn: function (){
  12590. var self=this,$self=this;
  12591. return $core.withContext(function($ctx1) {
  12592. return "\r";
  12593. return self;
  12594. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12595. },
  12596. args: [],
  12597. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12598. referencedClasses: [],
  12599. messageSends: []
  12600. }),
  12601. $globals.String.a$cls);
  12602. $core.addMethod(
  12603. $core.method({
  12604. selector: "crlf",
  12605. protocol: "accessing",
  12606. fn: function (){
  12607. var self=this,$self=this;
  12608. return $core.withContext(function($ctx1) {
  12609. return "\r\n";
  12610. return self;
  12611. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12612. },
  12613. args: [],
  12614. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12615. referencedClasses: [],
  12616. messageSends: []
  12617. }),
  12618. $globals.String.a$cls);
  12619. $core.addMethod(
  12620. $core.method({
  12621. selector: "esc",
  12622. protocol: "accessing",
  12623. fn: function (){
  12624. var self=this,$self=this;
  12625. return $core.withContext(function($ctx1) {
  12626. return $self._fromCharCode_((27));
  12627. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12628. },
  12629. args: [],
  12630. source: "esc\x0a\x09^ self fromCharCode: 27",
  12631. referencedClasses: [],
  12632. messageSends: ["fromCharCode:"]
  12633. }),
  12634. $globals.String.a$cls);
  12635. $core.addMethod(
  12636. $core.method({
  12637. selector: "fromCharCode:",
  12638. protocol: "instance creation",
  12639. fn: function (anInteger){
  12640. var self=this,$self=this;
  12641. return $core.withContext(function($ctx1) {
  12642. return String.fromCharCode(anInteger);
  12643. return self;
  12644. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12645. },
  12646. args: ["anInteger"],
  12647. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12648. referencedClasses: [],
  12649. messageSends: []
  12650. }),
  12651. $globals.String.a$cls);
  12652. $core.addMethod(
  12653. $core.method({
  12654. selector: "fromString:",
  12655. protocol: "instance creation",
  12656. fn: function (aString){
  12657. var self=this,$self=this;
  12658. return $core.withContext(function($ctx1) {
  12659. return String(aString);
  12660. return self;
  12661. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12662. },
  12663. args: ["aString"],
  12664. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12665. referencedClasses: [],
  12666. messageSends: []
  12667. }),
  12668. $globals.String.a$cls);
  12669. $core.addMethod(
  12670. $core.method({
  12671. selector: "lf",
  12672. protocol: "accessing",
  12673. fn: function (){
  12674. var self=this,$self=this;
  12675. return $core.withContext(function($ctx1) {
  12676. return "\n";
  12677. return self;
  12678. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12679. },
  12680. args: [],
  12681. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12682. referencedClasses: [],
  12683. messageSends: []
  12684. }),
  12685. $globals.String.a$cls);
  12686. $core.addMethod(
  12687. $core.method({
  12688. selector: "random",
  12689. protocol: "random",
  12690. fn: function (){
  12691. var self=this,$self=this;
  12692. return $core.withContext(function($ctx1) {
  12693. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12694. return self;
  12695. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12696. },
  12697. args: [],
  12698. 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);'>",
  12699. referencedClasses: [],
  12700. messageSends: []
  12701. }),
  12702. $globals.String.a$cls);
  12703. $core.addMethod(
  12704. $core.method({
  12705. selector: "randomNotIn:",
  12706. protocol: "random",
  12707. fn: function (aString){
  12708. var self=this,$self=this;
  12709. var result;
  12710. return $core.withContext(function($ctx1) {
  12711. $recv((function(){
  12712. return $core.withContext(function($ctx2) {
  12713. result=$self._random();
  12714. result;
  12715. return $recv(aString)._includesSubString_(result);
  12716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12717. }))._whileTrue();
  12718. return result;
  12719. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12720. },
  12721. args: ["aString"],
  12722. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12723. referencedClasses: [],
  12724. messageSends: ["whileTrue", "random", "includesSubString:"]
  12725. }),
  12726. $globals.String.a$cls);
  12727. $core.addMethod(
  12728. $core.method({
  12729. selector: "space",
  12730. protocol: "accessing",
  12731. fn: function (){
  12732. var self=this,$self=this;
  12733. return $core.withContext(function($ctx1) {
  12734. return " ";
  12735. return self;
  12736. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12737. },
  12738. args: [],
  12739. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12740. referencedClasses: [],
  12741. messageSends: []
  12742. }),
  12743. $globals.String.a$cls);
  12744. $core.addMethod(
  12745. $core.method({
  12746. selector: "streamClass",
  12747. protocol: "accessing",
  12748. fn: function (){
  12749. var self=this,$self=this;
  12750. return $globals.StringStream;
  12751. },
  12752. args: [],
  12753. source: "streamClass\x0a\x09\x09^ StringStream",
  12754. referencedClasses: ["StringStream"],
  12755. messageSends: []
  12756. }),
  12757. $globals.String.a$cls);
  12758. $core.addMethod(
  12759. $core.method({
  12760. selector: "tab",
  12761. protocol: "accessing",
  12762. fn: function (){
  12763. var self=this,$self=this;
  12764. return $core.withContext(function($ctx1) {
  12765. return "\t";
  12766. return self;
  12767. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12768. },
  12769. args: [],
  12770. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12771. referencedClasses: [],
  12772. messageSends: []
  12773. }),
  12774. $globals.String.a$cls);
  12775. $core.addMethod(
  12776. $core.method({
  12777. selector: "value:",
  12778. protocol: "instance creation",
  12779. fn: function (aUTFCharCode){
  12780. var self=this,$self=this;
  12781. return $core.withContext(function($ctx1) {
  12782. return String.fromCharCode(aUTFCharCode);;
  12783. return self;
  12784. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12785. },
  12786. args: ["aUTFCharCode"],
  12787. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12788. referencedClasses: [],
  12789. messageSends: []
  12790. }),
  12791. $globals.String.a$cls);
  12792. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12793. $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`.";
  12794. $core.addMethod(
  12795. $core.method({
  12796. selector: "=",
  12797. protocol: "comparing",
  12798. fn: function (aCollection){
  12799. var self=this,$self=this;
  12800. return $core.withContext(function($ctx1) {
  12801. var $2,$1,$4,$3,$5;
  12802. var $early={};
  12803. try {
  12804. $2=$self._class();
  12805. $ctx1.sendIdx["class"]=1;
  12806. $1=$recv($2).__eq($recv(aCollection)._class());
  12807. $ctx1.sendIdx["="]=1;
  12808. if(!$core.assert($1)){
  12809. return false;
  12810. }
  12811. $4=$self._size();
  12812. $ctx1.sendIdx["size"]=1;
  12813. $3=$recv($4).__eq($recv(aCollection)._size());
  12814. if(!$core.assert($3)){
  12815. return false;
  12816. }
  12817. $self._do_((function(each){
  12818. return $core.withContext(function($ctx2) {
  12819. $5=$recv(aCollection)._includes_(each);
  12820. if(!$core.assert($5)){
  12821. throw $early=[false];
  12822. }
  12823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12824. }));
  12825. return true;
  12826. }
  12827. catch(e) {if(e===$early)return e[0]; throw e}
  12828. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12829. },
  12830. args: ["aCollection"],
  12831. 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",
  12832. referencedClasses: [],
  12833. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12834. }),
  12835. $globals.Set);
  12836. $core.addMethod(
  12837. $core.method({
  12838. selector: "add:",
  12839. protocol: "adding/removing",
  12840. fn: function (anObject){
  12841. var self=this,$self=this;
  12842. var bucket;
  12843. return $core.withContext(function($ctx1) {
  12844. var $1,$receiver;
  12845. bucket=$self._bucketsOfElement_(anObject);
  12846. $1=$recv(bucket)._second();
  12847. if(($receiver = $1) == null || $receiver.a$nil){
  12848. var object,slowBucket;
  12849. object=$recv(bucket)._first();
  12850. $ctx1.sendIdx["first"]=1;
  12851. object;
  12852. slowBucket=$recv(bucket)._third();
  12853. slowBucket;
  12854. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12855. return $core.withContext(function($ctx2) {
  12856. $recv(slowBucket)._add_(object);
  12857. $self["@size"]=$recv($self["@size"]).__plus((1));
  12858. return $self["@size"];
  12859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12860. }));
  12861. return object;
  12862. } else {
  12863. var primitiveBucket;
  12864. primitiveBucket=$receiver;
  12865. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12866. }
  12867. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12868. },
  12869. args: ["anObject"],
  12870. 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 ]",
  12871. referencedClasses: [],
  12872. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12873. }),
  12874. $globals.Set);
  12875. $core.addMethod(
  12876. $core.method({
  12877. selector: "add:in:",
  12878. protocol: "private",
  12879. fn: function (anObject,anotherObject){
  12880. var self=this,$self=this;
  12881. return $core.withContext(function($ctx1) {
  12882. if (anObject in anotherObject.store) { return false; }
  12883. $self['@size']++;
  12884. anotherObject.store[anObject] = true;
  12885. return anObject;
  12886. ;
  12887. return self;
  12888. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12889. },
  12890. args: ["anObject", "anotherObject"],
  12891. 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'>",
  12892. referencedClasses: [],
  12893. messageSends: []
  12894. }),
  12895. $globals.Set);
  12896. $core.addMethod(
  12897. $core.method({
  12898. selector: "bucketsOfElement:",
  12899. protocol: "private",
  12900. fn: function (anObject){
  12901. var self=this,$self=this;
  12902. return $core.withContext(function($ctx1) {
  12903. // include nil to well-known objects under "boolean" fastBucket
  12904. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12905. var prim = anObject.valueOf();
  12906. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12907. var bucket = null;
  12908. $self['@slowBucketStores'].some(function (store) {
  12909. return bucket = store._bucketOfElement_(anObject);
  12910. });
  12911. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12912. }
  12913. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12914. ;
  12915. return self;
  12916. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12917. },
  12918. args: ["anObject"],
  12919. 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'>",
  12920. referencedClasses: [],
  12921. messageSends: []
  12922. }),
  12923. $globals.Set);
  12924. $core.addMethod(
  12925. $core.method({
  12926. selector: "classNameOf:",
  12927. protocol: "private",
  12928. fn: function (anObject){
  12929. var self=this,$self=this;
  12930. return $core.withContext(function($ctx1) {
  12931. return anObject.a$cls != null && anObject.a$cls.name;
  12932. return self;
  12933. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12934. },
  12935. args: ["anObject"],
  12936. 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'>",
  12937. referencedClasses: [],
  12938. messageSends: []
  12939. }),
  12940. $globals.Set);
  12941. $core.addMethod(
  12942. $core.method({
  12943. selector: "collect:",
  12944. protocol: "enumerating",
  12945. fn: function (aBlock){
  12946. var self=this,$self=this;
  12947. var collection;
  12948. return $core.withContext(function($ctx1) {
  12949. collection=$recv($self._class())._new();
  12950. $self._do_((function(each){
  12951. return $core.withContext(function($ctx2) {
  12952. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12954. }));
  12955. return collection;
  12956. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12957. },
  12958. args: ["aBlock"],
  12959. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12960. referencedClasses: [],
  12961. messageSends: ["new", "class", "do:", "add:", "value:"]
  12962. }),
  12963. $globals.Set);
  12964. $core.addMethod(
  12965. $core.method({
  12966. selector: "detect:ifNone:",
  12967. protocol: "enumerating",
  12968. fn: function (aBlock,anotherBlock){
  12969. var self=this,$self=this;
  12970. return $core.withContext(function($ctx1) {
  12971. var $1;
  12972. var $early={};
  12973. try {
  12974. $self._do_((function(each){
  12975. return $core.withContext(function($ctx2) {
  12976. $1=$recv(aBlock)._value_(each);
  12977. if($core.assert($1)){
  12978. throw $early=[each];
  12979. }
  12980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12981. }));
  12982. return $recv(anotherBlock)._value();
  12983. }
  12984. catch(e) {if(e===$early)return e[0]; throw e}
  12985. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12986. },
  12987. args: ["aBlock", "anotherBlock"],
  12988. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12989. referencedClasses: [],
  12990. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12991. }),
  12992. $globals.Set);
  12993. $core.addMethod(
  12994. $core.method({
  12995. selector: "do:",
  12996. protocol: "enumerating",
  12997. fn: function (aBlock){
  12998. var self=this,$self=this;
  12999. return $core.withContext(function($ctx1) {
  13000. var el, keys, i;
  13001. el = $self['@fastBuckets'];
  13002. keys = Object.keys(el);
  13003. for (i = 0; i < keys.length; ++i) {
  13004. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  13005. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  13006. else { store._do_(aBlock); }
  13007. }
  13008. el = $self['@slowBucketStores'];
  13009. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  13010. $self['@defaultBucket']._do_(aBlock);
  13011. ;
  13012. return self;
  13013. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  13014. },
  13015. args: ["aBlock"],
  13016. 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'>",
  13017. referencedClasses: [],
  13018. messageSends: []
  13019. }),
  13020. $globals.Set);
  13021. $core.addMethod(
  13022. $core.method({
  13023. selector: "includes:",
  13024. protocol: "testing",
  13025. fn: function (anObject){
  13026. var self=this,$self=this;
  13027. var bucket;
  13028. return $core.withContext(function($ctx1) {
  13029. var $1,$2,$3,$receiver;
  13030. bucket=$self._bucketsOfElement_(anObject);
  13031. $1=$recv(bucket)._second();
  13032. if(($receiver = $1) == null || $receiver.a$nil){
  13033. $2=$recv(bucket)._third();
  13034. $3=$recv(bucket)._first();
  13035. $ctx1.sendIdx["first"]=1;
  13036. return $recv($2)._includes_($3);
  13037. } else {
  13038. var primitiveBucket;
  13039. primitiveBucket=$receiver;
  13040. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  13041. }
  13042. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  13043. },
  13044. args: ["anObject"],
  13045. 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 ]",
  13046. referencedClasses: [],
  13047. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  13048. }),
  13049. $globals.Set);
  13050. $core.addMethod(
  13051. $core.method({
  13052. selector: "includes:in:",
  13053. protocol: "private",
  13054. fn: function (anObject,anotherObject){
  13055. var self=this,$self=this;
  13056. return $core.withContext(function($ctx1) {
  13057. return anObject in anotherObject.store;
  13058. return self;
  13059. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13060. },
  13061. args: ["anObject", "anotherObject"],
  13062. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  13063. referencedClasses: [],
  13064. messageSends: []
  13065. }),
  13066. $globals.Set);
  13067. $core.addMethod(
  13068. $core.method({
  13069. selector: "initialize",
  13070. protocol: "initialization",
  13071. fn: function (){
  13072. var self=this,$self=this;
  13073. return $core.withContext(function($ctx1) {
  13074. (
  13075. $ctx1.supercall = true,
  13076. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13077. $ctx1.supercall = false;
  13078. $self["@defaultBucket"]=[];
  13079. $self._initializeSlowBucketStores();
  13080. $self._removeAll();
  13081. return self;
  13082. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  13083. },
  13084. args: [],
  13085. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  13086. referencedClasses: [],
  13087. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  13088. }),
  13089. $globals.Set);
  13090. $core.addMethod(
  13091. $core.method({
  13092. selector: "initializeSlowBucketStores",
  13093. protocol: "initialization",
  13094. fn: function (){
  13095. var self=this,$self=this;
  13096. return $core.withContext(function($ctx1) {
  13097. var $1;
  13098. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13099. return $core.withContext(function($ctx2) {
  13100. return $self._classNameOf_(x);
  13101. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13102. }));
  13103. $ctx1.sendIdx["hashBlock:"]=1;
  13104. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13105. return $core.withContext(function($ctx2) {
  13106. return $self._jsConstructorNameOf_(x);
  13107. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13108. }))];
  13109. return self;
  13110. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  13111. },
  13112. args: [],
  13113. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13114. referencedClasses: ["ArrayBucketStore"],
  13115. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13116. }),
  13117. $globals.Set);
  13118. $core.addMethod(
  13119. $core.method({
  13120. selector: "jsConstructorNameOf:",
  13121. protocol: "private",
  13122. fn: function (anObject){
  13123. var self=this,$self=this;
  13124. return $core.withContext(function($ctx1) {
  13125. return anObject.constructor && anObject.constructor.name;
  13126. return self;
  13127. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  13128. },
  13129. args: ["anObject"],
  13130. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13131. referencedClasses: [],
  13132. messageSends: []
  13133. }),
  13134. $globals.Set);
  13135. $core.addMethod(
  13136. $core.method({
  13137. selector: "printOn:",
  13138. protocol: "printing",
  13139. fn: function (aStream){
  13140. var self=this,$self=this;
  13141. return $core.withContext(function($ctx1) {
  13142. (
  13143. $ctx1.supercall = true,
  13144. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13145. $ctx1.supercall = false;
  13146. $ctx1.sendIdx["printOn:"]=1;
  13147. $recv(aStream)._nextPutAll_(" (");
  13148. $ctx1.sendIdx["nextPutAll:"]=1;
  13149. $self._do_separatedBy_((function(each){
  13150. return $core.withContext(function($ctx2) {
  13151. return $recv(each)._printOn_(aStream);
  13152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13153. }),(function(){
  13154. return $core.withContext(function($ctx2) {
  13155. return $recv(aStream)._nextPutAll_(" ");
  13156. $ctx2.sendIdx["nextPutAll:"]=2;
  13157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13158. }));
  13159. $recv(aStream)._nextPutAll_(")");
  13160. return self;
  13161. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  13162. },
  13163. args: ["aStream"],
  13164. 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: ')'",
  13165. referencedClasses: [],
  13166. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13167. }),
  13168. $globals.Set);
  13169. $core.addMethod(
  13170. $core.method({
  13171. selector: "remove:ifAbsent:",
  13172. protocol: "adding/removing",
  13173. fn: function (anObject,aBlock){
  13174. var self=this,$self=this;
  13175. var bucket;
  13176. return $core.withContext(function($ctx1) {
  13177. var $1,$2,$3,$receiver;
  13178. var $early={};
  13179. try {
  13180. bucket=$self._bucketsOfElement_(anObject);
  13181. $1=$recv(bucket)._second();
  13182. if(($receiver = $1) == null || $receiver.a$nil){
  13183. $2=$recv(bucket)._third();
  13184. $3=$recv(bucket)._first();
  13185. $ctx1.sendIdx["first"]=1;
  13186. $recv($2)._remove_ifAbsent_($3,(function(){
  13187. return $core.withContext(function($ctx2) {
  13188. throw $early=[$recv(aBlock)._value()];
  13189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13190. }));
  13191. $self["@size"]=$recv($self["@size"]).__minus((1));
  13192. return $self["@size"];
  13193. } else {
  13194. var primitiveBucket;
  13195. primitiveBucket=$receiver;
  13196. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  13197. }
  13198. }
  13199. catch(e) {if(e===$early)return e[0]; throw e}
  13200. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  13201. },
  13202. args: ["anObject", "aBlock"],
  13203. 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 ]",
  13204. referencedClasses: [],
  13205. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  13206. }),
  13207. $globals.Set);
  13208. $core.addMethod(
  13209. $core.method({
  13210. selector: "remove:in:",
  13211. protocol: "private",
  13212. fn: function (anObject,anotherObject){
  13213. var self=this,$self=this;
  13214. return $core.withContext(function($ctx1) {
  13215. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  13216. return self;
  13217. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13218. },
  13219. args: ["anObject", "anotherObject"],
  13220. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  13221. referencedClasses: [],
  13222. messageSends: []
  13223. }),
  13224. $globals.Set);
  13225. $core.addMethod(
  13226. $core.method({
  13227. selector: "removeAll",
  13228. protocol: "adding/removing",
  13229. fn: function (){
  13230. var self=this,$self=this;
  13231. return $core.withContext(function($ctx1) {
  13232. $self['@fastBuckets'] = {
  13233. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13234. "number": { store: Object.create(null), fn: Number },
  13235. "string": { store: Object.create(null) }
  13236. };
  13237. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  13238. $self['@defaultBucket']._removeAll();
  13239. $self['@size'] = 0;
  13240. ;
  13241. return self;
  13242. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  13243. },
  13244. args: [],
  13245. 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'>",
  13246. referencedClasses: [],
  13247. messageSends: []
  13248. }),
  13249. $globals.Set);
  13250. $core.addMethod(
  13251. $core.method({
  13252. selector: "select:",
  13253. protocol: "enumerating",
  13254. fn: function (aBlock){
  13255. var self=this,$self=this;
  13256. var collection;
  13257. return $core.withContext(function($ctx1) {
  13258. var $1;
  13259. collection=$recv($self._class())._new();
  13260. $self._do_((function(each){
  13261. return $core.withContext(function($ctx2) {
  13262. $1=$recv(aBlock)._value_(each);
  13263. if($core.assert($1)){
  13264. return $recv(collection)._add_(each);
  13265. }
  13266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13267. }));
  13268. return collection;
  13269. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  13270. },
  13271. args: ["aBlock"],
  13272. 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",
  13273. referencedClasses: [],
  13274. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13275. }),
  13276. $globals.Set);
  13277. $core.addMethod(
  13278. $core.method({
  13279. selector: "select:thenCollect:",
  13280. protocol: "enumerating",
  13281. fn: function (selectBlock,collectBlock){
  13282. var self=this,$self=this;
  13283. var collection;
  13284. return $core.withContext(function($ctx1) {
  13285. var $1;
  13286. collection=$recv($self._class())._new();
  13287. $self._do_((function(each){
  13288. return $core.withContext(function($ctx2) {
  13289. $1=$recv(selectBlock)._value_(each);
  13290. $ctx2.sendIdx["value:"]=1;
  13291. if($core.assert($1)){
  13292. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13293. }
  13294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13295. }));
  13296. return collection;
  13297. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  13298. },
  13299. args: ["selectBlock", "collectBlock"],
  13300. 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",
  13301. referencedClasses: [],
  13302. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13303. }),
  13304. $globals.Set);
  13305. $core.addMethod(
  13306. $core.method({
  13307. selector: "size",
  13308. protocol: "accessing",
  13309. fn: function (){
  13310. var self=this,$self=this;
  13311. return $self["@size"];
  13312. },
  13313. args: [],
  13314. source: "size\x0a\x09^ size",
  13315. referencedClasses: [],
  13316. messageSends: []
  13317. }),
  13318. $globals.Set);
  13319. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13320. $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.";
  13321. $core.addMethod(
  13322. $core.method({
  13323. selector: "<<",
  13324. protocol: "writing",
  13325. fn: function (anObject){
  13326. var self=this,$self=this;
  13327. return $core.withContext(function($ctx1) {
  13328. $self._write_(anObject);
  13329. return self;
  13330. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  13331. },
  13332. args: ["anObject"],
  13333. source: "<< anObject\x0a\x09self write: anObject",
  13334. referencedClasses: [],
  13335. messageSends: ["write:"]
  13336. }),
  13337. $globals.ProtoStream);
  13338. $core.addMethod(
  13339. $core.method({
  13340. selector: "atEnd",
  13341. protocol: "testing",
  13342. fn: function (){
  13343. var self=this,$self=this;
  13344. return $core.withContext(function($ctx1) {
  13345. $self._subclassResponsibility();
  13346. return self;
  13347. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  13348. },
  13349. args: [],
  13350. source: "atEnd\x0a\x09self subclassResponsibility",
  13351. referencedClasses: [],
  13352. messageSends: ["subclassResponsibility"]
  13353. }),
  13354. $globals.ProtoStream);
  13355. $core.addMethod(
  13356. $core.method({
  13357. selector: "atStart",
  13358. protocol: "testing",
  13359. fn: function (){
  13360. var self=this,$self=this;
  13361. return $core.withContext(function($ctx1) {
  13362. $self._subclassResponsibility();
  13363. return self;
  13364. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  13365. },
  13366. args: [],
  13367. source: "atStart\x0a\x09self subclassResponsibility",
  13368. referencedClasses: [],
  13369. messageSends: ["subclassResponsibility"]
  13370. }),
  13371. $globals.ProtoStream);
  13372. $core.addMethod(
  13373. $core.method({
  13374. selector: "contents",
  13375. protocol: "accessing",
  13376. fn: function (){
  13377. var self=this,$self=this;
  13378. return $core.withContext(function($ctx1) {
  13379. $self._subclassResponsibility();
  13380. return self;
  13381. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  13382. },
  13383. args: [],
  13384. source: "contents\x0a\x09self subclassResponsibility",
  13385. referencedClasses: [],
  13386. messageSends: ["subclassResponsibility"]
  13387. }),
  13388. $globals.ProtoStream);
  13389. $core.addMethod(
  13390. $core.method({
  13391. selector: "do:",
  13392. protocol: "enumerating",
  13393. fn: function (aBlock){
  13394. var self=this,$self=this;
  13395. return $core.withContext(function($ctx1) {
  13396. $recv((function(){
  13397. return $core.withContext(function($ctx2) {
  13398. return $self._atEnd();
  13399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13400. }))._whileFalse_((function(){
  13401. return $core.withContext(function($ctx2) {
  13402. return $recv(aBlock)._value_($self._next());
  13403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13404. }));
  13405. return self;
  13406. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  13407. },
  13408. args: ["aBlock"],
  13409. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13410. referencedClasses: [],
  13411. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13412. }),
  13413. $globals.ProtoStream);
  13414. $core.addMethod(
  13415. $core.method({
  13416. selector: "isEmpty",
  13417. protocol: "testing",
  13418. fn: function (){
  13419. var self=this,$self=this;
  13420. return $core.withContext(function($ctx1) {
  13421. return $recv($self._atStart())._and_((function(){
  13422. return $core.withContext(function($ctx2) {
  13423. return $self._atEnd();
  13424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13425. }));
  13426. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  13427. },
  13428. args: [],
  13429. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13430. referencedClasses: [],
  13431. messageSends: ["and:", "atStart", "atEnd"]
  13432. }),
  13433. $globals.ProtoStream);
  13434. $core.addMethod(
  13435. $core.method({
  13436. selector: "next",
  13437. protocol: "reading",
  13438. fn: function (){
  13439. var self=this,$self=this;
  13440. return $core.withContext(function($ctx1) {
  13441. var $1;
  13442. $1=$self._atEnd();
  13443. if($core.assert($1)){
  13444. return nil;
  13445. } else {
  13446. return $self._subclassResponsibility();
  13447. }
  13448. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  13449. },
  13450. args: [],
  13451. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13452. referencedClasses: [],
  13453. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13454. }),
  13455. $globals.ProtoStream);
  13456. $core.addMethod(
  13457. $core.method({
  13458. selector: "nextPut:",
  13459. protocol: "writing",
  13460. fn: function (anObject){
  13461. var self=this,$self=this;
  13462. return $core.withContext(function($ctx1) {
  13463. $self._subclassResponsibility();
  13464. return self;
  13465. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  13466. },
  13467. args: ["anObject"],
  13468. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13469. referencedClasses: [],
  13470. messageSends: ["subclassResponsibility"]
  13471. }),
  13472. $globals.ProtoStream);
  13473. $core.addMethod(
  13474. $core.method({
  13475. selector: "nextPutAll:",
  13476. protocol: "writing",
  13477. fn: function (aCollection){
  13478. var self=this,$self=this;
  13479. return $core.withContext(function($ctx1) {
  13480. $recv(aCollection)._do_((function(each){
  13481. return $core.withContext(function($ctx2) {
  13482. return $self._nextPut_(each);
  13483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13484. }));
  13485. return self;
  13486. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  13487. },
  13488. args: ["aCollection"],
  13489. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13490. referencedClasses: [],
  13491. messageSends: ["do:", "nextPut:"]
  13492. }),
  13493. $globals.ProtoStream);
  13494. $core.addMethod(
  13495. $core.method({
  13496. selector: "nextPutString:",
  13497. protocol: "writing",
  13498. fn: function (aString){
  13499. var self=this,$self=this;
  13500. return $core.withContext(function($ctx1) {
  13501. $self._nextPut_(aString);
  13502. return self;
  13503. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13504. },
  13505. args: ["aString"],
  13506. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13507. referencedClasses: [],
  13508. messageSends: ["nextPut:"]
  13509. }),
  13510. $globals.ProtoStream);
  13511. $core.addMethod(
  13512. $core.method({
  13513. selector: "peek",
  13514. protocol: "reading",
  13515. fn: function (){
  13516. var self=this,$self=this;
  13517. return $core.withContext(function($ctx1) {
  13518. var $1;
  13519. $1=$self._atEnd();
  13520. if($core.assert($1)){
  13521. return nil;
  13522. } else {
  13523. return $self._subclassResponsibility();
  13524. }
  13525. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13526. },
  13527. args: [],
  13528. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13529. referencedClasses: [],
  13530. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13531. }),
  13532. $globals.ProtoStream);
  13533. $core.addMethod(
  13534. $core.method({
  13535. selector: "reset",
  13536. protocol: "actions",
  13537. fn: function (){
  13538. var self=this,$self=this;
  13539. return $core.withContext(function($ctx1) {
  13540. $self._subclassResponsibility();
  13541. return self;
  13542. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  13543. },
  13544. args: [],
  13545. source: "reset\x0a\x09self subclassResponsibility",
  13546. referencedClasses: [],
  13547. messageSends: ["subclassResponsibility"]
  13548. }),
  13549. $globals.ProtoStream);
  13550. $core.addMethod(
  13551. $core.method({
  13552. selector: "resetContents",
  13553. protocol: "actions",
  13554. fn: function (){
  13555. var self=this,$self=this;
  13556. return $core.withContext(function($ctx1) {
  13557. $self._subclassResponsibility();
  13558. return self;
  13559. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13560. },
  13561. args: [],
  13562. source: "resetContents\x0a\x09self subclassResponsibility",
  13563. referencedClasses: [],
  13564. messageSends: ["subclassResponsibility"]
  13565. }),
  13566. $globals.ProtoStream);
  13567. $core.addMethod(
  13568. $core.method({
  13569. selector: "setToEnd",
  13570. protocol: "positioning",
  13571. fn: function (){
  13572. var self=this,$self=this;
  13573. return $core.withContext(function($ctx1) {
  13574. $self._subclassResponsibility();
  13575. return self;
  13576. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13577. },
  13578. args: [],
  13579. source: "setToEnd\x0a\x09self subclassResponsibility",
  13580. referencedClasses: [],
  13581. messageSends: ["subclassResponsibility"]
  13582. }),
  13583. $globals.ProtoStream);
  13584. $core.addMethod(
  13585. $core.method({
  13586. selector: "setToStart",
  13587. protocol: "positioning",
  13588. fn: function (){
  13589. var self=this,$self=this;
  13590. return $core.withContext(function($ctx1) {
  13591. $self._reset();
  13592. return self;
  13593. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13594. },
  13595. args: [],
  13596. source: "setToStart\x0a\x09self reset",
  13597. referencedClasses: [],
  13598. messageSends: ["reset"]
  13599. }),
  13600. $globals.ProtoStream);
  13601. $core.addMethod(
  13602. $core.method({
  13603. selector: "write:",
  13604. protocol: "writing",
  13605. fn: function (anObject){
  13606. var self=this,$self=this;
  13607. return $core.withContext(function($ctx1) {
  13608. $recv(anObject)._putOn_(self);
  13609. return self;
  13610. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13611. },
  13612. args: ["anObject"],
  13613. source: "write: anObject\x0a\x09anObject putOn: self",
  13614. referencedClasses: [],
  13615. messageSends: ["putOn:"]
  13616. }),
  13617. $globals.ProtoStream);
  13618. $core.addMethod(
  13619. $core.method({
  13620. selector: "on:",
  13621. protocol: "instance creation",
  13622. fn: function (aCollection){
  13623. var self=this,$self=this;
  13624. return $core.withContext(function($ctx1) {
  13625. var $1;
  13626. $1=$self._new();
  13627. $recv($1)._setCollection_(aCollection);
  13628. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13629. return $recv($1)._yourself();
  13630. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13631. },
  13632. args: ["aCollection"],
  13633. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13634. referencedClasses: [],
  13635. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13636. }),
  13637. $globals.ProtoStream.a$cls);
  13638. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13639. $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.";
  13640. $core.addMethod(
  13641. $core.method({
  13642. selector: "atEnd",
  13643. protocol: "testing",
  13644. fn: function (){
  13645. var self=this,$self=this;
  13646. return $core.withContext(function($ctx1) {
  13647. return $recv($self._position()).__eq($self._size());
  13648. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13649. },
  13650. args: [],
  13651. source: "atEnd\x0a\x09^ self position = self size",
  13652. referencedClasses: [],
  13653. messageSends: ["=", "position", "size"]
  13654. }),
  13655. $globals.Stream);
  13656. $core.addMethod(
  13657. $core.method({
  13658. selector: "atStart",
  13659. protocol: "testing",
  13660. fn: function (){
  13661. var self=this,$self=this;
  13662. return $core.withContext(function($ctx1) {
  13663. return $recv($self._position()).__eq((0));
  13664. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13665. },
  13666. args: [],
  13667. source: "atStart\x0a\x09^ self position = 0",
  13668. referencedClasses: [],
  13669. messageSends: ["=", "position"]
  13670. }),
  13671. $globals.Stream);
  13672. $core.addMethod(
  13673. $core.method({
  13674. selector: "close",
  13675. protocol: "actions",
  13676. fn: function (){
  13677. var self=this,$self=this;
  13678. return self;
  13679. },
  13680. args: [],
  13681. source: "close",
  13682. referencedClasses: [],
  13683. messageSends: []
  13684. }),
  13685. $globals.Stream);
  13686. $core.addMethod(
  13687. $core.method({
  13688. selector: "collection",
  13689. protocol: "accessing",
  13690. fn: function (){
  13691. var self=this,$self=this;
  13692. return $self["@collection"];
  13693. },
  13694. args: [],
  13695. source: "collection\x0a\x09^ collection",
  13696. referencedClasses: [],
  13697. messageSends: []
  13698. }),
  13699. $globals.Stream);
  13700. $core.addMethod(
  13701. $core.method({
  13702. selector: "contents",
  13703. protocol: "accessing",
  13704. fn: function (){
  13705. var self=this,$self=this;
  13706. return $core.withContext(function($ctx1) {
  13707. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13708. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13709. },
  13710. args: [],
  13711. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13712. referencedClasses: [],
  13713. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13714. }),
  13715. $globals.Stream);
  13716. $core.addMethod(
  13717. $core.method({
  13718. selector: "flush",
  13719. protocol: "actions",
  13720. fn: function (){
  13721. var self=this,$self=this;
  13722. return self;
  13723. },
  13724. args: [],
  13725. source: "flush",
  13726. referencedClasses: [],
  13727. messageSends: []
  13728. }),
  13729. $globals.Stream);
  13730. $core.addMethod(
  13731. $core.method({
  13732. selector: "isEmpty",
  13733. protocol: "testing",
  13734. fn: function (){
  13735. var self=this,$self=this;
  13736. return $core.withContext(function($ctx1) {
  13737. return $recv($self._size()).__eq((0));
  13738. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13739. },
  13740. args: [],
  13741. source: "isEmpty\x0a\x09^ self size = 0",
  13742. referencedClasses: [],
  13743. messageSends: ["=", "size"]
  13744. }),
  13745. $globals.Stream);
  13746. $core.addMethod(
  13747. $core.method({
  13748. selector: "next",
  13749. protocol: "reading",
  13750. fn: function (){
  13751. var self=this,$self=this;
  13752. return $core.withContext(function($ctx1) {
  13753. var $1,$3,$2;
  13754. $1=$self._atEnd();
  13755. if($core.assert($1)){
  13756. return nil;
  13757. } else {
  13758. $3=$self._position();
  13759. $ctx1.sendIdx["position"]=1;
  13760. $2=$recv($3).__plus((1));
  13761. $self._position_($2);
  13762. return $recv($self["@collection"])._at_($self._position());
  13763. }
  13764. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13765. },
  13766. args: [],
  13767. 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 ]",
  13768. referencedClasses: [],
  13769. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13770. }),
  13771. $globals.Stream);
  13772. $core.addMethod(
  13773. $core.method({
  13774. selector: "next:",
  13775. protocol: "reading",
  13776. fn: function (anInteger){
  13777. var self=this,$self=this;
  13778. var tempCollection;
  13779. return $core.withContext(function($ctx1) {
  13780. var $1;
  13781. tempCollection=$recv($recv($self._collection())._class())._new();
  13782. $recv(anInteger)._timesRepeat_((function(){
  13783. return $core.withContext(function($ctx2) {
  13784. $1=$self._atEnd();
  13785. if(!$core.assert($1)){
  13786. return $recv(tempCollection)._add_($self._next());
  13787. }
  13788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13789. }));
  13790. return tempCollection;
  13791. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13792. },
  13793. args: ["anInteger"],
  13794. 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",
  13795. referencedClasses: [],
  13796. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13797. }),
  13798. $globals.Stream);
  13799. $core.addMethod(
  13800. $core.method({
  13801. selector: "nextPut:",
  13802. protocol: "writing",
  13803. fn: function (anObject){
  13804. var self=this,$self=this;
  13805. return $core.withContext(function($ctx1) {
  13806. var $2,$1,$3,$4;
  13807. $2=$self._position();
  13808. $ctx1.sendIdx["position"]=1;
  13809. $1=$recv($2).__plus((1));
  13810. $self._position_($1);
  13811. $3=$self._collection();
  13812. $4=$self._position();
  13813. $ctx1.sendIdx["position"]=2;
  13814. $recv($3)._at_put_($4,anObject);
  13815. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13816. return self;
  13817. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13818. },
  13819. args: ["anObject"],
  13820. 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)",
  13821. referencedClasses: [],
  13822. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13823. }),
  13824. $globals.Stream);
  13825. $core.addMethod(
  13826. $core.method({
  13827. selector: "peek",
  13828. protocol: "reading",
  13829. fn: function (){
  13830. var self=this,$self=this;
  13831. return $core.withContext(function($ctx1) {
  13832. var $1;
  13833. $1=$self._atEnd();
  13834. if(!$core.assert($1)){
  13835. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13836. }
  13837. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13838. },
  13839. args: [],
  13840. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13841. referencedClasses: [],
  13842. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13843. }),
  13844. $globals.Stream);
  13845. $core.addMethod(
  13846. $core.method({
  13847. selector: "position",
  13848. protocol: "accessing",
  13849. fn: function (){
  13850. var self=this,$self=this;
  13851. return $core.withContext(function($ctx1) {
  13852. var $1,$receiver;
  13853. $1=$self["@position"];
  13854. if(($receiver = $1) == null || $receiver.a$nil){
  13855. $self["@position"]=(0);
  13856. return $self["@position"];
  13857. } else {
  13858. return $1;
  13859. }
  13860. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13861. },
  13862. args: [],
  13863. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13864. referencedClasses: [],
  13865. messageSends: ["ifNil:"]
  13866. }),
  13867. $globals.Stream);
  13868. $core.addMethod(
  13869. $core.method({
  13870. selector: "position:",
  13871. protocol: "accessing",
  13872. fn: function (anInteger){
  13873. var self=this,$self=this;
  13874. $self["@position"]=anInteger;
  13875. return self;
  13876. },
  13877. args: ["anInteger"],
  13878. source: "position: anInteger\x0a\x09position := anInteger",
  13879. referencedClasses: [],
  13880. messageSends: []
  13881. }),
  13882. $globals.Stream);
  13883. $core.addMethod(
  13884. $core.method({
  13885. selector: "reset",
  13886. protocol: "actions",
  13887. fn: function (){
  13888. var self=this,$self=this;
  13889. return $core.withContext(function($ctx1) {
  13890. $self._position_((0));
  13891. return self;
  13892. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13893. },
  13894. args: [],
  13895. source: "reset\x0a\x09self position: 0",
  13896. referencedClasses: [],
  13897. messageSends: ["position:"]
  13898. }),
  13899. $globals.Stream);
  13900. $core.addMethod(
  13901. $core.method({
  13902. selector: "resetContents",
  13903. protocol: "actions",
  13904. fn: function (){
  13905. var self=this,$self=this;
  13906. return $core.withContext(function($ctx1) {
  13907. $self._reset();
  13908. $self._setStreamSize_((0));
  13909. return self;
  13910. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13911. },
  13912. args: [],
  13913. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13914. referencedClasses: [],
  13915. messageSends: ["reset", "setStreamSize:"]
  13916. }),
  13917. $globals.Stream);
  13918. $core.addMethod(
  13919. $core.method({
  13920. selector: "setCollection:",
  13921. protocol: "accessing",
  13922. fn: function (aCollection){
  13923. var self=this,$self=this;
  13924. $self["@collection"]=aCollection;
  13925. return self;
  13926. },
  13927. args: ["aCollection"],
  13928. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13929. referencedClasses: [],
  13930. messageSends: []
  13931. }),
  13932. $globals.Stream);
  13933. $core.addMethod(
  13934. $core.method({
  13935. selector: "setStreamSize:",
  13936. protocol: "accessing",
  13937. fn: function (anInteger){
  13938. var self=this,$self=this;
  13939. $self["@streamSize"]=anInteger;
  13940. return self;
  13941. },
  13942. args: ["anInteger"],
  13943. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13944. referencedClasses: [],
  13945. messageSends: []
  13946. }),
  13947. $globals.Stream);
  13948. $core.addMethod(
  13949. $core.method({
  13950. selector: "setToEnd",
  13951. protocol: "positioning",
  13952. fn: function (){
  13953. var self=this,$self=this;
  13954. return $core.withContext(function($ctx1) {
  13955. $self._position_($self._size());
  13956. return self;
  13957. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13958. },
  13959. args: [],
  13960. source: "setToEnd\x0a\x09self position: self size",
  13961. referencedClasses: [],
  13962. messageSends: ["position:", "size"]
  13963. }),
  13964. $globals.Stream);
  13965. $core.addMethod(
  13966. $core.method({
  13967. selector: "size",
  13968. protocol: "accessing",
  13969. fn: function (){
  13970. var self=this,$self=this;
  13971. return $core.withContext(function($ctx1) {
  13972. return $self._streamSize();
  13973. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13974. },
  13975. args: [],
  13976. source: "size\x0a\x09^ self streamSize",
  13977. referencedClasses: [],
  13978. messageSends: ["streamSize"]
  13979. }),
  13980. $globals.Stream);
  13981. $core.addMethod(
  13982. $core.method({
  13983. selector: "skip:",
  13984. protocol: "positioning",
  13985. fn: function (anInteger){
  13986. var self=this,$self=this;
  13987. return $core.withContext(function($ctx1) {
  13988. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13989. return self;
  13990. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13991. },
  13992. args: ["anInteger"],
  13993. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13994. referencedClasses: [],
  13995. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13996. }),
  13997. $globals.Stream);
  13998. $core.addMethod(
  13999. $core.method({
  14000. selector: "streamSize",
  14001. protocol: "accessing",
  14002. fn: function (){
  14003. var self=this,$self=this;
  14004. return $self["@streamSize"];
  14005. },
  14006. args: [],
  14007. source: "streamSize\x0a\x09^ streamSize",
  14008. referencedClasses: [],
  14009. messageSends: []
  14010. }),
  14011. $globals.Stream);
  14012. $core.addMethod(
  14013. $core.method({
  14014. selector: "on:",
  14015. protocol: "instance creation",
  14016. fn: function (aCollection){
  14017. var self=this,$self=this;
  14018. return $core.withContext(function($ctx1) {
  14019. var $1;
  14020. $1=$self._new();
  14021. $recv($1)._setCollection_(aCollection);
  14022. $recv($1)._setStreamSize_($recv(aCollection)._size());
  14023. return $recv($1)._yourself();
  14024. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  14025. },
  14026. args: ["aCollection"],
  14027. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  14028. referencedClasses: [],
  14029. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  14030. }),
  14031. $globals.Stream.a$cls);
  14032. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  14033. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  14034. $core.addMethod(
  14035. $core.method({
  14036. selector: "cr",
  14037. protocol: "writing",
  14038. fn: function (){
  14039. var self=this,$self=this;
  14040. return $core.withContext(function($ctx1) {
  14041. return $self._nextPutAll_($recv($globals.String)._cr());
  14042. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  14043. },
  14044. args: [],
  14045. source: "cr\x0a\x09^ self nextPutAll: String cr",
  14046. referencedClasses: ["String"],
  14047. messageSends: ["nextPutAll:", "cr"]
  14048. }),
  14049. $globals.StringStream);
  14050. $core.addMethod(
  14051. $core.method({
  14052. selector: "crlf",
  14053. protocol: "writing",
  14054. fn: function (){
  14055. var self=this,$self=this;
  14056. return $core.withContext(function($ctx1) {
  14057. return $self._nextPutAll_($recv($globals.String)._crlf());
  14058. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  14059. },
  14060. args: [],
  14061. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  14062. referencedClasses: ["String"],
  14063. messageSends: ["nextPutAll:", "crlf"]
  14064. }),
  14065. $globals.StringStream);
  14066. $core.addMethod(
  14067. $core.method({
  14068. selector: "lf",
  14069. protocol: "writing",
  14070. fn: function (){
  14071. var self=this,$self=this;
  14072. return $core.withContext(function($ctx1) {
  14073. return $self._nextPutAll_($recv($globals.String)._lf());
  14074. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  14075. },
  14076. args: [],
  14077. source: "lf\x0a\x09^ self nextPutAll: String lf",
  14078. referencedClasses: ["String"],
  14079. messageSends: ["nextPutAll:", "lf"]
  14080. }),
  14081. $globals.StringStream);
  14082. $core.addMethod(
  14083. $core.method({
  14084. selector: "next:",
  14085. protocol: "reading",
  14086. fn: function (anInteger){
  14087. var self=this,$self=this;
  14088. var tempCollection;
  14089. return $core.withContext(function($ctx1) {
  14090. var $1;
  14091. tempCollection=$recv($recv($self._collection())._class())._new();
  14092. $recv(anInteger)._timesRepeat_((function(){
  14093. return $core.withContext(function($ctx2) {
  14094. $1=$self._atEnd();
  14095. if(!$core.assert($1)){
  14096. tempCollection=$recv(tempCollection).__comma($self._next());
  14097. return tempCollection;
  14098. }
  14099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14100. }));
  14101. return tempCollection;
  14102. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  14103. },
  14104. args: ["anInteger"],
  14105. 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",
  14106. referencedClasses: [],
  14107. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14108. }),
  14109. $globals.StringStream);
  14110. $core.addMethod(
  14111. $core.method({
  14112. selector: "nextPut:",
  14113. protocol: "writing",
  14114. fn: function (aString){
  14115. var self=this,$self=this;
  14116. return $core.withContext(function($ctx1) {
  14117. $self._nextPutAll_(aString);
  14118. return self;
  14119. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  14120. },
  14121. args: ["aString"],
  14122. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14123. referencedClasses: [],
  14124. messageSends: ["nextPutAll:"]
  14125. }),
  14126. $globals.StringStream);
  14127. $core.addMethod(
  14128. $core.method({
  14129. selector: "nextPutAll:",
  14130. protocol: "writing",
  14131. fn: function (aString){
  14132. var self=this,$self=this;
  14133. var pre,post;
  14134. return $core.withContext(function($ctx1) {
  14135. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  14136. $1=$self._atEnd();
  14137. if($core.assert($1)){
  14138. $3=$self._collection();
  14139. $ctx1.sendIdx["collection"]=1;
  14140. $2=$recv($3).__comma(aString);
  14141. $ctx1.sendIdx[","]=1;
  14142. $self._setCollection_($2);
  14143. $ctx1.sendIdx["setCollection:"]=1;
  14144. } else {
  14145. $4=$self._collection();
  14146. $ctx1.sendIdx["collection"]=2;
  14147. $5=$self._position();
  14148. $ctx1.sendIdx["position"]=1;
  14149. pre=$recv($4)._copyFrom_to_((1),$5);
  14150. $ctx1.sendIdx["copyFrom:to:"]=1;
  14151. pre;
  14152. $6=$self._collection();
  14153. $ctx1.sendIdx["collection"]=3;
  14154. $9=$self._position();
  14155. $ctx1.sendIdx["position"]=2;
  14156. $8=$recv($9).__plus((1));
  14157. $ctx1.sendIdx["+"]=2;
  14158. $10=$recv(aString)._size();
  14159. $ctx1.sendIdx["size"]=1;
  14160. $7=$recv($8).__plus($10);
  14161. $ctx1.sendIdx["+"]=1;
  14162. $11=$recv($self._collection())._size();
  14163. $ctx1.sendIdx["size"]=2;
  14164. post=$recv($6)._copyFrom_to_($7,$11);
  14165. post;
  14166. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  14167. $ctx1.sendIdx[","]=2;
  14168. $self._setCollection_($12);
  14169. }
  14170. $14=$self._position();
  14171. $ctx1.sendIdx["position"]=3;
  14172. $13=$recv($14).__plus($recv(aString)._size());
  14173. $self._position_($13);
  14174. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14175. return self;
  14176. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  14177. },
  14178. args: ["aString"],
  14179. 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)",
  14180. referencedClasses: [],
  14181. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  14182. }),
  14183. $globals.StringStream);
  14184. $core.addMethod(
  14185. $core.method({
  14186. selector: "nextPutString:",
  14187. protocol: "writing",
  14188. fn: function (aString){
  14189. var self=this,$self=this;
  14190. return $core.withContext(function($ctx1) {
  14191. $self._nextPutAll_(aString);
  14192. return self;
  14193. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  14194. },
  14195. args: ["aString"],
  14196. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14197. referencedClasses: [],
  14198. messageSends: ["nextPutAll:"]
  14199. }),
  14200. $globals.StringStream);
  14201. $core.addMethod(
  14202. $core.method({
  14203. selector: "print:",
  14204. protocol: "writing",
  14205. fn: function (anObject){
  14206. var self=this,$self=this;
  14207. return $core.withContext(function($ctx1) {
  14208. $recv(anObject)._printOn_(self);
  14209. return self;
  14210. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  14211. },
  14212. args: ["anObject"],
  14213. source: "print: anObject\x0a\x09anObject printOn: self",
  14214. referencedClasses: [],
  14215. messageSends: ["printOn:"]
  14216. }),
  14217. $globals.StringStream);
  14218. $core.addMethod(
  14219. $core.method({
  14220. selector: "printSymbol:",
  14221. protocol: "writing",
  14222. fn: function (anObject){
  14223. var self=this,$self=this;
  14224. return $core.withContext(function($ctx1) {
  14225. $recv(anObject)._asSymbolPrintOn_(self);
  14226. return self;
  14227. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  14228. },
  14229. args: ["anObject"],
  14230. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14231. referencedClasses: [],
  14232. messageSends: ["asSymbolPrintOn:"]
  14233. }),
  14234. $globals.StringStream);
  14235. $core.addMethod(
  14236. $core.method({
  14237. selector: "space",
  14238. protocol: "writing",
  14239. fn: function (){
  14240. var self=this,$self=this;
  14241. return $core.withContext(function($ctx1) {
  14242. $self._nextPut_(" ");
  14243. return self;
  14244. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  14245. },
  14246. args: [],
  14247. source: "space\x0a\x09self nextPut: ' '",
  14248. referencedClasses: [],
  14249. messageSends: ["nextPut:"]
  14250. }),
  14251. $globals.StringStream);
  14252. $core.addMethod(
  14253. $core.method({
  14254. selector: "tab",
  14255. protocol: "writing",
  14256. fn: function (){
  14257. var self=this,$self=this;
  14258. return $core.withContext(function($ctx1) {
  14259. return $self._nextPutAll_($recv($globals.String)._tab());
  14260. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  14261. },
  14262. args: [],
  14263. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14264. referencedClasses: ["String"],
  14265. messageSends: ["nextPutAll:", "tab"]
  14266. }),
  14267. $globals.StringStream);
  14268. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14269. $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.";
  14270. $core.addMethod(
  14271. $core.method({
  14272. selector: "initialize",
  14273. protocol: "initialization",
  14274. fn: function (){
  14275. var self=this,$self=this;
  14276. return $core.withContext(function($ctx1) {
  14277. (
  14278. $ctx1.supercall = true,
  14279. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14280. $ctx1.supercall = false;
  14281. $self["@read"]=$recv($globals.OrderedCollection)._new();
  14282. $ctx1.sendIdx["new"]=1;
  14283. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14284. $self["@readIndex"]=(1);
  14285. return self;
  14286. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  14287. },
  14288. args: [],
  14289. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14290. referencedClasses: ["OrderedCollection"],
  14291. messageSends: ["initialize", "new"]
  14292. }),
  14293. $globals.Queue);
  14294. $core.addMethod(
  14295. $core.method({
  14296. selector: "next",
  14297. protocol: "accessing",
  14298. fn: function (){
  14299. var self=this,$self=this;
  14300. return $core.withContext(function($ctx1) {
  14301. return $self._nextIfAbsent_((function(){
  14302. return $core.withContext(function($ctx2) {
  14303. return $self._error_("Cannot read from empty Queue.");
  14304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14305. }));
  14306. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  14307. },
  14308. args: [],
  14309. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14310. referencedClasses: [],
  14311. messageSends: ["nextIfAbsent:", "error:"]
  14312. }),
  14313. $globals.Queue);
  14314. $core.addMethod(
  14315. $core.method({
  14316. selector: "nextIfAbsent:",
  14317. protocol: "accessing",
  14318. fn: function (aBlock){
  14319. var self=this,$self=this;
  14320. var result;
  14321. return $core.withContext(function($ctx1) {
  14322. var $1;
  14323. var $early={};
  14324. try {
  14325. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  14326. return $core.withContext(function($ctx2) {
  14327. $recv($self["@write"])._ifEmpty_((function(){
  14328. return $core.withContext(function($ctx3) {
  14329. $1=$recv($self["@readIndex"]).__gt((1));
  14330. if($core.assert($1)){
  14331. $self["@read"]=[];
  14332. $self["@read"];
  14333. $self["@readIndex"]=(1);
  14334. $self["@readIndex"];
  14335. }
  14336. throw $early=[$recv(aBlock)._value()];
  14337. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14338. }));
  14339. $self["@read"]=$self["@write"];
  14340. $self["@read"];
  14341. $self["@readIndex"]=(1);
  14342. $self["@readIndex"];
  14343. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14344. $self["@write"];
  14345. return $recv($self["@read"])._first();
  14346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14347. }));
  14348. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  14349. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  14350. return result;
  14351. }
  14352. catch(e) {if(e===$early)return e[0]; throw e}
  14353. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  14354. },
  14355. args: ["aBlock"],
  14356. 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",
  14357. referencedClasses: ["OrderedCollection"],
  14358. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14359. }),
  14360. $globals.Queue);
  14361. $core.addMethod(
  14362. $core.method({
  14363. selector: "nextPut:",
  14364. protocol: "accessing",
  14365. fn: function (anObject){
  14366. var self=this,$self=this;
  14367. return $core.withContext(function($ctx1) {
  14368. $recv($self["@write"])._add_(anObject);
  14369. return self;
  14370. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  14371. },
  14372. args: ["anObject"],
  14373. source: "nextPut: anObject\x0a\x09write add: anObject",
  14374. referencedClasses: [],
  14375. messageSends: ["add:"]
  14376. }),
  14377. $globals.Queue);
  14378. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14379. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14380. $core.addMethod(
  14381. $core.method({
  14382. selector: "compile:",
  14383. protocol: "evaluating",
  14384. fn: function (aString){
  14385. var self=this,$self=this;
  14386. return $core.withContext(function($ctx1) {
  14387. return self.compile(aString);
  14388. return self;
  14389. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  14390. },
  14391. args: ["aString"],
  14392. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14393. referencedClasses: [],
  14394. messageSends: []
  14395. }),
  14396. $globals.RegularExpression);
  14397. $core.addMethod(
  14398. $core.method({
  14399. selector: "exec:",
  14400. protocol: "evaluating",
  14401. fn: function (aString){
  14402. var self=this,$self=this;
  14403. return $core.withContext(function($ctx1) {
  14404. return self.exec(aString) || nil;
  14405. return self;
  14406. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  14407. },
  14408. args: ["aString"],
  14409. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14410. referencedClasses: [],
  14411. messageSends: []
  14412. }),
  14413. $globals.RegularExpression);
  14414. $core.addMethod(
  14415. $core.method({
  14416. selector: "test:",
  14417. protocol: "evaluating",
  14418. fn: function (aString){
  14419. var self=this,$self=this;
  14420. return $core.withContext(function($ctx1) {
  14421. return self.test(aString);
  14422. return self;
  14423. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  14424. },
  14425. args: ["aString"],
  14426. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14427. referencedClasses: [],
  14428. messageSends: []
  14429. }),
  14430. $globals.RegularExpression);
  14431. $core.addMethod(
  14432. $core.method({
  14433. selector: "fromString:",
  14434. protocol: "instance creation",
  14435. fn: function (aString){
  14436. var self=this,$self=this;
  14437. return $core.withContext(function($ctx1) {
  14438. return $self._fromString_flag_(aString,"");
  14439. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  14440. },
  14441. args: ["aString"],
  14442. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14443. referencedClasses: [],
  14444. messageSends: ["fromString:flag:"]
  14445. }),
  14446. $globals.RegularExpression.a$cls);
  14447. $core.addMethod(
  14448. $core.method({
  14449. selector: "fromString:flag:",
  14450. protocol: "instance creation",
  14451. fn: function (aString,anotherString){
  14452. var self=this,$self=this;
  14453. return $core.withContext(function($ctx1) {
  14454. return new RegExp(aString, anotherString);
  14455. return self;
  14456. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  14457. },
  14458. args: ["aString", "anotherString"],
  14459. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14460. referencedClasses: [],
  14461. messageSends: []
  14462. }),
  14463. $globals.RegularExpression.a$cls);
  14464. });
  14465. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14466. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14467. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14468. $core.addPackage("Kernel-Classes");
  14469. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14470. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14471. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14472. $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.";
  14473. $core.addMethod(
  14474. $core.method({
  14475. selector: "allInstanceVariableNames",
  14476. protocol: "accessing",
  14477. fn: function (){
  14478. var self=this,$self=this;
  14479. var result;
  14480. return $core.withContext(function($ctx1) {
  14481. var $1,$receiver;
  14482. result=$recv($self._instanceVariableNames())._copy();
  14483. $1=$self._superclass();
  14484. $ctx1.sendIdx["superclass"]=1;
  14485. if(($receiver = $1) == null || $receiver.a$nil){
  14486. $1;
  14487. } else {
  14488. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14489. }
  14490. return result;
  14491. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14492. },
  14493. args: [],
  14494. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14495. referencedClasses: [],
  14496. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14497. }),
  14498. $globals.Behavior);
  14499. $core.addMethod(
  14500. $core.method({
  14501. selector: "allSelectors",
  14502. protocol: "accessing",
  14503. fn: function (){
  14504. var self=this,$self=this;
  14505. return $core.withContext(function($ctx1) {
  14506. var $1,$2;
  14507. $1=$self._allSuperclasses();
  14508. $2=$self._selectors();
  14509. $ctx1.sendIdx["selectors"]=1;
  14510. return $recv($1)._inject_into_($2,(function(acc,each){
  14511. return $core.withContext(function($ctx2) {
  14512. $recv(acc)._addAll_($recv(each)._selectors());
  14513. return $recv(acc)._yourself();
  14514. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14515. }));
  14516. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14517. },
  14518. args: [],
  14519. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14520. referencedClasses: [],
  14521. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14522. }),
  14523. $globals.Behavior);
  14524. $core.addMethod(
  14525. $core.method({
  14526. selector: "allSubclasses",
  14527. protocol: "accessing",
  14528. fn: function (){
  14529. var self=this,$self=this;
  14530. return $core.withContext(function($ctx1) {
  14531. return $recv($globals.Array)._streamContents_((function(str){
  14532. return $core.withContext(function($ctx2) {
  14533. return $self._allSubclassesDo_((function(each){
  14534. return $core.withContext(function($ctx3) {
  14535. return $recv(str)._nextPut_(each);
  14536. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14537. }));
  14538. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14539. }));
  14540. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14541. },
  14542. args: [],
  14543. 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 ] ]",
  14544. referencedClasses: ["Array"],
  14545. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14546. }),
  14547. $globals.Behavior);
  14548. $core.addMethod(
  14549. $core.method({
  14550. selector: "allSubclassesDo:",
  14551. protocol: "enumerating",
  14552. fn: function (aBlock){
  14553. var self=this,$self=this;
  14554. return $core.withContext(function($ctx1) {
  14555. $core.traverseClassTree(self, function(subclass) {
  14556. if (subclass !== self) aBlock._value_(subclass);
  14557. });
  14558. return self;
  14559. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14560. },
  14561. args: ["aBlock"],
  14562. 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})'>",
  14563. referencedClasses: [],
  14564. messageSends: []
  14565. }),
  14566. $globals.Behavior);
  14567. $core.addMethod(
  14568. $core.method({
  14569. selector: "allSuperclasses",
  14570. protocol: "accessing",
  14571. fn: function (){
  14572. var self=this,$self=this;
  14573. return $core.withContext(function($ctx1) {
  14574. var $1,$3,$2,$receiver;
  14575. $1=$self._superclass();
  14576. $ctx1.sendIdx["superclass"]=1;
  14577. if(($receiver = $1) == null || $receiver.a$nil){
  14578. return [];
  14579. } else {
  14580. $1;
  14581. }
  14582. $3=$self._superclass();
  14583. $ctx1.sendIdx["superclass"]=2;
  14584. $2=$recv($globals.OrderedCollection)._with_($3);
  14585. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14586. return $recv($2)._yourself();
  14587. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14588. },
  14589. args: [],
  14590. 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",
  14591. referencedClasses: ["OrderedCollection"],
  14592. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14593. }),
  14594. $globals.Behavior);
  14595. $core.addMethod(
  14596. $core.method({
  14597. selector: "basicNew",
  14598. protocol: "instance creation",
  14599. fn: function (){
  14600. var self=this,$self=this;
  14601. return $core.withContext(function($ctx1) {
  14602. return new self.fn();
  14603. return self;
  14604. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14605. },
  14606. args: [],
  14607. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14608. referencedClasses: [],
  14609. messageSends: []
  14610. }),
  14611. $globals.Behavior);
  14612. $core.addMethod(
  14613. $core.method({
  14614. selector: "basicOrganization",
  14615. protocol: "accessing",
  14616. fn: function (){
  14617. var self=this,$self=this;
  14618. return $self["@organization"];
  14619. },
  14620. args: [],
  14621. source: "basicOrganization\x0a\x09^ organization",
  14622. referencedClasses: [],
  14623. messageSends: []
  14624. }),
  14625. $globals.Behavior);
  14626. $core.addMethod(
  14627. $core.method({
  14628. selector: "basicOrganization:",
  14629. protocol: "accessing",
  14630. fn: function (aClassOrganizer){
  14631. var self=this,$self=this;
  14632. $self["@organization"]=aClassOrganizer;
  14633. return self;
  14634. },
  14635. args: ["aClassOrganizer"],
  14636. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14637. referencedClasses: [],
  14638. messageSends: []
  14639. }),
  14640. $globals.Behavior);
  14641. $core.addMethod(
  14642. $core.method({
  14643. selector: "canUnderstand:",
  14644. protocol: "testing",
  14645. fn: function (aSelector){
  14646. var self=this,$self=this;
  14647. return $core.withContext(function($ctx1) {
  14648. var $2,$1;
  14649. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14650. return $core.withContext(function($ctx2) {
  14651. $2=$self._superclass();
  14652. $ctx2.sendIdx["superclass"]=1;
  14653. $1=$recv($2)._notNil();
  14654. return $recv($1)._and_((function(){
  14655. return $core.withContext(function($ctx3) {
  14656. return $recv($self._superclass())._canUnderstand_(aSelector);
  14657. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14658. }));
  14659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14660. }));
  14661. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14662. },
  14663. args: ["aSelector"],
  14664. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14665. referencedClasses: [],
  14666. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14667. }),
  14668. $globals.Behavior);
  14669. $core.addMethod(
  14670. $core.method({
  14671. selector: "includesBehavior:",
  14672. protocol: "testing",
  14673. fn: function (aClass){
  14674. var self=this,$self=this;
  14675. return $core.withContext(function($ctx1) {
  14676. return $recv($self.__eq_eq(aClass))._or_((function(){
  14677. return $core.withContext(function($ctx2) {
  14678. return $self._inheritsFrom_(aClass);
  14679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14680. }));
  14681. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14682. },
  14683. args: ["aClass"],
  14684. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14685. referencedClasses: [],
  14686. messageSends: ["or:", "==", "inheritsFrom:"]
  14687. }),
  14688. $globals.Behavior);
  14689. $core.addMethod(
  14690. $core.method({
  14691. selector: "inheritsFrom:",
  14692. protocol: "testing",
  14693. fn: function (aClass){
  14694. var self=this,$self=this;
  14695. return $core.withContext(function($ctx1) {
  14696. var $1,$3,$2,$receiver;
  14697. $1=$self._superclass();
  14698. $ctx1.sendIdx["superclass"]=1;
  14699. if(($receiver = $1) == null || $receiver.a$nil){
  14700. return false;
  14701. } else {
  14702. $1;
  14703. }
  14704. $3=$self._superclass();
  14705. $ctx1.sendIdx["superclass"]=2;
  14706. $2=$recv(aClass).__eq_eq($3);
  14707. return $recv($2)._or_((function(){
  14708. return $core.withContext(function($ctx2) {
  14709. return $recv($self._superclass())._inheritsFrom_(aClass);
  14710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14711. }));
  14712. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14713. },
  14714. args: ["aClass"],
  14715. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14716. referencedClasses: [],
  14717. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14718. }),
  14719. $globals.Behavior);
  14720. $core.addMethod(
  14721. $core.method({
  14722. selector: "instanceVariableNames",
  14723. protocol: "accessing",
  14724. fn: function (){
  14725. var self=this,$self=this;
  14726. return $core.withContext(function($ctx1) {
  14727. return self.iVarNames;
  14728. return self;
  14729. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14730. },
  14731. args: [],
  14732. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14733. referencedClasses: [],
  14734. messageSends: []
  14735. }),
  14736. $globals.Behavior);
  14737. $core.addMethod(
  14738. $core.method({
  14739. selector: "isBehavior",
  14740. protocol: "testing",
  14741. fn: function (){
  14742. var self=this,$self=this;
  14743. return true;
  14744. },
  14745. args: [],
  14746. source: "isBehavior\x0a\x09^ true",
  14747. referencedClasses: [],
  14748. messageSends: []
  14749. }),
  14750. $globals.Behavior);
  14751. $core.addMethod(
  14752. $core.method({
  14753. selector: "javascriptConstructor",
  14754. protocol: "accessing",
  14755. fn: function (){
  14756. var self=this,$self=this;
  14757. return $core.withContext(function($ctx1) {
  14758. return self.fn;
  14759. return self;
  14760. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14761. },
  14762. args: [],
  14763. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14764. referencedClasses: [],
  14765. messageSends: []
  14766. }),
  14767. $globals.Behavior);
  14768. $core.addMethod(
  14769. $core.method({
  14770. selector: "javascriptConstructor:",
  14771. protocol: "accessing",
  14772. fn: function (aJavaScriptFunction){
  14773. var self=this,$self=this;
  14774. return $core.withContext(function($ctx1) {
  14775. $core.setClassConstructor(self, aJavaScriptFunction);;
  14776. return self;
  14777. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14778. },
  14779. args: ["aJavaScriptFunction"],
  14780. 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);'>",
  14781. referencedClasses: [],
  14782. messageSends: []
  14783. }),
  14784. $globals.Behavior);
  14785. $core.addMethod(
  14786. $core.method({
  14787. selector: "lookupSelector:",
  14788. protocol: "accessing",
  14789. fn: function (selector){
  14790. var self=this,$self=this;
  14791. var lookupClass;
  14792. return $core.withContext(function($ctx1) {
  14793. var $1;
  14794. var $early={};
  14795. try {
  14796. lookupClass=self;
  14797. $recv((function(){
  14798. return $core.withContext(function($ctx2) {
  14799. return $recv(lookupClass).__eq(nil);
  14800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14801. }))._whileFalse_((function(){
  14802. return $core.withContext(function($ctx2) {
  14803. $1=$recv(lookupClass)._includesSelector_(selector);
  14804. if($core.assert($1)){
  14805. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14806. }
  14807. lookupClass=$recv(lookupClass)._superclass();
  14808. return lookupClass;
  14809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14810. }));
  14811. return nil;
  14812. }
  14813. catch(e) {if(e===$early)return e[0]; throw e}
  14814. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14815. },
  14816. args: ["selector"],
  14817. 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",
  14818. referencedClasses: [],
  14819. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14820. }),
  14821. $globals.Behavior);
  14822. $core.addMethod(
  14823. $core.method({
  14824. selector: "new",
  14825. protocol: "instance creation",
  14826. fn: function (){
  14827. var self=this,$self=this;
  14828. return $core.withContext(function($ctx1) {
  14829. return $recv($self._basicNew())._initialize();
  14830. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14831. },
  14832. args: [],
  14833. source: "new\x0a\x09^ self basicNew initialize",
  14834. referencedClasses: [],
  14835. messageSends: ["initialize", "basicNew"]
  14836. }),
  14837. $globals.Behavior);
  14838. $core.addMethod(
  14839. $core.method({
  14840. selector: "prototype",
  14841. protocol: "accessing",
  14842. fn: function (){
  14843. var self=this,$self=this;
  14844. return $core.withContext(function($ctx1) {
  14845. return self.fn.prototype;
  14846. return self;
  14847. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14848. },
  14849. args: [],
  14850. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14851. referencedClasses: [],
  14852. messageSends: []
  14853. }),
  14854. $globals.Behavior);
  14855. $core.addMethod(
  14856. $core.method({
  14857. selector: "subclasses",
  14858. protocol: "accessing",
  14859. fn: function (){
  14860. var self=this,$self=this;
  14861. return $core.withContext(function($ctx1) {
  14862. $self._subclassResponsibility();
  14863. return self;
  14864. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14865. },
  14866. args: [],
  14867. source: "subclasses\x0a\x09self subclassResponsibility",
  14868. referencedClasses: [],
  14869. messageSends: ["subclassResponsibility"]
  14870. }),
  14871. $globals.Behavior);
  14872. $core.addMethod(
  14873. $core.method({
  14874. selector: "superclass",
  14875. protocol: "accessing",
  14876. fn: function (){
  14877. var self=this,$self=this;
  14878. return $core.withContext(function($ctx1) {
  14879. return self.superclass;
  14880. return self;
  14881. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14882. },
  14883. args: [],
  14884. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14885. referencedClasses: [],
  14886. messageSends: []
  14887. }),
  14888. $globals.Behavior);
  14889. $core.addMethod(
  14890. $core.method({
  14891. selector: "theMetaClass",
  14892. protocol: "accessing",
  14893. fn: function (){
  14894. var self=this,$self=this;
  14895. return $core.withContext(function($ctx1) {
  14896. $self._subclassResponsibility();
  14897. return self;
  14898. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14899. },
  14900. args: [],
  14901. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14902. referencedClasses: [],
  14903. messageSends: ["subclassResponsibility"]
  14904. }),
  14905. $globals.Behavior);
  14906. $core.addMethod(
  14907. $core.method({
  14908. selector: "theNonMetaClass",
  14909. protocol: "accessing",
  14910. fn: function (){
  14911. var self=this,$self=this;
  14912. return $core.withContext(function($ctx1) {
  14913. $self._subclassResponsibility();
  14914. return self;
  14915. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14916. },
  14917. args: [],
  14918. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14919. referencedClasses: [],
  14920. messageSends: ["subclassResponsibility"]
  14921. }),
  14922. $globals.Behavior);
  14923. $core.addMethod(
  14924. $core.method({
  14925. selector: "withAllSubclasses",
  14926. protocol: "accessing",
  14927. fn: function (){
  14928. var self=this,$self=this;
  14929. return $core.withContext(function($ctx1) {
  14930. var $1;
  14931. $1=$recv($globals.Array)._with_(self);
  14932. $recv($1)._addAll_($self._allSubclasses());
  14933. return $recv($1)._yourself();
  14934. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14935. },
  14936. args: [],
  14937. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14938. referencedClasses: ["Array"],
  14939. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14940. }),
  14941. $globals.Behavior);
  14942. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14943. $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.";
  14944. $core.addMethod(
  14945. $core.method({
  14946. selector: "basicPackage:",
  14947. protocol: "accessing",
  14948. fn: function (aPackage){
  14949. var self=this,$self=this;
  14950. $self["@package"]=aPackage;
  14951. return self;
  14952. },
  14953. args: ["aPackage"],
  14954. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14955. referencedClasses: [],
  14956. messageSends: []
  14957. }),
  14958. $globals.Class);
  14959. $core.addMethod(
  14960. $core.method({
  14961. selector: "classTag",
  14962. protocol: "accessing",
  14963. fn: function (){
  14964. var self=this,$self=this;
  14965. return "class";
  14966. },
  14967. args: [],
  14968. 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'",
  14969. referencedClasses: [],
  14970. messageSends: []
  14971. }),
  14972. $globals.Class);
  14973. $core.addMethod(
  14974. $core.method({
  14975. selector: "definition",
  14976. protocol: "accessing",
  14977. fn: function (){
  14978. var self=this,$self=this;
  14979. return $core.withContext(function($ctx1) {
  14980. var $1,$2;
  14981. return $recv($globals.String)._streamContents_((function(stream){
  14982. return $core.withContext(function($ctx2) {
  14983. $recv(stream)._print_($self._superclass());
  14984. $ctx2.sendIdx["print:"]=1;
  14985. $recv(stream)._write_(" subclass: ");
  14986. $ctx2.sendIdx["write:"]=1;
  14987. $recv(stream)._printSymbol_($self._name());
  14988. $recv(stream)._lf();
  14989. $ctx2.sendIdx["lf"]=1;
  14990. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14991. return $core.withContext(function($ctx3) {
  14992. $1=$recv($globals.String)._tab();
  14993. $ctx3.sendIdx["tab"]=1;
  14994. $2=$recv($globals.String)._lf();
  14995. $ctx3.sendIdx["lf"]=2;
  14996. return [$1,"uses: ",tcd,$2];
  14997. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14998. })));
  14999. $ctx2.sendIdx["write:"]=2;
  15000. $recv(stream)._tab();
  15001. $ctx2.sendIdx["tab"]=2;
  15002. $recv(stream)._write_("instanceVariableNames: ");
  15003. $ctx2.sendIdx["write:"]=3;
  15004. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15005. $ctx2.sendIdx["print:"]=2;
  15006. $recv(stream)._lf();
  15007. $recv(stream)._tab();
  15008. $recv(stream)._write_("package: ");
  15009. return $recv(stream)._print_($self._category());
  15010. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15011. }));
  15012. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  15013. },
  15014. args: [],
  15015. 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 ]",
  15016. referencedClasses: ["String"],
  15017. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  15018. }),
  15019. $globals.Class);
  15020. $core.addMethod(
  15021. $core.method({
  15022. selector: "isClass",
  15023. protocol: "testing",
  15024. fn: function (){
  15025. var self=this,$self=this;
  15026. return true;
  15027. },
  15028. args: [],
  15029. source: "isClass\x0a\x09^ true",
  15030. referencedClasses: [],
  15031. messageSends: []
  15032. }),
  15033. $globals.Class);
  15034. $core.addMethod(
  15035. $core.method({
  15036. selector: "package",
  15037. protocol: "accessing",
  15038. fn: function (){
  15039. var self=this,$self=this;
  15040. return $self["@package"];
  15041. },
  15042. args: [],
  15043. source: "package\x0a\x09^ package",
  15044. referencedClasses: [],
  15045. messageSends: []
  15046. }),
  15047. $globals.Class);
  15048. $core.addMethod(
  15049. $core.method({
  15050. selector: "rename:",
  15051. protocol: "accessing",
  15052. fn: function (aString){
  15053. var self=this,$self=this;
  15054. return $core.withContext(function($ctx1) {
  15055. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15056. return self;
  15057. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  15058. },
  15059. args: ["aString"],
  15060. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15061. referencedClasses: ["ClassBuilder"],
  15062. messageSends: ["renameClass:to:", "new"]
  15063. }),
  15064. $globals.Class);
  15065. $core.addMethod(
  15066. $core.method({
  15067. selector: "subclasses",
  15068. protocol: "accessing",
  15069. fn: function (){
  15070. var self=this,$self=this;
  15071. return $core.withContext(function($ctx1) {
  15072. return self.subclasses._copy();
  15073. return self;
  15074. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  15075. },
  15076. args: [],
  15077. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  15078. referencedClasses: [],
  15079. messageSends: []
  15080. }),
  15081. $globals.Class);
  15082. $core.addMethod(
  15083. $core.method({
  15084. selector: "theMetaClass",
  15085. protocol: "accessing",
  15086. fn: function (){
  15087. var self=this,$self=this;
  15088. return $core.withContext(function($ctx1) {
  15089. return $self._class();
  15090. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  15091. },
  15092. args: [],
  15093. source: "theMetaClass\x0a\x09^ self class",
  15094. referencedClasses: [],
  15095. messageSends: ["class"]
  15096. }),
  15097. $globals.Class);
  15098. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  15099. $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.";
  15100. $core.addMethod(
  15101. $core.method({
  15102. selector: "asJavaScriptSource",
  15103. protocol: "converting",
  15104. fn: function (){
  15105. var self=this,$self=this;
  15106. return $core.withContext(function($ctx1) {
  15107. var $1;
  15108. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15109. $ctx1.sendIdx[","]=1;
  15110. return $1;
  15111. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15112. },
  15113. args: [],
  15114. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15115. referencedClasses: [],
  15116. messageSends: [",", "name", "instanceClass"]
  15117. }),
  15118. $globals.Metaclass);
  15119. $core.addMethod(
  15120. $core.method({
  15121. selector: "definition",
  15122. protocol: "accessing",
  15123. fn: function (){
  15124. var self=this,$self=this;
  15125. return $core.withContext(function($ctx1) {
  15126. var $1,$2;
  15127. return $recv($globals.String)._streamContents_((function(stream){
  15128. return $core.withContext(function($ctx2) {
  15129. $recv(stream)._print_(self);
  15130. $ctx2.sendIdx["print:"]=1;
  15131. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15132. return " ";
  15133. }),(function(tcd){
  15134. return $core.withContext(function($ctx3) {
  15135. $1=$recv($globals.String)._lf();
  15136. $ctx3.sendIdx["lf"]=1;
  15137. $2=$recv($globals.String)._tab();
  15138. $ctx3.sendIdx["tab"]=1;
  15139. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15140. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15141. })));
  15142. $ctx2.sendIdx["write:"]=1;
  15143. $recv(stream)._write_("instanceVariableNames: ");
  15144. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15145. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15146. }));
  15147. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15148. },
  15149. args: [],
  15150. 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) ]",
  15151. referencedClasses: ["String"],
  15152. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15153. }),
  15154. $globals.Metaclass);
  15155. $core.addMethod(
  15156. $core.method({
  15157. selector: "instanceClass",
  15158. protocol: "accessing",
  15159. fn: function (){
  15160. var self=this,$self=this;
  15161. return $core.withContext(function($ctx1) {
  15162. return self.instanceClass;
  15163. return self;
  15164. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15165. },
  15166. args: [],
  15167. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15168. referencedClasses: [],
  15169. messageSends: []
  15170. }),
  15171. $globals.Metaclass);
  15172. $core.addMethod(
  15173. $core.method({
  15174. selector: "instanceVariableNames:",
  15175. protocol: "accessing",
  15176. fn: function (aCollection){
  15177. var self=this,$self=this;
  15178. return $core.withContext(function($ctx1) {
  15179. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15180. return self;
  15181. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15182. },
  15183. args: ["aCollection"],
  15184. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15185. referencedClasses: ["ClassBuilder"],
  15186. messageSends: ["class:instanceVariableNames:", "new"]
  15187. }),
  15188. $globals.Metaclass);
  15189. $core.addMethod(
  15190. $core.method({
  15191. selector: "isMetaclass",
  15192. protocol: "testing",
  15193. fn: function (){
  15194. var self=this,$self=this;
  15195. return true;
  15196. },
  15197. args: [],
  15198. source: "isMetaclass\x0a\x09^ true",
  15199. referencedClasses: [],
  15200. messageSends: []
  15201. }),
  15202. $globals.Metaclass);
  15203. $core.addMethod(
  15204. $core.method({
  15205. selector: "name",
  15206. protocol: "accessing",
  15207. fn: function (){
  15208. var self=this,$self=this;
  15209. return $core.withContext(function($ctx1) {
  15210. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15211. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15212. },
  15213. args: [],
  15214. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15215. referencedClasses: [],
  15216. messageSends: [",", "name", "instanceClass"]
  15217. }),
  15218. $globals.Metaclass);
  15219. $core.addMethod(
  15220. $core.method({
  15221. selector: "package",
  15222. protocol: "accessing",
  15223. fn: function (){
  15224. var self=this,$self=this;
  15225. return $core.withContext(function($ctx1) {
  15226. return $recv($self._instanceClass())._package();
  15227. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15228. },
  15229. args: [],
  15230. source: "package\x0a\x09^ self instanceClass package",
  15231. referencedClasses: [],
  15232. messageSends: ["package", "instanceClass"]
  15233. }),
  15234. $globals.Metaclass);
  15235. $core.addMethod(
  15236. $core.method({
  15237. selector: "subclasses",
  15238. protocol: "accessing",
  15239. fn: function (){
  15240. var self=this,$self=this;
  15241. return $core.withContext(function($ctx1) {
  15242. return $core.metaSubclasses(self);
  15243. return self;
  15244. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15245. },
  15246. args: [],
  15247. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15248. referencedClasses: [],
  15249. messageSends: []
  15250. }),
  15251. $globals.Metaclass);
  15252. $core.addMethod(
  15253. $core.method({
  15254. selector: "theMetaClass",
  15255. protocol: "accessing",
  15256. fn: function (){
  15257. var self=this,$self=this;
  15258. return self;
  15259. },
  15260. args: [],
  15261. source: "theMetaClass\x0a\x09^ self",
  15262. referencedClasses: [],
  15263. messageSends: []
  15264. }),
  15265. $globals.Metaclass);
  15266. $core.addMethod(
  15267. $core.method({
  15268. selector: "theNonMetaClass",
  15269. protocol: "accessing",
  15270. fn: function (){
  15271. var self=this,$self=this;
  15272. return $core.withContext(function($ctx1) {
  15273. return $self._instanceClass();
  15274. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15275. },
  15276. args: [],
  15277. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15278. referencedClasses: [],
  15279. messageSends: ["instanceClass"]
  15280. }),
  15281. $globals.Metaclass);
  15282. $core.addMethod(
  15283. $core.method({
  15284. selector: "uses:instanceVariableNames:",
  15285. protocol: "accessing",
  15286. fn: function (aTraitCompositionDescription,aCollection){
  15287. var self=this,$self=this;
  15288. var metaclass;
  15289. return $core.withContext(function($ctx1) {
  15290. metaclass=$self._instanceVariableNames_(aCollection);
  15291. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15292. return metaclass;
  15293. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15294. },
  15295. args: ["aTraitCompositionDescription", "aCollection"],
  15296. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15297. referencedClasses: [],
  15298. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15299. }),
  15300. $globals.Metaclass);
  15301. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15302. $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:`.";
  15303. $core.addMethod(
  15304. $core.method({
  15305. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15306. protocol: "class definition",
  15307. fn: function (aClass,className,aCollection,packageName){
  15308. var self=this,$self=this;
  15309. var theClass,thePackage;
  15310. return $core.withContext(function($ctx1) {
  15311. var $1,$2,$3,$receiver;
  15312. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15313. thePackage=$recv($globals.Package)._named_(packageName);
  15314. $1=theClass;
  15315. if(($receiver = $1) == null || $receiver.a$nil){
  15316. $1;
  15317. } else {
  15318. $recv(theClass)._package_(thePackage);
  15319. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15320. if(!$core.assert($2)){
  15321. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15322. }
  15323. }
  15324. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15325. $recv($3)._recompile();
  15326. return $recv($3)._yourself();
  15327. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15328. },
  15329. args: ["aClass", "className", "aCollection", "packageName"],
  15330. 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",
  15331. referencedClasses: ["Smalltalk", "Package"],
  15332. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15333. }),
  15334. $globals.ClassBuilder);
  15335. $core.addMethod(
  15336. $core.method({
  15337. selector: "addTraitNamed:package:",
  15338. protocol: "class definition",
  15339. fn: function (traitName,packageName){
  15340. var self=this,$self=this;
  15341. var theTrait,thePackage;
  15342. return $core.withContext(function($ctx1) {
  15343. var $1,$2,$receiver;
  15344. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15345. thePackage=$recv($globals.Package)._named_(packageName);
  15346. $1=theTrait;
  15347. if(($receiver = $1) == null || $receiver.a$nil){
  15348. $1;
  15349. } else {
  15350. $2=theTrait;
  15351. $recv($2)._package_(thePackage);
  15352. $recv($2)._recompile();
  15353. return $recv($2)._yourself();
  15354. }
  15355. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15356. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15357. },
  15358. args: ["traitName", "packageName"],
  15359. 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",
  15360. referencedClasses: ["Smalltalk", "Package"],
  15361. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15362. }),
  15363. $globals.ClassBuilder);
  15364. $core.addMethod(
  15365. $core.method({
  15366. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15367. protocol: "private",
  15368. fn: function (aClass,aString,aCollection,packageName){
  15369. var self=this,$self=this;
  15370. return $core.withContext(function($ctx1) {
  15371. return $core.addClass(aString, aClass, aCollection, packageName);
  15372. ;
  15373. return self;
  15374. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15375. },
  15376. args: ["aClass", "aString", "aCollection", "packageName"],
  15377. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15378. referencedClasses: [],
  15379. messageSends: []
  15380. }),
  15381. $globals.ClassBuilder);
  15382. $core.addMethod(
  15383. $core.method({
  15384. selector: "basicAddTraitNamed:package:",
  15385. protocol: "private",
  15386. fn: function (aString,anotherString){
  15387. var self=this,$self=this;
  15388. return $core.withContext(function($ctx1) {
  15389. return $core.addTrait(aString, anotherString);
  15390. return self;
  15391. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15392. },
  15393. args: ["aString", "anotherString"],
  15394. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15395. referencedClasses: [],
  15396. messageSends: []
  15397. }),
  15398. $globals.ClassBuilder);
  15399. $core.addMethod(
  15400. $core.method({
  15401. selector: "basicClass:instanceVariables:",
  15402. protocol: "private",
  15403. fn: function (aClass,aCollection){
  15404. var self=this,$self=this;
  15405. return $core.withContext(function($ctx1) {
  15406. var $1;
  15407. $1=$recv(aClass)._isMetaclass();
  15408. if(!$core.assert($1)){
  15409. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15410. }
  15411. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15412. return self;
  15413. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15414. },
  15415. args: ["aClass", "aCollection"],
  15416. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15417. referencedClasses: [],
  15418. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15419. }),
  15420. $globals.ClassBuilder);
  15421. $core.addMethod(
  15422. $core.method({
  15423. selector: "basicRemoveClass:",
  15424. protocol: "private",
  15425. fn: function (aClass){
  15426. var self=this,$self=this;
  15427. return $core.withContext(function($ctx1) {
  15428. $core.removeClass(aClass);
  15429. return self;
  15430. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15431. },
  15432. args: ["aClass"],
  15433. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15434. referencedClasses: [],
  15435. messageSends: []
  15436. }),
  15437. $globals.ClassBuilder);
  15438. $core.addMethod(
  15439. $core.method({
  15440. selector: "basicRenameClass:to:",
  15441. protocol: "private",
  15442. fn: function (aClass,aString){
  15443. var self=this,$self=this;
  15444. return $core.withContext(function($ctx1) {
  15445. $globals[aString] = aClass;
  15446. delete $globals[aClass.name];
  15447. aClass.name = aString;
  15448. ;
  15449. return self;
  15450. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15451. },
  15452. args: ["aClass", "aString"],
  15453. 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'>",
  15454. referencedClasses: [],
  15455. messageSends: []
  15456. }),
  15457. $globals.ClassBuilder);
  15458. $core.addMethod(
  15459. $core.method({
  15460. selector: "basicSwapClassNames:with:",
  15461. protocol: "private",
  15462. fn: function (aClass,anotherClass){
  15463. var self=this,$self=this;
  15464. return $core.withContext(function($ctx1) {
  15465. var tmp = aClass.name;
  15466. aClass.name = anotherClass.name;
  15467. anotherClass.name = tmp;
  15468. ;
  15469. return self;
  15470. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15471. },
  15472. args: ["aClass", "anotherClass"],
  15473. 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'>",
  15474. referencedClasses: [],
  15475. messageSends: []
  15476. }),
  15477. $globals.ClassBuilder);
  15478. $core.addMethod(
  15479. $core.method({
  15480. selector: "class:instanceVariableNames:",
  15481. protocol: "class definition",
  15482. fn: function (aClass,ivarNames){
  15483. var self=this,$self=this;
  15484. return $core.withContext(function($ctx1) {
  15485. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15486. return self;
  15487. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15488. },
  15489. args: ["aClass", "ivarNames"],
  15490. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15491. referencedClasses: [],
  15492. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15493. }),
  15494. $globals.ClassBuilder);
  15495. $core.addMethod(
  15496. $core.method({
  15497. selector: "class:instanceVariables:",
  15498. protocol: "class definition",
  15499. fn: function (aClass,aCollection){
  15500. var self=this,$self=this;
  15501. return $core.withContext(function($ctx1) {
  15502. var $1,$3,$2;
  15503. $self._basicClass_instanceVariables_(aClass,aCollection);
  15504. $1=$recv($globals.SystemAnnouncer)._current();
  15505. $3=$recv($globals.ClassDefinitionChanged)._new();
  15506. $recv($3)._theClass_(aClass);
  15507. $2=$recv($3)._yourself();
  15508. $recv($1)._announce_($2);
  15509. return self;
  15510. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15511. },
  15512. args: ["aClass", "aCollection"],
  15513. 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)",
  15514. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15515. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15516. }),
  15517. $globals.ClassBuilder);
  15518. $core.addMethod(
  15519. $core.method({
  15520. selector: "copyClass:named:",
  15521. protocol: "copying",
  15522. fn: function (aClass,className){
  15523. var self=this,$self=this;
  15524. var newClass;
  15525. return $core.withContext(function($ctx1) {
  15526. var $1,$3,$2;
  15527. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15528. $self._copyClass_to_(aClass,newClass);
  15529. $1=$recv($globals.SystemAnnouncer)._current();
  15530. $3=$recv($globals.ClassAdded)._new();
  15531. $recv($3)._theClass_(newClass);
  15532. $2=$recv($3)._yourself();
  15533. $recv($1)._announce_($2);
  15534. return newClass;
  15535. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15536. },
  15537. args: ["aClass", "className"],
  15538. 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",
  15539. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15540. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15541. }),
  15542. $globals.ClassBuilder);
  15543. $core.addMethod(
  15544. $core.method({
  15545. selector: "copyClass:to:",
  15546. protocol: "copying",
  15547. fn: function (aClass,anotherClass){
  15548. var self=this,$self=this;
  15549. return $core.withContext(function($ctx1) {
  15550. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15551. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15552. $1=$recv(aClass)._methodDictionary();
  15553. $ctx1.sendIdx["methodDictionary"]=1;
  15554. $recv($1)._valuesDo_((function(each){
  15555. return $core.withContext(function($ctx2) {
  15556. $3=$recv(each)._methodClass();
  15557. $ctx2.sendIdx["methodClass"]=1;
  15558. $2=$recv($3).__eq(aClass);
  15559. $ctx2.sendIdx["="]=1;
  15560. if($core.assert($2)){
  15561. $4=$recv($globals.Compiler)._new();
  15562. $ctx2.sendIdx["new"]=1;
  15563. $5=$recv(each)._source();
  15564. $ctx2.sendIdx["source"]=1;
  15565. $6=$recv(each)._protocol();
  15566. $ctx2.sendIdx["protocol"]=1;
  15567. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15568. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15569. }
  15570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15571. }));
  15572. $ctx1.sendIdx["valuesDo:"]=1;
  15573. $7=$recv(aClass)._traitComposition();
  15574. $ctx1.sendIdx["traitComposition"]=1;
  15575. $recv(anotherClass)._setTraitComposition_($7);
  15576. $ctx1.sendIdx["setTraitComposition:"]=1;
  15577. $8=$recv(anotherClass)._class();
  15578. $ctx1.sendIdx["class"]=1;
  15579. $10=$recv(aClass)._class();
  15580. $ctx1.sendIdx["class"]=2;
  15581. $9=$recv($10)._instanceVariableNames();
  15582. $self._basicClass_instanceVariables_($8,$9);
  15583. $12=$recv(aClass)._class();
  15584. $ctx1.sendIdx["class"]=3;
  15585. $11=$recv($12)._methodDictionary();
  15586. $recv($11)._valuesDo_((function(each){
  15587. return $core.withContext(function($ctx2) {
  15588. $14=$recv(each)._methodClass();
  15589. $15=$recv(aClass)._class();
  15590. $ctx2.sendIdx["class"]=4;
  15591. $13=$recv($14).__eq($15);
  15592. if($core.assert($13)){
  15593. $16=$recv($globals.Compiler)._new();
  15594. $17=$recv(each)._source();
  15595. $18=$recv(anotherClass)._class();
  15596. $ctx2.sendIdx["class"]=5;
  15597. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15598. }
  15599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15600. }));
  15601. $19=$recv(anotherClass)._class();
  15602. $ctx1.sendIdx["class"]=6;
  15603. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15604. return self;
  15605. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15606. },
  15607. args: ["aClass", "anotherClass"],
  15608. 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",
  15609. referencedClasses: ["Compiler"],
  15610. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15611. }),
  15612. $globals.ClassBuilder);
  15613. $core.addMethod(
  15614. $core.method({
  15615. selector: "installMethod:forClass:protocol:",
  15616. protocol: "method definition",
  15617. fn: function (aCompiledMethod,aBehavior,aString){
  15618. var self=this,$self=this;
  15619. return $core.withContext(function($ctx1) {
  15620. $recv(aCompiledMethod)._protocol_(aString);
  15621. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15622. return aCompiledMethod;
  15623. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15624. },
  15625. args: ["aCompiledMethod", "aBehavior", "aString"],
  15626. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15627. referencedClasses: [],
  15628. messageSends: ["protocol:", "addCompiledMethod:"]
  15629. }),
  15630. $globals.ClassBuilder);
  15631. $core.addMethod(
  15632. $core.method({
  15633. selector: "instanceVariableNamesFor:",
  15634. protocol: "accessing",
  15635. fn: function (aString){
  15636. var self=this,$self=this;
  15637. return $core.withContext(function($ctx1) {
  15638. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15639. return $core.withContext(function($ctx2) {
  15640. return $recv(each)._isEmpty();
  15641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15642. }));
  15643. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15644. },
  15645. args: ["aString"],
  15646. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15647. referencedClasses: [],
  15648. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15649. }),
  15650. $globals.ClassBuilder);
  15651. $core.addMethod(
  15652. $core.method({
  15653. selector: "migrateClass:superclass:",
  15654. protocol: "class migration",
  15655. fn: function (aClass,anotherClass){
  15656. var self=this,$self=this;
  15657. return $core.withContext(function($ctx1) {
  15658. var $1;
  15659. $1=$recv(aClass)._name();
  15660. $ctx1.sendIdx["name"]=1;
  15661. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15662. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15663. },
  15664. args: ["aClass", "anotherClass"],
  15665. 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",
  15666. referencedClasses: [],
  15667. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15668. }),
  15669. $globals.ClassBuilder);
  15670. $core.addMethod(
  15671. $core.method({
  15672. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15673. protocol: "class migration",
  15674. fn: function (className,aClass,aCollection,packageName){
  15675. var self=this,$self=this;
  15676. var oldClass,newClass,tmp;
  15677. return $core.withContext(function($ctx1) {
  15678. var $1,$2,$4,$3;
  15679. tmp="new*".__comma(className);
  15680. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15681. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15682. $self._basicSwapClassNames_with_(oldClass,newClass);
  15683. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15684. $recv((function(){
  15685. return $core.withContext(function($ctx2) {
  15686. return $self._copyClass_to_(oldClass,newClass);
  15687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15688. }))._on_do_($globals.Error,(function(exception){
  15689. return $core.withContext(function($ctx2) {
  15690. $self._basicSwapClassNames_with_(oldClass,newClass);
  15691. $1=$self._basicRemoveClass_(newClass);
  15692. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15693. $1;
  15694. return $recv(exception)._resignal();
  15695. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15696. }));
  15697. $self._rawRenameClass_to_(oldClass,tmp);
  15698. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15699. $self._rawRenameClass_to_(newClass,className);
  15700. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15701. return $core.withContext(function($ctx2) {
  15702. return $self._migrateClass_superclass_(each,newClass);
  15703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15704. }));
  15705. $self._basicRemoveClass_(oldClass);
  15706. $2=$recv($globals.SystemAnnouncer)._current();
  15707. $4=$recv($globals.ClassMigrated)._new();
  15708. $recv($4)._theClass_(newClass);
  15709. $recv($4)._oldClass_(oldClass);
  15710. $3=$recv($4)._yourself();
  15711. $recv($2)._announce_($3);
  15712. return newClass;
  15713. }, 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)});
  15714. },
  15715. args: ["className", "aClass", "aCollection", "packageName"],
  15716. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15717. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15718. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15719. }),
  15720. $globals.ClassBuilder);
  15721. $core.addMethod(
  15722. $core.method({
  15723. selector: "rawRenameClass:to:",
  15724. protocol: "private",
  15725. fn: function (aClass,aString){
  15726. var self=this,$self=this;
  15727. return $core.withContext(function($ctx1) {
  15728. $globals[aString] = aClass;
  15729. ;
  15730. return self;
  15731. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15732. },
  15733. args: ["aClass", "aString"],
  15734. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15735. referencedClasses: [],
  15736. messageSends: []
  15737. }),
  15738. $globals.ClassBuilder);
  15739. $core.addMethod(
  15740. $core.method({
  15741. selector: "renameClass:to:",
  15742. protocol: "class migration",
  15743. fn: function (aClass,className){
  15744. var self=this,$self=this;
  15745. return $core.withContext(function($ctx1) {
  15746. var $1,$3,$2;
  15747. $self._basicRenameClass_to_(aClass,className);
  15748. $recv(aClass)._recompile();
  15749. $1=$recv($globals.SystemAnnouncer)._current();
  15750. $3=$recv($globals.ClassRenamed)._new();
  15751. $recv($3)._theClass_(aClass);
  15752. $2=$recv($3)._yourself();
  15753. $recv($1)._announce_($2);
  15754. return self;
  15755. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15756. },
  15757. args: ["aClass", "className"],
  15758. 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)",
  15759. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15760. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15761. }),
  15762. $globals.ClassBuilder);
  15763. $core.addMethod(
  15764. $core.method({
  15765. selector: "setupClass:",
  15766. protocol: "public",
  15767. fn: function (aClass){
  15768. var self=this,$self=this;
  15769. return $core.withContext(function($ctx1) {
  15770. $self._deprecatedAPI_("Classes are now auto-inited.");
  15771. return self;
  15772. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  15773. },
  15774. args: ["aClass"],
  15775. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  15776. referencedClasses: [],
  15777. messageSends: ["deprecatedAPI:"]
  15778. }),
  15779. $globals.ClassBuilder);
  15780. $core.addMethod(
  15781. $core.method({
  15782. selector: "superclass:subclass:",
  15783. protocol: "class definition",
  15784. fn: function (aClass,className){
  15785. var self=this,$self=this;
  15786. return $core.withContext(function($ctx1) {
  15787. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15788. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15789. },
  15790. args: ["aClass", "className"],
  15791. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15792. referencedClasses: [],
  15793. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15794. }),
  15795. $globals.ClassBuilder);
  15796. $core.addMethod(
  15797. $core.method({
  15798. selector: "superclass:subclass:instanceVariableNames:package:",
  15799. protocol: "class definition",
  15800. fn: function (aClass,className,ivarNames,packageName){
  15801. var self=this,$self=this;
  15802. var newClass;
  15803. return $core.withContext(function($ctx1) {
  15804. var $1,$2,$3,$5,$4,$receiver;
  15805. $1=$self._instanceVariableNamesFor_(ivarNames);
  15806. if(($receiver = packageName) == null || $receiver.a$nil){
  15807. $2="unclassified";
  15808. } else {
  15809. $2=packageName;
  15810. }
  15811. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15812. $3=$recv($globals.SystemAnnouncer)._current();
  15813. $5=$recv($globals.ClassAdded)._new();
  15814. $recv($5)._theClass_(newClass);
  15815. $4=$recv($5)._yourself();
  15816. $recv($3)._announce_($4);
  15817. return newClass;
  15818. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15819. },
  15820. args: ["aClass", "className", "ivarNames", "packageName"],
  15821. 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",
  15822. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15823. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15824. }),
  15825. $globals.ClassBuilder);
  15826. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15827. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15828. $core.addMethod(
  15829. $core.method({
  15830. selector: "getNodesFrom:",
  15831. protocol: "accessing",
  15832. fn: function (aCollection){
  15833. var self=this,$self=this;
  15834. var children,others;
  15835. return $core.withContext(function($ctx1) {
  15836. var $1;
  15837. children=[];
  15838. others=[];
  15839. $recv(aCollection)._do_((function(each){
  15840. return $core.withContext(function($ctx2) {
  15841. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15842. if($core.assert($1)){
  15843. return $recv(children)._add_(each);
  15844. $ctx2.sendIdx["add:"]=1;
  15845. } else {
  15846. return $recv(others)._add_(each);
  15847. }
  15848. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15849. }));
  15850. $self["@nodes"]=$recv(children)._collect_((function(each){
  15851. return $core.withContext(function($ctx2) {
  15852. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15854. }));
  15855. return self;
  15856. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15857. },
  15858. args: ["aCollection"],
  15859. 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 ]",
  15860. referencedClasses: ["ClassSorterNode"],
  15861. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15862. }),
  15863. $globals.ClassSorterNode);
  15864. $core.addMethod(
  15865. $core.method({
  15866. selector: "level",
  15867. protocol: "accessing",
  15868. fn: function (){
  15869. var self=this,$self=this;
  15870. return $self["@level"];
  15871. },
  15872. args: [],
  15873. source: "level\x0a\x09^ level",
  15874. referencedClasses: [],
  15875. messageSends: []
  15876. }),
  15877. $globals.ClassSorterNode);
  15878. $core.addMethod(
  15879. $core.method({
  15880. selector: "level:",
  15881. protocol: "accessing",
  15882. fn: function (anInteger){
  15883. var self=this,$self=this;
  15884. $self["@level"]=anInteger;
  15885. return self;
  15886. },
  15887. args: ["anInteger"],
  15888. source: "level: anInteger\x0a\x09level := anInteger",
  15889. referencedClasses: [],
  15890. messageSends: []
  15891. }),
  15892. $globals.ClassSorterNode);
  15893. $core.addMethod(
  15894. $core.method({
  15895. selector: "nodes",
  15896. protocol: "accessing",
  15897. fn: function (){
  15898. var self=this,$self=this;
  15899. return $self["@nodes"];
  15900. },
  15901. args: [],
  15902. source: "nodes\x0a\x09^ nodes",
  15903. referencedClasses: [],
  15904. messageSends: []
  15905. }),
  15906. $globals.ClassSorterNode);
  15907. $core.addMethod(
  15908. $core.method({
  15909. selector: "theClass",
  15910. protocol: "accessing",
  15911. fn: function (){
  15912. var self=this,$self=this;
  15913. return $self["@theClass"];
  15914. },
  15915. args: [],
  15916. source: "theClass\x0a\x09^ theClass",
  15917. referencedClasses: [],
  15918. messageSends: []
  15919. }),
  15920. $globals.ClassSorterNode);
  15921. $core.addMethod(
  15922. $core.method({
  15923. selector: "theClass:",
  15924. protocol: "accessing",
  15925. fn: function (aClass){
  15926. var self=this,$self=this;
  15927. $self["@theClass"]=aClass;
  15928. return self;
  15929. },
  15930. args: ["aClass"],
  15931. source: "theClass: aClass\x0a\x09theClass := aClass",
  15932. referencedClasses: [],
  15933. messageSends: []
  15934. }),
  15935. $globals.ClassSorterNode);
  15936. $core.addMethod(
  15937. $core.method({
  15938. selector: "traverseClassesWith:",
  15939. protocol: "visiting",
  15940. fn: function (aCollection){
  15941. var self=this,$self=this;
  15942. return $core.withContext(function($ctx1) {
  15943. var $1,$3,$2;
  15944. $1=$self._theClass();
  15945. $ctx1.sendIdx["theClass"]=1;
  15946. $recv(aCollection)._add_($1);
  15947. $recv($recv($self._nodes())._sorted_((function(a,b){
  15948. return $core.withContext(function($ctx2) {
  15949. $3=$recv(a)._theClass();
  15950. $ctx2.sendIdx["theClass"]=2;
  15951. $2=$recv($3)._name();
  15952. $ctx2.sendIdx["name"]=1;
  15953. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15954. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15955. })))._do_((function(aNode){
  15956. return $core.withContext(function($ctx2) {
  15957. return $recv(aNode)._traverseClassesWith_(aCollection);
  15958. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15959. }));
  15960. return self;
  15961. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15962. },
  15963. args: ["aCollection"],
  15964. 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 ].",
  15965. referencedClasses: [],
  15966. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15967. }),
  15968. $globals.ClassSorterNode);
  15969. $core.addMethod(
  15970. $core.method({
  15971. selector: "on:classes:level:",
  15972. protocol: "instance creation",
  15973. fn: function (aClass,aCollection,anInteger){
  15974. var self=this,$self=this;
  15975. return $core.withContext(function($ctx1) {
  15976. var $1;
  15977. $1=$self._new();
  15978. $recv($1)._theClass_(aClass);
  15979. $recv($1)._level_(anInteger);
  15980. $recv($1)._getNodesFrom_(aCollection);
  15981. return $recv($1)._yourself();
  15982. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15983. },
  15984. args: ["aClass", "aCollection", "anInteger"],
  15985. 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",
  15986. referencedClasses: [],
  15987. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15988. }),
  15989. $globals.ClassSorterNode.a$cls);
  15990. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15991. $core.addMethod(
  15992. $core.method({
  15993. selector: "allInstanceVariableNames",
  15994. protocol: "accessing",
  15995. fn: function (){
  15996. var self=this,$self=this;
  15997. return [];
  15998. },
  15999. args: [],
  16000. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  16001. referencedClasses: [],
  16002. messageSends: []
  16003. }),
  16004. $globals.TBehaviorDefaults);
  16005. $core.addMethod(
  16006. $core.method({
  16007. selector: "allSubclassesDo:",
  16008. protocol: "enumerating",
  16009. fn: function (aBlock){
  16010. var self=this,$self=this;
  16011. return self;
  16012. },
  16013. args: ["aBlock"],
  16014. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  16015. referencedClasses: [],
  16016. messageSends: []
  16017. }),
  16018. $globals.TBehaviorDefaults);
  16019. $core.addMethod(
  16020. $core.method({
  16021. selector: "name",
  16022. protocol: "accessing",
  16023. fn: function (){
  16024. var self=this,$self=this;
  16025. return nil;
  16026. },
  16027. args: [],
  16028. source: "name\x0a\x09^ nil",
  16029. referencedClasses: [],
  16030. messageSends: []
  16031. }),
  16032. $globals.TBehaviorDefaults);
  16033. $core.addMethod(
  16034. $core.method({
  16035. selector: "printOn:",
  16036. protocol: "printing",
  16037. fn: function (aStream){
  16038. var self=this,$self=this;
  16039. return $core.withContext(function($ctx1) {
  16040. var $1,$receiver;
  16041. $1=$self._name();
  16042. if(($receiver = $1) == null || $receiver.a$nil){
  16043. (
  16044. $ctx1.supercall = true,
  16045. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  16046. $ctx1.supercall = false;
  16047. } else {
  16048. var name;
  16049. name=$receiver;
  16050. $recv(aStream)._nextPutAll_(name);
  16051. }
  16052. return self;
  16053. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  16054. },
  16055. args: ["aStream"],
  16056. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  16057. referencedClasses: [],
  16058. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16059. }),
  16060. $globals.TBehaviorDefaults);
  16061. $core.addMethod(
  16062. $core.method({
  16063. selector: "superclass",
  16064. protocol: "accessing",
  16065. fn: function (){
  16066. var self=this,$self=this;
  16067. return nil;
  16068. },
  16069. args: [],
  16070. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16071. referencedClasses: [],
  16072. messageSends: []
  16073. }),
  16074. $globals.TBehaviorDefaults);
  16075. $core.addMethod(
  16076. $core.method({
  16077. selector: "traitUsers",
  16078. protocol: "accessing",
  16079. fn: function (){
  16080. var self=this,$self=this;
  16081. return [];
  16082. },
  16083. args: [],
  16084. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16085. referencedClasses: [],
  16086. messageSends: []
  16087. }),
  16088. $globals.TBehaviorDefaults);
  16089. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16090. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16091. $core.addMethod(
  16092. $core.method({
  16093. selector: ">>",
  16094. protocol: "accessing",
  16095. fn: function (aString){
  16096. var self=this,$self=this;
  16097. return $core.withContext(function($ctx1) {
  16098. return $self._methodAt_(aString);
  16099. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  16100. },
  16101. args: ["aString"],
  16102. source: ">> aString\x0a\x09^ self methodAt: aString",
  16103. referencedClasses: [],
  16104. messageSends: ["methodAt:"]
  16105. }),
  16106. $globals.TBehaviorProvider);
  16107. $core.addMethod(
  16108. $core.method({
  16109. selector: "addCompiledMethod:",
  16110. protocol: "compiling",
  16111. fn: function (aMethod){
  16112. var self=this,$self=this;
  16113. var oldMethod,announcement;
  16114. return $core.withContext(function($ctx1) {
  16115. var $1,$2,$3,$4,$receiver;
  16116. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16117. return nil;
  16118. }));
  16119. $self._basicAddCompiledMethod_(aMethod);
  16120. $1=oldMethod;
  16121. if(($receiver = $1) == null || $receiver.a$nil){
  16122. $2=$recv($globals.MethodAdded)._new();
  16123. $ctx1.sendIdx["new"]=1;
  16124. $recv($2)._method_(aMethod);
  16125. $ctx1.sendIdx["method:"]=1;
  16126. $3=$recv($2)._yourself();
  16127. $ctx1.sendIdx["yourself"]=1;
  16128. announcement=$3;
  16129. } else {
  16130. $4=$recv($globals.MethodModified)._new();
  16131. $recv($4)._oldMethod_(oldMethod);
  16132. $recv($4)._method_(aMethod);
  16133. announcement=$recv($4)._yourself();
  16134. }
  16135. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16136. return self;
  16137. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16138. },
  16139. args: ["aMethod"],
  16140. 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",
  16141. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16142. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16143. }),
  16144. $globals.TBehaviorProvider);
  16145. $core.addMethod(
  16146. $core.method({
  16147. selector: "basicAddCompiledMethod:",
  16148. protocol: "private",
  16149. fn: function (aMethod){
  16150. var self=this,$self=this;
  16151. return $core.withContext(function($ctx1) {
  16152. $core.addMethod(aMethod, self);
  16153. return self;
  16154. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16155. },
  16156. args: ["aMethod"],
  16157. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16158. referencedClasses: [],
  16159. messageSends: []
  16160. }),
  16161. $globals.TBehaviorProvider);
  16162. $core.addMethod(
  16163. $core.method({
  16164. selector: "basicRemoveCompiledMethod:",
  16165. protocol: "private",
  16166. fn: function (aMethod){
  16167. var self=this,$self=this;
  16168. return $core.withContext(function($ctx1) {
  16169. $core.removeMethod(aMethod,self);
  16170. return self;
  16171. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16172. },
  16173. args: ["aMethod"],
  16174. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16175. referencedClasses: [],
  16176. messageSends: []
  16177. }),
  16178. $globals.TBehaviorProvider);
  16179. $core.addMethod(
  16180. $core.method({
  16181. selector: "compile:protocol:",
  16182. protocol: "compiling",
  16183. fn: function (aString,anotherString){
  16184. var self=this,$self=this;
  16185. return $core.withContext(function($ctx1) {
  16186. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16187. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16188. },
  16189. args: ["aString", "anotherString"],
  16190. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16191. referencedClasses: ["Compiler"],
  16192. messageSends: ["install:forClass:protocol:", "new"]
  16193. }),
  16194. $globals.TBehaviorProvider);
  16195. $core.addMethod(
  16196. $core.method({
  16197. selector: "includesSelector:",
  16198. protocol: "testing",
  16199. fn: function (aString){
  16200. var self=this,$self=this;
  16201. return $core.withContext(function($ctx1) {
  16202. return $recv($self._methodDictionary())._includesKey_(aString);
  16203. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16204. },
  16205. args: ["aString"],
  16206. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16207. referencedClasses: [],
  16208. messageSends: ["includesKey:", "methodDictionary"]
  16209. }),
  16210. $globals.TBehaviorProvider);
  16211. $core.addMethod(
  16212. $core.method({
  16213. selector: "methodAt:",
  16214. protocol: "accessing",
  16215. fn: function (aString){
  16216. var self=this,$self=this;
  16217. return $core.withContext(function($ctx1) {
  16218. return $recv($self._methodDictionary())._at_(aString);
  16219. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16220. },
  16221. args: ["aString"],
  16222. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16223. referencedClasses: [],
  16224. messageSends: ["at:", "methodDictionary"]
  16225. }),
  16226. $globals.TBehaviorProvider);
  16227. $core.addMethod(
  16228. $core.method({
  16229. selector: "methodDictionary",
  16230. protocol: "accessing",
  16231. fn: function (){
  16232. var self=this,$self=this;
  16233. return $core.withContext(function($ctx1) {
  16234. var dict = $globals.HashedCollection._new();
  16235. var methods = self.methods;
  16236. Object.keys(methods).forEach(function(i) {
  16237. if(methods[i].selector) {
  16238. dict._at_put_(methods[i].selector, methods[i]);
  16239. }
  16240. });
  16241. return dict;
  16242. return self;
  16243. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16244. },
  16245. args: [],
  16246. 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'>",
  16247. referencedClasses: [],
  16248. messageSends: []
  16249. }),
  16250. $globals.TBehaviorProvider);
  16251. $core.addMethod(
  16252. $core.method({
  16253. selector: "methodOrganizationEnter:andLeave:",
  16254. protocol: "accessing",
  16255. fn: function (aMethod,oldMethod){
  16256. var self=this,$self=this;
  16257. return $core.withContext(function($ctx1) {
  16258. var $1,$2,$receiver;
  16259. if(($receiver = aMethod) == null || $receiver.a$nil){
  16260. aMethod;
  16261. } else {
  16262. $1=$self._organization();
  16263. $2=$recv(aMethod)._protocol();
  16264. $ctx1.sendIdx["protocol"]=1;
  16265. $recv($1)._addElement_($2);
  16266. }
  16267. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16268. oldMethod;
  16269. } else {
  16270. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16271. }
  16272. return self;
  16273. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16274. },
  16275. args: ["aMethod", "oldMethod"],
  16276. 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 ]",
  16277. referencedClasses: [],
  16278. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16279. }),
  16280. $globals.TBehaviorProvider);
  16281. $core.addMethod(
  16282. $core.method({
  16283. selector: "methodTemplate",
  16284. protocol: "accessing",
  16285. fn: function (){
  16286. var self=this,$self=this;
  16287. return $core.withContext(function($ctx1) {
  16288. return $recv($globals.String)._streamContents_((function(stream){
  16289. return $core.withContext(function($ctx2) {
  16290. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16291. $ctx2.sendIdx["write:"]=1;
  16292. $recv(stream)._lf();
  16293. $ctx2.sendIdx["lf"]=1;
  16294. $recv(stream)._tab();
  16295. $ctx2.sendIdx["tab"]=1;
  16296. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16297. $ctx2.sendIdx["write:"]=2;
  16298. $recv(stream)._lf();
  16299. $ctx2.sendIdx["lf"]=2;
  16300. $recv(stream)._lf();
  16301. $ctx2.sendIdx["lf"]=3;
  16302. $recv(stream)._tab();
  16303. $ctx2.sendIdx["tab"]=2;
  16304. $recv(stream)._write_("| temporary variable names |");
  16305. $ctx2.sendIdx["write:"]=3;
  16306. $recv(stream)._lf();
  16307. $recv(stream)._tab();
  16308. return $recv(stream)._write_("statements");
  16309. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16310. }));
  16311. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16312. },
  16313. args: [],
  16314. 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' ]",
  16315. referencedClasses: ["String"],
  16316. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16317. }),
  16318. $globals.TBehaviorProvider);
  16319. $core.addMethod(
  16320. $core.method({
  16321. selector: "methods",
  16322. protocol: "accessing",
  16323. fn: function (){
  16324. var self=this,$self=this;
  16325. return $core.withContext(function($ctx1) {
  16326. return $recv($self._methodDictionary())._values();
  16327. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16328. },
  16329. args: [],
  16330. source: "methods\x0a\x09^ self methodDictionary values",
  16331. referencedClasses: [],
  16332. messageSends: ["values", "methodDictionary"]
  16333. }),
  16334. $globals.TBehaviorProvider);
  16335. $core.addMethod(
  16336. $core.method({
  16337. selector: "methodsInProtocol:",
  16338. protocol: "accessing",
  16339. fn: function (aString){
  16340. var self=this,$self=this;
  16341. return $core.withContext(function($ctx1) {
  16342. return $recv($self._methods())._select_((function(each){
  16343. return $core.withContext(function($ctx2) {
  16344. return $recv($recv(each)._protocol()).__eq(aString);
  16345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16346. }));
  16347. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16348. },
  16349. args: ["aString"],
  16350. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16351. referencedClasses: [],
  16352. messageSends: ["select:", "methods", "=", "protocol"]
  16353. }),
  16354. $globals.TBehaviorProvider);
  16355. $core.addMethod(
  16356. $core.method({
  16357. selector: "organization",
  16358. protocol: "accessing",
  16359. fn: function (){
  16360. var self=this,$self=this;
  16361. return $core.withContext(function($ctx1) {
  16362. var $1,$receiver;
  16363. $1=$self._basicOrganization();
  16364. $ctx1.sendIdx["basicOrganization"]=1;
  16365. if(($receiver = $1) == null || $receiver.a$nil){
  16366. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16367. return $self._basicOrganization();
  16368. } else {
  16369. return $1;
  16370. }
  16371. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16372. },
  16373. args: [],
  16374. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16375. referencedClasses: ["ClassOrganizer"],
  16376. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16377. }),
  16378. $globals.TBehaviorProvider);
  16379. $core.addMethod(
  16380. $core.method({
  16381. selector: "ownMethods",
  16382. protocol: "accessing",
  16383. fn: function (){
  16384. var self=this,$self=this;
  16385. return $core.withContext(function($ctx1) {
  16386. var $1;
  16387. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16388. return $core.withContext(function($ctx2) {
  16389. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16390. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16391. })))._sorted_((function(a,b){
  16392. return $core.withContext(function($ctx2) {
  16393. $1=$recv(a)._selector();
  16394. $ctx2.sendIdx["selector"]=1;
  16395. return $recv($1).__lt_eq($recv(b)._selector());
  16396. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16397. }));
  16398. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16399. },
  16400. args: [],
  16401. 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 ]",
  16402. referencedClasses: ["OrderedCollection"],
  16403. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16404. }),
  16405. $globals.TBehaviorProvider);
  16406. $core.addMethod(
  16407. $core.method({
  16408. selector: "ownMethodsInProtocol:",
  16409. protocol: "accessing",
  16410. fn: function (aString){
  16411. var self=this,$self=this;
  16412. return $core.withContext(function($ctx1) {
  16413. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16414. return $core.withContext(function($ctx2) {
  16415. return $recv($recv(each)._methodClass()).__eq(self);
  16416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16417. }));
  16418. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16419. },
  16420. args: ["aString"],
  16421. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16422. referencedClasses: [],
  16423. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16424. }),
  16425. $globals.TBehaviorProvider);
  16426. $core.addMethod(
  16427. $core.method({
  16428. selector: "ownProtocols",
  16429. protocol: "accessing",
  16430. fn: function (){
  16431. var self=this,$self=this;
  16432. return $core.withContext(function($ctx1) {
  16433. return $recv($self._protocols())._reject_((function(each){
  16434. return $core.withContext(function($ctx2) {
  16435. return $recv(each)._match_("^\x5c*");
  16436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16437. }));
  16438. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16439. },
  16440. args: [],
  16441. 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*' ]",
  16442. referencedClasses: [],
  16443. messageSends: ["reject:", "protocols", "match:"]
  16444. }),
  16445. $globals.TBehaviorProvider);
  16446. $core.addMethod(
  16447. $core.method({
  16448. selector: "packageOfProtocol:",
  16449. protocol: "accessing",
  16450. fn: function (aString){
  16451. var self=this,$self=this;
  16452. return $core.withContext(function($ctx1) {
  16453. var $1;
  16454. $1=$recv(aString)._beginsWith_("*");
  16455. if(!$core.assert($1)){
  16456. return $self._package();
  16457. }
  16458. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16459. return nil;
  16460. }));
  16461. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16462. },
  16463. args: ["aString"],
  16464. 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 ]",
  16465. referencedClasses: ["Package"],
  16466. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16467. }),
  16468. $globals.TBehaviorProvider);
  16469. $core.addMethod(
  16470. $core.method({
  16471. selector: "protocols",
  16472. protocol: "accessing",
  16473. fn: function (){
  16474. var self=this,$self=this;
  16475. return $core.withContext(function($ctx1) {
  16476. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16477. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16478. },
  16479. args: [],
  16480. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16481. referencedClasses: [],
  16482. messageSends: ["sorted", "asArray", "elements", "organization"]
  16483. }),
  16484. $globals.TBehaviorProvider);
  16485. $core.addMethod(
  16486. $core.method({
  16487. selector: "protocolsDo:",
  16488. protocol: "enumerating",
  16489. fn: function (aBlock){
  16490. var self=this,$self=this;
  16491. var methodsByProtocol;
  16492. return $core.withContext(function($ctx1) {
  16493. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16494. $ctx1.sendIdx["new"]=1;
  16495. $recv($self._methodDictionary())._valuesDo_((function(m){
  16496. return $core.withContext(function($ctx2) {
  16497. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16498. return $core.withContext(function($ctx3) {
  16499. return $recv($globals.Array)._new();
  16500. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16501. })))._add_(m);
  16502. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16503. }));
  16504. $recv($self._protocols())._do_((function(protocol){
  16505. return $core.withContext(function($ctx2) {
  16506. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16507. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16508. }));
  16509. return self;
  16510. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16511. },
  16512. args: ["aBlock"],
  16513. 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) ]",
  16514. referencedClasses: ["HashedCollection", "Array"],
  16515. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16516. }),
  16517. $globals.TBehaviorProvider);
  16518. $core.addMethod(
  16519. $core.method({
  16520. selector: "recompile",
  16521. protocol: "compiling",
  16522. fn: function (){
  16523. var self=this,$self=this;
  16524. return $core.withContext(function($ctx1) {
  16525. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16526. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16527. },
  16528. args: [],
  16529. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16530. referencedClasses: ["Compiler"],
  16531. messageSends: ["recompile:", "new"]
  16532. }),
  16533. $globals.TBehaviorProvider);
  16534. $core.addMethod(
  16535. $core.method({
  16536. selector: "removeCompiledMethod:",
  16537. protocol: "compiling",
  16538. fn: function (aMethod){
  16539. var self=this,$self=this;
  16540. return $core.withContext(function($ctx1) {
  16541. var $1,$3,$2;
  16542. $self._basicRemoveCompiledMethod_(aMethod);
  16543. $1=$recv($globals.SystemAnnouncer)._current();
  16544. $3=$recv($globals.MethodRemoved)._new();
  16545. $recv($3)._method_(aMethod);
  16546. $2=$recv($3)._yourself();
  16547. $recv($1)._announce_($2);
  16548. return self;
  16549. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16550. },
  16551. args: ["aMethod"],
  16552. 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)",
  16553. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16554. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16555. }),
  16556. $globals.TBehaviorProvider);
  16557. $core.addMethod(
  16558. $core.method({
  16559. selector: "removeProtocolIfEmpty:",
  16560. protocol: "accessing",
  16561. fn: function (aString){
  16562. var self=this,$self=this;
  16563. return $core.withContext(function($ctx1) {
  16564. $recv($self._methods())._detect_ifNone_((function(each){
  16565. return $core.withContext(function($ctx2) {
  16566. return $recv($recv(each)._protocol()).__eq(aString);
  16567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16568. }),(function(){
  16569. return $core.withContext(function($ctx2) {
  16570. return $recv($self._organization())._removeElement_(aString);
  16571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16572. }));
  16573. return self;
  16574. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16575. },
  16576. args: ["aString"],
  16577. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16578. referencedClasses: [],
  16579. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16580. }),
  16581. $globals.TBehaviorProvider);
  16582. $core.addMethod(
  16583. $core.method({
  16584. selector: "selectors",
  16585. protocol: "accessing",
  16586. fn: function (){
  16587. var self=this,$self=this;
  16588. return $core.withContext(function($ctx1) {
  16589. return $recv($self._methodDictionary())._keys();
  16590. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16591. },
  16592. args: [],
  16593. source: "selectors\x0a\x09^ self methodDictionary keys",
  16594. referencedClasses: [],
  16595. messageSends: ["keys", "methodDictionary"]
  16596. }),
  16597. $globals.TBehaviorProvider);
  16598. $core.addMethod(
  16599. $core.method({
  16600. selector: "setTraitComposition:",
  16601. protocol: "compiling",
  16602. fn: function (aTraitComposition){
  16603. var self=this,$self=this;
  16604. return $core.withContext(function($ctx1) {
  16605. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16606. return self;
  16607. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16608. },
  16609. args: ["aTraitComposition"],
  16610. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16611. referencedClasses: [],
  16612. messageSends: []
  16613. }),
  16614. $globals.TBehaviorProvider);
  16615. $core.addMethod(
  16616. $core.method({
  16617. selector: "traitComposition",
  16618. protocol: "accessing",
  16619. fn: function (){
  16620. var self=this,$self=this;
  16621. return $core.withContext(function($ctx1) {
  16622. var $1,$receiver;
  16623. $1=$self._basicAt_("traitComposition");
  16624. if(($receiver = $1) == null || $receiver.a$nil){
  16625. return [];
  16626. } else {
  16627. var aCollection;
  16628. aCollection=$receiver;
  16629. return $recv(aCollection)._collect_((function(each){
  16630. return $core.withContext(function($ctx2) {
  16631. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16633. }));
  16634. }
  16635. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16636. },
  16637. args: [],
  16638. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16639. referencedClasses: ["TraitTransformation"],
  16640. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16641. }),
  16642. $globals.TBehaviorProvider);
  16643. $core.addMethod(
  16644. $core.method({
  16645. selector: "traitCompositionDefinition",
  16646. protocol: "accessing",
  16647. fn: function (){
  16648. var self=this,$self=this;
  16649. return $core.withContext(function($ctx1) {
  16650. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16651. return $core.withContext(function($ctx2) {
  16652. return $recv($globals.String)._streamContents_((function(str){
  16653. return $core.withContext(function($ctx3) {
  16654. $recv(str)._write_("{");
  16655. $ctx3.sendIdx["write:"]=1;
  16656. $recv(traitComposition)._do_separatedBy_((function(each){
  16657. return $core.withContext(function($ctx4) {
  16658. return $recv(str)._write_($recv(each)._definition());
  16659. $ctx4.sendIdx["write:"]=2;
  16660. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16661. }),(function(){
  16662. return $core.withContext(function($ctx4) {
  16663. return $recv(str)._write_(". ");
  16664. $ctx4.sendIdx["write:"]=3;
  16665. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16666. }));
  16667. return $recv(str)._write_("}");
  16668. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16669. }));
  16670. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16671. }));
  16672. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16673. },
  16674. args: [],
  16675. 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: '}' ] ]",
  16676. referencedClasses: ["String"],
  16677. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16678. }),
  16679. $globals.TBehaviorProvider);
  16680. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16681. $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.";
  16682. $core.addMethod(
  16683. $core.method({
  16684. selector: "asJavaScriptSource",
  16685. protocol: "converting",
  16686. fn: function (){
  16687. var self=this,$self=this;
  16688. return $core.withContext(function($ctx1) {
  16689. return "$globals.".__comma($self._name());
  16690. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16691. },
  16692. args: [],
  16693. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16694. referencedClasses: [],
  16695. messageSends: [",", "name"]
  16696. }),
  16697. $globals.TMasterBehavior);
  16698. $core.addMethod(
  16699. $core.method({
  16700. selector: "browse",
  16701. protocol: "browsing",
  16702. fn: function (){
  16703. var self=this,$self=this;
  16704. return $core.withContext(function($ctx1) {
  16705. $recv($globals.Finder)._findClass_(self);
  16706. return self;
  16707. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16708. },
  16709. args: [],
  16710. source: "browse\x0a\x09Finder findClass: self",
  16711. referencedClasses: ["Finder"],
  16712. messageSends: ["findClass:"]
  16713. }),
  16714. $globals.TMasterBehavior);
  16715. $core.addMethod(
  16716. $core.method({
  16717. selector: "category",
  16718. protocol: "accessing",
  16719. fn: function (){
  16720. var self=this,$self=this;
  16721. return $core.withContext(function($ctx1) {
  16722. var $1,$receiver;
  16723. $1=$self._package();
  16724. $ctx1.sendIdx["package"]=1;
  16725. if(($receiver = $1) == null || $receiver.a$nil){
  16726. return "Unclassified";
  16727. } else {
  16728. return $recv($self._package())._name();
  16729. }
  16730. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16731. },
  16732. args: [],
  16733. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16734. referencedClasses: [],
  16735. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16736. }),
  16737. $globals.TMasterBehavior);
  16738. $core.addMethod(
  16739. $core.method({
  16740. selector: "classTag",
  16741. protocol: "accessing",
  16742. fn: function (){
  16743. var self=this,$self=this;
  16744. return $core.withContext(function($ctx1) {
  16745. return $self._subclassResponsibility();
  16746. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16747. },
  16748. args: [],
  16749. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16750. referencedClasses: [],
  16751. messageSends: ["subclassResponsibility"]
  16752. }),
  16753. $globals.TMasterBehavior);
  16754. $core.addMethod(
  16755. $core.method({
  16756. selector: "comment",
  16757. protocol: "accessing",
  16758. fn: function (){
  16759. var self=this,$self=this;
  16760. return $core.withContext(function($ctx1) {
  16761. var $1,$receiver;
  16762. $1=$self._basicAt_("comment");
  16763. if(($receiver = $1) == null || $receiver.a$nil){
  16764. return "";
  16765. } else {
  16766. return $1;
  16767. }
  16768. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16769. },
  16770. args: [],
  16771. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16772. referencedClasses: [],
  16773. messageSends: ["ifNil:", "basicAt:"]
  16774. }),
  16775. $globals.TMasterBehavior);
  16776. $core.addMethod(
  16777. $core.method({
  16778. selector: "comment:",
  16779. protocol: "accessing",
  16780. fn: function (aString){
  16781. var self=this,$self=this;
  16782. return $core.withContext(function($ctx1) {
  16783. var $1,$3,$2;
  16784. $self._basicAt_put_("comment",aString);
  16785. $1=$recv($globals.SystemAnnouncer)._current();
  16786. $3=$recv($globals.ClassCommentChanged)._new();
  16787. $recv($3)._theClass_(self);
  16788. $2=$recv($3)._yourself();
  16789. $recv($1)._announce_($2);
  16790. return self;
  16791. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16792. },
  16793. args: ["aString"],
  16794. 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)",
  16795. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16796. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16797. }),
  16798. $globals.TMasterBehavior);
  16799. $core.addMethod(
  16800. $core.method({
  16801. selector: "definedMethods",
  16802. protocol: "accessing",
  16803. fn: function (){
  16804. var self=this,$self=this;
  16805. var methods;
  16806. return $core.withContext(function($ctx1) {
  16807. var $1,$receiver;
  16808. methods=$self._methods();
  16809. $ctx1.sendIdx["methods"]=1;
  16810. $1=$self._theMetaClass();
  16811. if(($receiver = $1) == null || $receiver.a$nil){
  16812. return methods;
  16813. } else {
  16814. var meta;
  16815. meta=$receiver;
  16816. return $recv(methods).__comma($recv(meta)._methods());
  16817. }
  16818. return self;
  16819. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16820. },
  16821. args: [],
  16822. 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 ]",
  16823. referencedClasses: [],
  16824. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16825. }),
  16826. $globals.TMasterBehavior);
  16827. $core.addMethod(
  16828. $core.method({
  16829. selector: "enterOrganization",
  16830. protocol: "accessing",
  16831. fn: function (){
  16832. var self=this,$self=this;
  16833. return $core.withContext(function($ctx1) {
  16834. var $1,$receiver;
  16835. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16836. $globals.Smalltalk;
  16837. } else {
  16838. $1=$self._basicAt_("category");
  16839. if(($receiver = $1) == null || $receiver.a$nil){
  16840. $self._basicPackage_(nil);
  16841. $ctx1.sendIdx["basicPackage:"]=1;
  16842. } else {
  16843. var category;
  16844. category=$receiver;
  16845. $self._basicPackage_($recv($globals.Package)._named_(category));
  16846. $recv($recv($self._package())._organization())._addElement_(self);
  16847. }
  16848. }
  16849. return self;
  16850. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16851. },
  16852. args: [],
  16853. 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 ] ]",
  16854. referencedClasses: ["Smalltalk", "Package"],
  16855. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16856. }),
  16857. $globals.TMasterBehavior);
  16858. $core.addMethod(
  16859. $core.method({
  16860. selector: "leaveOrganization",
  16861. protocol: "accessing",
  16862. fn: function (){
  16863. var self=this,$self=this;
  16864. return $core.withContext(function($ctx1) {
  16865. var $receiver;
  16866. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16867. $globals.Smalltalk;
  16868. } else {
  16869. $recv($recv($self._package())._organization())._removeElement_(self);
  16870. }
  16871. return self;
  16872. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16873. },
  16874. args: [],
  16875. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16876. referencedClasses: ["Smalltalk"],
  16877. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16878. }),
  16879. $globals.TMasterBehavior);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "name",
  16883. protocol: "accessing",
  16884. fn: function (){
  16885. var self=this,$self=this;
  16886. return $core.withContext(function($ctx1) {
  16887. return self.name;
  16888. return self;
  16889. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16890. },
  16891. args: [],
  16892. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16893. referencedClasses: [],
  16894. messageSends: []
  16895. }),
  16896. $globals.TMasterBehavior);
  16897. $core.addMethod(
  16898. $core.method({
  16899. selector: "package:",
  16900. protocol: "accessing",
  16901. fn: function (aPackage){
  16902. var self=this,$self=this;
  16903. var oldPackage;
  16904. return $core.withContext(function($ctx1) {
  16905. var $2,$1,$3,$5,$4;
  16906. $2=$self._package();
  16907. $ctx1.sendIdx["package"]=1;
  16908. $1=$recv($2).__eq(aPackage);
  16909. if($core.assert($1)){
  16910. return self;
  16911. }
  16912. oldPackage=$self._package();
  16913. $self._leaveOrganization();
  16914. $self._basicAt_put_("category",aPackage);
  16915. $self._enterOrganization();
  16916. $3=$recv($globals.SystemAnnouncer)._current();
  16917. $5=$recv($globals.ClassMoved)._new();
  16918. $recv($5)._theClass_(self);
  16919. $recv($5)._oldPackage_(oldPackage);
  16920. $4=$recv($5)._yourself();
  16921. $recv($3)._announce_($4);
  16922. return self;
  16923. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16924. },
  16925. args: ["aPackage"],
  16926. 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;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16927. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16928. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16929. }),
  16930. $globals.TMasterBehavior);
  16931. $core.addMethod(
  16932. $core.method({
  16933. selector: "theNonMetaClass",
  16934. protocol: "accessing",
  16935. fn: function (){
  16936. var self=this,$self=this;
  16937. return self;
  16938. },
  16939. args: [],
  16940. source: "theNonMetaClass\x0a\x09^ self",
  16941. referencedClasses: [],
  16942. messageSends: []
  16943. }),
  16944. $globals.TMasterBehavior);
  16945. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16946. $core.addMethod(
  16947. $core.method({
  16948. selector: "-",
  16949. protocol: "composition",
  16950. fn: function (anArray){
  16951. var self=this,$self=this;
  16952. return $core.withContext(function($ctx1) {
  16953. return $recv($self._asTraitTransformation()).__minus(anArray);
  16954. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16955. },
  16956. args: ["anArray"],
  16957. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16958. referencedClasses: [],
  16959. messageSends: ["-", "asTraitTransformation"]
  16960. }),
  16961. $globals.Trait);
  16962. $core.addMethod(
  16963. $core.method({
  16964. selector: "@",
  16965. protocol: "composition",
  16966. fn: function (anArrayOfAssociations){
  16967. var self=this,$self=this;
  16968. return $core.withContext(function($ctx1) {
  16969. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16970. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16971. },
  16972. args: ["anArrayOfAssociations"],
  16973. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16974. referencedClasses: [],
  16975. messageSends: ["@", "asTraitTransformation"]
  16976. }),
  16977. $globals.Trait);
  16978. $core.addMethod(
  16979. $core.method({
  16980. selector: "asTraitComposition",
  16981. protocol: "converting",
  16982. fn: function (){
  16983. var self=this,$self=this;
  16984. return $core.withContext(function($ctx1) {
  16985. return $recv($self._asTraitTransformation())._asTraitComposition();
  16986. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16987. },
  16988. args: [],
  16989. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16990. referencedClasses: [],
  16991. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16992. }),
  16993. $globals.Trait);
  16994. $core.addMethod(
  16995. $core.method({
  16996. selector: "asTraitTransformation",
  16997. protocol: "converting",
  16998. fn: function (){
  16999. var self=this,$self=this;
  17000. return $core.withContext(function($ctx1) {
  17001. return $recv($globals.TraitTransformation)._on_(self);
  17002. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  17003. },
  17004. args: [],
  17005. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  17006. referencedClasses: ["TraitTransformation"],
  17007. messageSends: ["on:"]
  17008. }),
  17009. $globals.Trait);
  17010. $core.addMethod(
  17011. $core.method({
  17012. selector: "basicOrganization",
  17013. protocol: "accessing",
  17014. fn: function (){
  17015. var self=this,$self=this;
  17016. return $self["@organization"];
  17017. },
  17018. args: [],
  17019. source: "basicOrganization\x0a\x09^ organization",
  17020. referencedClasses: [],
  17021. messageSends: []
  17022. }),
  17023. $globals.Trait);
  17024. $core.addMethod(
  17025. $core.method({
  17026. selector: "basicOrganization:",
  17027. protocol: "accessing",
  17028. fn: function (aClassOrganizer){
  17029. var self=this,$self=this;
  17030. $self["@organization"]=aClassOrganizer;
  17031. return self;
  17032. },
  17033. args: ["aClassOrganizer"],
  17034. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  17035. referencedClasses: [],
  17036. messageSends: []
  17037. }),
  17038. $globals.Trait);
  17039. $core.addMethod(
  17040. $core.method({
  17041. selector: "basicPackage:",
  17042. protocol: "accessing",
  17043. fn: function (aPackage){
  17044. var self=this,$self=this;
  17045. $self["@package"]=aPackage;
  17046. return self;
  17047. },
  17048. args: ["aPackage"],
  17049. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  17050. referencedClasses: [],
  17051. messageSends: []
  17052. }),
  17053. $globals.Trait);
  17054. $core.addMethod(
  17055. $core.method({
  17056. selector: "classTag",
  17057. protocol: "accessing",
  17058. fn: function (){
  17059. var self=this,$self=this;
  17060. return "trait";
  17061. },
  17062. args: [],
  17063. source: "classTag\x0a\x09^ 'trait'",
  17064. referencedClasses: [],
  17065. messageSends: []
  17066. }),
  17067. $globals.Trait);
  17068. $core.addMethod(
  17069. $core.method({
  17070. selector: "definition",
  17071. protocol: "accessing",
  17072. fn: function (){
  17073. var self=this,$self=this;
  17074. return $core.withContext(function($ctx1) {
  17075. var $1;
  17076. return $recv($globals.String)._streamContents_((function(stream){
  17077. return $core.withContext(function($ctx2) {
  17078. $recv(stream)._write_("Trait named: ");
  17079. $ctx2.sendIdx["write:"]=1;
  17080. $recv(stream)._printSymbol_($self._name());
  17081. $recv(stream)._lf();
  17082. $ctx2.sendIdx["lf"]=1;
  17083. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17084. return $core.withContext(function($ctx3) {
  17085. $1=$recv($globals.String)._tab();
  17086. $ctx3.sendIdx["tab"]=1;
  17087. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17088. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17089. })));
  17090. $ctx2.sendIdx["write:"]=2;
  17091. $recv(stream)._tab();
  17092. $recv(stream)._write_("package: ");
  17093. return $recv(stream)._print_($self._category());
  17094. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17095. }));
  17096. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  17097. },
  17098. args: [],
  17099. 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 ]",
  17100. referencedClasses: ["String"],
  17101. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17102. }),
  17103. $globals.Trait);
  17104. $core.addMethod(
  17105. $core.method({
  17106. selector: "package",
  17107. protocol: "accessing",
  17108. fn: function (){
  17109. var self=this,$self=this;
  17110. return $self["@package"];
  17111. },
  17112. args: [],
  17113. source: "package\x0a\x09^ package",
  17114. referencedClasses: [],
  17115. messageSends: []
  17116. }),
  17117. $globals.Trait);
  17118. $core.addMethod(
  17119. $core.method({
  17120. selector: "theMetaClass",
  17121. protocol: "accessing",
  17122. fn: function (){
  17123. var self=this,$self=this;
  17124. return nil;
  17125. },
  17126. args: [],
  17127. source: "theMetaClass\x0a\x09^ nil",
  17128. referencedClasses: [],
  17129. messageSends: []
  17130. }),
  17131. $globals.Trait);
  17132. $core.addMethod(
  17133. $core.method({
  17134. selector: "traitUsers",
  17135. protocol: "accessing",
  17136. fn: function (){
  17137. var self=this,$self=this;
  17138. return $core.withContext(function($ctx1) {
  17139. return $recv($self._basicAt_("traitUsers"))._copy();
  17140. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17141. },
  17142. args: [],
  17143. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  17144. referencedClasses: [],
  17145. messageSends: ["copy", "basicAt:"]
  17146. }),
  17147. $globals.Trait);
  17148. $core.addMethod(
  17149. $core.method({
  17150. selector: "named:package:",
  17151. protocol: "instance creation",
  17152. fn: function (aString,anotherString){
  17153. var self=this,$self=this;
  17154. return $core.withContext(function($ctx1) {
  17155. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17156. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17157. },
  17158. args: ["aString", "anotherString"],
  17159. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17160. referencedClasses: ["ClassBuilder"],
  17161. messageSends: ["addTraitNamed:package:", "new"]
  17162. }),
  17163. $globals.Trait.a$cls);
  17164. $core.addMethod(
  17165. $core.method({
  17166. selector: "named:uses:package:",
  17167. protocol: "instance creation",
  17168. fn: function (aString,aTraitCompositionDescription,anotherString){
  17169. var self=this,$self=this;
  17170. var trait;
  17171. return $core.withContext(function($ctx1) {
  17172. trait=$self._named_package_(aString,anotherString);
  17173. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17174. return trait;
  17175. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17176. },
  17177. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17178. 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",
  17179. referencedClasses: [],
  17180. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17181. }),
  17182. $globals.Trait.a$cls);
  17183. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17184. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17185. $core.addMethod(
  17186. $core.method({
  17187. selector: "-",
  17188. protocol: "composition",
  17189. fn: function (anArray){
  17190. var self=this,$self=this;
  17191. return $core.withContext(function($ctx1) {
  17192. var $1;
  17193. $1=$self._copy();
  17194. $recv($1)._addExclusions_(anArray);
  17195. return $recv($1)._yourself();
  17196. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17197. },
  17198. args: ["anArray"],
  17199. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17200. referencedClasses: [],
  17201. messageSends: ["addExclusions:", "copy", "yourself"]
  17202. }),
  17203. $globals.TraitTransformation);
  17204. $core.addMethod(
  17205. $core.method({
  17206. selector: "@",
  17207. protocol: "composition",
  17208. fn: function (anArrayOfAssociations){
  17209. var self=this,$self=this;
  17210. return $core.withContext(function($ctx1) {
  17211. var $1;
  17212. $1=$self._copy();
  17213. $recv($1)._addAliases_(anArrayOfAssociations);
  17214. return $recv($1)._yourself();
  17215. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17216. },
  17217. args: ["anArrayOfAssociations"],
  17218. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17219. referencedClasses: [],
  17220. messageSends: ["addAliases:", "copy", "yourself"]
  17221. }),
  17222. $globals.TraitTransformation);
  17223. $core.addMethod(
  17224. $core.method({
  17225. selector: "addAliases:",
  17226. protocol: "accessing",
  17227. fn: function (anArrayOfAssociations){
  17228. var self=this,$self=this;
  17229. return $core.withContext(function($ctx1) {
  17230. $recv(anArrayOfAssociations)._do_((function(each){
  17231. var key;
  17232. return $core.withContext(function($ctx2) {
  17233. key=$recv(each)._key();
  17234. key;
  17235. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17236. return $core.withContext(function($ctx3) {
  17237. return $self._error_("Cannot use same alias name twice.");
  17238. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17239. }),(function(){
  17240. return $core.withContext(function($ctx3) {
  17241. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17242. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17243. }));
  17244. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17245. }));
  17246. return anArrayOfAssociations;
  17247. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17248. },
  17249. args: ["anArrayOfAssociations"],
  17250. 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",
  17251. referencedClasses: [],
  17252. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17253. }),
  17254. $globals.TraitTransformation);
  17255. $core.addMethod(
  17256. $core.method({
  17257. selector: "addExclusions:",
  17258. protocol: "accessing",
  17259. fn: function (anArray){
  17260. var self=this,$self=this;
  17261. return $core.withContext(function($ctx1) {
  17262. $recv($self["@exclusions"])._addAll_(anArray);
  17263. return anArray;
  17264. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17265. },
  17266. args: ["anArray"],
  17267. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17268. referencedClasses: [],
  17269. messageSends: ["addAll:"]
  17270. }),
  17271. $globals.TraitTransformation);
  17272. $core.addMethod(
  17273. $core.method({
  17274. selector: "aliases",
  17275. protocol: "accessing",
  17276. fn: function (){
  17277. var self=this,$self=this;
  17278. return $self["@aliases"];
  17279. },
  17280. args: [],
  17281. source: "aliases\x0a\x09^ aliases",
  17282. referencedClasses: [],
  17283. messageSends: []
  17284. }),
  17285. $globals.TraitTransformation);
  17286. $core.addMethod(
  17287. $core.method({
  17288. selector: "asJavaScriptObject",
  17289. protocol: "converting",
  17290. fn: function (){
  17291. var self=this,$self=this;
  17292. return $core.withContext(function($ctx1) {
  17293. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17294. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17295. },
  17296. args: [],
  17297. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17298. referencedClasses: [],
  17299. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17300. }),
  17301. $globals.TraitTransformation);
  17302. $core.addMethod(
  17303. $core.method({
  17304. selector: "asJavaScriptSource",
  17305. protocol: "converting",
  17306. fn: function (){
  17307. var self=this,$self=this;
  17308. return $core.withContext(function($ctx1) {
  17309. var $2,$3,$1;
  17310. return $recv($globals.String)._streamContents_((function(str){
  17311. return $core.withContext(function($ctx2) {
  17312. $2=$recv($self._trait())._asJavaScriptSource();
  17313. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17314. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17315. return $core.withContext(function($ctx3) {
  17316. return [", aliases: ",$recv(al)._asJSONString()];
  17317. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17318. }));
  17319. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17320. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17321. return $core.withContext(function($ctx3) {
  17322. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17323. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17324. })),"}"];
  17325. return $recv(str)._write_($1);
  17326. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17327. }));
  17328. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17329. },
  17330. args: [],
  17331. 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'}' } ]",
  17332. referencedClasses: ["String"],
  17333. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17334. }),
  17335. $globals.TraitTransformation);
  17336. $core.addMethod(
  17337. $core.method({
  17338. selector: "asTraitComposition",
  17339. protocol: "converting",
  17340. fn: function (){
  17341. var self=this,$self=this;
  17342. return [self];
  17343. },
  17344. args: [],
  17345. source: "asTraitComposition\x0a\x09^ { self }",
  17346. referencedClasses: [],
  17347. messageSends: []
  17348. }),
  17349. $globals.TraitTransformation);
  17350. $core.addMethod(
  17351. $core.method({
  17352. selector: "asTraitTransformation",
  17353. protocol: "converting",
  17354. fn: function (){
  17355. var self=this,$self=this;
  17356. return self;
  17357. },
  17358. args: [],
  17359. source: "asTraitTransformation\x0a\x09^ self",
  17360. referencedClasses: [],
  17361. messageSends: []
  17362. }),
  17363. $globals.TraitTransformation);
  17364. $core.addMethod(
  17365. $core.method({
  17366. selector: "definition",
  17367. protocol: "accessing",
  17368. fn: function (){
  17369. var self=this,$self=this;
  17370. return $core.withContext(function($ctx1) {
  17371. return $recv($globals.String)._streamContents_((function(str){
  17372. return $core.withContext(function($ctx2) {
  17373. $recv(str)._print_($self._trait());
  17374. $recv($self._aliases())._ifNotEmpty_((function(al){
  17375. return $core.withContext(function($ctx3) {
  17376. $recv(str)._write_(" @ {");
  17377. $ctx3.sendIdx["write:"]=1;
  17378. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17379. return $core.withContext(function($ctx4) {
  17380. $recv(str)._printSymbol_($recv(each)._key());
  17381. $ctx4.sendIdx["printSymbol:"]=1;
  17382. $recv(str)._write_(" -> ");
  17383. $ctx4.sendIdx["write:"]=2;
  17384. return $recv(str)._printSymbol_($recv(each)._value());
  17385. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17386. }),(function(){
  17387. return $core.withContext(function($ctx4) {
  17388. return $recv(str)._write_(". ");
  17389. $ctx4.sendIdx["write:"]=3;
  17390. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17391. }));
  17392. $ctx3.sendIdx["do:separatedBy:"]=1;
  17393. return $recv(str)._write_("}");
  17394. $ctx3.sendIdx["write:"]=4;
  17395. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17396. }));
  17397. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17398. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17399. return $core.withContext(function($ctx3) {
  17400. $recv(str)._write_(" - #(");
  17401. $ctx3.sendIdx["write:"]=5;
  17402. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17403. return $core.withContext(function($ctx4) {
  17404. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17405. $ctx4.sendIdx["write:"]=6;
  17406. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17407. }),(function(){
  17408. return $core.withContext(function($ctx4) {
  17409. return $recv(str)._space();
  17410. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17411. }));
  17412. return $recv(str)._write_(")");
  17413. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17414. }));
  17415. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17416. }));
  17417. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17418. },
  17419. args: [],
  17420. 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: ')' ] ]",
  17421. referencedClasses: ["String"],
  17422. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17423. }),
  17424. $globals.TraitTransformation);
  17425. $core.addMethod(
  17426. $core.method({
  17427. selector: "exclusions",
  17428. protocol: "accessing",
  17429. fn: function (){
  17430. var self=this,$self=this;
  17431. return $self["@exclusions"];
  17432. },
  17433. args: [],
  17434. source: "exclusions\x0a\x09^ exclusions",
  17435. referencedClasses: [],
  17436. messageSends: []
  17437. }),
  17438. $globals.TraitTransformation);
  17439. $core.addMethod(
  17440. $core.method({
  17441. selector: "initialize",
  17442. protocol: "initialization",
  17443. fn: function (){
  17444. var self=this,$self=this;
  17445. return $core.withContext(function($ctx1) {
  17446. (
  17447. $ctx1.supercall = true,
  17448. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17449. $ctx1.supercall = false;
  17450. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17451. $self["@exclusions"]=$recv($globals.Set)._new();
  17452. $self["@trait"]=nil;
  17453. return self;
  17454. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17455. },
  17456. args: [],
  17457. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17458. referencedClasses: ["Set"],
  17459. messageSends: ["initialize", "new"]
  17460. }),
  17461. $globals.TraitTransformation);
  17462. $core.addMethod(
  17463. $core.method({
  17464. selector: "postCopy",
  17465. protocol: "copying",
  17466. fn: function (){
  17467. var self=this,$self=this;
  17468. return $core.withContext(function($ctx1) {
  17469. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17470. $ctx1.sendIdx["copy"]=1;
  17471. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17472. return self;
  17473. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17474. },
  17475. args: [],
  17476. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17477. referencedClasses: [],
  17478. messageSends: ["copy"]
  17479. }),
  17480. $globals.TraitTransformation);
  17481. $core.addMethod(
  17482. $core.method({
  17483. selector: "trait",
  17484. protocol: "accessing",
  17485. fn: function (){
  17486. var self=this,$self=this;
  17487. return $self["@trait"];
  17488. },
  17489. args: [],
  17490. source: "trait\x0a\x09^ trait",
  17491. referencedClasses: [],
  17492. messageSends: []
  17493. }),
  17494. $globals.TraitTransformation);
  17495. $core.addMethod(
  17496. $core.method({
  17497. selector: "trait:",
  17498. protocol: "accessing",
  17499. fn: function (anObject){
  17500. var self=this,$self=this;
  17501. $self["@trait"]=anObject;
  17502. return self;
  17503. },
  17504. args: ["anObject"],
  17505. source: "trait: anObject\x0a\x09trait := anObject",
  17506. referencedClasses: [],
  17507. messageSends: []
  17508. }),
  17509. $globals.TraitTransformation);
  17510. $core.addMethod(
  17511. $core.method({
  17512. selector: "fromJSON:",
  17513. protocol: "instance creation",
  17514. fn: function (aJSObject){
  17515. var self=this,$self=this;
  17516. return $core.withContext(function($ctx1) {
  17517. var $1,$4,$3,$2;
  17518. $1=(
  17519. $ctx1.supercall = true,
  17520. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17521. $ctx1.supercall = false;
  17522. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17523. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17524. return $globals.HashedCollection._newFromPairs_([]);
  17525. }));
  17526. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17527. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17528. $2=$recv($3)._associations();
  17529. $recv($1)._addAliases_($2);
  17530. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17531. return [];
  17532. })));
  17533. return $recv($1)._yourself();
  17534. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17535. },
  17536. args: ["aJSObject"],
  17537. 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",
  17538. referencedClasses: ["Smalltalk"],
  17539. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17540. }),
  17541. $globals.TraitTransformation.a$cls);
  17542. $core.addMethod(
  17543. $core.method({
  17544. selector: "on:",
  17545. protocol: "instance creation",
  17546. fn: function (aTrait){
  17547. var self=this,$self=this;
  17548. return $core.withContext(function($ctx1) {
  17549. var $1;
  17550. $1=(
  17551. $ctx1.supercall = true,
  17552. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17553. $ctx1.supercall = false;
  17554. $recv($1)._trait_(aTrait);
  17555. return $recv($1)._yourself();
  17556. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17557. },
  17558. args: ["aTrait"],
  17559. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17560. referencedClasses: [],
  17561. messageSends: ["trait:", "new", "yourself"]
  17562. }),
  17563. $globals.TraitTransformation.a$cls);
  17564. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17565. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17566. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17567. $core.addMethod(
  17568. $core.method({
  17569. selector: "asTraitComposition",
  17570. protocol: "*Kernel-Classes",
  17571. fn: function (){
  17572. var self=this,$self=this;
  17573. return $core.withContext(function($ctx1) {
  17574. return $self._collect_((function(each){
  17575. return $core.withContext(function($ctx2) {
  17576. return $recv(each)._asTraitTransformation();
  17577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17578. }));
  17579. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17580. },
  17581. args: [],
  17582. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17583. referencedClasses: [],
  17584. messageSends: ["collect:", "asTraitTransformation"]
  17585. }),
  17586. $globals.Array);
  17587. });
  17588. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17589. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17590. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17591. $core.addPackage("Kernel-Methods");
  17592. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17593. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17594. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17595. $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 | ... ] `";
  17596. $core.addMethod(
  17597. $core.method({
  17598. selector: "applyTo:arguments:",
  17599. protocol: "evaluating",
  17600. fn: function (anObject,aCollection){
  17601. var self=this,$self=this;
  17602. return $core.withContext(function($ctx1) {
  17603. return self.apply(anObject, aCollection);
  17604. return self;
  17605. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17606. },
  17607. args: ["anObject", "aCollection"],
  17608. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17609. referencedClasses: [],
  17610. messageSends: []
  17611. }),
  17612. $globals.BlockClosure);
  17613. $core.addMethod(
  17614. $core.method({
  17615. selector: "asCompiledMethod:",
  17616. protocol: "converting",
  17617. fn: function (aString){
  17618. var self=this,$self=this;
  17619. return $core.withContext(function($ctx1) {
  17620. return $core.method({selector:aString, fn:self});;
  17621. return self;
  17622. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17623. },
  17624. args: ["aString"],
  17625. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17626. referencedClasses: [],
  17627. messageSends: []
  17628. }),
  17629. $globals.BlockClosure);
  17630. $core.addMethod(
  17631. $core.method({
  17632. selector: "compiledSource",
  17633. protocol: "accessing",
  17634. fn: function (){
  17635. var self=this,$self=this;
  17636. return $core.withContext(function($ctx1) {
  17637. return self.toString();
  17638. return self;
  17639. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17640. },
  17641. args: [],
  17642. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17643. referencedClasses: [],
  17644. messageSends: []
  17645. }),
  17646. $globals.BlockClosure);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "currySelf",
  17650. protocol: "converting",
  17651. fn: function (){
  17652. var self=this,$self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. return function () {
  17655. var args = [ this ];
  17656. args.push.apply(args, arguments);
  17657. return self.apply(null, args);
  17658. }
  17659. ;
  17660. return self;
  17661. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17662. },
  17663. args: [],
  17664. 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'>",
  17665. referencedClasses: [],
  17666. messageSends: []
  17667. }),
  17668. $globals.BlockClosure);
  17669. $core.addMethod(
  17670. $core.method({
  17671. selector: "ensure:",
  17672. protocol: "evaluating",
  17673. fn: function (aBlock){
  17674. var self=this,$self=this;
  17675. return $core.withContext(function($ctx1) {
  17676. try{return $self._value()}finally{aBlock._value()};
  17677. return self;
  17678. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17679. },
  17680. args: ["aBlock"],
  17681. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17682. referencedClasses: [],
  17683. messageSends: []
  17684. }),
  17685. $globals.BlockClosure);
  17686. $core.addMethod(
  17687. $core.method({
  17688. selector: "fork",
  17689. protocol: "timeout/interval",
  17690. fn: function (){
  17691. var self=this,$self=this;
  17692. return $core.withContext(function($ctx1) {
  17693. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17694. return self;
  17695. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17696. },
  17697. args: [],
  17698. source: "fork\x0a\x09ForkPool default fork: self",
  17699. referencedClasses: ["ForkPool"],
  17700. messageSends: ["fork:", "default"]
  17701. }),
  17702. $globals.BlockClosure);
  17703. $core.addMethod(
  17704. $core.method({
  17705. selector: "new",
  17706. protocol: "evaluating",
  17707. fn: function (){
  17708. var self=this,$self=this;
  17709. return $core.withContext(function($ctx1) {
  17710. return new self();
  17711. return self;
  17712. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17713. },
  17714. args: [],
  17715. 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()'>",
  17716. referencedClasses: [],
  17717. messageSends: []
  17718. }),
  17719. $globals.BlockClosure);
  17720. $core.addMethod(
  17721. $core.method({
  17722. selector: "newValue:",
  17723. protocol: "evaluating",
  17724. fn: function (anObject){
  17725. var self=this,$self=this;
  17726. return $core.withContext(function($ctx1) {
  17727. return $self._newWithValues_([anObject]);
  17728. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17729. },
  17730. args: ["anObject"],
  17731. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17732. referencedClasses: [],
  17733. messageSends: ["newWithValues:"]
  17734. }),
  17735. $globals.BlockClosure);
  17736. $core.addMethod(
  17737. $core.method({
  17738. selector: "newValue:value:",
  17739. protocol: "evaluating",
  17740. fn: function (anObject,anObject2){
  17741. var self=this,$self=this;
  17742. return $core.withContext(function($ctx1) {
  17743. return $self._newWithValues_([anObject,anObject2]);
  17744. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17745. },
  17746. args: ["anObject", "anObject2"],
  17747. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17748. referencedClasses: [],
  17749. messageSends: ["newWithValues:"]
  17750. }),
  17751. $globals.BlockClosure);
  17752. $core.addMethod(
  17753. $core.method({
  17754. selector: "newValue:value:value:",
  17755. protocol: "evaluating",
  17756. fn: function (anObject,anObject2,anObject3){
  17757. var self=this,$self=this;
  17758. return $core.withContext(function($ctx1) {
  17759. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17760. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17761. },
  17762. args: ["anObject", "anObject2", "anObject3"],
  17763. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17764. referencedClasses: [],
  17765. messageSends: ["newWithValues:"]
  17766. }),
  17767. $globals.BlockClosure);
  17768. $core.addMethod(
  17769. $core.method({
  17770. selector: "newWithValues:",
  17771. protocol: "evaluating",
  17772. fn: function (aCollection){
  17773. var self=this,$self=this;
  17774. return $core.withContext(function($ctx1) {
  17775. var object = Object.create(self.prototype);
  17776. var result = self.apply(object, aCollection);
  17777. return typeof result === "object" ? result : object;
  17778. ;
  17779. return self;
  17780. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17781. },
  17782. args: ["aCollection"],
  17783. 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'>",
  17784. referencedClasses: [],
  17785. messageSends: []
  17786. }),
  17787. $globals.BlockClosure);
  17788. $core.addMethod(
  17789. $core.method({
  17790. selector: "numArgs",
  17791. protocol: "accessing",
  17792. fn: function (){
  17793. var self=this,$self=this;
  17794. return $core.withContext(function($ctx1) {
  17795. return self.length;
  17796. return self;
  17797. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17798. },
  17799. args: [],
  17800. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17801. referencedClasses: [],
  17802. messageSends: []
  17803. }),
  17804. $globals.BlockClosure);
  17805. $core.addMethod(
  17806. $core.method({
  17807. selector: "on:do:",
  17808. protocol: "error handling",
  17809. fn: function (anErrorClass,aBlock){
  17810. var self=this,$self=this;
  17811. return $core.withContext(function($ctx1) {
  17812. var $1;
  17813. return $self._tryCatch_((function(error){
  17814. var smalltalkError;
  17815. return $core.withContext(function($ctx2) {
  17816. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17817. smalltalkError;
  17818. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17819. if($core.assert($1)){
  17820. return $recv(aBlock)._value_(smalltalkError);
  17821. } else {
  17822. return $recv(smalltalkError)._resignal();
  17823. }
  17824. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17825. }));
  17826. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17827. },
  17828. args: ["anErrorClass", "aBlock"],
  17829. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  17830. referencedClasses: ["Smalltalk"],
  17831. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  17832. }),
  17833. $globals.BlockClosure);
  17834. $core.addMethod(
  17835. $core.method({
  17836. selector: "receiver",
  17837. protocol: "accessing",
  17838. fn: function (){
  17839. var self=this,$self=this;
  17840. return nil;
  17841. },
  17842. args: [],
  17843. source: "receiver\x0a\x09^ nil",
  17844. referencedClasses: [],
  17845. messageSends: []
  17846. }),
  17847. $globals.BlockClosure);
  17848. $core.addMethod(
  17849. $core.method({
  17850. selector: "timeToRun",
  17851. protocol: "evaluating",
  17852. fn: function (){
  17853. var self=this,$self=this;
  17854. return $core.withContext(function($ctx1) {
  17855. return $recv($globals.Date)._millisecondsToRun_(self);
  17856. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17857. },
  17858. args: [],
  17859. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17860. referencedClasses: ["Date"],
  17861. messageSends: ["millisecondsToRun:"]
  17862. }),
  17863. $globals.BlockClosure);
  17864. $core.addMethod(
  17865. $core.method({
  17866. selector: "tryCatch:",
  17867. protocol: "error handling",
  17868. fn: function (aBlock){
  17869. var self=this,$self=this;
  17870. return $core.withContext(function($ctx1) {
  17871. try {
  17872. return $self._value();
  17873. } catch(error) {
  17874. // pass non-local returns undetected
  17875. if (Array.isArray(error) && error.length === 1) throw error;
  17876. return aBlock._value_(error);
  17877. }
  17878. ;
  17879. return self;
  17880. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17881. },
  17882. args: ["aBlock"],
  17883. 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'>",
  17884. referencedClasses: [],
  17885. messageSends: []
  17886. }),
  17887. $globals.BlockClosure);
  17888. $core.addMethod(
  17889. $core.method({
  17890. selector: "value",
  17891. protocol: "evaluating",
  17892. fn: function (){
  17893. var self=this,$self=this;
  17894. return $core.withContext(function($ctx1) {
  17895. return self();;
  17896. return self;
  17897. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17898. },
  17899. args: [],
  17900. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17901. referencedClasses: [],
  17902. messageSends: []
  17903. }),
  17904. $globals.BlockClosure);
  17905. $core.addMethod(
  17906. $core.method({
  17907. selector: "value:",
  17908. protocol: "evaluating",
  17909. fn: function (anArg){
  17910. var self=this,$self=this;
  17911. return $core.withContext(function($ctx1) {
  17912. return self(anArg);;
  17913. return self;
  17914. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17915. },
  17916. args: ["anArg"],
  17917. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17918. referencedClasses: [],
  17919. messageSends: []
  17920. }),
  17921. $globals.BlockClosure);
  17922. $core.addMethod(
  17923. $core.method({
  17924. selector: "value:value:",
  17925. protocol: "evaluating",
  17926. fn: function (firstArg,secondArg){
  17927. var self=this,$self=this;
  17928. return $core.withContext(function($ctx1) {
  17929. return self(firstArg, secondArg);;
  17930. return self;
  17931. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17932. },
  17933. args: ["firstArg", "secondArg"],
  17934. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17935. referencedClasses: [],
  17936. messageSends: []
  17937. }),
  17938. $globals.BlockClosure);
  17939. $core.addMethod(
  17940. $core.method({
  17941. selector: "value:value:value:",
  17942. protocol: "evaluating",
  17943. fn: function (firstArg,secondArg,thirdArg){
  17944. var self=this,$self=this;
  17945. return $core.withContext(function($ctx1) {
  17946. return self(firstArg, secondArg, thirdArg);;
  17947. return self;
  17948. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17949. },
  17950. args: ["firstArg", "secondArg", "thirdArg"],
  17951. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17952. referencedClasses: [],
  17953. messageSends: []
  17954. }),
  17955. $globals.BlockClosure);
  17956. $core.addMethod(
  17957. $core.method({
  17958. selector: "valueWithInterval:",
  17959. protocol: "timeout/interval",
  17960. fn: function (aNumber){
  17961. var self=this,$self=this;
  17962. return $core.withContext(function($ctx1) {
  17963. var interval = setInterval(self, aNumber);
  17964. return $globals.Timeout._on_(interval);
  17965. ;
  17966. return self;
  17967. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17968. },
  17969. args: ["aNumber"],
  17970. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17971. referencedClasses: [],
  17972. messageSends: []
  17973. }),
  17974. $globals.BlockClosure);
  17975. $core.addMethod(
  17976. $core.method({
  17977. selector: "valueWithPossibleArguments:",
  17978. protocol: "evaluating",
  17979. fn: function (aCollection){
  17980. var self=this,$self=this;
  17981. return $core.withContext(function($ctx1) {
  17982. return self.apply(null, aCollection);;
  17983. return self;
  17984. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17985. },
  17986. args: ["aCollection"],
  17987. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17988. referencedClasses: [],
  17989. messageSends: []
  17990. }),
  17991. $globals.BlockClosure);
  17992. $core.addMethod(
  17993. $core.method({
  17994. selector: "valueWithTimeout:",
  17995. protocol: "timeout/interval",
  17996. fn: function (aNumber){
  17997. var self=this,$self=this;
  17998. return $core.withContext(function($ctx1) {
  17999. var timeout = setTimeout(self, aNumber);
  18000. return $globals.Timeout._on_(timeout);
  18001. ;
  18002. return self;
  18003. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  18004. },
  18005. args: ["aNumber"],
  18006. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  18007. referencedClasses: [],
  18008. messageSends: []
  18009. }),
  18010. $globals.BlockClosure);
  18011. $core.addMethod(
  18012. $core.method({
  18013. selector: "whileFalse",
  18014. protocol: "controlling",
  18015. fn: function (){
  18016. var self=this,$self=this;
  18017. return $core.withContext(function($ctx1) {
  18018. $self._whileFalse_((function(){
  18019. }));
  18020. return self;
  18021. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  18022. },
  18023. args: [],
  18024. source: "whileFalse\x0a\x09self whileFalse: []",
  18025. referencedClasses: [],
  18026. messageSends: ["whileFalse:"]
  18027. }),
  18028. $globals.BlockClosure);
  18029. $core.addMethod(
  18030. $core.method({
  18031. selector: "whileFalse:",
  18032. protocol: "controlling",
  18033. fn: function (aBlock){
  18034. var self=this,$self=this;
  18035. return $core.withContext(function($ctx1) {
  18036. while(!$core.assert($self._value())) {aBlock._value()};
  18037. return self;
  18038. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  18039. },
  18040. args: ["aBlock"],
  18041. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  18042. referencedClasses: [],
  18043. messageSends: []
  18044. }),
  18045. $globals.BlockClosure);
  18046. $core.addMethod(
  18047. $core.method({
  18048. selector: "whileTrue",
  18049. protocol: "controlling",
  18050. fn: function (){
  18051. var self=this,$self=this;
  18052. return $core.withContext(function($ctx1) {
  18053. $self._whileTrue_((function(){
  18054. }));
  18055. return self;
  18056. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  18057. },
  18058. args: [],
  18059. source: "whileTrue\x0a\x09self whileTrue: []",
  18060. referencedClasses: [],
  18061. messageSends: ["whileTrue:"]
  18062. }),
  18063. $globals.BlockClosure);
  18064. $core.addMethod(
  18065. $core.method({
  18066. selector: "whileTrue:",
  18067. protocol: "controlling",
  18068. fn: function (aBlock){
  18069. var self=this,$self=this;
  18070. return $core.withContext(function($ctx1) {
  18071. while($core.assert($self._value())) {aBlock._value()};
  18072. return self;
  18073. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  18074. },
  18075. args: ["aBlock"],
  18076. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18077. referencedClasses: [],
  18078. messageSends: []
  18079. }),
  18080. $globals.BlockClosure);
  18081. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  18082. $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";
  18083. $core.addMethod(
  18084. $core.method({
  18085. selector: "arguments",
  18086. protocol: "accessing",
  18087. fn: function (){
  18088. var self=this,$self=this;
  18089. return $core.withContext(function($ctx1) {
  18090. return self.args || [];
  18091. return self;
  18092. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18093. },
  18094. args: [],
  18095. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  18096. referencedClasses: [],
  18097. messageSends: []
  18098. }),
  18099. $globals.CompiledMethod);
  18100. $core.addMethod(
  18101. $core.method({
  18102. selector: "browse",
  18103. protocol: "browsing",
  18104. fn: function (){
  18105. var self=this,$self=this;
  18106. return $core.withContext(function($ctx1) {
  18107. $recv($globals.Finder)._findMethod_(self);
  18108. return self;
  18109. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18110. },
  18111. args: [],
  18112. source: "browse\x0a\x09Finder findMethod: self",
  18113. referencedClasses: ["Finder"],
  18114. messageSends: ["findMethod:"]
  18115. }),
  18116. $globals.CompiledMethod);
  18117. $core.addMethod(
  18118. $core.method({
  18119. selector: "category",
  18120. protocol: "accessing",
  18121. fn: function (){
  18122. var self=this,$self=this;
  18123. return $core.withContext(function($ctx1) {
  18124. return $self._protocol();
  18125. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18126. },
  18127. args: [],
  18128. source: "category\x0a\x09^ self protocol",
  18129. referencedClasses: [],
  18130. messageSends: ["protocol"]
  18131. }),
  18132. $globals.CompiledMethod);
  18133. $core.addMethod(
  18134. $core.method({
  18135. selector: "defaultProtocol",
  18136. protocol: "defaults",
  18137. fn: function (){
  18138. var self=this,$self=this;
  18139. return "as yet unclassified";
  18140. },
  18141. args: [],
  18142. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18143. referencedClasses: [],
  18144. messageSends: []
  18145. }),
  18146. $globals.CompiledMethod);
  18147. $core.addMethod(
  18148. $core.method({
  18149. selector: "fn",
  18150. protocol: "accessing",
  18151. fn: function (){
  18152. var self=this,$self=this;
  18153. return $core.withContext(function($ctx1) {
  18154. return $self._basicAt_("fn");
  18155. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18156. },
  18157. args: [],
  18158. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18159. referencedClasses: [],
  18160. messageSends: ["basicAt:"]
  18161. }),
  18162. $globals.CompiledMethod);
  18163. $core.addMethod(
  18164. $core.method({
  18165. selector: "fn:",
  18166. protocol: "accessing",
  18167. fn: function (aBlock){
  18168. var self=this,$self=this;
  18169. return $core.withContext(function($ctx1) {
  18170. $self._basicAt_put_("fn",aBlock);
  18171. return self;
  18172. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18173. },
  18174. args: ["aBlock"],
  18175. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18176. referencedClasses: [],
  18177. messageSends: ["basicAt:put:"]
  18178. }),
  18179. $globals.CompiledMethod);
  18180. $core.addMethod(
  18181. $core.method({
  18182. selector: "isCompiledMethod",
  18183. protocol: "testing",
  18184. fn: function (){
  18185. var self=this,$self=this;
  18186. return true;
  18187. },
  18188. args: [],
  18189. source: "isCompiledMethod\x0a\x09^ true",
  18190. referencedClasses: [],
  18191. messageSends: []
  18192. }),
  18193. $globals.CompiledMethod);
  18194. $core.addMethod(
  18195. $core.method({
  18196. selector: "isOverridden",
  18197. protocol: "testing",
  18198. fn: function (){
  18199. var self=this,$self=this;
  18200. var selector;
  18201. return $core.withContext(function($ctx1) {
  18202. var $1;
  18203. var $early={};
  18204. try {
  18205. selector=$self._selector();
  18206. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18207. return $core.withContext(function($ctx2) {
  18208. $1=$recv(each)._includesSelector_(selector);
  18209. if($core.assert($1)){
  18210. throw $early=[true];
  18211. }
  18212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18213. }));
  18214. return false;
  18215. }
  18216. catch(e) {if(e===$early)return e[0]; throw e}
  18217. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18218. },
  18219. args: [],
  18220. 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",
  18221. referencedClasses: [],
  18222. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18223. }),
  18224. $globals.CompiledMethod);
  18225. $core.addMethod(
  18226. $core.method({
  18227. selector: "isOverride",
  18228. protocol: "testing",
  18229. fn: function (){
  18230. var self=this,$self=this;
  18231. var superclass;
  18232. return $core.withContext(function($ctx1) {
  18233. var $1,$2,$receiver;
  18234. $1=$self._methodClass();
  18235. $ctx1.sendIdx["methodClass"]=1;
  18236. superclass=$recv($1)._superclass();
  18237. $ctx1.sendIdx["superclass"]=1;
  18238. $2=superclass;
  18239. if(($receiver = $2) == null || $receiver.a$nil){
  18240. return false;
  18241. } else {
  18242. $2;
  18243. }
  18244. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18245. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18246. },
  18247. args: [],
  18248. 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",
  18249. referencedClasses: [],
  18250. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18251. }),
  18252. $globals.CompiledMethod);
  18253. $core.addMethod(
  18254. $core.method({
  18255. selector: "messageSends",
  18256. protocol: "accessing",
  18257. fn: function (){
  18258. var self=this,$self=this;
  18259. return $core.withContext(function($ctx1) {
  18260. return $self._basicAt_("messageSends");
  18261. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18262. },
  18263. args: [],
  18264. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18265. referencedClasses: [],
  18266. messageSends: ["basicAt:"]
  18267. }),
  18268. $globals.CompiledMethod);
  18269. $core.addMethod(
  18270. $core.method({
  18271. selector: "methodClass",
  18272. protocol: "accessing",
  18273. fn: function (){
  18274. var self=this,$self=this;
  18275. return $core.withContext(function($ctx1) {
  18276. return $self._basicAt_("owner");
  18277. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18278. },
  18279. args: [],
  18280. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18281. referencedClasses: [],
  18282. messageSends: ["basicAt:"]
  18283. }),
  18284. $globals.CompiledMethod);
  18285. $core.addMethod(
  18286. $core.method({
  18287. selector: "package",
  18288. protocol: "accessing",
  18289. fn: function (){
  18290. var self=this,$self=this;
  18291. return $core.withContext(function($ctx1) {
  18292. var $1,$receiver;
  18293. $1=$self._methodClass();
  18294. if(($receiver = $1) == null || $receiver.a$nil){
  18295. return $1;
  18296. } else {
  18297. var class_;
  18298. class_=$receiver;
  18299. return $recv(class_)._packageOfProtocol_($self._protocol());
  18300. }
  18301. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18302. },
  18303. args: [],
  18304. 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 ]",
  18305. referencedClasses: [],
  18306. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18307. }),
  18308. $globals.CompiledMethod);
  18309. $core.addMethod(
  18310. $core.method({
  18311. selector: "protocol",
  18312. protocol: "accessing",
  18313. fn: function (){
  18314. var self=this,$self=this;
  18315. return $core.withContext(function($ctx1) {
  18316. var $1,$receiver;
  18317. $1=$self._basicAt_("protocol");
  18318. if(($receiver = $1) == null || $receiver.a$nil){
  18319. return $self._defaultProtocol();
  18320. } else {
  18321. return $1;
  18322. }
  18323. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18324. },
  18325. args: [],
  18326. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18327. referencedClasses: [],
  18328. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18329. }),
  18330. $globals.CompiledMethod);
  18331. $core.addMethod(
  18332. $core.method({
  18333. selector: "protocol:",
  18334. protocol: "accessing",
  18335. fn: function (aString){
  18336. var self=this,$self=this;
  18337. var oldProtocol;
  18338. return $core.withContext(function($ctx1) {
  18339. var $1,$3,$2,$4,$receiver;
  18340. oldProtocol=$self._protocol();
  18341. $self._basicAt_put_("protocol",aString);
  18342. $1=$recv($globals.SystemAnnouncer)._current();
  18343. $3=$recv($globals.MethodMoved)._new();
  18344. $recv($3)._method_(self);
  18345. $recv($3)._oldProtocol_(oldProtocol);
  18346. $2=$recv($3)._yourself();
  18347. $recv($1)._announce_($2);
  18348. $4=$self._methodClass();
  18349. if(($receiver = $4) == null || $receiver.a$nil){
  18350. $4;
  18351. } else {
  18352. var methodClass;
  18353. methodClass=$receiver;
  18354. $recv($recv(methodClass)._organization())._addElement_(aString);
  18355. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18356. }
  18357. return self;
  18358. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18359. },
  18360. args: ["aString"],
  18361. 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 ]",
  18362. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18363. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18364. }),
  18365. $globals.CompiledMethod);
  18366. $core.addMethod(
  18367. $core.method({
  18368. selector: "referencedClasses",
  18369. protocol: "accessing",
  18370. fn: function (){
  18371. var self=this,$self=this;
  18372. return $core.withContext(function($ctx1) {
  18373. return $self._basicAt_("referencedClasses");
  18374. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18375. },
  18376. args: [],
  18377. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18378. referencedClasses: [],
  18379. messageSends: ["basicAt:"]
  18380. }),
  18381. $globals.CompiledMethod);
  18382. $core.addMethod(
  18383. $core.method({
  18384. selector: "selector",
  18385. protocol: "accessing",
  18386. fn: function (){
  18387. var self=this,$self=this;
  18388. return $core.withContext(function($ctx1) {
  18389. return $self._basicAt_("selector");
  18390. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18391. },
  18392. args: [],
  18393. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18394. referencedClasses: [],
  18395. messageSends: ["basicAt:"]
  18396. }),
  18397. $globals.CompiledMethod);
  18398. $core.addMethod(
  18399. $core.method({
  18400. selector: "selector:",
  18401. protocol: "accessing",
  18402. fn: function (aString){
  18403. var self=this,$self=this;
  18404. return $core.withContext(function($ctx1) {
  18405. $self._basicAt_put_("selector",aString);
  18406. return self;
  18407. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18408. },
  18409. args: ["aString"],
  18410. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18411. referencedClasses: [],
  18412. messageSends: ["basicAt:put:"]
  18413. }),
  18414. $globals.CompiledMethod);
  18415. $core.addMethod(
  18416. $core.method({
  18417. selector: "sendTo:arguments:",
  18418. protocol: "evaluating",
  18419. fn: function (anObject,aCollection){
  18420. var self=this,$self=this;
  18421. return $core.withContext(function($ctx1) {
  18422. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18423. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18424. },
  18425. args: ["anObject", "aCollection"],
  18426. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18427. referencedClasses: [],
  18428. messageSends: ["applyTo:arguments:", "fn"]
  18429. }),
  18430. $globals.CompiledMethod);
  18431. $core.addMethod(
  18432. $core.method({
  18433. selector: "source",
  18434. protocol: "accessing",
  18435. fn: function (){
  18436. var self=this,$self=this;
  18437. return $core.withContext(function($ctx1) {
  18438. var $1,$receiver;
  18439. $1=$self._basicAt_("source");
  18440. if(($receiver = $1) == null || $receiver.a$nil){
  18441. return "";
  18442. } else {
  18443. return $1;
  18444. }
  18445. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18446. },
  18447. args: [],
  18448. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18449. referencedClasses: [],
  18450. messageSends: ["ifNil:", "basicAt:"]
  18451. }),
  18452. $globals.CompiledMethod);
  18453. $core.addMethod(
  18454. $core.method({
  18455. selector: "source:",
  18456. protocol: "accessing",
  18457. fn: function (aString){
  18458. var self=this,$self=this;
  18459. return $core.withContext(function($ctx1) {
  18460. $self._basicAt_put_("source",aString);
  18461. return self;
  18462. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18463. },
  18464. args: ["aString"],
  18465. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18466. referencedClasses: [],
  18467. messageSends: ["basicAt:put:"]
  18468. }),
  18469. $globals.CompiledMethod);
  18470. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18471. $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`";
  18472. $core.addMethod(
  18473. $core.method({
  18474. selector: "addWorker",
  18475. protocol: "private",
  18476. fn: function (){
  18477. var self=this,$self=this;
  18478. return $core.withContext(function($ctx1) {
  18479. $recv($self["@worker"])._valueWithTimeout_((0));
  18480. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18481. return self;
  18482. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18483. },
  18484. args: [],
  18485. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18486. referencedClasses: [],
  18487. messageSends: ["valueWithTimeout:", "+"]
  18488. }),
  18489. $globals.ForkPool);
  18490. $core.addMethod(
  18491. $core.method({
  18492. selector: "defaultMaxPoolSize",
  18493. protocol: "defaults",
  18494. fn: function (){
  18495. var self=this,$self=this;
  18496. return $core.withContext(function($ctx1) {
  18497. return $recv($self._class())._defaultMaxPoolSize();
  18498. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18499. },
  18500. args: [],
  18501. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18502. referencedClasses: [],
  18503. messageSends: ["defaultMaxPoolSize", "class"]
  18504. }),
  18505. $globals.ForkPool);
  18506. $core.addMethod(
  18507. $core.method({
  18508. selector: "fork:",
  18509. protocol: "actions",
  18510. fn: function (aBlock){
  18511. var self=this,$self=this;
  18512. return $core.withContext(function($ctx1) {
  18513. var $1;
  18514. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18515. if($core.assert($1)){
  18516. $self._addWorker();
  18517. }
  18518. $recv($self["@queue"])._nextPut_(aBlock);
  18519. return self;
  18520. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18521. },
  18522. args: ["aBlock"],
  18523. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18524. referencedClasses: [],
  18525. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18526. }),
  18527. $globals.ForkPool);
  18528. $core.addMethod(
  18529. $core.method({
  18530. selector: "initialize",
  18531. protocol: "initialization",
  18532. fn: function (){
  18533. var self=this,$self=this;
  18534. return $core.withContext(function($ctx1) {
  18535. (
  18536. $ctx1.supercall = true,
  18537. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18538. $ctx1.supercall = false;
  18539. $self["@poolSize"]=(0);
  18540. $self["@queue"]=$recv($globals.Queue)._new();
  18541. $self["@worker"]=$self._makeWorker();
  18542. return self;
  18543. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18544. },
  18545. args: [],
  18546. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18547. referencedClasses: ["Queue"],
  18548. messageSends: ["initialize", "new", "makeWorker"]
  18549. }),
  18550. $globals.ForkPool);
  18551. $core.addMethod(
  18552. $core.method({
  18553. selector: "makeWorker",
  18554. protocol: "initialization",
  18555. fn: function (){
  18556. var self=this,$self=this;
  18557. var sentinel;
  18558. return $core.withContext(function($ctx1) {
  18559. var $1;
  18560. sentinel=$recv($globals.Object)._new();
  18561. return (function(){
  18562. var block;
  18563. return $core.withContext(function($ctx2) {
  18564. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18565. $self["@poolSize"];
  18566. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18567. return sentinel;
  18568. }));
  18569. block;
  18570. $1=$recv(block).__eq_eq(sentinel);
  18571. if(!$core.assert($1)){
  18572. return $recv((function(){
  18573. return $core.withContext(function($ctx3) {
  18574. return $recv(block)._value();
  18575. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18576. }))._ensure_((function(){
  18577. return $core.withContext(function($ctx3) {
  18578. return $self._addWorker();
  18579. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18580. }));
  18581. }
  18582. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18583. });
  18584. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18585. },
  18586. args: [],
  18587. 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 ] ]]",
  18588. referencedClasses: ["Object"],
  18589. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18590. }),
  18591. $globals.ForkPool);
  18592. $core.addMethod(
  18593. $core.method({
  18594. selector: "maxPoolSize",
  18595. protocol: "accessing",
  18596. fn: function (){
  18597. var self=this,$self=this;
  18598. return $core.withContext(function($ctx1) {
  18599. var $1,$receiver;
  18600. $1=$self["@maxPoolSize"];
  18601. if(($receiver = $1) == null || $receiver.a$nil){
  18602. return $self._defaultMaxPoolSize();
  18603. } else {
  18604. return $1;
  18605. }
  18606. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18607. },
  18608. args: [],
  18609. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18610. referencedClasses: [],
  18611. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18612. }),
  18613. $globals.ForkPool);
  18614. $core.addMethod(
  18615. $core.method({
  18616. selector: "maxPoolSize:",
  18617. protocol: "accessing",
  18618. fn: function (anInteger){
  18619. var self=this,$self=this;
  18620. $self["@maxPoolSize"]=anInteger;
  18621. return self;
  18622. },
  18623. args: ["anInteger"],
  18624. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18625. referencedClasses: [],
  18626. messageSends: []
  18627. }),
  18628. $globals.ForkPool);
  18629. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18630. $core.addMethod(
  18631. $core.method({
  18632. selector: "default",
  18633. protocol: "accessing",
  18634. fn: function (){
  18635. var self=this,$self=this;
  18636. return $core.withContext(function($ctx1) {
  18637. var $1,$receiver;
  18638. $1=$self["@default"];
  18639. if(($receiver = $1) == null || $receiver.a$nil){
  18640. $self["@default"]=$self._new();
  18641. return $self["@default"];
  18642. } else {
  18643. return $1;
  18644. }
  18645. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18646. },
  18647. args: [],
  18648. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18649. referencedClasses: [],
  18650. messageSends: ["ifNil:", "new"]
  18651. }),
  18652. $globals.ForkPool.a$cls);
  18653. $core.addMethod(
  18654. $core.method({
  18655. selector: "defaultMaxPoolSize",
  18656. protocol: "accessing",
  18657. fn: function (){
  18658. var self=this,$self=this;
  18659. return (100);
  18660. },
  18661. args: [],
  18662. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18663. referencedClasses: [],
  18664. messageSends: []
  18665. }),
  18666. $globals.ForkPool.a$cls);
  18667. $core.addMethod(
  18668. $core.method({
  18669. selector: "resetDefault",
  18670. protocol: "accessing",
  18671. fn: function (){
  18672. var self=this,$self=this;
  18673. $self["@default"]=nil;
  18674. return self;
  18675. },
  18676. args: [],
  18677. source: "resetDefault\x0a\x09default := nil",
  18678. referencedClasses: [],
  18679. messageSends: []
  18680. }),
  18681. $globals.ForkPool.a$cls);
  18682. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18683. $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.";
  18684. $core.addMethod(
  18685. $core.method({
  18686. selector: "arguments",
  18687. protocol: "accessing",
  18688. fn: function (){
  18689. var self=this,$self=this;
  18690. return $self["@arguments"];
  18691. },
  18692. args: [],
  18693. source: "arguments\x0a\x09^ arguments",
  18694. referencedClasses: [],
  18695. messageSends: []
  18696. }),
  18697. $globals.Message);
  18698. $core.addMethod(
  18699. $core.method({
  18700. selector: "arguments:",
  18701. protocol: "accessing",
  18702. fn: function (anArray){
  18703. var self=this,$self=this;
  18704. $self["@arguments"]=anArray;
  18705. return self;
  18706. },
  18707. args: ["anArray"],
  18708. source: "arguments: anArray\x0a\x09arguments := anArray",
  18709. referencedClasses: [],
  18710. messageSends: []
  18711. }),
  18712. $globals.Message);
  18713. $core.addMethod(
  18714. $core.method({
  18715. selector: "printOn:",
  18716. protocol: "printing",
  18717. fn: function (aStream){
  18718. var self=this,$self=this;
  18719. return $core.withContext(function($ctx1) {
  18720. (
  18721. $ctx1.supercall = true,
  18722. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18723. $ctx1.supercall = false;
  18724. $recv(aStream)._nextPutAll_("(");
  18725. $ctx1.sendIdx["nextPutAll:"]=1;
  18726. $recv(aStream)._nextPutAll_($self._selector());
  18727. $ctx1.sendIdx["nextPutAll:"]=2;
  18728. $recv(aStream)._nextPutAll_(")");
  18729. return self;
  18730. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18731. },
  18732. args: ["aStream"],
  18733. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18734. referencedClasses: [],
  18735. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18736. }),
  18737. $globals.Message);
  18738. $core.addMethod(
  18739. $core.method({
  18740. selector: "selector",
  18741. protocol: "accessing",
  18742. fn: function (){
  18743. var self=this,$self=this;
  18744. return $self["@selector"];
  18745. },
  18746. args: [],
  18747. source: "selector\x0a\x09^ selector",
  18748. referencedClasses: [],
  18749. messageSends: []
  18750. }),
  18751. $globals.Message);
  18752. $core.addMethod(
  18753. $core.method({
  18754. selector: "selector:",
  18755. protocol: "accessing",
  18756. fn: function (aString){
  18757. var self=this,$self=this;
  18758. $self["@selector"]=aString;
  18759. return self;
  18760. },
  18761. args: ["aString"],
  18762. source: "selector: aString\x0a\x09selector := aString",
  18763. referencedClasses: [],
  18764. messageSends: []
  18765. }),
  18766. $globals.Message);
  18767. $core.addMethod(
  18768. $core.method({
  18769. selector: "sendTo:",
  18770. protocol: "actions",
  18771. fn: function (anObject){
  18772. var self=this,$self=this;
  18773. return $core.withContext(function($ctx1) {
  18774. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18775. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18776. },
  18777. args: ["anObject"],
  18778. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18779. referencedClasses: [],
  18780. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18781. }),
  18782. $globals.Message);
  18783. $core.addMethod(
  18784. $core.method({
  18785. selector: "selector:arguments:",
  18786. protocol: "instance creation",
  18787. fn: function (aString,anArray){
  18788. var self=this,$self=this;
  18789. return $core.withContext(function($ctx1) {
  18790. var $1;
  18791. $1=$self._new();
  18792. $recv($1)._selector_(aString);
  18793. $recv($1)._arguments_(anArray);
  18794. return $recv($1)._yourself();
  18795. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18796. },
  18797. args: ["aString", "anArray"],
  18798. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18799. referencedClasses: [],
  18800. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18801. }),
  18802. $globals.Message.a$cls);
  18803. $core.addMethod(
  18804. $core.method({
  18805. selector: "selector:arguments:notUnderstoodBy:",
  18806. protocol: "dnu handling",
  18807. fn: function (aString,anArray,anObject){
  18808. var self=this,$self=this;
  18809. return $core.withContext(function($ctx1) {
  18810. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18811. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18812. },
  18813. args: ["aString", "anArray", "anObject"],
  18814. 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)",
  18815. referencedClasses: [],
  18816. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18817. }),
  18818. $globals.Message.a$cls);
  18819. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18820. $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.";
  18821. $core.addMethod(
  18822. $core.method({
  18823. selector: "arguments",
  18824. protocol: "accessing",
  18825. fn: function (){
  18826. var self=this,$self=this;
  18827. return $core.withContext(function($ctx1) {
  18828. return $recv($self["@message"])._arguments();
  18829. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18830. },
  18831. args: [],
  18832. source: "arguments\x0a\x09^ message arguments",
  18833. referencedClasses: [],
  18834. messageSends: ["arguments"]
  18835. }),
  18836. $globals.MessageSend);
  18837. $core.addMethod(
  18838. $core.method({
  18839. selector: "arguments:",
  18840. protocol: "accessing",
  18841. fn: function (aCollection){
  18842. var self=this,$self=this;
  18843. return $core.withContext(function($ctx1) {
  18844. $recv($self["@message"])._arguments_(aCollection);
  18845. return self;
  18846. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18847. },
  18848. args: ["aCollection"],
  18849. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18850. referencedClasses: [],
  18851. messageSends: ["arguments:"]
  18852. }),
  18853. $globals.MessageSend);
  18854. $core.addMethod(
  18855. $core.method({
  18856. selector: "initialize",
  18857. protocol: "initialization",
  18858. fn: function (){
  18859. var self=this,$self=this;
  18860. return $core.withContext(function($ctx1) {
  18861. (
  18862. $ctx1.supercall = true,
  18863. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18864. $ctx1.supercall = false;
  18865. $self["@message"]=$recv($globals.Message)._new();
  18866. return self;
  18867. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18868. },
  18869. args: [],
  18870. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18871. referencedClasses: ["Message"],
  18872. messageSends: ["initialize", "new"]
  18873. }),
  18874. $globals.MessageSend);
  18875. $core.addMethod(
  18876. $core.method({
  18877. selector: "printOn:",
  18878. protocol: "printing",
  18879. fn: function (aStream){
  18880. var self=this,$self=this;
  18881. return $core.withContext(function($ctx1) {
  18882. (
  18883. $ctx1.supercall = true,
  18884. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18885. $ctx1.supercall = false;
  18886. $recv(aStream)._nextPutAll_("(");
  18887. $ctx1.sendIdx["nextPutAll:"]=1;
  18888. $recv(aStream)._nextPutAll_($self._receiver());
  18889. $ctx1.sendIdx["nextPutAll:"]=2;
  18890. $recv(aStream)._nextPutAll_(" >> ");
  18891. $ctx1.sendIdx["nextPutAll:"]=3;
  18892. $recv(aStream)._nextPutAll_($self._selector());
  18893. $ctx1.sendIdx["nextPutAll:"]=4;
  18894. $recv(aStream)._nextPutAll_(")");
  18895. return self;
  18896. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18897. },
  18898. args: ["aStream"],
  18899. 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: ')'",
  18900. referencedClasses: [],
  18901. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18902. }),
  18903. $globals.MessageSend);
  18904. $core.addMethod(
  18905. $core.method({
  18906. selector: "receiver",
  18907. protocol: "accessing",
  18908. fn: function (){
  18909. var self=this,$self=this;
  18910. return $self["@receiver"];
  18911. },
  18912. args: [],
  18913. source: "receiver\x0a\x09^ receiver",
  18914. referencedClasses: [],
  18915. messageSends: []
  18916. }),
  18917. $globals.MessageSend);
  18918. $core.addMethod(
  18919. $core.method({
  18920. selector: "receiver:",
  18921. protocol: "accessing",
  18922. fn: function (anObject){
  18923. var self=this,$self=this;
  18924. $self["@receiver"]=anObject;
  18925. return self;
  18926. },
  18927. args: ["anObject"],
  18928. source: "receiver: anObject\x0a\x09receiver := anObject",
  18929. referencedClasses: [],
  18930. messageSends: []
  18931. }),
  18932. $globals.MessageSend);
  18933. $core.addMethod(
  18934. $core.method({
  18935. selector: "selector",
  18936. protocol: "accessing",
  18937. fn: function (){
  18938. var self=this,$self=this;
  18939. return $core.withContext(function($ctx1) {
  18940. return $recv($self["@message"])._selector();
  18941. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18942. },
  18943. args: [],
  18944. source: "selector\x0a\x09^ message selector",
  18945. referencedClasses: [],
  18946. messageSends: ["selector"]
  18947. }),
  18948. $globals.MessageSend);
  18949. $core.addMethod(
  18950. $core.method({
  18951. selector: "selector:",
  18952. protocol: "accessing",
  18953. fn: function (aString){
  18954. var self=this,$self=this;
  18955. return $core.withContext(function($ctx1) {
  18956. $recv($self["@message"])._selector_(aString);
  18957. return self;
  18958. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18959. },
  18960. args: ["aString"],
  18961. source: "selector: aString\x0a\x09message selector: aString",
  18962. referencedClasses: [],
  18963. messageSends: ["selector:"]
  18964. }),
  18965. $globals.MessageSend);
  18966. $core.addMethod(
  18967. $core.method({
  18968. selector: "value",
  18969. protocol: "evaluating",
  18970. fn: function (){
  18971. var self=this,$self=this;
  18972. return $core.withContext(function($ctx1) {
  18973. return $recv($self["@message"])._sendTo_($self._receiver());
  18974. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18975. },
  18976. args: [],
  18977. source: "value\x0a\x09^ message sendTo: self receiver",
  18978. referencedClasses: [],
  18979. messageSends: ["sendTo:", "receiver"]
  18980. }),
  18981. $globals.MessageSend);
  18982. $core.addMethod(
  18983. $core.method({
  18984. selector: "value:",
  18985. protocol: "evaluating",
  18986. fn: function (anObject){
  18987. var self=this,$self=this;
  18988. return $core.withContext(function($ctx1) {
  18989. var $1;
  18990. $1=$self["@message"];
  18991. $recv($1)._arguments_([anObject]);
  18992. return $recv($1)._sendTo_($self._receiver());
  18993. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18994. },
  18995. args: ["anObject"],
  18996. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18997. referencedClasses: [],
  18998. messageSends: ["arguments:", "sendTo:", "receiver"]
  18999. }),
  19000. $globals.MessageSend);
  19001. $core.addMethod(
  19002. $core.method({
  19003. selector: "value:value:",
  19004. protocol: "evaluating",
  19005. fn: function (firstArgument,secondArgument){
  19006. var self=this,$self=this;
  19007. return $core.withContext(function($ctx1) {
  19008. var $1;
  19009. $1=$self["@message"];
  19010. $recv($1)._arguments_([firstArgument,secondArgument]);
  19011. return $recv($1)._sendTo_($self._receiver());
  19012. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  19013. },
  19014. args: ["firstArgument", "secondArgument"],
  19015. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  19016. referencedClasses: [],
  19017. messageSends: ["arguments:", "sendTo:", "receiver"]
  19018. }),
  19019. $globals.MessageSend);
  19020. $core.addMethod(
  19021. $core.method({
  19022. selector: "value:value:value:",
  19023. protocol: "evaluating",
  19024. fn: function (firstArgument,secondArgument,thirdArgument){
  19025. var self=this,$self=this;
  19026. return $core.withContext(function($ctx1) {
  19027. var $1;
  19028. $1=$self["@message"];
  19029. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  19030. return $recv($1)._sendTo_($self._receiver());
  19031. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  19032. },
  19033. args: ["firstArgument", "secondArgument", "thirdArgument"],
  19034. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  19035. referencedClasses: [],
  19036. messageSends: ["arguments:", "sendTo:", "receiver"]
  19037. }),
  19038. $globals.MessageSend);
  19039. $core.addMethod(
  19040. $core.method({
  19041. selector: "valueWithPossibleArguments:",
  19042. protocol: "evaluating",
  19043. fn: function (aCollection){
  19044. var self=this,$self=this;
  19045. return $core.withContext(function($ctx1) {
  19046. $self._arguments_(aCollection);
  19047. return $self._value();
  19048. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  19049. },
  19050. args: ["aCollection"],
  19051. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  19052. referencedClasses: [],
  19053. messageSends: ["arguments:", "value"]
  19054. }),
  19055. $globals.MessageSend);
  19056. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  19057. $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`.";
  19058. $core.addMethod(
  19059. $core.method({
  19060. selector: "asString",
  19061. protocol: "converting",
  19062. fn: function (){
  19063. var self=this,$self=this;
  19064. return $core.withContext(function($ctx1) {
  19065. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  19066. $2=$self._isBlockContext();
  19067. if($core.assert($2)){
  19068. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  19069. $ctx1.sendIdx[","]=2;
  19070. $1=$recv($3).__comma(")");
  19071. $ctx1.sendIdx[","]=1;
  19072. } else {
  19073. var methodClass;
  19074. methodClass=$recv($self._method())._methodClass();
  19075. methodClass;
  19076. $5=methodClass;
  19077. $7=$self._receiver();
  19078. $ctx1.sendIdx["receiver"]=1;
  19079. $6=$recv($7)._class();
  19080. $ctx1.sendIdx["class"]=1;
  19081. $4=$recv($5).__eq($6);
  19082. if($core.assert($4)){
  19083. $11=$self._receiver();
  19084. $ctx1.sendIdx["receiver"]=2;
  19085. $10=$recv($11)._class();
  19086. $ctx1.sendIdx["class"]=2;
  19087. $9=$recv($10)._name();
  19088. $ctx1.sendIdx["name"]=1;
  19089. $8=$recv($9).__comma(" >> ");
  19090. $ctx1.sendIdx[","]=4;
  19091. $12=$self._selector();
  19092. $ctx1.sendIdx["selector"]=1;
  19093. $1=$recv($8).__comma($12);
  19094. $ctx1.sendIdx[","]=3;
  19095. } else {
  19096. $16=$recv($recv($self._receiver())._class())._name();
  19097. $ctx1.sendIdx["name"]=2;
  19098. $15=$recv($16).__comma("(");
  19099. $14=$recv($15).__comma($recv(methodClass)._name());
  19100. $ctx1.sendIdx[","]=7;
  19101. $13=$recv($14).__comma(") >> ");
  19102. $ctx1.sendIdx[","]=6;
  19103. $1=$recv($13).__comma($self._selector());
  19104. $ctx1.sendIdx[","]=5;
  19105. }
  19106. }
  19107. return $1;
  19108. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  19109. },
  19110. args: [],
  19111. 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 ] ]",
  19112. referencedClasses: [],
  19113. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19114. }),
  19115. $globals.MethodContext);
  19116. $core.addMethod(
  19117. $core.method({
  19118. selector: "basicReceiver",
  19119. protocol: "accessing",
  19120. fn: function (){
  19121. var self=this,$self=this;
  19122. return $core.withContext(function($ctx1) {
  19123. return self.receiver;
  19124. return self;
  19125. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  19126. },
  19127. args: [],
  19128. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  19129. referencedClasses: [],
  19130. messageSends: []
  19131. }),
  19132. $globals.MethodContext);
  19133. $core.addMethod(
  19134. $core.method({
  19135. selector: "evaluatedSelector",
  19136. protocol: "accessing",
  19137. fn: function (){
  19138. var self=this,$self=this;
  19139. return $core.withContext(function($ctx1) {
  19140. return self.evaluatedSelector;
  19141. return self;
  19142. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  19143. },
  19144. args: [],
  19145. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  19146. referencedClasses: [],
  19147. messageSends: []
  19148. }),
  19149. $globals.MethodContext);
  19150. $core.addMethod(
  19151. $core.method({
  19152. selector: "findContextSuchThat:",
  19153. protocol: "accessing",
  19154. fn: function (testBlock){
  19155. var self=this,$self=this;
  19156. var context;
  19157. return $core.withContext(function($ctx1) {
  19158. var $1;
  19159. var $early={};
  19160. try {
  19161. context=self;
  19162. $recv((function(){
  19163. return $core.withContext(function($ctx2) {
  19164. return $recv(context)._isNil();
  19165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19166. }))._whileFalse_((function(){
  19167. return $core.withContext(function($ctx2) {
  19168. $1=$recv(testBlock)._value_(context);
  19169. if($core.assert($1)){
  19170. throw $early=[context];
  19171. }
  19172. context=$recv(context)._outerContext();
  19173. return context;
  19174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19175. }));
  19176. return nil;
  19177. }
  19178. catch(e) {if(e===$early)return e[0]; throw e}
  19179. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19180. },
  19181. args: ["testBlock"],
  19182. 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",
  19183. referencedClasses: [],
  19184. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19185. }),
  19186. $globals.MethodContext);
  19187. $core.addMethod(
  19188. $core.method({
  19189. selector: "home",
  19190. protocol: "accessing",
  19191. fn: function (){
  19192. var self=this,$self=this;
  19193. return $core.withContext(function($ctx1) {
  19194. return self.homeContext;
  19195. return self;
  19196. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19197. },
  19198. args: [],
  19199. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19200. referencedClasses: [],
  19201. messageSends: []
  19202. }),
  19203. $globals.MethodContext);
  19204. $core.addMethod(
  19205. $core.method({
  19206. selector: "index",
  19207. protocol: "accessing",
  19208. fn: function (){
  19209. var self=this,$self=this;
  19210. return $core.withContext(function($ctx1) {
  19211. return self.index || 0;
  19212. return self;
  19213. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19214. },
  19215. args: [],
  19216. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19217. referencedClasses: [],
  19218. messageSends: []
  19219. }),
  19220. $globals.MethodContext);
  19221. $core.addMethod(
  19222. $core.method({
  19223. selector: "isBlockContext",
  19224. protocol: "testing",
  19225. fn: function (){
  19226. var self=this,$self=this;
  19227. return $core.withContext(function($ctx1) {
  19228. return $recv($self._selector())._isNil();
  19229. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19230. },
  19231. args: [],
  19232. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19233. referencedClasses: [],
  19234. messageSends: ["isNil", "selector"]
  19235. }),
  19236. $globals.MethodContext);
  19237. $core.addMethod(
  19238. $core.method({
  19239. selector: "locals",
  19240. protocol: "accessing",
  19241. fn: function (){
  19242. var self=this,$self=this;
  19243. return $core.withContext(function($ctx1) {
  19244. return self.locals || {};
  19245. return self;
  19246. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19247. },
  19248. args: [],
  19249. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19250. referencedClasses: [],
  19251. messageSends: []
  19252. }),
  19253. $globals.MethodContext);
  19254. $core.addMethod(
  19255. $core.method({
  19256. selector: "method",
  19257. protocol: "accessing",
  19258. fn: function (){
  19259. var self=this,$self=this;
  19260. var method,lookupClass,receiverClass,supercall;
  19261. return $core.withContext(function($ctx1) {
  19262. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19263. $1=$self._methodContext();
  19264. $ctx1.sendIdx["methodContext"]=1;
  19265. if(($receiver = $1) == null || $receiver.a$nil){
  19266. return nil;
  19267. } else {
  19268. $1;
  19269. }
  19270. $3=$self._methodContext();
  19271. $ctx1.sendIdx["methodContext"]=2;
  19272. $2=$recv($3)._receiver();
  19273. receiverClass=$recv($2)._class();
  19274. $4=receiverClass;
  19275. $6=$self._methodContext();
  19276. $ctx1.sendIdx["methodContext"]=3;
  19277. $5=$recv($6)._selector();
  19278. $ctx1.sendIdx["selector"]=1;
  19279. method=$recv($4)._lookupSelector_($5);
  19280. $ctx1.sendIdx["lookupSelector:"]=1;
  19281. $7=$self._outerContext();
  19282. if(($receiver = $7) == null || $receiver.a$nil){
  19283. supercall=false;
  19284. } else {
  19285. var outer;
  19286. outer=$receiver;
  19287. supercall=$recv(outer)._supercall();
  19288. }
  19289. $8=supercall;
  19290. if($core.assert($8)){
  19291. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19292. } else {
  19293. return method;
  19294. }
  19295. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19296. },
  19297. args: [],
  19298. 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 ]",
  19299. referencedClasses: [],
  19300. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19301. }),
  19302. $globals.MethodContext);
  19303. $core.addMethod(
  19304. $core.method({
  19305. selector: "methodContext",
  19306. protocol: "accessing",
  19307. fn: function (){
  19308. var self=this,$self=this;
  19309. return $core.withContext(function($ctx1) {
  19310. var $1,$2,$receiver;
  19311. $1=$self._isBlockContext();
  19312. if(!$core.assert($1)){
  19313. return self;
  19314. }
  19315. $2=$self._outerContext();
  19316. if(($receiver = $2) == null || $receiver.a$nil){
  19317. return $2;
  19318. } else {
  19319. var outer;
  19320. outer=$receiver;
  19321. return $recv(outer)._methodContext();
  19322. }
  19323. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19324. },
  19325. args: [],
  19326. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19327. referencedClasses: [],
  19328. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19329. }),
  19330. $globals.MethodContext);
  19331. $core.addMethod(
  19332. $core.method({
  19333. selector: "outerContext",
  19334. protocol: "accessing",
  19335. fn: function (){
  19336. var self=this,$self=this;
  19337. return $core.withContext(function($ctx1) {
  19338. return self.outerContext || self.homeContext;
  19339. return self;
  19340. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19341. },
  19342. args: [],
  19343. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19344. referencedClasses: [],
  19345. messageSends: []
  19346. }),
  19347. $globals.MethodContext);
  19348. $core.addMethod(
  19349. $core.method({
  19350. selector: "printOn:",
  19351. protocol: "printing",
  19352. fn: function (aStream){
  19353. var self=this,$self=this;
  19354. return $core.withContext(function($ctx1) {
  19355. (
  19356. $ctx1.supercall = true,
  19357. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19358. $ctx1.supercall = false;
  19359. $recv(aStream)._nextPutAll_("(");
  19360. $ctx1.sendIdx["nextPutAll:"]=1;
  19361. $recv(aStream)._nextPutAll_($self._asString());
  19362. $ctx1.sendIdx["nextPutAll:"]=2;
  19363. $recv(aStream)._nextPutAll_(")");
  19364. return self;
  19365. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19366. },
  19367. args: ["aStream"],
  19368. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19369. referencedClasses: [],
  19370. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19371. }),
  19372. $globals.MethodContext);
  19373. $core.addMethod(
  19374. $core.method({
  19375. selector: "receiver",
  19376. protocol: "accessing",
  19377. fn: function (){
  19378. var self=this,$self=this;
  19379. return $core.withContext(function($ctx1) {
  19380. var $2,$1;
  19381. $1=$recv($self._isBlockContext())._and_((function(){
  19382. return $core.withContext(function($ctx2) {
  19383. $2=$self._outerContext();
  19384. $ctx2.sendIdx["outerContext"]=1;
  19385. return $recv($2)._notNil();
  19386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19387. }));
  19388. if($core.assert($1)){
  19389. return $recv($self._outerContext())._receiver();
  19390. } else {
  19391. return $self._basicReceiver();
  19392. }
  19393. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19394. },
  19395. args: [],
  19396. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19397. referencedClasses: [],
  19398. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19399. }),
  19400. $globals.MethodContext);
  19401. $core.addMethod(
  19402. $core.method({
  19403. selector: "selector",
  19404. protocol: "accessing",
  19405. fn: function (){
  19406. var self=this,$self=this;
  19407. return $core.withContext(function($ctx1) {
  19408. if(self.selector) {
  19409. return $core.js2st(self.selector);
  19410. } else {
  19411. return nil;
  19412. }
  19413. ;
  19414. return self;
  19415. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19416. },
  19417. args: [],
  19418. 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'>",
  19419. referencedClasses: [],
  19420. messageSends: []
  19421. }),
  19422. $globals.MethodContext);
  19423. $core.addMethod(
  19424. $core.method({
  19425. selector: "sendIndexAt:",
  19426. protocol: "accessing",
  19427. fn: function (aSelector){
  19428. var self=this,$self=this;
  19429. return $core.withContext(function($ctx1) {
  19430. return self.sendIdx[aSelector] || 0;
  19431. return self;
  19432. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19433. },
  19434. args: ["aSelector"],
  19435. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19436. referencedClasses: [],
  19437. messageSends: []
  19438. }),
  19439. $globals.MethodContext);
  19440. $core.addMethod(
  19441. $core.method({
  19442. selector: "sendIndexes",
  19443. protocol: "accessing",
  19444. fn: function (){
  19445. var self=this,$self=this;
  19446. return $core.withContext(function($ctx1) {
  19447. return self.sendIdx;
  19448. return self;
  19449. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19450. },
  19451. args: [],
  19452. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19453. referencedClasses: [],
  19454. messageSends: []
  19455. }),
  19456. $globals.MethodContext);
  19457. $core.addMethod(
  19458. $core.method({
  19459. selector: "stubHere",
  19460. protocol: "accessing",
  19461. fn: function (){
  19462. var self=this,$self=this;
  19463. return $core.withContext(function($ctx1) {
  19464. self.homeContext = undefined;
  19465. return self;
  19466. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19467. },
  19468. args: [],
  19469. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19470. referencedClasses: [],
  19471. messageSends: []
  19472. }),
  19473. $globals.MethodContext);
  19474. $core.addMethod(
  19475. $core.method({
  19476. selector: "stubToAtMost:",
  19477. protocol: "error handling",
  19478. fn: function (anInteger){
  19479. var self=this,$self=this;
  19480. var context;
  19481. return $core.withContext(function($ctx1) {
  19482. var $1,$2,$receiver;
  19483. context=self;
  19484. $recv(anInteger)._timesRepeat_((function(){
  19485. return $core.withContext(function($ctx2) {
  19486. $1=context;
  19487. if(($receiver = $1) == null || $receiver.a$nil){
  19488. context=$1;
  19489. } else {
  19490. context=$recv(context)._home();
  19491. }
  19492. return context;
  19493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19494. }));
  19495. $2=context;
  19496. if(($receiver = $2) == null || $receiver.a$nil){
  19497. $2;
  19498. } else {
  19499. $recv(context)._stubHere();
  19500. }
  19501. return self;
  19502. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19503. },
  19504. args: ["anInteger"],
  19505. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19506. referencedClasses: [],
  19507. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19508. }),
  19509. $globals.MethodContext);
  19510. $core.addMethod(
  19511. $core.method({
  19512. selector: "supercall",
  19513. protocol: "accessing",
  19514. fn: function (){
  19515. var self=this,$self=this;
  19516. return $core.withContext(function($ctx1) {
  19517. return self.supercall == true;
  19518. return self;
  19519. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19520. },
  19521. args: [],
  19522. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19523. referencedClasses: [],
  19524. messageSends: []
  19525. }),
  19526. $globals.MethodContext);
  19527. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19528. $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' ]";
  19529. $core.addMethod(
  19530. $core.method({
  19531. selector: "constructorNamed:",
  19532. protocol: "instance creation",
  19533. fn: function (aString){
  19534. var self=this,$self=this;
  19535. return $core.withContext(function($ctx1) {
  19536. var nativeFunc=$globals.Platform._globals()[aString];
  19537. return new nativeFunc();
  19538. ;
  19539. return self;
  19540. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19541. },
  19542. args: ["aString"],
  19543. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19544. referencedClasses: [],
  19545. messageSends: []
  19546. }),
  19547. $globals.NativeFunction.a$cls);
  19548. $core.addMethod(
  19549. $core.method({
  19550. selector: "constructorNamed:value:",
  19551. protocol: "instance creation",
  19552. fn: function (aString,anObject){
  19553. var self=this,$self=this;
  19554. return $core.withContext(function($ctx1) {
  19555. var nativeFunc=$globals.Platform._globals()[aString];
  19556. return new nativeFunc(anObject);
  19557. ;
  19558. return self;
  19559. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19560. },
  19561. args: ["aString", "anObject"],
  19562. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19563. referencedClasses: [],
  19564. messageSends: []
  19565. }),
  19566. $globals.NativeFunction.a$cls);
  19567. $core.addMethod(
  19568. $core.method({
  19569. selector: "constructorNamed:value:value:",
  19570. protocol: "instance creation",
  19571. fn: function (aString,anObject,anObject2){
  19572. var self=this,$self=this;
  19573. return $core.withContext(function($ctx1) {
  19574. var nativeFunc=$globals.Platform._globals[aString];
  19575. return new nativeFunc(anObject,anObject2);
  19576. ;
  19577. return self;
  19578. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19579. },
  19580. args: ["aString", "anObject", "anObject2"],
  19581. 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'>",
  19582. referencedClasses: [],
  19583. messageSends: []
  19584. }),
  19585. $globals.NativeFunction.a$cls);
  19586. $core.addMethod(
  19587. $core.method({
  19588. selector: "constructorNamed:value:value:value:",
  19589. protocol: "instance creation",
  19590. fn: function (aString,anObject,anObject2,anObject3){
  19591. var self=this,$self=this;
  19592. return $core.withContext(function($ctx1) {
  19593. var nativeFunc=$globals.Platform._globals[aString];
  19594. return new nativeFunc(anObject,anObject2, anObject3);
  19595. ;
  19596. return self;
  19597. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19598. },
  19599. args: ["aString", "anObject", "anObject2", "anObject3"],
  19600. 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'>",
  19601. referencedClasses: [],
  19602. messageSends: []
  19603. }),
  19604. $globals.NativeFunction.a$cls);
  19605. $core.addMethod(
  19606. $core.method({
  19607. selector: "constructorOf:",
  19608. protocol: "instance creation",
  19609. fn: function (nativeFunc){
  19610. var self=this,$self=this;
  19611. return $core.withContext(function($ctx1) {
  19612. return new nativeFunc();
  19613. ;
  19614. return self;
  19615. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19616. },
  19617. args: ["nativeFunc"],
  19618. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19619. referencedClasses: [],
  19620. messageSends: []
  19621. }),
  19622. $globals.NativeFunction.a$cls);
  19623. $core.addMethod(
  19624. $core.method({
  19625. selector: "constructorOf:value:",
  19626. protocol: "instance creation",
  19627. fn: function (nativeFunc,anObject){
  19628. var self=this,$self=this;
  19629. return $core.withContext(function($ctx1) {
  19630. return new nativeFunc(anObject);
  19631. ;
  19632. return self;
  19633. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19634. },
  19635. args: ["nativeFunc", "anObject"],
  19636. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19637. referencedClasses: [],
  19638. messageSends: []
  19639. }),
  19640. $globals.NativeFunction.a$cls);
  19641. $core.addMethod(
  19642. $core.method({
  19643. selector: "constructorOf:value:value:",
  19644. protocol: "instance creation",
  19645. fn: function (nativeFunc,anObject,anObject2){
  19646. var self=this,$self=this;
  19647. return $core.withContext(function($ctx1) {
  19648. return new nativeFunc(anObject,anObject2);
  19649. ;
  19650. return self;
  19651. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19652. },
  19653. args: ["nativeFunc", "anObject", "anObject2"],
  19654. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19655. referencedClasses: [],
  19656. messageSends: []
  19657. }),
  19658. $globals.NativeFunction.a$cls);
  19659. $core.addMethod(
  19660. $core.method({
  19661. selector: "constructorOf:value:value:value:",
  19662. protocol: "instance creation",
  19663. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19664. var self=this,$self=this;
  19665. return $core.withContext(function($ctx1) {
  19666. return new nativeFunc(anObject,anObject2, anObject3);
  19667. ;
  19668. return self;
  19669. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19670. },
  19671. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19672. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19673. referencedClasses: [],
  19674. messageSends: []
  19675. }),
  19676. $globals.NativeFunction.a$cls);
  19677. $core.addMethod(
  19678. $core.method({
  19679. selector: "exists:",
  19680. protocol: "testing",
  19681. fn: function (aString){
  19682. var self=this,$self=this;
  19683. return $core.withContext(function($ctx1) {
  19684. return $recv($globals.Platform)._includesGlobal_(aString);
  19685. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19686. },
  19687. args: ["aString"],
  19688. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19689. referencedClasses: ["Platform"],
  19690. messageSends: ["includesGlobal:"]
  19691. }),
  19692. $globals.NativeFunction.a$cls);
  19693. $core.addMethod(
  19694. $core.method({
  19695. selector: "functionNamed:",
  19696. protocol: "function calling",
  19697. fn: function (aString){
  19698. var self=this,$self=this;
  19699. return $core.withContext(function($ctx1) {
  19700. var nativeFunc=$globals.Platform._globals[aString];
  19701. return nativeFunc();
  19702. ;
  19703. return self;
  19704. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19705. },
  19706. args: ["aString"],
  19707. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19708. referencedClasses: [],
  19709. messageSends: []
  19710. }),
  19711. $globals.NativeFunction.a$cls);
  19712. $core.addMethod(
  19713. $core.method({
  19714. selector: "functionNamed:value:",
  19715. protocol: "function calling",
  19716. fn: function (aString,anObject){
  19717. var self=this,$self=this;
  19718. return $core.withContext(function($ctx1) {
  19719. var nativeFunc=$globals.Platform._globals()[aString];
  19720. return nativeFunc(anObject);
  19721. ;
  19722. return self;
  19723. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19724. },
  19725. args: ["aString", "anObject"],
  19726. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19727. referencedClasses: [],
  19728. messageSends: []
  19729. }),
  19730. $globals.NativeFunction.a$cls);
  19731. $core.addMethod(
  19732. $core.method({
  19733. selector: "functionNamed:value:value:",
  19734. protocol: "function calling",
  19735. fn: function (aString,anObject,anObject2){
  19736. var self=this,$self=this;
  19737. return $core.withContext(function($ctx1) {
  19738. var nativeFunc=$globals.Platform._globals()[aString];
  19739. return nativeFunc(anObject,anObject2);
  19740. ;
  19741. return self;
  19742. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19743. },
  19744. args: ["aString", "anObject", "anObject2"],
  19745. 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'>",
  19746. referencedClasses: [],
  19747. messageSends: []
  19748. }),
  19749. $globals.NativeFunction.a$cls);
  19750. $core.addMethod(
  19751. $core.method({
  19752. selector: "functionNamed:value:value:value:",
  19753. protocol: "function calling",
  19754. fn: function (aString,anObject,anObject2,anObject3){
  19755. var self=this,$self=this;
  19756. return $core.withContext(function($ctx1) {
  19757. var nativeFunc=$globals.Platform._globals()[aString];
  19758. return nativeFunc(anObject,anObject2, anObject3);
  19759. ;
  19760. return self;
  19761. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19762. },
  19763. args: ["aString", "anObject", "anObject2", "anObject3"],
  19764. 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'>",
  19765. referencedClasses: [],
  19766. messageSends: []
  19767. }),
  19768. $globals.NativeFunction.a$cls);
  19769. $core.addMethod(
  19770. $core.method({
  19771. selector: "functionNamed:valueWithArgs:",
  19772. protocol: "function calling",
  19773. fn: function (aString,args){
  19774. var self=this,$self=this;
  19775. return $core.withContext(function($ctx1) {
  19776. var nativeFunc=$globals.Platform._globals()[aString];
  19777. return Function.prototype.apply.call(nativeFunc, null, args);
  19778. ;
  19779. return self;
  19780. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19781. },
  19782. args: ["aString", "args"],
  19783. 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'>",
  19784. referencedClasses: [],
  19785. messageSends: []
  19786. }),
  19787. $globals.NativeFunction.a$cls);
  19788. $core.addMethod(
  19789. $core.method({
  19790. selector: "functionOf:",
  19791. protocol: "function calling",
  19792. fn: function (nativeFunc){
  19793. var self=this,$self=this;
  19794. return $core.withContext(function($ctx1) {
  19795. return nativeFunc();
  19796. ;
  19797. return self;
  19798. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19799. },
  19800. args: ["nativeFunc"],
  19801. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19802. referencedClasses: [],
  19803. messageSends: []
  19804. }),
  19805. $globals.NativeFunction.a$cls);
  19806. $core.addMethod(
  19807. $core.method({
  19808. selector: "functionOf:value:",
  19809. protocol: "function calling",
  19810. fn: function (nativeFunc,anObject){
  19811. var self=this,$self=this;
  19812. return $core.withContext(function($ctx1) {
  19813. return nativeFunc(anObject);
  19814. ;
  19815. return self;
  19816. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19817. },
  19818. args: ["nativeFunc", "anObject"],
  19819. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19820. referencedClasses: [],
  19821. messageSends: []
  19822. }),
  19823. $globals.NativeFunction.a$cls);
  19824. $core.addMethod(
  19825. $core.method({
  19826. selector: "functionOf:value:value:",
  19827. protocol: "function calling",
  19828. fn: function (nativeFunc,anObject,anObject2){
  19829. var self=this,$self=this;
  19830. return $core.withContext(function($ctx1) {
  19831. return nativeFunc(anObject,anObject2);
  19832. ;
  19833. return self;
  19834. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19835. },
  19836. args: ["nativeFunc", "anObject", "anObject2"],
  19837. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19838. referencedClasses: [],
  19839. messageSends: []
  19840. }),
  19841. $globals.NativeFunction.a$cls);
  19842. $core.addMethod(
  19843. $core.method({
  19844. selector: "functionOf:value:value:value:",
  19845. protocol: "function calling",
  19846. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19847. var self=this,$self=this;
  19848. return $core.withContext(function($ctx1) {
  19849. return nativeFunc(anObject,anObject2, anObject3);
  19850. ;
  19851. return self;
  19852. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19853. },
  19854. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19855. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19856. referencedClasses: [],
  19857. messageSends: []
  19858. }),
  19859. $globals.NativeFunction.a$cls);
  19860. $core.addMethod(
  19861. $core.method({
  19862. selector: "functionOf:valueWithArgs:",
  19863. protocol: "function calling",
  19864. fn: function (nativeFunc,args){
  19865. var self=this,$self=this;
  19866. return $core.withContext(function($ctx1) {
  19867. return Function.prototype.apply.call(nativeFunc, null, args);
  19868. ;
  19869. return self;
  19870. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19871. },
  19872. args: ["nativeFunc", "args"],
  19873. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19874. referencedClasses: [],
  19875. messageSends: []
  19876. }),
  19877. $globals.NativeFunction.a$cls);
  19878. $core.addMethod(
  19879. $core.method({
  19880. selector: "isNativeFunction:",
  19881. protocol: "testing",
  19882. fn: function (anObject){
  19883. var self=this,$self=this;
  19884. return $core.withContext(function($ctx1) {
  19885. return typeof anObject === "function";
  19886. return self;
  19887. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19888. },
  19889. args: ["anObject"],
  19890. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19891. referencedClasses: [],
  19892. messageSends: []
  19893. }),
  19894. $globals.NativeFunction.a$cls);
  19895. $core.addMethod(
  19896. $core.method({
  19897. selector: "methodOf:this:",
  19898. protocol: "method calling",
  19899. fn: function (nativeFunc,thisObject){
  19900. var self=this,$self=this;
  19901. return $core.withContext(function($ctx1) {
  19902. return Function.prototype.call.call(nativeFunc, thisObject);
  19903. ;
  19904. return self;
  19905. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19906. },
  19907. args: ["nativeFunc", "thisObject"],
  19908. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19909. referencedClasses: [],
  19910. messageSends: []
  19911. }),
  19912. $globals.NativeFunction.a$cls);
  19913. $core.addMethod(
  19914. $core.method({
  19915. selector: "methodOf:this:value:",
  19916. protocol: "method calling",
  19917. fn: function (nativeFunc,thisObject,anObject){
  19918. var self=this,$self=this;
  19919. return $core.withContext(function($ctx1) {
  19920. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19921. ;
  19922. return self;
  19923. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19924. },
  19925. args: ["nativeFunc", "thisObject", "anObject"],
  19926. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19927. referencedClasses: [],
  19928. messageSends: []
  19929. }),
  19930. $globals.NativeFunction.a$cls);
  19931. $core.addMethod(
  19932. $core.method({
  19933. selector: "methodOf:this:value:value:",
  19934. protocol: "method calling",
  19935. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19936. var self=this,$self=this;
  19937. return $core.withContext(function($ctx1) {
  19938. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19939. ;
  19940. return self;
  19941. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19942. },
  19943. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19944. 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'>",
  19945. referencedClasses: [],
  19946. messageSends: []
  19947. }),
  19948. $globals.NativeFunction.a$cls);
  19949. $core.addMethod(
  19950. $core.method({
  19951. selector: "methodOf:this:value:value:value:",
  19952. protocol: "method calling",
  19953. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19954. var self=this,$self=this;
  19955. return $core.withContext(function($ctx1) {
  19956. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19957. ;
  19958. return self;
  19959. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19960. },
  19961. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19962. 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'>",
  19963. referencedClasses: [],
  19964. messageSends: []
  19965. }),
  19966. $globals.NativeFunction.a$cls);
  19967. $core.addMethod(
  19968. $core.method({
  19969. selector: "methodOf:this:valueWithArgs:",
  19970. protocol: "method calling",
  19971. fn: function (nativeFunc,thisObject,args){
  19972. var self=this,$self=this;
  19973. return $core.withContext(function($ctx1) {
  19974. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19975. ;
  19976. return self;
  19977. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19978. },
  19979. args: ["nativeFunc", "thisObject", "args"],
  19980. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19981. referencedClasses: [],
  19982. messageSends: []
  19983. }),
  19984. $globals.NativeFunction.a$cls);
  19985. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19986. $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.";
  19987. $core.addMethod(
  19988. $core.method({
  19989. selector: "clearInterval",
  19990. protocol: "timeout/interval",
  19991. fn: function (){
  19992. var self=this,$self=this;
  19993. return $core.withContext(function($ctx1) {
  19994. var interval = $self["@rawTimeout"];
  19995. clearInterval(interval);
  19996. ;
  19997. return self;
  19998. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19999. },
  20000. args: [],
  20001. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  20002. referencedClasses: [],
  20003. messageSends: []
  20004. }),
  20005. $globals.Timeout);
  20006. $core.addMethod(
  20007. $core.method({
  20008. selector: "clearTimeout",
  20009. protocol: "timeout/interval",
  20010. fn: function (){
  20011. var self=this,$self=this;
  20012. return $core.withContext(function($ctx1) {
  20013. var timeout = $self["@rawTimeout"];
  20014. clearTimeout(timeout);
  20015. ;
  20016. return self;
  20017. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  20018. },
  20019. args: [],
  20020. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  20021. referencedClasses: [],
  20022. messageSends: []
  20023. }),
  20024. $globals.Timeout);
  20025. $core.addMethod(
  20026. $core.method({
  20027. selector: "rawTimeout:",
  20028. protocol: "accessing",
  20029. fn: function (anObject){
  20030. var self=this,$self=this;
  20031. $self["@rawTimeout"]=anObject;
  20032. return self;
  20033. },
  20034. args: ["anObject"],
  20035. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  20036. referencedClasses: [],
  20037. messageSends: []
  20038. }),
  20039. $globals.Timeout);
  20040. $core.addMethod(
  20041. $core.method({
  20042. selector: "on:",
  20043. protocol: "instance creation",
  20044. fn: function (anObject){
  20045. var self=this,$self=this;
  20046. return $core.withContext(function($ctx1) {
  20047. var $1;
  20048. $1=$self._new();
  20049. $recv($1)._rawTimeout_(anObject);
  20050. return $recv($1)._yourself();
  20051. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  20052. },
  20053. args: ["anObject"],
  20054. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  20055. referencedClasses: [],
  20056. messageSends: ["rawTimeout:", "new", "yourself"]
  20057. }),
  20058. $globals.Timeout.a$cls);
  20059. });
  20060. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20061. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20062. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20063. $core.addPackage("Kernel-Dag");
  20064. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  20065. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20066. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  20067. $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:`.";
  20068. $core.addMethod(
  20069. $core.method({
  20070. selector: "value:",
  20071. protocol: "evaluating",
  20072. fn: function (anObject){
  20073. var self=this,$self=this;
  20074. return $core.withContext(function($ctx1) {
  20075. return $self._visit_(anObject);
  20076. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  20077. },
  20078. args: ["anObject"],
  20079. source: "value: anObject\x0a\x09^ self visit: anObject",
  20080. referencedClasses: [],
  20081. messageSends: ["visit:"]
  20082. }),
  20083. $globals.AbstractDagVisitor);
  20084. $core.addMethod(
  20085. $core.method({
  20086. selector: "visit:",
  20087. protocol: "visiting",
  20088. fn: function (aNode){
  20089. var self=this,$self=this;
  20090. return $core.withContext(function($ctx1) {
  20091. return $recv(aNode)._acceptDagVisitor_(self);
  20092. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20093. },
  20094. args: ["aNode"],
  20095. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20096. referencedClasses: [],
  20097. messageSends: ["acceptDagVisitor:"]
  20098. }),
  20099. $globals.AbstractDagVisitor);
  20100. $core.addMethod(
  20101. $core.method({
  20102. selector: "visitAll:",
  20103. protocol: "visiting",
  20104. fn: function (aCollection){
  20105. var self=this,$self=this;
  20106. return $core.withContext(function($ctx1) {
  20107. return $recv(aCollection)._collect_((function(each){
  20108. return $core.withContext(function($ctx2) {
  20109. return $self._visit_(each);
  20110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20111. }));
  20112. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20113. },
  20114. args: ["aCollection"],
  20115. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20116. referencedClasses: [],
  20117. messageSends: ["collect:", "visit:"]
  20118. }),
  20119. $globals.AbstractDagVisitor);
  20120. $core.addMethod(
  20121. $core.method({
  20122. selector: "visitAllChildren:",
  20123. protocol: "visiting",
  20124. fn: function (aDagNode){
  20125. var self=this,$self=this;
  20126. return $core.withContext(function($ctx1) {
  20127. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20128. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20129. },
  20130. args: ["aDagNode"],
  20131. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20132. referencedClasses: [],
  20133. messageSends: ["visitAll:", "dagChildren"]
  20134. }),
  20135. $globals.AbstractDagVisitor);
  20136. $core.addMethod(
  20137. $core.method({
  20138. selector: "visitDagNode:",
  20139. protocol: "visiting",
  20140. fn: function (aNode){
  20141. var self=this,$self=this;
  20142. return $core.withContext(function($ctx1) {
  20143. $self._subclassResponsibility();
  20144. return self;
  20145. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20146. },
  20147. args: ["aNode"],
  20148. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20149. referencedClasses: [],
  20150. messageSends: ["subclassResponsibility"]
  20151. }),
  20152. $globals.AbstractDagVisitor);
  20153. $core.addMethod(
  20154. $core.method({
  20155. selector: "visitDagNodeVariantRedux:",
  20156. protocol: "visiting",
  20157. fn: function (aNode){
  20158. var self=this,$self=this;
  20159. var newChildren,oldChildren;
  20160. return $core.withContext(function($ctx1) {
  20161. var $2,$3,$1,$4,$5;
  20162. var $early={};
  20163. try {
  20164. oldChildren=$recv(aNode)._dagChildren();
  20165. newChildren=$self._visitAllChildren_(aNode);
  20166. $2=$recv(oldChildren)._size();
  20167. $ctx1.sendIdx["size"]=1;
  20168. $3=$recv(newChildren)._size();
  20169. $ctx1.sendIdx["size"]=2;
  20170. $1=$recv($2).__eq($3);
  20171. if($core.assert($1)){
  20172. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20173. return $core.withContext(function($ctx2) {
  20174. $4=$recv(oldChildren)._at_(i);
  20175. $ctx2.sendIdx["at:"]=1;
  20176. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20177. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20178. }),(function(){
  20179. throw $early=[aNode];
  20180. }));
  20181. }
  20182. $5=$recv(aNode)._copy();
  20183. $recv($5)._dagChildren_(newChildren);
  20184. return $recv($5)._yourself();
  20185. }
  20186. catch(e) {if(e===$early)return e[0]; throw e}
  20187. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20188. },
  20189. args: ["aNode"],
  20190. 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",
  20191. referencedClasses: [],
  20192. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20193. }),
  20194. $globals.AbstractDagVisitor);
  20195. $core.addMethod(
  20196. $core.method({
  20197. selector: "visitDagNodeVariantSimple:",
  20198. protocol: "visiting",
  20199. fn: function (aNode){
  20200. var self=this,$self=this;
  20201. return $core.withContext(function($ctx1) {
  20202. $self._visitAllChildren_(aNode);
  20203. return aNode;
  20204. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20205. },
  20206. args: ["aNode"],
  20207. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20208. referencedClasses: [],
  20209. messageSends: ["visitAllChildren:"]
  20210. }),
  20211. $globals.AbstractDagVisitor);
  20212. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20213. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20214. $core.addMethod(
  20215. $core.method({
  20216. selector: "initialize",
  20217. protocol: "initialization",
  20218. fn: function (){
  20219. var self=this,$self=this;
  20220. return $core.withContext(function($ctx1) {
  20221. (
  20222. $ctx1.supercall = true,
  20223. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20224. $ctx1.supercall = false;
  20225. $self["@path"]=[];
  20226. return self;
  20227. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20228. },
  20229. args: [],
  20230. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20231. referencedClasses: [],
  20232. messageSends: ["initialize"]
  20233. }),
  20234. $globals.PathDagVisitor);
  20235. $core.addMethod(
  20236. $core.method({
  20237. selector: "path",
  20238. protocol: "accessing",
  20239. fn: function (){
  20240. var self=this,$self=this;
  20241. return $self["@path"];
  20242. },
  20243. args: [],
  20244. source: "path\x0a\x09^ path",
  20245. referencedClasses: [],
  20246. messageSends: []
  20247. }),
  20248. $globals.PathDagVisitor);
  20249. $core.addMethod(
  20250. $core.method({
  20251. selector: "visit:",
  20252. protocol: "visiting",
  20253. fn: function (aNode){
  20254. var self=this,$self=this;
  20255. var oldPath,result;
  20256. return $core.withContext(function($ctx1) {
  20257. result=aNode;
  20258. oldPath=$self["@path"];
  20259. $recv((function(){
  20260. return $core.withContext(function($ctx2) {
  20261. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20262. $self["@path"];
  20263. result=(
  20264. $ctx2.supercall = true,
  20265. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20266. $ctx2.supercall = false;
  20267. return result;
  20268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20269. }))._ensure_((function(){
  20270. $self["@path"]=oldPath;
  20271. return $self["@path"];
  20272. }));
  20273. return result;
  20274. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20275. },
  20276. args: ["aNode"],
  20277. 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",
  20278. referencedClasses: [],
  20279. messageSends: ["ensure:", ",", "visit:"]
  20280. }),
  20281. $globals.PathDagVisitor);
  20282. $core.addMethod(
  20283. $core.method({
  20284. selector: "visitDagNodeVariantRedux:",
  20285. protocol: "visiting",
  20286. fn: function (aNode){
  20287. var self=this,$self=this;
  20288. var newNode;
  20289. return $core.withContext(function($ctx1) {
  20290. var $1;
  20291. newNode=(
  20292. $ctx1.supercall = true,
  20293. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20294. $ctx1.supercall = false;
  20295. $1=$recv(aNode).__eq_eq(newNode);
  20296. if(!$core.assert($1)){
  20297. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20298. }
  20299. return newNode;
  20300. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20301. },
  20302. args: ["aNode"],
  20303. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20304. referencedClasses: [],
  20305. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20306. }),
  20307. $globals.PathDagVisitor);
  20308. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20309. $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).";
  20310. $core.addMethod(
  20311. $core.method({
  20312. selector: "acceptDagVisitor:",
  20313. protocol: "visiting",
  20314. fn: function (aVisitor){
  20315. var self=this,$self=this;
  20316. return $core.withContext(function($ctx1) {
  20317. return $recv(aVisitor)._visitDagNode_(self);
  20318. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20319. },
  20320. args: ["aVisitor"],
  20321. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20322. referencedClasses: [],
  20323. messageSends: ["visitDagNode:"]
  20324. }),
  20325. $globals.DagNode);
  20326. $core.addMethod(
  20327. $core.method({
  20328. selector: "allDagChildren",
  20329. protocol: "accessing",
  20330. fn: function (){
  20331. var self=this,$self=this;
  20332. var allNodes;
  20333. return $core.withContext(function($ctx1) {
  20334. var $1;
  20335. $1=$self._dagChildren();
  20336. $ctx1.sendIdx["dagChildren"]=1;
  20337. allNodes=$recv($1)._asSet();
  20338. $recv($self._dagChildren())._do_((function(each){
  20339. return $core.withContext(function($ctx2) {
  20340. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20342. }));
  20343. return allNodes;
  20344. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20345. },
  20346. args: [],
  20347. 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",
  20348. referencedClasses: [],
  20349. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20350. }),
  20351. $globals.DagNode);
  20352. $core.addMethod(
  20353. $core.method({
  20354. selector: "dagChildren",
  20355. protocol: "accessing",
  20356. fn: function (){
  20357. var self=this,$self=this;
  20358. return $core.withContext(function($ctx1) {
  20359. $self._subclassResponsibility();
  20360. return self;
  20361. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20362. },
  20363. args: [],
  20364. source: "dagChildren\x0a\x09self subclassResponsibility",
  20365. referencedClasses: [],
  20366. messageSends: ["subclassResponsibility"]
  20367. }),
  20368. $globals.DagNode);
  20369. $core.addMethod(
  20370. $core.method({
  20371. selector: "dagChildren:",
  20372. protocol: "accessing",
  20373. fn: function (aCollection){
  20374. var self=this,$self=this;
  20375. return $core.withContext(function($ctx1) {
  20376. $self._subclassResponsibility();
  20377. return self;
  20378. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20379. },
  20380. args: ["aCollection"],
  20381. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20382. referencedClasses: [],
  20383. messageSends: ["subclassResponsibility"]
  20384. }),
  20385. $globals.DagNode);
  20386. $core.addMethod(
  20387. $core.method({
  20388. selector: "isDagNode",
  20389. protocol: "testing",
  20390. fn: function (){
  20391. var self=this,$self=this;
  20392. return true;
  20393. },
  20394. args: [],
  20395. source: "isDagNode\x0a\x09^ true",
  20396. referencedClasses: [],
  20397. messageSends: []
  20398. }),
  20399. $globals.DagNode);
  20400. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20401. $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.";
  20402. $core.addMethod(
  20403. $core.method({
  20404. selector: "addDagChild:",
  20405. protocol: "accessing",
  20406. fn: function (aDagNode){
  20407. var self=this,$self=this;
  20408. return $core.withContext(function($ctx1) {
  20409. $recv($self._dagChildren())._add_(aDagNode);
  20410. return self;
  20411. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20412. },
  20413. args: ["aDagNode"],
  20414. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20415. referencedClasses: [],
  20416. messageSends: ["add:", "dagChildren"]
  20417. }),
  20418. $globals.DagParentNode);
  20419. $core.addMethod(
  20420. $core.method({
  20421. selector: "dagChildren",
  20422. protocol: "accessing",
  20423. fn: function (){
  20424. var self=this,$self=this;
  20425. return $core.withContext(function($ctx1) {
  20426. var $1,$receiver;
  20427. $1=$self["@nodes"];
  20428. if(($receiver = $1) == null || $receiver.a$nil){
  20429. $self["@nodes"]=$recv($globals.Array)._new();
  20430. return $self["@nodes"];
  20431. } else {
  20432. return $1;
  20433. }
  20434. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20435. },
  20436. args: [],
  20437. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20438. referencedClasses: ["Array"],
  20439. messageSends: ["ifNil:", "new"]
  20440. }),
  20441. $globals.DagParentNode);
  20442. $core.addMethod(
  20443. $core.method({
  20444. selector: "dagChildren:",
  20445. protocol: "accessing",
  20446. fn: function (aCollection){
  20447. var self=this,$self=this;
  20448. $self["@nodes"]=aCollection;
  20449. return self;
  20450. },
  20451. args: ["aCollection"],
  20452. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20453. referencedClasses: [],
  20454. messageSends: []
  20455. }),
  20456. $globals.DagParentNode);
  20457. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20458. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20459. $core.addMethod(
  20460. $core.method({
  20461. selector: "dagChildren",
  20462. protocol: "accessing",
  20463. fn: function (){
  20464. var self=this,$self=this;
  20465. return [];
  20466. },
  20467. args: [],
  20468. source: "dagChildren\x0a\x09^ #()",
  20469. referencedClasses: [],
  20470. messageSends: []
  20471. }),
  20472. $globals.DagSink);
  20473. $core.addMethod(
  20474. $core.method({
  20475. selector: "dagChildren:",
  20476. protocol: "accessing",
  20477. fn: function (aCollection){
  20478. var self=this,$self=this;
  20479. return $core.withContext(function($ctx1) {
  20480. $recv(aCollection)._ifNotEmpty_((function(){
  20481. return $core.withContext(function($ctx2) {
  20482. return $self._error_("A DagSink cannot have children.");
  20483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20484. }));
  20485. return self;
  20486. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20487. },
  20488. args: ["aCollection"],
  20489. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20490. referencedClasses: [],
  20491. messageSends: ["ifNotEmpty:", "error:"]
  20492. }),
  20493. $globals.DagSink);
  20494. $core.addMethod(
  20495. $core.method({
  20496. selector: "isDagNode",
  20497. protocol: "*Kernel-Dag",
  20498. fn: function (){
  20499. var self=this,$self=this;
  20500. return false;
  20501. },
  20502. args: [],
  20503. source: "isDagNode\x0a\x09^ false",
  20504. referencedClasses: [],
  20505. messageSends: []
  20506. }),
  20507. $globals.Object);
  20508. });
  20509. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20510. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20511. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20512. $core.addPackage("Kernel-Exceptions");
  20513. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20514. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20515. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20516. $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.";
  20517. $core.addMethod(
  20518. $core.method({
  20519. selector: "beHandled",
  20520. protocol: "accessing",
  20521. fn: function (){
  20522. var self=this,$self=this;
  20523. return $core.withContext(function($ctx1) {
  20524. self.amberHandled = true;
  20525. return self;
  20526. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20527. },
  20528. args: [],
  20529. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20530. referencedClasses: [],
  20531. messageSends: []
  20532. }),
  20533. $globals.Error);
  20534. $core.addMethod(
  20535. $core.method({
  20536. selector: "beUnhandled",
  20537. protocol: "accessing",
  20538. fn: function (){
  20539. var self=this,$self=this;
  20540. return $core.withContext(function($ctx1) {
  20541. self.amberHandled = false;
  20542. return self;
  20543. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20544. },
  20545. args: [],
  20546. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20547. referencedClasses: [],
  20548. messageSends: []
  20549. }),
  20550. $globals.Error);
  20551. $core.addMethod(
  20552. $core.method({
  20553. selector: "context",
  20554. protocol: "accessing",
  20555. fn: function (){
  20556. var self=this,$self=this;
  20557. return $core.withContext(function($ctx1) {
  20558. return self.context;
  20559. return self;
  20560. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20561. },
  20562. args: [],
  20563. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20564. referencedClasses: [],
  20565. messageSends: []
  20566. }),
  20567. $globals.Error);
  20568. $core.addMethod(
  20569. $core.method({
  20570. selector: "initialize",
  20571. protocol: "initialization",
  20572. fn: function (){
  20573. var self=this,$self=this;
  20574. return $core.withContext(function($ctx1) {
  20575. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20576. return self;
  20577. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20578. },
  20579. args: [],
  20580. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20581. referencedClasses: [],
  20582. messageSends: ["messageText:", ",", "name", "class"]
  20583. }),
  20584. $globals.Error);
  20585. $core.addMethod(
  20586. $core.method({
  20587. selector: "isSmalltalkError",
  20588. protocol: "testing",
  20589. fn: function (){
  20590. var self=this,$self=this;
  20591. return $core.withContext(function($ctx1) {
  20592. return self.smalltalkError === true;
  20593. return self;
  20594. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20595. },
  20596. args: [],
  20597. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20598. referencedClasses: [],
  20599. messageSends: []
  20600. }),
  20601. $globals.Error);
  20602. $core.addMethod(
  20603. $core.method({
  20604. selector: "jsStack",
  20605. protocol: "accessing",
  20606. fn: function (){
  20607. var self=this,$self=this;
  20608. return $core.withContext(function($ctx1) {
  20609. return self.stack;
  20610. return self;
  20611. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20612. },
  20613. args: [],
  20614. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20615. referencedClasses: [],
  20616. messageSends: []
  20617. }),
  20618. $globals.Error);
  20619. $core.addMethod(
  20620. $core.method({
  20621. selector: "messageText",
  20622. protocol: "accessing",
  20623. fn: function (){
  20624. var self=this,$self=this;
  20625. return $self["@messageText"];
  20626. },
  20627. args: [],
  20628. source: "messageText\x0a\x09^ messageText",
  20629. referencedClasses: [],
  20630. messageSends: []
  20631. }),
  20632. $globals.Error);
  20633. $core.addMethod(
  20634. $core.method({
  20635. selector: "messageText:",
  20636. protocol: "accessing",
  20637. fn: function (aString){
  20638. var self=this,$self=this;
  20639. $self["@messageText"]=aString;
  20640. return self;
  20641. },
  20642. args: ["aString"],
  20643. source: "messageText: aString\x0a\x09messageText := aString",
  20644. referencedClasses: [],
  20645. messageSends: []
  20646. }),
  20647. $globals.Error);
  20648. $core.addMethod(
  20649. $core.method({
  20650. selector: "resignal",
  20651. protocol: "signaling",
  20652. fn: function (){
  20653. var self=this,$self=this;
  20654. return $core.withContext(function($ctx1) {
  20655. self.amberHandled = false;
  20656. throw(self);
  20657. ;
  20658. return self;
  20659. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20660. },
  20661. args: [],
  20662. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  20663. referencedClasses: [],
  20664. messageSends: []
  20665. }),
  20666. $globals.Error);
  20667. $core.addMethod(
  20668. $core.method({
  20669. selector: "signal",
  20670. protocol: "signaling",
  20671. fn: function (){
  20672. var self=this,$self=this;
  20673. return $core.withContext(function($ctx1) {
  20674. self.amberHandled = false;
  20675. self.context = $core.getThisContext();
  20676. self.smalltalkError = true;
  20677. throw self;
  20678. ;
  20679. return self;
  20680. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20681. },
  20682. args: [],
  20683. 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'>",
  20684. referencedClasses: [],
  20685. messageSends: []
  20686. }),
  20687. $globals.Error);
  20688. $core.addMethod(
  20689. $core.method({
  20690. selector: "signal:",
  20691. protocol: "signaling",
  20692. fn: function (aString){
  20693. var self=this,$self=this;
  20694. return $core.withContext(function($ctx1) {
  20695. $self._messageText_(aString);
  20696. $self._signal();
  20697. return self;
  20698. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20699. },
  20700. args: ["aString"],
  20701. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20702. referencedClasses: [],
  20703. messageSends: ["messageText:", "signal"]
  20704. }),
  20705. $globals.Error);
  20706. $core.addMethod(
  20707. $core.method({
  20708. selector: "signalerContext",
  20709. protocol: "accessing",
  20710. fn: function (){
  20711. var self=this,$self=this;
  20712. return $core.withContext(function($ctx1) {
  20713. return $self._signalerContextFrom_($self._context());
  20714. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20715. },
  20716. args: [],
  20717. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20718. referencedClasses: [],
  20719. messageSends: ["signalerContextFrom:", "context"]
  20720. }),
  20721. $globals.Error);
  20722. $core.addMethod(
  20723. $core.method({
  20724. selector: "signalerContextFrom:",
  20725. protocol: "accessing",
  20726. fn: function (aContext){
  20727. var self=this,$self=this;
  20728. return $core.withContext(function($ctx1) {
  20729. var $3,$2,$1;
  20730. return $recv(aContext)._findContextSuchThat_((function(context){
  20731. return $core.withContext(function($ctx2) {
  20732. $3=$recv(context)._receiver();
  20733. $ctx2.sendIdx["receiver"]=1;
  20734. $2=$recv($3).__eq_eq(self);
  20735. $ctx2.sendIdx["=="]=1;
  20736. $1=$recv($2)._or_((function(){
  20737. return $core.withContext(function($ctx3) {
  20738. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20739. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20740. }));
  20741. return $recv($1)._not();
  20742. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20743. }));
  20744. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20745. },
  20746. args: ["aContext"],
  20747. 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 ]",
  20748. referencedClasses: [],
  20749. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20750. }),
  20751. $globals.Error);
  20752. $core.addMethod(
  20753. $core.method({
  20754. selector: "wasHandled",
  20755. protocol: "testing",
  20756. fn: function (){
  20757. var self=this,$self=this;
  20758. return $core.withContext(function($ctx1) {
  20759. return self.amberHandled || false;
  20760. return self;
  20761. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20762. },
  20763. args: [],
  20764. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20765. referencedClasses: [],
  20766. messageSends: []
  20767. }),
  20768. $globals.Error);
  20769. $core.addMethod(
  20770. $core.method({
  20771. selector: "classTag",
  20772. protocol: "accessing",
  20773. fn: function (){
  20774. var self=this,$self=this;
  20775. return "exception";
  20776. },
  20777. args: [],
  20778. 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'",
  20779. referencedClasses: [],
  20780. messageSends: []
  20781. }),
  20782. $globals.Error.a$cls);
  20783. $core.addMethod(
  20784. $core.method({
  20785. selector: "signal",
  20786. protocol: "instance creation",
  20787. fn: function (){
  20788. var self=this,$self=this;
  20789. return $core.withContext(function($ctx1) {
  20790. return $recv($self._new())._signal();
  20791. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20792. },
  20793. args: [],
  20794. source: "signal\x0a\x09^ self new signal",
  20795. referencedClasses: [],
  20796. messageSends: ["signal", "new"]
  20797. }),
  20798. $globals.Error.a$cls);
  20799. $core.addMethod(
  20800. $core.method({
  20801. selector: "signal:",
  20802. protocol: "instance creation",
  20803. fn: function (aString){
  20804. var self=this,$self=this;
  20805. return $core.withContext(function($ctx1) {
  20806. return $recv($self._new())._signal_(aString);
  20807. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20808. },
  20809. args: ["aString"],
  20810. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20811. referencedClasses: [],
  20812. messageSends: ["signal:", "new"]
  20813. }),
  20814. $globals.Error.a$cls);
  20815. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20816. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20817. $core.addMethod(
  20818. $core.method({
  20819. selector: "messageText",
  20820. protocol: "accessing",
  20821. fn: function (){
  20822. var self=this,$self=this;
  20823. return "Halt encountered";
  20824. },
  20825. args: [],
  20826. source: "messageText\x0a\x09^ 'Halt encountered'",
  20827. referencedClasses: [],
  20828. messageSends: []
  20829. }),
  20830. $globals.Halt);
  20831. $core.addMethod(
  20832. $core.method({
  20833. selector: "signalerContextFrom:",
  20834. protocol: "accessing",
  20835. fn: function (aContext){
  20836. var self=this,$self=this;
  20837. return $core.withContext(function($ctx1) {
  20838. var $3,$2,$1;
  20839. return $recv(aContext)._findContextSuchThat_((function(context){
  20840. return $core.withContext(function($ctx2) {
  20841. $3=$recv(context)._receiver();
  20842. $ctx2.sendIdx["receiver"]=1;
  20843. $2=$recv($3).__eq_eq(self);
  20844. $ctx2.sendIdx["=="]=1;
  20845. $1=$recv($2)._or_((function(){
  20846. return $core.withContext(function($ctx3) {
  20847. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20848. return $core.withContext(function($ctx4) {
  20849. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20850. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20851. }));
  20852. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20853. }));
  20854. $ctx2.sendIdx["or:"]=1;
  20855. return $recv($1)._not();
  20856. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20857. }));
  20858. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20859. },
  20860. args: ["aContext"],
  20861. 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 ]",
  20862. referencedClasses: [],
  20863. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20864. }),
  20865. $globals.Halt);
  20866. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20867. $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:`";
  20868. $core.addMethod(
  20869. $core.method({
  20870. selector: "context:",
  20871. protocol: "accessing",
  20872. fn: function (aMethodContext){
  20873. var self=this,$self=this;
  20874. return $core.withContext(function($ctx1) {
  20875. self.context = aMethodContext;
  20876. return self;
  20877. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20878. },
  20879. args: ["aMethodContext"],
  20880. 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'>",
  20881. referencedClasses: [],
  20882. messageSends: []
  20883. }),
  20884. $globals.JavaScriptException);
  20885. $core.addMethod(
  20886. $core.method({
  20887. selector: "exception",
  20888. protocol: "accessing",
  20889. fn: function (){
  20890. var self=this,$self=this;
  20891. return $self["@exception"];
  20892. },
  20893. args: [],
  20894. source: "exception\x0a\x09^ exception",
  20895. referencedClasses: [],
  20896. messageSends: []
  20897. }),
  20898. $globals.JavaScriptException);
  20899. $core.addMethod(
  20900. $core.method({
  20901. selector: "exception:",
  20902. protocol: "accessing",
  20903. fn: function (anException){
  20904. var self=this,$self=this;
  20905. $self["@exception"]=anException;
  20906. return self;
  20907. },
  20908. args: ["anException"],
  20909. source: "exception: anException\x0a\x09exception := anException",
  20910. referencedClasses: [],
  20911. messageSends: []
  20912. }),
  20913. $globals.JavaScriptException);
  20914. $core.addMethod(
  20915. $core.method({
  20916. selector: "messageText",
  20917. protocol: "accessing",
  20918. fn: function (){
  20919. var self=this,$self=this;
  20920. return $core.withContext(function($ctx1) {
  20921. return "JavaScript exception: " + $self["@exception"].toString();
  20922. return self;
  20923. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20924. },
  20925. args: [],
  20926. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20927. referencedClasses: [],
  20928. messageSends: []
  20929. }),
  20930. $globals.JavaScriptException);
  20931. $core.addMethod(
  20932. $core.method({
  20933. selector: "shouldBeStubbed",
  20934. protocol: "testing",
  20935. fn: function (){
  20936. var self=this,$self=this;
  20937. return $core.withContext(function($ctx1) {
  20938. return $self["@exception"] instanceof RangeError;
  20939. return self;
  20940. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20941. },
  20942. args: [],
  20943. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20944. referencedClasses: [],
  20945. messageSends: []
  20946. }),
  20947. $globals.JavaScriptException);
  20948. $core.addMethod(
  20949. $core.method({
  20950. selector: "wrap",
  20951. protocol: "error handling",
  20952. fn: function (){
  20953. var self=this,$self=this;
  20954. return $core.withContext(function($ctx1) {
  20955. var $1;
  20956. $recv((function(){
  20957. return $core.withContext(function($ctx2) {
  20958. return $self._signal();
  20959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20960. }))._tryCatch_((function(){
  20961. return $core.withContext(function($ctx2) {
  20962. $1=$self._shouldBeStubbed();
  20963. if($core.assert($1)){
  20964. return $recv($self._context())._stubToAtMost_((100));
  20965. }
  20966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20967. }));
  20968. return self;
  20969. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20970. },
  20971. args: [],
  20972. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20973. referencedClasses: [],
  20974. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20975. }),
  20976. $globals.JavaScriptException);
  20977. $core.addMethod(
  20978. $core.method({
  20979. selector: "on:",
  20980. protocol: "instance creation",
  20981. fn: function (anException){
  20982. var self=this,$self=this;
  20983. return $core.withContext(function($ctx1) {
  20984. var $1;
  20985. $1=$self._new();
  20986. $recv($1)._exception_(anException);
  20987. return $recv($1)._yourself();
  20988. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20989. },
  20990. args: ["anException"],
  20991. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20992. referencedClasses: [],
  20993. messageSends: ["exception:", "new", "yourself"]
  20994. }),
  20995. $globals.JavaScriptException.a$cls);
  20996. $core.addMethod(
  20997. $core.method({
  20998. selector: "on:context:",
  20999. protocol: "instance creation",
  21000. fn: function (anException,aMethodContext){
  21001. var self=this,$self=this;
  21002. return $core.withContext(function($ctx1) {
  21003. var $1;
  21004. $1=$self._new();
  21005. $recv($1)._exception_(anException);
  21006. $recv($1)._context_(aMethodContext);
  21007. return $recv($1)._yourself();
  21008. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  21009. },
  21010. args: ["anException", "aMethodContext"],
  21011. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  21012. referencedClasses: [],
  21013. messageSends: ["exception:", "new", "context:", "yourself"]
  21014. }),
  21015. $globals.JavaScriptException.a$cls);
  21016. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  21017. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  21018. $core.addMethod(
  21019. $core.method({
  21020. selector: "message",
  21021. protocol: "accessing",
  21022. fn: function (){
  21023. var self=this,$self=this;
  21024. return $self["@message"];
  21025. },
  21026. args: [],
  21027. source: "message\x0a\x09^ message",
  21028. referencedClasses: [],
  21029. messageSends: []
  21030. }),
  21031. $globals.MessageNotUnderstood);
  21032. $core.addMethod(
  21033. $core.method({
  21034. selector: "message:",
  21035. protocol: "accessing",
  21036. fn: function (aMessage){
  21037. var self=this,$self=this;
  21038. $self["@message"]=aMessage;
  21039. return self;
  21040. },
  21041. args: ["aMessage"],
  21042. source: "message: aMessage\x0a\x09message := aMessage",
  21043. referencedClasses: [],
  21044. messageSends: []
  21045. }),
  21046. $globals.MessageNotUnderstood);
  21047. $core.addMethod(
  21048. $core.method({
  21049. selector: "messageText",
  21050. protocol: "accessing",
  21051. fn: function (){
  21052. var self=this,$self=this;
  21053. return $core.withContext(function($ctx1) {
  21054. var $1;
  21055. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  21056. $ctx1.sendIdx[","]=1;
  21057. return $1;
  21058. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  21059. },
  21060. args: [],
  21061. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  21062. referencedClasses: [],
  21063. messageSends: [",", "asString", "receiver", "selector", "message"]
  21064. }),
  21065. $globals.MessageNotUnderstood);
  21066. $core.addMethod(
  21067. $core.method({
  21068. selector: "receiver",
  21069. protocol: "accessing",
  21070. fn: function (){
  21071. var self=this,$self=this;
  21072. return $self["@receiver"];
  21073. },
  21074. args: [],
  21075. source: "receiver\x0a\x09^ receiver",
  21076. referencedClasses: [],
  21077. messageSends: []
  21078. }),
  21079. $globals.MessageNotUnderstood);
  21080. $core.addMethod(
  21081. $core.method({
  21082. selector: "receiver:",
  21083. protocol: "accessing",
  21084. fn: function (anObject){
  21085. var self=this,$self=this;
  21086. $self["@receiver"]=anObject;
  21087. return self;
  21088. },
  21089. args: ["anObject"],
  21090. source: "receiver: anObject\x0a\x09receiver := anObject",
  21091. referencedClasses: [],
  21092. messageSends: []
  21093. }),
  21094. $globals.MessageNotUnderstood);
  21095. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21096. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21097. $core.addMethod(
  21098. $core.method({
  21099. selector: "object",
  21100. protocol: "accessing",
  21101. fn: function (){
  21102. var self=this,$self=this;
  21103. return $self["@object"];
  21104. },
  21105. args: [],
  21106. source: "object\x0a\x09^ object",
  21107. referencedClasses: [],
  21108. messageSends: []
  21109. }),
  21110. $globals.NonBooleanReceiver);
  21111. $core.addMethod(
  21112. $core.method({
  21113. selector: "object:",
  21114. protocol: "accessing",
  21115. fn: function (anObject){
  21116. var self=this,$self=this;
  21117. $self["@object"]=anObject;
  21118. return self;
  21119. },
  21120. args: ["anObject"],
  21121. source: "object: anObject\x0a\x09object := anObject",
  21122. referencedClasses: [],
  21123. messageSends: []
  21124. }),
  21125. $globals.NonBooleanReceiver);
  21126. $core.addMethod(
  21127. $core.method({
  21128. selector: "signalOn:",
  21129. protocol: "instance creation",
  21130. fn: function (anObject){
  21131. var self=this,$self=this;
  21132. return $core.withContext(function($ctx1) {
  21133. var $1;
  21134. $1=$self._new();
  21135. $recv($1)._object_(anObject);
  21136. return $recv($1)._signal();
  21137. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21138. },
  21139. args: ["anObject"],
  21140. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21141. referencedClasses: [],
  21142. messageSends: ["object:", "new", "signal"]
  21143. }),
  21144. $globals.NonBooleanReceiver.a$cls);
  21145. });
  21146. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21147. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21148. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21149. $core.addPackage("Kernel-Promises");
  21150. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21151. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21152. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21153. $core.addMethod(
  21154. $core.method({
  21155. selector: "all:",
  21156. protocol: "composites",
  21157. fn: function (aCollection){
  21158. var self=this,$self=this;
  21159. return $core.withContext(function($ctx1) {
  21160. return Promise.all($recv(aCollection)._asArray());
  21161. return self;
  21162. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21163. },
  21164. args: ["aCollection"],
  21165. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21166. referencedClasses: [],
  21167. messageSends: []
  21168. }),
  21169. $globals.Promise.a$cls);
  21170. $core.addMethod(
  21171. $core.method({
  21172. selector: "any:",
  21173. protocol: "composites",
  21174. fn: function (aCollection){
  21175. var self=this,$self=this;
  21176. return $core.withContext(function($ctx1) {
  21177. return Promise.race($recv(aCollection)._asArray());
  21178. return self;
  21179. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21180. },
  21181. args: ["aCollection"],
  21182. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21183. referencedClasses: [],
  21184. messageSends: []
  21185. }),
  21186. $globals.Promise.a$cls);
  21187. $core.addMethod(
  21188. $core.method({
  21189. selector: "forBlock:",
  21190. protocol: "instance creation",
  21191. fn: function (aBlock){
  21192. var self=this,$self=this;
  21193. return $core.withContext(function($ctx1) {
  21194. return $recv($self._new())._then_(aBlock);
  21195. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21196. },
  21197. args: ["aBlock"],
  21198. 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",
  21199. referencedClasses: [],
  21200. messageSends: ["then:", "new"]
  21201. }),
  21202. $globals.Promise.a$cls);
  21203. $core.addMethod(
  21204. $core.method({
  21205. selector: "new",
  21206. protocol: "instance creation",
  21207. fn: function (){
  21208. var self=this,$self=this;
  21209. return $core.withContext(function($ctx1) {
  21210. return Promise.resolve();
  21211. return self;
  21212. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21213. },
  21214. args: [],
  21215. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21216. referencedClasses: [],
  21217. messageSends: []
  21218. }),
  21219. $globals.Promise.a$cls);
  21220. $core.addMethod(
  21221. $core.method({
  21222. selector: "new:",
  21223. protocol: "instance creation",
  21224. fn: function (aBlock){
  21225. var self=this,$self=this;
  21226. return $core.withContext(function($ctx1) {
  21227. return new Promise(function (resolve, reject) {
  21228. var model = {value: resolve, signal: reject};
  21229. aBlock._value_(model);
  21230. });
  21231. return self;
  21232. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21233. },
  21234. args: ["aBlock"],
  21235. 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})'>",
  21236. referencedClasses: [],
  21237. messageSends: []
  21238. }),
  21239. $globals.Promise.a$cls);
  21240. $core.addMethod(
  21241. $core.method({
  21242. selector: "signal:",
  21243. protocol: "instance creation",
  21244. fn: function (anObject){
  21245. var self=this,$self=this;
  21246. return $core.withContext(function($ctx1) {
  21247. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21248. return self;
  21249. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21250. },
  21251. args: ["anObject"],
  21252. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21253. referencedClasses: [],
  21254. messageSends: []
  21255. }),
  21256. $globals.Promise.a$cls);
  21257. $core.addMethod(
  21258. $core.method({
  21259. selector: "value:",
  21260. protocol: "instance creation",
  21261. fn: function (anObject){
  21262. var self=this,$self=this;
  21263. return $core.withContext(function($ctx1) {
  21264. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21265. return self;
  21266. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21267. },
  21268. args: ["anObject"],
  21269. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21270. referencedClasses: [],
  21271. messageSends: []
  21272. }),
  21273. $globals.Promise.a$cls);
  21274. $core.addTrait("TThenable", "Kernel-Promises");
  21275. $core.addMethod(
  21276. $core.method({
  21277. selector: "catch:",
  21278. protocol: "promises",
  21279. fn: function (aBlock){
  21280. var self=this,$self=this;
  21281. return $core.withContext(function($ctx1) {
  21282. return self.then(null, function (err) {return $core.seamless(function () {
  21283. return aBlock._value_(err);
  21284. })});
  21285. return self;
  21286. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21287. },
  21288. args: ["aBlock"],
  21289. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21290. referencedClasses: [],
  21291. messageSends: []
  21292. }),
  21293. $globals.TThenable);
  21294. $core.addMethod(
  21295. $core.method({
  21296. selector: "on:do:",
  21297. protocol: "promises",
  21298. fn: function (aClass,aBlock){
  21299. var self=this,$self=this;
  21300. return $core.withContext(function($ctx1) {
  21301. return self.then(null, function (err) {return $core.seamless(function () {
  21302. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21303. else throw err;
  21304. })});
  21305. return self;
  21306. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21307. },
  21308. args: ["aClass", "aBlock"],
  21309. 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})})'>",
  21310. referencedClasses: [],
  21311. messageSends: []
  21312. }),
  21313. $globals.TThenable);
  21314. $core.addMethod(
  21315. $core.method({
  21316. selector: "on:do:catch:",
  21317. protocol: "promises",
  21318. fn: function (aClass,aBlock,anotherBlock){
  21319. var self=this,$self=this;
  21320. return $core.withContext(function($ctx1) {
  21321. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21322. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21323. },
  21324. args: ["aClass", "aBlock", "anotherBlock"],
  21325. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21326. referencedClasses: [],
  21327. messageSends: ["catch:", "on:do:"]
  21328. }),
  21329. $globals.TThenable);
  21330. $core.addMethod(
  21331. $core.method({
  21332. selector: "then:",
  21333. protocol: "promises",
  21334. fn: function (aBlockOrArray){
  21335. var self=this,$self=this;
  21336. return $core.withContext(function($ctx1) {
  21337. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21338. return array.reduce(function (soFar, aBlock) {
  21339. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21340. function (result) {return $core.seamless(function () {
  21341. if (Array.isArray(result)) {
  21342. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21343. } else {
  21344. return aBlock._value_(result);
  21345. }
  21346. })} :
  21347. function (result) {return $core.seamless(function () {
  21348. return aBlock._value_(result);
  21349. })}
  21350. );
  21351. }, self);
  21352. return self;
  21353. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21354. },
  21355. args: ["aBlockOrArray"],
  21356. 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)'>",
  21357. referencedClasses: [],
  21358. messageSends: []
  21359. }),
  21360. $globals.TThenable);
  21361. $core.addMethod(
  21362. $core.method({
  21363. selector: "then:catch:",
  21364. protocol: "promises",
  21365. fn: function (aBlockOrArray,anotherBlock){
  21366. var self=this,$self=this;
  21367. return $core.withContext(function($ctx1) {
  21368. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21369. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21370. },
  21371. args: ["aBlockOrArray", "anotherBlock"],
  21372. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21373. referencedClasses: [],
  21374. messageSends: ["catch:", "then:"]
  21375. }),
  21376. $globals.TThenable);
  21377. $core.addMethod(
  21378. $core.method({
  21379. selector: "then:on:do:",
  21380. protocol: "promises",
  21381. fn: function (aBlockOrArray,aClass,aBlock){
  21382. var self=this,$self=this;
  21383. return $core.withContext(function($ctx1) {
  21384. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21385. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21386. },
  21387. args: ["aBlockOrArray", "aClass", "aBlock"],
  21388. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21389. referencedClasses: [],
  21390. messageSends: ["on:do:", "then:"]
  21391. }),
  21392. $globals.TThenable);
  21393. $core.addMethod(
  21394. $core.method({
  21395. selector: "then:on:do:catch:",
  21396. protocol: "promises",
  21397. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21398. var self=this,$self=this;
  21399. return $core.withContext(function($ctx1) {
  21400. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21401. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21402. },
  21403. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21404. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21405. referencedClasses: [],
  21406. messageSends: ["catch:", "on:do:", "then:"]
  21407. }),
  21408. $globals.TThenable);
  21409. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21410. });
  21411. 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";
  21412. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21413. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21414. $core.addPackage("Kernel-Infrastructure");
  21415. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21416. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21417. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21418. $core.addMethod(
  21419. $core.method({
  21420. selector: "initializeClasses",
  21421. protocol: "initialization",
  21422. fn: function (){
  21423. var self=this,$self=this;
  21424. return $core.withContext(function($ctx1) {
  21425. var $1;
  21426. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21427. return $core.withContext(function($ctx2) {
  21428. $1=$recv(each).__eq($globals.SmalltalkImage);
  21429. if(!$core.assert($1)){
  21430. return $recv(each)._initialize();
  21431. }
  21432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21433. }));
  21434. return self;
  21435. }, function($ctx1) {$ctx1.fill(self,"initializeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21436. },
  21437. args: [],
  21438. source: "initializeClasses\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09each = SmalltalkImage ifFalse: [ each initialize ] ]",
  21439. referencedClasses: ["Smalltalk", "SmalltalkImage"],
  21440. messageSends: ["do:", "classes", "ifFalse:", "=", "initialize"]
  21441. }),
  21442. $globals.AmberBootstrapInitialization.a$cls);
  21443. $core.addMethod(
  21444. $core.method({
  21445. selector: "organizeClasses",
  21446. protocol: "organization",
  21447. fn: function (){
  21448. var self=this,$self=this;
  21449. return $core.withContext(function($ctx1) {
  21450. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21451. return $core.withContext(function($ctx2) {
  21452. return $recv(each)._enterOrganization();
  21453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21454. }));
  21455. return self;
  21456. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21457. },
  21458. args: [],
  21459. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21460. referencedClasses: ["Smalltalk"],
  21461. messageSends: ["do:", "classes", "enterOrganization"]
  21462. }),
  21463. $globals.AmberBootstrapInitialization.a$cls);
  21464. $core.addMethod(
  21465. $core.method({
  21466. selector: "organizeMethods",
  21467. protocol: "organization",
  21468. fn: function (){
  21469. var self=this,$self=this;
  21470. return $core.withContext(function($ctx1) {
  21471. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21472. return $core.withContext(function($ctx2) {
  21473. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21474. return $core.withContext(function($ctx3) {
  21475. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21476. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21477. }));
  21478. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21479. }));
  21480. $ctx1.sendIdx["do:"]=1;
  21481. return self;
  21482. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21483. },
  21484. args: [],
  21485. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21486. referencedClasses: ["Smalltalk"],
  21487. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21488. }),
  21489. $globals.AmberBootstrapInitialization.a$cls);
  21490. $core.addMethod(
  21491. $core.method({
  21492. selector: "run",
  21493. protocol: "public api",
  21494. fn: function (){
  21495. var self=this,$self=this;
  21496. return $core.withContext(function($ctx1) {
  21497. $recv($globals.SmalltalkImage)._initialize();
  21498. $recv($globals.Smalltalk)._adoptPackageDictionary();
  21499. $self._organizeClasses();
  21500. $self._organizeMethods();
  21501. $self._initializeClasses();
  21502. return self;
  21503. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21504. },
  21505. args: [],
  21506. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09Smalltalk adoptPackageDictionary.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods;\x0a\x09\x09initializeClasses",
  21507. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21508. messageSends: ["initialize", "adoptPackageDictionary", "organizeClasses", "organizeMethods", "initializeClasses"]
  21509. }),
  21510. $globals.AmberBootstrapInitialization.a$cls);
  21511. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21512. $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`.";
  21513. $core.addMethod(
  21514. $core.method({
  21515. selector: "=",
  21516. protocol: "comparing",
  21517. fn: function (anObject){
  21518. var self=this,$self=this;
  21519. return $core.withContext(function($ctx1) {
  21520. var $2,$1;
  21521. $2=$recv(anObject)._class();
  21522. $ctx1.sendIdx["class"]=1;
  21523. $1=$recv($2).__eq_eq($self._class());
  21524. if(!$core.assert($1)){
  21525. return false;
  21526. }
  21527. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21528. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21529. },
  21530. args: ["anObject"],
  21531. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21532. referencedClasses: ["JSObjectProxy"],
  21533. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21534. }),
  21535. $globals.JSObjectProxy);
  21536. $core.addMethod(
  21537. $core.method({
  21538. selector: "asJavaScriptObject",
  21539. protocol: "converting",
  21540. fn: function (){
  21541. var self=this,$self=this;
  21542. return $self["@jsObject"];
  21543. },
  21544. args: [],
  21545. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21546. referencedClasses: [],
  21547. messageSends: []
  21548. }),
  21549. $globals.JSObjectProxy);
  21550. $core.addMethod(
  21551. $core.method({
  21552. selector: "at:",
  21553. protocol: "accessing",
  21554. fn: function (aString){
  21555. var self=this,$self=this;
  21556. return $core.withContext(function($ctx1) {
  21557. return $self['@jsObject'][aString];
  21558. return self;
  21559. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21560. },
  21561. args: ["aString"],
  21562. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21563. referencedClasses: [],
  21564. messageSends: []
  21565. }),
  21566. $globals.JSObjectProxy);
  21567. $core.addMethod(
  21568. $core.method({
  21569. selector: "at:ifAbsent:",
  21570. protocol: "accessing",
  21571. fn: function (aString,aBlock){
  21572. var self=this,$self=this;
  21573. return $core.withContext(function($ctx1) {
  21574. var obj = $self['@jsObject'];
  21575. return aString in obj ? obj[aString] : aBlock._value();
  21576. ;
  21577. return self;
  21578. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21579. },
  21580. args: ["aString", "aBlock"],
  21581. 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'>",
  21582. referencedClasses: [],
  21583. messageSends: []
  21584. }),
  21585. $globals.JSObjectProxy);
  21586. $core.addMethod(
  21587. $core.method({
  21588. selector: "at:ifPresent:",
  21589. protocol: "accessing",
  21590. fn: function (aString,aBlock){
  21591. var self=this,$self=this;
  21592. return $core.withContext(function($ctx1) {
  21593. var obj = $self['@jsObject'];
  21594. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21595. ;
  21596. return self;
  21597. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21598. },
  21599. args: ["aString", "aBlock"],
  21600. 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'>",
  21601. referencedClasses: [],
  21602. messageSends: []
  21603. }),
  21604. $globals.JSObjectProxy);
  21605. $core.addMethod(
  21606. $core.method({
  21607. selector: "at:ifPresent:ifAbsent:",
  21608. protocol: "accessing",
  21609. fn: function (aString,aBlock,anotherBlock){
  21610. var self=this,$self=this;
  21611. return $core.withContext(function($ctx1) {
  21612. var obj = $self['@jsObject'];
  21613. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21614. ;
  21615. return self;
  21616. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21617. },
  21618. args: ["aString", "aBlock", "anotherBlock"],
  21619. 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'>",
  21620. referencedClasses: [],
  21621. messageSends: []
  21622. }),
  21623. $globals.JSObjectProxy);
  21624. $core.addMethod(
  21625. $core.method({
  21626. selector: "at:put:",
  21627. protocol: "accessing",
  21628. fn: function (aString,anObject){
  21629. var self=this,$self=this;
  21630. return $core.withContext(function($ctx1) {
  21631. return $self['@jsObject'][aString] = anObject;
  21632. return self;
  21633. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21634. },
  21635. args: ["aString", "anObject"],
  21636. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21637. referencedClasses: [],
  21638. messageSends: []
  21639. }),
  21640. $globals.JSObjectProxy);
  21641. $core.addMethod(
  21642. $core.method({
  21643. selector: "catch:",
  21644. protocol: "promises",
  21645. fn: function (aBlock){
  21646. var self=this,$self=this;
  21647. return $core.withContext(function($ctx1) {
  21648. var $1,$2;
  21649. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21650. if($core.assert($1)){
  21651. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21652. } else {
  21653. $2=(
  21654. $ctx1.supercall = true,
  21655. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21656. $ctx1.supercall = false;
  21657. return $2;
  21658. }
  21659. return self;
  21660. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21661. },
  21662. args: ["aBlock"],
  21663. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21664. referencedClasses: ["NativeFunction", "TThenable"],
  21665. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21666. }),
  21667. $globals.JSObjectProxy);
  21668. $core.addMethod(
  21669. $core.method({
  21670. selector: "doesNotUnderstand:",
  21671. protocol: "proxy",
  21672. fn: function (aMessage){
  21673. var self=this,$self=this;
  21674. return $core.withContext(function($ctx1) {
  21675. var $1,$receiver;
  21676. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21677. if(($receiver = $1) == null || $receiver.a$nil){
  21678. return (
  21679. $ctx1.supercall = true,
  21680. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21681. $ctx1.supercall = false;
  21682. } else {
  21683. var jsSelector;
  21684. jsSelector=$receiver;
  21685. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21686. }
  21687. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21688. },
  21689. args: ["aMessage"],
  21690. 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 ]",
  21691. referencedClasses: ["JSObjectProxy"],
  21692. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21693. }),
  21694. $globals.JSObjectProxy);
  21695. $core.addMethod(
  21696. $core.method({
  21697. selector: "in:",
  21698. protocol: "accessing",
  21699. fn: function (aValuable){
  21700. var self=this,$self=this;
  21701. return $core.withContext(function($ctx1) {
  21702. return $recv(aValuable)._value_($self["@jsObject"]);
  21703. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21704. },
  21705. args: ["aValuable"],
  21706. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21707. referencedClasses: [],
  21708. messageSends: ["value:"]
  21709. }),
  21710. $globals.JSObjectProxy);
  21711. $core.addMethod(
  21712. $core.method({
  21713. selector: "jsObject",
  21714. protocol: "accessing",
  21715. fn: function (){
  21716. var self=this,$self=this;
  21717. return $self["@jsObject"];
  21718. },
  21719. args: [],
  21720. source: "jsObject\x0a\x09^ jsObject",
  21721. referencedClasses: [],
  21722. messageSends: []
  21723. }),
  21724. $globals.JSObjectProxy);
  21725. $core.addMethod(
  21726. $core.method({
  21727. selector: "keysAndValuesDo:",
  21728. protocol: "enumerating",
  21729. fn: function (aBlock){
  21730. var self=this,$self=this;
  21731. return $core.withContext(function($ctx1) {
  21732. var o = $self['@jsObject'];
  21733. for(var i in o) {
  21734. aBlock._value_value_(i, o[i]);
  21735. }
  21736. ;
  21737. return self;
  21738. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21739. },
  21740. args: ["aBlock"],
  21741. 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'>",
  21742. referencedClasses: [],
  21743. messageSends: []
  21744. }),
  21745. $globals.JSObjectProxy);
  21746. $core.addMethod(
  21747. $core.method({
  21748. selector: "on:do:",
  21749. protocol: "promises",
  21750. fn: function (aClass,aBlock){
  21751. var self=this,$self=this;
  21752. return $core.withContext(function($ctx1) {
  21753. var $1,$2;
  21754. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21755. if($core.assert($1)){
  21756. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21757. } else {
  21758. $2=(
  21759. $ctx1.supercall = true,
  21760. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21761. $ctx1.supercall = false;
  21762. return $2;
  21763. }
  21764. return self;
  21765. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21766. },
  21767. args: ["aClass", "aBlock"],
  21768. 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 ]",
  21769. referencedClasses: ["NativeFunction", "TThenable"],
  21770. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21771. }),
  21772. $globals.JSObjectProxy);
  21773. $core.addMethod(
  21774. $core.method({
  21775. selector: "printOn:",
  21776. protocol: "printing",
  21777. fn: function (aStream){
  21778. var self=this,$self=this;
  21779. return $core.withContext(function($ctx1) {
  21780. $recv(aStream)._nextPutAll_($self._printString());
  21781. return self;
  21782. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21783. },
  21784. args: ["aStream"],
  21785. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21786. referencedClasses: [],
  21787. messageSends: ["nextPutAll:", "printString"]
  21788. }),
  21789. $globals.JSObjectProxy);
  21790. $core.addMethod(
  21791. $core.method({
  21792. selector: "printString",
  21793. protocol: "printing",
  21794. fn: function (){
  21795. var self=this,$self=this;
  21796. return $core.withContext(function($ctx1) {
  21797. var js = $self['@jsObject'];
  21798. return js.toString
  21799. ? js.toString()
  21800. : Object.prototype.toString.call(js)
  21801. ;
  21802. return self;
  21803. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21804. },
  21805. args: [],
  21806. 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'>",
  21807. referencedClasses: [],
  21808. messageSends: []
  21809. }),
  21810. $globals.JSObjectProxy);
  21811. $core.addMethod(
  21812. $core.method({
  21813. selector: "putOn:",
  21814. protocol: "streaming",
  21815. fn: function (aStream){
  21816. var self=this,$self=this;
  21817. return $core.withContext(function($ctx1) {
  21818. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21819. return self;
  21820. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21821. },
  21822. args: ["aStream"],
  21823. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21824. referencedClasses: [],
  21825. messageSends: ["nextPutJSObject:"]
  21826. }),
  21827. $globals.JSObjectProxy);
  21828. $core.addMethod(
  21829. $core.method({
  21830. selector: "then:",
  21831. protocol: "promises",
  21832. fn: function (aBlockOrArray){
  21833. var self=this,$self=this;
  21834. return $core.withContext(function($ctx1) {
  21835. var $1,$2;
  21836. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21837. if($core.assert($1)){
  21838. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21839. } else {
  21840. $2=(
  21841. $ctx1.supercall = true,
  21842. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21843. $ctx1.supercall = false;
  21844. return $2;
  21845. }
  21846. return self;
  21847. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21848. },
  21849. args: ["aBlockOrArray"],
  21850. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21851. referencedClasses: ["NativeFunction", "TThenable"],
  21852. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21853. }),
  21854. $globals.JSObjectProxy);
  21855. $core.addMethod(
  21856. $core.method({
  21857. selector: "addObjectVariablesTo:ofProxy:",
  21858. protocol: "proxy",
  21859. fn: function (aDictionary,aProxy){
  21860. var self=this,$self=this;
  21861. return $core.withContext(function($ctx1) {
  21862. var jsObject = aProxy['@jsObject'];
  21863. for(var i in jsObject) {
  21864. aDictionary._at_put_(i, jsObject[i]);
  21865. }
  21866. ;
  21867. return self;
  21868. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21869. },
  21870. args: ["aDictionary", "aProxy"],
  21871. 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'>",
  21872. referencedClasses: [],
  21873. messageSends: []
  21874. }),
  21875. $globals.JSObjectProxy.a$cls);
  21876. $core.addMethod(
  21877. $core.method({
  21878. selector: "compareJSObjectOfProxy:withProxy:",
  21879. protocol: "proxy",
  21880. fn: function (aProxy,anotherProxy){
  21881. var self=this,$self=this;
  21882. return $core.withContext(function($ctx1) {
  21883. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21884. return aProxy["@jsObject"] === anotherJSObject;
  21885. return self;
  21886. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21887. },
  21888. args: ["aProxy", "anotherProxy"],
  21889. 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'>",
  21890. referencedClasses: [],
  21891. messageSends: []
  21892. }),
  21893. $globals.JSObjectProxy.a$cls);
  21894. $core.addMethod(
  21895. $core.method({
  21896. selector: "forwardMessage:withArguments:ofProxy:",
  21897. protocol: "proxy",
  21898. fn: function (aString,anArray,aProxy){
  21899. var self=this,$self=this;
  21900. return $core.withContext(function($ctx1) {
  21901. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21902. ;
  21903. return self;
  21904. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21905. },
  21906. args: ["aString", "anArray", "aProxy"],
  21907. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21908. referencedClasses: [],
  21909. messageSends: []
  21910. }),
  21911. $globals.JSObjectProxy.a$cls);
  21912. $core.addMethod(
  21913. $core.method({
  21914. selector: "jsObject:ofProxy:",
  21915. protocol: "proxy",
  21916. fn: function (aJSObject,aProxy){
  21917. var self=this,$self=this;
  21918. return $core.withContext(function($ctx1) {
  21919. aProxy['@jsObject'] = aJSObject;
  21920. return self;
  21921. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21922. },
  21923. args: ["aJSObject", "aProxy"],
  21924. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21925. referencedClasses: [],
  21926. messageSends: []
  21927. }),
  21928. $globals.JSObjectProxy.a$cls);
  21929. $core.addMethod(
  21930. $core.method({
  21931. selector: "lookupProperty:ofProxy:",
  21932. protocol: "proxy",
  21933. fn: function (aString,aProxy){
  21934. var self=this,$self=this;
  21935. return $core.withContext(function($ctx1) {
  21936. return aString in aProxy._jsObject() ? aString : nil;
  21937. return self;
  21938. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21939. },
  21940. args: ["aString", "aProxy"],
  21941. 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'>",
  21942. referencedClasses: [],
  21943. messageSends: []
  21944. }),
  21945. $globals.JSObjectProxy.a$cls);
  21946. $core.addMethod(
  21947. $core.method({
  21948. selector: "null",
  21949. protocol: "accessing",
  21950. fn: function (){
  21951. var self=this,$self=this;
  21952. return $core.withContext(function($ctx1) {
  21953. return null;
  21954. return self;
  21955. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21956. },
  21957. args: [],
  21958. source: "null\x0a\x09<inlineJS: 'return null'>",
  21959. referencedClasses: [],
  21960. messageSends: []
  21961. }),
  21962. $globals.JSObjectProxy.a$cls);
  21963. $core.addMethod(
  21964. $core.method({
  21965. selector: "on:",
  21966. protocol: "instance creation",
  21967. fn: function (aJSObject){
  21968. var self=this,$self=this;
  21969. var instance;
  21970. return $core.withContext(function($ctx1) {
  21971. instance=$self._new();
  21972. $self._jsObject_ofProxy_(aJSObject,instance);
  21973. return instance;
  21974. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21975. },
  21976. args: ["aJSObject"],
  21977. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21978. referencedClasses: [],
  21979. messageSends: ["new", "jsObject:ofProxy:"]
  21980. }),
  21981. $globals.JSObjectProxy.a$cls);
  21982. $core.addMethod(
  21983. $core.method({
  21984. selector: "undefined",
  21985. protocol: "accessing",
  21986. fn: function (){
  21987. var self=this,$self=this;
  21988. return $core.withContext(function($ctx1) {
  21989. return undefined;
  21990. return self;
  21991. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21992. },
  21993. args: [],
  21994. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21995. referencedClasses: [],
  21996. messageSends: []
  21997. }),
  21998. $globals.JSObjectProxy.a$cls);
  21999. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  22000. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  22001. $core.addMethod(
  22002. $core.method({
  22003. selector: "addElement:",
  22004. protocol: "accessing",
  22005. fn: function (anObject){
  22006. var self=this,$self=this;
  22007. return $core.withContext(function($ctx1) {
  22008. $recv($self._elements())._add_(anObject);
  22009. return self;
  22010. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  22011. },
  22012. args: ["anObject"],
  22013. source: "addElement: anObject\x0a\x09self elements add: anObject",
  22014. referencedClasses: [],
  22015. messageSends: ["add:", "elements"]
  22016. }),
  22017. $globals.Organizer);
  22018. $core.addMethod(
  22019. $core.method({
  22020. selector: "elements",
  22021. protocol: "accessing",
  22022. fn: function (){
  22023. var self=this,$self=this;
  22024. return $self["@elements"];
  22025. },
  22026. args: [],
  22027. source: "elements\x0a\x09^ elements",
  22028. referencedClasses: [],
  22029. messageSends: []
  22030. }),
  22031. $globals.Organizer);
  22032. $core.addMethod(
  22033. $core.method({
  22034. selector: "initialize",
  22035. protocol: "initialization",
  22036. fn: function (){
  22037. var self=this,$self=this;
  22038. return $core.withContext(function($ctx1) {
  22039. (
  22040. $ctx1.supercall = true,
  22041. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22042. $ctx1.supercall = false;
  22043. $self["@elements"]=$recv($globals.Set)._new();
  22044. return self;
  22045. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  22046. },
  22047. args: [],
  22048. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  22049. referencedClasses: ["Set"],
  22050. messageSends: ["initialize", "new"]
  22051. }),
  22052. $globals.Organizer);
  22053. $core.addMethod(
  22054. $core.method({
  22055. selector: "removeElement:",
  22056. protocol: "accessing",
  22057. fn: function (anObject){
  22058. var self=this,$self=this;
  22059. return $core.withContext(function($ctx1) {
  22060. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  22061. }));
  22062. return self;
  22063. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  22064. },
  22065. args: ["anObject"],
  22066. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  22067. referencedClasses: [],
  22068. messageSends: ["remove:ifAbsent:", "elements"]
  22069. }),
  22070. $globals.Organizer);
  22071. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  22072. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  22073. $core.addMethod(
  22074. $core.method({
  22075. selector: "addElement:",
  22076. protocol: "accessing",
  22077. fn: function (aString){
  22078. var self=this,$self=this;
  22079. return $core.withContext(function($ctx1) {
  22080. var $1,$3,$2;
  22081. (
  22082. $ctx1.supercall = true,
  22083. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  22084. $ctx1.supercall = false;
  22085. $1=$recv($globals.SystemAnnouncer)._current();
  22086. $3=$recv($globals.ProtocolAdded)._new();
  22087. $recv($3)._protocol_(aString);
  22088. $recv($3)._theClass_($self._theClass());
  22089. $2=$recv($3)._yourself();
  22090. $recv($1)._announce_($2);
  22091. return self;
  22092. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  22093. },
  22094. args: ["aString"],
  22095. 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)",
  22096. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  22097. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22098. }),
  22099. $globals.ClassOrganizer);
  22100. $core.addMethod(
  22101. $core.method({
  22102. selector: "removeElement:",
  22103. protocol: "accessing",
  22104. fn: function (aString){
  22105. var self=this,$self=this;
  22106. return $core.withContext(function($ctx1) {
  22107. var $1,$3,$2;
  22108. (
  22109. $ctx1.supercall = true,
  22110. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  22111. $ctx1.supercall = false;
  22112. $1=$recv($globals.SystemAnnouncer)._current();
  22113. $3=$recv($globals.ProtocolRemoved)._new();
  22114. $recv($3)._protocol_(aString);
  22115. $recv($3)._theClass_($self._theClass());
  22116. $2=$recv($3)._yourself();
  22117. $recv($1)._announce_($2);
  22118. return self;
  22119. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  22120. },
  22121. args: ["aString"],
  22122. 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)",
  22123. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22124. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22125. }),
  22126. $globals.ClassOrganizer);
  22127. $core.addMethod(
  22128. $core.method({
  22129. selector: "theClass",
  22130. protocol: "accessing",
  22131. fn: function (){
  22132. var self=this,$self=this;
  22133. return $self["@traitOrBehavior"];
  22134. },
  22135. args: [],
  22136. source: "theClass\x0a\x09^ traitOrBehavior",
  22137. referencedClasses: [],
  22138. messageSends: []
  22139. }),
  22140. $globals.ClassOrganizer);
  22141. $core.addMethod(
  22142. $core.method({
  22143. selector: "theClass:",
  22144. protocol: "accessing",
  22145. fn: function (aClass){
  22146. var self=this,$self=this;
  22147. $self["@traitOrBehavior"]=aClass;
  22148. return self;
  22149. },
  22150. args: ["aClass"],
  22151. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22152. referencedClasses: [],
  22153. messageSends: []
  22154. }),
  22155. $globals.ClassOrganizer);
  22156. $core.addMethod(
  22157. $core.method({
  22158. selector: "on:",
  22159. protocol: "instance creation",
  22160. fn: function (aClass){
  22161. var self=this,$self=this;
  22162. return $core.withContext(function($ctx1) {
  22163. var $1;
  22164. $1=$self._new();
  22165. $recv($1)._theClass_(aClass);
  22166. return $recv($1)._yourself();
  22167. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22168. },
  22169. args: ["aClass"],
  22170. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22171. referencedClasses: [],
  22172. messageSends: ["theClass:", "new", "yourself"]
  22173. }),
  22174. $globals.ClassOrganizer.a$cls);
  22175. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22176. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22177. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22178. $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'";
  22179. $core.addMethod(
  22180. $core.method({
  22181. selector: "basicTransport",
  22182. protocol: "private",
  22183. fn: function (){
  22184. var self=this,$self=this;
  22185. return $self["@basicTransport"];
  22186. },
  22187. args: [],
  22188. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22189. referencedClasses: [],
  22190. messageSends: []
  22191. }),
  22192. $globals.Package);
  22193. $core.addMethod(
  22194. $core.method({
  22195. selector: "beClean",
  22196. protocol: "accessing",
  22197. fn: function (){
  22198. var self=this,$self=this;
  22199. return $core.withContext(function($ctx1) {
  22200. var $1,$3,$2;
  22201. $self["@dirty"]=false;
  22202. $1=$recv($globals.SystemAnnouncer)._current();
  22203. $3=$recv($globals.PackageClean)._new();
  22204. $recv($3)._package_(self);
  22205. $2=$recv($3)._yourself();
  22206. $recv($1)._announce_($2);
  22207. return self;
  22208. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22209. },
  22210. args: [],
  22211. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22212. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22213. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22214. }),
  22215. $globals.Package);
  22216. $core.addMethod(
  22217. $core.method({
  22218. selector: "beDirty",
  22219. protocol: "accessing",
  22220. fn: function (){
  22221. var self=this,$self=this;
  22222. return $core.withContext(function($ctx1) {
  22223. var $1,$3,$2;
  22224. $self["@dirty"]=true;
  22225. $1=$recv($globals.SystemAnnouncer)._current();
  22226. $3=$recv($globals.PackageDirty)._new();
  22227. $recv($3)._package_(self);
  22228. $2=$recv($3)._yourself();
  22229. $recv($1)._announce_($2);
  22230. return self;
  22231. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22232. },
  22233. args: [],
  22234. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22235. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22236. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22237. }),
  22238. $globals.Package);
  22239. $core.addMethod(
  22240. $core.method({
  22241. selector: "classTemplate",
  22242. protocol: "accessing",
  22243. fn: function (){
  22244. var self=this,$self=this;
  22245. return $core.withContext(function($ctx1) {
  22246. return $recv($globals.String)._streamContents_((function(stream){
  22247. return $core.withContext(function($ctx2) {
  22248. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22249. $ctx2.sendIdx["write:"]=1;
  22250. $recv(stream)._lf();
  22251. $ctx2.sendIdx["lf"]=1;
  22252. $recv(stream)._tab();
  22253. $ctx2.sendIdx["tab"]=1;
  22254. $recv(stream)._write_("instanceVariableNames: ''");
  22255. $ctx2.sendIdx["write:"]=2;
  22256. $recv(stream)._lf();
  22257. $recv(stream)._tab();
  22258. $recv(stream)._write_("package: ");
  22259. return $recv(stream)._print_($self._name());
  22260. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22261. }));
  22262. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22263. },
  22264. args: [],
  22265. 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 ]",
  22266. referencedClasses: ["String"],
  22267. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22268. }),
  22269. $globals.Package);
  22270. $core.addMethod(
  22271. $core.method({
  22272. selector: "classes",
  22273. protocol: "classes",
  22274. fn: function (){
  22275. var self=this,$self=this;
  22276. return $core.withContext(function($ctx1) {
  22277. return $recv($recv($self._organization())._elements())._copy();
  22278. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22279. },
  22280. args: [],
  22281. source: "classes\x0a\x09^ self organization elements copy",
  22282. referencedClasses: [],
  22283. messageSends: ["copy", "elements", "organization"]
  22284. }),
  22285. $globals.Package);
  22286. $core.addMethod(
  22287. $core.method({
  22288. selector: "definition",
  22289. protocol: "accessing",
  22290. fn: function (){
  22291. var self=this,$self=this;
  22292. return $core.withContext(function($ctx1) {
  22293. var $1;
  22294. return $recv($globals.String)._streamContents_((function(stream){
  22295. return $core.withContext(function($ctx2) {
  22296. $1=$recv($self._class())._name();
  22297. $ctx2.sendIdx["name"]=1;
  22298. $recv(stream)._write_($1);
  22299. $ctx2.sendIdx["write:"]=1;
  22300. $recv(stream)._lf();
  22301. $ctx2.sendIdx["lf"]=1;
  22302. $recv(stream)._tab();
  22303. $ctx2.sendIdx["tab"]=1;
  22304. $recv(stream)._write_("named: ");
  22305. $ctx2.sendIdx["write:"]=2;
  22306. $recv(stream)._print_($self._name());
  22307. $recv(stream)._lf();
  22308. $ctx2.sendIdx["lf"]=2;
  22309. $recv(stream)._tab();
  22310. $ctx2.sendIdx["tab"]=2;
  22311. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22312. $ctx2.sendIdx["write:"]=3;
  22313. $recv(stream)._lf();
  22314. $recv(stream)._tab();
  22315. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22316. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22317. }));
  22318. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22319. },
  22320. args: [],
  22321. 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. ')' } ]",
  22322. referencedClasses: ["String"],
  22323. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22324. }),
  22325. $globals.Package);
  22326. $core.addMethod(
  22327. $core.method({
  22328. selector: "eval:",
  22329. protocol: "evaluating",
  22330. fn: function (aString){
  22331. var self=this,$self=this;
  22332. return $core.withContext(function($ctx1) {
  22333. var $1,$receiver;
  22334. $1=$self["@evalBlock"];
  22335. if(($receiver = $1) == null || $receiver.a$nil){
  22336. return $recv($globals.Compiler)._eval_(aString);
  22337. } else {
  22338. return $recv($self["@evalBlock"])._value_(aString);
  22339. }
  22340. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22341. },
  22342. args: ["aString"],
  22343. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22344. referencedClasses: ["Compiler"],
  22345. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22346. }),
  22347. $globals.Package);
  22348. $core.addMethod(
  22349. $core.method({
  22350. selector: "evalBlock",
  22351. protocol: "accessing",
  22352. fn: function (){
  22353. var self=this,$self=this;
  22354. return $self["@evalBlock"];
  22355. },
  22356. args: [],
  22357. source: "evalBlock\x0a\x09^ evalBlock",
  22358. referencedClasses: [],
  22359. messageSends: []
  22360. }),
  22361. $globals.Package);
  22362. $core.addMethod(
  22363. $core.method({
  22364. selector: "evalBlock:",
  22365. protocol: "accessing",
  22366. fn: function (aBlock){
  22367. var self=this,$self=this;
  22368. $self["@evalBlock"]=aBlock;
  22369. return self;
  22370. },
  22371. args: ["aBlock"],
  22372. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22373. referencedClasses: [],
  22374. messageSends: []
  22375. }),
  22376. $globals.Package);
  22377. $core.addMethod(
  22378. $core.method({
  22379. selector: "imports",
  22380. protocol: "accessing",
  22381. fn: function (){
  22382. var self=this,$self=this;
  22383. return $core.withContext(function($ctx1) {
  22384. var $1,$receiver;
  22385. $1=$self["@imports"];
  22386. if(($receiver = $1) == null || $receiver.a$nil){
  22387. $self._imports_([]);
  22388. return $self["@imports"];
  22389. } else {
  22390. return $1;
  22391. }
  22392. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22393. },
  22394. args: [],
  22395. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22396. referencedClasses: [],
  22397. messageSends: ["ifNil:", "imports:"]
  22398. }),
  22399. $globals.Package);
  22400. $core.addMethod(
  22401. $core.method({
  22402. selector: "imports:",
  22403. protocol: "accessing",
  22404. fn: function (anArray){
  22405. var self=this,$self=this;
  22406. return $core.withContext(function($ctx1) {
  22407. $self._validateImports_(anArray);
  22408. $self["@imports"]=$recv(anArray)._asSet();
  22409. return self;
  22410. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22411. },
  22412. args: ["anArray"],
  22413. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22414. referencedClasses: [],
  22415. messageSends: ["validateImports:", "asSet"]
  22416. }),
  22417. $globals.Package);
  22418. $core.addMethod(
  22419. $core.method({
  22420. selector: "importsAsJson",
  22421. protocol: "converting",
  22422. fn: function (){
  22423. var self=this,$self=this;
  22424. return $core.withContext(function($ctx1) {
  22425. var $1;
  22426. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22427. return $core.withContext(function($ctx2) {
  22428. $1=$recv(each)._isString();
  22429. if($core.assert($1)){
  22430. return each;
  22431. } else {
  22432. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22433. $ctx2.sendIdx[","]=1;
  22434. }
  22435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22436. }));
  22437. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22438. },
  22439. args: [],
  22440. 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 ]]",
  22441. referencedClasses: [],
  22442. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22443. }),
  22444. $globals.Package);
  22445. $core.addMethod(
  22446. $core.method({
  22447. selector: "importsDefinition",
  22448. protocol: "accessing",
  22449. fn: function (){
  22450. var self=this,$self=this;
  22451. return $core.withContext(function($ctx1) {
  22452. return $recv($globals.String)._streamContents_((function(stream){
  22453. return $core.withContext(function($ctx2) {
  22454. $recv(stream)._write_("{");
  22455. $ctx2.sendIdx["write:"]=1;
  22456. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22457. return $core.withContext(function($ctx3) {
  22458. return $recv(stream)._print_(each);
  22459. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22460. }),(function(){
  22461. return $core.withContext(function($ctx3) {
  22462. return $recv(stream)._write_(". ");
  22463. $ctx3.sendIdx["write:"]=2;
  22464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22465. }));
  22466. return $recv(stream)._write_("}");
  22467. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22468. }));
  22469. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22470. },
  22471. args: [],
  22472. 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: '}' ]",
  22473. referencedClasses: ["String"],
  22474. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22475. }),
  22476. $globals.Package);
  22477. $core.addMethod(
  22478. $core.method({
  22479. selector: "importsFromJson:",
  22480. protocol: "converting",
  22481. fn: function (anArray){
  22482. var self=this,$self=this;
  22483. return $core.withContext(function($ctx1) {
  22484. var $1;
  22485. return $recv(anArray)._collect_((function(each){
  22486. var split;
  22487. return $core.withContext(function($ctx2) {
  22488. split=$recv(each)._tokenize_("=");
  22489. split;
  22490. $1=$recv($recv(split)._size()).__eq((1));
  22491. if($core.assert($1)){
  22492. return $recv(split)._first();
  22493. $ctx2.sendIdx["first"]=1;
  22494. } else {
  22495. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22496. }
  22497. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22498. }));
  22499. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22500. },
  22501. args: ["anArray"],
  22502. 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 ]]",
  22503. referencedClasses: [],
  22504. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22505. }),
  22506. $globals.Package);
  22507. $core.addMethod(
  22508. $core.method({
  22509. selector: "initialize",
  22510. protocol: "initialization",
  22511. fn: function (){
  22512. var self=this,$self=this;
  22513. return $core.withContext(function($ctx1) {
  22514. (
  22515. $ctx1.supercall = true,
  22516. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22517. $ctx1.supercall = false;
  22518. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22519. $self["@evalBlock"]=nil;
  22520. $self["@dirty"]=nil;
  22521. $self["@imports"]=nil;
  22522. $self["@transport"]=nil;
  22523. return self;
  22524. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22525. },
  22526. args: [],
  22527. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22528. referencedClasses: ["PackageOrganizer"],
  22529. messageSends: ["initialize", "new"]
  22530. }),
  22531. $globals.Package);
  22532. $core.addMethod(
  22533. $core.method({
  22534. selector: "isDirty",
  22535. protocol: "testing",
  22536. fn: function (){
  22537. var self=this,$self=this;
  22538. return $core.withContext(function($ctx1) {
  22539. var $1,$receiver;
  22540. $1=$self["@dirty"];
  22541. if(($receiver = $1) == null || $receiver.a$nil){
  22542. return false;
  22543. } else {
  22544. return $1;
  22545. }
  22546. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22547. },
  22548. args: [],
  22549. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22550. referencedClasses: [],
  22551. messageSends: ["ifNil:"]
  22552. }),
  22553. $globals.Package);
  22554. $core.addMethod(
  22555. $core.method({
  22556. selector: "isPackage",
  22557. protocol: "testing",
  22558. fn: function (){
  22559. var self=this,$self=this;
  22560. return true;
  22561. },
  22562. args: [],
  22563. source: "isPackage\x0a\x09^ true",
  22564. referencedClasses: [],
  22565. messageSends: []
  22566. }),
  22567. $globals.Package);
  22568. $core.addMethod(
  22569. $core.method({
  22570. selector: "javaScriptDescriptor:",
  22571. protocol: "accessing",
  22572. fn: function (anObject){
  22573. var self=this,$self=this;
  22574. var basicEval,basicImports;
  22575. return $core.withContext(function($ctx1) {
  22576. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22577. return $core.withContext(function($ctx2) {
  22578. return nil._asJavaScriptObject();
  22579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22580. }));
  22581. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22582. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22583. return [];
  22584. }));
  22585. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22586. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22587. }));
  22588. $self._evalBlock_(basicEval);
  22589. $self._imports_($self._importsFromJson_(basicImports));
  22590. return self;
  22591. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22592. },
  22593. args: ["anObject"],
  22594. 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)",
  22595. referencedClasses: [],
  22596. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22597. }),
  22598. $globals.Package);
  22599. $core.addMethod(
  22600. $core.method({
  22601. selector: "loadDependencies",
  22602. protocol: "dependencies",
  22603. fn: function (){
  22604. var self=this,$self=this;
  22605. var classes,packages;
  22606. return $core.withContext(function($ctx1) {
  22607. var $1;
  22608. classes=$self._loadDependencyClasses();
  22609. $1=$recv($recv(classes)._collect_((function(each){
  22610. return $core.withContext(function($ctx2) {
  22611. return $recv(each)._package();
  22612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22613. })))._asSet();
  22614. $recv($1)._remove_ifAbsent_(self,(function(){
  22615. }));
  22616. return $recv($1)._yourself();
  22617. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22618. },
  22619. args: [],
  22620. 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",
  22621. referencedClasses: [],
  22622. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22623. }),
  22624. $globals.Package);
  22625. $core.addMethod(
  22626. $core.method({
  22627. selector: "loadDependencyClasses",
  22628. protocol: "dependencies",
  22629. fn: function (){
  22630. var self=this,$self=this;
  22631. var starCategoryName;
  22632. return $core.withContext(function($ctx1) {
  22633. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22634. starCategoryName="*".__comma($self._name());
  22635. $ctx1.sendIdx[","]=1;
  22636. $3=$self._classes();
  22637. $ctx1.sendIdx["classes"]=1;
  22638. $2=$recv($3)._collect_((function(each){
  22639. return $core.withContext(function($ctx2) {
  22640. return $recv(each)._superclass();
  22641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22642. }));
  22643. $ctx1.sendIdx["collect:"]=1;
  22644. $1=$recv($2)._asSet();
  22645. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22646. return $core.withContext(function($ctx2) {
  22647. $5=$recv(each)._protocols();
  22648. $ctx2.sendIdx["protocols"]=1;
  22649. $7=$recv(each)._theMetaClass();
  22650. if(($receiver = $7) == null || $receiver.a$nil){
  22651. $6=[];
  22652. } else {
  22653. var meta;
  22654. meta=$receiver;
  22655. $6=$recv(meta)._protocols();
  22656. }
  22657. $4=$recv($5).__comma($6);
  22658. return $recv($4)._includes_(starCategoryName);
  22659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22660. })));
  22661. $ctx1.sendIdx["addAll:"]=1;
  22662. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22663. return $core.withContext(function($ctx2) {
  22664. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22665. return $core.withContext(function($ctx3) {
  22666. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22667. return $core.withContext(function($ctx4) {
  22668. return $recv(eachTT)._trait();
  22669. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22670. })));
  22671. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22672. }));
  22673. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22674. })));
  22675. $recv($1)._remove_ifAbsent_(nil,(function(){
  22676. }));
  22677. return $recv($1)._yourself();
  22678. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22679. },
  22680. args: [],
  22681. 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",
  22682. referencedClasses: ["Smalltalk", "Array"],
  22683. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22684. }),
  22685. $globals.Package);
  22686. $core.addMethod(
  22687. $core.method({
  22688. selector: "name",
  22689. protocol: "accessing",
  22690. fn: function (){
  22691. var self=this,$self=this;
  22692. return $self["@name"];
  22693. },
  22694. args: [],
  22695. source: "name\x0a\x09^ name",
  22696. referencedClasses: [],
  22697. messageSends: []
  22698. }),
  22699. $globals.Package);
  22700. $core.addMethod(
  22701. $core.method({
  22702. selector: "name:",
  22703. protocol: "accessing",
  22704. fn: function (aString){
  22705. var self=this,$self=this;
  22706. $self["@name"]=aString;
  22707. return self;
  22708. },
  22709. args: ["aString"],
  22710. source: "name: aString\x0a\x09name := aString",
  22711. referencedClasses: [],
  22712. messageSends: []
  22713. }),
  22714. $globals.Package);
  22715. $core.addMethod(
  22716. $core.method({
  22717. selector: "organization",
  22718. protocol: "accessing",
  22719. fn: function (){
  22720. var self=this,$self=this;
  22721. return $self["@organization"];
  22722. },
  22723. args: [],
  22724. source: "organization\x0a\x09^ organization",
  22725. referencedClasses: [],
  22726. messageSends: []
  22727. }),
  22728. $globals.Package);
  22729. $core.addMethod(
  22730. $core.method({
  22731. selector: "printOn:",
  22732. protocol: "printing",
  22733. fn: function (aStream){
  22734. var self=this,$self=this;
  22735. return $core.withContext(function($ctx1) {
  22736. (
  22737. $ctx1.supercall = true,
  22738. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22739. $ctx1.supercall = false;
  22740. $recv(aStream)._nextPutAll_(" (");
  22741. $ctx1.sendIdx["nextPutAll:"]=1;
  22742. $recv(aStream)._nextPutAll_($self._name());
  22743. $ctx1.sendIdx["nextPutAll:"]=2;
  22744. $recv(aStream)._nextPutAll_(")");
  22745. return self;
  22746. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22747. },
  22748. args: ["aStream"],
  22749. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22750. referencedClasses: [],
  22751. messageSends: ["printOn:", "nextPutAll:", "name"]
  22752. }),
  22753. $globals.Package);
  22754. $core.addMethod(
  22755. $core.method({
  22756. selector: "setupClasses",
  22757. protocol: "classes",
  22758. fn: function (){
  22759. var self=this,$self=this;
  22760. return $core.withContext(function($ctx1) {
  22761. $recv($self._classes())._do_((function(each){
  22762. return $core.withContext(function($ctx2) {
  22763. return $recv(each)._initialize();
  22764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22765. }));
  22766. return self;
  22767. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22768. },
  22769. args: [],
  22770. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22771. referencedClasses: [],
  22772. messageSends: ["do:", "classes", "initialize"]
  22773. }),
  22774. $globals.Package);
  22775. $core.addMethod(
  22776. $core.method({
  22777. selector: "sortedClasses",
  22778. protocol: "classes",
  22779. fn: function (){
  22780. var self=this,$self=this;
  22781. return $core.withContext(function($ctx1) {
  22782. return $recv($self._class())._sortedClasses_($self._classes());
  22783. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22784. },
  22785. args: [],
  22786. 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",
  22787. referencedClasses: [],
  22788. messageSends: ["sortedClasses:", "class", "classes"]
  22789. }),
  22790. $globals.Package);
  22791. $core.addMethod(
  22792. $core.method({
  22793. selector: "sortedImportsAsArray",
  22794. protocol: "private",
  22795. fn: function (){
  22796. var self=this,$self=this;
  22797. return $core.withContext(function($ctx1) {
  22798. var $3,$2,$4,$1,$6,$5,$7;
  22799. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22800. return $core.withContext(function($ctx2) {
  22801. $3=$recv(a)._isString();
  22802. $ctx2.sendIdx["isString"]=1;
  22803. $2=$recv($3)._not();
  22804. $4=$recv(b)._isString();
  22805. $ctx2.sendIdx["isString"]=2;
  22806. $1=$recv($2).__and($4);
  22807. return $recv($1)._or_((function(){
  22808. return $core.withContext(function($ctx3) {
  22809. $6=$recv(a)._isString();
  22810. $ctx3.sendIdx["isString"]=3;
  22811. $5=$recv($6).__eq($recv(b)._isString());
  22812. return $recv($5)._and_((function(){
  22813. return $core.withContext(function($ctx4) {
  22814. $7=$recv(a)._value();
  22815. $ctx4.sendIdx["value"]=1;
  22816. return $recv($7).__lt_eq($recv(b)._value());
  22817. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22818. }));
  22819. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22820. }));
  22821. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22822. }));
  22823. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22824. },
  22825. args: [],
  22826. 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 ]]]",
  22827. referencedClasses: [],
  22828. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22829. }),
  22830. $globals.Package);
  22831. $core.addMethod(
  22832. $core.method({
  22833. selector: "traitCompositions",
  22834. protocol: "dependencies",
  22835. fn: function (){
  22836. var self=this,$self=this;
  22837. var traitCompositions;
  22838. return $core.withContext(function($ctx1) {
  22839. var $1,$2,$3,$receiver;
  22840. traitCompositions=$recv($globals.Dictionary)._new();
  22841. $recv($self._classes())._do_((function(each){
  22842. return $core.withContext(function($ctx2) {
  22843. $1=traitCompositions;
  22844. $2=$recv(each)._traitComposition();
  22845. $ctx2.sendIdx["traitComposition"]=1;
  22846. $recv($1)._at_put_(each,$2);
  22847. $ctx2.sendIdx["at:put:"]=1;
  22848. $3=$recv(each)._theMetaClass();
  22849. if(($receiver = $3) == null || $receiver.a$nil){
  22850. return $3;
  22851. } else {
  22852. var meta;
  22853. meta=$receiver;
  22854. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22855. }
  22856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22857. }));
  22858. return $recv(traitCompositions)._reject_((function(each){
  22859. return $core.withContext(function($ctx2) {
  22860. return $recv(each)._isEmpty();
  22861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22862. }));
  22863. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22864. },
  22865. args: [],
  22866. 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 ]",
  22867. referencedClasses: ["Dictionary"],
  22868. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22869. }),
  22870. $globals.Package);
  22871. $core.addMethod(
  22872. $core.method({
  22873. selector: "transport",
  22874. protocol: "accessing",
  22875. fn: function (){
  22876. var self=this,$self=this;
  22877. return $core.withContext(function($ctx1) {
  22878. var $1,$receiver;
  22879. $1=$self["@transport"];
  22880. if(($receiver = $1) == null || $receiver.a$nil){
  22881. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22882. return $self["@transport"];
  22883. } else {
  22884. return $1;
  22885. }
  22886. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22887. },
  22888. args: [],
  22889. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22890. referencedClasses: ["PackageTransport"],
  22891. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22892. }),
  22893. $globals.Package);
  22894. $core.addMethod(
  22895. $core.method({
  22896. selector: "transport:",
  22897. protocol: "accessing",
  22898. fn: function (aPackageTransport){
  22899. var self=this,$self=this;
  22900. return $core.withContext(function($ctx1) {
  22901. $self["@transport"]=aPackageTransport;
  22902. $recv(aPackageTransport)._package_(self);
  22903. return self;
  22904. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22905. },
  22906. args: ["aPackageTransport"],
  22907. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22908. referencedClasses: [],
  22909. messageSends: ["package:"]
  22910. }),
  22911. $globals.Package);
  22912. $core.addMethod(
  22913. $core.method({
  22914. selector: "validateImports:",
  22915. protocol: "validation",
  22916. fn: function (aCollection){
  22917. var self=this,$self=this;
  22918. return $core.withContext(function($ctx1) {
  22919. var $1,$2,$5,$4,$3,$6;
  22920. $recv(aCollection)._do_((function(import_){
  22921. return $core.withContext(function($ctx2) {
  22922. $1=$recv(import_)._isString();
  22923. $ctx2.sendIdx["isString"]=1;
  22924. if(!$core.assert($1)){
  22925. $2=$recv(import_)._respondsTo_("key");
  22926. if(!$core.assert($2)){
  22927. $self._error_("Imports must be Strings or Associations");
  22928. $ctx2.sendIdx["error:"]=1;
  22929. }
  22930. $5=$recv(import_)._key();
  22931. $ctx2.sendIdx["key"]=1;
  22932. $4=$recv($5)._isString();
  22933. $ctx2.sendIdx["isString"]=2;
  22934. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22935. if(!$core.assert($3)){
  22936. $self._error_("Key and value must be Strings");
  22937. $ctx2.sendIdx["error:"]=2;
  22938. }
  22939. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22940. if(!$core.assert($6)){
  22941. return $self._error_("Keys must be identifiers");
  22942. }
  22943. }
  22944. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22945. }));
  22946. return self;
  22947. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22948. },
  22949. args: ["aCollection"],
  22950. 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' ]]]",
  22951. referencedClasses: [],
  22952. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22953. }),
  22954. $globals.Package);
  22955. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22956. $core.addMethod(
  22957. $core.method({
  22958. selector: "named:",
  22959. protocol: "accessing",
  22960. fn: function (aPackageName){
  22961. var self=this,$self=this;
  22962. return $core.withContext(function($ctx1) {
  22963. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22964. return $core.withContext(function($ctx2) {
  22965. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22967. }));
  22968. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22969. },
  22970. args: ["aPackageName"],
  22971. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22972. referencedClasses: ["Smalltalk"],
  22973. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22974. }),
  22975. $globals.Package.a$cls);
  22976. $core.addMethod(
  22977. $core.method({
  22978. selector: "named:ifAbsent:",
  22979. protocol: "accessing",
  22980. fn: function (aPackageName,aBlock){
  22981. var self=this,$self=this;
  22982. return $core.withContext(function($ctx1) {
  22983. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22984. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22985. },
  22986. args: ["aPackageName", "aBlock"],
  22987. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22988. referencedClasses: ["Smalltalk"],
  22989. messageSends: ["packageAt:ifAbsent:"]
  22990. }),
  22991. $globals.Package.a$cls);
  22992. $core.addMethod(
  22993. $core.method({
  22994. selector: "named:imports:transport:",
  22995. protocol: "accessing",
  22996. fn: function (aPackageName,anArray,aTransport){
  22997. var self=this,$self=this;
  22998. var pkg;
  22999. return $core.withContext(function($ctx1) {
  23000. pkg=$self._named_(aPackageName);
  23001. $recv(pkg)._imports_(anArray);
  23002. $recv(pkg)._transport_(aTransport);
  23003. return pkg;
  23004. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23005. },
  23006. args: ["aPackageName", "anArray", "aTransport"],
  23007. 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",
  23008. referencedClasses: [],
  23009. messageSends: ["named:", "imports:", "transport:"]
  23010. }),
  23011. $globals.Package.a$cls);
  23012. $core.addMethod(
  23013. $core.method({
  23014. selector: "named:javaScriptDescriptor:",
  23015. protocol: "instance creation",
  23016. fn: function (aString,anObject){
  23017. var self=this,$self=this;
  23018. var pkg;
  23019. return $core.withContext(function($ctx1) {
  23020. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  23021. $recv(pkg)._javaScriptDescriptor_(anObject);
  23022. return pkg;
  23023. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  23024. },
  23025. args: ["aString", "anObject"],
  23026. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  23027. referencedClasses: ["Smalltalk"],
  23028. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  23029. }),
  23030. $globals.Package.a$cls);
  23031. $core.addMethod(
  23032. $core.method({
  23033. selector: "named:transport:",
  23034. protocol: "accessing",
  23035. fn: function (aPackageName,aTransport){
  23036. var self=this,$self=this;
  23037. var pkg;
  23038. return $core.withContext(function($ctx1) {
  23039. pkg=$self._named_(aPackageName);
  23040. $recv(pkg)._transport_(aTransport);
  23041. return pkg;
  23042. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23043. },
  23044. args: ["aPackageName", "aTransport"],
  23045. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  23046. referencedClasses: [],
  23047. messageSends: ["named:", "transport:"]
  23048. }),
  23049. $globals.Package.a$cls);
  23050. $core.addMethod(
  23051. $core.method({
  23052. selector: "new:",
  23053. protocol: "instance creation",
  23054. fn: function (aString){
  23055. var self=this,$self=this;
  23056. return $core.withContext(function($ctx1) {
  23057. var $1;
  23058. $1=$recv($globals.Package)._new();
  23059. $recv($1)._name_(aString);
  23060. return $recv($1)._yourself();
  23061. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  23062. },
  23063. args: ["aString"],
  23064. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  23065. referencedClasses: ["Package"],
  23066. messageSends: ["name:", "new", "yourself"]
  23067. }),
  23068. $globals.Package.a$cls);
  23069. $core.addMethod(
  23070. $core.method({
  23071. selector: "sortedClasses:",
  23072. protocol: "sorting",
  23073. fn: function (classes){
  23074. var self=this,$self=this;
  23075. var children,others,nodes,expandedClasses;
  23076. return $core.withContext(function($ctx1) {
  23077. var $1,$3,$2;
  23078. children=[];
  23079. others=[];
  23080. $recv(classes)._do_((function(each){
  23081. return $core.withContext(function($ctx2) {
  23082. $1=$recv(classes)._includes_($recv(each)._superclass());
  23083. if($core.assert($1)){
  23084. return $recv(others)._add_(each);
  23085. } else {
  23086. return $recv(children)._add_(each);
  23087. $ctx2.sendIdx["add:"]=1;
  23088. }
  23089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23090. }));
  23091. $ctx1.sendIdx["do:"]=1;
  23092. nodes=$recv(children)._collect_((function(each){
  23093. return $core.withContext(function($ctx2) {
  23094. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  23095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23096. }));
  23097. nodes=$recv(nodes)._sorted_((function(a,b){
  23098. return $core.withContext(function($ctx2) {
  23099. $3=$recv(a)._theClass();
  23100. $ctx2.sendIdx["theClass"]=1;
  23101. $2=$recv($3)._name();
  23102. $ctx2.sendIdx["name"]=1;
  23103. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  23104. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  23105. }));
  23106. expandedClasses=$recv($globals.Array)._new();
  23107. $recv(nodes)._do_((function(aNode){
  23108. return $core.withContext(function($ctx2) {
  23109. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  23110. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  23111. }));
  23112. return expandedClasses;
  23113. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  23114. },
  23115. args: ["classes"],
  23116. 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",
  23117. referencedClasses: ["ClassSorterNode", "Array"],
  23118. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23119. }),
  23120. $globals.Package.a$cls);
  23121. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23122. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23123. $core.addMethod(
  23124. $core.method({
  23125. selector: "announcer",
  23126. protocol: "accessing",
  23127. fn: function (){
  23128. var self=this,$self=this;
  23129. return $core.withContext(function($ctx1) {
  23130. return $recv($globals.SystemAnnouncer)._current();
  23131. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23132. },
  23133. args: [],
  23134. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23135. referencedClasses: ["SystemAnnouncer"],
  23136. messageSends: ["current"]
  23137. }),
  23138. $globals.PackageStateObserver);
  23139. $core.addMethod(
  23140. $core.method({
  23141. selector: "observeSystem",
  23142. protocol: "actions",
  23143. fn: function (){
  23144. var self=this,$self=this;
  23145. return $core.withContext(function($ctx1) {
  23146. var $1;
  23147. $1=$self._announcer();
  23148. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23149. $ctx1.sendIdx["on:send:to:"]=1;
  23150. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23151. $ctx1.sendIdx["on:send:to:"]=2;
  23152. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23153. $ctx1.sendIdx["on:send:to:"]=3;
  23154. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23155. return self;
  23156. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23157. },
  23158. args: [],
  23159. 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",
  23160. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23161. messageSends: ["on:send:to:", "announcer"]
  23162. }),
  23163. $globals.PackageStateObserver);
  23164. $core.addMethod(
  23165. $core.method({
  23166. selector: "onClassModification:",
  23167. protocol: "reactions",
  23168. fn: function (anAnnouncement){
  23169. var self=this,$self=this;
  23170. return $core.withContext(function($ctx1) {
  23171. var $1,$receiver;
  23172. $1=$recv(anAnnouncement)._theClass();
  23173. if(($receiver = $1) == null || $receiver.a$nil){
  23174. $1;
  23175. } else {
  23176. var theClass;
  23177. theClass=$receiver;
  23178. $recv($recv(theClass)._package())._beDirty();
  23179. }
  23180. return self;
  23181. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23182. },
  23183. args: ["anAnnouncement"],
  23184. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23185. referencedClasses: [],
  23186. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23187. }),
  23188. $globals.PackageStateObserver);
  23189. $core.addMethod(
  23190. $core.method({
  23191. selector: "onMethodModification:",
  23192. protocol: "reactions",
  23193. fn: function (anAnnouncement){
  23194. var self=this,$self=this;
  23195. return $core.withContext(function($ctx1) {
  23196. var $1,$receiver;
  23197. $1=$recv($recv(anAnnouncement)._method())._package();
  23198. if(($receiver = $1) == null || $receiver.a$nil){
  23199. $1;
  23200. } else {
  23201. var package_;
  23202. package_=$receiver;
  23203. $recv(package_)._beDirty();
  23204. }
  23205. return self;
  23206. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23207. },
  23208. args: ["anAnnouncement"],
  23209. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23210. referencedClasses: [],
  23211. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23212. }),
  23213. $globals.PackageStateObserver);
  23214. $core.addMethod(
  23215. $core.method({
  23216. selector: "onPackageAdded:",
  23217. protocol: "reactions",
  23218. fn: function (anAnnouncement){
  23219. var self=this,$self=this;
  23220. return $core.withContext(function($ctx1) {
  23221. $recv($recv(anAnnouncement)._package())._beDirty();
  23222. return self;
  23223. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23224. },
  23225. args: ["anAnnouncement"],
  23226. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23227. referencedClasses: [],
  23228. messageSends: ["beDirty", "package"]
  23229. }),
  23230. $globals.PackageStateObserver);
  23231. $core.addMethod(
  23232. $core.method({
  23233. selector: "onProtocolModification:",
  23234. protocol: "reactions",
  23235. fn: function (anAnnouncement){
  23236. var self=this,$self=this;
  23237. return $core.withContext(function($ctx1) {
  23238. var $1,$receiver;
  23239. $1=$recv(anAnnouncement)._package();
  23240. if(($receiver = $1) == null || $receiver.a$nil){
  23241. $1;
  23242. } else {
  23243. var package_;
  23244. package_=$receiver;
  23245. $recv(package_)._beDirty();
  23246. }
  23247. return self;
  23248. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23249. },
  23250. args: ["anAnnouncement"],
  23251. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23252. referencedClasses: [],
  23253. messageSends: ["ifNotNil:", "package", "beDirty"]
  23254. }),
  23255. $globals.PackageStateObserver);
  23256. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23257. $core.addMethod(
  23258. $core.method({
  23259. selector: "current",
  23260. protocol: "accessing",
  23261. fn: function (){
  23262. var self=this,$self=this;
  23263. return $core.withContext(function($ctx1) {
  23264. var $1,$receiver;
  23265. $1=$self["@current"];
  23266. if(($receiver = $1) == null || $receiver.a$nil){
  23267. $self["@current"]=$self._new();
  23268. return $self["@current"];
  23269. } else {
  23270. return $1;
  23271. }
  23272. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23273. },
  23274. args: [],
  23275. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23276. referencedClasses: [],
  23277. messageSends: ["ifNil:", "new"]
  23278. }),
  23279. $globals.PackageStateObserver.a$cls);
  23280. $core.addMethod(
  23281. $core.method({
  23282. selector: "initialize",
  23283. protocol: "initialization",
  23284. fn: function (){
  23285. var self=this,$self=this;
  23286. return $core.withContext(function($ctx1) {
  23287. $recv($self._current())._observeSystem();
  23288. return self;
  23289. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23290. },
  23291. args: [],
  23292. source: "initialize\x0a\x09self current observeSystem",
  23293. referencedClasses: [],
  23294. messageSends: ["observeSystem", "current"]
  23295. }),
  23296. $globals.PackageStateObserver.a$cls);
  23297. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23298. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23299. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23300. $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`";
  23301. $core.addMethod(
  23302. $core.method({
  23303. selector: "defaultValue",
  23304. protocol: "accessing",
  23305. fn: function (){
  23306. var self=this,$self=this;
  23307. return $self["@defaultValue"];
  23308. },
  23309. args: [],
  23310. source: "defaultValue\x0a\x09^ defaultValue",
  23311. referencedClasses: [],
  23312. messageSends: []
  23313. }),
  23314. $globals.Setting);
  23315. $core.addMethod(
  23316. $core.method({
  23317. selector: "defaultValue:",
  23318. protocol: "accessing",
  23319. fn: function (aStringifiableObject){
  23320. var self=this,$self=this;
  23321. $self["@defaultValue"]=aStringifiableObject;
  23322. return self;
  23323. },
  23324. args: ["aStringifiableObject"],
  23325. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23326. referencedClasses: [],
  23327. messageSends: []
  23328. }),
  23329. $globals.Setting);
  23330. $core.addMethod(
  23331. $core.method({
  23332. selector: "key",
  23333. protocol: "accessing",
  23334. fn: function (){
  23335. var self=this,$self=this;
  23336. return $self["@key"];
  23337. },
  23338. args: [],
  23339. source: "key\x0a\x09^ key",
  23340. referencedClasses: [],
  23341. messageSends: []
  23342. }),
  23343. $globals.Setting);
  23344. $core.addMethod(
  23345. $core.method({
  23346. selector: "key:",
  23347. protocol: "accessing",
  23348. fn: function (aString){
  23349. var self=this,$self=this;
  23350. $self["@key"]=aString;
  23351. return self;
  23352. },
  23353. args: ["aString"],
  23354. source: "key: aString\x0a\x09key := aString",
  23355. referencedClasses: [],
  23356. messageSends: []
  23357. }),
  23358. $globals.Setting);
  23359. $core.addMethod(
  23360. $core.method({
  23361. selector: "value",
  23362. protocol: "accessing",
  23363. fn: function (){
  23364. var self=this,$self=this;
  23365. return $core.withContext(function($ctx1) {
  23366. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23367. return $core.withContext(function($ctx2) {
  23368. return $self._defaultValue();
  23369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23370. }));
  23371. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23372. },
  23373. args: [],
  23374. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23375. referencedClasses: ["Smalltalk"],
  23376. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23377. }),
  23378. $globals.Setting);
  23379. $core.addMethod(
  23380. $core.method({
  23381. selector: "value:",
  23382. protocol: "accessing",
  23383. fn: function (aStringifiableObject){
  23384. var self=this,$self=this;
  23385. return $core.withContext(function($ctx1) {
  23386. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23387. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23388. },
  23389. args: ["aStringifiableObject"],
  23390. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23391. referencedClasses: ["Smalltalk"],
  23392. messageSends: ["at:put:", "settings", "key"]
  23393. }),
  23394. $globals.Setting);
  23395. $core.addMethod(
  23396. $core.method({
  23397. selector: "at:ifAbsent:",
  23398. protocol: "instance creation",
  23399. fn: function (aString,aDefaultValue){
  23400. var self=this,$self=this;
  23401. return $core.withContext(function($ctx1) {
  23402. var $1;
  23403. $1=(
  23404. $ctx1.supercall = true,
  23405. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23406. $ctx1.supercall = false;
  23407. $recv($1)._key_(aString);
  23408. $recv($1)._defaultValue_(aDefaultValue);
  23409. return $recv($1)._yourself();
  23410. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23411. },
  23412. args: ["aString", "aDefaultValue"],
  23413. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23414. referencedClasses: [],
  23415. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23416. }),
  23417. $globals.Setting.a$cls);
  23418. $core.addMethod(
  23419. $core.method({
  23420. selector: "new",
  23421. protocol: "instance creation",
  23422. fn: function (){
  23423. var self=this,$self=this;
  23424. return $core.withContext(function($ctx1) {
  23425. $self._shouldNotImplement();
  23426. return self;
  23427. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23428. },
  23429. args: [],
  23430. source: "new\x0a\x09self shouldNotImplement",
  23431. referencedClasses: [],
  23432. messageSends: ["shouldNotImplement"]
  23433. }),
  23434. $globals.Setting.a$cls);
  23435. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23436. $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.";
  23437. $core.addMethod(
  23438. $core.method({
  23439. selector: "addGlobalJsVariable:",
  23440. protocol: "globals",
  23441. fn: function (aString){
  23442. var self=this,$self=this;
  23443. return $core.withContext(function($ctx1) {
  23444. $recv($self._globalJsVariables())._add_(aString);
  23445. return self;
  23446. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23447. },
  23448. args: ["aString"],
  23449. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23450. referencedClasses: [],
  23451. messageSends: ["add:", "globalJsVariables"]
  23452. }),
  23453. $globals.SmalltalkImage);
  23454. $core.addMethod(
  23455. $core.method({
  23456. selector: "adoptPackageDictionary",
  23457. protocol: "private",
  23458. fn: function (){
  23459. var self=this,$self=this;
  23460. return $core.withContext(function($ctx1) {
  23461. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23462. return $core.withContext(function($ctx2) {
  23463. return $recv($globals.Package)._named_javaScriptDescriptor_(key,value);
  23464. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23465. }));
  23466. return self;
  23467. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDictionary",{},$globals.SmalltalkImage)});
  23468. },
  23469. args: [],
  23470. source: "adoptPackageDictionary\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]",
  23471. referencedClasses: ["Package"],
  23472. messageSends: ["keysAndValuesDo:", "packageDescriptors", "core", "named:javaScriptDescriptor:"]
  23473. }),
  23474. $globals.SmalltalkImage);
  23475. $core.addMethod(
  23476. $core.method({
  23477. selector: "amdRequire",
  23478. protocol: "accessing amd",
  23479. fn: function (){
  23480. var self=this,$self=this;
  23481. return $core.withContext(function($ctx1) {
  23482. return $recv($self._core())._at_("amdRequire");
  23483. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23484. },
  23485. args: [],
  23486. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23487. referencedClasses: [],
  23488. messageSends: ["at:", "core"]
  23489. }),
  23490. $globals.SmalltalkImage);
  23491. $core.addMethod(
  23492. $core.method({
  23493. selector: "asSmalltalkException:",
  23494. protocol: "error handling",
  23495. fn: function (anObject){
  23496. var self=this,$self=this;
  23497. return $core.withContext(function($ctx1) {
  23498. var $1;
  23499. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23500. return $core.withContext(function($ctx2) {
  23501. return $recv(anObject)._isKindOf_($globals.Error);
  23502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23503. }));
  23504. if($core.assert($1)){
  23505. return anObject;
  23506. } else {
  23507. return $recv($globals.JavaScriptException)._on_(anObject);
  23508. }
  23509. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23510. },
  23511. args: ["anObject"],
  23512. 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 ]",
  23513. referencedClasses: ["Error", "JavaScriptException"],
  23514. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23515. }),
  23516. $globals.SmalltalkImage);
  23517. $core.addMethod(
  23518. $core.method({
  23519. selector: "basicCreatePackage:",
  23520. protocol: "private",
  23521. fn: function (packageName){
  23522. var self=this,$self=this;
  23523. return $core.withContext(function($ctx1) {
  23524. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23525. return $core.withContext(function($ctx2) {
  23526. return $recv($globals.Package)._new_(packageName);
  23527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23528. }));
  23529. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23530. },
  23531. args: ["packageName"],
  23532. 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 ]",
  23533. referencedClasses: ["Package"],
  23534. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23535. }),
  23536. $globals.SmalltalkImage);
  23537. $core.addMethod(
  23538. $core.method({
  23539. selector: "basicParse:",
  23540. protocol: "private",
  23541. fn: function (aString){
  23542. var self=this,$self=this;
  23543. return $core.withContext(function($ctx1) {
  23544. return $recv($globals.SmalltalkParser)._parse_(aString);
  23545. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23546. },
  23547. args: ["aString"],
  23548. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23549. referencedClasses: ["SmalltalkParser"],
  23550. messageSends: ["parse:"]
  23551. }),
  23552. $globals.SmalltalkImage);
  23553. $core.addMethod(
  23554. $core.method({
  23555. selector: "cancelOptOut:",
  23556. protocol: "accessing",
  23557. fn: function (anObject){
  23558. var self=this,$self=this;
  23559. return $core.withContext(function($ctx1) {
  23560. delete anObject.klass; delete anObject.a$cls;;
  23561. return self;
  23562. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23563. },
  23564. args: ["anObject"],
  23565. 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;'>",
  23566. referencedClasses: [],
  23567. messageSends: []
  23568. }),
  23569. $globals.SmalltalkImage);
  23570. $core.addMethod(
  23571. $core.method({
  23572. selector: "classes",
  23573. protocol: "classes",
  23574. fn: function (){
  23575. var self=this,$self=this;
  23576. return $core.withContext(function($ctx1) {
  23577. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23578. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23579. },
  23580. args: [],
  23581. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23582. referencedClasses: [],
  23583. messageSends: ["copy", "traitsOrClasses", "core"]
  23584. }),
  23585. $globals.SmalltalkImage);
  23586. $core.addMethod(
  23587. $core.method({
  23588. selector: "core",
  23589. protocol: "accessing",
  23590. fn: function (){
  23591. var self=this,$self=this;
  23592. return $core.withContext(function($ctx1) {
  23593. return $core;
  23594. return self;
  23595. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23596. },
  23597. args: [],
  23598. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23599. referencedClasses: [],
  23600. messageSends: []
  23601. }),
  23602. $globals.SmalltalkImage);
  23603. $core.addMethod(
  23604. $core.method({
  23605. selector: "createPackage:",
  23606. protocol: "packages",
  23607. fn: function (packageName){
  23608. var self=this,$self=this;
  23609. var package_,announcement;
  23610. return $core.withContext(function($ctx1) {
  23611. var $1;
  23612. package_=$self._basicCreatePackage_(packageName);
  23613. $1=$recv($globals.PackageAdded)._new();
  23614. $recv($1)._package_(package_);
  23615. announcement=$recv($1)._yourself();
  23616. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23617. return package_;
  23618. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23619. },
  23620. args: ["packageName"],
  23621. 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",
  23622. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23623. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23624. }),
  23625. $globals.SmalltalkImage);
  23626. $core.addMethod(
  23627. $core.method({
  23628. selector: "defaultAmdNamespace",
  23629. protocol: "accessing amd",
  23630. fn: function (){
  23631. var self=this,$self=this;
  23632. return $core.withContext(function($ctx1) {
  23633. return "transport.defaultAmdNamespace"._settingValue();
  23634. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23635. },
  23636. args: [],
  23637. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23638. referencedClasses: [],
  23639. messageSends: ["settingValue"]
  23640. }),
  23641. $globals.SmalltalkImage);
  23642. $core.addMethod(
  23643. $core.method({
  23644. selector: "defaultAmdNamespace:",
  23645. protocol: "accessing amd",
  23646. fn: function (aString){
  23647. var self=this,$self=this;
  23648. return $core.withContext(function($ctx1) {
  23649. "transport.defaultAmdNamespace"._settingValue_(aString);
  23650. return self;
  23651. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23652. },
  23653. args: ["aString"],
  23654. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23655. referencedClasses: [],
  23656. messageSends: ["settingValue:"]
  23657. }),
  23658. $globals.SmalltalkImage);
  23659. $core.addMethod(
  23660. $core.method({
  23661. selector: "deleteClass:",
  23662. protocol: "private",
  23663. fn: function (aClass){
  23664. var self=this,$self=this;
  23665. return $core.withContext(function($ctx1) {
  23666. $core.removeClass(aClass);
  23667. return self;
  23668. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23669. },
  23670. args: ["aClass"],
  23671. 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)'>",
  23672. referencedClasses: [],
  23673. messageSends: []
  23674. }),
  23675. $globals.SmalltalkImage);
  23676. $core.addMethod(
  23677. $core.method({
  23678. selector: "deleteGlobalJsVariable:",
  23679. protocol: "globals",
  23680. fn: function (aString){
  23681. var self=this,$self=this;
  23682. return $core.withContext(function($ctx1) {
  23683. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23684. }));
  23685. return self;
  23686. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23687. },
  23688. args: ["aString"],
  23689. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23690. referencedClasses: [],
  23691. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23692. }),
  23693. $globals.SmalltalkImage);
  23694. $core.addMethod(
  23695. $core.method({
  23696. selector: "existsJsGlobal:",
  23697. protocol: "testing",
  23698. fn: function (aString){
  23699. var self=this,$self=this;
  23700. return $core.withContext(function($ctx1) {
  23701. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23702. return $recv($globals.Platform)._includesGlobal_(aString);
  23703. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23704. },
  23705. args: ["aString"],
  23706. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23707. referencedClasses: ["Platform"],
  23708. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23709. }),
  23710. $globals.SmalltalkImage);
  23711. $core.addMethod(
  23712. $core.method({
  23713. selector: "globalJsVariables",
  23714. protocol: "globals",
  23715. fn: function (){
  23716. var self=this,$self=this;
  23717. return $core.withContext(function($ctx1) {
  23718. var $1,$receiver;
  23719. $1=$self["@globalJsVariables"];
  23720. if(($receiver = $1) == null || $receiver.a$nil){
  23721. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23722. return $self["@globalJsVariables"];
  23723. } else {
  23724. return $1;
  23725. }
  23726. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23727. },
  23728. args: [],
  23729. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23730. referencedClasses: [],
  23731. messageSends: ["ifNil:"]
  23732. }),
  23733. $globals.SmalltalkImage);
  23734. $core.addMethod(
  23735. $core.method({
  23736. selector: "globals",
  23737. protocol: "accessing",
  23738. fn: function (){
  23739. var self=this,$self=this;
  23740. return $core.withContext(function($ctx1) {
  23741. return $globals;
  23742. return self;
  23743. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23744. },
  23745. args: [],
  23746. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23747. referencedClasses: [],
  23748. messageSends: []
  23749. }),
  23750. $globals.SmalltalkImage);
  23751. $core.addMethod(
  23752. $core.method({
  23753. selector: "includesKey:",
  23754. protocol: "accessing",
  23755. fn: function (aKey){
  23756. var self=this,$self=this;
  23757. return $core.withContext(function($ctx1) {
  23758. return $core.hasOwnProperty(aKey);
  23759. return self;
  23760. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23761. },
  23762. args: ["aKey"],
  23763. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23764. referencedClasses: [],
  23765. messageSends: []
  23766. }),
  23767. $globals.SmalltalkImage);
  23768. $core.addMethod(
  23769. $core.method({
  23770. selector: "isSmalltalkObject:",
  23771. protocol: "testing",
  23772. fn: function (anObject){
  23773. var self=this,$self=this;
  23774. return $core.withContext(function($ctx1) {
  23775. return anObject.a$cls != null;
  23776. return self;
  23777. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23778. },
  23779. args: ["anObject"],
  23780. 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'>",
  23781. referencedClasses: [],
  23782. messageSends: []
  23783. }),
  23784. $globals.SmalltalkImage);
  23785. $core.addMethod(
  23786. $core.method({
  23787. selector: "optOut:",
  23788. protocol: "accessing",
  23789. fn: function (anObject){
  23790. var self=this,$self=this;
  23791. return $core.withContext(function($ctx1) {
  23792. anObject.klass = null; anObject.a$cls = null;
  23793. return self;
  23794. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23795. },
  23796. args: ["anObject"],
  23797. 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'>",
  23798. referencedClasses: [],
  23799. messageSends: []
  23800. }),
  23801. $globals.SmalltalkImage);
  23802. $core.addMethod(
  23803. $core.method({
  23804. selector: "packageAt:",
  23805. protocol: "packages",
  23806. fn: function (packageName){
  23807. var self=this,$self=this;
  23808. return $core.withContext(function($ctx1) {
  23809. $self._deprecatedAPI_("Use #packageAt:ifAbsent: directly.");
  23810. return $self._packageAt_ifAbsent_(packageName,(function(){
  23811. }));
  23812. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  23813. },
  23814. args: ["packageName"],
  23815. source: "packageAt: packageName\x0a\x09self deprecatedAPI: 'Use #packageAt:ifAbsent: directly.'.\x0a\x09^ self packageAt: packageName ifAbsent: []",
  23816. referencedClasses: [],
  23817. messageSends: ["deprecatedAPI:", "packageAt:ifAbsent:"]
  23818. }),
  23819. $globals.SmalltalkImage);
  23820. $core.addMethod(
  23821. $core.method({
  23822. selector: "packageAt:ifAbsent:",
  23823. protocol: "packages",
  23824. fn: function (packageName,aBlock){
  23825. var self=this,$self=this;
  23826. return $core.withContext(function($ctx1) {
  23827. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23828. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23829. },
  23830. args: ["packageName", "aBlock"],
  23831. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23832. referencedClasses: [],
  23833. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23834. }),
  23835. $globals.SmalltalkImage);
  23836. $core.addMethod(
  23837. $core.method({
  23838. selector: "packageAt:ifPresent:",
  23839. protocol: "packages",
  23840. fn: function (packageName,aBlock){
  23841. var self=this,$self=this;
  23842. return $core.withContext(function($ctx1) {
  23843. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23844. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23845. },
  23846. args: ["packageName", "aBlock"],
  23847. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23848. referencedClasses: [],
  23849. messageSends: ["at:ifPresent:", "packageDictionary"]
  23850. }),
  23851. $globals.SmalltalkImage);
  23852. $core.addMethod(
  23853. $core.method({
  23854. selector: "packageDictionary",
  23855. protocol: "packages",
  23856. fn: function (){
  23857. var self=this,$self=this;
  23858. return $core.withContext(function($ctx1) {
  23859. var $1,$receiver;
  23860. $1=$self["@packageDictionary"];
  23861. if(($receiver = $1) == null || $receiver.a$nil){
  23862. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23863. return $self["@packageDictionary"];
  23864. } else {
  23865. return $1;
  23866. }
  23867. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23868. },
  23869. args: [],
  23870. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23871. referencedClasses: ["Dictionary"],
  23872. messageSends: ["ifNil:", "new"]
  23873. }),
  23874. $globals.SmalltalkImage);
  23875. $core.addMethod(
  23876. $core.method({
  23877. selector: "packages",
  23878. protocol: "packages",
  23879. fn: function (){
  23880. var self=this,$self=this;
  23881. return $core.withContext(function($ctx1) {
  23882. return $recv($recv($self._packageDictionary())._values())._copy();
  23883. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23884. },
  23885. args: [],
  23886. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23887. referencedClasses: [],
  23888. messageSends: ["copy", "values", "packageDictionary"]
  23889. }),
  23890. $globals.SmalltalkImage);
  23891. $core.addMethod(
  23892. $core.method({
  23893. selector: "parse:",
  23894. protocol: "accessing",
  23895. fn: function (aString){
  23896. var self=this,$self=this;
  23897. var result;
  23898. return $core.withContext(function($ctx1) {
  23899. var $1;
  23900. $recv((function(){
  23901. return $core.withContext(function($ctx2) {
  23902. result=$self._basicParse_(aString);
  23903. return result;
  23904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23905. }))._tryCatch_((function(ex){
  23906. return $core.withContext(function($ctx2) {
  23907. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23908. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23909. }));
  23910. $1=result;
  23911. $recv($1)._source_(aString);
  23912. return $recv($1)._yourself();
  23913. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23914. },
  23915. args: ["aString"],
  23916. 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",
  23917. referencedClasses: [],
  23918. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23919. }),
  23920. $globals.SmalltalkImage);
  23921. $core.addMethod(
  23922. $core.method({
  23923. selector: "parseError:parsing:",
  23924. protocol: "error handling",
  23925. fn: function (anException,aString){
  23926. var self=this,$self=this;
  23927. var pos;
  23928. return $core.withContext(function($ctx1) {
  23929. var $1,$2,$6,$5,$4,$3;
  23930. $1=$recv(anException)._basicAt_("location");
  23931. $ctx1.sendIdx["basicAt:"]=1;
  23932. pos=$recv($1)._start();
  23933. $2=$recv($globals.ParseError)._new();
  23934. $6=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  23935. $ctx1.sendIdx[","]=4;
  23936. $5=$recv($6).__comma($recv(pos)._column());
  23937. $ctx1.sendIdx[","]=3;
  23938. $4=$recv($5).__comma(" : Unexpected character ");
  23939. $ctx1.sendIdx[","]=2;
  23940. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23941. $ctx1.sendIdx[","]=1;
  23942. return $recv($2)._messageText_($3);
  23943. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  23944. },
  23945. args: ["anException", "aString"],
  23946. source: "parseError: anException parsing: aString\x0a\x09| pos |\x0a\x09pos := (anException basicAt: 'location') start.\x0a\x09^ ParseError new messageText: 'Parse error on line ', pos line ,' column ' , pos column ,' : Unexpected character ', (anException basicAt: 'found')",
  23947. referencedClasses: ["ParseError"],
  23948. messageSends: ["start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  23949. }),
  23950. $globals.SmalltalkImage);
  23951. $core.addMethod(
  23952. $core.method({
  23953. selector: "pseudoVariableNames",
  23954. protocol: "accessing",
  23955. fn: function (){
  23956. var self=this,$self=this;
  23957. return ["self", "super", "nil", "true", "false", "thisContext"];
  23958. },
  23959. args: [],
  23960. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23961. referencedClasses: [],
  23962. messageSends: []
  23963. }),
  23964. $globals.SmalltalkImage);
  23965. $core.addMethod(
  23966. $core.method({
  23967. selector: "readJSObject:",
  23968. protocol: "accessing",
  23969. fn: function (anObject){
  23970. var self=this,$self=this;
  23971. return $core.withContext(function($ctx1) {
  23972. return $core.readJSObject(anObject);
  23973. return self;
  23974. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23975. },
  23976. args: ["anObject"],
  23977. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23978. referencedClasses: [],
  23979. messageSends: []
  23980. }),
  23981. $globals.SmalltalkImage);
  23982. $core.addMethod(
  23983. $core.method({
  23984. selector: "removeClass:",
  23985. protocol: "classes",
  23986. fn: function (aClass){
  23987. var self=this,$self=this;
  23988. return $core.withContext(function($ctx1) {
  23989. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23990. $1=$recv(aClass)._isMetaclass();
  23991. if($core.assert($1)){
  23992. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23993. $ctx1.sendIdx[","]=1;
  23994. $self._error_($2);
  23995. $ctx1.sendIdx["error:"]=1;
  23996. }
  23997. $recv(aClass)._allSubclassesDo_((function(subclass){
  23998. return $core.withContext(function($ctx2) {
  23999. $5=$recv(aClass)._name();
  24000. $ctx2.sendIdx["name"]=1;
  24001. $4=$recv($5).__comma(" has a subclass: ");
  24002. $ctx2.sendIdx[","]=3;
  24003. $6=$recv(subclass)._name();
  24004. $ctx2.sendIdx["name"]=2;
  24005. $3=$recv($4).__comma($6);
  24006. $ctx2.sendIdx[","]=2;
  24007. return $self._error_($3);
  24008. $ctx2.sendIdx["error:"]=2;
  24009. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  24010. }));
  24011. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  24012. return $core.withContext(function($ctx2) {
  24013. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  24014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  24015. }));
  24016. $self._deleteClass_(aClass);
  24017. $recv(aClass)._setTraitComposition_([]);
  24018. $ctx1.sendIdx["setTraitComposition:"]=1;
  24019. $7=$recv(aClass)._theMetaClass();
  24020. if(($receiver = $7) == null || $receiver.a$nil){
  24021. $7;
  24022. } else {
  24023. var meta;
  24024. meta=$receiver;
  24025. $recv(meta)._setTraitComposition_([]);
  24026. }
  24027. $8=$recv($globals.SystemAnnouncer)._current();
  24028. $10=$recv($globals.ClassRemoved)._new();
  24029. $recv($10)._theClass_(aClass);
  24030. $9=$recv($10)._yourself();
  24031. $recv($8)._announce_($9);
  24032. return self;
  24033. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  24034. },
  24035. args: ["aClass"],
  24036. 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)",
  24037. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  24038. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  24039. }),
  24040. $globals.SmalltalkImage);
  24041. $core.addMethod(
  24042. $core.method({
  24043. selector: "removePackage:",
  24044. protocol: "packages",
  24045. fn: function (packageName){
  24046. var self=this,$self=this;
  24047. var pkg;
  24048. return $core.withContext(function($ctx1) {
  24049. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24050. return $core.withContext(function($ctx2) {
  24051. return $self._error_("Missing package: ".__comma(packageName));
  24052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24053. }));
  24054. $recv($recv(pkg)._classes())._do_((function(each){
  24055. return $core.withContext(function($ctx2) {
  24056. return $self._removeClass_(each);
  24057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24058. }));
  24059. $recv($self._packageDictionary())._removeKey_(packageName);
  24060. return self;
  24061. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  24062. },
  24063. args: ["packageName"],
  24064. 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",
  24065. referencedClasses: [],
  24066. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  24067. }),
  24068. $globals.SmalltalkImage);
  24069. $core.addMethod(
  24070. $core.method({
  24071. selector: "renamePackage:to:",
  24072. protocol: "packages",
  24073. fn: function (packageName,newName){
  24074. var self=this,$self=this;
  24075. var pkg;
  24076. return $core.withContext(function($ctx1) {
  24077. var $1,$2,$3;
  24078. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24079. return $core.withContext(function($ctx2) {
  24080. $1="Missing package: ".__comma(packageName);
  24081. $ctx2.sendIdx[","]=1;
  24082. return $self._error_($1);
  24083. $ctx2.sendIdx["error:"]=1;
  24084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24085. }));
  24086. $self._packageAt_ifPresent_(newName,(function(){
  24087. return $core.withContext(function($ctx2) {
  24088. return $self._error_("Already exists a package called: ".__comma(newName));
  24089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24090. }));
  24091. $2=pkg;
  24092. $recv($2)._name_(newName);
  24093. $recv($2)._beDirty();
  24094. $3=$self._packageDictionary();
  24095. $recv($3)._at_put_(newName,pkg);
  24096. $recv($3)._removeKey_(packageName);
  24097. return self;
  24098. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24099. },
  24100. args: ["packageName", "newName"],
  24101. 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",
  24102. referencedClasses: [],
  24103. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24104. }),
  24105. $globals.SmalltalkImage);
  24106. $core.addMethod(
  24107. $core.method({
  24108. selector: "reservedWords",
  24109. protocol: "accessing",
  24110. fn: function (){
  24111. var self=this,$self=this;
  24112. 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"];
  24113. },
  24114. args: [],
  24115. 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)",
  24116. referencedClasses: [],
  24117. messageSends: []
  24118. }),
  24119. $globals.SmalltalkImage);
  24120. $core.addMethod(
  24121. $core.method({
  24122. selector: "settings",
  24123. protocol: "accessing",
  24124. fn: function (){
  24125. var self=this,$self=this;
  24126. return $globals.SmalltalkSettings;
  24127. },
  24128. args: [],
  24129. source: "settings\x0a\x09^ SmalltalkSettings",
  24130. referencedClasses: ["SmalltalkSettings"],
  24131. messageSends: []
  24132. }),
  24133. $globals.SmalltalkImage);
  24134. $core.addMethod(
  24135. $core.method({
  24136. selector: "version",
  24137. protocol: "accessing",
  24138. fn: function (){
  24139. var self=this,$self=this;
  24140. return "0.21.1";
  24141. },
  24142. args: [],
  24143. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.21.1'",
  24144. referencedClasses: [],
  24145. messageSends: []
  24146. }),
  24147. $globals.SmalltalkImage);
  24148. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24149. $core.addMethod(
  24150. $core.method({
  24151. selector: "current",
  24152. protocol: "instance creation",
  24153. fn: function (){
  24154. var self=this,$self=this;
  24155. return $core.withContext(function($ctx1) {
  24156. var $1,$receiver;
  24157. $1=$self["@current"];
  24158. if(($receiver = $1) == null || $receiver.a$nil){
  24159. $self["@current"]=(
  24160. $ctx1.supercall = true,
  24161. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24162. $ctx1.supercall = false;
  24163. return $self["@current"];
  24164. } else {
  24165. $self._deprecatedAPI();
  24166. return $self["@current"];
  24167. }
  24168. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24169. },
  24170. args: [],
  24171. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24172. referencedClasses: [],
  24173. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24174. }),
  24175. $globals.SmalltalkImage.a$cls);
  24176. $core.addMethod(
  24177. $core.method({
  24178. selector: "initialize",
  24179. protocol: "initialization",
  24180. fn: function (){
  24181. var self=this,$self=this;
  24182. var st;
  24183. return $core.withContext(function($ctx1) {
  24184. st=$self._current();
  24185. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24186. return self;
  24187. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24188. },
  24189. args: [],
  24190. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24191. referencedClasses: [],
  24192. messageSends: ["current", "at:put:", "globals"]
  24193. }),
  24194. $globals.SmalltalkImage.a$cls);
  24195. $core.addMethod(
  24196. $core.method({
  24197. selector: "new",
  24198. protocol: "instance creation",
  24199. fn: function (){
  24200. var self=this,$self=this;
  24201. return $core.withContext(function($ctx1) {
  24202. $self._shouldNotImplement();
  24203. return self;
  24204. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24205. },
  24206. args: [],
  24207. source: "new\x0a\x09self shouldNotImplement",
  24208. referencedClasses: [],
  24209. messageSends: ["shouldNotImplement"]
  24210. }),
  24211. $globals.SmalltalkImage.a$cls);
  24212. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24213. $core.addMethod(
  24214. $core.method({
  24215. selector: "nextPutJSObject:",
  24216. protocol: "*Kernel-Infrastructure",
  24217. fn: function (aJSObject){
  24218. var self=this,$self=this;
  24219. return $core.withContext(function($ctx1) {
  24220. $self._nextPut_(aJSObject);
  24221. return self;
  24222. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24223. },
  24224. args: ["aJSObject"],
  24225. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24226. referencedClasses: [],
  24227. messageSends: ["nextPut:"]
  24228. }),
  24229. $globals.ProtoStream);
  24230. $core.addMethod(
  24231. $core.method({
  24232. selector: "asJavaScriptPropertyName",
  24233. protocol: "*Kernel-Infrastructure",
  24234. fn: function (){
  24235. var self=this,$self=this;
  24236. return $core.withContext(function($ctx1) {
  24237. return $core.st2prop(self);
  24238. return self;
  24239. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24240. },
  24241. args: [],
  24242. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24243. referencedClasses: [],
  24244. messageSends: []
  24245. }),
  24246. $globals.String);
  24247. $core.addMethod(
  24248. $core.method({
  24249. selector: "asSetting",
  24250. protocol: "*Kernel-Infrastructure",
  24251. fn: function (){
  24252. var self=this,$self=this;
  24253. return $core.withContext(function($ctx1) {
  24254. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24255. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24256. },
  24257. args: [],
  24258. 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",
  24259. referencedClasses: ["Setting"],
  24260. messageSends: ["at:ifAbsent:"]
  24261. }),
  24262. $globals.String);
  24263. $core.addMethod(
  24264. $core.method({
  24265. selector: "asSettingIfAbsent:",
  24266. protocol: "*Kernel-Infrastructure",
  24267. fn: function (aDefaultValue){
  24268. var self=this,$self=this;
  24269. return $core.withContext(function($ctx1) {
  24270. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24271. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24272. },
  24273. args: ["aDefaultValue"],
  24274. 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",
  24275. referencedClasses: ["Setting"],
  24276. messageSends: ["at:ifAbsent:"]
  24277. }),
  24278. $globals.String);
  24279. $core.addMethod(
  24280. $core.method({
  24281. selector: "settingValue",
  24282. protocol: "*Kernel-Infrastructure",
  24283. fn: function (){
  24284. var self=this,$self=this;
  24285. return $core.withContext(function($ctx1) {
  24286. return $recv($self._asSetting())._value();
  24287. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24288. },
  24289. args: [],
  24290. source: "settingValue\x0a\x09^ self asSetting value",
  24291. referencedClasses: [],
  24292. messageSends: ["value", "asSetting"]
  24293. }),
  24294. $globals.String);
  24295. $core.addMethod(
  24296. $core.method({
  24297. selector: "settingValue:",
  24298. protocol: "*Kernel-Infrastructure",
  24299. fn: function (aValue){
  24300. var self=this,$self=this;
  24301. return $core.withContext(function($ctx1) {
  24302. return $recv($self._asSetting())._value_(aValue);
  24303. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24304. },
  24305. args: ["aValue"],
  24306. 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",
  24307. referencedClasses: [],
  24308. messageSends: ["value:", "asSetting"]
  24309. }),
  24310. $globals.String);
  24311. $core.addMethod(
  24312. $core.method({
  24313. selector: "settingValueIfAbsent:",
  24314. protocol: "*Kernel-Infrastructure",
  24315. fn: function (aDefaultValue){
  24316. var self=this,$self=this;
  24317. return $core.withContext(function($ctx1) {
  24318. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24319. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24320. },
  24321. args: ["aDefaultValue"],
  24322. 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",
  24323. referencedClasses: [],
  24324. messageSends: ["value", "asSettingIfAbsent:"]
  24325. }),
  24326. $globals.String);
  24327. });
  24328. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24329. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24330. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24331. $core.addPackage("Kernel-Announcements");
  24332. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24333. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24334. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24335. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24336. $core.addMethod(
  24337. $core.method({
  24338. selector: "announcementClass",
  24339. protocol: "accessing",
  24340. fn: function (){
  24341. var self=this,$self=this;
  24342. return $self["@announcementClass"];
  24343. },
  24344. args: [],
  24345. source: "announcementClass\x0a\x09^ announcementClass",
  24346. referencedClasses: [],
  24347. messageSends: []
  24348. }),
  24349. $globals.AnnouncementSubscription);
  24350. $core.addMethod(
  24351. $core.method({
  24352. selector: "announcementClass:",
  24353. protocol: "accessing",
  24354. fn: function (aClass){
  24355. var self=this,$self=this;
  24356. $self["@announcementClass"]=aClass;
  24357. return self;
  24358. },
  24359. args: ["aClass"],
  24360. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24361. referencedClasses: [],
  24362. messageSends: []
  24363. }),
  24364. $globals.AnnouncementSubscription);
  24365. $core.addMethod(
  24366. $core.method({
  24367. selector: "deliver:",
  24368. protocol: "announcing",
  24369. fn: function (anAnnouncement){
  24370. var self=this,$self=this;
  24371. return $core.withContext(function($ctx1) {
  24372. var $1;
  24373. $1=$self._handlesAnnouncement_(anAnnouncement);
  24374. if($core.assert($1)){
  24375. $recv($self._valuable())._value_(anAnnouncement);
  24376. }
  24377. return self;
  24378. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24379. },
  24380. args: ["anAnnouncement"],
  24381. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24382. referencedClasses: [],
  24383. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24384. }),
  24385. $globals.AnnouncementSubscription);
  24386. $core.addMethod(
  24387. $core.method({
  24388. selector: "handlesAnnouncement:",
  24389. protocol: "announcing",
  24390. fn: function (anAnnouncement){
  24391. var self=this,$self=this;
  24392. return $core.withContext(function($ctx1) {
  24393. var $2,$3,$1,$receiver;
  24394. $2=$recv($globals.Smalltalk)._globals();
  24395. $ctx1.sendIdx["globals"]=1;
  24396. $3=$recv($self._announcementClass())._name();
  24397. $ctx1.sendIdx["name"]=1;
  24398. $1=$recv($2)._at_($3);
  24399. $ctx1.sendIdx["at:"]=1;
  24400. if(($receiver = $1) == null || $receiver.a$nil){
  24401. return false;
  24402. } else {
  24403. var class_;
  24404. class_=$receiver;
  24405. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24406. }
  24407. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24408. },
  24409. args: ["anAnnouncement"],
  24410. 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 ]",
  24411. referencedClasses: ["Smalltalk"],
  24412. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24413. }),
  24414. $globals.AnnouncementSubscription);
  24415. $core.addMethod(
  24416. $core.method({
  24417. selector: "receiver",
  24418. protocol: "accessing",
  24419. fn: function (){
  24420. var self=this,$self=this;
  24421. return $core.withContext(function($ctx1) {
  24422. return $recv($self._valuable())._receiver();
  24423. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24424. },
  24425. args: [],
  24426. source: "receiver\x0a\x09^ self valuable receiver",
  24427. referencedClasses: [],
  24428. messageSends: ["receiver", "valuable"]
  24429. }),
  24430. $globals.AnnouncementSubscription);
  24431. $core.addMethod(
  24432. $core.method({
  24433. selector: "valuable",
  24434. protocol: "accessing",
  24435. fn: function (){
  24436. var self=this,$self=this;
  24437. return $self["@valuable"];
  24438. },
  24439. args: [],
  24440. source: "valuable\x0a\x09^ valuable",
  24441. referencedClasses: [],
  24442. messageSends: []
  24443. }),
  24444. $globals.AnnouncementSubscription);
  24445. $core.addMethod(
  24446. $core.method({
  24447. selector: "valuable:",
  24448. protocol: "accessing",
  24449. fn: function (aValuable){
  24450. var self=this,$self=this;
  24451. $self["@valuable"]=aValuable;
  24452. return self;
  24453. },
  24454. args: ["aValuable"],
  24455. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24456. referencedClasses: [],
  24457. messageSends: []
  24458. }),
  24459. $globals.AnnouncementSubscription);
  24460. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24461. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24462. $core.addMethod(
  24463. $core.method({
  24464. selector: "receiver",
  24465. protocol: "accessing",
  24466. fn: function (){
  24467. var self=this,$self=this;
  24468. return $self["@receiver"];
  24469. },
  24470. args: [],
  24471. source: "receiver\x0a\x09^ receiver",
  24472. referencedClasses: [],
  24473. messageSends: []
  24474. }),
  24475. $globals.AnnouncementValuable);
  24476. $core.addMethod(
  24477. $core.method({
  24478. selector: "receiver:",
  24479. protocol: "accessing",
  24480. fn: function (anObject){
  24481. var self=this,$self=this;
  24482. $self["@receiver"]=anObject;
  24483. return self;
  24484. },
  24485. args: ["anObject"],
  24486. source: "receiver: anObject\x0a\x09receiver := anObject",
  24487. referencedClasses: [],
  24488. messageSends: []
  24489. }),
  24490. $globals.AnnouncementValuable);
  24491. $core.addMethod(
  24492. $core.method({
  24493. selector: "valuable",
  24494. protocol: "accessing",
  24495. fn: function (){
  24496. var self=this,$self=this;
  24497. return $self["@valuable"];
  24498. },
  24499. args: [],
  24500. source: "valuable\x0a\x09^ valuable",
  24501. referencedClasses: [],
  24502. messageSends: []
  24503. }),
  24504. $globals.AnnouncementValuable);
  24505. $core.addMethod(
  24506. $core.method({
  24507. selector: "valuable:",
  24508. protocol: "accessing",
  24509. fn: function (anObject){
  24510. var self=this,$self=this;
  24511. $self["@valuable"]=anObject;
  24512. return self;
  24513. },
  24514. args: ["anObject"],
  24515. source: "valuable: anObject\x0a\x09valuable := anObject",
  24516. referencedClasses: [],
  24517. messageSends: []
  24518. }),
  24519. $globals.AnnouncementValuable);
  24520. $core.addMethod(
  24521. $core.method({
  24522. selector: "value",
  24523. protocol: "evaluating",
  24524. fn: function (){
  24525. var self=this,$self=this;
  24526. return $core.withContext(function($ctx1) {
  24527. return $recv($self._valuable())._value();
  24528. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24529. },
  24530. args: [],
  24531. source: "value\x0a\x09^ self valuable value",
  24532. referencedClasses: [],
  24533. messageSends: ["value", "valuable"]
  24534. }),
  24535. $globals.AnnouncementValuable);
  24536. $core.addMethod(
  24537. $core.method({
  24538. selector: "value:",
  24539. protocol: "evaluating",
  24540. fn: function (anObject){
  24541. var self=this,$self=this;
  24542. return $core.withContext(function($ctx1) {
  24543. return $recv($self._valuable())._value_(anObject);
  24544. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24545. },
  24546. args: ["anObject"],
  24547. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24548. referencedClasses: [],
  24549. messageSends: ["value:", "valuable"]
  24550. }),
  24551. $globals.AnnouncementValuable);
  24552. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24553. $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' ].";
  24554. $core.addMethod(
  24555. $core.method({
  24556. selector: "announce:",
  24557. protocol: "announcing",
  24558. fn: function (anAnnouncement){
  24559. var self=this,$self=this;
  24560. return $core.withContext(function($ctx1) {
  24561. $recv($self["@subscriptions"])._do_((function(each){
  24562. return $core.withContext(function($ctx2) {
  24563. return $recv(each)._deliver_(anAnnouncement);
  24564. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24565. }));
  24566. return self;
  24567. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24568. },
  24569. args: ["anAnnouncement"],
  24570. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24571. referencedClasses: [],
  24572. messageSends: ["do:", "deliver:"]
  24573. }),
  24574. $globals.Announcer);
  24575. $core.addMethod(
  24576. $core.method({
  24577. selector: "initialize",
  24578. protocol: "initialization",
  24579. fn: function (){
  24580. var self=this,$self=this;
  24581. return $core.withContext(function($ctx1) {
  24582. (
  24583. $ctx1.supercall = true,
  24584. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24585. $ctx1.supercall = false;
  24586. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24587. return self;
  24588. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24589. },
  24590. args: [],
  24591. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24592. referencedClasses: ["OrderedCollection"],
  24593. messageSends: ["initialize", "new"]
  24594. }),
  24595. $globals.Announcer);
  24596. $core.addMethod(
  24597. $core.method({
  24598. selector: "on:do:",
  24599. protocol: "subscribing",
  24600. fn: function (aClass,aBlock){
  24601. var self=this,$self=this;
  24602. return $core.withContext(function($ctx1) {
  24603. $self._on_do_for_(aClass,aBlock,nil);
  24604. return self;
  24605. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24606. },
  24607. args: ["aClass", "aBlock"],
  24608. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24609. referencedClasses: [],
  24610. messageSends: ["on:do:for:"]
  24611. }),
  24612. $globals.Announcer);
  24613. $core.addMethod(
  24614. $core.method({
  24615. selector: "on:do:for:",
  24616. protocol: "subscribing",
  24617. fn: function (aClass,aBlock,aReceiver){
  24618. var self=this,$self=this;
  24619. return $core.withContext(function($ctx1) {
  24620. var $1,$3,$5,$6,$4,$2;
  24621. $1=$self["@subscriptions"];
  24622. $3=$recv($globals.AnnouncementSubscription)._new();
  24623. $ctx1.sendIdx["new"]=1;
  24624. $5=$recv($globals.AnnouncementValuable)._new();
  24625. $recv($5)._valuable_(aBlock);
  24626. $recv($5)._receiver_(aReceiver);
  24627. $6=$recv($5)._yourself();
  24628. $ctx1.sendIdx["yourself"]=1;
  24629. $4=$6;
  24630. $recv($3)._valuable_($4);
  24631. $ctx1.sendIdx["valuable:"]=1;
  24632. $recv($3)._announcementClass_(aClass);
  24633. $2=$recv($3)._yourself();
  24634. $recv($1)._add_($2);
  24635. return self;
  24636. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24637. },
  24638. args: ["aClass", "aBlock", "aReceiver"],
  24639. 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)",
  24640. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24641. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24642. }),
  24643. $globals.Announcer);
  24644. $core.addMethod(
  24645. $core.method({
  24646. selector: "on:doOnce:",
  24647. protocol: "subscribing",
  24648. fn: function (aClass,aBlock){
  24649. var self=this,$self=this;
  24650. var subscription;
  24651. return $core.withContext(function($ctx1) {
  24652. var $1;
  24653. $1=$recv($globals.AnnouncementSubscription)._new();
  24654. $recv($1)._announcementClass_(aClass);
  24655. subscription=$recv($1)._yourself();
  24656. $recv(subscription)._valuable_((function(ann){
  24657. return $core.withContext(function($ctx2) {
  24658. $recv($self["@subscriptions"])._remove_(subscription);
  24659. return $recv(aBlock)._value_(ann);
  24660. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24661. }));
  24662. $recv($self["@subscriptions"])._add_(subscription);
  24663. return self;
  24664. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24665. },
  24666. args: ["aClass", "aBlock"],
  24667. 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",
  24668. referencedClasses: ["AnnouncementSubscription"],
  24669. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24670. }),
  24671. $globals.Announcer);
  24672. $core.addMethod(
  24673. $core.method({
  24674. selector: "on:send:to:",
  24675. protocol: "subscribing",
  24676. fn: function (aClass,aSelector,anObject){
  24677. var self=this,$self=this;
  24678. return $core.withContext(function($ctx1) {
  24679. var $1,$3,$5,$6,$4,$2;
  24680. $1=$self["@subscriptions"];
  24681. $3=$recv($globals.AnnouncementSubscription)._new();
  24682. $ctx1.sendIdx["new"]=1;
  24683. $5=$recv($globals.MessageSend)._new();
  24684. $recv($5)._receiver_(anObject);
  24685. $recv($5)._selector_(aSelector);
  24686. $6=$recv($5)._yourself();
  24687. $ctx1.sendIdx["yourself"]=1;
  24688. $4=$6;
  24689. $recv($3)._valuable_($4);
  24690. $recv($3)._announcementClass_(aClass);
  24691. $2=$recv($3)._yourself();
  24692. $recv($1)._add_($2);
  24693. return self;
  24694. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24695. },
  24696. args: ["aClass", "aSelector", "anObject"],
  24697. 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)",
  24698. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24699. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24700. }),
  24701. $globals.Announcer);
  24702. $core.addMethod(
  24703. $core.method({
  24704. selector: "unsubscribe:",
  24705. protocol: "subscribing",
  24706. fn: function (anObject){
  24707. var self=this,$self=this;
  24708. return $core.withContext(function($ctx1) {
  24709. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24710. return $core.withContext(function($ctx2) {
  24711. return $recv($recv(each)._receiver()).__eq(anObject);
  24712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24713. }));
  24714. return self;
  24715. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24716. },
  24717. args: ["anObject"],
  24718. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24719. referencedClasses: [],
  24720. messageSends: ["reject:", "=", "receiver"]
  24721. }),
  24722. $globals.Announcer);
  24723. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24724. $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`";
  24725. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24726. $core.addMethod(
  24727. $core.method({
  24728. selector: "current",
  24729. protocol: "accessing",
  24730. fn: function (){
  24731. var self=this,$self=this;
  24732. return $core.withContext(function($ctx1) {
  24733. var $1,$receiver;
  24734. $1=$self["@current"];
  24735. if(($receiver = $1) == null || $receiver.a$nil){
  24736. $self["@current"]=(
  24737. $ctx1.supercall = true,
  24738. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24739. $ctx1.supercall = false;
  24740. return $self["@current"];
  24741. } else {
  24742. return $1;
  24743. }
  24744. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24745. },
  24746. args: [],
  24747. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24748. referencedClasses: [],
  24749. messageSends: ["ifNil:", "new"]
  24750. }),
  24751. $globals.SystemAnnouncer.a$cls);
  24752. $core.addMethod(
  24753. $core.method({
  24754. selector: "new",
  24755. protocol: "instance creation",
  24756. fn: function (){
  24757. var self=this,$self=this;
  24758. return $core.withContext(function($ctx1) {
  24759. $self._shouldNotImplement();
  24760. return self;
  24761. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24762. },
  24763. args: [],
  24764. source: "new\x0a\x09self shouldNotImplement",
  24765. referencedClasses: [],
  24766. messageSends: ["shouldNotImplement"]
  24767. }),
  24768. $globals.SystemAnnouncer.a$cls);
  24769. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24770. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24771. $core.addMethod(
  24772. $core.method({
  24773. selector: "classTag",
  24774. protocol: "accessing",
  24775. fn: function (){
  24776. var self=this,$self=this;
  24777. return "announcement";
  24778. },
  24779. args: [],
  24780. 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'",
  24781. referencedClasses: [],
  24782. messageSends: []
  24783. }),
  24784. $globals.SystemAnnouncement.a$cls);
  24785. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24786. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24787. $core.addMethod(
  24788. $core.method({
  24789. selector: "theClass",
  24790. protocol: "accessing",
  24791. fn: function (){
  24792. var self=this,$self=this;
  24793. return $self["@theClass"];
  24794. },
  24795. args: [],
  24796. source: "theClass\x0a\x09^ theClass",
  24797. referencedClasses: [],
  24798. messageSends: []
  24799. }),
  24800. $globals.ClassAnnouncement);
  24801. $core.addMethod(
  24802. $core.method({
  24803. selector: "theClass:",
  24804. protocol: "accessing",
  24805. fn: function (aClass){
  24806. var self=this,$self=this;
  24807. $self["@theClass"]=aClass;
  24808. return self;
  24809. },
  24810. args: ["aClass"],
  24811. source: "theClass: aClass\x0a\x09theClass := aClass",
  24812. referencedClasses: [],
  24813. messageSends: []
  24814. }),
  24815. $globals.ClassAnnouncement);
  24816. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24817. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24818. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24819. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24820. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24821. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24822. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24823. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24824. $core.addMethod(
  24825. $core.method({
  24826. selector: "oldClass",
  24827. protocol: "accessing",
  24828. fn: function (){
  24829. var self=this,$self=this;
  24830. return $self["@oldClass"];
  24831. },
  24832. args: [],
  24833. source: "oldClass\x0a\x09^ oldClass",
  24834. referencedClasses: [],
  24835. messageSends: []
  24836. }),
  24837. $globals.ClassMigrated);
  24838. $core.addMethod(
  24839. $core.method({
  24840. selector: "oldClass:",
  24841. protocol: "accessing",
  24842. fn: function (aClass){
  24843. var self=this,$self=this;
  24844. $self["@oldClass"]=aClass;
  24845. return self;
  24846. },
  24847. args: ["aClass"],
  24848. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24849. referencedClasses: [],
  24850. messageSends: []
  24851. }),
  24852. $globals.ClassMigrated);
  24853. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24854. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24855. $core.addMethod(
  24856. $core.method({
  24857. selector: "oldPackage",
  24858. protocol: "accessing",
  24859. fn: function (){
  24860. var self=this,$self=this;
  24861. return $self["@oldPackage"];
  24862. },
  24863. args: [],
  24864. source: "oldPackage\x0a\x09^ oldPackage",
  24865. referencedClasses: [],
  24866. messageSends: []
  24867. }),
  24868. $globals.ClassMoved);
  24869. $core.addMethod(
  24870. $core.method({
  24871. selector: "oldPackage:",
  24872. protocol: "accessing",
  24873. fn: function (aPackage){
  24874. var self=this,$self=this;
  24875. $self["@oldPackage"]=aPackage;
  24876. return self;
  24877. },
  24878. args: ["aPackage"],
  24879. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24880. referencedClasses: [],
  24881. messageSends: []
  24882. }),
  24883. $globals.ClassMoved);
  24884. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24885. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24886. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24887. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24888. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24889. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24890. $core.addMethod(
  24891. $core.method({
  24892. selector: "method",
  24893. protocol: "accessing",
  24894. fn: function (){
  24895. var self=this,$self=this;
  24896. return $self["@method"];
  24897. },
  24898. args: [],
  24899. source: "method\x0a\x09^ method",
  24900. referencedClasses: [],
  24901. messageSends: []
  24902. }),
  24903. $globals.MethodAnnouncement);
  24904. $core.addMethod(
  24905. $core.method({
  24906. selector: "method:",
  24907. protocol: "accessing",
  24908. fn: function (aCompiledMethod){
  24909. var self=this,$self=this;
  24910. $self["@method"]=aCompiledMethod;
  24911. return self;
  24912. },
  24913. args: ["aCompiledMethod"],
  24914. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24915. referencedClasses: [],
  24916. messageSends: []
  24917. }),
  24918. $globals.MethodAnnouncement);
  24919. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24920. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24921. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24922. $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.";
  24923. $core.addMethod(
  24924. $core.method({
  24925. selector: "oldMethod",
  24926. protocol: "accessing",
  24927. fn: function (){
  24928. var self=this,$self=this;
  24929. return $self["@oldMethod"];
  24930. },
  24931. args: [],
  24932. source: "oldMethod\x0a\x09^ oldMethod",
  24933. referencedClasses: [],
  24934. messageSends: []
  24935. }),
  24936. $globals.MethodModified);
  24937. $core.addMethod(
  24938. $core.method({
  24939. selector: "oldMethod:",
  24940. protocol: "accessing",
  24941. fn: function (aMethod){
  24942. var self=this,$self=this;
  24943. $self["@oldMethod"]=aMethod;
  24944. return self;
  24945. },
  24946. args: ["aMethod"],
  24947. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24948. referencedClasses: [],
  24949. messageSends: []
  24950. }),
  24951. $globals.MethodModified);
  24952. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24953. $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.";
  24954. $core.addMethod(
  24955. $core.method({
  24956. selector: "oldProtocol",
  24957. protocol: "accessing",
  24958. fn: function (){
  24959. var self=this,$self=this;
  24960. return $self["@oldProtocol"];
  24961. },
  24962. args: [],
  24963. source: "oldProtocol\x0a\x09^ oldProtocol",
  24964. referencedClasses: [],
  24965. messageSends: []
  24966. }),
  24967. $globals.MethodMoved);
  24968. $core.addMethod(
  24969. $core.method({
  24970. selector: "oldProtocol:",
  24971. protocol: "accessing",
  24972. fn: function (aString){
  24973. var self=this,$self=this;
  24974. $self["@oldProtocol"]=aString;
  24975. return self;
  24976. },
  24977. args: ["aString"],
  24978. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24979. referencedClasses: [],
  24980. messageSends: []
  24981. }),
  24982. $globals.MethodMoved);
  24983. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24984. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24985. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24986. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24987. $core.addMethod(
  24988. $core.method({
  24989. selector: "package",
  24990. protocol: "accessing",
  24991. fn: function (){
  24992. var self=this,$self=this;
  24993. return $self["@package"];
  24994. },
  24995. args: [],
  24996. source: "package\x0a\x09^ package",
  24997. referencedClasses: [],
  24998. messageSends: []
  24999. }),
  25000. $globals.PackageAnnouncement);
  25001. $core.addMethod(
  25002. $core.method({
  25003. selector: "package:",
  25004. protocol: "accessing",
  25005. fn: function (aPackage){
  25006. var self=this,$self=this;
  25007. $self["@package"]=aPackage;
  25008. return self;
  25009. },
  25010. args: ["aPackage"],
  25011. source: "package: aPackage\x0a\x09package := aPackage",
  25012. referencedClasses: [],
  25013. messageSends: []
  25014. }),
  25015. $globals.PackageAnnouncement);
  25016. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25017. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  25018. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25019. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  25020. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25021. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  25022. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25023. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  25024. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  25025. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  25026. $core.addMethod(
  25027. $core.method({
  25028. selector: "package",
  25029. protocol: "accessing",
  25030. fn: function (){
  25031. var self=this,$self=this;
  25032. return $core.withContext(function($ctx1) {
  25033. var $1,$receiver;
  25034. $1=$self._theClass();
  25035. if(($receiver = $1) == null || $receiver.a$nil){
  25036. return $1;
  25037. } else {
  25038. var class_;
  25039. class_=$receiver;
  25040. return $recv(class_)._packageOfProtocol_($self._protocol());
  25041. }
  25042. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  25043. },
  25044. args: [],
  25045. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25046. referencedClasses: [],
  25047. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25048. }),
  25049. $globals.ProtocolAnnouncement);
  25050. $core.addMethod(
  25051. $core.method({
  25052. selector: "protocol",
  25053. protocol: "accessing",
  25054. fn: function (){
  25055. var self=this,$self=this;
  25056. return $self["@protocol"];
  25057. },
  25058. args: [],
  25059. source: "protocol\x0a\x09^ protocol",
  25060. referencedClasses: [],
  25061. messageSends: []
  25062. }),
  25063. $globals.ProtocolAnnouncement);
  25064. $core.addMethod(
  25065. $core.method({
  25066. selector: "protocol:",
  25067. protocol: "accessing",
  25068. fn: function (aString){
  25069. var self=this,$self=this;
  25070. $self["@protocol"]=aString;
  25071. return self;
  25072. },
  25073. args: ["aString"],
  25074. source: "protocol: aString\x0a\x09protocol := aString",
  25075. referencedClasses: [],
  25076. messageSends: []
  25077. }),
  25078. $globals.ProtocolAnnouncement);
  25079. $core.addMethod(
  25080. $core.method({
  25081. selector: "theClass",
  25082. protocol: "accessing",
  25083. fn: function (){
  25084. var self=this,$self=this;
  25085. return $self["@theClass"];
  25086. },
  25087. args: [],
  25088. source: "theClass\x0a\x09^ theClass",
  25089. referencedClasses: [],
  25090. messageSends: []
  25091. }),
  25092. $globals.ProtocolAnnouncement);
  25093. $core.addMethod(
  25094. $core.method({
  25095. selector: "theClass:",
  25096. protocol: "accessing",
  25097. fn: function (aClass){
  25098. var self=this,$self=this;
  25099. $self["@theClass"]=aClass;
  25100. return self;
  25101. },
  25102. args: ["aClass"],
  25103. source: "theClass: aClass\x0a\x09theClass := aClass",
  25104. referencedClasses: [],
  25105. messageSends: []
  25106. }),
  25107. $globals.ProtocolAnnouncement);
  25108. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25109. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25110. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25111. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25112. });
  25113. 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";
  25114. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25115. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25116. $core.addPackage("Platform-Services");
  25117. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  25118. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25119. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25120. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25121. $core.addMethod(
  25122. $core.method({
  25123. selector: "handleError:",
  25124. protocol: "error handling",
  25125. fn: function (anError){
  25126. var self=this,$self=this;
  25127. return $core.withContext(function($ctx1) {
  25128. var $1,$receiver;
  25129. $1=$recv(anError)._context();
  25130. $ctx1.sendIdx["context"]=1;
  25131. if(($receiver = $1) == null || $receiver.a$nil){
  25132. $1;
  25133. } else {
  25134. $self._logErrorContext_($recv(anError)._context());
  25135. }
  25136. $self._logError_(anError);
  25137. return self;
  25138. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25139. },
  25140. args: ["anError"],
  25141. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25142. referencedClasses: [],
  25143. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25144. }),
  25145. $globals.ConsoleErrorHandler);
  25146. $core.addMethod(
  25147. $core.method({
  25148. selector: "log:",
  25149. protocol: "private",
  25150. fn: function (aString){
  25151. var self=this,$self=this;
  25152. return $core.withContext(function($ctx1) {
  25153. $recv(console)._log_(aString);
  25154. return self;
  25155. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25156. },
  25157. args: ["aString"],
  25158. source: "log: aString\x0a\x09console log: aString",
  25159. referencedClasses: [],
  25160. messageSends: ["log:"]
  25161. }),
  25162. $globals.ConsoleErrorHandler);
  25163. $core.addMethod(
  25164. $core.method({
  25165. selector: "logContext:",
  25166. protocol: "private",
  25167. fn: function (aContext){
  25168. var self=this,$self=this;
  25169. return $core.withContext(function($ctx1) {
  25170. var $1,$receiver;
  25171. $1=$recv(aContext)._home();
  25172. $ctx1.sendIdx["home"]=1;
  25173. if(($receiver = $1) == null || $receiver.a$nil){
  25174. $1;
  25175. } else {
  25176. $self._logContext_($recv(aContext)._home());
  25177. }
  25178. $self._log_($recv(aContext)._asString());
  25179. return self;
  25180. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25181. },
  25182. args: ["aContext"],
  25183. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25184. referencedClasses: [],
  25185. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25186. }),
  25187. $globals.ConsoleErrorHandler);
  25188. $core.addMethod(
  25189. $core.method({
  25190. selector: "logError:",
  25191. protocol: "private",
  25192. fn: function (anError){
  25193. var self=this,$self=this;
  25194. return $core.withContext(function($ctx1) {
  25195. $self._log_($recv(anError)._messageText());
  25196. return self;
  25197. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25198. },
  25199. args: ["anError"],
  25200. source: "logError: anError\x0a\x09self log: anError messageText",
  25201. referencedClasses: [],
  25202. messageSends: ["log:", "messageText"]
  25203. }),
  25204. $globals.ConsoleErrorHandler);
  25205. $core.addMethod(
  25206. $core.method({
  25207. selector: "logErrorContext:",
  25208. protocol: "private",
  25209. fn: function (aContext){
  25210. var self=this,$self=this;
  25211. return $core.withContext(function($ctx1) {
  25212. var $1,$receiver;
  25213. if(($receiver = aContext) == null || $receiver.a$nil){
  25214. aContext;
  25215. } else {
  25216. $1=$recv(aContext)._home();
  25217. $ctx1.sendIdx["home"]=1;
  25218. if(($receiver = $1) == null || $receiver.a$nil){
  25219. $1;
  25220. } else {
  25221. $self._logContext_($recv(aContext)._home());
  25222. }
  25223. }
  25224. return self;
  25225. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25226. },
  25227. args: ["aContext"],
  25228. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25229. referencedClasses: [],
  25230. messageSends: ["ifNotNil:", "home", "logContext:"]
  25231. }),
  25232. $globals.ConsoleErrorHandler);
  25233. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25234. $core.addMethod(
  25235. $core.method({
  25236. selector: "initialize",
  25237. protocol: "initialization",
  25238. fn: function (){
  25239. var self=this,$self=this;
  25240. return $core.withContext(function($ctx1) {
  25241. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25242. return self;
  25243. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25244. },
  25245. args: [],
  25246. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25247. referencedClasses: ["ErrorHandler"],
  25248. messageSends: ["registerIfNone:", "new"]
  25249. }),
  25250. $globals.ConsoleErrorHandler.a$cls);
  25251. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25252. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25253. $core.addMethod(
  25254. $core.method({
  25255. selector: "clear",
  25256. protocol: "printing",
  25257. fn: function (){
  25258. var self=this,$self=this;
  25259. return self;
  25260. },
  25261. args: [],
  25262. source: "clear\x0a\x09\x22no op\x22",
  25263. referencedClasses: [],
  25264. messageSends: []
  25265. }),
  25266. $globals.ConsoleTranscript);
  25267. $core.addMethod(
  25268. $core.method({
  25269. selector: "cr",
  25270. protocol: "printing",
  25271. fn: function (){
  25272. var self=this,$self=this;
  25273. return self;
  25274. },
  25275. args: [],
  25276. source: "cr\x0a\x09\x22no op\x22",
  25277. referencedClasses: [],
  25278. messageSends: []
  25279. }),
  25280. $globals.ConsoleTranscript);
  25281. $core.addMethod(
  25282. $core.method({
  25283. selector: "open",
  25284. protocol: "actions",
  25285. fn: function (){
  25286. var self=this,$self=this;
  25287. return self;
  25288. },
  25289. args: [],
  25290. source: "open",
  25291. referencedClasses: [],
  25292. messageSends: []
  25293. }),
  25294. $globals.ConsoleTranscript);
  25295. $core.addMethod(
  25296. $core.method({
  25297. selector: "show:",
  25298. protocol: "printing",
  25299. fn: function (anObject){
  25300. var self=this,$self=this;
  25301. return $core.withContext(function($ctx1) {
  25302. console.log(String($recv(anObject)._asString()));
  25303. return self;
  25304. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25305. },
  25306. args: ["anObject"],
  25307. 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()))'>",
  25308. referencedClasses: [],
  25309. messageSends: []
  25310. }),
  25311. $globals.ConsoleTranscript);
  25312. $core.addMethod(
  25313. $core.method({
  25314. selector: "initialize",
  25315. protocol: "initialization",
  25316. fn: function (){
  25317. var self=this,$self=this;
  25318. return $core.withContext(function($ctx1) {
  25319. $recv($globals.Transcript)._registerIfNone_($self._new());
  25320. return self;
  25321. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25322. },
  25323. args: [],
  25324. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25325. referencedClasses: ["Transcript"],
  25326. messageSends: ["registerIfNone:", "new"]
  25327. }),
  25328. $globals.ConsoleTranscript.a$cls);
  25329. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25330. $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.";
  25331. $core.addMethod(
  25332. $core.method({
  25333. selector: "addInstVarNamed:to:",
  25334. protocol: "compiling",
  25335. fn: function (aString,aClass){
  25336. var self=this,$self=this;
  25337. var newInstVars;
  25338. return $core.withContext(function($ctx1) {
  25339. var $1,$2,$3,$4,$5;
  25340. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25341. $1=$recv(aClass)._isMetaclass();
  25342. if($core.assert($1)){
  25343. $2=$self._classBuilder();
  25344. $ctx1.sendIdx["classBuilder"]=1;
  25345. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25346. } else {
  25347. $3=$self._classBuilder();
  25348. $4=$recv(aClass)._superclass();
  25349. $5=$recv(aClass)._name();
  25350. $ctx1.sendIdx["name"]=1;
  25351. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25352. }
  25353. return self;
  25354. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25355. },
  25356. args: ["aString", "aClass"],
  25357. 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 ]",
  25358. referencedClasses: [],
  25359. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25360. }),
  25361. $globals.Environment);
  25362. $core.addMethod(
  25363. $core.method({
  25364. selector: "allSelectors",
  25365. protocol: "accessing",
  25366. fn: function (){
  25367. var self=this,$self=this;
  25368. return $core.withContext(function($ctx1) {
  25369. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25370. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25371. },
  25372. args: [],
  25373. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25374. referencedClasses: ["Smalltalk"],
  25375. messageSends: ["allSelectors", "core"]
  25376. }),
  25377. $globals.Environment);
  25378. $core.addMethod(
  25379. $core.method({
  25380. selector: "availableClassNames",
  25381. protocol: "accessing",
  25382. fn: function (){
  25383. var self=this,$self=this;
  25384. return $core.withContext(function($ctx1) {
  25385. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25386. return $core.withContext(function($ctx2) {
  25387. return $recv(each)._name();
  25388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25389. }));
  25390. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25391. },
  25392. args: [],
  25393. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25394. referencedClasses: ["Smalltalk"],
  25395. messageSends: ["collect:", "classes", "name"]
  25396. }),
  25397. $globals.Environment);
  25398. $core.addMethod(
  25399. $core.method({
  25400. selector: "availablePackageNames",
  25401. protocol: "accessing",
  25402. fn: function (){
  25403. var self=this,$self=this;
  25404. return $core.withContext(function($ctx1) {
  25405. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25406. return $core.withContext(function($ctx2) {
  25407. return $recv(each)._name();
  25408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25409. }));
  25410. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25411. },
  25412. args: [],
  25413. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25414. referencedClasses: ["Smalltalk"],
  25415. messageSends: ["collect:", "packages", "name"]
  25416. }),
  25417. $globals.Environment);
  25418. $core.addMethod(
  25419. $core.method({
  25420. selector: "availableProtocolsFor:",
  25421. protocol: "accessing",
  25422. fn: function (aClass){
  25423. var self=this,$self=this;
  25424. var protocols;
  25425. return $core.withContext(function($ctx1) {
  25426. var $1,$receiver;
  25427. protocols=$recv(aClass)._protocols();
  25428. $1=$recv(aClass)._superclass();
  25429. $ctx1.sendIdx["superclass"]=1;
  25430. if(($receiver = $1) == null || $receiver.a$nil){
  25431. $1;
  25432. } else {
  25433. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25434. }
  25435. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25436. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25437. },
  25438. args: ["aClass"],
  25439. 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",
  25440. referencedClasses: [],
  25441. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25442. }),
  25443. $globals.Environment);
  25444. $core.addMethod(
  25445. $core.method({
  25446. selector: "classBuilder",
  25447. protocol: "accessing",
  25448. fn: function (){
  25449. var self=this,$self=this;
  25450. return $core.withContext(function($ctx1) {
  25451. return $recv($globals.ClassBuilder)._new();
  25452. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25453. },
  25454. args: [],
  25455. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25456. referencedClasses: ["ClassBuilder"],
  25457. messageSends: ["new"]
  25458. }),
  25459. $globals.Environment);
  25460. $core.addMethod(
  25461. $core.method({
  25462. selector: "classNamed:",
  25463. protocol: "accessing",
  25464. fn: function (aString){
  25465. var self=this,$self=this;
  25466. return $core.withContext(function($ctx1) {
  25467. var $1,$receiver;
  25468. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25469. if(($receiver = $1) == null || $receiver.a$nil){
  25470. return $self._error_("Invalid class name");
  25471. } else {
  25472. return $1;
  25473. }
  25474. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25475. },
  25476. args: ["aString"],
  25477. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25478. referencedClasses: ["Smalltalk"],
  25479. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25480. }),
  25481. $globals.Environment);
  25482. $core.addMethod(
  25483. $core.method({
  25484. selector: "classes",
  25485. protocol: "accessing",
  25486. fn: function (){
  25487. var self=this,$self=this;
  25488. return $core.withContext(function($ctx1) {
  25489. return $recv($globals.Smalltalk)._classes();
  25490. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25491. },
  25492. args: [],
  25493. source: "classes\x0a\x09^ Smalltalk classes",
  25494. referencedClasses: ["Smalltalk"],
  25495. messageSends: ["classes"]
  25496. }),
  25497. $globals.Environment);
  25498. $core.addMethod(
  25499. $core.method({
  25500. selector: "commitPackage:onSuccess:onError:",
  25501. protocol: "actions",
  25502. fn: function (aPackage,aBlock,anotherBlock){
  25503. var self=this,$self=this;
  25504. return $core.withContext(function($ctx1) {
  25505. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25506. return self;
  25507. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25508. },
  25509. args: ["aPackage", "aBlock", "anotherBlock"],
  25510. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25511. referencedClasses: [],
  25512. messageSends: ["commitOnSuccess:onError:", "transport"]
  25513. }),
  25514. $globals.Environment);
  25515. $core.addMethod(
  25516. $core.method({
  25517. selector: "compileClassComment:for:",
  25518. protocol: "compiling",
  25519. fn: function (aString,aClass){
  25520. var self=this,$self=this;
  25521. return $core.withContext(function($ctx1) {
  25522. $recv(aClass)._comment_(aString);
  25523. return self;
  25524. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25525. },
  25526. args: ["aString", "aClass"],
  25527. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25528. referencedClasses: [],
  25529. messageSends: ["comment:"]
  25530. }),
  25531. $globals.Environment);
  25532. $core.addMethod(
  25533. $core.method({
  25534. selector: "compileClassDefinition:",
  25535. protocol: "compiling",
  25536. fn: function (aString){
  25537. var self=this,$self=this;
  25538. return $core.withContext(function($ctx1) {
  25539. $recv((function(){
  25540. return $core.withContext(function($ctx2) {
  25541. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25543. }))._on_do_($globals.Error,(function(error){
  25544. return $core.withContext(function($ctx2) {
  25545. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25546. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25547. }));
  25548. return self;
  25549. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25550. },
  25551. args: ["aString"],
  25552. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25553. referencedClasses: ["DoIt", "Error", "Terminal"],
  25554. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25555. }),
  25556. $globals.Environment);
  25557. $core.addMethod(
  25558. $core.method({
  25559. selector: "compileMethod:for:protocol:",
  25560. protocol: "compiling",
  25561. fn: function (sourceCode,class_,protocol){
  25562. var self=this,$self=this;
  25563. return $core.withContext(function($ctx1) {
  25564. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25565. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25566. },
  25567. args: ["sourceCode", "class", "protocol"],
  25568. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25569. referencedClasses: [],
  25570. messageSends: ["compile:protocol:"]
  25571. }),
  25572. $globals.Environment);
  25573. $core.addMethod(
  25574. $core.method({
  25575. selector: "copyClass:to:",
  25576. protocol: "actions",
  25577. fn: function (aClass,aClassName){
  25578. var self=this,$self=this;
  25579. return $core.withContext(function($ctx1) {
  25580. var $1,$2,$receiver;
  25581. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25582. if(($receiver = $1) == null || $receiver.a$nil){
  25583. $1;
  25584. } else {
  25585. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25586. $ctx1.sendIdx[","]=1;
  25587. $self._error_($2);
  25588. }
  25589. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25590. return self;
  25591. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25592. },
  25593. args: ["aClass", "aClassName"],
  25594. 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",
  25595. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25596. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25597. }),
  25598. $globals.Environment);
  25599. $core.addMethod(
  25600. $core.method({
  25601. selector: "doItReceiver",
  25602. protocol: "accessing",
  25603. fn: function (){
  25604. var self=this,$self=this;
  25605. return $core.withContext(function($ctx1) {
  25606. return $recv($globals.DoIt)._new();
  25607. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25608. },
  25609. args: [],
  25610. source: "doItReceiver\x0a\x09^ DoIt new",
  25611. referencedClasses: ["DoIt"],
  25612. messageSends: ["new"]
  25613. }),
  25614. $globals.Environment);
  25615. $core.addMethod(
  25616. $core.method({
  25617. selector: "evaluate:for:",
  25618. protocol: "evaluating",
  25619. fn: function (aString,anObject){
  25620. var self=this,$self=this;
  25621. return $core.withContext(function($ctx1) {
  25622. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25623. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25624. },
  25625. args: ["aString", "anObject"],
  25626. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25627. referencedClasses: ["Evaluator"],
  25628. messageSends: ["evaluate:for:"]
  25629. }),
  25630. $globals.Environment);
  25631. $core.addMethod(
  25632. $core.method({
  25633. selector: "evaluate:on:do:",
  25634. protocol: "error handling",
  25635. fn: function (aBlock,anErrorClass,exceptionBlock){
  25636. var self=this,$self=this;
  25637. return $core.withContext(function($ctx1) {
  25638. var $1;
  25639. $recv(aBlock)._tryCatch_((function(exception){
  25640. return $core.withContext(function($ctx2) {
  25641. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25642. if($core.assert($1)){
  25643. return $recv(exceptionBlock)._value_(exception);
  25644. } else {
  25645. return $recv(exception)._resignal();
  25646. }
  25647. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25648. }));
  25649. return self;
  25650. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25651. },
  25652. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25653. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  25654. referencedClasses: [],
  25655. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  25656. }),
  25657. $globals.Environment);
  25658. $core.addMethod(
  25659. $core.method({
  25660. selector: "inspect:",
  25661. protocol: "actions",
  25662. fn: function (anObject){
  25663. var self=this,$self=this;
  25664. return $core.withContext(function($ctx1) {
  25665. $recv($globals.Inspector)._inspect_(anObject);
  25666. return self;
  25667. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25668. },
  25669. args: ["anObject"],
  25670. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25671. referencedClasses: ["Inspector"],
  25672. messageSends: ["inspect:"]
  25673. }),
  25674. $globals.Environment);
  25675. $core.addMethod(
  25676. $core.method({
  25677. selector: "moveClass:toPackage:",
  25678. protocol: "actions",
  25679. fn: function (aClass,aPackageName){
  25680. var self=this,$self=this;
  25681. var package_;
  25682. return $core.withContext(function($ctx1) {
  25683. var $1,$2,$receiver;
  25684. package_=$recv($globals.Package)._named_(aPackageName);
  25685. $1=package_;
  25686. if(($receiver = $1) == null || $receiver.a$nil){
  25687. $self._error_("Invalid package name");
  25688. } else {
  25689. $1;
  25690. }
  25691. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25692. if($core.assert($2)){
  25693. return self;
  25694. }
  25695. $recv(aClass)._package_(package_);
  25696. $recv(aClass)._recompile();
  25697. return self;
  25698. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25699. },
  25700. args: ["aClass", "aPackageName"],
  25701. 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",
  25702. referencedClasses: ["Package"],
  25703. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25704. }),
  25705. $globals.Environment);
  25706. $core.addMethod(
  25707. $core.method({
  25708. selector: "moveMethod:toClass:",
  25709. protocol: "actions",
  25710. fn: function (aMethod,aClassName){
  25711. var self=this,$self=this;
  25712. var destinationClass;
  25713. return $core.withContext(function($ctx1) {
  25714. var $2,$3,$1,$5,$4;
  25715. destinationClass=$self._classNamed_(aClassName);
  25716. $2=destinationClass;
  25717. $3=$recv(aMethod)._methodClass();
  25718. $ctx1.sendIdx["methodClass"]=1;
  25719. $1=$recv($2).__eq_eq($3);
  25720. if($core.assert($1)){
  25721. return self;
  25722. }
  25723. $5=$recv(aMethod)._methodClass();
  25724. $ctx1.sendIdx["methodClass"]=2;
  25725. $4=$recv($5)._isMetaclass();
  25726. if($core.assert($4)){
  25727. destinationClass=$recv(destinationClass)._theMetaClass();
  25728. destinationClass;
  25729. }
  25730. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25731. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25732. return self;
  25733. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25734. },
  25735. args: ["aMethod", "aClassName"],
  25736. 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",
  25737. referencedClasses: [],
  25738. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25739. }),
  25740. $globals.Environment);
  25741. $core.addMethod(
  25742. $core.method({
  25743. selector: "moveMethod:toProtocol:",
  25744. protocol: "actions",
  25745. fn: function (aMethod,aProtocol){
  25746. var self=this,$self=this;
  25747. return $core.withContext(function($ctx1) {
  25748. $recv(aMethod)._protocol_(aProtocol);
  25749. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25750. return self;
  25751. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25752. },
  25753. args: ["aMethod", "aProtocol"],
  25754. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25755. referencedClasses: [],
  25756. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25757. }),
  25758. $globals.Environment);
  25759. $core.addMethod(
  25760. $core.method({
  25761. selector: "packages",
  25762. protocol: "accessing",
  25763. fn: function (){
  25764. var self=this,$self=this;
  25765. return $core.withContext(function($ctx1) {
  25766. return $recv($globals.Smalltalk)._packages();
  25767. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25768. },
  25769. args: [],
  25770. source: "packages\x0a\x09^ Smalltalk packages",
  25771. referencedClasses: ["Smalltalk"],
  25772. messageSends: ["packages"]
  25773. }),
  25774. $globals.Environment);
  25775. $core.addMethod(
  25776. $core.method({
  25777. selector: "registerErrorHandler:",
  25778. protocol: "services",
  25779. fn: function (anErrorHandler){
  25780. var self=this,$self=this;
  25781. return $core.withContext(function($ctx1) {
  25782. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25783. return self;
  25784. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25785. },
  25786. args: ["anErrorHandler"],
  25787. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25788. referencedClasses: ["ErrorHandler"],
  25789. messageSends: ["register:"]
  25790. }),
  25791. $globals.Environment);
  25792. $core.addMethod(
  25793. $core.method({
  25794. selector: "registerFinder:",
  25795. protocol: "services",
  25796. fn: function (aFinder){
  25797. var self=this,$self=this;
  25798. return $core.withContext(function($ctx1) {
  25799. $recv($globals.Finder)._register_(aFinder);
  25800. return self;
  25801. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25802. },
  25803. args: ["aFinder"],
  25804. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25805. referencedClasses: ["Finder"],
  25806. messageSends: ["register:"]
  25807. }),
  25808. $globals.Environment);
  25809. $core.addMethod(
  25810. $core.method({
  25811. selector: "registerInspector:",
  25812. protocol: "services",
  25813. fn: function (anInspector){
  25814. var self=this,$self=this;
  25815. return $core.withContext(function($ctx1) {
  25816. $recv($globals.Inspector)._register_(anInspector);
  25817. return self;
  25818. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25819. },
  25820. args: ["anInspector"],
  25821. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25822. referencedClasses: ["Inspector"],
  25823. messageSends: ["register:"]
  25824. }),
  25825. $globals.Environment);
  25826. $core.addMethod(
  25827. $core.method({
  25828. selector: "registerProgressHandler:",
  25829. protocol: "services",
  25830. fn: function (aProgressHandler){
  25831. var self=this,$self=this;
  25832. return $core.withContext(function($ctx1) {
  25833. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25834. return self;
  25835. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25836. },
  25837. args: ["aProgressHandler"],
  25838. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25839. referencedClasses: ["ProgressHandler"],
  25840. messageSends: ["register:"]
  25841. }),
  25842. $globals.Environment);
  25843. $core.addMethod(
  25844. $core.method({
  25845. selector: "registerTranscript:",
  25846. protocol: "services",
  25847. fn: function (aTranscript){
  25848. var self=this,$self=this;
  25849. return $core.withContext(function($ctx1) {
  25850. $recv($globals.Transcript)._register_(aTranscript);
  25851. return self;
  25852. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25853. },
  25854. args: ["aTranscript"],
  25855. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25856. referencedClasses: ["Transcript"],
  25857. messageSends: ["register:"]
  25858. }),
  25859. $globals.Environment);
  25860. $core.addMethod(
  25861. $core.method({
  25862. selector: "removeClass:",
  25863. protocol: "actions",
  25864. fn: function (aClass){
  25865. var self=this,$self=this;
  25866. return $core.withContext(function($ctx1) {
  25867. $recv($globals.Smalltalk)._removeClass_(aClass);
  25868. return self;
  25869. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25870. },
  25871. args: ["aClass"],
  25872. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25873. referencedClasses: ["Smalltalk"],
  25874. messageSends: ["removeClass:"]
  25875. }),
  25876. $globals.Environment);
  25877. $core.addMethod(
  25878. $core.method({
  25879. selector: "removeMethod:",
  25880. protocol: "actions",
  25881. fn: function (aMethod){
  25882. var self=this,$self=this;
  25883. return $core.withContext(function($ctx1) {
  25884. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25885. return self;
  25886. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25887. },
  25888. args: ["aMethod"],
  25889. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25890. referencedClasses: [],
  25891. messageSends: ["removeCompiledMethod:", "methodClass"]
  25892. }),
  25893. $globals.Environment);
  25894. $core.addMethod(
  25895. $core.method({
  25896. selector: "removeProtocol:from:",
  25897. protocol: "actions",
  25898. fn: function (aString,aClass){
  25899. var self=this,$self=this;
  25900. return $core.withContext(function($ctx1) {
  25901. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25902. return $core.withContext(function($ctx2) {
  25903. return $recv(aClass)._removeCompiledMethod_(each);
  25904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25905. }));
  25906. return self;
  25907. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25908. },
  25909. args: ["aString", "aClass"],
  25910. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25911. referencedClasses: [],
  25912. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25913. }),
  25914. $globals.Environment);
  25915. $core.addMethod(
  25916. $core.method({
  25917. selector: "renameClass:to:",
  25918. protocol: "actions",
  25919. fn: function (aClass,aClassName){
  25920. var self=this,$self=this;
  25921. return $core.withContext(function($ctx1) {
  25922. var $1,$2,$receiver;
  25923. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25924. if(($receiver = $1) == null || $receiver.a$nil){
  25925. $1;
  25926. } else {
  25927. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25928. $ctx1.sendIdx[","]=1;
  25929. $self._error_($2);
  25930. }
  25931. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25932. return self;
  25933. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25934. },
  25935. args: ["aClass", "aClassName"],
  25936. 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",
  25937. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25938. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25939. }),
  25940. $globals.Environment);
  25941. $core.addMethod(
  25942. $core.method({
  25943. selector: "renamePackage:to:",
  25944. protocol: "actions",
  25945. fn: function (aPackageName,aNewPackageName){
  25946. var self=this,$self=this;
  25947. return $core.withContext(function($ctx1) {
  25948. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25949. return self;
  25950. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25951. },
  25952. args: ["aPackageName", "aNewPackageName"],
  25953. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25954. referencedClasses: ["Smalltalk"],
  25955. messageSends: ["renamePackage:to:"]
  25956. }),
  25957. $globals.Environment);
  25958. $core.addMethod(
  25959. $core.method({
  25960. selector: "renameProtocol:to:in:",
  25961. protocol: "actions",
  25962. fn: function (aString,anotherString,aClass){
  25963. var self=this,$self=this;
  25964. return $core.withContext(function($ctx1) {
  25965. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25966. return $core.withContext(function($ctx2) {
  25967. return $recv(each)._protocol_(anotherString);
  25968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25969. }));
  25970. return self;
  25971. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25972. },
  25973. args: ["aString", "anotherString", "aClass"],
  25974. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25975. referencedClasses: [],
  25976. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25977. }),
  25978. $globals.Environment);
  25979. $core.addMethod(
  25980. $core.method({
  25981. selector: "setClassCommentOf:to:",
  25982. protocol: "actions",
  25983. fn: function (aClass,aString){
  25984. var self=this,$self=this;
  25985. return $core.withContext(function($ctx1) {
  25986. $recv(aClass)._comment_(aString);
  25987. return self;
  25988. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25989. },
  25990. args: ["aClass", "aString"],
  25991. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25992. referencedClasses: [],
  25993. messageSends: ["comment:"]
  25994. }),
  25995. $globals.Environment);
  25996. $core.addMethod(
  25997. $core.method({
  25998. selector: "systemAnnouncer",
  25999. protocol: "accessing",
  26000. fn: function (){
  26001. var self=this,$self=this;
  26002. return $core.withContext(function($ctx1) {
  26003. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  26004. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  26005. },
  26006. args: [],
  26007. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  26008. referencedClasses: ["Smalltalk"],
  26009. messageSends: ["current", "at:", "globals"]
  26010. }),
  26011. $globals.Environment);
  26012. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  26013. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  26014. $core.addMethod(
  26015. $core.method({
  26016. selector: "do:on:displaying:",
  26017. protocol: "progress handling",
  26018. fn: function (aBlock,aCollection,aString){
  26019. var self=this,$self=this;
  26020. return $core.withContext(function($ctx1) {
  26021. $recv(aCollection)._do_(aBlock);
  26022. return self;
  26023. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  26024. },
  26025. args: ["aBlock", "aCollection", "aString"],
  26026. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  26027. referencedClasses: [],
  26028. messageSends: ["do:"]
  26029. }),
  26030. $globals.NullProgressHandler);
  26031. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  26032. $core.addMethod(
  26033. $core.method({
  26034. selector: "initialize",
  26035. protocol: "initialization",
  26036. fn: function (){
  26037. var self=this,$self=this;
  26038. return $core.withContext(function($ctx1) {
  26039. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26040. return self;
  26041. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  26042. },
  26043. args: [],
  26044. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26045. referencedClasses: ["ProgressHandler"],
  26046. messageSends: ["registerIfNone:", "new"]
  26047. }),
  26048. $globals.NullProgressHandler.a$cls);
  26049. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26050. $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.";
  26051. $globals.Service.a$cls.iVarNames = ["current"];
  26052. $core.addMethod(
  26053. $core.method({
  26054. selector: "current",
  26055. protocol: "accessing",
  26056. fn: function (){
  26057. var self=this,$self=this;
  26058. return $self["@current"];
  26059. },
  26060. args: [],
  26061. source: "current\x0a\x09^ current",
  26062. referencedClasses: [],
  26063. messageSends: []
  26064. }),
  26065. $globals.Service.a$cls);
  26066. $core.addMethod(
  26067. $core.method({
  26068. selector: "new",
  26069. protocol: "instance creation",
  26070. fn: function (){
  26071. var self=this,$self=this;
  26072. return $core.withContext(function($ctx1) {
  26073. $self._shouldNotImplement();
  26074. return self;
  26075. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26076. },
  26077. args: [],
  26078. source: "new\x0a\x09self shouldNotImplement",
  26079. referencedClasses: [],
  26080. messageSends: ["shouldNotImplement"]
  26081. }),
  26082. $globals.Service.a$cls);
  26083. $core.addMethod(
  26084. $core.method({
  26085. selector: "register:",
  26086. protocol: "registration",
  26087. fn: function (anObject){
  26088. var self=this,$self=this;
  26089. $self["@current"]=anObject;
  26090. return self;
  26091. },
  26092. args: ["anObject"],
  26093. source: "register: anObject\x0a\x09current := anObject",
  26094. referencedClasses: [],
  26095. messageSends: []
  26096. }),
  26097. $globals.Service.a$cls);
  26098. $core.addMethod(
  26099. $core.method({
  26100. selector: "registerIfNone:",
  26101. protocol: "registration",
  26102. fn: function (anObject){
  26103. var self=this,$self=this;
  26104. return $core.withContext(function($ctx1) {
  26105. var $1,$receiver;
  26106. $1=$self._current();
  26107. if(($receiver = $1) == null || $receiver.a$nil){
  26108. $self._register_(anObject);
  26109. } else {
  26110. $1;
  26111. }
  26112. return self;
  26113. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26114. },
  26115. args: ["anObject"],
  26116. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26117. referencedClasses: [],
  26118. messageSends: ["ifNil:", "current", "register:"]
  26119. }),
  26120. $globals.Service.a$cls);
  26121. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26122. $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.";
  26123. $core.addMethod(
  26124. $core.method({
  26125. selector: "handleError:",
  26126. protocol: "error handling",
  26127. fn: function (anError){
  26128. var self=this,$self=this;
  26129. return $core.withContext(function($ctx1) {
  26130. var $1;
  26131. $1=$recv((function(){
  26132. return $core.withContext(function($ctx2) {
  26133. return $recv(anError)._isSmalltalkError();
  26134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26135. }))._tryCatch_((function(){
  26136. return false;
  26137. }));
  26138. if($core.assert($1)){
  26139. $self._handleUnhandledError_(anError);
  26140. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26141. } else {
  26142. var smalltalkError;
  26143. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26144. smalltalkError;
  26145. $recv(smalltalkError)._wrap();
  26146. $self._handleUnhandledError_(smalltalkError);
  26147. }
  26148. return self;
  26149. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26150. },
  26151. args: ["anError"],
  26152. 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 ]",
  26153. referencedClasses: ["JavaScriptException"],
  26154. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26155. }),
  26156. $globals.ErrorHandler.a$cls);
  26157. $core.addMethod(
  26158. $core.method({
  26159. selector: "handleUnhandledError:",
  26160. protocol: "error handling",
  26161. fn: function (anError){
  26162. var self=this,$self=this;
  26163. return $core.withContext(function($ctx1) {
  26164. var $1;
  26165. $1=$recv(anError)._wasHandled();
  26166. if(!$core.assert($1)){
  26167. $recv($self._current())._handleError_(anError);
  26168. $recv(anError)._beHandled();
  26169. }
  26170. return self;
  26171. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26172. },
  26173. args: ["anError"],
  26174. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26175. referencedClasses: [],
  26176. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26177. }),
  26178. $globals.ErrorHandler.a$cls);
  26179. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26180. $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.";
  26181. $core.addMethod(
  26182. $core.method({
  26183. selector: "findClass:",
  26184. protocol: "finding",
  26185. fn: function (aClass){
  26186. var self=this,$self=this;
  26187. return $core.withContext(function($ctx1) {
  26188. return $recv($self._current())._findClass_(aClass);
  26189. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26190. },
  26191. args: ["aClass"],
  26192. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26193. referencedClasses: [],
  26194. messageSends: ["findClass:", "current"]
  26195. }),
  26196. $globals.Finder.a$cls);
  26197. $core.addMethod(
  26198. $core.method({
  26199. selector: "findMethod:",
  26200. protocol: "finding",
  26201. fn: function (aCompiledMethod){
  26202. var self=this,$self=this;
  26203. return $core.withContext(function($ctx1) {
  26204. return $recv($self._current())._findMethod_(aCompiledMethod);
  26205. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26206. },
  26207. args: ["aCompiledMethod"],
  26208. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26209. referencedClasses: [],
  26210. messageSends: ["findMethod:", "current"]
  26211. }),
  26212. $globals.Finder.a$cls);
  26213. $core.addMethod(
  26214. $core.method({
  26215. selector: "findString:",
  26216. protocol: "finding",
  26217. fn: function (aString){
  26218. var self=this,$self=this;
  26219. return $core.withContext(function($ctx1) {
  26220. return $recv($self._current())._findString_(aString);
  26221. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26222. },
  26223. args: ["aString"],
  26224. source: "findString: aString\x0a\x09^ self current findString: aString",
  26225. referencedClasses: [],
  26226. messageSends: ["findString:", "current"]
  26227. }),
  26228. $globals.Finder.a$cls);
  26229. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26230. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26231. $core.addMethod(
  26232. $core.method({
  26233. selector: "inspect:",
  26234. protocol: "inspecting",
  26235. fn: function (anObject){
  26236. var self=this,$self=this;
  26237. return $core.withContext(function($ctx1) {
  26238. return $recv($self._current())._inspect_(anObject);
  26239. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26240. },
  26241. args: ["anObject"],
  26242. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26243. referencedClasses: [],
  26244. messageSends: ["inspect:", "current"]
  26245. }),
  26246. $globals.Inspector.a$cls);
  26247. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26248. $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";
  26249. $core.addMethod(
  26250. $core.method({
  26251. selector: "globals",
  26252. protocol: "accessing",
  26253. fn: function (){
  26254. var self=this,$self=this;
  26255. return $core.withContext(function($ctx1) {
  26256. return $recv($self._current())._globals();
  26257. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26258. },
  26259. args: [],
  26260. source: "globals\x0a\x09^ self current globals",
  26261. referencedClasses: [],
  26262. messageSends: ["globals", "current"]
  26263. }),
  26264. $globals.Platform.a$cls);
  26265. $core.addMethod(
  26266. $core.method({
  26267. selector: "includesGlobal:",
  26268. protocol: "testing",
  26269. fn: function (aString){
  26270. var self=this,$self=this;
  26271. return $core.withContext(function($ctx1) {
  26272. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26273. return true;
  26274. }),(function(){
  26275. return false;
  26276. }));
  26277. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26278. },
  26279. args: ["aString"],
  26280. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26281. referencedClasses: [],
  26282. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26283. }),
  26284. $globals.Platform.a$cls);
  26285. $core.addMethod(
  26286. $core.method({
  26287. selector: "newXhr",
  26288. protocol: "accessing",
  26289. fn: function (){
  26290. var self=this,$self=this;
  26291. return $core.withContext(function($ctx1) {
  26292. return $recv($self._current())._newXhr();
  26293. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26294. },
  26295. args: [],
  26296. source: "newXhr\x0a\x09^ self current newXhr",
  26297. referencedClasses: [],
  26298. messageSends: ["newXhr", "current"]
  26299. }),
  26300. $globals.Platform.a$cls);
  26301. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26302. $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`.";
  26303. $core.addMethod(
  26304. $core.method({
  26305. selector: "do:on:displaying:",
  26306. protocol: "progress handling",
  26307. fn: function (aBlock,aCollection,aString){
  26308. var self=this,$self=this;
  26309. return $core.withContext(function($ctx1) {
  26310. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26311. return self;
  26312. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26313. },
  26314. args: ["aBlock", "aCollection", "aString"],
  26315. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26316. referencedClasses: [],
  26317. messageSends: ["do:on:displaying:", "current"]
  26318. }),
  26319. $globals.ProgressHandler.a$cls);
  26320. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26321. $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:'.";
  26322. $core.addMethod(
  26323. $core.method({
  26324. selector: "alert:",
  26325. protocol: "dialogs",
  26326. fn: function (aString){
  26327. var self=this,$self=this;
  26328. return $core.withContext(function($ctx1) {
  26329. return $recv($self._current())._alert_(aString);
  26330. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26331. },
  26332. args: ["aString"],
  26333. source: "alert: aString\x0a\x09^ self current alert: aString",
  26334. referencedClasses: [],
  26335. messageSends: ["alert:", "current"]
  26336. }),
  26337. $globals.Terminal.a$cls);
  26338. $core.addMethod(
  26339. $core.method({
  26340. selector: "confirm:",
  26341. protocol: "dialogs",
  26342. fn: function (aString){
  26343. var self=this,$self=this;
  26344. return $core.withContext(function($ctx1) {
  26345. return $recv($self._current())._confirm_(aString);
  26346. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26347. },
  26348. args: ["aString"],
  26349. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26350. referencedClasses: [],
  26351. messageSends: ["confirm:", "current"]
  26352. }),
  26353. $globals.Terminal.a$cls);
  26354. $core.addMethod(
  26355. $core.method({
  26356. selector: "prompt:",
  26357. protocol: "dialogs",
  26358. fn: function (aString){
  26359. var self=this,$self=this;
  26360. return $core.withContext(function($ctx1) {
  26361. return $recv($self._current())._prompt_(aString);
  26362. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26363. },
  26364. args: ["aString"],
  26365. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26366. referencedClasses: [],
  26367. messageSends: ["prompt:", "current"]
  26368. }),
  26369. $globals.Terminal.a$cls);
  26370. $core.addMethod(
  26371. $core.method({
  26372. selector: "prompt:default:",
  26373. protocol: "dialogs",
  26374. fn: function (aString,defaultString){
  26375. var self=this,$self=this;
  26376. return $core.withContext(function($ctx1) {
  26377. return $recv($self._current())._prompt_default_(aString,defaultString);
  26378. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26379. },
  26380. args: ["aString", "defaultString"],
  26381. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26382. referencedClasses: [],
  26383. messageSends: ["prompt:default:", "current"]
  26384. }),
  26385. $globals.Terminal.a$cls);
  26386. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26387. $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.";
  26388. $core.addMethod(
  26389. $core.method({
  26390. selector: "clear",
  26391. protocol: "printing",
  26392. fn: function (){
  26393. var self=this,$self=this;
  26394. return $core.withContext(function($ctx1) {
  26395. $recv($self._current())._clear();
  26396. return self;
  26397. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26398. },
  26399. args: [],
  26400. source: "clear\x0a\x09self current clear",
  26401. referencedClasses: [],
  26402. messageSends: ["clear", "current"]
  26403. }),
  26404. $globals.Transcript.a$cls);
  26405. $core.addMethod(
  26406. $core.method({
  26407. selector: "cr",
  26408. protocol: "printing",
  26409. fn: function (){
  26410. var self=this,$self=this;
  26411. return $core.withContext(function($ctx1) {
  26412. $recv($self._current())._show_($recv($globals.String)._cr());
  26413. return self;
  26414. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26415. },
  26416. args: [],
  26417. source: "cr\x0a\x09self current show: String cr",
  26418. referencedClasses: ["String"],
  26419. messageSends: ["show:", "current", "cr"]
  26420. }),
  26421. $globals.Transcript.a$cls);
  26422. $core.addMethod(
  26423. $core.method({
  26424. selector: "inspect:",
  26425. protocol: "printing",
  26426. fn: function (anObject){
  26427. var self=this,$self=this;
  26428. return $core.withContext(function($ctx1) {
  26429. $self._show_(anObject);
  26430. return self;
  26431. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26432. },
  26433. args: ["anObject"],
  26434. source: "inspect: anObject\x0a\x09self show: anObject",
  26435. referencedClasses: [],
  26436. messageSends: ["show:"]
  26437. }),
  26438. $globals.Transcript.a$cls);
  26439. $core.addMethod(
  26440. $core.method({
  26441. selector: "open",
  26442. protocol: "instance creation",
  26443. fn: function (){
  26444. var self=this,$self=this;
  26445. return $core.withContext(function($ctx1) {
  26446. $recv($self._current())._open();
  26447. return self;
  26448. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26449. },
  26450. args: [],
  26451. source: "open\x0a\x09self current open",
  26452. referencedClasses: [],
  26453. messageSends: ["open", "current"]
  26454. }),
  26455. $globals.Transcript.a$cls);
  26456. $core.addMethod(
  26457. $core.method({
  26458. selector: "show:",
  26459. protocol: "printing",
  26460. fn: function (anObject){
  26461. var self=this,$self=this;
  26462. return $core.withContext(function($ctx1) {
  26463. $recv($self._current())._show_(anObject);
  26464. return self;
  26465. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26466. },
  26467. args: ["anObject"],
  26468. source: "show: anObject\x0a\x09self current show: anObject",
  26469. referencedClasses: [],
  26470. messageSends: ["show:", "current"]
  26471. }),
  26472. $globals.Transcript.a$cls);
  26473. $core.addMethod(
  26474. $core.method({
  26475. selector: "inspectOn:",
  26476. protocol: "*Platform-Services",
  26477. fn: function (anInspector){
  26478. var self=this,$self=this;
  26479. var variables;
  26480. return $core.withContext(function($ctx1) {
  26481. variables=$recv($globals.Dictionary)._new();
  26482. $recv(variables)._at_put_("#self",self);
  26483. $ctx1.sendIdx["at:put:"]=1;
  26484. $recv(variables)._at_put_("#keys",$self._keys());
  26485. $ctx1.sendIdx["at:put:"]=2;
  26486. $self._keysAndValuesDo_((function(key,value){
  26487. return $core.withContext(function($ctx2) {
  26488. return $recv(variables)._at_put_(key,value);
  26489. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26490. }));
  26491. $recv(anInspector)._setLabel_($self._printString());
  26492. $recv(anInspector)._setVariables_(variables);
  26493. return self;
  26494. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26495. },
  26496. args: ["anInspector"],
  26497. 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",
  26498. referencedClasses: ["Dictionary"],
  26499. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26500. }),
  26501. $globals.AssociativeCollection);
  26502. $core.addMethod(
  26503. $core.method({
  26504. selector: "inspectOn:",
  26505. protocol: "*Platform-Services",
  26506. fn: function (anInspector){
  26507. var self=this,$self=this;
  26508. var variables;
  26509. return $core.withContext(function($ctx1) {
  26510. variables=$recv($globals.Dictionary)._new();
  26511. $recv(variables)._at_put_("#self",self);
  26512. $ctx1.sendIdx["at:put:"]=1;
  26513. $self._withIndexDo_((function(each,i){
  26514. return $core.withContext(function($ctx2) {
  26515. return $recv(variables)._at_put_(i,each);
  26516. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26517. }));
  26518. $recv(anInspector)._setLabel_($self._printString());
  26519. $recv(anInspector)._setVariables_(variables);
  26520. return self;
  26521. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26522. },
  26523. args: ["anInspector"],
  26524. 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",
  26525. referencedClasses: ["Dictionary"],
  26526. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26527. }),
  26528. $globals.Collection);
  26529. $core.addMethod(
  26530. $core.method({
  26531. selector: "inspectOn:",
  26532. protocol: "*Platform-Services",
  26533. fn: function (anInspector){
  26534. var self=this,$self=this;
  26535. var variables;
  26536. return $core.withContext(function($ctx1) {
  26537. variables=$recv($globals.Dictionary)._new();
  26538. $recv(variables)._at_put_("#self",self);
  26539. $ctx1.sendIdx["at:put:"]=1;
  26540. $recv(variables)._at_put_("#year",$self._year());
  26541. $ctx1.sendIdx["at:put:"]=2;
  26542. $recv(variables)._at_put_("#month",$self._month());
  26543. $ctx1.sendIdx["at:put:"]=3;
  26544. $recv(variables)._at_put_("#day",$self._day());
  26545. $ctx1.sendIdx["at:put:"]=4;
  26546. $recv(variables)._at_put_("#hours",$self._hours());
  26547. $ctx1.sendIdx["at:put:"]=5;
  26548. $recv(variables)._at_put_("#minutes",$self._minutes());
  26549. $ctx1.sendIdx["at:put:"]=6;
  26550. $recv(variables)._at_put_("#seconds",$self._seconds());
  26551. $ctx1.sendIdx["at:put:"]=7;
  26552. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26553. $recv(anInspector)._setLabel_($self._printString());
  26554. $recv(anInspector)._setVariables_(variables);
  26555. return self;
  26556. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26557. },
  26558. args: ["anInspector"],
  26559. 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",
  26560. referencedClasses: ["Dictionary"],
  26561. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26562. }),
  26563. $globals.Date);
  26564. $core.addMethod(
  26565. $core.method({
  26566. selector: "inspectOn:",
  26567. protocol: "*Platform-Services",
  26568. fn: function (anInspector){
  26569. var self=this,$self=this;
  26570. var variables;
  26571. return $core.withContext(function($ctx1) {
  26572. variables=$recv($globals.Dictionary)._new();
  26573. $recv(variables)._at_put_("#self",$self._jsObject());
  26574. $recv(anInspector)._setLabel_($self._printString());
  26575. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26576. $recv(anInspector)._setVariables_(variables);
  26577. return self;
  26578. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26579. },
  26580. args: ["anInspector"],
  26581. 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",
  26582. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26583. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26584. }),
  26585. $globals.JSObjectProxy);
  26586. $core.addMethod(
  26587. $core.method({
  26588. selector: "inspectOn:",
  26589. protocol: "*Platform-Services",
  26590. fn: function (anInspector){
  26591. var self=this,$self=this;
  26592. var variables;
  26593. return $core.withContext(function($ctx1) {
  26594. variables=$recv($globals.Dictionary)._new();
  26595. $recv(variables)._at_put_("#self",self);
  26596. $ctx1.sendIdx["at:put:"]=1;
  26597. $recv(variables)._at_put_("#home",$self._home());
  26598. $ctx1.sendIdx["at:put:"]=2;
  26599. $recv(variables)._at_put_("#receiver",$self._receiver());
  26600. $ctx1.sendIdx["at:put:"]=3;
  26601. $recv(variables)._at_put_("#selector",$self._selector());
  26602. $ctx1.sendIdx["at:put:"]=4;
  26603. $recv(variables)._at_put_("#locals",$self._locals());
  26604. $ctx1.sendIdx["at:put:"]=5;
  26605. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26606. return $core.withContext(function($ctx2) {
  26607. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26609. }));
  26610. $recv(anInspector)._setLabel_($self._printString());
  26611. $recv(anInspector)._setVariables_(variables);
  26612. return self;
  26613. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26614. },
  26615. args: ["anInspector"],
  26616. 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",
  26617. referencedClasses: ["Dictionary"],
  26618. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26619. }),
  26620. $globals.MethodContext);
  26621. $core.addMethod(
  26622. $core.method({
  26623. selector: "inspectOn:",
  26624. protocol: "*Platform-Services",
  26625. fn: function (anInspector){
  26626. var self=this,$self=this;
  26627. var variables;
  26628. return $core.withContext(function($ctx1) {
  26629. variables=$recv($globals.Dictionary)._new();
  26630. $recv(variables)._at_put_("#self",self);
  26631. $ctx1.sendIdx["at:put:"]=1;
  26632. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26633. return $core.withContext(function($ctx2) {
  26634. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26636. }));
  26637. $recv(anInspector)._setLabel_($self._printString());
  26638. $recv(anInspector)._setVariables_(variables);
  26639. return self;
  26640. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26641. },
  26642. args: ["anInspector"],
  26643. 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",
  26644. referencedClasses: ["Dictionary"],
  26645. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26646. }),
  26647. $globals.Object);
  26648. $core.addMethod(
  26649. $core.method({
  26650. selector: "do:displayingProgress:",
  26651. protocol: "*Platform-Services",
  26652. fn: function (aBlock,aString){
  26653. var self=this,$self=this;
  26654. return $core.withContext(function($ctx1) {
  26655. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26656. return self;
  26657. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26658. },
  26659. args: ["aBlock", "aString"],
  26660. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26661. referencedClasses: ["ProgressHandler"],
  26662. messageSends: ["do:on:displaying:"]
  26663. }),
  26664. $globals.SequenceableCollection);
  26665. $core.addMethod(
  26666. $core.method({
  26667. selector: "inspectOn:",
  26668. protocol: "*Platform-Services",
  26669. fn: function (anInspector){
  26670. var self=this,$self=this;
  26671. var variables,i;
  26672. return $core.withContext(function($ctx1) {
  26673. variables=$recv($globals.Dictionary)._new();
  26674. $recv(variables)._at_put_("#self",self);
  26675. $ctx1.sendIdx["at:put:"]=1;
  26676. i=(1);
  26677. $self._do_((function(each){
  26678. return $core.withContext(function($ctx2) {
  26679. $recv(variables)._at_put_(i,each);
  26680. i=$recv(i).__plus((1));
  26681. return i;
  26682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26683. }));
  26684. $recv(anInspector)._setLabel_($self._printString());
  26685. $recv(anInspector)._setVariables_(variables);
  26686. return self;
  26687. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26688. },
  26689. args: ["anInspector"],
  26690. 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",
  26691. referencedClasses: ["Dictionary"],
  26692. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26693. }),
  26694. $globals.Set);
  26695. $core.addMethod(
  26696. $core.method({
  26697. selector: "inspectOn:",
  26698. protocol: "*Platform-Services",
  26699. fn: function (anInspector){
  26700. var self=this,$self=this;
  26701. var label;
  26702. return $core.withContext(function($ctx1) {
  26703. var $3,$2,$1,$5,$4;
  26704. (
  26705. $ctx1.supercall = true,
  26706. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26707. $ctx1.supercall = false;
  26708. $3=$self._printString();
  26709. $ctx1.sendIdx["printString"]=1;
  26710. $2=$recv($3)._size();
  26711. $1=$recv($2).__gt((30));
  26712. if($core.assert($1)){
  26713. $5=$self._printString();
  26714. $ctx1.sendIdx["printString"]=2;
  26715. $4=$recv($5)._copyFrom_to_((1),(30));
  26716. label=$recv($4).__comma("...'");
  26717. label;
  26718. } else {
  26719. label=$self._printString();
  26720. label;
  26721. }
  26722. $recv(anInspector)._setLabel_(label);
  26723. return self;
  26724. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26725. },
  26726. args: ["anInspector"],
  26727. 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",
  26728. referencedClasses: [],
  26729. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26730. }),
  26731. $globals.String);
  26732. });
  26733. define('amber/deploy',[
  26734. './helpers',
  26735. './boot', // pre-fetch, dep of ./helpers
  26736. // --- packages of the core Amber begin here ---
  26737. 'amber_core/Kernel-Helpers',
  26738. 'amber_core/Kernel-Objects',
  26739. 'amber_core/Kernel-Classes',
  26740. 'amber_core/Kernel-Methods',
  26741. 'amber_core/Kernel-Collections',
  26742. 'amber_core/Kernel-Dag',
  26743. 'amber_core/Kernel-Infrastructure',
  26744. 'amber_core/Kernel-Promises',
  26745. 'amber_core/Kernel-Exceptions',
  26746. 'amber_core/Kernel-Announcements',
  26747. 'amber_core/Platform-Services',
  26748. // --- packages of the core Amber end here ---
  26749. ], function (amber) {
  26750. return amber;
  26751. });
  26752. // jshint ignore:start
  26753. define('amber/parser',['./boot'], function($boot) {
  26754. var $globals = $boot.globals;
  26755. $globals.SmalltalkParser = (function() {
  26756. "use strict";
  26757. /*
  26758. * Generated by PEG.js 0.9.0.
  26759. *
  26760. * http://pegjs.org/
  26761. */
  26762. function peg$subclass(child, parent) {
  26763. function ctor() { this.constructor = child; }
  26764. ctor.prototype = parent.prototype;
  26765. child.prototype = new ctor();
  26766. }
  26767. function peg$SyntaxError(message, expected, found, location) {
  26768. this.message = message;
  26769. this.expected = expected;
  26770. this.found = found;
  26771. this.location = location;
  26772. this.name = "SyntaxError";
  26773. if (typeof Error.captureStackTrace === "function") {
  26774. Error.captureStackTrace(this, peg$SyntaxError);
  26775. }
  26776. }
  26777. peg$subclass(peg$SyntaxError, Error);
  26778. function peg$parse(input) {
  26779. var options = arguments.length > 1 ? arguments[1] : {},
  26780. parser = this,
  26781. peg$FAILED = {},
  26782. peg$startRuleFunctions = { start: peg$parsestart },
  26783. peg$startRuleFunction = peg$parsestart,
  26784. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26785. 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]" },
  26786. peg$c2 = "\"",
  26787. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26788. peg$c4 = /^[^"]/,
  26789. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26790. peg$c6 = ".",
  26791. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26792. peg$c8 = /^[a-zA-Z]/,
  26793. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26794. peg$c10 = /^[a-zA-Z0-9]/,
  26795. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26796. peg$c12 = ":",
  26797. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26798. peg$c14 = /^[A-Z]/,
  26799. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26800. peg$c16 = function(val) {
  26801. return $globals.ValueNode._new()
  26802. ._location_(location())
  26803. ._source_(text())
  26804. ._value_(val);
  26805. },
  26806. peg$c17 = "'",
  26807. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26808. peg$c19 = "''",
  26809. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26810. peg$c21 = function() {return '\'';},
  26811. peg$c22 = /^[^']/,
  26812. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26813. peg$c24 = function(val) {return val.join('');},
  26814. peg$c25 = "$",
  26815. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26816. peg$c27 = { type: "any", description: "any character" },
  26817. peg$c28 = function(char) {
  26818. return $globals.ValueNode._new()
  26819. ._location_(location())
  26820. ._source_(text())
  26821. ._value_(char);
  26822. },
  26823. peg$c29 = "#",
  26824. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26825. peg$c31 = function(rest) {return rest;},
  26826. peg$c32 = "e",
  26827. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26828. peg$c34 = function(n) {return parseFloat(n);},
  26829. peg$c35 = "-",
  26830. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26831. peg$c37 = "16r",
  26832. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26833. peg$c39 = /^[0-9a-fA-F]/,
  26834. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26835. peg$c41 = function(neg, num) {
  26836. return parseInt(((neg || '') + num), 16);
  26837. },
  26838. peg$c42 = /^[0-9]/,
  26839. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26840. peg$c44 = function(n) {return parseFloat(n, 10);},
  26841. peg$c45 = function(n) {return parseInt(n, 10);},
  26842. peg$c46 = "#(",
  26843. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26844. peg$c48 = ")",
  26845. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26846. peg$c50 = function(rest) {
  26847. return rest
  26848. ._location_(location())
  26849. ._source_(text());
  26850. },
  26851. peg$c51 = "(",
  26852. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26853. peg$c53 = function(lit) {return lit._value();},
  26854. peg$c54 = function(lits) {
  26855. return $globals.ValueNode._new()
  26856. ._value_(lits);
  26857. },
  26858. peg$c55 = "{",
  26859. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26860. peg$c57 = "}",
  26861. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26862. peg$c59 = function(expressions) {
  26863. return $globals.DynamicArrayNode._new()
  26864. ._location_(location())
  26865. ._source_(text())
  26866. ._dagChildren_(expressions || []);
  26867. },
  26868. peg$c60 = "#{",
  26869. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26870. peg$c62 = function(expressions) {
  26871. return $globals.DynamicDictionaryNode._new()
  26872. ._location_(location())
  26873. ._source_(text())
  26874. ._dagChildren_(expressions || []);
  26875. },
  26876. peg$c63 = "true",
  26877. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26878. peg$c65 = function() {return true;},
  26879. peg$c66 = "false",
  26880. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26881. peg$c68 = function() {return false;},
  26882. peg$c69 = "nil",
  26883. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26884. peg$c71 = function() {return null;},
  26885. peg$c72 = function(identifier) {
  26886. return $globals.VariableNode._new()
  26887. ._location_(location())
  26888. ._source_(text())
  26889. ._value_(identifier);
  26890. },
  26891. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26892. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26893. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26894. peg$c76 = function(pairs) {
  26895. var selector = '';
  26896. var params = [];
  26897. for(var i = 0; i < pairs.length; i++) {
  26898. selector += pairs[i].key;
  26899. params.push(pairs[i].arg);
  26900. }
  26901. return [selector, params];
  26902. },
  26903. peg$c77 = function(selector, arg) {
  26904. return [selector, [arg]];
  26905. },
  26906. peg$c78 = function(selector) {return [selector, []];},
  26907. peg$c79 = function(expression) {
  26908. return expression;
  26909. },
  26910. peg$c80 = function(first, others) {
  26911. return [first].concat(others);
  26912. },
  26913. peg$c81 = ":=",
  26914. peg$c82 = { type: "literal", value: ":=", description: "\":=\"" },
  26915. peg$c83 = function(variable, expression) {
  26916. return $globals.AssignmentNode._new()
  26917. ._location_(location())
  26918. ._source_(text())
  26919. ._left_(variable)
  26920. ._right_(expression);
  26921. },
  26922. peg$c84 = "^",
  26923. peg$c85 = { type: "literal", value: "^", description: "\"^\"" },
  26924. peg$c86 = function(expression) {
  26925. return $globals.ReturnNode._new()
  26926. ._location_(location())
  26927. ._source_(text())
  26928. ._dagChildren_([expression]);
  26929. },
  26930. peg$c87 = "|",
  26931. peg$c88 = { type: "literal", value: "|", description: "\"|\"" },
  26932. peg$c89 = function(variable) {return variable;},
  26933. peg$c90 = function(vars) {
  26934. return vars;
  26935. },
  26936. peg$c91 = function(param) {return param;},
  26937. peg$c92 = function(params) {
  26938. return params;
  26939. },
  26940. peg$c93 = function(ret) {return [ret];},
  26941. peg$c94 = function(exps, ret) {
  26942. var expressions = exps;
  26943. expressions.push(ret);
  26944. return expressions;
  26945. },
  26946. peg$c95 = function(expressions) {return expressions || [];},
  26947. peg$c96 = function(js) {return js;},
  26948. peg$c97 = function(temps, statements) {
  26949. return $globals.SequenceNode._new()
  26950. ._location_(location())
  26951. ._source_(text())
  26952. ._temps_(temps || [])
  26953. ._dagChildren_(statements || []);
  26954. },
  26955. peg$c98 = "[",
  26956. peg$c99 = { type: "literal", value: "[", description: "\"[\"" },
  26957. peg$c100 = "]",
  26958. peg$c101 = { type: "literal", value: "]", description: "\"]\"" },
  26959. peg$c102 = function(params, sequence) {
  26960. return $globals.BlockNode._new()
  26961. ._location_(location())
  26962. ._source_(text())
  26963. ._parameters_(params || [])
  26964. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26965. },
  26966. peg$c103 = function(selector) {
  26967. return $globals.SendNode._new()
  26968. ._location_(location())
  26969. ._source_(text())
  26970. ._selector_(selector);
  26971. },
  26972. peg$c104 = function(receiver, tail) {
  26973. return receiver._withTail_(tail);
  26974. },
  26975. peg$c105 = function(selector, arg) {
  26976. return $globals.SendNode._new()
  26977. ._location_(location())
  26978. ._source_(text())
  26979. ._selector_(selector)
  26980. ._arguments_([arg]);
  26981. },
  26982. peg$c106 = function(pairs) {
  26983. var selector = '';
  26984. var args = [];
  26985. for(var i = 0; i < pairs.length; i++) {
  26986. selector += pairs[i].key;
  26987. args.push(pairs[i].arg);
  26988. }
  26989. return $globals.SendNode._new()
  26990. ._location_(location())
  26991. ._source_(text())
  26992. ._selector_(selector)
  26993. ._arguments_(args);
  26994. },
  26995. peg$c107 = function(receiver, tail) {
  26996. return tail ? receiver._withTail_([tail]) : receiver;
  26997. },
  26998. peg$c108 = function(send) {return send._isSendNode();},
  26999. peg$c109 = ";",
  27000. peg$c110 = { type: "literal", value: ";", description: "\";\"" },
  27001. peg$c111 = function(send, mess) {return mess;},
  27002. peg$c112 = function(send, messages) {
  27003. messages.unshift(send);
  27004. return $globals.CascadeNode._new()
  27005. ._location_(location())
  27006. ._source_(text())
  27007. ._dagChildren_(messages);
  27008. },
  27009. peg$c113 = "<",
  27010. peg$c114 = { type: "literal", value: "<", description: "\"<\"" },
  27011. peg$c115 = ">>",
  27012. peg$c116 = { type: "literal", value: ">>", description: "\">>\"" },
  27013. peg$c117 = function() {return '>';},
  27014. peg$c118 = /^[^>]/,
  27015. peg$c119 = { type: "class", value: "[^>]", description: "[^>]" },
  27016. peg$c120 = ">",
  27017. peg$c121 = { type: "literal", value: ">", description: "\">\"" },
  27018. peg$c122 = function(val) {return !/^\s*inlineJS/.test(val.join(''));},
  27019. peg$c123 = function(val) {
  27020. console.warn('Use of <...js code...> is deprecated, in:\n' + val.join(''));
  27021. return $globals.JSStatementNode._new()
  27022. ._location_(location())
  27023. ._source_(val.join(''))
  27024. },
  27025. peg$c124 = "inlineJS:",
  27026. peg$c125 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  27027. peg$c126 = function(val) {
  27028. return $globals.JSStatementNode._new()
  27029. ._location_(location())
  27030. ._source_(val)
  27031. },
  27032. peg$c127 = function(pattern, sequence) {
  27033. return $globals.MethodNode._new()
  27034. ._location_(location())
  27035. ._source_(text())
  27036. ._selector_(pattern[0])
  27037. ._arguments_(pattern[1])
  27038. ._dagChildren_([sequence]);
  27039. },
  27040. peg$c128 = function(send) { return send._isSendNode() && send._selector() === '->' },
  27041. peg$c129 = function(send) {
  27042. return [send._receiver(), send._arguments()[0]];
  27043. },
  27044. peg$c130 = function(first, others) {
  27045. return first.concat.apply(first, others);
  27046. },
  27047. peg$currPos = 0,
  27048. peg$savedPos = 0,
  27049. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27050. peg$maxFailPos = 0,
  27051. peg$maxFailExpected = [],
  27052. peg$silentFails = 0,
  27053. peg$resultsCache = {},
  27054. peg$result;
  27055. if ("startRule" in options) {
  27056. if (!(options.startRule in peg$startRuleFunctions)) {
  27057. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27058. }
  27059. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27060. }
  27061. function text() {
  27062. return input.substring(peg$savedPos, peg$currPos);
  27063. }
  27064. function location() {
  27065. return peg$computeLocation(peg$savedPos, peg$currPos);
  27066. }
  27067. function expected(description) {
  27068. throw peg$buildException(
  27069. null,
  27070. [{ type: "other", description: description }],
  27071. input.substring(peg$savedPos, peg$currPos),
  27072. peg$computeLocation(peg$savedPos, peg$currPos)
  27073. );
  27074. }
  27075. function error(message) {
  27076. throw peg$buildException(
  27077. message,
  27078. null,
  27079. input.substring(peg$savedPos, peg$currPos),
  27080. peg$computeLocation(peg$savedPos, peg$currPos)
  27081. );
  27082. }
  27083. function peg$computePosDetails(pos) {
  27084. var details = peg$posDetailsCache[pos],
  27085. p, ch;
  27086. if (details) {
  27087. return details;
  27088. } else {
  27089. p = pos - 1;
  27090. while (!peg$posDetailsCache[p]) {
  27091. p--;
  27092. }
  27093. details = peg$posDetailsCache[p];
  27094. details = {
  27095. line: details.line,
  27096. column: details.column,
  27097. seenCR: details.seenCR
  27098. };
  27099. while (p < pos) {
  27100. ch = input.charAt(p);
  27101. if (ch === "\n") {
  27102. if (!details.seenCR) { details.line++; }
  27103. details.column = 1;
  27104. details.seenCR = false;
  27105. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27106. details.line++;
  27107. details.column = 1;
  27108. details.seenCR = true;
  27109. } else {
  27110. details.column++;
  27111. details.seenCR = false;
  27112. }
  27113. p++;
  27114. }
  27115. peg$posDetailsCache[pos] = details;
  27116. return details;
  27117. }
  27118. }
  27119. function peg$computeLocation(startPos, endPos) {
  27120. var startPosDetails = peg$computePosDetails(startPos),
  27121. endPosDetails = peg$computePosDetails(endPos);
  27122. return {
  27123. start: {
  27124. offset: startPos,
  27125. line: startPosDetails.line,
  27126. column: startPosDetails.column
  27127. },
  27128. end: {
  27129. offset: endPos,
  27130. line: endPosDetails.line,
  27131. column: endPosDetails.column
  27132. }
  27133. };
  27134. }
  27135. function peg$fail(expected) {
  27136. if (peg$currPos < peg$maxFailPos) { return; }
  27137. if (peg$currPos > peg$maxFailPos) {
  27138. peg$maxFailPos = peg$currPos;
  27139. peg$maxFailExpected = [];
  27140. }
  27141. peg$maxFailExpected.push(expected);
  27142. }
  27143. function peg$buildException(message, expected, found, location) {
  27144. function cleanupExpected(expected) {
  27145. var i = 1;
  27146. expected.sort(function(a, b) {
  27147. if (a.description < b.description) {
  27148. return -1;
  27149. } else if (a.description > b.description) {
  27150. return 1;
  27151. } else {
  27152. return 0;
  27153. }
  27154. });
  27155. while (i < expected.length) {
  27156. if (expected[i - 1] === expected[i]) {
  27157. expected.splice(i, 1);
  27158. } else {
  27159. i++;
  27160. }
  27161. }
  27162. }
  27163. function buildMessage(expected, found) {
  27164. function stringEscape(s) {
  27165. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27166. return s
  27167. .replace(/\\/g, '\\\\')
  27168. .replace(/"/g, '\\"')
  27169. .replace(/\x08/g, '\\b')
  27170. .replace(/\t/g, '\\t')
  27171. .replace(/\n/g, '\\n')
  27172. .replace(/\f/g, '\\f')
  27173. .replace(/\r/g, '\\r')
  27174. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27175. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27176. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27177. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27178. }
  27179. var expectedDescs = new Array(expected.length),
  27180. expectedDesc, foundDesc, i;
  27181. for (i = 0; i < expected.length; i++) {
  27182. expectedDescs[i] = expected[i].description;
  27183. }
  27184. expectedDesc = expected.length > 1
  27185. ? expectedDescs.slice(0, -1).join(", ")
  27186. + " or "
  27187. + expectedDescs[expected.length - 1]
  27188. : expectedDescs[0];
  27189. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27190. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27191. }
  27192. if (expected !== null) {
  27193. cleanupExpected(expected);
  27194. }
  27195. return new peg$SyntaxError(
  27196. message !== null ? message : buildMessage(expected, found),
  27197. expected,
  27198. found,
  27199. location
  27200. );
  27201. }
  27202. function peg$parsestart() {
  27203. var s0;
  27204. var key = peg$currPos * 63 + 0,
  27205. cached = peg$resultsCache[key];
  27206. if (cached) {
  27207. peg$currPos = cached.nextPos;
  27208. return cached.result;
  27209. }
  27210. s0 = peg$parsemethod();
  27211. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27212. return s0;
  27213. }
  27214. function peg$parseseparator() {
  27215. var s0, s1;
  27216. var key = peg$currPos * 63 + 1,
  27217. cached = peg$resultsCache[key];
  27218. if (cached) {
  27219. peg$currPos = cached.nextPos;
  27220. return cached.result;
  27221. }
  27222. s0 = [];
  27223. if (peg$c0.test(input.charAt(peg$currPos))) {
  27224. s1 = input.charAt(peg$currPos);
  27225. peg$currPos++;
  27226. } else {
  27227. s1 = peg$FAILED;
  27228. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27229. }
  27230. if (s1 !== peg$FAILED) {
  27231. while (s1 !== peg$FAILED) {
  27232. s0.push(s1);
  27233. if (peg$c0.test(input.charAt(peg$currPos))) {
  27234. s1 = input.charAt(peg$currPos);
  27235. peg$currPos++;
  27236. } else {
  27237. s1 = peg$FAILED;
  27238. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27239. }
  27240. }
  27241. } else {
  27242. s0 = peg$FAILED;
  27243. }
  27244. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27245. return s0;
  27246. }
  27247. function peg$parsecomments() {
  27248. var s0, s1, s2, s3, s4;
  27249. var key = peg$currPos * 63 + 2,
  27250. cached = peg$resultsCache[key];
  27251. if (cached) {
  27252. peg$currPos = cached.nextPos;
  27253. return cached.result;
  27254. }
  27255. s0 = [];
  27256. s1 = peg$currPos;
  27257. if (input.charCodeAt(peg$currPos) === 34) {
  27258. s2 = peg$c2;
  27259. peg$currPos++;
  27260. } else {
  27261. s2 = peg$FAILED;
  27262. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27263. }
  27264. if (s2 !== peg$FAILED) {
  27265. s3 = [];
  27266. if (peg$c4.test(input.charAt(peg$currPos))) {
  27267. s4 = input.charAt(peg$currPos);
  27268. peg$currPos++;
  27269. } else {
  27270. s4 = peg$FAILED;
  27271. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27272. }
  27273. while (s4 !== peg$FAILED) {
  27274. s3.push(s4);
  27275. if (peg$c4.test(input.charAt(peg$currPos))) {
  27276. s4 = input.charAt(peg$currPos);
  27277. peg$currPos++;
  27278. } else {
  27279. s4 = peg$FAILED;
  27280. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27281. }
  27282. }
  27283. if (s3 !== peg$FAILED) {
  27284. if (input.charCodeAt(peg$currPos) === 34) {
  27285. s4 = peg$c2;
  27286. peg$currPos++;
  27287. } else {
  27288. s4 = peg$FAILED;
  27289. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27290. }
  27291. if (s4 !== peg$FAILED) {
  27292. s2 = [s2, s3, s4];
  27293. s1 = s2;
  27294. } else {
  27295. peg$currPos = s1;
  27296. s1 = peg$FAILED;
  27297. }
  27298. } else {
  27299. peg$currPos = s1;
  27300. s1 = peg$FAILED;
  27301. }
  27302. } else {
  27303. peg$currPos = s1;
  27304. s1 = peg$FAILED;
  27305. }
  27306. if (s1 !== peg$FAILED) {
  27307. while (s1 !== peg$FAILED) {
  27308. s0.push(s1);
  27309. s1 = peg$currPos;
  27310. if (input.charCodeAt(peg$currPos) === 34) {
  27311. s2 = peg$c2;
  27312. peg$currPos++;
  27313. } else {
  27314. s2 = peg$FAILED;
  27315. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27316. }
  27317. if (s2 !== peg$FAILED) {
  27318. s3 = [];
  27319. if (peg$c4.test(input.charAt(peg$currPos))) {
  27320. s4 = input.charAt(peg$currPos);
  27321. peg$currPos++;
  27322. } else {
  27323. s4 = peg$FAILED;
  27324. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27325. }
  27326. while (s4 !== peg$FAILED) {
  27327. s3.push(s4);
  27328. if (peg$c4.test(input.charAt(peg$currPos))) {
  27329. s4 = input.charAt(peg$currPos);
  27330. peg$currPos++;
  27331. } else {
  27332. s4 = peg$FAILED;
  27333. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27334. }
  27335. }
  27336. if (s3 !== peg$FAILED) {
  27337. if (input.charCodeAt(peg$currPos) === 34) {
  27338. s4 = peg$c2;
  27339. peg$currPos++;
  27340. } else {
  27341. s4 = peg$FAILED;
  27342. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27343. }
  27344. if (s4 !== peg$FAILED) {
  27345. s2 = [s2, s3, s4];
  27346. s1 = s2;
  27347. } else {
  27348. peg$currPos = s1;
  27349. s1 = peg$FAILED;
  27350. }
  27351. } else {
  27352. peg$currPos = s1;
  27353. s1 = peg$FAILED;
  27354. }
  27355. } else {
  27356. peg$currPos = s1;
  27357. s1 = peg$FAILED;
  27358. }
  27359. }
  27360. } else {
  27361. s0 = peg$FAILED;
  27362. }
  27363. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27364. return s0;
  27365. }
  27366. function peg$parsews() {
  27367. var s0, s1;
  27368. var key = peg$currPos * 63 + 3,
  27369. cached = peg$resultsCache[key];
  27370. if (cached) {
  27371. peg$currPos = cached.nextPos;
  27372. return cached.result;
  27373. }
  27374. s0 = [];
  27375. s1 = peg$parseseparator();
  27376. if (s1 === peg$FAILED) {
  27377. s1 = peg$parsecomments();
  27378. }
  27379. while (s1 !== peg$FAILED) {
  27380. s0.push(s1);
  27381. s1 = peg$parseseparator();
  27382. if (s1 === peg$FAILED) {
  27383. s1 = peg$parsecomments();
  27384. }
  27385. }
  27386. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27387. return s0;
  27388. }
  27389. function peg$parsemaybeDotsWs() {
  27390. var s0, s1;
  27391. var key = peg$currPos * 63 + 4,
  27392. cached = peg$resultsCache[key];
  27393. if (cached) {
  27394. peg$currPos = cached.nextPos;
  27395. return cached.result;
  27396. }
  27397. s0 = [];
  27398. if (input.charCodeAt(peg$currPos) === 46) {
  27399. s1 = peg$c6;
  27400. peg$currPos++;
  27401. } else {
  27402. s1 = peg$FAILED;
  27403. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27404. }
  27405. if (s1 === peg$FAILED) {
  27406. s1 = peg$parseseparator();
  27407. if (s1 === peg$FAILED) {
  27408. s1 = peg$parsecomments();
  27409. }
  27410. }
  27411. while (s1 !== peg$FAILED) {
  27412. s0.push(s1);
  27413. if (input.charCodeAt(peg$currPos) === 46) {
  27414. s1 = peg$c6;
  27415. peg$currPos++;
  27416. } else {
  27417. s1 = peg$FAILED;
  27418. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27419. }
  27420. if (s1 === peg$FAILED) {
  27421. s1 = peg$parseseparator();
  27422. if (s1 === peg$FAILED) {
  27423. s1 = peg$parsecomments();
  27424. }
  27425. }
  27426. }
  27427. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27428. return s0;
  27429. }
  27430. function peg$parsesomeDotsWs() {
  27431. var s0, s1, s2, s3;
  27432. var key = peg$currPos * 63 + 5,
  27433. cached = peg$resultsCache[key];
  27434. if (cached) {
  27435. peg$currPos = cached.nextPos;
  27436. return cached.result;
  27437. }
  27438. s0 = peg$currPos;
  27439. s1 = peg$parsews();
  27440. if (s1 !== peg$FAILED) {
  27441. if (input.charCodeAt(peg$currPos) === 46) {
  27442. s2 = peg$c6;
  27443. peg$currPos++;
  27444. } else {
  27445. s2 = peg$FAILED;
  27446. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27447. }
  27448. if (s2 !== peg$FAILED) {
  27449. s3 = peg$parsemaybeDotsWs();
  27450. if (s3 !== peg$FAILED) {
  27451. s1 = [s1, s2, s3];
  27452. s0 = s1;
  27453. } else {
  27454. peg$currPos = s0;
  27455. s0 = peg$FAILED;
  27456. }
  27457. } else {
  27458. peg$currPos = s0;
  27459. s0 = peg$FAILED;
  27460. }
  27461. } else {
  27462. peg$currPos = s0;
  27463. s0 = peg$FAILED;
  27464. }
  27465. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27466. return s0;
  27467. }
  27468. function peg$parseidentifier() {
  27469. var s0, s1, s2, s3, s4;
  27470. var key = peg$currPos * 63 + 6,
  27471. cached = peg$resultsCache[key];
  27472. if (cached) {
  27473. peg$currPos = cached.nextPos;
  27474. return cached.result;
  27475. }
  27476. s0 = peg$currPos;
  27477. s1 = peg$currPos;
  27478. if (peg$c8.test(input.charAt(peg$currPos))) {
  27479. s2 = input.charAt(peg$currPos);
  27480. peg$currPos++;
  27481. } else {
  27482. s2 = peg$FAILED;
  27483. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27484. }
  27485. if (s2 !== peg$FAILED) {
  27486. s3 = [];
  27487. if (peg$c10.test(input.charAt(peg$currPos))) {
  27488. s4 = input.charAt(peg$currPos);
  27489. peg$currPos++;
  27490. } else {
  27491. s4 = peg$FAILED;
  27492. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27493. }
  27494. while (s4 !== peg$FAILED) {
  27495. s3.push(s4);
  27496. if (peg$c10.test(input.charAt(peg$currPos))) {
  27497. s4 = input.charAt(peg$currPos);
  27498. peg$currPos++;
  27499. } else {
  27500. s4 = peg$FAILED;
  27501. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27502. }
  27503. }
  27504. if (s3 !== peg$FAILED) {
  27505. s2 = [s2, s3];
  27506. s1 = s2;
  27507. } else {
  27508. peg$currPos = s1;
  27509. s1 = peg$FAILED;
  27510. }
  27511. } else {
  27512. peg$currPos = s1;
  27513. s1 = peg$FAILED;
  27514. }
  27515. if (s1 !== peg$FAILED) {
  27516. s0 = input.substring(s0, peg$currPos);
  27517. } else {
  27518. s0 = s1;
  27519. }
  27520. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27521. return s0;
  27522. }
  27523. function peg$parsekeyword() {
  27524. var s0, s1, s2, s3;
  27525. var key = peg$currPos * 63 + 7,
  27526. cached = peg$resultsCache[key];
  27527. if (cached) {
  27528. peg$currPos = cached.nextPos;
  27529. return cached.result;
  27530. }
  27531. s0 = peg$currPos;
  27532. s1 = peg$currPos;
  27533. s2 = peg$parseidentifier();
  27534. if (s2 !== peg$FAILED) {
  27535. if (input.charCodeAt(peg$currPos) === 58) {
  27536. s3 = peg$c12;
  27537. peg$currPos++;
  27538. } else {
  27539. s3 = peg$FAILED;
  27540. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27541. }
  27542. if (s3 !== peg$FAILED) {
  27543. s2 = [s2, s3];
  27544. s1 = s2;
  27545. } else {
  27546. peg$currPos = s1;
  27547. s1 = peg$FAILED;
  27548. }
  27549. } else {
  27550. peg$currPos = s1;
  27551. s1 = peg$FAILED;
  27552. }
  27553. if (s1 !== peg$FAILED) {
  27554. s0 = input.substring(s0, peg$currPos);
  27555. } else {
  27556. s0 = s1;
  27557. }
  27558. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27559. return s0;
  27560. }
  27561. function peg$parseclassName() {
  27562. var s0, s1, s2, s3, s4;
  27563. var key = peg$currPos * 63 + 8,
  27564. cached = peg$resultsCache[key];
  27565. if (cached) {
  27566. peg$currPos = cached.nextPos;
  27567. return cached.result;
  27568. }
  27569. s0 = peg$currPos;
  27570. s1 = peg$currPos;
  27571. if (peg$c14.test(input.charAt(peg$currPos))) {
  27572. s2 = input.charAt(peg$currPos);
  27573. peg$currPos++;
  27574. } else {
  27575. s2 = peg$FAILED;
  27576. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27577. }
  27578. if (s2 !== peg$FAILED) {
  27579. s3 = [];
  27580. if (peg$c10.test(input.charAt(peg$currPos))) {
  27581. s4 = input.charAt(peg$currPos);
  27582. peg$currPos++;
  27583. } else {
  27584. s4 = peg$FAILED;
  27585. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27586. }
  27587. while (s4 !== peg$FAILED) {
  27588. s3.push(s4);
  27589. if (peg$c10.test(input.charAt(peg$currPos))) {
  27590. s4 = input.charAt(peg$currPos);
  27591. peg$currPos++;
  27592. } else {
  27593. s4 = peg$FAILED;
  27594. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27595. }
  27596. }
  27597. if (s3 !== peg$FAILED) {
  27598. s2 = [s2, s3];
  27599. s1 = s2;
  27600. } else {
  27601. peg$currPos = s1;
  27602. s1 = peg$FAILED;
  27603. }
  27604. } else {
  27605. peg$currPos = s1;
  27606. s1 = peg$FAILED;
  27607. }
  27608. if (s1 !== peg$FAILED) {
  27609. s0 = input.substring(s0, peg$currPos);
  27610. } else {
  27611. s0 = s1;
  27612. }
  27613. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27614. return s0;
  27615. }
  27616. function peg$parsestring() {
  27617. var s0, s1;
  27618. var key = peg$currPos * 63 + 9,
  27619. cached = peg$resultsCache[key];
  27620. if (cached) {
  27621. peg$currPos = cached.nextPos;
  27622. return cached.result;
  27623. }
  27624. s0 = peg$currPos;
  27625. s1 = peg$parserawString();
  27626. if (s1 !== peg$FAILED) {
  27627. peg$savedPos = s0;
  27628. s1 = peg$c16(s1);
  27629. }
  27630. s0 = s1;
  27631. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27632. return s0;
  27633. }
  27634. function peg$parserawString() {
  27635. var s0, s1, s2, s3, s4;
  27636. var key = peg$currPos * 63 + 10,
  27637. cached = peg$resultsCache[key];
  27638. if (cached) {
  27639. peg$currPos = cached.nextPos;
  27640. return cached.result;
  27641. }
  27642. s0 = peg$currPos;
  27643. if (input.charCodeAt(peg$currPos) === 39) {
  27644. s1 = peg$c17;
  27645. peg$currPos++;
  27646. } else {
  27647. s1 = peg$FAILED;
  27648. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27649. }
  27650. if (s1 !== peg$FAILED) {
  27651. s2 = [];
  27652. s3 = peg$currPos;
  27653. if (input.substr(peg$currPos, 2) === peg$c19) {
  27654. s4 = peg$c19;
  27655. peg$currPos += 2;
  27656. } else {
  27657. s4 = peg$FAILED;
  27658. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27659. }
  27660. if (s4 !== peg$FAILED) {
  27661. peg$savedPos = s3;
  27662. s4 = peg$c21();
  27663. }
  27664. s3 = s4;
  27665. if (s3 === peg$FAILED) {
  27666. if (peg$c22.test(input.charAt(peg$currPos))) {
  27667. s3 = input.charAt(peg$currPos);
  27668. peg$currPos++;
  27669. } else {
  27670. s3 = peg$FAILED;
  27671. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27672. }
  27673. }
  27674. while (s3 !== peg$FAILED) {
  27675. s2.push(s3);
  27676. s3 = peg$currPos;
  27677. if (input.substr(peg$currPos, 2) === peg$c19) {
  27678. s4 = peg$c19;
  27679. peg$currPos += 2;
  27680. } else {
  27681. s4 = peg$FAILED;
  27682. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27683. }
  27684. if (s4 !== peg$FAILED) {
  27685. peg$savedPos = s3;
  27686. s4 = peg$c21();
  27687. }
  27688. s3 = s4;
  27689. if (s3 === peg$FAILED) {
  27690. if (peg$c22.test(input.charAt(peg$currPos))) {
  27691. s3 = input.charAt(peg$currPos);
  27692. peg$currPos++;
  27693. } else {
  27694. s3 = peg$FAILED;
  27695. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27696. }
  27697. }
  27698. }
  27699. if (s2 !== peg$FAILED) {
  27700. if (input.charCodeAt(peg$currPos) === 39) {
  27701. s3 = peg$c17;
  27702. peg$currPos++;
  27703. } else {
  27704. s3 = peg$FAILED;
  27705. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27706. }
  27707. if (s3 !== peg$FAILED) {
  27708. peg$savedPos = s0;
  27709. s1 = peg$c24(s2);
  27710. s0 = s1;
  27711. } else {
  27712. peg$currPos = s0;
  27713. s0 = peg$FAILED;
  27714. }
  27715. } else {
  27716. peg$currPos = s0;
  27717. s0 = peg$FAILED;
  27718. }
  27719. } else {
  27720. peg$currPos = s0;
  27721. s0 = peg$FAILED;
  27722. }
  27723. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27724. return s0;
  27725. }
  27726. function peg$parsecharacter() {
  27727. var s0, s1, s2;
  27728. var key = peg$currPos * 63 + 11,
  27729. cached = peg$resultsCache[key];
  27730. if (cached) {
  27731. peg$currPos = cached.nextPos;
  27732. return cached.result;
  27733. }
  27734. s0 = peg$currPos;
  27735. if (input.charCodeAt(peg$currPos) === 36) {
  27736. s1 = peg$c25;
  27737. peg$currPos++;
  27738. } else {
  27739. s1 = peg$FAILED;
  27740. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27741. }
  27742. if (s1 !== peg$FAILED) {
  27743. if (input.length > peg$currPos) {
  27744. s2 = input.charAt(peg$currPos);
  27745. peg$currPos++;
  27746. } else {
  27747. s2 = peg$FAILED;
  27748. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27749. }
  27750. if (s2 !== peg$FAILED) {
  27751. peg$savedPos = s0;
  27752. s1 = peg$c28(s2);
  27753. s0 = s1;
  27754. } else {
  27755. peg$currPos = s0;
  27756. s0 = peg$FAILED;
  27757. }
  27758. } else {
  27759. peg$currPos = s0;
  27760. s0 = peg$FAILED;
  27761. }
  27762. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27763. return s0;
  27764. }
  27765. function peg$parsesymbol() {
  27766. var s0, s1, s2;
  27767. var key = peg$currPos * 63 + 12,
  27768. cached = peg$resultsCache[key];
  27769. if (cached) {
  27770. peg$currPos = cached.nextPos;
  27771. return cached.result;
  27772. }
  27773. s0 = peg$currPos;
  27774. if (input.charCodeAt(peg$currPos) === 35) {
  27775. s1 = peg$c29;
  27776. peg$currPos++;
  27777. } else {
  27778. s1 = peg$FAILED;
  27779. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27780. }
  27781. if (s1 !== peg$FAILED) {
  27782. s2 = peg$parsebareSymbol();
  27783. if (s2 !== peg$FAILED) {
  27784. peg$savedPos = s0;
  27785. s1 = peg$c31(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$parsebareSymbol() {
  27799. var s0, s1, s2, s3;
  27800. var key = peg$currPos * 63 + 13,
  27801. cached = peg$resultsCache[key];
  27802. if (cached) {
  27803. peg$currPos = cached.nextPos;
  27804. return cached.result;
  27805. }
  27806. s0 = peg$currPos;
  27807. s1 = peg$currPos;
  27808. s2 = [];
  27809. s3 = peg$parsekeyword();
  27810. if (s3 !== peg$FAILED) {
  27811. while (s3 !== peg$FAILED) {
  27812. s2.push(s3);
  27813. s3 = peg$parsekeyword();
  27814. }
  27815. } else {
  27816. s2 = peg$FAILED;
  27817. }
  27818. if (s2 !== peg$FAILED) {
  27819. s1 = input.substring(s1, peg$currPos);
  27820. } else {
  27821. s1 = s2;
  27822. }
  27823. if (s1 === peg$FAILED) {
  27824. s1 = peg$parsebinarySelector();
  27825. if (s1 === peg$FAILED) {
  27826. s1 = peg$parseidentifier();
  27827. if (s1 === peg$FAILED) {
  27828. s1 = peg$parserawString();
  27829. }
  27830. }
  27831. }
  27832. if (s1 !== peg$FAILED) {
  27833. peg$savedPos = s0;
  27834. s1 = peg$c16(s1);
  27835. }
  27836. s0 = s1;
  27837. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27838. return s0;
  27839. }
  27840. function peg$parsenumber() {
  27841. var s0, s1;
  27842. var key = peg$currPos * 63 + 14,
  27843. cached = peg$resultsCache[key];
  27844. if (cached) {
  27845. peg$currPos = cached.nextPos;
  27846. return cached.result;
  27847. }
  27848. s0 = peg$currPos;
  27849. s1 = peg$parserawNumber();
  27850. if (s1 !== peg$FAILED) {
  27851. peg$savedPos = s0;
  27852. s1 = peg$c16(s1);
  27853. }
  27854. s0 = s1;
  27855. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27856. return s0;
  27857. }
  27858. function peg$parserawNumber() {
  27859. var s0;
  27860. var key = peg$currPos * 63 + 15,
  27861. cached = peg$resultsCache[key];
  27862. if (cached) {
  27863. peg$currPos = cached.nextPos;
  27864. return cached.result;
  27865. }
  27866. s0 = peg$parsenumberExp();
  27867. if (s0 === peg$FAILED) {
  27868. s0 = peg$parsehex();
  27869. if (s0 === peg$FAILED) {
  27870. s0 = peg$parsefloat();
  27871. if (s0 === peg$FAILED) {
  27872. s0 = peg$parseinteger();
  27873. }
  27874. }
  27875. }
  27876. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27877. return s0;
  27878. }
  27879. function peg$parsenumberExp() {
  27880. var s0, s1, s2, s3, s4, s5;
  27881. var key = peg$currPos * 63 + 16,
  27882. cached = peg$resultsCache[key];
  27883. if (cached) {
  27884. peg$currPos = cached.nextPos;
  27885. return cached.result;
  27886. }
  27887. s0 = peg$currPos;
  27888. s1 = peg$currPos;
  27889. s2 = peg$currPos;
  27890. s3 = peg$parsefloat();
  27891. if (s3 === peg$FAILED) {
  27892. s3 = peg$parseinteger();
  27893. }
  27894. if (s3 !== peg$FAILED) {
  27895. if (input.charCodeAt(peg$currPos) === 101) {
  27896. s4 = peg$c32;
  27897. peg$currPos++;
  27898. } else {
  27899. s4 = peg$FAILED;
  27900. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27901. }
  27902. if (s4 !== peg$FAILED) {
  27903. s5 = peg$parseinteger();
  27904. if (s5 !== peg$FAILED) {
  27905. s3 = [s3, s4, s5];
  27906. s2 = s3;
  27907. } else {
  27908. peg$currPos = s2;
  27909. s2 = peg$FAILED;
  27910. }
  27911. } else {
  27912. peg$currPos = s2;
  27913. s2 = peg$FAILED;
  27914. }
  27915. } else {
  27916. peg$currPos = s2;
  27917. s2 = peg$FAILED;
  27918. }
  27919. if (s2 !== peg$FAILED) {
  27920. s1 = input.substring(s1, peg$currPos);
  27921. } else {
  27922. s1 = s2;
  27923. }
  27924. if (s1 !== peg$FAILED) {
  27925. peg$savedPos = s0;
  27926. s1 = peg$c34(s1);
  27927. }
  27928. s0 = s1;
  27929. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27930. return s0;
  27931. }
  27932. function peg$parsehex() {
  27933. var s0, s1, s2, s3, s4, s5;
  27934. var key = peg$currPos * 63 + 17,
  27935. cached = peg$resultsCache[key];
  27936. if (cached) {
  27937. peg$currPos = cached.nextPos;
  27938. return cached.result;
  27939. }
  27940. s0 = peg$currPos;
  27941. if (input.charCodeAt(peg$currPos) === 45) {
  27942. s1 = peg$c35;
  27943. peg$currPos++;
  27944. } else {
  27945. s1 = peg$FAILED;
  27946. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27947. }
  27948. if (s1 === peg$FAILED) {
  27949. s1 = null;
  27950. }
  27951. if (s1 !== peg$FAILED) {
  27952. if (input.substr(peg$currPos, 3) === peg$c37) {
  27953. s2 = peg$c37;
  27954. peg$currPos += 3;
  27955. } else {
  27956. s2 = peg$FAILED;
  27957. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27958. }
  27959. if (s2 !== peg$FAILED) {
  27960. s3 = peg$currPos;
  27961. s4 = [];
  27962. if (peg$c39.test(input.charAt(peg$currPos))) {
  27963. s5 = input.charAt(peg$currPos);
  27964. peg$currPos++;
  27965. } else {
  27966. s5 = peg$FAILED;
  27967. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27968. }
  27969. if (s5 !== peg$FAILED) {
  27970. while (s5 !== peg$FAILED) {
  27971. s4.push(s5);
  27972. if (peg$c39.test(input.charAt(peg$currPos))) {
  27973. s5 = input.charAt(peg$currPos);
  27974. peg$currPos++;
  27975. } else {
  27976. s5 = peg$FAILED;
  27977. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27978. }
  27979. }
  27980. } else {
  27981. s4 = peg$FAILED;
  27982. }
  27983. if (s4 !== peg$FAILED) {
  27984. s3 = input.substring(s3, peg$currPos);
  27985. } else {
  27986. s3 = s4;
  27987. }
  27988. if (s3 !== peg$FAILED) {
  27989. peg$savedPos = s0;
  27990. s1 = peg$c41(s1, s3);
  27991. s0 = s1;
  27992. } else {
  27993. peg$currPos = s0;
  27994. s0 = peg$FAILED;
  27995. }
  27996. } else {
  27997. peg$currPos = s0;
  27998. s0 = peg$FAILED;
  27999. }
  28000. } else {
  28001. peg$currPos = s0;
  28002. s0 = peg$FAILED;
  28003. }
  28004. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28005. return s0;
  28006. }
  28007. function peg$parsefloat() {
  28008. var s0, s1, s2, s3, s4, s5, s6, s7;
  28009. var key = peg$currPos * 63 + 18,
  28010. cached = peg$resultsCache[key];
  28011. if (cached) {
  28012. peg$currPos = cached.nextPos;
  28013. return cached.result;
  28014. }
  28015. s0 = peg$currPos;
  28016. s1 = peg$currPos;
  28017. s2 = peg$currPos;
  28018. if (input.charCodeAt(peg$currPos) === 45) {
  28019. s3 = peg$c35;
  28020. peg$currPos++;
  28021. } else {
  28022. s3 = peg$FAILED;
  28023. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28024. }
  28025. if (s3 === peg$FAILED) {
  28026. s3 = null;
  28027. }
  28028. if (s3 !== peg$FAILED) {
  28029. s4 = [];
  28030. if (peg$c42.test(input.charAt(peg$currPos))) {
  28031. s5 = input.charAt(peg$currPos);
  28032. peg$currPos++;
  28033. } else {
  28034. s5 = peg$FAILED;
  28035. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28036. }
  28037. if (s5 !== peg$FAILED) {
  28038. while (s5 !== peg$FAILED) {
  28039. s4.push(s5);
  28040. if (peg$c42.test(input.charAt(peg$currPos))) {
  28041. s5 = input.charAt(peg$currPos);
  28042. peg$currPos++;
  28043. } else {
  28044. s5 = peg$FAILED;
  28045. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28046. }
  28047. }
  28048. } else {
  28049. s4 = peg$FAILED;
  28050. }
  28051. if (s4 !== peg$FAILED) {
  28052. if (input.charCodeAt(peg$currPos) === 46) {
  28053. s5 = peg$c6;
  28054. peg$currPos++;
  28055. } else {
  28056. s5 = peg$FAILED;
  28057. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28058. }
  28059. if (s5 !== peg$FAILED) {
  28060. s6 = [];
  28061. if (peg$c42.test(input.charAt(peg$currPos))) {
  28062. s7 = input.charAt(peg$currPos);
  28063. peg$currPos++;
  28064. } else {
  28065. s7 = peg$FAILED;
  28066. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28067. }
  28068. if (s7 !== peg$FAILED) {
  28069. while (s7 !== peg$FAILED) {
  28070. s6.push(s7);
  28071. if (peg$c42.test(input.charAt(peg$currPos))) {
  28072. s7 = input.charAt(peg$currPos);
  28073. peg$currPos++;
  28074. } else {
  28075. s7 = peg$FAILED;
  28076. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28077. }
  28078. }
  28079. } else {
  28080. s6 = peg$FAILED;
  28081. }
  28082. if (s6 !== peg$FAILED) {
  28083. s3 = [s3, s4, s5, s6];
  28084. s2 = s3;
  28085. } else {
  28086. peg$currPos = s2;
  28087. s2 = peg$FAILED;
  28088. }
  28089. } else {
  28090. peg$currPos = s2;
  28091. s2 = peg$FAILED;
  28092. }
  28093. } else {
  28094. peg$currPos = s2;
  28095. s2 = peg$FAILED;
  28096. }
  28097. } else {
  28098. peg$currPos = s2;
  28099. s2 = peg$FAILED;
  28100. }
  28101. if (s2 !== peg$FAILED) {
  28102. s1 = input.substring(s1, peg$currPos);
  28103. } else {
  28104. s1 = s2;
  28105. }
  28106. if (s1 !== peg$FAILED) {
  28107. peg$savedPos = s0;
  28108. s1 = peg$c44(s1);
  28109. }
  28110. s0 = s1;
  28111. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28112. return s0;
  28113. }
  28114. function peg$parseinteger() {
  28115. var s0, s1, s2, s3, s4, s5;
  28116. var key = peg$currPos * 63 + 19,
  28117. cached = peg$resultsCache[key];
  28118. if (cached) {
  28119. peg$currPos = cached.nextPos;
  28120. return cached.result;
  28121. }
  28122. s0 = peg$currPos;
  28123. s1 = peg$currPos;
  28124. s2 = peg$currPos;
  28125. if (input.charCodeAt(peg$currPos) === 45) {
  28126. s3 = peg$c35;
  28127. peg$currPos++;
  28128. } else {
  28129. s3 = peg$FAILED;
  28130. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28131. }
  28132. if (s3 === peg$FAILED) {
  28133. s3 = null;
  28134. }
  28135. if (s3 !== peg$FAILED) {
  28136. s4 = [];
  28137. if (peg$c42.test(input.charAt(peg$currPos))) {
  28138. s5 = input.charAt(peg$currPos);
  28139. peg$currPos++;
  28140. } else {
  28141. s5 = peg$FAILED;
  28142. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28143. }
  28144. if (s5 !== peg$FAILED) {
  28145. while (s5 !== peg$FAILED) {
  28146. s4.push(s5);
  28147. if (peg$c42.test(input.charAt(peg$currPos))) {
  28148. s5 = input.charAt(peg$currPos);
  28149. peg$currPos++;
  28150. } else {
  28151. s5 = peg$FAILED;
  28152. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28153. }
  28154. }
  28155. } else {
  28156. s4 = peg$FAILED;
  28157. }
  28158. if (s4 !== peg$FAILED) {
  28159. s3 = [s3, s4];
  28160. s2 = s3;
  28161. } else {
  28162. peg$currPos = s2;
  28163. s2 = peg$FAILED;
  28164. }
  28165. } else {
  28166. peg$currPos = s2;
  28167. s2 = peg$FAILED;
  28168. }
  28169. if (s2 !== peg$FAILED) {
  28170. s1 = input.substring(s1, peg$currPos);
  28171. } else {
  28172. s1 = s2;
  28173. }
  28174. if (s1 !== peg$FAILED) {
  28175. peg$savedPos = s0;
  28176. s1 = peg$c45(s1);
  28177. }
  28178. s0 = s1;
  28179. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28180. return s0;
  28181. }
  28182. function peg$parseliteralArray() {
  28183. var s0, s1, s2, s3, s4;
  28184. var key = peg$currPos * 63 + 20,
  28185. cached = peg$resultsCache[key];
  28186. if (cached) {
  28187. peg$currPos = cached.nextPos;
  28188. return cached.result;
  28189. }
  28190. s0 = peg$currPos;
  28191. if (input.substr(peg$currPos, 2) === peg$c46) {
  28192. s1 = peg$c46;
  28193. peg$currPos += 2;
  28194. } else {
  28195. s1 = peg$FAILED;
  28196. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28197. }
  28198. if (s1 !== peg$FAILED) {
  28199. s2 = peg$parsewsLiteralArrayContents();
  28200. if (s2 !== peg$FAILED) {
  28201. s3 = peg$parsews();
  28202. if (s3 !== peg$FAILED) {
  28203. if (input.charCodeAt(peg$currPos) === 41) {
  28204. s4 = peg$c48;
  28205. peg$currPos++;
  28206. } else {
  28207. s4 = peg$FAILED;
  28208. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28209. }
  28210. if (s4 !== peg$FAILED) {
  28211. peg$savedPos = s0;
  28212. s1 = peg$c50(s2);
  28213. s0 = s1;
  28214. } else {
  28215. peg$currPos = s0;
  28216. s0 = peg$FAILED;
  28217. }
  28218. } else {
  28219. peg$currPos = s0;
  28220. s0 = peg$FAILED;
  28221. }
  28222. } else {
  28223. peg$currPos = s0;
  28224. s0 = peg$FAILED;
  28225. }
  28226. } else {
  28227. peg$currPos = s0;
  28228. s0 = peg$FAILED;
  28229. }
  28230. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28231. return s0;
  28232. }
  28233. function peg$parsebareLiteralArray() {
  28234. var s0, s1, s2, s3, s4;
  28235. var key = peg$currPos * 63 + 21,
  28236. cached = peg$resultsCache[key];
  28237. if (cached) {
  28238. peg$currPos = cached.nextPos;
  28239. return cached.result;
  28240. }
  28241. s0 = peg$currPos;
  28242. if (input.charCodeAt(peg$currPos) === 40) {
  28243. s1 = peg$c51;
  28244. peg$currPos++;
  28245. } else {
  28246. s1 = peg$FAILED;
  28247. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28248. }
  28249. if (s1 !== peg$FAILED) {
  28250. s2 = peg$parsewsLiteralArrayContents();
  28251. if (s2 !== peg$FAILED) {
  28252. s3 = peg$parsews();
  28253. if (s3 !== peg$FAILED) {
  28254. if (input.charCodeAt(peg$currPos) === 41) {
  28255. s4 = peg$c48;
  28256. peg$currPos++;
  28257. } else {
  28258. s4 = peg$FAILED;
  28259. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28260. }
  28261. if (s4 !== peg$FAILED) {
  28262. peg$savedPos = s0;
  28263. s1 = peg$c50(s2);
  28264. s0 = s1;
  28265. } else {
  28266. peg$currPos = s0;
  28267. s0 = peg$FAILED;
  28268. }
  28269. } else {
  28270. peg$currPos = s0;
  28271. s0 = peg$FAILED;
  28272. }
  28273. } else {
  28274. peg$currPos = s0;
  28275. s0 = peg$FAILED;
  28276. }
  28277. } else {
  28278. peg$currPos = s0;
  28279. s0 = peg$FAILED;
  28280. }
  28281. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28282. return s0;
  28283. }
  28284. function peg$parseliteralArrayElement() {
  28285. var s0;
  28286. var key = peg$currPos * 63 + 22,
  28287. cached = peg$resultsCache[key];
  28288. if (cached) {
  28289. peg$currPos = cached.nextPos;
  28290. return cached.result;
  28291. }
  28292. s0 = peg$parseparseTimeLiteral();
  28293. if (s0 === peg$FAILED) {
  28294. s0 = peg$parsebareLiteralArray();
  28295. if (s0 === peg$FAILED) {
  28296. s0 = peg$parsebareSymbol();
  28297. }
  28298. }
  28299. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28300. return s0;
  28301. }
  28302. function peg$parsewsLiteralArrayContents() {
  28303. var s0, s1, s2, s3, s4;
  28304. var key = peg$currPos * 63 + 23,
  28305. cached = peg$resultsCache[key];
  28306. if (cached) {
  28307. peg$currPos = cached.nextPos;
  28308. return cached.result;
  28309. }
  28310. s0 = peg$currPos;
  28311. s1 = [];
  28312. s2 = peg$currPos;
  28313. s3 = peg$parsews();
  28314. if (s3 !== peg$FAILED) {
  28315. s4 = peg$parseliteralArrayElement();
  28316. if (s4 !== peg$FAILED) {
  28317. peg$savedPos = s2;
  28318. s3 = peg$c53(s4);
  28319. s2 = s3;
  28320. } else {
  28321. peg$currPos = s2;
  28322. s2 = peg$FAILED;
  28323. }
  28324. } else {
  28325. peg$currPos = s2;
  28326. s2 = peg$FAILED;
  28327. }
  28328. while (s2 !== peg$FAILED) {
  28329. s1.push(s2);
  28330. s2 = peg$currPos;
  28331. s3 = peg$parsews();
  28332. if (s3 !== peg$FAILED) {
  28333. s4 = peg$parseliteralArrayElement();
  28334. if (s4 !== peg$FAILED) {
  28335. peg$savedPos = s2;
  28336. s3 = peg$c53(s4);
  28337. s2 = s3;
  28338. } else {
  28339. peg$currPos = s2;
  28340. s2 = peg$FAILED;
  28341. }
  28342. } else {
  28343. peg$currPos = s2;
  28344. s2 = peg$FAILED;
  28345. }
  28346. }
  28347. if (s1 !== peg$FAILED) {
  28348. peg$savedPos = s0;
  28349. s1 = peg$c54(s1);
  28350. }
  28351. s0 = s1;
  28352. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28353. return s0;
  28354. }
  28355. function peg$parsedynamicArray() {
  28356. var s0, s1, s2, s3, s4;
  28357. var key = peg$currPos * 63 + 24,
  28358. cached = peg$resultsCache[key];
  28359. if (cached) {
  28360. peg$currPos = cached.nextPos;
  28361. return cached.result;
  28362. }
  28363. s0 = peg$currPos;
  28364. if (input.charCodeAt(peg$currPos) === 123) {
  28365. s1 = peg$c55;
  28366. peg$currPos++;
  28367. } else {
  28368. s1 = peg$FAILED;
  28369. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28370. }
  28371. if (s1 !== peg$FAILED) {
  28372. s2 = peg$parsewsExpressions();
  28373. if (s2 === peg$FAILED) {
  28374. s2 = null;
  28375. }
  28376. if (s2 !== peg$FAILED) {
  28377. s3 = peg$parsemaybeDotsWs();
  28378. if (s3 !== peg$FAILED) {
  28379. if (input.charCodeAt(peg$currPos) === 125) {
  28380. s4 = peg$c57;
  28381. peg$currPos++;
  28382. } else {
  28383. s4 = peg$FAILED;
  28384. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28385. }
  28386. if (s4 !== peg$FAILED) {
  28387. peg$savedPos = s0;
  28388. s1 = peg$c59(s2);
  28389. s0 = s1;
  28390. } else {
  28391. peg$currPos = s0;
  28392. s0 = peg$FAILED;
  28393. }
  28394. } else {
  28395. peg$currPos = s0;
  28396. s0 = peg$FAILED;
  28397. }
  28398. } else {
  28399. peg$currPos = s0;
  28400. s0 = peg$FAILED;
  28401. }
  28402. } else {
  28403. peg$currPos = s0;
  28404. s0 = peg$FAILED;
  28405. }
  28406. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28407. return s0;
  28408. }
  28409. function peg$parsedynamicDictionary() {
  28410. var s0, s1, s2, s3, s4;
  28411. var key = peg$currPos * 63 + 25,
  28412. cached = peg$resultsCache[key];
  28413. if (cached) {
  28414. peg$currPos = cached.nextPos;
  28415. return cached.result;
  28416. }
  28417. s0 = peg$currPos;
  28418. if (input.substr(peg$currPos, 2) === peg$c60) {
  28419. s1 = peg$c60;
  28420. peg$currPos += 2;
  28421. } else {
  28422. s1 = peg$FAILED;
  28423. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28424. }
  28425. if (s1 !== peg$FAILED) {
  28426. s2 = peg$parsewsAssociations();
  28427. if (s2 === peg$FAILED) {
  28428. s2 = null;
  28429. }
  28430. if (s2 !== peg$FAILED) {
  28431. s3 = peg$parsemaybeDotsWs();
  28432. if (s3 !== peg$FAILED) {
  28433. if (input.charCodeAt(peg$currPos) === 125) {
  28434. s4 = peg$c57;
  28435. peg$currPos++;
  28436. } else {
  28437. s4 = peg$FAILED;
  28438. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28439. }
  28440. if (s4 !== peg$FAILED) {
  28441. peg$savedPos = s0;
  28442. s1 = peg$c62(s2);
  28443. s0 = s1;
  28444. } else {
  28445. peg$currPos = s0;
  28446. s0 = peg$FAILED;
  28447. }
  28448. } else {
  28449. peg$currPos = s0;
  28450. s0 = peg$FAILED;
  28451. }
  28452. } else {
  28453. peg$currPos = s0;
  28454. s0 = peg$FAILED;
  28455. }
  28456. } else {
  28457. peg$currPos = s0;
  28458. s0 = peg$FAILED;
  28459. }
  28460. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28461. return s0;
  28462. }
  28463. function peg$parsepseudoVariable() {
  28464. var s0, s1, s2;
  28465. var key = peg$currPos * 63 + 26,
  28466. cached = peg$resultsCache[key];
  28467. if (cached) {
  28468. peg$currPos = cached.nextPos;
  28469. return cached.result;
  28470. }
  28471. s0 = peg$currPos;
  28472. s1 = peg$currPos;
  28473. if (input.substr(peg$currPos, 4) === peg$c63) {
  28474. s2 = peg$c63;
  28475. peg$currPos += 4;
  28476. } else {
  28477. s2 = peg$FAILED;
  28478. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28479. }
  28480. if (s2 !== peg$FAILED) {
  28481. peg$savedPos = s1;
  28482. s2 = peg$c65();
  28483. }
  28484. s1 = s2;
  28485. if (s1 === peg$FAILED) {
  28486. s1 = peg$currPos;
  28487. if (input.substr(peg$currPos, 5) === peg$c66) {
  28488. s2 = peg$c66;
  28489. peg$currPos += 5;
  28490. } else {
  28491. s2 = peg$FAILED;
  28492. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28493. }
  28494. if (s2 !== peg$FAILED) {
  28495. peg$savedPos = s1;
  28496. s2 = peg$c68();
  28497. }
  28498. s1 = s2;
  28499. if (s1 === peg$FAILED) {
  28500. s1 = peg$currPos;
  28501. if (input.substr(peg$currPos, 3) === peg$c69) {
  28502. s2 = peg$c69;
  28503. peg$currPos += 3;
  28504. } else {
  28505. s2 = peg$FAILED;
  28506. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28507. }
  28508. if (s2 !== peg$FAILED) {
  28509. peg$savedPos = s1;
  28510. s2 = peg$c71();
  28511. }
  28512. s1 = s2;
  28513. }
  28514. }
  28515. if (s1 !== peg$FAILED) {
  28516. peg$savedPos = s0;
  28517. s1 = peg$c16(s1);
  28518. }
  28519. s0 = s1;
  28520. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28521. return s0;
  28522. }
  28523. function peg$parseparseTimeLiteral() {
  28524. var s0;
  28525. var key = peg$currPos * 63 + 27,
  28526. cached = peg$resultsCache[key];
  28527. if (cached) {
  28528. peg$currPos = cached.nextPos;
  28529. return cached.result;
  28530. }
  28531. s0 = peg$parsepseudoVariable();
  28532. if (s0 === peg$FAILED) {
  28533. s0 = peg$parsenumber();
  28534. if (s0 === peg$FAILED) {
  28535. s0 = peg$parseliteralArray();
  28536. if (s0 === peg$FAILED) {
  28537. s0 = peg$parsestring();
  28538. if (s0 === peg$FAILED) {
  28539. s0 = peg$parsesymbol();
  28540. if (s0 === peg$FAILED) {
  28541. s0 = peg$parsecharacter();
  28542. }
  28543. }
  28544. }
  28545. }
  28546. }
  28547. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28548. return s0;
  28549. }
  28550. function peg$parseruntimeLiteral() {
  28551. var s0;
  28552. var key = peg$currPos * 63 + 28,
  28553. cached = peg$resultsCache[key];
  28554. if (cached) {
  28555. peg$currPos = cached.nextPos;
  28556. return cached.result;
  28557. }
  28558. s0 = peg$parsedynamicDictionary();
  28559. if (s0 === peg$FAILED) {
  28560. s0 = peg$parsedynamicArray();
  28561. if (s0 === peg$FAILED) {
  28562. s0 = peg$parseblock();
  28563. }
  28564. }
  28565. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28566. return s0;
  28567. }
  28568. function peg$parseliteral() {
  28569. var s0;
  28570. var key = peg$currPos * 63 + 29,
  28571. cached = peg$resultsCache[key];
  28572. if (cached) {
  28573. peg$currPos = cached.nextPos;
  28574. return cached.result;
  28575. }
  28576. s0 = peg$parseruntimeLiteral();
  28577. if (s0 === peg$FAILED) {
  28578. s0 = peg$parseparseTimeLiteral();
  28579. }
  28580. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28581. return s0;
  28582. }
  28583. function peg$parsevariable() {
  28584. var s0, s1;
  28585. var key = peg$currPos * 63 + 30,
  28586. cached = peg$resultsCache[key];
  28587. if (cached) {
  28588. peg$currPos = cached.nextPos;
  28589. return cached.result;
  28590. }
  28591. s0 = peg$currPos;
  28592. s1 = peg$parseidentifier();
  28593. if (s1 !== peg$FAILED) {
  28594. peg$savedPos = s0;
  28595. s1 = peg$c72(s1);
  28596. }
  28597. s0 = s1;
  28598. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28599. return s0;
  28600. }
  28601. function peg$parsebinarySelector() {
  28602. var s0, s1, s2;
  28603. var key = peg$currPos * 63 + 31,
  28604. cached = peg$resultsCache[key];
  28605. if (cached) {
  28606. peg$currPos = cached.nextPos;
  28607. return cached.result;
  28608. }
  28609. s0 = peg$currPos;
  28610. s1 = [];
  28611. if (peg$c73.test(input.charAt(peg$currPos))) {
  28612. s2 = input.charAt(peg$currPos);
  28613. peg$currPos++;
  28614. } else {
  28615. s2 = peg$FAILED;
  28616. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28617. }
  28618. if (s2 !== peg$FAILED) {
  28619. while (s2 !== peg$FAILED) {
  28620. s1.push(s2);
  28621. if (peg$c73.test(input.charAt(peg$currPos))) {
  28622. s2 = input.charAt(peg$currPos);
  28623. peg$currPos++;
  28624. } else {
  28625. s2 = peg$FAILED;
  28626. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28627. }
  28628. }
  28629. } else {
  28630. s1 = peg$FAILED;
  28631. }
  28632. if (s1 !== peg$FAILED) {
  28633. s0 = input.substring(s0, peg$currPos);
  28634. } else {
  28635. s0 = s1;
  28636. }
  28637. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28638. return s0;
  28639. }
  28640. function peg$parsewsKeywordPattern() {
  28641. var s0, s1, s2, s3, s4, s5, s6;
  28642. var key = peg$currPos * 63 + 32,
  28643. cached = peg$resultsCache[key];
  28644. if (cached) {
  28645. peg$currPos = cached.nextPos;
  28646. return cached.result;
  28647. }
  28648. s0 = peg$currPos;
  28649. s1 = [];
  28650. s2 = peg$currPos;
  28651. s3 = peg$parsews();
  28652. if (s3 !== peg$FAILED) {
  28653. s4 = peg$parsekeyword();
  28654. if (s4 !== peg$FAILED) {
  28655. s5 = peg$parsews();
  28656. if (s5 !== peg$FAILED) {
  28657. s6 = peg$parseidentifier();
  28658. if (s6 !== peg$FAILED) {
  28659. peg$savedPos = s2;
  28660. s3 = peg$c75(s4, s6);
  28661. s2 = s3;
  28662. } else {
  28663. peg$currPos = s2;
  28664. s2 = peg$FAILED;
  28665. }
  28666. } else {
  28667. peg$currPos = s2;
  28668. s2 = peg$FAILED;
  28669. }
  28670. } else {
  28671. peg$currPos = s2;
  28672. s2 = peg$FAILED;
  28673. }
  28674. } else {
  28675. peg$currPos = s2;
  28676. s2 = peg$FAILED;
  28677. }
  28678. if (s2 !== peg$FAILED) {
  28679. while (s2 !== peg$FAILED) {
  28680. s1.push(s2);
  28681. s2 = peg$currPos;
  28682. s3 = peg$parsews();
  28683. if (s3 !== peg$FAILED) {
  28684. s4 = peg$parsekeyword();
  28685. if (s4 !== peg$FAILED) {
  28686. s5 = peg$parsews();
  28687. if (s5 !== peg$FAILED) {
  28688. s6 = peg$parseidentifier();
  28689. if (s6 !== peg$FAILED) {
  28690. peg$savedPos = s2;
  28691. s3 = peg$c75(s4, s6);
  28692. s2 = s3;
  28693. } else {
  28694. peg$currPos = s2;
  28695. s2 = peg$FAILED;
  28696. }
  28697. } else {
  28698. peg$currPos = s2;
  28699. s2 = peg$FAILED;
  28700. }
  28701. } else {
  28702. peg$currPos = s2;
  28703. s2 = peg$FAILED;
  28704. }
  28705. } else {
  28706. peg$currPos = s2;
  28707. s2 = peg$FAILED;
  28708. }
  28709. }
  28710. } else {
  28711. s1 = peg$FAILED;
  28712. }
  28713. if (s1 !== peg$FAILED) {
  28714. peg$savedPos = s0;
  28715. s1 = peg$c76(s1);
  28716. }
  28717. s0 = s1;
  28718. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28719. return s0;
  28720. }
  28721. function peg$parsewsBinaryPattern() {
  28722. var s0, s1, s2, s3, s4;
  28723. var key = peg$currPos * 63 + 33,
  28724. cached = peg$resultsCache[key];
  28725. if (cached) {
  28726. peg$currPos = cached.nextPos;
  28727. return cached.result;
  28728. }
  28729. s0 = peg$currPos;
  28730. s1 = peg$parsews();
  28731. if (s1 !== peg$FAILED) {
  28732. s2 = peg$parsebinarySelector();
  28733. if (s2 !== peg$FAILED) {
  28734. s3 = peg$parsews();
  28735. if (s3 !== peg$FAILED) {
  28736. s4 = peg$parseidentifier();
  28737. if (s4 !== peg$FAILED) {
  28738. peg$savedPos = s0;
  28739. s1 = peg$c77(s2, s4);
  28740. s0 = s1;
  28741. } else {
  28742. peg$currPos = s0;
  28743. s0 = peg$FAILED;
  28744. }
  28745. } else {
  28746. peg$currPos = s0;
  28747. s0 = peg$FAILED;
  28748. }
  28749. } else {
  28750. peg$currPos = s0;
  28751. s0 = peg$FAILED;
  28752. }
  28753. } else {
  28754. peg$currPos = s0;
  28755. s0 = peg$FAILED;
  28756. }
  28757. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28758. return s0;
  28759. }
  28760. function peg$parsewsUnaryPattern() {
  28761. var s0, s1, s2;
  28762. var key = peg$currPos * 63 + 34,
  28763. cached = peg$resultsCache[key];
  28764. if (cached) {
  28765. peg$currPos = cached.nextPos;
  28766. return cached.result;
  28767. }
  28768. s0 = peg$currPos;
  28769. s1 = peg$parsews();
  28770. if (s1 !== peg$FAILED) {
  28771. s2 = peg$parseidentifier();
  28772. if (s2 !== peg$FAILED) {
  28773. peg$savedPos = s0;
  28774. s1 = peg$c78(s2);
  28775. s0 = s1;
  28776. } else {
  28777. peg$currPos = s0;
  28778. s0 = peg$FAILED;
  28779. }
  28780. } else {
  28781. peg$currPos = s0;
  28782. s0 = peg$FAILED;
  28783. }
  28784. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28785. return s0;
  28786. }
  28787. function peg$parseexpression() {
  28788. var s0;
  28789. var key = peg$currPos * 63 + 35,
  28790. cached = peg$resultsCache[key];
  28791. if (cached) {
  28792. peg$currPos = cached.nextPos;
  28793. return cached.result;
  28794. }
  28795. s0 = peg$parseassignment();
  28796. if (s0 === peg$FAILED) {
  28797. s0 = peg$parsecascade();
  28798. if (s0 === peg$FAILED) {
  28799. s0 = peg$parsekeywordSend();
  28800. }
  28801. }
  28802. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28803. return s0;
  28804. }
  28805. function peg$parsewsExpressionsRest() {
  28806. var s0, s1, s2;
  28807. var key = peg$currPos * 63 + 36,
  28808. cached = peg$resultsCache[key];
  28809. if (cached) {
  28810. peg$currPos = cached.nextPos;
  28811. return cached.result;
  28812. }
  28813. s0 = peg$currPos;
  28814. s1 = peg$parsesomeDotsWs();
  28815. if (s1 !== peg$FAILED) {
  28816. s2 = peg$parseexpression();
  28817. if (s2 !== peg$FAILED) {
  28818. peg$savedPos = s0;
  28819. s1 = peg$c79(s2);
  28820. s0 = s1;
  28821. } else {
  28822. peg$currPos = s0;
  28823. s0 = peg$FAILED;
  28824. }
  28825. } else {
  28826. peg$currPos = s0;
  28827. s0 = peg$FAILED;
  28828. }
  28829. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28830. return s0;
  28831. }
  28832. function peg$parsewsExpressions() {
  28833. var s0, s1, s2, s3, s4;
  28834. var key = peg$currPos * 63 + 37,
  28835. cached = peg$resultsCache[key];
  28836. if (cached) {
  28837. peg$currPos = cached.nextPos;
  28838. return cached.result;
  28839. }
  28840. s0 = peg$currPos;
  28841. s1 = peg$parsemaybeDotsWs();
  28842. if (s1 !== peg$FAILED) {
  28843. s2 = peg$parseexpression();
  28844. if (s2 !== peg$FAILED) {
  28845. s3 = [];
  28846. s4 = peg$parsewsExpressionsRest();
  28847. while (s4 !== peg$FAILED) {
  28848. s3.push(s4);
  28849. s4 = peg$parsewsExpressionsRest();
  28850. }
  28851. if (s3 !== peg$FAILED) {
  28852. peg$savedPos = s0;
  28853. s1 = peg$c80(s2, s3);
  28854. s0 = s1;
  28855. } else {
  28856. peg$currPos = s0;
  28857. s0 = peg$FAILED;
  28858. }
  28859. } else {
  28860. peg$currPos = s0;
  28861. s0 = peg$FAILED;
  28862. }
  28863. } else {
  28864. peg$currPos = s0;
  28865. s0 = peg$FAILED;
  28866. }
  28867. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28868. return s0;
  28869. }
  28870. function peg$parseassignment() {
  28871. var s0, s1, s2, s3, s4, s5;
  28872. var key = peg$currPos * 63 + 38,
  28873. cached = peg$resultsCache[key];
  28874. if (cached) {
  28875. peg$currPos = cached.nextPos;
  28876. return cached.result;
  28877. }
  28878. s0 = peg$currPos;
  28879. s1 = peg$parsevariable();
  28880. if (s1 !== peg$FAILED) {
  28881. s2 = peg$parsews();
  28882. if (s2 !== peg$FAILED) {
  28883. if (input.substr(peg$currPos, 2) === peg$c81) {
  28884. s3 = peg$c81;
  28885. peg$currPos += 2;
  28886. } else {
  28887. s3 = peg$FAILED;
  28888. if (peg$silentFails === 0) { peg$fail(peg$c82); }
  28889. }
  28890. if (s3 !== peg$FAILED) {
  28891. s4 = peg$parsews();
  28892. if (s4 !== peg$FAILED) {
  28893. s5 = peg$parseexpression();
  28894. if (s5 !== peg$FAILED) {
  28895. peg$savedPos = s0;
  28896. s1 = peg$c83(s1, s5);
  28897. s0 = s1;
  28898. } else {
  28899. peg$currPos = s0;
  28900. s0 = peg$FAILED;
  28901. }
  28902. } else {
  28903. peg$currPos = s0;
  28904. s0 = peg$FAILED;
  28905. }
  28906. } else {
  28907. peg$currPos = s0;
  28908. s0 = peg$FAILED;
  28909. }
  28910. } else {
  28911. peg$currPos = s0;
  28912. s0 = peg$FAILED;
  28913. }
  28914. } else {
  28915. peg$currPos = s0;
  28916. s0 = peg$FAILED;
  28917. }
  28918. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28919. return s0;
  28920. }
  28921. function peg$parseret() {
  28922. var s0, s1, s2, s3;
  28923. var key = peg$currPos * 63 + 39,
  28924. cached = peg$resultsCache[key];
  28925. if (cached) {
  28926. peg$currPos = cached.nextPos;
  28927. return cached.result;
  28928. }
  28929. s0 = peg$currPos;
  28930. if (input.charCodeAt(peg$currPos) === 94) {
  28931. s1 = peg$c84;
  28932. peg$currPos++;
  28933. } else {
  28934. s1 = peg$FAILED;
  28935. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  28936. }
  28937. if (s1 !== peg$FAILED) {
  28938. s2 = peg$parsews();
  28939. if (s2 !== peg$FAILED) {
  28940. s3 = peg$parseexpression();
  28941. if (s3 !== peg$FAILED) {
  28942. peg$savedPos = s0;
  28943. s1 = peg$c86(s3);
  28944. s0 = s1;
  28945. } else {
  28946. peg$currPos = s0;
  28947. s0 = peg$FAILED;
  28948. }
  28949. } else {
  28950. peg$currPos = s0;
  28951. s0 = peg$FAILED;
  28952. }
  28953. } else {
  28954. peg$currPos = s0;
  28955. s0 = peg$FAILED;
  28956. }
  28957. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28958. return s0;
  28959. }
  28960. function peg$parsetemps() {
  28961. var s0, s1, s2, s3, s4, s5;
  28962. var key = peg$currPos * 63 + 40,
  28963. cached = peg$resultsCache[key];
  28964. if (cached) {
  28965. peg$currPos = cached.nextPos;
  28966. return cached.result;
  28967. }
  28968. s0 = peg$currPos;
  28969. if (input.charCodeAt(peg$currPos) === 124) {
  28970. s1 = peg$c87;
  28971. peg$currPos++;
  28972. } else {
  28973. s1 = peg$FAILED;
  28974. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28975. }
  28976. if (s1 !== peg$FAILED) {
  28977. s2 = [];
  28978. s3 = peg$currPos;
  28979. s4 = peg$parsews();
  28980. if (s4 !== peg$FAILED) {
  28981. s5 = peg$parseidentifier();
  28982. if (s5 !== peg$FAILED) {
  28983. peg$savedPos = s3;
  28984. s4 = peg$c89(s5);
  28985. s3 = s4;
  28986. } else {
  28987. peg$currPos = s3;
  28988. s3 = peg$FAILED;
  28989. }
  28990. } else {
  28991. peg$currPos = s3;
  28992. s3 = peg$FAILED;
  28993. }
  28994. while (s3 !== peg$FAILED) {
  28995. s2.push(s3);
  28996. s3 = peg$currPos;
  28997. s4 = peg$parsews();
  28998. if (s4 !== peg$FAILED) {
  28999. s5 = peg$parseidentifier();
  29000. if (s5 !== peg$FAILED) {
  29001. peg$savedPos = s3;
  29002. s4 = peg$c89(s5);
  29003. s3 = s4;
  29004. } else {
  29005. peg$currPos = s3;
  29006. s3 = peg$FAILED;
  29007. }
  29008. } else {
  29009. peg$currPos = s3;
  29010. s3 = peg$FAILED;
  29011. }
  29012. }
  29013. if (s2 !== peg$FAILED) {
  29014. s3 = peg$parsews();
  29015. if (s3 !== peg$FAILED) {
  29016. if (input.charCodeAt(peg$currPos) === 124) {
  29017. s4 = peg$c87;
  29018. peg$currPos++;
  29019. } else {
  29020. s4 = peg$FAILED;
  29021. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  29022. }
  29023. if (s4 !== peg$FAILED) {
  29024. peg$savedPos = s0;
  29025. s1 = peg$c90(s2);
  29026. s0 = s1;
  29027. } else {
  29028. peg$currPos = s0;
  29029. s0 = peg$FAILED;
  29030. }
  29031. } else {
  29032. peg$currPos = s0;
  29033. s0 = peg$FAILED;
  29034. }
  29035. } else {
  29036. peg$currPos = s0;
  29037. s0 = peg$FAILED;
  29038. }
  29039. } else {
  29040. peg$currPos = s0;
  29041. s0 = peg$FAILED;
  29042. }
  29043. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29044. return s0;
  29045. }
  29046. function peg$parsewsBlockParamList() {
  29047. var s0, s1, s2, s3, s4, s5, s6;
  29048. var key = peg$currPos * 63 + 41,
  29049. cached = peg$resultsCache[key];
  29050. if (cached) {
  29051. peg$currPos = cached.nextPos;
  29052. return cached.result;
  29053. }
  29054. s0 = peg$currPos;
  29055. s1 = [];
  29056. s2 = peg$currPos;
  29057. s3 = peg$parsews();
  29058. if (s3 !== peg$FAILED) {
  29059. if (input.charCodeAt(peg$currPos) === 58) {
  29060. s4 = peg$c12;
  29061. peg$currPos++;
  29062. } else {
  29063. s4 = peg$FAILED;
  29064. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29065. }
  29066. if (s4 !== peg$FAILED) {
  29067. s5 = peg$parsews();
  29068. if (s5 !== peg$FAILED) {
  29069. s6 = peg$parseidentifier();
  29070. if (s6 !== peg$FAILED) {
  29071. peg$savedPos = s2;
  29072. s3 = peg$c91(s6);
  29073. s2 = s3;
  29074. } else {
  29075. peg$currPos = s2;
  29076. s2 = peg$FAILED;
  29077. }
  29078. } else {
  29079. peg$currPos = s2;
  29080. s2 = peg$FAILED;
  29081. }
  29082. } else {
  29083. peg$currPos = s2;
  29084. s2 = peg$FAILED;
  29085. }
  29086. } else {
  29087. peg$currPos = s2;
  29088. s2 = peg$FAILED;
  29089. }
  29090. if (s2 !== peg$FAILED) {
  29091. while (s2 !== peg$FAILED) {
  29092. s1.push(s2);
  29093. s2 = peg$currPos;
  29094. s3 = peg$parsews();
  29095. if (s3 !== peg$FAILED) {
  29096. if (input.charCodeAt(peg$currPos) === 58) {
  29097. s4 = peg$c12;
  29098. peg$currPos++;
  29099. } else {
  29100. s4 = peg$FAILED;
  29101. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29102. }
  29103. if (s4 !== peg$FAILED) {
  29104. s5 = peg$parsews();
  29105. if (s5 !== peg$FAILED) {
  29106. s6 = peg$parseidentifier();
  29107. if (s6 !== peg$FAILED) {
  29108. peg$savedPos = s2;
  29109. s3 = peg$c91(s6);
  29110. s2 = s3;
  29111. } else {
  29112. peg$currPos = s2;
  29113. s2 = peg$FAILED;
  29114. }
  29115. } else {
  29116. peg$currPos = s2;
  29117. s2 = peg$FAILED;
  29118. }
  29119. } else {
  29120. peg$currPos = s2;
  29121. s2 = peg$FAILED;
  29122. }
  29123. } else {
  29124. peg$currPos = s2;
  29125. s2 = peg$FAILED;
  29126. }
  29127. }
  29128. } else {
  29129. s1 = peg$FAILED;
  29130. }
  29131. if (s1 !== peg$FAILED) {
  29132. s2 = peg$parsews();
  29133. if (s2 !== peg$FAILED) {
  29134. if (input.charCodeAt(peg$currPos) === 124) {
  29135. s3 = peg$c87;
  29136. peg$currPos++;
  29137. } else {
  29138. s3 = peg$FAILED;
  29139. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  29140. }
  29141. if (s3 !== peg$FAILED) {
  29142. peg$savedPos = s0;
  29143. s1 = peg$c92(s1);
  29144. s0 = s1;
  29145. } else {
  29146. peg$currPos = s0;
  29147. s0 = peg$FAILED;
  29148. }
  29149. } else {
  29150. peg$currPos = s0;
  29151. s0 = peg$FAILED;
  29152. }
  29153. } else {
  29154. peg$currPos = s0;
  29155. s0 = peg$FAILED;
  29156. }
  29157. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29158. return s0;
  29159. }
  29160. function peg$parsesubexpression() {
  29161. var s0, s1, s2, s3, s4, s5;
  29162. var key = peg$currPos * 63 + 42,
  29163. cached = peg$resultsCache[key];
  29164. if (cached) {
  29165. peg$currPos = cached.nextPos;
  29166. return cached.result;
  29167. }
  29168. s0 = peg$currPos;
  29169. if (input.charCodeAt(peg$currPos) === 40) {
  29170. s1 = peg$c51;
  29171. peg$currPos++;
  29172. } else {
  29173. s1 = peg$FAILED;
  29174. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29175. }
  29176. if (s1 !== peg$FAILED) {
  29177. s2 = peg$parsews();
  29178. if (s2 !== peg$FAILED) {
  29179. s3 = peg$parseexpression();
  29180. if (s3 !== peg$FAILED) {
  29181. s4 = peg$parsews();
  29182. if (s4 !== peg$FAILED) {
  29183. if (input.charCodeAt(peg$currPos) === 41) {
  29184. s5 = peg$c48;
  29185. peg$currPos++;
  29186. } else {
  29187. s5 = peg$FAILED;
  29188. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29189. }
  29190. if (s5 !== peg$FAILED) {
  29191. peg$savedPos = s0;
  29192. s1 = peg$c79(s3);
  29193. s0 = s1;
  29194. } else {
  29195. peg$currPos = s0;
  29196. s0 = peg$FAILED;
  29197. }
  29198. } else {
  29199. peg$currPos = s0;
  29200. s0 = peg$FAILED;
  29201. }
  29202. } else {
  29203. peg$currPos = s0;
  29204. s0 = peg$FAILED;
  29205. }
  29206. } else {
  29207. peg$currPos = s0;
  29208. s0 = peg$FAILED;
  29209. }
  29210. } else {
  29211. peg$currPos = s0;
  29212. s0 = peg$FAILED;
  29213. }
  29214. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29215. return s0;
  29216. }
  29217. function peg$parsewsStatements() {
  29218. var s0, s1, s2, s3;
  29219. var key = peg$currPos * 63 + 43,
  29220. cached = peg$resultsCache[key];
  29221. if (cached) {
  29222. peg$currPos = cached.nextPos;
  29223. return cached.result;
  29224. }
  29225. s0 = peg$currPos;
  29226. s1 = peg$parsemaybeDotsWs();
  29227. if (s1 !== peg$FAILED) {
  29228. s2 = peg$parseret();
  29229. if (s2 !== peg$FAILED) {
  29230. peg$savedPos = s0;
  29231. s1 = peg$c93(s2);
  29232. s0 = s1;
  29233. } else {
  29234. peg$currPos = s0;
  29235. s0 = peg$FAILED;
  29236. }
  29237. } else {
  29238. peg$currPos = s0;
  29239. s0 = peg$FAILED;
  29240. }
  29241. if (s0 === peg$FAILED) {
  29242. s0 = peg$currPos;
  29243. s1 = peg$parsewsExpressions();
  29244. if (s1 !== peg$FAILED) {
  29245. s2 = peg$parsesomeDotsWs();
  29246. if (s2 !== peg$FAILED) {
  29247. s3 = peg$parseret();
  29248. if (s3 !== peg$FAILED) {
  29249. peg$savedPos = s0;
  29250. s1 = peg$c94(s1, s3);
  29251. s0 = s1;
  29252. } else {
  29253. peg$currPos = s0;
  29254. s0 = peg$FAILED;
  29255. }
  29256. } else {
  29257. peg$currPos = s0;
  29258. s0 = peg$FAILED;
  29259. }
  29260. } else {
  29261. peg$currPos = s0;
  29262. s0 = peg$FAILED;
  29263. }
  29264. if (s0 === peg$FAILED) {
  29265. s0 = peg$currPos;
  29266. s1 = peg$parsewsExpressions();
  29267. if (s1 === peg$FAILED) {
  29268. s1 = null;
  29269. }
  29270. if (s1 !== peg$FAILED) {
  29271. peg$savedPos = s0;
  29272. s1 = peg$c95(s1);
  29273. }
  29274. s0 = s1;
  29275. }
  29276. }
  29277. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29278. return s0;
  29279. }
  29280. function peg$parsewsSequenceWs() {
  29281. var s0, s1, s2, s3;
  29282. var key = peg$currPos * 63 + 44,
  29283. cached = peg$resultsCache[key];
  29284. if (cached) {
  29285. peg$currPos = cached.nextPos;
  29286. return cached.result;
  29287. }
  29288. s0 = peg$currPos;
  29289. s1 = peg$parsews();
  29290. if (s1 !== peg$FAILED) {
  29291. s2 = peg$parsejsStatement();
  29292. if (s2 !== peg$FAILED) {
  29293. s3 = peg$parsews();
  29294. if (s3 !== peg$FAILED) {
  29295. peg$savedPos = s0;
  29296. s1 = peg$c96(s2);
  29297. s0 = s1;
  29298. } else {
  29299. peg$currPos = s0;
  29300. s0 = peg$FAILED;
  29301. }
  29302. } else {
  29303. peg$currPos = s0;
  29304. s0 = peg$FAILED;
  29305. }
  29306. } else {
  29307. peg$currPos = s0;
  29308. s0 = peg$FAILED;
  29309. }
  29310. if (s0 === peg$FAILED) {
  29311. s0 = peg$parsewsStSequenceWs();
  29312. }
  29313. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29314. return s0;
  29315. }
  29316. function peg$parsewsStSequenceWs() {
  29317. var s0, s1, s2, s3, s4;
  29318. var key = peg$currPos * 63 + 45,
  29319. cached = peg$resultsCache[key];
  29320. if (cached) {
  29321. peg$currPos = cached.nextPos;
  29322. return cached.result;
  29323. }
  29324. s0 = peg$currPos;
  29325. s1 = peg$parsews();
  29326. if (s1 !== peg$FAILED) {
  29327. s2 = peg$parsetemps();
  29328. if (s2 === peg$FAILED) {
  29329. s2 = null;
  29330. }
  29331. if (s2 !== peg$FAILED) {
  29332. s3 = peg$parsewsStatements();
  29333. if (s3 === peg$FAILED) {
  29334. s3 = null;
  29335. }
  29336. if (s3 !== peg$FAILED) {
  29337. s4 = peg$parsemaybeDotsWs();
  29338. if (s4 !== peg$FAILED) {
  29339. peg$savedPos = s0;
  29340. s1 = peg$c97(s2, s3);
  29341. s0 = s1;
  29342. } else {
  29343. peg$currPos = s0;
  29344. s0 = peg$FAILED;
  29345. }
  29346. } else {
  29347. peg$currPos = s0;
  29348. s0 = peg$FAILED;
  29349. }
  29350. } else {
  29351. peg$currPos = s0;
  29352. s0 = peg$FAILED;
  29353. }
  29354. } else {
  29355. peg$currPos = s0;
  29356. s0 = peg$FAILED;
  29357. }
  29358. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29359. return s0;
  29360. }
  29361. function peg$parseblock() {
  29362. var s0, s1, s2, s3, s4;
  29363. var key = peg$currPos * 63 + 46,
  29364. cached = peg$resultsCache[key];
  29365. if (cached) {
  29366. peg$currPos = cached.nextPos;
  29367. return cached.result;
  29368. }
  29369. s0 = peg$currPos;
  29370. if (input.charCodeAt(peg$currPos) === 91) {
  29371. s1 = peg$c98;
  29372. peg$currPos++;
  29373. } else {
  29374. s1 = peg$FAILED;
  29375. if (peg$silentFails === 0) { peg$fail(peg$c99); }
  29376. }
  29377. if (s1 !== peg$FAILED) {
  29378. s2 = peg$parsewsBlockParamList();
  29379. if (s2 === peg$FAILED) {
  29380. s2 = null;
  29381. }
  29382. if (s2 !== peg$FAILED) {
  29383. s3 = peg$parsewsSequenceWs();
  29384. if (s3 !== peg$FAILED) {
  29385. if (input.charCodeAt(peg$currPos) === 93) {
  29386. s4 = peg$c100;
  29387. peg$currPos++;
  29388. } else {
  29389. s4 = peg$FAILED;
  29390. if (peg$silentFails === 0) { peg$fail(peg$c101); }
  29391. }
  29392. if (s4 !== peg$FAILED) {
  29393. peg$savedPos = s0;
  29394. s1 = peg$c102(s2, s3);
  29395. s0 = s1;
  29396. } else {
  29397. peg$currPos = s0;
  29398. s0 = peg$FAILED;
  29399. }
  29400. } else {
  29401. peg$currPos = s0;
  29402. s0 = peg$FAILED;
  29403. }
  29404. } else {
  29405. peg$currPos = s0;
  29406. s0 = peg$FAILED;
  29407. }
  29408. } else {
  29409. peg$currPos = s0;
  29410. s0 = peg$FAILED;
  29411. }
  29412. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29413. return s0;
  29414. }
  29415. function peg$parseoperand() {
  29416. var s0;
  29417. var key = peg$currPos * 63 + 47,
  29418. cached = peg$resultsCache[key];
  29419. if (cached) {
  29420. peg$currPos = cached.nextPos;
  29421. return cached.result;
  29422. }
  29423. s0 = peg$parseliteral();
  29424. if (s0 === peg$FAILED) {
  29425. s0 = peg$parsevariable();
  29426. if (s0 === peg$FAILED) {
  29427. s0 = peg$parsesubexpression();
  29428. }
  29429. }
  29430. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29431. return s0;
  29432. }
  29433. function peg$parsewsUnaryMessage() {
  29434. var s0, s1, s2, s3, s4;
  29435. var key = peg$currPos * 63 + 48,
  29436. cached = peg$resultsCache[key];
  29437. if (cached) {
  29438. peg$currPos = cached.nextPos;
  29439. return cached.result;
  29440. }
  29441. s0 = peg$currPos;
  29442. s1 = peg$parsews();
  29443. if (s1 !== peg$FAILED) {
  29444. s2 = peg$parseidentifier();
  29445. if (s2 !== peg$FAILED) {
  29446. s3 = peg$currPos;
  29447. peg$silentFails++;
  29448. if (input.charCodeAt(peg$currPos) === 58) {
  29449. s4 = peg$c12;
  29450. peg$currPos++;
  29451. } else {
  29452. s4 = peg$FAILED;
  29453. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29454. }
  29455. peg$silentFails--;
  29456. if (s4 === peg$FAILED) {
  29457. s3 = void 0;
  29458. } else {
  29459. peg$currPos = s3;
  29460. s3 = peg$FAILED;
  29461. }
  29462. if (s3 !== peg$FAILED) {
  29463. peg$savedPos = s0;
  29464. s1 = peg$c103(s2);
  29465. s0 = s1;
  29466. } else {
  29467. peg$currPos = s0;
  29468. s0 = peg$FAILED;
  29469. }
  29470. } else {
  29471. peg$currPos = s0;
  29472. s0 = peg$FAILED;
  29473. }
  29474. } else {
  29475. peg$currPos = s0;
  29476. s0 = peg$FAILED;
  29477. }
  29478. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29479. return s0;
  29480. }
  29481. function peg$parseunarySend() {
  29482. var s0, s1, s2, s3;
  29483. var key = peg$currPos * 63 + 49,
  29484. cached = peg$resultsCache[key];
  29485. if (cached) {
  29486. peg$currPos = cached.nextPos;
  29487. return cached.result;
  29488. }
  29489. s0 = peg$currPos;
  29490. s1 = peg$parseoperand();
  29491. if (s1 !== peg$FAILED) {
  29492. s2 = [];
  29493. s3 = peg$parsewsUnaryMessage();
  29494. while (s3 !== peg$FAILED) {
  29495. s2.push(s3);
  29496. s3 = peg$parsewsUnaryMessage();
  29497. }
  29498. if (s2 !== peg$FAILED) {
  29499. peg$savedPos = s0;
  29500. s1 = peg$c104(s1, s2);
  29501. s0 = s1;
  29502. } else {
  29503. peg$currPos = s0;
  29504. s0 = peg$FAILED;
  29505. }
  29506. } else {
  29507. peg$currPos = s0;
  29508. s0 = peg$FAILED;
  29509. }
  29510. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29511. return s0;
  29512. }
  29513. function peg$parsewsBinaryMessage() {
  29514. var s0, s1, s2, s3, s4;
  29515. var key = peg$currPos * 63 + 50,
  29516. cached = peg$resultsCache[key];
  29517. if (cached) {
  29518. peg$currPos = cached.nextPos;
  29519. return cached.result;
  29520. }
  29521. s0 = peg$currPos;
  29522. s1 = peg$parsews();
  29523. if (s1 !== peg$FAILED) {
  29524. s2 = peg$parsebinarySelector();
  29525. if (s2 !== peg$FAILED) {
  29526. s3 = peg$parsews();
  29527. if (s3 !== peg$FAILED) {
  29528. s4 = peg$parseunarySend();
  29529. if (s4 !== peg$FAILED) {
  29530. peg$savedPos = s0;
  29531. s1 = peg$c105(s2, s4);
  29532. s0 = s1;
  29533. } else {
  29534. peg$currPos = s0;
  29535. s0 = peg$FAILED;
  29536. }
  29537. } else {
  29538. peg$currPos = s0;
  29539. s0 = peg$FAILED;
  29540. }
  29541. } else {
  29542. peg$currPos = s0;
  29543. s0 = peg$FAILED;
  29544. }
  29545. } else {
  29546. peg$currPos = s0;
  29547. s0 = peg$FAILED;
  29548. }
  29549. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29550. return s0;
  29551. }
  29552. function peg$parsebinarySend() {
  29553. var s0, s1, s2, s3;
  29554. var key = peg$currPos * 63 + 51,
  29555. cached = peg$resultsCache[key];
  29556. if (cached) {
  29557. peg$currPos = cached.nextPos;
  29558. return cached.result;
  29559. }
  29560. s0 = peg$currPos;
  29561. s1 = peg$parseunarySend();
  29562. if (s1 !== peg$FAILED) {
  29563. s2 = [];
  29564. s3 = peg$parsewsBinaryMessage();
  29565. while (s3 !== peg$FAILED) {
  29566. s2.push(s3);
  29567. s3 = peg$parsewsBinaryMessage();
  29568. }
  29569. if (s2 !== peg$FAILED) {
  29570. peg$savedPos = s0;
  29571. s1 = peg$c104(s1, s2);
  29572. s0 = s1;
  29573. } else {
  29574. peg$currPos = s0;
  29575. s0 = peg$FAILED;
  29576. }
  29577. } else {
  29578. peg$currPos = s0;
  29579. s0 = peg$FAILED;
  29580. }
  29581. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29582. return s0;
  29583. }
  29584. function peg$parsewsKeywordMessage() {
  29585. var s0, s1, s2, s3, s4, s5, s6;
  29586. var key = peg$currPos * 63 + 52,
  29587. cached = peg$resultsCache[key];
  29588. if (cached) {
  29589. peg$currPos = cached.nextPos;
  29590. return cached.result;
  29591. }
  29592. s0 = peg$currPos;
  29593. s1 = [];
  29594. s2 = peg$currPos;
  29595. s3 = peg$parsews();
  29596. if (s3 !== peg$FAILED) {
  29597. s4 = peg$parsekeyword();
  29598. if (s4 !== peg$FAILED) {
  29599. s5 = peg$parsews();
  29600. if (s5 !== peg$FAILED) {
  29601. s6 = peg$parsebinarySend();
  29602. if (s6 !== peg$FAILED) {
  29603. peg$savedPos = s2;
  29604. s3 = peg$c75(s4, s6);
  29605. s2 = s3;
  29606. } else {
  29607. peg$currPos = s2;
  29608. s2 = peg$FAILED;
  29609. }
  29610. } else {
  29611. peg$currPos = s2;
  29612. s2 = peg$FAILED;
  29613. }
  29614. } else {
  29615. peg$currPos = s2;
  29616. s2 = peg$FAILED;
  29617. }
  29618. } else {
  29619. peg$currPos = s2;
  29620. s2 = peg$FAILED;
  29621. }
  29622. if (s2 !== peg$FAILED) {
  29623. while (s2 !== peg$FAILED) {
  29624. s1.push(s2);
  29625. s2 = peg$currPos;
  29626. s3 = peg$parsews();
  29627. if (s3 !== peg$FAILED) {
  29628. s4 = peg$parsekeyword();
  29629. if (s4 !== peg$FAILED) {
  29630. s5 = peg$parsews();
  29631. if (s5 !== peg$FAILED) {
  29632. s6 = peg$parsebinarySend();
  29633. if (s6 !== peg$FAILED) {
  29634. peg$savedPos = s2;
  29635. s3 = peg$c75(s4, s6);
  29636. s2 = s3;
  29637. } else {
  29638. peg$currPos = s2;
  29639. s2 = peg$FAILED;
  29640. }
  29641. } else {
  29642. peg$currPos = s2;
  29643. s2 = peg$FAILED;
  29644. }
  29645. } else {
  29646. peg$currPos = s2;
  29647. s2 = peg$FAILED;
  29648. }
  29649. } else {
  29650. peg$currPos = s2;
  29651. s2 = peg$FAILED;
  29652. }
  29653. }
  29654. } else {
  29655. s1 = peg$FAILED;
  29656. }
  29657. if (s1 !== peg$FAILED) {
  29658. peg$savedPos = s0;
  29659. s1 = peg$c106(s1);
  29660. }
  29661. s0 = s1;
  29662. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29663. return s0;
  29664. }
  29665. function peg$parsekeywordSend() {
  29666. var s0, s1, s2;
  29667. var key = peg$currPos * 63 + 53,
  29668. cached = peg$resultsCache[key];
  29669. if (cached) {
  29670. peg$currPos = cached.nextPos;
  29671. return cached.result;
  29672. }
  29673. s0 = peg$currPos;
  29674. s1 = peg$parsebinarySend();
  29675. if (s1 !== peg$FAILED) {
  29676. s2 = peg$parsewsKeywordMessage();
  29677. if (s2 === peg$FAILED) {
  29678. s2 = null;
  29679. }
  29680. if (s2 !== peg$FAILED) {
  29681. peg$savedPos = s0;
  29682. s1 = peg$c107(s1, s2);
  29683. s0 = s1;
  29684. } else {
  29685. peg$currPos = s0;
  29686. s0 = peg$FAILED;
  29687. }
  29688. } else {
  29689. peg$currPos = s0;
  29690. s0 = peg$FAILED;
  29691. }
  29692. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29693. return s0;
  29694. }
  29695. function peg$parsewsMessage() {
  29696. var s0;
  29697. var key = peg$currPos * 63 + 54,
  29698. cached = peg$resultsCache[key];
  29699. if (cached) {
  29700. peg$currPos = cached.nextPos;
  29701. return cached.result;
  29702. }
  29703. s0 = peg$parsewsBinaryMessage();
  29704. if (s0 === peg$FAILED) {
  29705. s0 = peg$parsewsUnaryMessage();
  29706. if (s0 === peg$FAILED) {
  29707. s0 = peg$parsewsKeywordMessage();
  29708. }
  29709. }
  29710. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29711. return s0;
  29712. }
  29713. function peg$parsecascade() {
  29714. var s0, s1, s2, s3, s4, s5, s6, s7;
  29715. var key = peg$currPos * 63 + 55,
  29716. cached = peg$resultsCache[key];
  29717. if (cached) {
  29718. peg$currPos = cached.nextPos;
  29719. return cached.result;
  29720. }
  29721. s0 = peg$currPos;
  29722. s1 = peg$parsekeywordSend();
  29723. if (s1 !== peg$FAILED) {
  29724. peg$savedPos = peg$currPos;
  29725. s2 = peg$c108(s1);
  29726. if (s2) {
  29727. s2 = void 0;
  29728. } else {
  29729. s2 = peg$FAILED;
  29730. }
  29731. if (s2 !== peg$FAILED) {
  29732. s3 = [];
  29733. s4 = peg$currPos;
  29734. s5 = peg$parsews();
  29735. if (s5 !== peg$FAILED) {
  29736. if (input.charCodeAt(peg$currPos) === 59) {
  29737. s6 = peg$c109;
  29738. peg$currPos++;
  29739. } else {
  29740. s6 = peg$FAILED;
  29741. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29742. }
  29743. if (s6 !== peg$FAILED) {
  29744. s7 = peg$parsewsMessage();
  29745. if (s7 !== peg$FAILED) {
  29746. peg$savedPos = s4;
  29747. s5 = peg$c111(s1, s7);
  29748. s4 = s5;
  29749. } else {
  29750. peg$currPos = s4;
  29751. s4 = peg$FAILED;
  29752. }
  29753. } else {
  29754. peg$currPos = s4;
  29755. s4 = peg$FAILED;
  29756. }
  29757. } else {
  29758. peg$currPos = s4;
  29759. s4 = peg$FAILED;
  29760. }
  29761. if (s4 !== peg$FAILED) {
  29762. while (s4 !== peg$FAILED) {
  29763. s3.push(s4);
  29764. s4 = peg$currPos;
  29765. s5 = peg$parsews();
  29766. if (s5 !== peg$FAILED) {
  29767. if (input.charCodeAt(peg$currPos) === 59) {
  29768. s6 = peg$c109;
  29769. peg$currPos++;
  29770. } else {
  29771. s6 = peg$FAILED;
  29772. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29773. }
  29774. if (s6 !== peg$FAILED) {
  29775. s7 = peg$parsewsMessage();
  29776. if (s7 !== peg$FAILED) {
  29777. peg$savedPos = s4;
  29778. s5 = peg$c111(s1, s7);
  29779. s4 = s5;
  29780. } else {
  29781. peg$currPos = s4;
  29782. s4 = peg$FAILED;
  29783. }
  29784. } else {
  29785. peg$currPos = s4;
  29786. s4 = peg$FAILED;
  29787. }
  29788. } else {
  29789. peg$currPos = s4;
  29790. s4 = peg$FAILED;
  29791. }
  29792. }
  29793. } else {
  29794. s3 = peg$FAILED;
  29795. }
  29796. if (s3 !== peg$FAILED) {
  29797. peg$savedPos = s0;
  29798. s1 = peg$c112(s1, s3);
  29799. s0 = s1;
  29800. } else {
  29801. peg$currPos = s0;
  29802. s0 = peg$FAILED;
  29803. }
  29804. } else {
  29805. peg$currPos = s0;
  29806. s0 = peg$FAILED;
  29807. }
  29808. } else {
  29809. peg$currPos = s0;
  29810. s0 = peg$FAILED;
  29811. }
  29812. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29813. return s0;
  29814. }
  29815. function peg$parsejsStatement() {
  29816. var s0;
  29817. var key = peg$currPos * 63 + 56,
  29818. cached = peg$resultsCache[key];
  29819. if (cached) {
  29820. peg$currPos = cached.nextPos;
  29821. return cached.result;
  29822. }
  29823. s0 = peg$parsepragmaJsStatement();
  29824. if (s0 === peg$FAILED) {
  29825. s0 = peg$parselegacyJsStatement();
  29826. }
  29827. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29828. return s0;
  29829. }
  29830. function peg$parselegacyJsStatement() {
  29831. var s0, s1, s2, s3, s4;
  29832. var key = peg$currPos * 63 + 57,
  29833. cached = peg$resultsCache[key];
  29834. if (cached) {
  29835. peg$currPos = cached.nextPos;
  29836. return cached.result;
  29837. }
  29838. s0 = peg$currPos;
  29839. if (input.charCodeAt(peg$currPos) === 60) {
  29840. s1 = peg$c113;
  29841. peg$currPos++;
  29842. } else {
  29843. s1 = peg$FAILED;
  29844. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29845. }
  29846. if (s1 !== peg$FAILED) {
  29847. s2 = [];
  29848. s3 = peg$currPos;
  29849. if (input.substr(peg$currPos, 2) === peg$c115) {
  29850. s4 = peg$c115;
  29851. peg$currPos += 2;
  29852. } else {
  29853. s4 = peg$FAILED;
  29854. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29855. }
  29856. if (s4 !== peg$FAILED) {
  29857. peg$savedPos = s3;
  29858. s4 = peg$c117();
  29859. }
  29860. s3 = s4;
  29861. if (s3 === peg$FAILED) {
  29862. if (peg$c118.test(input.charAt(peg$currPos))) {
  29863. s3 = input.charAt(peg$currPos);
  29864. peg$currPos++;
  29865. } else {
  29866. s3 = peg$FAILED;
  29867. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29868. }
  29869. }
  29870. while (s3 !== peg$FAILED) {
  29871. s2.push(s3);
  29872. s3 = peg$currPos;
  29873. if (input.substr(peg$currPos, 2) === peg$c115) {
  29874. s4 = peg$c115;
  29875. peg$currPos += 2;
  29876. } else {
  29877. s4 = peg$FAILED;
  29878. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29879. }
  29880. if (s4 !== peg$FAILED) {
  29881. peg$savedPos = s3;
  29882. s4 = peg$c117();
  29883. }
  29884. s3 = s4;
  29885. if (s3 === peg$FAILED) {
  29886. if (peg$c118.test(input.charAt(peg$currPos))) {
  29887. s3 = input.charAt(peg$currPos);
  29888. peg$currPos++;
  29889. } else {
  29890. s3 = peg$FAILED;
  29891. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29892. }
  29893. }
  29894. }
  29895. if (s2 !== peg$FAILED) {
  29896. if (input.charCodeAt(peg$currPos) === 62) {
  29897. s3 = peg$c120;
  29898. peg$currPos++;
  29899. } else {
  29900. s3 = peg$FAILED;
  29901. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29902. }
  29903. if (s3 !== peg$FAILED) {
  29904. peg$savedPos = peg$currPos;
  29905. s4 = peg$c122(s2);
  29906. if (s4) {
  29907. s4 = void 0;
  29908. } else {
  29909. s4 = peg$FAILED;
  29910. }
  29911. if (s4 !== peg$FAILED) {
  29912. peg$savedPos = s0;
  29913. s1 = peg$c123(s2);
  29914. s0 = s1;
  29915. } else {
  29916. peg$currPos = s0;
  29917. s0 = peg$FAILED;
  29918. }
  29919. } else {
  29920. peg$currPos = s0;
  29921. s0 = peg$FAILED;
  29922. }
  29923. } else {
  29924. peg$currPos = s0;
  29925. s0 = peg$FAILED;
  29926. }
  29927. } else {
  29928. peg$currPos = s0;
  29929. s0 = peg$FAILED;
  29930. }
  29931. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29932. return s0;
  29933. }
  29934. function peg$parsepragmaJsStatement() {
  29935. var s0, s1, s2, s3, s4, s5, s6, s7;
  29936. var key = peg$currPos * 63 + 58,
  29937. cached = peg$resultsCache[key];
  29938. if (cached) {
  29939. peg$currPos = cached.nextPos;
  29940. return cached.result;
  29941. }
  29942. s0 = peg$currPos;
  29943. if (input.charCodeAt(peg$currPos) === 60) {
  29944. s1 = peg$c113;
  29945. peg$currPos++;
  29946. } else {
  29947. s1 = peg$FAILED;
  29948. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29949. }
  29950. if (s1 !== peg$FAILED) {
  29951. s2 = peg$parsews();
  29952. if (s2 !== peg$FAILED) {
  29953. if (input.substr(peg$currPos, 9) === peg$c124) {
  29954. s3 = peg$c124;
  29955. peg$currPos += 9;
  29956. } else {
  29957. s3 = peg$FAILED;
  29958. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  29959. }
  29960. if (s3 !== peg$FAILED) {
  29961. s4 = peg$parsews();
  29962. if (s4 !== peg$FAILED) {
  29963. s5 = peg$parserawString();
  29964. if (s5 !== peg$FAILED) {
  29965. s6 = peg$parsews();
  29966. if (s6 !== peg$FAILED) {
  29967. if (input.charCodeAt(peg$currPos) === 62) {
  29968. s7 = peg$c120;
  29969. peg$currPos++;
  29970. } else {
  29971. s7 = peg$FAILED;
  29972. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29973. }
  29974. if (s7 !== peg$FAILED) {
  29975. peg$savedPos = s0;
  29976. s1 = peg$c126(s5);
  29977. s0 = s1;
  29978. } else {
  29979. peg$currPos = s0;
  29980. s0 = peg$FAILED;
  29981. }
  29982. } else {
  29983. peg$currPos = s0;
  29984. s0 = peg$FAILED;
  29985. }
  29986. } else {
  29987. peg$currPos = s0;
  29988. s0 = peg$FAILED;
  29989. }
  29990. } else {
  29991. peg$currPos = s0;
  29992. s0 = peg$FAILED;
  29993. }
  29994. } else {
  29995. peg$currPos = s0;
  29996. s0 = peg$FAILED;
  29997. }
  29998. } else {
  29999. peg$currPos = s0;
  30000. s0 = peg$FAILED;
  30001. }
  30002. } else {
  30003. peg$currPos = s0;
  30004. s0 = peg$FAILED;
  30005. }
  30006. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30007. return s0;
  30008. }
  30009. function peg$parsemethod() {
  30010. var s0, s1, s2;
  30011. var key = peg$currPos * 63 + 59,
  30012. cached = peg$resultsCache[key];
  30013. if (cached) {
  30014. peg$currPos = cached.nextPos;
  30015. return cached.result;
  30016. }
  30017. s0 = peg$currPos;
  30018. s1 = peg$parsewsKeywordPattern();
  30019. if (s1 === peg$FAILED) {
  30020. s1 = peg$parsewsBinaryPattern();
  30021. if (s1 === peg$FAILED) {
  30022. s1 = peg$parsewsUnaryPattern();
  30023. }
  30024. }
  30025. if (s1 !== peg$FAILED) {
  30026. s2 = peg$parsewsSequenceWs();
  30027. if (s2 !== peg$FAILED) {
  30028. peg$savedPos = s0;
  30029. s1 = peg$c127(s1, s2);
  30030. s0 = s1;
  30031. } else {
  30032. peg$currPos = s0;
  30033. s0 = peg$FAILED;
  30034. }
  30035. } else {
  30036. peg$currPos = s0;
  30037. s0 = peg$FAILED;
  30038. }
  30039. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30040. return s0;
  30041. }
  30042. function peg$parseassociationSend() {
  30043. var s0, s1, s2;
  30044. var key = peg$currPos * 63 + 60,
  30045. cached = peg$resultsCache[key];
  30046. if (cached) {
  30047. peg$currPos = cached.nextPos;
  30048. return cached.result;
  30049. }
  30050. s0 = peg$currPos;
  30051. s1 = peg$parsebinarySend();
  30052. if (s1 !== peg$FAILED) {
  30053. peg$savedPos = peg$currPos;
  30054. s2 = peg$c128(s1);
  30055. if (s2) {
  30056. s2 = void 0;
  30057. } else {
  30058. s2 = peg$FAILED;
  30059. }
  30060. if (s2 !== peg$FAILED) {
  30061. peg$savedPos = s0;
  30062. s1 = peg$c129(s1);
  30063. s0 = s1;
  30064. } else {
  30065. peg$currPos = s0;
  30066. s0 = peg$FAILED;
  30067. }
  30068. } else {
  30069. peg$currPos = s0;
  30070. s0 = peg$FAILED;
  30071. }
  30072. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30073. return s0;
  30074. }
  30075. function peg$parsewsAssociationsRest() {
  30076. var s0, s1, s2;
  30077. var key = peg$currPos * 63 + 61,
  30078. cached = peg$resultsCache[key];
  30079. if (cached) {
  30080. peg$currPos = cached.nextPos;
  30081. return cached.result;
  30082. }
  30083. s0 = peg$currPos;
  30084. s1 = peg$parsesomeDotsWs();
  30085. if (s1 !== peg$FAILED) {
  30086. s2 = peg$parseassociationSend();
  30087. if (s2 !== peg$FAILED) {
  30088. peg$savedPos = s0;
  30089. s1 = peg$c79(s2);
  30090. s0 = s1;
  30091. } else {
  30092. peg$currPos = s0;
  30093. s0 = peg$FAILED;
  30094. }
  30095. } else {
  30096. peg$currPos = s0;
  30097. s0 = peg$FAILED;
  30098. }
  30099. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30100. return s0;
  30101. }
  30102. function peg$parsewsAssociations() {
  30103. var s0, s1, s2, s3, s4;
  30104. var key = peg$currPos * 63 + 62,
  30105. cached = peg$resultsCache[key];
  30106. if (cached) {
  30107. peg$currPos = cached.nextPos;
  30108. return cached.result;
  30109. }
  30110. s0 = peg$currPos;
  30111. s1 = peg$parsemaybeDotsWs();
  30112. if (s1 !== peg$FAILED) {
  30113. s2 = peg$parseassociationSend();
  30114. if (s2 !== peg$FAILED) {
  30115. s3 = [];
  30116. s4 = peg$parsewsAssociationsRest();
  30117. while (s4 !== peg$FAILED) {
  30118. s3.push(s4);
  30119. s4 = peg$parsewsAssociationsRest();
  30120. }
  30121. if (s3 !== peg$FAILED) {
  30122. peg$savedPos = s0;
  30123. s1 = peg$c130(s2, s3);
  30124. s0 = s1;
  30125. } else {
  30126. peg$currPos = s0;
  30127. s0 = peg$FAILED;
  30128. }
  30129. } else {
  30130. peg$currPos = s0;
  30131. s0 = peg$FAILED;
  30132. }
  30133. } else {
  30134. peg$currPos = s0;
  30135. s0 = peg$FAILED;
  30136. }
  30137. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30138. return s0;
  30139. }
  30140. peg$result = peg$startRuleFunction();
  30141. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30142. return peg$result;
  30143. } else {
  30144. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30145. peg$fail({ type: "end", description: "end of input" });
  30146. }
  30147. throw peg$buildException(
  30148. null,
  30149. peg$maxFailExpected,
  30150. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30151. peg$maxFailPos < input.length
  30152. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30153. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30154. );
  30155. }
  30156. }
  30157. return {
  30158. SyntaxError: peg$SyntaxError,
  30159. parse: peg$parse
  30160. };
  30161. })();
  30162. });
  30163. 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";
  30164. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30165. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30166. $core.addPackage("Platform-ImportExport");
  30167. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30168. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30169. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30170. $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.";
  30171. $core.addMethod(
  30172. $core.method({
  30173. selector: "exportPackage:on:",
  30174. protocol: "output",
  30175. fn: function (aPackage,aStream){
  30176. var self=this,$self=this;
  30177. return $core.withContext(function($ctx1) {
  30178. $self._subclassResponsibility();
  30179. return self;
  30180. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30181. },
  30182. args: ["aPackage", "aStream"],
  30183. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30184. referencedClasses: [],
  30185. messageSends: ["subclassResponsibility"]
  30186. }),
  30187. $globals.AbstractExporter);
  30188. $core.addMethod(
  30189. $core.method({
  30190. selector: "extensionMethodsOfPackage:",
  30191. protocol: "accessing",
  30192. fn: function (aPackage){
  30193. var self=this,$self=this;
  30194. var result;
  30195. return $core.withContext(function($ctx1) {
  30196. result=$recv($globals.OrderedCollection)._new();
  30197. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30198. return $core.withContext(function($ctx2) {
  30199. return $recv(result)._addAll_($recv(each)._ownMethods());
  30200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30201. }));
  30202. return result;
  30203. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30204. },
  30205. args: ["aPackage"],
  30206. 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",
  30207. referencedClasses: ["OrderedCollection"],
  30208. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30209. }),
  30210. $globals.AbstractExporter);
  30211. $core.addMethod(
  30212. $core.method({
  30213. selector: "extensionProtocolsOfPackage:",
  30214. protocol: "accessing",
  30215. fn: function (aPackage){
  30216. var self=this,$self=this;
  30217. var extensionName,result;
  30218. return $core.withContext(function($ctx1) {
  30219. var $1,$2,$3;
  30220. $1=$recv(aPackage)._name();
  30221. $ctx1.sendIdx["name"]=1;
  30222. extensionName="*".__comma($1);
  30223. result=$recv($globals.OrderedCollection)._new();
  30224. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30225. return $core.withContext(function($ctx2) {
  30226. $2=$recv(a)._name();
  30227. $ctx2.sendIdx["name"]=2;
  30228. return $recv($2).__lt($recv(b)._name());
  30229. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30230. })))._do_((function(each){
  30231. return $core.withContext(function($ctx2) {
  30232. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30233. return $core.withContext(function($ctx3) {
  30234. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30235. if($core.assert($3)){
  30236. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30237. }
  30238. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30239. }));
  30240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30241. }));
  30242. $ctx1.sendIdx["do:"]=1;
  30243. return result;
  30244. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30245. },
  30246. args: ["aPackage"],
  30247. 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",
  30248. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30249. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30250. }),
  30251. $globals.AbstractExporter);
  30252. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30253. $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.";
  30254. $core.addMethod(
  30255. $core.method({
  30256. selector: "chunkEscape:",
  30257. protocol: "convenience",
  30258. fn: function (aString){
  30259. var self=this,$self=this;
  30260. return $core.withContext(function($ctx1) {
  30261. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30262. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30263. },
  30264. args: ["aString"],
  30265. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30266. referencedClasses: [],
  30267. messageSends: ["trimBoth", "replace:with:"]
  30268. }),
  30269. $globals.ChunkExporter);
  30270. $core.addMethod(
  30271. $core.method({
  30272. selector: "exportBehavior:on:",
  30273. protocol: "output",
  30274. fn: function (aBehavior,aStream){
  30275. var self=this,$self=this;
  30276. return $core.withContext(function($ctx1) {
  30277. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30278. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30279. return self;
  30280. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30281. },
  30282. args: ["aBehavior", "aStream"],
  30283. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30284. referencedClasses: [],
  30285. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30286. }),
  30287. $globals.ChunkExporter);
  30288. $core.addMethod(
  30289. $core.method({
  30290. selector: "exportCategoryEpilogueOf:on:",
  30291. protocol: "output",
  30292. fn: function (aCategory,aStream){
  30293. var self=this,$self=this;
  30294. return $core.withContext(function($ctx1) {
  30295. $recv(aStream)._write_(" !");
  30296. $recv(aStream)._lf();
  30297. $ctx1.sendIdx["lf"]=1;
  30298. $recv(aStream)._lf();
  30299. return self;
  30300. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30301. },
  30302. args: ["aCategory", "aStream"],
  30303. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30304. referencedClasses: [],
  30305. messageSends: ["write:", "lf"]
  30306. }),
  30307. $globals.ChunkExporter);
  30308. $core.addMethod(
  30309. $core.method({
  30310. selector: "exportCategoryPrologueOf:on:",
  30311. protocol: "output",
  30312. fn: function (aCategory,aStream){
  30313. var self=this,$self=this;
  30314. return $core.withContext(function($ctx1) {
  30315. $recv(aStream)._write_("!");
  30316. $ctx1.sendIdx["write:"]=1;
  30317. $recv(aStream)._print_($recv(aCategory)._theClass());
  30318. $ctx1.sendIdx["print:"]=1;
  30319. $recv(aStream)._write_(" methodsFor: ");
  30320. $ctx1.sendIdx["write:"]=2;
  30321. $recv(aStream)._print_(aCategory);
  30322. $recv(aStream)._write_("!");
  30323. return self;
  30324. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30325. },
  30326. args: ["aCategory", "aStream"],
  30327. 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: '!'",
  30328. referencedClasses: [],
  30329. messageSends: ["write:", "print:", "theClass"]
  30330. }),
  30331. $globals.ChunkExporter);
  30332. $core.addMethod(
  30333. $core.method({
  30334. selector: "exportDefinitionOf:on:",
  30335. protocol: "output",
  30336. fn: function (aClass,aStream){
  30337. var self=this,$self=this;
  30338. return $core.withContext(function($ctx1) {
  30339. var $1,$2,$3,$4;
  30340. $recv(aStream)._print_($recv(aClass)._superclass());
  30341. $ctx1.sendIdx["print:"]=1;
  30342. $recv(aStream)._write_(" subclass: ");
  30343. $ctx1.sendIdx["write:"]=1;
  30344. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30345. $1=$recv(aStream)._lf();
  30346. $ctx1.sendIdx["lf"]=1;
  30347. $recv(aStream)._tab();
  30348. $ctx1.sendIdx["tab"]=1;
  30349. $recv(aStream)._write_("instanceVariableNames: ");
  30350. $ctx1.sendIdx["write:"]=2;
  30351. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30352. $ctx1.sendIdx["print:"]=2;
  30353. $recv(aStream)._lf();
  30354. $ctx1.sendIdx["lf"]=2;
  30355. $recv(aStream)._tab();
  30356. $recv(aStream)._write_("package: ");
  30357. $ctx1.sendIdx["write:"]=3;
  30358. $recv(aStream)._print_($recv(aClass)._category());
  30359. $ctx1.sendIdx["print:"]=3;
  30360. $recv(aStream)._write_("!");
  30361. $ctx1.sendIdx["write:"]=4;
  30362. $2=$recv(aStream)._lf();
  30363. $ctx1.sendIdx["lf"]=3;
  30364. $3=$recv(aClass)._comment();
  30365. $ctx1.sendIdx["comment"]=1;
  30366. $recv($3)._ifNotEmpty_((function(){
  30367. return $core.withContext(function($ctx2) {
  30368. $recv(aStream)._write_("!");
  30369. $ctx2.sendIdx["write:"]=5;
  30370. $recv(aStream)._print_(aClass);
  30371. $recv(aStream)._write_(" commentStamp!");
  30372. $ctx2.sendIdx["write:"]=6;
  30373. $recv(aStream)._lf();
  30374. $ctx2.sendIdx["lf"]=4;
  30375. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30376. $4=$recv(aStream)._lf();
  30377. $ctx2.sendIdx["lf"]=5;
  30378. return $4;
  30379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30380. }));
  30381. $recv(aStream)._lf();
  30382. return self;
  30383. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30384. },
  30385. args: ["aClass", "aStream"],
  30386. 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",
  30387. referencedClasses: [],
  30388. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30389. }),
  30390. $globals.ChunkExporter);
  30391. $core.addMethod(
  30392. $core.method({
  30393. selector: "exportMetaDefinitionOf:on:",
  30394. protocol: "output",
  30395. fn: function (aClass,aStream){
  30396. var self=this,$self=this;
  30397. var classIvars,classTraitComposition;
  30398. return $core.withContext(function($ctx1) {
  30399. var $1,$2;
  30400. $1=$recv(aClass)._class();
  30401. $ctx1.sendIdx["class"]=1;
  30402. classIvars=$recv($1)._instanceVariableNames();
  30403. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30404. $2=$recv(classIvars)._notEmpty();
  30405. if($core.assert($2)){
  30406. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30407. $ctx1.sendIdx["print:"]=1;
  30408. $recv(aStream)._space();
  30409. $recv(aStream)._write_("instanceVariableNames: ");
  30410. $ctx1.sendIdx["write:"]=1;
  30411. $recv(aStream)._print_(" "._join_(classIvars));
  30412. $recv(aStream)._write_("!");
  30413. $recv(aStream)._lf();
  30414. $ctx1.sendIdx["lf"]=1;
  30415. $recv(aStream)._lf();
  30416. }
  30417. return self;
  30418. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30419. },
  30420. args: ["aClass", "aStream"],
  30421. 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 ]",
  30422. referencedClasses: [],
  30423. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30424. }),
  30425. $globals.ChunkExporter);
  30426. $core.addMethod(
  30427. $core.method({
  30428. selector: "exportMethod:on:",
  30429. protocol: "output",
  30430. fn: function (aMethod,aStream){
  30431. var self=this,$self=this;
  30432. return $core.withContext(function($ctx1) {
  30433. $recv(aStream)._lf();
  30434. $ctx1.sendIdx["lf"]=1;
  30435. $recv(aStream)._lf();
  30436. $ctx1.sendIdx["lf"]=2;
  30437. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30438. $ctx1.sendIdx["write:"]=1;
  30439. $recv(aStream)._lf();
  30440. $recv(aStream)._write_("!");
  30441. return self;
  30442. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30443. },
  30444. args: ["aMethod", "aStream"],
  30445. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30446. referencedClasses: [],
  30447. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30448. }),
  30449. $globals.ChunkExporter);
  30450. $core.addMethod(
  30451. $core.method({
  30452. selector: "exportPackage:on:",
  30453. protocol: "output",
  30454. fn: function (aPackage,aStream){
  30455. var self=this,$self=this;
  30456. return $core.withContext(function($ctx1) {
  30457. var $1,$receiver;
  30458. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30459. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30460. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30461. return $core.withContext(function($ctx2) {
  30462. $self._exportBehavior_on_(each,aStream);
  30463. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30464. $1=$recv(each)._theMetaClass();
  30465. if(($receiver = $1) == null || $receiver.a$nil){
  30466. return $1;
  30467. } else {
  30468. var meta;
  30469. meta=$receiver;
  30470. return $self._exportBehavior_on_(meta,aStream);
  30471. }
  30472. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30473. }));
  30474. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30475. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30476. return self;
  30477. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30478. },
  30479. args: ["aPackage", "aStream"],
  30480. 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",
  30481. referencedClasses: [],
  30482. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30483. }),
  30484. $globals.ChunkExporter);
  30485. $core.addMethod(
  30486. $core.method({
  30487. selector: "exportPackageDefinitionOf:on:",
  30488. protocol: "output",
  30489. fn: function (aPackage,aStream){
  30490. var self=this,$self=this;
  30491. return $core.withContext(function($ctx1) {
  30492. $recv(aStream)._write_("Smalltalk createPackage: ");
  30493. $ctx1.sendIdx["write:"]=1;
  30494. $recv(aStream)._print_($recv(aPackage)._name());
  30495. $recv(aStream)._write_("!");
  30496. $recv(aStream)._lf();
  30497. return self;
  30498. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30499. },
  30500. args: ["aPackage", "aStream"],
  30501. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30502. referencedClasses: [],
  30503. messageSends: ["write:", "print:", "name", "lf"]
  30504. }),
  30505. $globals.ChunkExporter);
  30506. $core.addMethod(
  30507. $core.method({
  30508. selector: "exportPackageImportsOf:on:",
  30509. protocol: "output",
  30510. fn: function (aPackage,aStream){
  30511. var self=this,$self=this;
  30512. return $core.withContext(function($ctx1) {
  30513. var $1;
  30514. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30515. return $core.withContext(function($ctx2) {
  30516. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30517. $ctx2.sendIdx["write:"]=1;
  30518. $1=$recv(aPackage)._name();
  30519. $ctx2.sendIdx["name"]=1;
  30520. $recv(aStream)._print_($1);
  30521. $ctx2.sendIdx["print:"]=1;
  30522. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30523. $ctx2.sendIdx["write:"]=2;
  30524. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30525. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30526. return $recv(aStream)._lf();
  30527. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30528. }));
  30529. return self;
  30530. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30531. },
  30532. args: ["aPackage", "aStream"],
  30533. 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 ]",
  30534. referencedClasses: [],
  30535. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30536. }),
  30537. $globals.ChunkExporter);
  30538. $core.addMethod(
  30539. $core.method({
  30540. selector: "exportPackageTraitCompositionsOf:on:",
  30541. protocol: "output",
  30542. fn: function (aPackage,aStream){
  30543. var self=this,$self=this;
  30544. return $core.withContext(function($ctx1) {
  30545. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30546. return $core.withContext(function($ctx2) {
  30547. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30548. return $core.withContext(function($ctx3) {
  30549. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30550. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30551. }));
  30552. $recv(aStream)._write_("! !");
  30553. $recv(aStream)._lf();
  30554. $ctx2.sendIdx["lf"]=1;
  30555. return $recv(aStream)._lf();
  30556. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30557. }));
  30558. return self;
  30559. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30560. },
  30561. args: ["aPackage", "aStream"],
  30562. 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 ]",
  30563. referencedClasses: [],
  30564. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30565. }),
  30566. $globals.ChunkExporter);
  30567. $core.addMethod(
  30568. $core.method({
  30569. selector: "exportProtocol:on:",
  30570. protocol: "output",
  30571. fn: function (aProtocol,aStream){
  30572. var self=this,$self=this;
  30573. return $core.withContext(function($ctx1) {
  30574. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30575. return $core.withContext(function($ctx2) {
  30576. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30577. $recv(methods)._do_((function(method){
  30578. return $core.withContext(function($ctx3) {
  30579. return $self._exportMethod_on_(method,aStream);
  30580. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30581. }));
  30582. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30583. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30584. }));
  30585. return self;
  30586. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30587. },
  30588. args: ["aProtocol", "aStream"],
  30589. 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 ]",
  30590. referencedClasses: [],
  30591. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30592. }),
  30593. $globals.ChunkExporter);
  30594. $core.addMethod(
  30595. $core.method({
  30596. selector: "exportProtocolEpilogueOf:on:",
  30597. protocol: "output",
  30598. fn: function (aProtocol,aStream){
  30599. var self=this,$self=this;
  30600. return $core.withContext(function($ctx1) {
  30601. $recv(aStream)._write_(" !");
  30602. $recv(aStream)._lf();
  30603. $ctx1.sendIdx["lf"]=1;
  30604. $recv(aStream)._lf();
  30605. return self;
  30606. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30607. },
  30608. args: ["aProtocol", "aStream"],
  30609. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30610. referencedClasses: [],
  30611. messageSends: ["write:", "lf"]
  30612. }),
  30613. $globals.ChunkExporter);
  30614. $core.addMethod(
  30615. $core.method({
  30616. selector: "exportProtocolPrologueOf:on:",
  30617. protocol: "output",
  30618. fn: function (aProtocol,aStream){
  30619. var self=this,$self=this;
  30620. return $core.withContext(function($ctx1) {
  30621. $recv(aStream)._write_("!");
  30622. $ctx1.sendIdx["write:"]=1;
  30623. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30624. $ctx1.sendIdx["print:"]=1;
  30625. $recv(aStream)._write_(" methodsFor: ");
  30626. $ctx1.sendIdx["write:"]=2;
  30627. $recv(aStream)._print_($recv(aProtocol)._name());
  30628. $recv(aStream)._write_("!");
  30629. return self;
  30630. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30631. },
  30632. args: ["aProtocol", "aStream"],
  30633. 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: '!'",
  30634. referencedClasses: [],
  30635. messageSends: ["write:", "print:", "theClass", "name"]
  30636. }),
  30637. $globals.ChunkExporter);
  30638. $core.addMethod(
  30639. $core.method({
  30640. selector: "exportProtocols:on:",
  30641. protocol: "output",
  30642. fn: function (aCollection,aStream){
  30643. var self=this,$self=this;
  30644. return $core.withContext(function($ctx1) {
  30645. $recv(aCollection)._do_((function(each){
  30646. return $core.withContext(function($ctx2) {
  30647. return $self._exportProtocol_on_(each,aStream);
  30648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30649. }));
  30650. return self;
  30651. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30652. },
  30653. args: ["aCollection", "aStream"],
  30654. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30655. referencedClasses: [],
  30656. messageSends: ["do:", "exportProtocol:on:"]
  30657. }),
  30658. $globals.ChunkExporter);
  30659. $core.addMethod(
  30660. $core.method({
  30661. selector: "exportTraitComposition:of:on:",
  30662. protocol: "output",
  30663. fn: function (aTraitComposition,aBehavior,aStream){
  30664. var self=this,$self=this;
  30665. return $core.withContext(function($ctx1) {
  30666. $recv(aStream)._print_(aBehavior);
  30667. $recv(aStream)._write_(" setTraitComposition: ");
  30668. $ctx1.sendIdx["write:"]=1;
  30669. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30670. $ctx1.sendIdx["write:"]=2;
  30671. $recv(aStream)._write_(" asTraitComposition!");
  30672. $recv(aStream)._lf();
  30673. return self;
  30674. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30675. },
  30676. args: ["aTraitComposition", "aBehavior", "aStream"],
  30677. 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",
  30678. referencedClasses: [],
  30679. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30680. }),
  30681. $globals.ChunkExporter);
  30682. $core.addMethod(
  30683. $core.method({
  30684. selector: "exportTraitDefinitionOf:on:",
  30685. protocol: "output",
  30686. fn: function (aClass,aStream){
  30687. var self=this,$self=this;
  30688. return $core.withContext(function($ctx1) {
  30689. var $1,$2,$3,$4;
  30690. $recv(aStream)._write_("Trait named: ");
  30691. $ctx1.sendIdx["write:"]=1;
  30692. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30693. $1=$recv(aStream)._lf();
  30694. $ctx1.sendIdx["lf"]=1;
  30695. $recv(aStream)._tab();
  30696. $recv(aStream)._write_("package: ");
  30697. $ctx1.sendIdx["write:"]=2;
  30698. $recv(aStream)._print_($recv(aClass)._category());
  30699. $ctx1.sendIdx["print:"]=1;
  30700. $recv(aStream)._write_("!");
  30701. $ctx1.sendIdx["write:"]=3;
  30702. $2=$recv(aStream)._lf();
  30703. $ctx1.sendIdx["lf"]=2;
  30704. $3=$recv(aClass)._comment();
  30705. $ctx1.sendIdx["comment"]=1;
  30706. $recv($3)._ifNotEmpty_((function(){
  30707. return $core.withContext(function($ctx2) {
  30708. $recv(aStream)._write_("!");
  30709. $ctx2.sendIdx["write:"]=4;
  30710. $recv(aStream)._print_(aClass);
  30711. $recv(aStream)._write_(" commentStamp!");
  30712. $ctx2.sendIdx["write:"]=5;
  30713. $recv(aStream)._lf();
  30714. $ctx2.sendIdx["lf"]=3;
  30715. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30716. $4=$recv(aStream)._lf();
  30717. $ctx2.sendIdx["lf"]=4;
  30718. return $4;
  30719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30720. }));
  30721. $recv(aStream)._lf();
  30722. return self;
  30723. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30724. },
  30725. args: ["aClass", "aStream"],
  30726. 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",
  30727. referencedClasses: [],
  30728. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30729. }),
  30730. $globals.ChunkExporter);
  30731. $core.addMethod(
  30732. $core.method({
  30733. selector: "extensionCategoriesOfPackage:",
  30734. protocol: "accessing",
  30735. fn: function (aPackage){
  30736. var self=this,$self=this;
  30737. var name,map,result;
  30738. return $core.withContext(function($ctx1) {
  30739. var $1;
  30740. name=$recv(aPackage)._name();
  30741. result=$recv($globals.OrderedCollection)._new();
  30742. $ctx1.sendIdx["new"]=1;
  30743. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30744. return $core.withContext(function($ctx2) {
  30745. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30746. return $core.withContext(function($ctx3) {
  30747. map=$recv($globals.Dictionary)._new();
  30748. map;
  30749. $recv(aClass)._protocolsDo_((function(category,methods){
  30750. return $core.withContext(function($ctx4) {
  30751. $1=$recv(category).__eq("*".__comma(name));
  30752. if($core.assert($1)){
  30753. return $recv(map)._at_put_(category,methods);
  30754. }
  30755. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30756. }));
  30757. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30758. return $core.withContext(function($ctx4) {
  30759. return $recv(a).__lt_eq(b);
  30760. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30761. })))._collect_((function(category){
  30762. return $core.withContext(function($ctx4) {
  30763. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30764. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30765. })));
  30766. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30767. }));
  30768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30769. }));
  30770. $ctx1.sendIdx["do:"]=1;
  30771. return result;
  30772. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30773. },
  30774. args: ["aPackage"],
  30775. 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",
  30776. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30777. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30778. }),
  30779. $globals.ChunkExporter);
  30780. $core.addMethod(
  30781. $core.method({
  30782. selector: "ownCategoriesOfClass:",
  30783. protocol: "accessing",
  30784. fn: function (aClass){
  30785. var self=this,$self=this;
  30786. var map;
  30787. return $core.withContext(function($ctx1) {
  30788. var $1;
  30789. map=$recv($globals.Dictionary)._new();
  30790. $recv(aClass)._protocolsDo_((function(each,methods){
  30791. return $core.withContext(function($ctx2) {
  30792. $1=$recv(each)._match_("^\x5c*");
  30793. if(!$core.assert($1)){
  30794. return $recv(map)._at_put_(each,methods);
  30795. }
  30796. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30797. }));
  30798. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30799. return $core.withContext(function($ctx2) {
  30800. return $recv(a).__lt_eq(b);
  30801. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30802. })))._collect_((function(each){
  30803. return $core.withContext(function($ctx2) {
  30804. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30806. }));
  30807. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30808. },
  30809. args: ["aClass"],
  30810. 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) ]",
  30811. referencedClasses: ["Dictionary", "MethodCategory"],
  30812. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30813. }),
  30814. $globals.ChunkExporter);
  30815. $core.addMethod(
  30816. $core.method({
  30817. selector: "ownCategoriesOfMetaClass:",
  30818. protocol: "accessing",
  30819. fn: function (aClass){
  30820. var self=this,$self=this;
  30821. return $core.withContext(function($ctx1) {
  30822. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30823. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30824. },
  30825. args: ["aClass"],
  30826. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30827. referencedClasses: [],
  30828. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30829. }),
  30830. $globals.ChunkExporter);
  30831. $core.addMethod(
  30832. $core.method({
  30833. selector: "ownMethodProtocolsOfClass:",
  30834. protocol: "accessing",
  30835. fn: function (aClass){
  30836. var self=this,$self=this;
  30837. return $core.withContext(function($ctx1) {
  30838. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30839. return $core.withContext(function($ctx2) {
  30840. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30842. }));
  30843. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30844. },
  30845. args: ["aClass"],
  30846. 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 ]",
  30847. referencedClasses: ["ExportMethodProtocol"],
  30848. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30849. }),
  30850. $globals.ChunkExporter);
  30851. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30852. $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.).";
  30853. $core.addMethod(
  30854. $core.method({
  30855. selector: "exportBehavior:on:",
  30856. protocol: "output",
  30857. fn: function (aBehavior,aStream){
  30858. var self=this,$self=this;
  30859. return $core.withContext(function($ctx1) {
  30860. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30861. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30862. return $core.withContext(function($ctx2) {
  30863. return $self._exportMethod_on_(method,aStream);
  30864. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30865. }));
  30866. return self;
  30867. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30868. },
  30869. args: ["aBehavior", "aStream"],
  30870. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30871. referencedClasses: [],
  30872. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30873. }),
  30874. $globals.Exporter);
  30875. $core.addMethod(
  30876. $core.method({
  30877. selector: "exportDefinitionOf:on:",
  30878. protocol: "output",
  30879. fn: function (aClass,aStream){
  30880. var self=this,$self=this;
  30881. return $core.withContext(function($ctx1) {
  30882. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30883. $recv(aStream)._lf();
  30884. $ctx1.sendIdx["lf"]=1;
  30885. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30886. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30887. $5=$recv(aClass)._superclass();
  30888. if(($receiver = $5) == null || $receiver.a$nil){
  30889. $4="null";
  30890. } else {
  30891. var superclass;
  30892. superclass=$receiver;
  30893. $4=$recv(superclass)._asJavaScriptSource();
  30894. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30895. }
  30896. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30897. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30898. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30899. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30900. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30901. $1=$recv(aStream)._write_($2);
  30902. $ctx1.sendIdx["write:"]=1;
  30903. $8=$recv(aClass)._comment();
  30904. $ctx1.sendIdx["comment"]=1;
  30905. $recv($8)._ifNotEmpty_((function(){
  30906. return $core.withContext(function($ctx2) {
  30907. $recv(aStream)._lf();
  30908. $ctx2.sendIdx["lf"]=2;
  30909. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30910. $ctx2.sendIdx["write:"]=2;
  30911. $recv(aStream)._lf();
  30912. $ctx2.sendIdx["lf"]=3;
  30913. $10=$recv(aClass)._asJavaScriptSource();
  30914. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30915. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30916. $recv(aStream)._write_($9);
  30917. $ctx2.sendIdx["write:"]=3;
  30918. $recv(aStream)._lf();
  30919. $ctx2.sendIdx["lf"]=4;
  30920. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30922. }));
  30923. $recv(aStream)._lf();
  30924. return self;
  30925. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30926. },
  30927. args: ["aClass", "aStream"],
  30928. 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",
  30929. referencedClasses: [],
  30930. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30931. }),
  30932. $globals.Exporter);
  30933. $core.addMethod(
  30934. $core.method({
  30935. selector: "exportMetaDefinitionOf:on:",
  30936. protocol: "output",
  30937. fn: function (aClass,aStream){
  30938. var self=this,$self=this;
  30939. return $core.withContext(function($ctx1) {
  30940. var $2,$1,$4,$3;
  30941. $recv(aStream)._lf();
  30942. $ctx1.sendIdx["lf"]=1;
  30943. $2=$recv(aClass)._theMetaClass();
  30944. $ctx1.sendIdx["theMetaClass"]=1;
  30945. $1=$recv($2)._instanceVariableNames();
  30946. $recv($1)._ifNotEmpty_((function(classIvars){
  30947. return $core.withContext(function($ctx2) {
  30948. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  30949. $ctx2.sendIdx["asJavaScriptSource"]=1;
  30950. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  30951. $recv(aStream)._write_($3);
  30952. return $recv(aStream)._lf();
  30953. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  30954. }));
  30955. return self;
  30956. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30957. },
  30958. args: ["aClass", "aStream"],
  30959. 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 ]",
  30960. referencedClasses: [],
  30961. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  30962. }),
  30963. $globals.Exporter);
  30964. $core.addMethod(
  30965. $core.method({
  30966. selector: "exportMethod:on:",
  30967. protocol: "output",
  30968. fn: function (aMethod,aStream){
  30969. var self=this,$self=this;
  30970. return $core.withContext(function($ctx1) {
  30971. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  30972. $recv(aStream)._write_("$core.addMethod(");
  30973. $ctx1.sendIdx["write:"]=1;
  30974. $recv(aStream)._lf();
  30975. $ctx1.sendIdx["lf"]=1;
  30976. $recv(aStream)._write_("$core.method({");
  30977. $ctx1.sendIdx["write:"]=2;
  30978. $recv(aStream)._lf();
  30979. $ctx1.sendIdx["lf"]=2;
  30980. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  30981. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30982. $1=["selector: ",$2,","];
  30983. $recv(aStream)._write_($1);
  30984. $ctx1.sendIdx["write:"]=3;
  30985. $recv(aStream)._lf();
  30986. $ctx1.sendIdx["lf"]=3;
  30987. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  30988. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30989. $3=["protocol: ",$4,","];
  30990. $recv(aStream)._write_($3);
  30991. $ctx1.sendIdx["write:"]=4;
  30992. $recv(aStream)._lf();
  30993. $ctx1.sendIdx["lf"]=4;
  30994. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  30995. $ctx1.sendIdx["write:"]=5;
  30996. $recv(aStream)._lf();
  30997. $ctx1.sendIdx["lf"]=5;
  30998. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30999. $ctx1.sendIdx["write:"]=6;
  31000. $recv(aStream)._lf();
  31001. $ctx1.sendIdx["lf"]=6;
  31002. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31003. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31004. $5=["args: ",$6,","];
  31005. $recv(aStream)._write_($5);
  31006. $ctx1.sendIdx["write:"]=7;
  31007. $recv(aStream)._lf();
  31008. $ctx1.sendIdx["lf"]=7;
  31009. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31010. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31011. $7=["source: ",$8,","];
  31012. $recv(aStream)._write_($7);
  31013. $ctx1.sendIdx["write:"]=8;
  31014. $recv(aStream)._lf();
  31015. $ctx1.sendIdx["lf"]=8;
  31016. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31017. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31018. $9=["referencedClasses: ",$10,","];
  31019. $recv(aStream)._write_($9);
  31020. $ctx1.sendIdx["write:"]=9;
  31021. $recv(aStream)._lf();
  31022. $ctx1.sendIdx["lf"]=9;
  31023. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31024. $ctx1.sendIdx["write:"]=10;
  31025. $recv(aStream)._lf();
  31026. $ctx1.sendIdx["lf"]=10;
  31027. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31028. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31029. $11=["messageSends: ",$12];
  31030. $recv(aStream)._write_($11);
  31031. $ctx1.sendIdx["write:"]=11;
  31032. $recv(aStream)._lf();
  31033. $ctx1.sendIdx["lf"]=11;
  31034. $recv(aStream)._write_("}),");
  31035. $ctx1.sendIdx["write:"]=12;
  31036. $recv(aStream)._lf();
  31037. $ctx1.sendIdx["lf"]=12;
  31038. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31039. $recv(aStream)._lf();
  31040. $ctx1.sendIdx["lf"]=13;
  31041. $recv(aStream)._lf();
  31042. return self;
  31043. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31044. },
  31045. args: ["aMethod", "aStream"],
  31046. 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",
  31047. referencedClasses: [],
  31048. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31049. }),
  31050. $globals.Exporter);
  31051. $core.addMethod(
  31052. $core.method({
  31053. selector: "exportPackage:on:",
  31054. protocol: "output",
  31055. fn: function (aPackage,aStream){
  31056. var self=this,$self=this;
  31057. return $core.withContext(function($ctx1) {
  31058. var $1,$receiver;
  31059. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31060. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31061. $self._exportPackageContextOf_on_(aPackage,aStream);
  31062. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31063. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31064. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31065. return $core.withContext(function($ctx2) {
  31066. $self._exportBehavior_on_(each,aStream);
  31067. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31068. $1=$recv(each)._theMetaClass();
  31069. if(($receiver = $1) == null || $receiver.a$nil){
  31070. return $1;
  31071. } else {
  31072. var meta;
  31073. meta=$receiver;
  31074. return $self._exportBehavior_on_(meta,aStream);
  31075. }
  31076. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31077. }));
  31078. $ctx1.sendIdx["do:"]=1;
  31079. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31080. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31081. return $core.withContext(function($ctx2) {
  31082. return $self._exportMethod_on_(each,aStream);
  31083. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31084. }));
  31085. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31086. return self;
  31087. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31088. },
  31089. args: ["aPackage", "aStream"],
  31090. 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",
  31091. referencedClasses: [],
  31092. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31093. }),
  31094. $globals.Exporter);
  31095. $core.addMethod(
  31096. $core.method({
  31097. selector: "exportPackageBodyBlockPrologueOf:on:",
  31098. protocol: "output",
  31099. fn: function (aPackage,aStream){
  31100. var self=this,$self=this;
  31101. return $core.withContext(function($ctx1) {
  31102. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31103. $ctx1.sendIdx["write:"]=1;
  31104. $recv(aStream)._lf();
  31105. $ctx1.sendIdx["lf"]=1;
  31106. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31107. $recv(aStream)._lf();
  31108. return self;
  31109. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31110. },
  31111. args: ["aPackage", "aStream"],
  31112. 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",
  31113. referencedClasses: [],
  31114. messageSends: ["write:", "lf"]
  31115. }),
  31116. $globals.Exporter);
  31117. $core.addMethod(
  31118. $core.method({
  31119. selector: "exportPackageContextOf:on:",
  31120. protocol: "output",
  31121. fn: function (aPackage,aStream){
  31122. var self=this,$self=this;
  31123. return $core.withContext(function($ctx1) {
  31124. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  31125. $recv(aStream)._lf();
  31126. return self;
  31127. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31128. },
  31129. args: ["aPackage", "aStream"],
  31130. 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",
  31131. referencedClasses: [],
  31132. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31133. }),
  31134. $globals.Exporter);
  31135. $core.addMethod(
  31136. $core.method({
  31137. selector: "exportPackageDefinitionOf:on:",
  31138. protocol: "output",
  31139. fn: function (aPackage,aStream){
  31140. var self=this,$self=this;
  31141. return $core.withContext(function($ctx1) {
  31142. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31143. $recv(aStream)._lf();
  31144. return self;
  31145. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31146. },
  31147. args: ["aPackage", "aStream"],
  31148. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31149. referencedClasses: [],
  31150. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31151. }),
  31152. $globals.Exporter);
  31153. $core.addMethod(
  31154. $core.method({
  31155. selector: "exportPackageEpilogueOf:on:",
  31156. protocol: "output",
  31157. fn: function (aPackage,aStream){
  31158. var self=this,$self=this;
  31159. return $core.withContext(function($ctx1) {
  31160. $self._subclassResponsibility();
  31161. return self;
  31162. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31163. },
  31164. args: ["aPackage", "aStream"],
  31165. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31166. referencedClasses: [],
  31167. messageSends: ["subclassResponsibility"]
  31168. }),
  31169. $globals.Exporter);
  31170. $core.addMethod(
  31171. $core.method({
  31172. selector: "exportPackageImportsOf:on:",
  31173. protocol: "output",
  31174. fn: function (aPackage,aStream){
  31175. var self=this,$self=this;
  31176. return $core.withContext(function($ctx1) {
  31177. var $2,$1;
  31178. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31179. return $core.withContext(function($ctx2) {
  31180. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31181. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31182. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31183. $recv(aStream)._write_($1);
  31184. return $recv(aStream)._lf();
  31185. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31186. }));
  31187. return self;
  31188. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31189. },
  31190. args: ["aPackage", "aStream"],
  31191. 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 ]",
  31192. referencedClasses: [],
  31193. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31194. }),
  31195. $globals.Exporter);
  31196. $core.addMethod(
  31197. $core.method({
  31198. selector: "exportPackagePrologueOf:on:",
  31199. protocol: "output",
  31200. fn: function (aPackage,aStream){
  31201. var self=this,$self=this;
  31202. return $core.withContext(function($ctx1) {
  31203. $self._subclassResponsibility();
  31204. return self;
  31205. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31206. },
  31207. args: ["aPackage", "aStream"],
  31208. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31209. referencedClasses: [],
  31210. messageSends: ["subclassResponsibility"]
  31211. }),
  31212. $globals.Exporter);
  31213. $core.addMethod(
  31214. $core.method({
  31215. selector: "exportPackageTraitCompositionsOf:on:",
  31216. protocol: "output",
  31217. fn: function (aPackage,aStream){
  31218. var self=this,$self=this;
  31219. return $core.withContext(function($ctx1) {
  31220. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31221. return $core.withContext(function($ctx2) {
  31222. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31223. return $core.withContext(function($ctx3) {
  31224. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31225. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31226. }));
  31227. return $recv(aStream)._lf();
  31228. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31229. }));
  31230. return self;
  31231. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31232. },
  31233. args: ["aPackage", "aStream"],
  31234. 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 ]",
  31235. referencedClasses: [],
  31236. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31237. }),
  31238. $globals.Exporter);
  31239. $core.addMethod(
  31240. $core.method({
  31241. selector: "exportPackageTransportOf:on:",
  31242. protocol: "output",
  31243. fn: function (aPackage,aStream){
  31244. var self=this,$self=this;
  31245. return $core.withContext(function($ctx1) {
  31246. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31247. $recv(aStream)._lf();
  31248. return self;
  31249. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31250. },
  31251. args: ["aPackage", "aStream"],
  31252. 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",
  31253. referencedClasses: [],
  31254. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31255. }),
  31256. $globals.Exporter);
  31257. $core.addMethod(
  31258. $core.method({
  31259. selector: "exportTraitComposition:of:on:",
  31260. protocol: "output",
  31261. fn: function (aTraitComposition,aBehavior,aStream){
  31262. var self=this,$self=this;
  31263. return $core.withContext(function($ctx1) {
  31264. var $2,$1;
  31265. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31266. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31267. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31268. $recv(aStream)._write_($1);
  31269. $recv(aStream)._lf();
  31270. return self;
  31271. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31272. },
  31273. args: ["aTraitComposition", "aBehavior", "aStream"],
  31274. 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",
  31275. referencedClasses: [],
  31276. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31277. }),
  31278. $globals.Exporter);
  31279. $core.addMethod(
  31280. $core.method({
  31281. selector: "exportTraitDefinitionOf:on:",
  31282. protocol: "output",
  31283. fn: function (aClass,aStream){
  31284. var self=this,$self=this;
  31285. return $core.withContext(function($ctx1) {
  31286. var $3,$4,$2,$1,$5,$7,$6;
  31287. $recv(aStream)._lf();
  31288. $ctx1.sendIdx["lf"]=1;
  31289. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31290. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31291. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31292. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31293. $2=["$core.addTrait(",$3,", ",$4,");"];
  31294. $1=$recv(aStream)._write_($2);
  31295. $ctx1.sendIdx["write:"]=1;
  31296. $5=$recv(aClass)._comment();
  31297. $ctx1.sendIdx["comment"]=1;
  31298. $recv($5)._ifNotEmpty_((function(){
  31299. return $core.withContext(function($ctx2) {
  31300. $recv(aStream)._lf();
  31301. $ctx2.sendIdx["lf"]=2;
  31302. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31303. $ctx2.sendIdx["write:"]=2;
  31304. $recv(aStream)._lf();
  31305. $ctx2.sendIdx["lf"]=3;
  31306. $7=$recv(aClass)._asJavaScriptSource();
  31307. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31308. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31309. $recv(aStream)._write_($6);
  31310. $ctx2.sendIdx["write:"]=3;
  31311. $recv(aStream)._lf();
  31312. $ctx2.sendIdx["lf"]=4;
  31313. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31315. }));
  31316. $recv(aStream)._lf();
  31317. return self;
  31318. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31319. },
  31320. args: ["aClass", "aStream"],
  31321. 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",
  31322. referencedClasses: [],
  31323. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31324. }),
  31325. $globals.Exporter);
  31326. $core.addMethod(
  31327. $core.method({
  31328. selector: "ownMethodsOfClass:",
  31329. protocol: "accessing",
  31330. fn: function (aClass){
  31331. var self=this,$self=this;
  31332. return $core.withContext(function($ctx1) {
  31333. var $1;
  31334. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31335. return $core.withContext(function($ctx2) {
  31336. $1=$recv(a)._selector();
  31337. $ctx2.sendIdx["selector"]=1;
  31338. return $recv($1).__lt_eq($recv(b)._selector());
  31339. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31340. })))._reject_((function(each){
  31341. return $core.withContext(function($ctx2) {
  31342. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31344. }));
  31345. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31346. },
  31347. args: ["aClass"],
  31348. 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*') ]",
  31349. referencedClasses: [],
  31350. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31351. }),
  31352. $globals.Exporter);
  31353. $core.addMethod(
  31354. $core.method({
  31355. selector: "ownMethodsOfMetaClass:",
  31356. protocol: "accessing",
  31357. fn: function (aClass){
  31358. var self=this,$self=this;
  31359. return $core.withContext(function($ctx1) {
  31360. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31361. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31362. },
  31363. args: ["aClass"],
  31364. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31365. referencedClasses: [],
  31366. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31367. }),
  31368. $globals.Exporter);
  31369. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31370. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31371. $core.addMethod(
  31372. $core.method({
  31373. selector: "amdNamesOfPackages:",
  31374. protocol: "private",
  31375. fn: function (anArray){
  31376. var self=this,$self=this;
  31377. return $core.withContext(function($ctx1) {
  31378. var $1;
  31379. return $recv($recv(anArray)._select_((function(each){
  31380. return $core.withContext(function($ctx2) {
  31381. $1=$self._amdNamespaceOfPackage_(each);
  31382. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31383. return $recv($1)._notNil();
  31384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31385. })))._collect_((function(each){
  31386. return $core.withContext(function($ctx2) {
  31387. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31388. $ctx2.sendIdx[","]=1;
  31389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31390. }));
  31391. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31392. },
  31393. args: ["anArray"],
  31394. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31395. referencedClasses: [],
  31396. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31397. }),
  31398. $globals.AmdExporter);
  31399. $core.addMethod(
  31400. $core.method({
  31401. selector: "amdNamespaceOfPackage:",
  31402. protocol: "private",
  31403. fn: function (aPackage){
  31404. var self=this,$self=this;
  31405. return $core.withContext(function($ctx1) {
  31406. var $3,$2,$1;
  31407. $3=$recv(aPackage)._transport();
  31408. $ctx1.sendIdx["transport"]=1;
  31409. $2=$recv($3)._type();
  31410. $1=$recv($2).__eq("amd");
  31411. if($core.assert($1)){
  31412. return $recv($recv(aPackage)._transport())._namespace();
  31413. } else {
  31414. return nil;
  31415. }
  31416. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31417. },
  31418. args: ["aPackage"],
  31419. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31420. referencedClasses: [],
  31421. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31422. }),
  31423. $globals.AmdExporter);
  31424. $core.addMethod(
  31425. $core.method({
  31426. selector: "exportPackageEpilogueOf:on:",
  31427. protocol: "output",
  31428. fn: function (aPackage,aStream){
  31429. var self=this,$self=this;
  31430. return $core.withContext(function($ctx1) {
  31431. $recv(aStream)._write_("});");
  31432. $recv(aStream)._lf();
  31433. return self;
  31434. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31435. },
  31436. args: ["aPackage", "aStream"],
  31437. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31438. referencedClasses: [],
  31439. messageSends: ["write:", "lf"]
  31440. }),
  31441. $globals.AmdExporter);
  31442. $core.addMethod(
  31443. $core.method({
  31444. selector: "exportPackagePrologueOf:on:",
  31445. protocol: "output",
  31446. fn: function (aPackage,aStream){
  31447. var self=this,$self=this;
  31448. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31449. return $core.withContext(function($ctx1) {
  31450. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31451. pragmaStart="";
  31452. pragmaEnd="";
  31453. importsForOutput=$self._importsForOutput_(aPackage);
  31454. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31455. $1=$recv(importsForOutput)._value();
  31456. $ctx1.sendIdx["value"]=1;
  31457. $recv($1)._ifNotEmpty_((function(){
  31458. return $core.withContext(function($ctx2) {
  31459. $3=$recv($globals.String)._lf();
  31460. $ctx2.sendIdx["lf"]=1;
  31461. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31462. $ctx2.sendIdx[","]=2;
  31463. $4=$recv($globals.String)._lf();
  31464. $ctx2.sendIdx["lf"]=2;
  31465. pragmaStart=$recv($2).__comma($4);
  31466. $ctx2.sendIdx[","]=1;
  31467. pragmaStart;
  31468. $6=$recv($globals.String)._lf();
  31469. $ctx2.sendIdx["lf"]=3;
  31470. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31471. $ctx2.sendIdx[","]=4;
  31472. $7=$recv($globals.String)._lf();
  31473. $ctx2.sendIdx["lf"]=4;
  31474. pragmaEnd=$recv($5).__comma($7);
  31475. $ctx2.sendIdx[","]=3;
  31476. return pragmaEnd;
  31477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31478. }));
  31479. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31480. $ctx1.sendIdx[","]=7;
  31481. $13=$recv($14).__comma([":2:"]);
  31482. $ctx1.sendIdx[","]=6;
  31483. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31484. $ctx1.sendIdx[","]=5;
  31485. $11=$recv($12)._asJavaScriptSource();
  31486. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31487. $ctx1.sendIdx["replace:with:"]=2;
  31488. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31489. $ctx1.sendIdx["replace:with:"]=1;
  31490. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31491. $ctx1.sendIdx[","]=8;
  31492. $17=$recv($18)._join_(",");
  31493. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31494. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31495. $ctx1.sendIdx["replace:with:"]=3;
  31496. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31497. $recv(aStream)._write_($8);
  31498. $recv(aStream)._lf();
  31499. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31500. return self;
  31501. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31502. },
  31503. args: ["aPackage", "aStream"],
  31504. 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",
  31505. referencedClasses: ["String"],
  31506. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31507. }),
  31508. $globals.AmdExporter);
  31509. $core.addMethod(
  31510. $core.method({
  31511. selector: "importsForOutput:",
  31512. protocol: "private",
  31513. fn: function (aPackage){
  31514. var self=this,$self=this;
  31515. var namedImports,anonImports,importVarNames;
  31516. return $core.withContext(function($ctx1) {
  31517. var $1;
  31518. namedImports=[];
  31519. anonImports=[];
  31520. importVarNames=[];
  31521. $recv($recv(aPackage)._imports())._do_((function(each){
  31522. return $core.withContext(function($ctx2) {
  31523. $1=$recv(each)._isString();
  31524. if($core.assert($1)){
  31525. return $recv(anonImports)._add_(each);
  31526. $ctx2.sendIdx["add:"]=1;
  31527. } else {
  31528. $recv(namedImports)._add_($recv(each)._value());
  31529. $ctx2.sendIdx["add:"]=2;
  31530. return $recv(importVarNames)._add_($recv(each)._key());
  31531. }
  31532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31533. }));
  31534. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31535. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31536. },
  31537. args: ["aPackage"],
  31538. 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)",
  31539. referencedClasses: [],
  31540. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31541. }),
  31542. $globals.AmdExporter);
  31543. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31544. $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";
  31545. $core.addMethod(
  31546. $core.method({
  31547. selector: "last",
  31548. protocol: "accessing",
  31549. fn: function (){
  31550. var self=this,$self=this;
  31551. return $self["@last"];
  31552. },
  31553. args: [],
  31554. source: "last\x0a\x09^ last",
  31555. referencedClasses: [],
  31556. messageSends: []
  31557. }),
  31558. $globals.ChunkParser);
  31559. $core.addMethod(
  31560. $core.method({
  31561. selector: "nextChunk",
  31562. protocol: "reading",
  31563. fn: function (){
  31564. var self=this,$self=this;
  31565. var char,result,chunk;
  31566. return $core.withContext(function($ctx1) {
  31567. var $1,$2,$3,$4;
  31568. var $early={};
  31569. try {
  31570. result=""._writeStream();
  31571. $recv((function(){
  31572. return $core.withContext(function($ctx2) {
  31573. char=$recv($self["@stream"])._next();
  31574. $ctx2.sendIdx["next"]=1;
  31575. char;
  31576. return $recv(char)._notNil();
  31577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31578. }))._whileTrue_((function(){
  31579. return $core.withContext(function($ctx2) {
  31580. $1=$recv(char).__eq("!");
  31581. $ctx2.sendIdx["="]=1;
  31582. if($core.assert($1)){
  31583. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31584. if($core.assert($2)){
  31585. $recv($self["@stream"])._next();
  31586. } else {
  31587. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31588. $3=$self["@last"];
  31589. throw $early=[$3];
  31590. }
  31591. }
  31592. return $recv(result)._nextPut_(char);
  31593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31594. }));
  31595. $self["@last"]=nil;
  31596. $4=$self["@last"];
  31597. return $4;
  31598. }
  31599. catch(e) {if(e===$early)return e[0]; throw e}
  31600. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31601. },
  31602. args: [],
  31603. 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",
  31604. referencedClasses: [],
  31605. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31606. }),
  31607. $globals.ChunkParser);
  31608. $core.addMethod(
  31609. $core.method({
  31610. selector: "stream:",
  31611. protocol: "accessing",
  31612. fn: function (aStream){
  31613. var self=this,$self=this;
  31614. $self["@stream"]=aStream;
  31615. return self;
  31616. },
  31617. args: ["aStream"],
  31618. source: "stream: aStream\x0a\x09stream := aStream",
  31619. referencedClasses: [],
  31620. messageSends: []
  31621. }),
  31622. $globals.ChunkParser);
  31623. $core.addMethod(
  31624. $core.method({
  31625. selector: "on:",
  31626. protocol: "instance creation",
  31627. fn: function (aStream){
  31628. var self=this,$self=this;
  31629. return $core.withContext(function($ctx1) {
  31630. return $recv($self._new())._stream_(aStream);
  31631. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31632. },
  31633. args: ["aStream"],
  31634. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31635. referencedClasses: [],
  31636. messageSends: ["stream:", "new"]
  31637. }),
  31638. $globals.ChunkParser.a$cls);
  31639. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31640. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31641. $core.addMethod(
  31642. $core.method({
  31643. selector: "class:",
  31644. protocol: "accessing",
  31645. fn: function (aClass){
  31646. var self=this,$self=this;
  31647. $self["@class"]=aClass;
  31648. return self;
  31649. },
  31650. args: ["aClass"],
  31651. source: "class: aClass\x0a\x09class := aClass",
  31652. referencedClasses: [],
  31653. messageSends: []
  31654. }),
  31655. $globals.ClassCommentReader);
  31656. $core.addMethod(
  31657. $core.method({
  31658. selector: "initialize",
  31659. protocol: "initialization",
  31660. fn: function (){
  31661. var self=this,$self=this;
  31662. return $core.withContext(function($ctx1) {
  31663. (
  31664. $ctx1.supercall = true,
  31665. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31666. $ctx1.supercall = false;
  31667. return self;
  31668. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31669. },
  31670. args: [],
  31671. source: "initialize\x0a\x09super initialize.",
  31672. referencedClasses: [],
  31673. messageSends: ["initialize"]
  31674. }),
  31675. $globals.ClassCommentReader);
  31676. $core.addMethod(
  31677. $core.method({
  31678. selector: "scanFrom:",
  31679. protocol: "fileIn",
  31680. fn: function (aChunkParser){
  31681. var self=this,$self=this;
  31682. var chunk;
  31683. return $core.withContext(function($ctx1) {
  31684. chunk=$recv(aChunkParser)._nextChunk();
  31685. $recv(chunk)._ifNotEmpty_((function(){
  31686. return $core.withContext(function($ctx2) {
  31687. return $self._setComment_(chunk);
  31688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31689. }));
  31690. return self;
  31691. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31692. },
  31693. args: ["aChunkParser"],
  31694. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31695. referencedClasses: [],
  31696. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31697. }),
  31698. $globals.ClassCommentReader);
  31699. $core.addMethod(
  31700. $core.method({
  31701. selector: "setComment:",
  31702. protocol: "private",
  31703. fn: function (aString){
  31704. var self=this,$self=this;
  31705. return $core.withContext(function($ctx1) {
  31706. $recv($self["@class"])._comment_(aString);
  31707. return self;
  31708. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31709. },
  31710. args: ["aString"],
  31711. source: "setComment: aString\x0a\x09class comment: aString",
  31712. referencedClasses: [],
  31713. messageSends: ["comment:"]
  31714. }),
  31715. $globals.ClassCommentReader);
  31716. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31717. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31718. $core.addMethod(
  31719. $core.method({
  31720. selector: "class:category:",
  31721. protocol: "accessing",
  31722. fn: function (aClass,aString){
  31723. var self=this,$self=this;
  31724. $self["@class"]=aClass;
  31725. $self["@category"]=aString;
  31726. return self;
  31727. },
  31728. args: ["aClass", "aString"],
  31729. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31730. referencedClasses: [],
  31731. messageSends: []
  31732. }),
  31733. $globals.ClassProtocolReader);
  31734. $core.addMethod(
  31735. $core.method({
  31736. selector: "compileMethod:",
  31737. protocol: "private",
  31738. fn: function (aString){
  31739. var self=this,$self=this;
  31740. return $core.withContext(function($ctx1) {
  31741. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31742. return self;
  31743. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31744. },
  31745. args: ["aString"],
  31746. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31747. referencedClasses: ["Compiler"],
  31748. messageSends: ["install:forClass:protocol:", "new"]
  31749. }),
  31750. $globals.ClassProtocolReader);
  31751. $core.addMethod(
  31752. $core.method({
  31753. selector: "initialize",
  31754. protocol: "initialization",
  31755. fn: function (){
  31756. var self=this,$self=this;
  31757. return $core.withContext(function($ctx1) {
  31758. (
  31759. $ctx1.supercall = true,
  31760. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31761. $ctx1.supercall = false;
  31762. return self;
  31763. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31764. },
  31765. args: [],
  31766. source: "initialize\x0a\x09super initialize.",
  31767. referencedClasses: [],
  31768. messageSends: ["initialize"]
  31769. }),
  31770. $globals.ClassProtocolReader);
  31771. $core.addMethod(
  31772. $core.method({
  31773. selector: "scanFrom:",
  31774. protocol: "fileIn",
  31775. fn: function (aChunkParser){
  31776. var self=this,$self=this;
  31777. var chunk;
  31778. return $core.withContext(function($ctx1) {
  31779. $recv((function(){
  31780. return $core.withContext(function($ctx2) {
  31781. chunk=$recv(aChunkParser)._nextChunk();
  31782. chunk;
  31783. return $recv(chunk)._isEmpty();
  31784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31785. }))._whileFalse_((function(){
  31786. return $core.withContext(function($ctx2) {
  31787. return $self._compileMethod_(chunk);
  31788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31789. }));
  31790. return self;
  31791. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31792. },
  31793. args: ["aChunkParser"],
  31794. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31795. referencedClasses: [],
  31796. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31797. }),
  31798. $globals.ClassProtocolReader);
  31799. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31800. $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.";
  31801. $core.addMethod(
  31802. $core.method({
  31803. selector: "methods",
  31804. protocol: "accessing",
  31805. fn: function (){
  31806. var self=this,$self=this;
  31807. return $core.withContext(function($ctx1) {
  31808. var $1;
  31809. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31810. return $core.withContext(function($ctx2) {
  31811. $1=$recv(a)._selector();
  31812. $ctx2.sendIdx["selector"]=1;
  31813. return $recv($1).__lt_eq($recv(b)._selector());
  31814. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31815. }));
  31816. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31817. },
  31818. args: [],
  31819. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31820. referencedClasses: [],
  31821. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31822. }),
  31823. $globals.ExportMethodProtocol);
  31824. $core.addMethod(
  31825. $core.method({
  31826. selector: "name",
  31827. protocol: "accessing",
  31828. fn: function (){
  31829. var self=this,$self=this;
  31830. return $self["@name"];
  31831. },
  31832. args: [],
  31833. source: "name\x0a\x09^ name",
  31834. referencedClasses: [],
  31835. messageSends: []
  31836. }),
  31837. $globals.ExportMethodProtocol);
  31838. $core.addMethod(
  31839. $core.method({
  31840. selector: "name:",
  31841. protocol: "accessing",
  31842. fn: function (aString){
  31843. var self=this,$self=this;
  31844. $self["@name"]=aString;
  31845. return self;
  31846. },
  31847. args: ["aString"],
  31848. source: "name: aString\x0a\x09name := aString",
  31849. referencedClasses: [],
  31850. messageSends: []
  31851. }),
  31852. $globals.ExportMethodProtocol);
  31853. $core.addMethod(
  31854. $core.method({
  31855. selector: "ownMethods",
  31856. protocol: "accessing",
  31857. fn: function (){
  31858. var self=this,$self=this;
  31859. return $core.withContext(function($ctx1) {
  31860. var $1;
  31861. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31862. return $core.withContext(function($ctx2) {
  31863. $1=$recv(a)._selector();
  31864. $ctx2.sendIdx["selector"]=1;
  31865. return $recv($1).__lt_eq($recv(b)._selector());
  31866. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31867. }));
  31868. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31869. },
  31870. args: [],
  31871. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31872. referencedClasses: [],
  31873. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31874. }),
  31875. $globals.ExportMethodProtocol);
  31876. $core.addMethod(
  31877. $core.method({
  31878. selector: "theClass",
  31879. protocol: "accessing",
  31880. fn: function (){
  31881. var self=this,$self=this;
  31882. return $self["@theClass"];
  31883. },
  31884. args: [],
  31885. source: "theClass\x0a\x09^ theClass",
  31886. referencedClasses: [],
  31887. messageSends: []
  31888. }),
  31889. $globals.ExportMethodProtocol);
  31890. $core.addMethod(
  31891. $core.method({
  31892. selector: "theClass:",
  31893. protocol: "accessing",
  31894. fn: function (aClass){
  31895. var self=this,$self=this;
  31896. $self["@theClass"]=aClass;
  31897. return self;
  31898. },
  31899. args: ["aClass"],
  31900. source: "theClass: aClass\x0a\x09theClass := aClass",
  31901. referencedClasses: [],
  31902. messageSends: []
  31903. }),
  31904. $globals.ExportMethodProtocol);
  31905. $core.addMethod(
  31906. $core.method({
  31907. selector: "name:theClass:",
  31908. protocol: "instance creation",
  31909. fn: function (aString,aClass){
  31910. var self=this,$self=this;
  31911. return $core.withContext(function($ctx1) {
  31912. var $1;
  31913. $1=$self._new();
  31914. $recv($1)._name_(aString);
  31915. $recv($1)._theClass_(aClass);
  31916. return $recv($1)._yourself();
  31917. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31918. },
  31919. args: ["aString", "aClass"],
  31920. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31921. referencedClasses: [],
  31922. messageSends: ["name:", "new", "theClass:", "yourself"]
  31923. }),
  31924. $globals.ExportMethodProtocol.a$cls);
  31925. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31926. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31927. $core.addMethod(
  31928. $core.method({
  31929. selector: "import:",
  31930. protocol: "fileIn",
  31931. fn: function (aStream){
  31932. var self=this,$self=this;
  31933. var chunk,result,parser,lastEmpty;
  31934. return $core.withContext(function($ctx1) {
  31935. var $1;
  31936. parser=$recv($globals.ChunkParser)._on_(aStream);
  31937. lastEmpty=false;
  31938. $self["@lastSection"]="n/a, not started";
  31939. $self["@lastChunk"]=nil;
  31940. $recv((function(){
  31941. return $core.withContext(function($ctx2) {
  31942. $recv((function(){
  31943. return $core.withContext(function($ctx3) {
  31944. chunk=$recv(parser)._nextChunk();
  31945. chunk;
  31946. return $recv(chunk)._isNil();
  31947. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31948. }))._whileFalse_((function(){
  31949. return $core.withContext(function($ctx3) {
  31950. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  31951. lastEmpty=true;
  31952. return lastEmpty;
  31953. }),(function(){
  31954. return $core.withContext(function($ctx4) {
  31955. $self["@lastSection"]=chunk;
  31956. $self["@lastSection"];
  31957. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  31958. result;
  31959. $1=lastEmpty;
  31960. if($core.assert($1)){
  31961. lastEmpty=false;
  31962. lastEmpty;
  31963. return $recv(result)._scanFrom_(parser);
  31964. }
  31965. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  31966. }));
  31967. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31968. }));
  31969. $self["@lastSection"]="n/a, finished";
  31970. return $self["@lastSection"];
  31971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31972. }))._on_do_($globals.Error,(function(e){
  31973. return $core.withContext(function($ctx2) {
  31974. $self["@lastChunk"]=$recv(parser)._last();
  31975. $self["@lastChunk"];
  31976. return $recv(e)._resignal();
  31977. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  31978. }));
  31979. return self;
  31980. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  31981. },
  31982. args: ["aStream"],
  31983. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  31984. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  31985. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  31986. }),
  31987. $globals.Importer);
  31988. $core.addMethod(
  31989. $core.method({
  31990. selector: "lastChunk",
  31991. protocol: "accessing",
  31992. fn: function (){
  31993. var self=this,$self=this;
  31994. return $self["@lastChunk"];
  31995. },
  31996. args: [],
  31997. source: "lastChunk\x0a\x09^ lastChunk",
  31998. referencedClasses: [],
  31999. messageSends: []
  32000. }),
  32001. $globals.Importer);
  32002. $core.addMethod(
  32003. $core.method({
  32004. selector: "lastSection",
  32005. protocol: "accessing",
  32006. fn: function (){
  32007. var self=this,$self=this;
  32008. return $self["@lastSection"];
  32009. },
  32010. args: [],
  32011. source: "lastSection\x0a\x09^ lastSection",
  32012. referencedClasses: [],
  32013. messageSends: []
  32014. }),
  32015. $globals.Importer);
  32016. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32017. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32018. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32019. $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.";
  32020. $core.addMethod(
  32021. $core.method({
  32022. selector: "ajaxPutAt:data:onSuccess:onError:",
  32023. protocol: "private",
  32024. fn: function (aURL,aString,aBlock,anotherBlock){
  32025. var self=this,$self=this;
  32026. var xhr;
  32027. return $core.withContext(function($ctx1) {
  32028. var $1,$4,$3,$2;
  32029. xhr=$recv($globals.Platform)._newXhr();
  32030. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32031. $recv(xhr)._onreadystatechange_((function(){
  32032. return $core.withContext(function($ctx2) {
  32033. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32034. if($core.assert($1)){
  32035. $4=$recv(xhr)._status();
  32036. $ctx2.sendIdx["status"]=1;
  32037. $3=$recv($4).__gt_eq((200));
  32038. $2=$recv($3)._and_((function(){
  32039. return $core.withContext(function($ctx3) {
  32040. return $recv($recv(xhr)._status()).__lt((300));
  32041. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32042. }));
  32043. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32044. }
  32045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32046. }));
  32047. $recv(xhr)._send_(aString);
  32048. return self;
  32049. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32050. },
  32051. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32052. 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",
  32053. referencedClasses: ["Platform"],
  32054. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32055. }),
  32056. $globals.PackageHandler);
  32057. $core.addMethod(
  32058. $core.method({
  32059. selector: "chunkContentsFor:",
  32060. protocol: "accessing",
  32061. fn: function (aPackage){
  32062. var self=this,$self=this;
  32063. return $core.withContext(function($ctx1) {
  32064. return $recv($globals.String)._streamContents_((function(str){
  32065. return $core.withContext(function($ctx2) {
  32066. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32067. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32068. }));
  32069. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32070. },
  32071. args: ["aPackage"],
  32072. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32073. referencedClasses: ["String"],
  32074. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32075. }),
  32076. $globals.PackageHandler);
  32077. $core.addMethod(
  32078. $core.method({
  32079. selector: "chunkExporter",
  32080. protocol: "factory",
  32081. fn: function (){
  32082. var self=this,$self=this;
  32083. return $core.withContext(function($ctx1) {
  32084. return $recv($self._chunkExporterClass())._new();
  32085. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32086. },
  32087. args: [],
  32088. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32089. referencedClasses: [],
  32090. messageSends: ["new", "chunkExporterClass"]
  32091. }),
  32092. $globals.PackageHandler);
  32093. $core.addMethod(
  32094. $core.method({
  32095. selector: "chunkExporterClass",
  32096. protocol: "accessing",
  32097. fn: function (){
  32098. var self=this,$self=this;
  32099. return $globals.ChunkExporter;
  32100. },
  32101. args: [],
  32102. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32103. referencedClasses: ["ChunkExporter"],
  32104. messageSends: []
  32105. }),
  32106. $globals.PackageHandler);
  32107. $core.addMethod(
  32108. $core.method({
  32109. selector: "commit:",
  32110. protocol: "committing",
  32111. fn: function (aPackage){
  32112. var self=this,$self=this;
  32113. return $core.withContext(function($ctx1) {
  32114. var $1,$2;
  32115. $self._commit_onSuccess_onError_(aPackage,(function(){
  32116. }),(function(error){
  32117. return $core.withContext(function($ctx2) {
  32118. $1=$recv($globals.PackageCommitError)._new();
  32119. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32120. $ctx2.sendIdx[","]=1;
  32121. $recv($1)._messageText_($2);
  32122. return $recv($1)._signal();
  32123. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32124. }));
  32125. return self;
  32126. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32127. },
  32128. args: ["aPackage"],
  32129. 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 ]",
  32130. referencedClasses: ["PackageCommitError"],
  32131. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32132. }),
  32133. $globals.PackageHandler);
  32134. $core.addMethod(
  32135. $core.method({
  32136. selector: "commit:onSuccess:onError:",
  32137. protocol: "committing",
  32138. fn: function (aPackage,aBlock,anotherBlock){
  32139. var self=this,$self=this;
  32140. return $core.withContext(function($ctx1) {
  32141. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32142. return $core.withContext(function($ctx2) {
  32143. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32144. return $core.withContext(function($ctx3) {
  32145. $recv(aPackage)._beClean();
  32146. return $recv(aBlock)._value();
  32147. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32148. }),anotherBlock);
  32149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32150. }),anotherBlock);
  32151. return self;
  32152. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32153. },
  32154. args: ["aPackage", "aBlock", "anotherBlock"],
  32155. 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",
  32156. referencedClasses: [],
  32157. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32158. }),
  32159. $globals.PackageHandler);
  32160. $core.addMethod(
  32161. $core.method({
  32162. selector: "commitJsFileFor:onSuccess:onError:",
  32163. protocol: "committing",
  32164. fn: function (aPackage,aBlock,anotherBlock){
  32165. var self=this,$self=this;
  32166. return $core.withContext(function($ctx1) {
  32167. var $2,$1;
  32168. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32169. $ctx1.sendIdx[","]=2;
  32170. $1=$recv($2).__comma(".js");
  32171. $ctx1.sendIdx[","]=1;
  32172. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32173. return self;
  32174. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32175. },
  32176. args: ["aPackage", "aBlock", "anotherBlock"],
  32177. 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",
  32178. referencedClasses: [],
  32179. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32180. }),
  32181. $globals.PackageHandler);
  32182. $core.addMethod(
  32183. $core.method({
  32184. selector: "commitPathJsFor:",
  32185. protocol: "accessing",
  32186. fn: function (aPackage){
  32187. var self=this,$self=this;
  32188. return $core.withContext(function($ctx1) {
  32189. $self._subclassResponsibility();
  32190. return self;
  32191. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32192. },
  32193. args: ["aPackage"],
  32194. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32195. referencedClasses: [],
  32196. messageSends: ["subclassResponsibility"]
  32197. }),
  32198. $globals.PackageHandler);
  32199. $core.addMethod(
  32200. $core.method({
  32201. selector: "commitPathStFor:",
  32202. protocol: "accessing",
  32203. fn: function (aPackage){
  32204. var self=this,$self=this;
  32205. return $core.withContext(function($ctx1) {
  32206. $self._subclassResponsibility();
  32207. return self;
  32208. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32209. },
  32210. args: ["aPackage"],
  32211. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32212. referencedClasses: [],
  32213. messageSends: ["subclassResponsibility"]
  32214. }),
  32215. $globals.PackageHandler);
  32216. $core.addMethod(
  32217. $core.method({
  32218. selector: "commitStFileFor:onSuccess:onError:",
  32219. protocol: "committing",
  32220. fn: function (aPackage,aBlock,anotherBlock){
  32221. var self=this,$self=this;
  32222. return $core.withContext(function($ctx1) {
  32223. var $2,$1;
  32224. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32225. $ctx1.sendIdx[","]=2;
  32226. $1=$recv($2).__comma(".st");
  32227. $ctx1.sendIdx[","]=1;
  32228. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32229. return self;
  32230. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32231. },
  32232. args: ["aPackage", "aBlock", "anotherBlock"],
  32233. 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",
  32234. referencedClasses: [],
  32235. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32236. }),
  32237. $globals.PackageHandler);
  32238. $core.addMethod(
  32239. $core.method({
  32240. selector: "contentsFor:",
  32241. protocol: "accessing",
  32242. fn: function (aPackage){
  32243. var self=this,$self=this;
  32244. return $core.withContext(function($ctx1) {
  32245. return $recv($globals.String)._streamContents_((function(str){
  32246. return $core.withContext(function($ctx2) {
  32247. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32248. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32249. }));
  32250. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32251. },
  32252. args: ["aPackage"],
  32253. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32254. referencedClasses: ["String"],
  32255. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32256. }),
  32257. $globals.PackageHandler);
  32258. $core.addMethod(
  32259. $core.method({
  32260. selector: "exporter",
  32261. protocol: "factory",
  32262. fn: function (){
  32263. var self=this,$self=this;
  32264. return $core.withContext(function($ctx1) {
  32265. return $recv($self._exporterClass())._new();
  32266. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32267. },
  32268. args: [],
  32269. source: "exporter\x0a\x09^ self exporterClass new",
  32270. referencedClasses: [],
  32271. messageSends: ["new", "exporterClass"]
  32272. }),
  32273. $globals.PackageHandler);
  32274. $core.addMethod(
  32275. $core.method({
  32276. selector: "exporterClass",
  32277. protocol: "accessing",
  32278. fn: function (){
  32279. var self=this,$self=this;
  32280. return $core.withContext(function($ctx1) {
  32281. $self._subclassResponsibility();
  32282. return self;
  32283. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32284. },
  32285. args: [],
  32286. source: "exporterClass\x0a\x09self subclassResponsibility",
  32287. referencedClasses: [],
  32288. messageSends: ["subclassResponsibility"]
  32289. }),
  32290. $globals.PackageHandler);
  32291. $core.addMethod(
  32292. $core.method({
  32293. selector: "load:",
  32294. protocol: "loading",
  32295. fn: function (aPackage){
  32296. var self=this,$self=this;
  32297. return $core.withContext(function($ctx1) {
  32298. $self._subclassResponsibility();
  32299. return self;
  32300. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32301. },
  32302. args: ["aPackage"],
  32303. source: "load: aPackage\x0a\x09self subclassResponsibility",
  32304. referencedClasses: [],
  32305. messageSends: ["subclassResponsibility"]
  32306. }),
  32307. $globals.PackageHandler);
  32308. $core.addMethod(
  32309. $core.method({
  32310. selector: "onCommitError:",
  32311. protocol: "error handling",
  32312. fn: function (anError){
  32313. var self=this,$self=this;
  32314. return $core.withContext(function($ctx1) {
  32315. var $1,$2;
  32316. $1=$recv($globals.PackageCommitError)._new();
  32317. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32318. $ctx1.sendIdx[","]=1;
  32319. $recv($1)._messageText_($2);
  32320. $recv($1)._signal();
  32321. return self;
  32322. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32323. },
  32324. args: ["anError"],
  32325. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32326. referencedClasses: ["PackageCommitError"],
  32327. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32328. }),
  32329. $globals.PackageHandler);
  32330. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32331. $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.";
  32332. $core.addMethod(
  32333. $core.method({
  32334. selector: "commitPathJsFor:",
  32335. protocol: "accessing",
  32336. fn: function (aPackage){
  32337. var self=this,$self=this;
  32338. return $core.withContext(function($ctx1) {
  32339. return $self._toUrl_($self._namespaceFor_(aPackage));
  32340. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32341. },
  32342. args: ["aPackage"],
  32343. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32344. referencedClasses: [],
  32345. messageSends: ["toUrl:", "namespaceFor:"]
  32346. }),
  32347. $globals.AmdPackageHandler);
  32348. $core.addMethod(
  32349. $core.method({
  32350. selector: "commitPathStFor:",
  32351. protocol: "accessing",
  32352. fn: function (aPackage){
  32353. var self=this,$self=this;
  32354. var path,pathWithout;
  32355. return $core.withContext(function($ctx1) {
  32356. var $1,$2;
  32357. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32358. $ctx1.sendIdx[","]=1;
  32359. path=$self._toUrl_($1);
  32360. pathWithout=$self._commitPathJsFor_(aPackage);
  32361. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32362. if($core.assert($2)){
  32363. return pathWithout;
  32364. } else {
  32365. return path;
  32366. }
  32367. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32368. },
  32369. args: ["aPackage"],
  32370. 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 ]",
  32371. referencedClasses: [],
  32372. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32373. }),
  32374. $globals.AmdPackageHandler);
  32375. $core.addMethod(
  32376. $core.method({
  32377. selector: "exporterClass",
  32378. protocol: "accessing",
  32379. fn: function (){
  32380. var self=this,$self=this;
  32381. return $globals.AmdExporter;
  32382. },
  32383. args: [],
  32384. source: "exporterClass\x0a\x09^ AmdExporter",
  32385. referencedClasses: ["AmdExporter"],
  32386. messageSends: []
  32387. }),
  32388. $globals.AmdPackageHandler);
  32389. $core.addMethod(
  32390. $core.method({
  32391. selector: "load:",
  32392. protocol: "loading",
  32393. fn: function (aPackage){
  32394. var self=this,$self=this;
  32395. return $core.withContext(function($ctx1) {
  32396. var $1,$3,$2,$receiver;
  32397. $1=$recv($globals.Smalltalk)._amdRequire();
  32398. if(($receiver = $1) == null || $receiver.a$nil){
  32399. $self._error_("AMD loader not present");
  32400. } else {
  32401. var require;
  32402. require=$receiver;
  32403. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32404. $ctx1.sendIdx[","]=1;
  32405. $2=$recv($globals.Array)._with_($3);
  32406. $recv(require)._value_($2);
  32407. }
  32408. return self;
  32409. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32410. },
  32411. args: ["aPackage"],
  32412. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  32413. referencedClasses: ["Smalltalk", "Array"],
  32414. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  32415. }),
  32416. $globals.AmdPackageHandler);
  32417. $core.addMethod(
  32418. $core.method({
  32419. selector: "namespaceFor:",
  32420. protocol: "committing",
  32421. fn: function (aPackage){
  32422. var self=this,$self=this;
  32423. return $core.withContext(function($ctx1) {
  32424. return $recv($recv(aPackage)._transport())._namespace();
  32425. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32426. },
  32427. args: ["aPackage"],
  32428. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32429. referencedClasses: [],
  32430. messageSends: ["namespace", "transport"]
  32431. }),
  32432. $globals.AmdPackageHandler);
  32433. $core.addMethod(
  32434. $core.method({
  32435. selector: "toUrl:",
  32436. protocol: "private",
  32437. fn: function (aString){
  32438. var self=this,$self=this;
  32439. return $core.withContext(function($ctx1) {
  32440. var $1,$receiver;
  32441. $1=$recv($globals.Smalltalk)._amdRequire();
  32442. if(($receiver = $1) == null || $receiver.a$nil){
  32443. return $self._error_("AMD loader not present");
  32444. } else {
  32445. var require;
  32446. require=$receiver;
  32447. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  32448. }
  32449. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32450. },
  32451. args: ["aString"],
  32452. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  32453. referencedClasses: ["Smalltalk"],
  32454. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  32455. }),
  32456. $globals.AmdPackageHandler);
  32457. $core.addMethod(
  32458. $core.method({
  32459. selector: "defaultNamespace",
  32460. protocol: "commit paths",
  32461. fn: function (){
  32462. var self=this,$self=this;
  32463. return $core.withContext(function($ctx1) {
  32464. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32465. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32466. },
  32467. args: [],
  32468. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32469. referencedClasses: ["Smalltalk"],
  32470. messageSends: ["defaultAmdNamespace"]
  32471. }),
  32472. $globals.AmdPackageHandler.a$cls);
  32473. $core.addMethod(
  32474. $core.method({
  32475. selector: "defaultNamespace:",
  32476. protocol: "commit paths",
  32477. fn: function (aString){
  32478. var self=this,$self=this;
  32479. return $core.withContext(function($ctx1) {
  32480. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32481. return self;
  32482. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32483. },
  32484. args: ["aString"],
  32485. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32486. referencedClasses: ["Smalltalk"],
  32487. messageSends: ["defaultAmdNamespace:"]
  32488. }),
  32489. $globals.AmdPackageHandler.a$cls);
  32490. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32491. $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.";
  32492. $core.addMethod(
  32493. $core.method({
  32494. selector: "asJavaScriptObject",
  32495. protocol: "converting",
  32496. fn: function (){
  32497. var self=this,$self=this;
  32498. return $core.withContext(function($ctx1) {
  32499. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32500. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32501. },
  32502. args: [],
  32503. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32504. referencedClasses: [],
  32505. messageSends: ["type"]
  32506. }),
  32507. $globals.PackageTransport);
  32508. $core.addMethod(
  32509. $core.method({
  32510. selector: "commit",
  32511. protocol: "committing",
  32512. fn: function (){
  32513. var self=this,$self=this;
  32514. return $core.withContext(function($ctx1) {
  32515. $recv($self._commitHandler())._commit_($self._package());
  32516. return self;
  32517. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32518. },
  32519. args: [],
  32520. source: "commit\x0a\x09self commitHandler commit: self package",
  32521. referencedClasses: [],
  32522. messageSends: ["commit:", "commitHandler", "package"]
  32523. }),
  32524. $globals.PackageTransport);
  32525. $core.addMethod(
  32526. $core.method({
  32527. selector: "commitHandler",
  32528. protocol: "factory",
  32529. fn: function (){
  32530. var self=this,$self=this;
  32531. return $core.withContext(function($ctx1) {
  32532. return $recv($self._commitHandlerClass())._new();
  32533. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32534. },
  32535. args: [],
  32536. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32537. referencedClasses: [],
  32538. messageSends: ["new", "commitHandlerClass"]
  32539. }),
  32540. $globals.PackageTransport);
  32541. $core.addMethod(
  32542. $core.method({
  32543. selector: "commitHandlerClass",
  32544. protocol: "accessing",
  32545. fn: function (){
  32546. var self=this,$self=this;
  32547. return $core.withContext(function($ctx1) {
  32548. $self._subclassResponsibility();
  32549. return self;
  32550. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32551. },
  32552. args: [],
  32553. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32554. referencedClasses: [],
  32555. messageSends: ["subclassResponsibility"]
  32556. }),
  32557. $globals.PackageTransport);
  32558. $core.addMethod(
  32559. $core.method({
  32560. selector: "commitOnSuccess:onError:",
  32561. protocol: "committing",
  32562. fn: function (aBlock,anotherBlock){
  32563. var self=this,$self=this;
  32564. return $core.withContext(function($ctx1) {
  32565. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32566. return self;
  32567. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32568. },
  32569. args: ["aBlock", "anotherBlock"],
  32570. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32571. referencedClasses: [],
  32572. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32573. }),
  32574. $globals.PackageTransport);
  32575. $core.addMethod(
  32576. $core.method({
  32577. selector: "definition",
  32578. protocol: "accessing",
  32579. fn: function (){
  32580. var self=this,$self=this;
  32581. return "";
  32582. },
  32583. args: [],
  32584. source: "definition\x0a\x09^ ''",
  32585. referencedClasses: [],
  32586. messageSends: []
  32587. }),
  32588. $globals.PackageTransport);
  32589. $core.addMethod(
  32590. $core.method({
  32591. selector: "load",
  32592. protocol: "loading",
  32593. fn: function (){
  32594. var self=this,$self=this;
  32595. return $core.withContext(function($ctx1) {
  32596. $recv($self._commitHandler())._load_($self._package());
  32597. return self;
  32598. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32599. },
  32600. args: [],
  32601. source: "load\x0a\x09self commitHandler load: self package",
  32602. referencedClasses: [],
  32603. messageSends: ["load:", "commitHandler", "package"]
  32604. }),
  32605. $globals.PackageTransport);
  32606. $core.addMethod(
  32607. $core.method({
  32608. selector: "package",
  32609. protocol: "accessing",
  32610. fn: function (){
  32611. var self=this,$self=this;
  32612. return $self["@package"];
  32613. },
  32614. args: [],
  32615. source: "package\x0a\x09^ package",
  32616. referencedClasses: [],
  32617. messageSends: []
  32618. }),
  32619. $globals.PackageTransport);
  32620. $core.addMethod(
  32621. $core.method({
  32622. selector: "package:",
  32623. protocol: "accessing",
  32624. fn: function (aPackage){
  32625. var self=this,$self=this;
  32626. $self["@package"]=aPackage;
  32627. return self;
  32628. },
  32629. args: ["aPackage"],
  32630. source: "package: aPackage\x0a\x09package := aPackage",
  32631. referencedClasses: [],
  32632. messageSends: []
  32633. }),
  32634. $globals.PackageTransport);
  32635. $core.addMethod(
  32636. $core.method({
  32637. selector: "setupFromJson:",
  32638. protocol: "initialization",
  32639. fn: function (anObject){
  32640. var self=this,$self=this;
  32641. return self;
  32642. },
  32643. args: ["anObject"],
  32644. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32645. referencedClasses: [],
  32646. messageSends: []
  32647. }),
  32648. $globals.PackageTransport);
  32649. $core.addMethod(
  32650. $core.method({
  32651. selector: "type",
  32652. protocol: "accessing",
  32653. fn: function (){
  32654. var self=this,$self=this;
  32655. return $core.withContext(function($ctx1) {
  32656. return $recv($self._class())._type();
  32657. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32658. },
  32659. args: [],
  32660. source: "type\x0a\x09^ self class type",
  32661. referencedClasses: [],
  32662. messageSends: ["type", "class"]
  32663. }),
  32664. $globals.PackageTransport);
  32665. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32666. $core.addMethod(
  32667. $core.method({
  32668. selector: "classRegisteredFor:",
  32669. protocol: "accessing",
  32670. fn: function (aString){
  32671. var self=this,$self=this;
  32672. return $core.withContext(function($ctx1) {
  32673. return $recv($self["@registry"])._at_(aString);
  32674. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32675. },
  32676. args: ["aString"],
  32677. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32678. referencedClasses: [],
  32679. messageSends: ["at:"]
  32680. }),
  32681. $globals.PackageTransport.a$cls);
  32682. $core.addMethod(
  32683. $core.method({
  32684. selector: "defaultType",
  32685. protocol: "accessing",
  32686. fn: function (){
  32687. var self=this,$self=this;
  32688. return $core.withContext(function($ctx1) {
  32689. return $recv($globals.AmdPackageTransport)._type();
  32690. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32691. },
  32692. args: [],
  32693. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32694. referencedClasses: ["AmdPackageTransport"],
  32695. messageSends: ["type"]
  32696. }),
  32697. $globals.PackageTransport.a$cls);
  32698. $core.addMethod(
  32699. $core.method({
  32700. selector: "for:",
  32701. protocol: "instance creation",
  32702. fn: function (aString){
  32703. var self=this,$self=this;
  32704. return $core.withContext(function($ctx1) {
  32705. return $recv($self._classRegisteredFor_(aString))._new();
  32706. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32707. },
  32708. args: ["aString"],
  32709. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32710. referencedClasses: [],
  32711. messageSends: ["new", "classRegisteredFor:"]
  32712. }),
  32713. $globals.PackageTransport.a$cls);
  32714. $core.addMethod(
  32715. $core.method({
  32716. selector: "fromJson:",
  32717. protocol: "instance creation",
  32718. fn: function (anObject){
  32719. var self=this,$self=this;
  32720. return $core.withContext(function($ctx1) {
  32721. var $1,$2,$receiver;
  32722. if(($receiver = anObject) == null || $receiver.a$nil){
  32723. $1=$self._for_($self._defaultType());
  32724. $ctx1.sendIdx["for:"]=1;
  32725. return $1;
  32726. } else {
  32727. anObject;
  32728. }
  32729. $2=$self._for_($recv(anObject)._type());
  32730. $recv($2)._setupFromJson_(anObject);
  32731. return $recv($2)._yourself();
  32732. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32733. },
  32734. args: ["anObject"],
  32735. 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",
  32736. referencedClasses: [],
  32737. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32738. }),
  32739. $globals.PackageTransport.a$cls);
  32740. $core.addMethod(
  32741. $core.method({
  32742. selector: "initialize",
  32743. protocol: "initialization",
  32744. fn: function (){
  32745. var self=this,$self=this;
  32746. return $core.withContext(function($ctx1) {
  32747. var $1;
  32748. (
  32749. $ctx1.supercall = true,
  32750. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32751. $ctx1.supercall = false;
  32752. $1=$self.__eq_eq($globals.PackageTransport);
  32753. if($core.assert($1)){
  32754. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32755. $self["@registry"];
  32756. } else {
  32757. $self._register();
  32758. }
  32759. return self;
  32760. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32761. },
  32762. args: [],
  32763. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32764. referencedClasses: ["PackageTransport"],
  32765. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32766. }),
  32767. $globals.PackageTransport.a$cls);
  32768. $core.addMethod(
  32769. $core.method({
  32770. selector: "register",
  32771. protocol: "registration",
  32772. fn: function (){
  32773. var self=this,$self=this;
  32774. return $core.withContext(function($ctx1) {
  32775. $recv($globals.PackageTransport)._register_(self);
  32776. return self;
  32777. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32778. },
  32779. args: [],
  32780. source: "register\x0a\x09PackageTransport register: self",
  32781. referencedClasses: ["PackageTransport"],
  32782. messageSends: ["register:"]
  32783. }),
  32784. $globals.PackageTransport.a$cls);
  32785. $core.addMethod(
  32786. $core.method({
  32787. selector: "register:",
  32788. protocol: "registration",
  32789. fn: function (aClass){
  32790. var self=this,$self=this;
  32791. return $core.withContext(function($ctx1) {
  32792. var $1,$receiver;
  32793. $1=$recv(aClass)._type();
  32794. $ctx1.sendIdx["type"]=1;
  32795. if(($receiver = $1) == null || $receiver.a$nil){
  32796. $1;
  32797. } else {
  32798. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32799. }
  32800. return self;
  32801. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32802. },
  32803. args: ["aClass"],
  32804. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32805. referencedClasses: [],
  32806. messageSends: ["ifNotNil:", "type", "at:put:"]
  32807. }),
  32808. $globals.PackageTransport.a$cls);
  32809. $core.addMethod(
  32810. $core.method({
  32811. selector: "type",
  32812. protocol: "accessing",
  32813. fn: function (){
  32814. var self=this,$self=this;
  32815. return nil;
  32816. },
  32817. args: [],
  32818. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32819. referencedClasses: [],
  32820. messageSends: []
  32821. }),
  32822. $globals.PackageTransport.a$cls);
  32823. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32824. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32825. $core.addMethod(
  32826. $core.method({
  32827. selector: "asJavaScriptObject",
  32828. protocol: "converting",
  32829. fn: function (){
  32830. var self=this,$self=this;
  32831. return $core.withContext(function($ctx1) {
  32832. var $1;
  32833. $1=(
  32834. $ctx1.supercall = true,
  32835. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32836. $ctx1.supercall = false;
  32837. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32838. return $recv($1)._yourself();
  32839. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32840. },
  32841. args: [],
  32842. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32843. referencedClasses: [],
  32844. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32845. }),
  32846. $globals.AmdPackageTransport);
  32847. $core.addMethod(
  32848. $core.method({
  32849. selector: "commitHandlerClass",
  32850. protocol: "accessing",
  32851. fn: function (){
  32852. var self=this,$self=this;
  32853. return $globals.AmdPackageHandler;
  32854. },
  32855. args: [],
  32856. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32857. referencedClasses: ["AmdPackageHandler"],
  32858. messageSends: []
  32859. }),
  32860. $globals.AmdPackageTransport);
  32861. $core.addMethod(
  32862. $core.method({
  32863. selector: "defaultNamespace",
  32864. protocol: "defaults",
  32865. fn: function (){
  32866. var self=this,$self=this;
  32867. return $core.withContext(function($ctx1) {
  32868. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32869. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32870. },
  32871. args: [],
  32872. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32873. referencedClasses: ["Smalltalk"],
  32874. messageSends: ["defaultAmdNamespace"]
  32875. }),
  32876. $globals.AmdPackageTransport);
  32877. $core.addMethod(
  32878. $core.method({
  32879. selector: "definition",
  32880. protocol: "accessing",
  32881. fn: function (){
  32882. var self=this,$self=this;
  32883. return $core.withContext(function($ctx1) {
  32884. return $recv($globals.String)._streamContents_((function(stream){
  32885. return $core.withContext(function($ctx2) {
  32886. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32887. return $recv(stream)._print_($self._namespace());
  32888. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32889. }));
  32890. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32891. },
  32892. args: [],
  32893. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32894. referencedClasses: ["String"],
  32895. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32896. }),
  32897. $globals.AmdPackageTransport);
  32898. $core.addMethod(
  32899. $core.method({
  32900. selector: "namespace",
  32901. protocol: "accessing",
  32902. fn: function (){
  32903. var self=this,$self=this;
  32904. return $core.withContext(function($ctx1) {
  32905. var $1,$receiver;
  32906. $1=$self["@namespace"];
  32907. if(($receiver = $1) == null || $receiver.a$nil){
  32908. return $self._defaultNamespace();
  32909. } else {
  32910. return $1;
  32911. }
  32912. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32913. },
  32914. args: [],
  32915. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32916. referencedClasses: [],
  32917. messageSends: ["ifNil:", "defaultNamespace"]
  32918. }),
  32919. $globals.AmdPackageTransport);
  32920. $core.addMethod(
  32921. $core.method({
  32922. selector: "namespace:",
  32923. protocol: "accessing",
  32924. fn: function (aString){
  32925. var self=this,$self=this;
  32926. $self["@namespace"]=aString;
  32927. return self;
  32928. },
  32929. args: ["aString"],
  32930. source: "namespace: aString\x0a\x09namespace := aString",
  32931. referencedClasses: [],
  32932. messageSends: []
  32933. }),
  32934. $globals.AmdPackageTransport);
  32935. $core.addMethod(
  32936. $core.method({
  32937. selector: "printOn:",
  32938. protocol: "printing",
  32939. fn: function (aStream){
  32940. var self=this,$self=this;
  32941. return $core.withContext(function($ctx1) {
  32942. (
  32943. $ctx1.supercall = true,
  32944. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  32945. $ctx1.supercall = false;
  32946. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  32947. $ctx1.sendIdx["nextPutAll:"]=1;
  32948. $recv(aStream)._nextPutAll_($self._namespace());
  32949. $ctx1.sendIdx["nextPutAll:"]=2;
  32950. $recv(aStream)._nextPutAll_(")");
  32951. return self;
  32952. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  32953. },
  32954. args: ["aStream"],
  32955. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  32956. referencedClasses: [],
  32957. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  32958. }),
  32959. $globals.AmdPackageTransport);
  32960. $core.addMethod(
  32961. $core.method({
  32962. selector: "setPath:",
  32963. protocol: "actions",
  32964. fn: function (aString){
  32965. var self=this,$self=this;
  32966. return $core.withContext(function($ctx1) {
  32967. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  32968. return self;
  32969. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  32970. },
  32971. args: ["aString"],
  32972. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  32973. referencedClasses: [],
  32974. messageSends: ["value:", "basicAt:", "namespace"]
  32975. }),
  32976. $globals.AmdPackageTransport);
  32977. $core.addMethod(
  32978. $core.method({
  32979. selector: "setupFromJson:",
  32980. protocol: "initialization",
  32981. fn: function (anObject){
  32982. var self=this,$self=this;
  32983. return $core.withContext(function($ctx1) {
  32984. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  32985. return self;
  32986. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  32987. },
  32988. args: ["anObject"],
  32989. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  32990. referencedClasses: [],
  32991. messageSends: ["namespace:", "at:"]
  32992. }),
  32993. $globals.AmdPackageTransport);
  32994. $core.addMethod(
  32995. $core.method({
  32996. selector: "namespace:",
  32997. protocol: "instance creation",
  32998. fn: function (aString){
  32999. var self=this,$self=this;
  33000. return $core.withContext(function($ctx1) {
  33001. var $1;
  33002. $1=$self._new();
  33003. $recv($1)._namespace_(aString);
  33004. return $recv($1)._yourself();
  33005. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33006. },
  33007. args: ["aString"],
  33008. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33009. referencedClasses: [],
  33010. messageSends: ["namespace:", "new", "yourself"]
  33011. }),
  33012. $globals.AmdPackageTransport.a$cls);
  33013. $core.addMethod(
  33014. $core.method({
  33015. selector: "type",
  33016. protocol: "accessing",
  33017. fn: function (){
  33018. var self=this,$self=this;
  33019. return "amd";
  33020. },
  33021. args: [],
  33022. source: "type\x0a\x09^ 'amd'",
  33023. referencedClasses: [],
  33024. messageSends: []
  33025. }),
  33026. $globals.AmdPackageTransport.a$cls);
  33027. $core.addMethod(
  33028. $core.method({
  33029. selector: "exportBehaviorDefinitionTo:using:",
  33030. protocol: "*Platform-ImportExport",
  33031. fn: function (aStream,anExporter){
  33032. var self=this,$self=this;
  33033. return $core.withContext(function($ctx1) {
  33034. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33035. return self;
  33036. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33037. },
  33038. args: ["aStream", "anExporter"],
  33039. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33040. referencedClasses: [],
  33041. messageSends: ["exportDefinitionOf:on:"]
  33042. }),
  33043. $globals.Class);
  33044. $core.addMethod(
  33045. $core.method({
  33046. selector: "exportBehaviorDefinitionTo:using:",
  33047. protocol: "*Platform-ImportExport",
  33048. fn: function (aStream,anExporter){
  33049. var self=this,$self=this;
  33050. return $core.withContext(function($ctx1) {
  33051. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33052. return self;
  33053. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33054. },
  33055. args: ["aStream", "anExporter"],
  33056. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33057. referencedClasses: [],
  33058. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33059. }),
  33060. $globals.Metaclass);
  33061. $core.addMethod(
  33062. $core.method({
  33063. selector: "commit",
  33064. protocol: "*Platform-ImportExport",
  33065. fn: function (){
  33066. var self=this,$self=this;
  33067. return $core.withContext(function($ctx1) {
  33068. return $recv($self._transport())._commit();
  33069. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33070. },
  33071. args: [],
  33072. source: "commit\x0a\x09^ self transport commit",
  33073. referencedClasses: [],
  33074. messageSends: ["commit", "transport"]
  33075. }),
  33076. $globals.Package);
  33077. $core.addMethod(
  33078. $core.method({
  33079. selector: "load",
  33080. protocol: "*Platform-ImportExport",
  33081. fn: function (){
  33082. var self=this,$self=this;
  33083. return $core.withContext(function($ctx1) {
  33084. return $recv($self._transport())._load();
  33085. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33086. },
  33087. args: [],
  33088. source: "load\x0a\x09^ self transport load",
  33089. referencedClasses: [],
  33090. messageSends: ["load", "transport"]
  33091. }),
  33092. $globals.Package);
  33093. $core.addMethod(
  33094. $core.method({
  33095. selector: "loadFromNamespace:",
  33096. protocol: "*Platform-ImportExport",
  33097. fn: function (aString){
  33098. var self=this,$self=this;
  33099. return $core.withContext(function($ctx1) {
  33100. var $1;
  33101. $1=$self._transport();
  33102. $recv($1)._namespace_(aString);
  33103. return $recv($1)._load();
  33104. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33105. },
  33106. args: ["aString"],
  33107. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33108. referencedClasses: [],
  33109. messageSends: ["namespace:", "transport", "load"]
  33110. }),
  33111. $globals.Package);
  33112. $core.addMethod(
  33113. $core.method({
  33114. selector: "load:",
  33115. protocol: "*Platform-ImportExport",
  33116. fn: function (aPackageName){
  33117. var self=this,$self=this;
  33118. return $core.withContext(function($ctx1) {
  33119. $recv($self._named_(aPackageName))._load();
  33120. return self;
  33121. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33122. },
  33123. args: ["aPackageName"],
  33124. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  33125. referencedClasses: [],
  33126. messageSends: ["load", "named:"]
  33127. }),
  33128. $globals.Package.a$cls);
  33129. $core.addMethod(
  33130. $core.method({
  33131. selector: "load:fromNamespace:",
  33132. protocol: "*Platform-ImportExport",
  33133. fn: function (aPackageName,aString){
  33134. var self=this,$self=this;
  33135. return $core.withContext(function($ctx1) {
  33136. $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33137. return self;
  33138. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33139. },
  33140. args: ["aPackageName", "aString"],
  33141. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  33142. referencedClasses: [],
  33143. messageSends: ["loadFromNamespace:", "named:"]
  33144. }),
  33145. $globals.Package.a$cls);
  33146. $core.addMethod(
  33147. $core.method({
  33148. selector: "methodsFor:",
  33149. protocol: "*Platform-ImportExport",
  33150. fn: function (aString){
  33151. var self=this,$self=this;
  33152. return $core.withContext(function($ctx1) {
  33153. var $1;
  33154. $1=$recv($globals.ClassProtocolReader)._new();
  33155. $recv($1)._class_category_(self,aString);
  33156. return $recv($1)._yourself();
  33157. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33158. },
  33159. args: ["aString"],
  33160. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33161. referencedClasses: ["ClassProtocolReader"],
  33162. messageSends: ["class:category:", "new", "yourself"]
  33163. }),
  33164. $globals.TBehaviorProvider);
  33165. $core.addMethod(
  33166. $core.method({
  33167. selector: "methodsFor:stamp:",
  33168. protocol: "*Platform-ImportExport",
  33169. fn: function (aString,aStamp){
  33170. var self=this,$self=this;
  33171. return $core.withContext(function($ctx1) {
  33172. return $self._methodsFor_(aString);
  33173. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33174. },
  33175. args: ["aString", "aStamp"],
  33176. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33177. referencedClasses: [],
  33178. messageSends: ["methodsFor:"]
  33179. }),
  33180. $globals.TBehaviorProvider);
  33181. $core.addMethod(
  33182. $core.method({
  33183. selector: "commentStamp",
  33184. protocol: "*Platform-ImportExport",
  33185. fn: function (){
  33186. var self=this,$self=this;
  33187. return $core.withContext(function($ctx1) {
  33188. var $1;
  33189. $1=$recv($globals.ClassCommentReader)._new();
  33190. $recv($1)._class_(self);
  33191. return $recv($1)._yourself();
  33192. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33193. },
  33194. args: [],
  33195. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33196. referencedClasses: ["ClassCommentReader"],
  33197. messageSends: ["class:", "new", "yourself"]
  33198. }),
  33199. $globals.TMasterBehavior);
  33200. $core.addMethod(
  33201. $core.method({
  33202. selector: "commentStamp:prior:",
  33203. protocol: "*Platform-ImportExport",
  33204. fn: function (aStamp,prior){
  33205. var self=this,$self=this;
  33206. return $core.withContext(function($ctx1) {
  33207. return $self._commentStamp();
  33208. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33209. },
  33210. args: ["aStamp", "prior"],
  33211. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33212. referencedClasses: [],
  33213. messageSends: ["commentStamp"]
  33214. }),
  33215. $globals.TMasterBehavior);
  33216. $core.addMethod(
  33217. $core.method({
  33218. selector: "exportBehaviorDefinitionTo:using:",
  33219. protocol: "*Platform-ImportExport",
  33220. fn: function (aStream,anExporter){
  33221. var self=this,$self=this;
  33222. return $core.withContext(function($ctx1) {
  33223. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33224. return self;
  33225. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33226. },
  33227. args: ["aStream", "anExporter"],
  33228. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33229. referencedClasses: [],
  33230. messageSends: ["exportTraitDefinitionOf:on:"]
  33231. }),
  33232. $globals.Trait);
  33233. });
  33234. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  33235. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33236. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33237. $core.addPackage("Compiler-Core");
  33238. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  33239. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33240. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  33241. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  33242. $core.addMethod(
  33243. $core.method({
  33244. selector: "compileNode:",
  33245. protocol: "compiling",
  33246. fn: function (aNode){
  33247. var self=this,$self=this;
  33248. return $core.withContext(function($ctx1) {
  33249. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  33250. return $core.withContext(function($ctx2) {
  33251. return $recv(transformer)._value_(input);
  33252. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  33253. }));
  33254. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  33255. },
  33256. args: ["aNode"],
  33257. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  33258. referencedClasses: [],
  33259. messageSends: ["inject:into:", "transformers", "value:"]
  33260. }),
  33261. $globals.AbstractCodeGenerator);
  33262. $core.addMethod(
  33263. $core.method({
  33264. selector: "currentClass",
  33265. protocol: "accessing",
  33266. fn: function (){
  33267. var self=this,$self=this;
  33268. return $self["@currentClass"];
  33269. },
  33270. args: [],
  33271. source: "currentClass\x0a\x09^ currentClass",
  33272. referencedClasses: [],
  33273. messageSends: []
  33274. }),
  33275. $globals.AbstractCodeGenerator);
  33276. $core.addMethod(
  33277. $core.method({
  33278. selector: "currentClass:",
  33279. protocol: "accessing",
  33280. fn: function (aClass){
  33281. var self=this,$self=this;
  33282. $self["@currentClass"]=aClass;
  33283. return self;
  33284. },
  33285. args: ["aClass"],
  33286. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33287. referencedClasses: [],
  33288. messageSends: []
  33289. }),
  33290. $globals.AbstractCodeGenerator);
  33291. $core.addMethod(
  33292. $core.method({
  33293. selector: "currentPackage",
  33294. protocol: "accessing",
  33295. fn: function (){
  33296. var self=this,$self=this;
  33297. return $self["@currentPackage"];
  33298. },
  33299. args: [],
  33300. source: "currentPackage\x0a\x09^ currentPackage",
  33301. referencedClasses: [],
  33302. messageSends: []
  33303. }),
  33304. $globals.AbstractCodeGenerator);
  33305. $core.addMethod(
  33306. $core.method({
  33307. selector: "currentPackage:",
  33308. protocol: "accessing",
  33309. fn: function (anObject){
  33310. var self=this,$self=this;
  33311. $self["@currentPackage"]=anObject;
  33312. return self;
  33313. },
  33314. args: ["anObject"],
  33315. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33316. referencedClasses: [],
  33317. messageSends: []
  33318. }),
  33319. $globals.AbstractCodeGenerator);
  33320. $core.addMethod(
  33321. $core.method({
  33322. selector: "pseudoVariables",
  33323. protocol: "accessing",
  33324. fn: function (){
  33325. var self=this,$self=this;
  33326. return $core.withContext(function($ctx1) {
  33327. return $recv($globals.Smalltalk)._pseudoVariableNames();
  33328. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  33329. },
  33330. args: [],
  33331. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  33332. referencedClasses: ["Smalltalk"],
  33333. messageSends: ["pseudoVariableNames"]
  33334. }),
  33335. $globals.AbstractCodeGenerator);
  33336. $core.addMethod(
  33337. $core.method({
  33338. selector: "source",
  33339. protocol: "accessing",
  33340. fn: function (){
  33341. var self=this,$self=this;
  33342. return $core.withContext(function($ctx1) {
  33343. var $1,$receiver;
  33344. $1=$self["@source"];
  33345. if(($receiver = $1) == null || $receiver.a$nil){
  33346. return "";
  33347. } else {
  33348. return $1;
  33349. }
  33350. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  33351. },
  33352. args: [],
  33353. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33354. referencedClasses: [],
  33355. messageSends: ["ifNil:"]
  33356. }),
  33357. $globals.AbstractCodeGenerator);
  33358. $core.addMethod(
  33359. $core.method({
  33360. selector: "source:",
  33361. protocol: "accessing",
  33362. fn: function (aString){
  33363. var self=this,$self=this;
  33364. $self["@source"]=aString;
  33365. return self;
  33366. },
  33367. args: ["aString"],
  33368. source: "source: aString\x0a\x09source := aString",
  33369. referencedClasses: [],
  33370. messageSends: []
  33371. }),
  33372. $globals.AbstractCodeGenerator);
  33373. $core.addMethod(
  33374. $core.method({
  33375. selector: "transformers",
  33376. protocol: "compiling",
  33377. fn: function (){
  33378. var self=this,$self=this;
  33379. var dict;
  33380. return $core.withContext(function($ctx1) {
  33381. dict=$self._transformersDictionary();
  33382. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  33383. return $core.withContext(function($ctx2) {
  33384. return $recv(dict)._at_(each);
  33385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33386. }));
  33387. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  33388. },
  33389. args: [],
  33390. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  33391. referencedClasses: [],
  33392. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  33393. }),
  33394. $globals.AbstractCodeGenerator);
  33395. $core.addMethod(
  33396. $core.method({
  33397. selector: "transformersDictionary",
  33398. protocol: "compiling",
  33399. fn: function (){
  33400. var self=this,$self=this;
  33401. return $core.withContext(function($ctx1) {
  33402. $self._subclassResponsibility();
  33403. return self;
  33404. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  33405. },
  33406. args: [],
  33407. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  33408. referencedClasses: [],
  33409. messageSends: ["subclassResponsibility"]
  33410. }),
  33411. $globals.AbstractCodeGenerator);
  33412. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  33413. $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.";
  33414. $core.addMethod(
  33415. $core.method({
  33416. selector: "irTranslator",
  33417. protocol: "compiling",
  33418. fn: function (){
  33419. var self=this,$self=this;
  33420. return $core.withContext(function($ctx1) {
  33421. var $1;
  33422. $1=$recv($self._irTranslatorClass())._new();
  33423. $recv($1)._currentClass_($self._currentClass());
  33424. return $recv($1)._yourself();
  33425. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  33426. },
  33427. args: [],
  33428. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  33429. referencedClasses: [],
  33430. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  33431. }),
  33432. $globals.CodeGenerator);
  33433. $core.addMethod(
  33434. $core.method({
  33435. selector: "irTranslatorClass",
  33436. protocol: "compiling",
  33437. fn: function (){
  33438. var self=this,$self=this;
  33439. return $globals.IRJSTranslator;
  33440. },
  33441. args: [],
  33442. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  33443. referencedClasses: ["IRJSTranslator"],
  33444. messageSends: []
  33445. }),
  33446. $globals.CodeGenerator);
  33447. $core.addMethod(
  33448. $core.method({
  33449. selector: "semanticAnalyzer",
  33450. protocol: "compiling",
  33451. fn: function (){
  33452. var self=this,$self=this;
  33453. return $core.withContext(function($ctx1) {
  33454. var $1;
  33455. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  33456. $recv($1)._thePackage_($self._currentPackage());
  33457. return $recv($1)._yourself();
  33458. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  33459. },
  33460. args: [],
  33461. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  33462. referencedClasses: ["SemanticAnalyzer"],
  33463. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  33464. }),
  33465. $globals.CodeGenerator);
  33466. $core.addMethod(
  33467. $core.method({
  33468. selector: "transformersDictionary",
  33469. protocol: "compiling",
  33470. fn: function (){
  33471. var self=this,$self=this;
  33472. return $core.withContext(function($ctx1) {
  33473. var $1,$2,$receiver;
  33474. $1=$self["@transformersDictionary"];
  33475. if(($receiver = $1) == null || $receiver.a$nil){
  33476. $2=$recv($globals.Dictionary)._new();
  33477. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  33478. $ctx1.sendIdx["at:put:"]=1;
  33479. $recv($2)._at_put_("5000-astToIr",$self._translator());
  33480. $ctx1.sendIdx["at:put:"]=2;
  33481. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  33482. $self["@transformersDictionary"]=$recv($2)._yourself();
  33483. return $self["@transformersDictionary"];
  33484. } else {
  33485. return $1;
  33486. }
  33487. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  33488. },
  33489. args: [],
  33490. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  33491. referencedClasses: ["Dictionary"],
  33492. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  33493. }),
  33494. $globals.CodeGenerator);
  33495. $core.addMethod(
  33496. $core.method({
  33497. selector: "translator",
  33498. protocol: "compiling",
  33499. fn: function (){
  33500. var self=this,$self=this;
  33501. return $core.withContext(function($ctx1) {
  33502. var $1;
  33503. $1=$recv($globals.IRASTTranslator)._new();
  33504. $recv($1)._source_($self._source());
  33505. $recv($1)._theClass_($self._currentClass());
  33506. return $recv($1)._yourself();
  33507. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  33508. },
  33509. args: [],
  33510. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  33511. referencedClasses: ["IRASTTranslator"],
  33512. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  33513. }),
  33514. $globals.CodeGenerator);
  33515. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass"], "Compiler-Core");
  33516. $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`";
  33517. $core.addMethod(
  33518. $core.method({
  33519. selector: "codeGeneratorClass",
  33520. protocol: "accessing",
  33521. fn: function (){
  33522. var self=this,$self=this;
  33523. return $core.withContext(function($ctx1) {
  33524. var $1,$receiver;
  33525. $1=$self["@codeGeneratorClass"];
  33526. if(($receiver = $1) == null || $receiver.a$nil){
  33527. return $globals.InliningCodeGenerator;
  33528. } else {
  33529. return $1;
  33530. }
  33531. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  33532. },
  33533. args: [],
  33534. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  33535. referencedClasses: ["InliningCodeGenerator"],
  33536. messageSends: ["ifNil:"]
  33537. }),
  33538. $globals.Compiler);
  33539. $core.addMethod(
  33540. $core.method({
  33541. selector: "codeGeneratorClass:",
  33542. protocol: "accessing",
  33543. fn: function (aClass){
  33544. var self=this,$self=this;
  33545. $self["@codeGeneratorClass"]=aClass;
  33546. return self;
  33547. },
  33548. args: ["aClass"],
  33549. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  33550. referencedClasses: [],
  33551. messageSends: []
  33552. }),
  33553. $globals.Compiler);
  33554. $core.addMethod(
  33555. $core.method({
  33556. selector: "compile:forClass:protocol:",
  33557. protocol: "compiling",
  33558. fn: function (aString,aClass,anotherString){
  33559. var self=this,$self=this;
  33560. return $core.withContext(function($ctx1) {
  33561. $self._source_(aString);
  33562. return $self._compileNode_forClass_package_($self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  33563. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  33564. },
  33565. args: ["aString", "aClass", "anotherString"],
  33566. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  33567. referencedClasses: [],
  33568. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  33569. }),
  33570. $globals.Compiler);
  33571. $core.addMethod(
  33572. $core.method({
  33573. selector: "compileExpression:on:",
  33574. protocol: "compiling",
  33575. fn: function (aString,anObject){
  33576. var self=this,$self=this;
  33577. return $core.withContext(function($ctx1) {
  33578. var $1;
  33579. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  33580. $ctx1.sendIdx[","]=1;
  33581. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  33582. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  33583. },
  33584. args: ["aString", "anObject"],
  33585. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  33586. referencedClasses: [],
  33587. messageSends: ["compile:forClass:protocol:", ",", "class"]
  33588. }),
  33589. $globals.Compiler);
  33590. $core.addMethod(
  33591. $core.method({
  33592. selector: "compileNode:",
  33593. protocol: "compiling",
  33594. fn: function (aNode){
  33595. var self=this,$self=this;
  33596. var generator,result;
  33597. return $core.withContext(function($ctx1) {
  33598. var $1;
  33599. generator=$recv($self._codeGeneratorClass())._new();
  33600. $1=generator;
  33601. $recv($1)._source_($self._source());
  33602. $recv($1)._currentClass_($self._currentClass());
  33603. $recv($1)._currentPackage_($self._currentPackage());
  33604. result=$recv(generator)._compileNode_(aNode);
  33605. return result;
  33606. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  33607. },
  33608. args: ["aNode"],
  33609. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09^ result",
  33610. referencedClasses: [],
  33611. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:"]
  33612. }),
  33613. $globals.Compiler);
  33614. $core.addMethod(
  33615. $core.method({
  33616. selector: "compileNode:forClass:package:",
  33617. protocol: "compiling",
  33618. fn: function (aNode,aClass,aPackage){
  33619. var self=this,$self=this;
  33620. return $core.withContext(function($ctx1) {
  33621. $self._currentClass_(aClass);
  33622. $self._currentPackage_(aPackage);
  33623. return $self._compileNode_(aNode);
  33624. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  33625. },
  33626. args: ["aNode", "aClass", "aPackage"],
  33627. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  33628. referencedClasses: [],
  33629. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  33630. }),
  33631. $globals.Compiler);
  33632. $core.addMethod(
  33633. $core.method({
  33634. selector: "currentClass",
  33635. protocol: "accessing",
  33636. fn: function (){
  33637. var self=this,$self=this;
  33638. return $self["@currentClass"];
  33639. },
  33640. args: [],
  33641. source: "currentClass\x0a\x09^ currentClass",
  33642. referencedClasses: [],
  33643. messageSends: []
  33644. }),
  33645. $globals.Compiler);
  33646. $core.addMethod(
  33647. $core.method({
  33648. selector: "currentClass:",
  33649. protocol: "accessing",
  33650. fn: function (aClass){
  33651. var self=this,$self=this;
  33652. $self["@currentClass"]=aClass;
  33653. return self;
  33654. },
  33655. args: ["aClass"],
  33656. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33657. referencedClasses: [],
  33658. messageSends: []
  33659. }),
  33660. $globals.Compiler);
  33661. $core.addMethod(
  33662. $core.method({
  33663. selector: "currentPackage",
  33664. protocol: "accessing",
  33665. fn: function (){
  33666. var self=this,$self=this;
  33667. return $self["@currentPackage"];
  33668. },
  33669. args: [],
  33670. source: "currentPackage\x0a\x09^ currentPackage",
  33671. referencedClasses: [],
  33672. messageSends: []
  33673. }),
  33674. $globals.Compiler);
  33675. $core.addMethod(
  33676. $core.method({
  33677. selector: "currentPackage:",
  33678. protocol: "accessing",
  33679. fn: function (anObject){
  33680. var self=this,$self=this;
  33681. $self["@currentPackage"]=anObject;
  33682. return self;
  33683. },
  33684. args: ["anObject"],
  33685. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33686. referencedClasses: [],
  33687. messageSends: []
  33688. }),
  33689. $globals.Compiler);
  33690. $core.addMethod(
  33691. $core.method({
  33692. selector: "eval:",
  33693. protocol: "compiling",
  33694. fn: function (aString){
  33695. var self=this,$self=this;
  33696. return $core.withContext(function($ctx1) {
  33697. return eval(aString);
  33698. return self;
  33699. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  33700. },
  33701. args: ["aString"],
  33702. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  33703. referencedClasses: [],
  33704. messageSends: []
  33705. }),
  33706. $globals.Compiler);
  33707. $core.addMethod(
  33708. $core.method({
  33709. selector: "eval:forPackage:",
  33710. protocol: "compiling",
  33711. fn: function (aString,aPackage){
  33712. var self=this,$self=this;
  33713. return $core.withContext(function($ctx1) {
  33714. var $receiver;
  33715. if(($receiver = aPackage) == null || $receiver.a$nil){
  33716. return $self._eval_(aString);
  33717. $ctx1.sendIdx["eval:"]=1;
  33718. } else {
  33719. return $recv(aPackage)._eval_(aString);
  33720. }
  33721. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  33722. },
  33723. args: ["aString", "aPackage"],
  33724. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  33725. referencedClasses: [],
  33726. messageSends: ["ifNil:ifNotNil:", "eval:"]
  33727. }),
  33728. $globals.Compiler);
  33729. $core.addMethod(
  33730. $core.method({
  33731. selector: "evaluateExpression:",
  33732. protocol: "compiling",
  33733. fn: function (aString){
  33734. var self=this,$self=this;
  33735. return $core.withContext(function($ctx1) {
  33736. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  33737. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  33738. },
  33739. args: ["aString"],
  33740. 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",
  33741. referencedClasses: ["DoIt"],
  33742. messageSends: ["evaluateExpression:on:", "new"]
  33743. }),
  33744. $globals.Compiler);
  33745. $core.addMethod(
  33746. $core.method({
  33747. selector: "evaluateExpression:on:",
  33748. protocol: "compiling",
  33749. fn: function (aString,anObject){
  33750. var self=this,$self=this;
  33751. var result,method;
  33752. return $core.withContext(function($ctx1) {
  33753. var $1;
  33754. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  33755. $recv(method)._protocol_("**xxxDoIt");
  33756. $1=$recv(anObject)._class();
  33757. $ctx1.sendIdx["class"]=1;
  33758. $recv($1)._addCompiledMethod_(method);
  33759. result=$recv(anObject)._xxxDoIt();
  33760. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  33761. return result;
  33762. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  33763. },
  33764. args: ["aString", "anObject"],
  33765. 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",
  33766. referencedClasses: [],
  33767. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  33768. }),
  33769. $globals.Compiler);
  33770. $core.addMethod(
  33771. $core.method({
  33772. selector: "install:forClass:protocol:",
  33773. protocol: "compiling",
  33774. fn: function (aString,aBehavior,anotherString){
  33775. var self=this,$self=this;
  33776. var compiledMethod;
  33777. return $core.withContext(function($ctx1) {
  33778. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  33779. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  33780. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  33781. },
  33782. args: ["aString", "aBehavior", "anotherString"],
  33783. 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",
  33784. referencedClasses: ["ClassBuilder"],
  33785. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  33786. }),
  33787. $globals.Compiler);
  33788. $core.addMethod(
  33789. $core.method({
  33790. selector: "parse:",
  33791. protocol: "compiling",
  33792. fn: function (aString){
  33793. var self=this,$self=this;
  33794. return $core.withContext(function($ctx1) {
  33795. return $recv($globals.Smalltalk)._parse_(aString);
  33796. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  33797. },
  33798. args: ["aString"],
  33799. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  33800. referencedClasses: ["Smalltalk"],
  33801. messageSends: ["parse:"]
  33802. }),
  33803. $globals.Compiler);
  33804. $core.addMethod(
  33805. $core.method({
  33806. selector: "parseExpression:",
  33807. protocol: "compiling",
  33808. fn: function (aString){
  33809. var self=this,$self=this;
  33810. return $core.withContext(function($ctx1) {
  33811. var $1;
  33812. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  33813. $ctx1.sendIdx[","]=1;
  33814. return $self._parse_($1);
  33815. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  33816. },
  33817. args: ["aString"],
  33818. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  33819. referencedClasses: [],
  33820. messageSends: ["parse:", ","]
  33821. }),
  33822. $globals.Compiler);
  33823. $core.addMethod(
  33824. $core.method({
  33825. selector: "recompile:",
  33826. protocol: "compiling",
  33827. fn: function (aClass){
  33828. var self=this,$self=this;
  33829. return $core.withContext(function($ctx1) {
  33830. var $1,$2,$3,$receiver;
  33831. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  33832. return $core.withContext(function($ctx2) {
  33833. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  33834. $ctx2.sendIdx["="]=1;
  33835. if($core.assert($1)){
  33836. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  33837. }
  33838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33839. }),"Recompiling ".__comma($recv(aClass)._name()));
  33840. $2=$recv(aClass)._theMetaClass();
  33841. if(($receiver = $2) == null || $receiver.a$nil){
  33842. $2;
  33843. } else {
  33844. var meta;
  33845. meta=$receiver;
  33846. $3=$recv(meta).__eq(aClass);
  33847. if(!$core.assert($3)){
  33848. $self._recompile_(meta);
  33849. }
  33850. }
  33851. return self;
  33852. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  33853. },
  33854. args: ["aClass"],
  33855. 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 ] ]",
  33856. referencedClasses: [],
  33857. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  33858. }),
  33859. $globals.Compiler);
  33860. $core.addMethod(
  33861. $core.method({
  33862. selector: "recompileAll",
  33863. protocol: "compiling",
  33864. fn: function (){
  33865. var self=this,$self=this;
  33866. return $core.withContext(function($ctx1) {
  33867. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  33868. return $core.withContext(function($ctx2) {
  33869. return $self._recompile_(each);
  33870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33871. }),"Compiling all classes...");
  33872. return self;
  33873. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  33874. },
  33875. args: [],
  33876. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  33877. referencedClasses: ["Smalltalk"],
  33878. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  33879. }),
  33880. $globals.Compiler);
  33881. $core.addMethod(
  33882. $core.method({
  33883. selector: "source",
  33884. protocol: "accessing",
  33885. fn: function (){
  33886. var self=this,$self=this;
  33887. return $core.withContext(function($ctx1) {
  33888. var $1,$receiver;
  33889. $1=$self["@source"];
  33890. if(($receiver = $1) == null || $receiver.a$nil){
  33891. return "";
  33892. } else {
  33893. return $1;
  33894. }
  33895. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  33896. },
  33897. args: [],
  33898. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33899. referencedClasses: [],
  33900. messageSends: ["ifNil:"]
  33901. }),
  33902. $globals.Compiler);
  33903. $core.addMethod(
  33904. $core.method({
  33905. selector: "source:",
  33906. protocol: "accessing",
  33907. fn: function (aString){
  33908. var self=this,$self=this;
  33909. $self["@source"]=aString;
  33910. return self;
  33911. },
  33912. args: ["aString"],
  33913. source: "source: aString\x0a\x09source := aString",
  33914. referencedClasses: [],
  33915. messageSends: []
  33916. }),
  33917. $globals.Compiler);
  33918. $core.addMethod(
  33919. $core.method({
  33920. selector: "eval:",
  33921. protocol: "evaluating",
  33922. fn: function (aString){
  33923. var self=this,$self=this;
  33924. return $core.withContext(function($ctx1) {
  33925. return $recv($self._new())._eval_(aString);
  33926. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  33927. },
  33928. args: ["aString"],
  33929. source: "eval: aString\x0a\x09^ self new eval: aString",
  33930. referencedClasses: [],
  33931. messageSends: ["eval:", "new"]
  33932. }),
  33933. $globals.Compiler.a$cls);
  33934. $core.addMethod(
  33935. $core.method({
  33936. selector: "recompile:",
  33937. protocol: "compiling",
  33938. fn: function (aClass){
  33939. var self=this,$self=this;
  33940. return $core.withContext(function($ctx1) {
  33941. $recv($self._new())._recompile_(aClass);
  33942. return self;
  33943. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  33944. },
  33945. args: ["aClass"],
  33946. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  33947. referencedClasses: [],
  33948. messageSends: ["recompile:", "new"]
  33949. }),
  33950. $globals.Compiler.a$cls);
  33951. $core.addMethod(
  33952. $core.method({
  33953. selector: "recompileAll",
  33954. protocol: "compiling",
  33955. fn: function (){
  33956. var self=this,$self=this;
  33957. return $core.withContext(function($ctx1) {
  33958. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  33959. return $core.withContext(function($ctx2) {
  33960. return $self._recompile_(each);
  33961. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33962. }));
  33963. return self;
  33964. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  33965. },
  33966. args: [],
  33967. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  33968. referencedClasses: ["Smalltalk"],
  33969. messageSends: ["do:", "classes", "recompile:"]
  33970. }),
  33971. $globals.Compiler.a$cls);
  33972. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  33973. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  33974. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  33975. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  33976. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  33977. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  33978. $core.addMethod(
  33979. $core.method({
  33980. selector: "evaluate:context:",
  33981. protocol: "evaluating",
  33982. fn: function (aString,aContext){
  33983. var self=this,$self=this;
  33984. var compiler,ast;
  33985. return $core.withContext(function($ctx1) {
  33986. var $1;
  33987. var $early={};
  33988. try {
  33989. compiler=$recv($globals.Compiler)._new();
  33990. $recv((function(){
  33991. return $core.withContext(function($ctx2) {
  33992. ast=$recv(compiler)._parseExpression_(aString);
  33993. return ast;
  33994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33995. }))._on_do_($globals.Error,(function(ex){
  33996. return $core.withContext(function($ctx2) {
  33997. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  33998. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  33999. }));
  34000. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  34001. $recv($1)._context_(aContext);
  34002. $recv($1)._visit_(ast);
  34003. return $recv(aContext)._evaluateNode_(ast);
  34004. }
  34005. catch(e) {if(e===$early)return e[0]; throw e}
  34006. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  34007. },
  34008. args: ["aString", "aContext"],
  34009. 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",
  34010. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  34011. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  34012. }),
  34013. $globals.Evaluator);
  34014. $core.addMethod(
  34015. $core.method({
  34016. selector: "evaluate:for:",
  34017. protocol: "evaluating",
  34018. fn: function (aString,anObject){
  34019. var self=this,$self=this;
  34020. return $core.withContext(function($ctx1) {
  34021. return $recv(anObject)._evaluate_on_(aString,self);
  34022. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  34023. },
  34024. args: ["aString", "anObject"],
  34025. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  34026. referencedClasses: [],
  34027. messageSends: ["evaluate:on:"]
  34028. }),
  34029. $globals.Evaluator);
  34030. $core.addMethod(
  34031. $core.method({
  34032. selector: "evaluate:receiver:",
  34033. protocol: "evaluating",
  34034. fn: function (aString,anObject){
  34035. var self=this,$self=this;
  34036. var compiler;
  34037. return $core.withContext(function($ctx1) {
  34038. var $early={};
  34039. try {
  34040. compiler=$recv($globals.Compiler)._new();
  34041. $recv((function(){
  34042. return $core.withContext(function($ctx2) {
  34043. return $recv(compiler)._parseExpression_(aString);
  34044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34045. }))._on_do_($globals.Error,(function(ex){
  34046. return $core.withContext(function($ctx2) {
  34047. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  34048. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  34049. }));
  34050. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  34051. }
  34052. catch(e) {if(e===$early)return e[0]; throw e}
  34053. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  34054. },
  34055. args: ["aString", "anObject"],
  34056. 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",
  34057. referencedClasses: ["Compiler", "Error", "Terminal"],
  34058. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  34059. }),
  34060. $globals.Evaluator);
  34061. $core.addMethod(
  34062. $core.method({
  34063. selector: "evaluate:for:",
  34064. protocol: "instance creation",
  34065. fn: function (aString,anObject){
  34066. var self=this,$self=this;
  34067. return $core.withContext(function($ctx1) {
  34068. return $recv($self._new())._evaluate_for_(aString,anObject);
  34069. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  34070. },
  34071. args: ["aString", "anObject"],
  34072. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  34073. referencedClasses: [],
  34074. messageSends: ["evaluate:for:", "new"]
  34075. }),
  34076. $globals.Evaluator.a$cls);
  34077. $core.addMethod(
  34078. $core.method({
  34079. selector: "asVariableName",
  34080. protocol: "*Compiler-Core",
  34081. fn: function (){
  34082. var self=this,$self=this;
  34083. return $core.withContext(function($ctx1) {
  34084. var $1;
  34085. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  34086. if($core.assert($1)){
  34087. return $self.__comma("_");
  34088. } else {
  34089. return self;
  34090. }
  34091. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  34092. },
  34093. args: [],
  34094. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  34095. referencedClasses: ["Smalltalk"],
  34096. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  34097. }),
  34098. $globals.String);
  34099. });
  34100. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  34101. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  34102. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  34103. $core.addPackage("Compiler-AST");
  34104. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  34105. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  34106. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  34107. $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.";
  34108. $core.addMethod(
  34109. $core.method({
  34110. selector: "inPosition:",
  34111. protocol: "testing",
  34112. fn: function (aPoint){
  34113. var self=this,$self=this;
  34114. return $core.withContext(function($ctx1) {
  34115. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  34116. return $core.withContext(function($ctx2) {
  34117. return $recv($self._positionEnd()).__gt_eq(aPoint);
  34118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34119. }));
  34120. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  34121. },
  34122. args: ["aPoint"],
  34123. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  34124. referencedClasses: [],
  34125. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  34126. }),
  34127. $globals.ASTNode);
  34128. $core.addMethod(
  34129. $core.method({
  34130. selector: "isAssignmentNode",
  34131. protocol: "testing",
  34132. fn: function (){
  34133. var self=this,$self=this;
  34134. return false;
  34135. },
  34136. args: [],
  34137. source: "isAssignmentNode\x0a\x09^ false",
  34138. referencedClasses: [],
  34139. messageSends: []
  34140. }),
  34141. $globals.ASTNode);
  34142. $core.addMethod(
  34143. $core.method({
  34144. selector: "isBlockNode",
  34145. protocol: "testing",
  34146. fn: function (){
  34147. var self=this,$self=this;
  34148. return false;
  34149. },
  34150. args: [],
  34151. source: "isBlockNode\x0a\x09^ false",
  34152. referencedClasses: [],
  34153. messageSends: []
  34154. }),
  34155. $globals.ASTNode);
  34156. $core.addMethod(
  34157. $core.method({
  34158. selector: "isBlockSequenceNode",
  34159. protocol: "testing",
  34160. fn: function (){
  34161. var self=this,$self=this;
  34162. return false;
  34163. },
  34164. args: [],
  34165. source: "isBlockSequenceNode\x0a\x09^ false",
  34166. referencedClasses: [],
  34167. messageSends: []
  34168. }),
  34169. $globals.ASTNode);
  34170. $core.addMethod(
  34171. $core.method({
  34172. selector: "isCascadeNode",
  34173. protocol: "testing",
  34174. fn: function (){
  34175. var self=this,$self=this;
  34176. return false;
  34177. },
  34178. args: [],
  34179. source: "isCascadeNode\x0a\x09^ false",
  34180. referencedClasses: [],
  34181. messageSends: []
  34182. }),
  34183. $globals.ASTNode);
  34184. $core.addMethod(
  34185. $core.method({
  34186. selector: "isImmutable",
  34187. protocol: "testing",
  34188. fn: function (){
  34189. var self=this,$self=this;
  34190. return false;
  34191. },
  34192. args: [],
  34193. source: "isImmutable\x0a\x09^ false",
  34194. referencedClasses: [],
  34195. messageSends: []
  34196. }),
  34197. $globals.ASTNode);
  34198. $core.addMethod(
  34199. $core.method({
  34200. selector: "isJSStatementNode",
  34201. protocol: "testing",
  34202. fn: function (){
  34203. var self=this,$self=this;
  34204. return false;
  34205. },
  34206. args: [],
  34207. source: "isJSStatementNode\x0a\x09^ false",
  34208. referencedClasses: [],
  34209. messageSends: []
  34210. }),
  34211. $globals.ASTNode);
  34212. $core.addMethod(
  34213. $core.method({
  34214. selector: "isNavigationNode",
  34215. protocol: "testing",
  34216. fn: function (){
  34217. var self=this,$self=this;
  34218. return false;
  34219. },
  34220. args: [],
  34221. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  34222. referencedClasses: [],
  34223. messageSends: []
  34224. }),
  34225. $globals.ASTNode);
  34226. $core.addMethod(
  34227. $core.method({
  34228. selector: "isReturnNode",
  34229. protocol: "testing",
  34230. fn: function (){
  34231. var self=this,$self=this;
  34232. return false;
  34233. },
  34234. args: [],
  34235. source: "isReturnNode\x0a\x09^ false",
  34236. referencedClasses: [],
  34237. messageSends: []
  34238. }),
  34239. $globals.ASTNode);
  34240. $core.addMethod(
  34241. $core.method({
  34242. selector: "isSendNode",
  34243. protocol: "testing",
  34244. fn: function (){
  34245. var self=this,$self=this;
  34246. return false;
  34247. },
  34248. args: [],
  34249. source: "isSendNode\x0a\x09^ false",
  34250. referencedClasses: [],
  34251. messageSends: []
  34252. }),
  34253. $globals.ASTNode);
  34254. $core.addMethod(
  34255. $core.method({
  34256. selector: "isSequenceNode",
  34257. protocol: "testing",
  34258. fn: function (){
  34259. var self=this,$self=this;
  34260. return false;
  34261. },
  34262. args: [],
  34263. source: "isSequenceNode\x0a\x09^ false",
  34264. referencedClasses: [],
  34265. messageSends: []
  34266. }),
  34267. $globals.ASTNode);
  34268. $core.addMethod(
  34269. $core.method({
  34270. selector: "isSuperKeyword",
  34271. protocol: "testing",
  34272. fn: function (){
  34273. var self=this,$self=this;
  34274. return false;
  34275. },
  34276. args: [],
  34277. source: "isSuperKeyword\x0a\x09^ false",
  34278. referencedClasses: [],
  34279. messageSends: []
  34280. }),
  34281. $globals.ASTNode);
  34282. $core.addMethod(
  34283. $core.method({
  34284. selector: "isValueNode",
  34285. protocol: "testing",
  34286. fn: function (){
  34287. var self=this,$self=this;
  34288. return false;
  34289. },
  34290. args: [],
  34291. source: "isValueNode\x0a\x09^ false",
  34292. referencedClasses: [],
  34293. messageSends: []
  34294. }),
  34295. $globals.ASTNode);
  34296. $core.addMethod(
  34297. $core.method({
  34298. selector: "isVariableNode",
  34299. protocol: "testing",
  34300. fn: function (){
  34301. var self=this,$self=this;
  34302. return false;
  34303. },
  34304. args: [],
  34305. source: "isVariableNode\x0a\x09^ false",
  34306. referencedClasses: [],
  34307. messageSends: []
  34308. }),
  34309. $globals.ASTNode);
  34310. $core.addMethod(
  34311. $core.method({
  34312. selector: "location:",
  34313. protocol: "accessing",
  34314. fn: function (aLocation){
  34315. var self=this,$self=this;
  34316. return $core.withContext(function($ctx1) {
  34317. var $3,$2,$1;
  34318. $3=$recv(aLocation)._start();
  34319. $ctx1.sendIdx["start"]=1;
  34320. $2=$recv($3)._line();
  34321. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  34322. $self._position_($1);
  34323. return self;
  34324. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  34325. },
  34326. args: ["aLocation"],
  34327. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  34328. referencedClasses: [],
  34329. messageSends: ["position:", "@", "line", "start", "column"]
  34330. }),
  34331. $globals.ASTNode);
  34332. $core.addMethod(
  34333. $core.method({
  34334. selector: "method",
  34335. protocol: "accessing",
  34336. fn: function (){
  34337. var self=this,$self=this;
  34338. return $core.withContext(function($ctx1) {
  34339. var $1,$receiver;
  34340. $1=$self._parent();
  34341. if(($receiver = $1) == null || $receiver.a$nil){
  34342. return $1;
  34343. } else {
  34344. var node;
  34345. node=$receiver;
  34346. return $recv(node)._method();
  34347. }
  34348. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  34349. },
  34350. args: [],
  34351. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  34352. referencedClasses: [],
  34353. messageSends: ["ifNotNil:", "parent", "method"]
  34354. }),
  34355. $globals.ASTNode);
  34356. $core.addMethod(
  34357. $core.method({
  34358. selector: "navigationNodeAt:ifAbsent:",
  34359. protocol: "accessing",
  34360. fn: function (aPoint,aBlock){
  34361. var self=this,$self=this;
  34362. var children;
  34363. return $core.withContext(function($ctx1) {
  34364. var $2,$1;
  34365. var $early={};
  34366. try {
  34367. children=$recv($self._allDagChildren())._select_((function(each){
  34368. return $core.withContext(function($ctx2) {
  34369. return $recv($recv(each)._isNavigationNode())._and_((function(){
  34370. return $core.withContext(function($ctx3) {
  34371. return $recv(each)._inPosition_(aPoint);
  34372. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34373. }));
  34374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34375. }));
  34376. $recv(children)._ifEmpty_((function(){
  34377. return $core.withContext(function($ctx2) {
  34378. throw $early=[$recv(aBlock)._value()];
  34379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  34380. }));
  34381. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  34382. return $core.withContext(function($ctx2) {
  34383. $2=$recv(a)._positionStart();
  34384. $ctx2.sendIdx["positionStart"]=1;
  34385. $1=$recv($2)._dist_(aPoint);
  34386. $ctx2.sendIdx["dist:"]=1;
  34387. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  34388. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  34389. })))._first();
  34390. }
  34391. catch(e) {if(e===$early)return e[0]; throw e}
  34392. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  34393. },
  34394. args: ["aPoint", "aBlock"],
  34395. 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",
  34396. referencedClasses: [],
  34397. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  34398. }),
  34399. $globals.ASTNode);
  34400. $core.addMethod(
  34401. $core.method({
  34402. selector: "parent",
  34403. protocol: "accessing",
  34404. fn: function (){
  34405. var self=this,$self=this;
  34406. return $self["@parent"];
  34407. },
  34408. args: [],
  34409. source: "parent\x0a\x09^ parent",
  34410. referencedClasses: [],
  34411. messageSends: []
  34412. }),
  34413. $globals.ASTNode);
  34414. $core.addMethod(
  34415. $core.method({
  34416. selector: "parent:",
  34417. protocol: "accessing",
  34418. fn: function (aNode){
  34419. var self=this,$self=this;
  34420. $self["@parent"]=aNode;
  34421. return self;
  34422. },
  34423. args: ["aNode"],
  34424. source: "parent: aNode\x0a\x09parent := aNode",
  34425. referencedClasses: [],
  34426. messageSends: []
  34427. }),
  34428. $globals.ASTNode);
  34429. $core.addMethod(
  34430. $core.method({
  34431. selector: "position",
  34432. protocol: "accessing",
  34433. fn: function (){
  34434. var self=this,$self=this;
  34435. return $core.withContext(function($ctx1) {
  34436. var $1,$2,$receiver;
  34437. $1=$self["@position"];
  34438. if(($receiver = $1) == null || $receiver.a$nil){
  34439. $2=$self._parent();
  34440. if(($receiver = $2) == null || $receiver.a$nil){
  34441. return $2;
  34442. } else {
  34443. var node;
  34444. node=$receiver;
  34445. return $recv(node)._position();
  34446. }
  34447. } else {
  34448. return $1;
  34449. }
  34450. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  34451. },
  34452. args: [],
  34453. 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 ] ]",
  34454. referencedClasses: [],
  34455. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  34456. }),
  34457. $globals.ASTNode);
  34458. $core.addMethod(
  34459. $core.method({
  34460. selector: "position:",
  34461. protocol: "accessing",
  34462. fn: function (aPosition){
  34463. var self=this,$self=this;
  34464. $self["@position"]=aPosition;
  34465. return self;
  34466. },
  34467. args: ["aPosition"],
  34468. source: "position: aPosition\x0a\x09position := aPosition",
  34469. referencedClasses: [],
  34470. messageSends: []
  34471. }),
  34472. $globals.ASTNode);
  34473. $core.addMethod(
  34474. $core.method({
  34475. selector: "positionEnd",
  34476. protocol: "accessing",
  34477. fn: function (){
  34478. var self=this,$self=this;
  34479. return $core.withContext(function($ctx1) {
  34480. var $1,$6,$5,$4,$3,$2;
  34481. $1=$self._positionStart();
  34482. $6=$self._source();
  34483. $ctx1.sendIdx["source"]=1;
  34484. $5=$recv($6)._lines();
  34485. $ctx1.sendIdx["lines"]=1;
  34486. $4=$recv($5)._size();
  34487. $ctx1.sendIdx["size"]=1;
  34488. $3=$recv($4).__minus((1));
  34489. $ctx1.sendIdx["-"]=1;
  34490. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  34491. return $recv($1).__plus($2);
  34492. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  34493. },
  34494. args: [],
  34495. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  34496. referencedClasses: [],
  34497. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  34498. }),
  34499. $globals.ASTNode);
  34500. $core.addMethod(
  34501. $core.method({
  34502. selector: "positionStart",
  34503. protocol: "accessing",
  34504. fn: function (){
  34505. var self=this,$self=this;
  34506. return $core.withContext(function($ctx1) {
  34507. return $self._position();
  34508. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  34509. },
  34510. args: [],
  34511. source: "positionStart\x0a\x09^ self position",
  34512. referencedClasses: [],
  34513. messageSends: ["position"]
  34514. }),
  34515. $globals.ASTNode);
  34516. $core.addMethod(
  34517. $core.method({
  34518. selector: "requiresSmalltalkContext",
  34519. protocol: "testing",
  34520. fn: function (){
  34521. var self=this,$self=this;
  34522. return $core.withContext(function($ctx1) {
  34523. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  34524. return $core.withContext(function($ctx2) {
  34525. return $recv(each)._requiresSmalltalkContext();
  34526. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34527. }),(function(){
  34528. return nil;
  34529. })))._notNil();
  34530. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  34531. },
  34532. args: [],
  34533. 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",
  34534. referencedClasses: [],
  34535. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  34536. }),
  34537. $globals.ASTNode);
  34538. $core.addMethod(
  34539. $core.method({
  34540. selector: "shouldBeAliased",
  34541. protocol: "accessing",
  34542. fn: function (){
  34543. var self=this,$self=this;
  34544. return $core.withContext(function($ctx1) {
  34545. var $1,$receiver;
  34546. $1=$self["@shouldBeAliased"];
  34547. if(($receiver = $1) == null || $receiver.a$nil){
  34548. return false;
  34549. } else {
  34550. return $1;
  34551. }
  34552. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  34553. },
  34554. args: [],
  34555. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  34556. referencedClasses: [],
  34557. messageSends: ["ifNil:"]
  34558. }),
  34559. $globals.ASTNode);
  34560. $core.addMethod(
  34561. $core.method({
  34562. selector: "shouldBeAliased:",
  34563. protocol: "accessing",
  34564. fn: function (aBoolean){
  34565. var self=this,$self=this;
  34566. $self["@shouldBeAliased"]=aBoolean;
  34567. return self;
  34568. },
  34569. args: ["aBoolean"],
  34570. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  34571. referencedClasses: [],
  34572. messageSends: []
  34573. }),
  34574. $globals.ASTNode);
  34575. $core.addMethod(
  34576. $core.method({
  34577. selector: "size",
  34578. protocol: "accessing",
  34579. fn: function (){
  34580. var self=this,$self=this;
  34581. return $core.withContext(function($ctx1) {
  34582. return $recv($self._source())._size();
  34583. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  34584. },
  34585. args: [],
  34586. source: "size\x0a\x09^ self source size",
  34587. referencedClasses: [],
  34588. messageSends: ["size", "source"]
  34589. }),
  34590. $globals.ASTNode);
  34591. $core.addMethod(
  34592. $core.method({
  34593. selector: "source",
  34594. protocol: "accessing",
  34595. fn: function (){
  34596. var self=this,$self=this;
  34597. return $core.withContext(function($ctx1) {
  34598. var $1,$receiver;
  34599. $1=$self["@source"];
  34600. if(($receiver = $1) == null || $receiver.a$nil){
  34601. return "";
  34602. } else {
  34603. return $1;
  34604. }
  34605. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  34606. },
  34607. args: [],
  34608. source: "source\x0a\x09^ source ifNil: [ '' ]",
  34609. referencedClasses: [],
  34610. messageSends: ["ifNil:"]
  34611. }),
  34612. $globals.ASTNode);
  34613. $core.addMethod(
  34614. $core.method({
  34615. selector: "source:",
  34616. protocol: "accessing",
  34617. fn: function (aString){
  34618. var self=this,$self=this;
  34619. $self["@source"]=aString;
  34620. return self;
  34621. },
  34622. args: ["aString"],
  34623. source: "source: aString\x0a\x09source := aString",
  34624. referencedClasses: [],
  34625. messageSends: []
  34626. }),
  34627. $globals.ASTNode);
  34628. $core.addMethod(
  34629. $core.method({
  34630. selector: "withTail:",
  34631. protocol: "building",
  34632. fn: function (aCollection){
  34633. var self=this,$self=this;
  34634. return $core.withContext(function($ctx1) {
  34635. var $1;
  34636. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  34637. return $core.withContext(function($ctx2) {
  34638. $1=$recv($globals.SendNode)._new();
  34639. $recv($1)._position_($recv(send)._position());
  34640. $recv($1)._source_($recv(send)._source());
  34641. $recv($1)._receiver_(receiver);
  34642. $recv($1)._selector_($recv(send)._selector());
  34643. $recv($1)._arguments_($recv(send)._arguments());
  34644. return $recv($1)._yourself();
  34645. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  34646. }));
  34647. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  34648. },
  34649. args: ["aCollection"],
  34650. 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 ]",
  34651. referencedClasses: ["SendNode"],
  34652. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  34653. }),
  34654. $globals.ASTNode);
  34655. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  34656. $globals.AssignmentNode.comment="I represent an assignment node.";
  34657. $core.addMethod(
  34658. $core.method({
  34659. selector: "acceptDagVisitor:",
  34660. protocol: "visiting",
  34661. fn: function (aVisitor){
  34662. var self=this,$self=this;
  34663. return $core.withContext(function($ctx1) {
  34664. return $recv(aVisitor)._visitAssignmentNode_(self);
  34665. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  34666. },
  34667. args: ["aVisitor"],
  34668. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  34669. referencedClasses: [],
  34670. messageSends: ["visitAssignmentNode:"]
  34671. }),
  34672. $globals.AssignmentNode);
  34673. $core.addMethod(
  34674. $core.method({
  34675. selector: "dagChildren",
  34676. protocol: "accessing",
  34677. fn: function (){
  34678. var self=this,$self=this;
  34679. return $core.withContext(function($ctx1) {
  34680. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  34681. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  34682. },
  34683. args: [],
  34684. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  34685. referencedClasses: ["Array"],
  34686. messageSends: ["with:with:", "left", "right"]
  34687. }),
  34688. $globals.AssignmentNode);
  34689. $core.addMethod(
  34690. $core.method({
  34691. selector: "isAssignmentNode",
  34692. protocol: "testing",
  34693. fn: function (){
  34694. var self=this,$self=this;
  34695. return true;
  34696. },
  34697. args: [],
  34698. source: "isAssignmentNode\x0a\x09^ true",
  34699. referencedClasses: [],
  34700. messageSends: []
  34701. }),
  34702. $globals.AssignmentNode);
  34703. $core.addMethod(
  34704. $core.method({
  34705. selector: "left",
  34706. protocol: "accessing",
  34707. fn: function (){
  34708. var self=this,$self=this;
  34709. return $self["@left"];
  34710. },
  34711. args: [],
  34712. source: "left\x0a\x09^ left",
  34713. referencedClasses: [],
  34714. messageSends: []
  34715. }),
  34716. $globals.AssignmentNode);
  34717. $core.addMethod(
  34718. $core.method({
  34719. selector: "left:",
  34720. protocol: "accessing",
  34721. fn: function (aNode){
  34722. var self=this,$self=this;
  34723. $self["@left"]=aNode;
  34724. return self;
  34725. },
  34726. args: ["aNode"],
  34727. source: "left: aNode\x0a\x09left := aNode",
  34728. referencedClasses: [],
  34729. messageSends: []
  34730. }),
  34731. $globals.AssignmentNode);
  34732. $core.addMethod(
  34733. $core.method({
  34734. selector: "right",
  34735. protocol: "accessing",
  34736. fn: function (){
  34737. var self=this,$self=this;
  34738. return $self["@right"];
  34739. },
  34740. args: [],
  34741. source: "right\x0a\x09^ right",
  34742. referencedClasses: [],
  34743. messageSends: []
  34744. }),
  34745. $globals.AssignmentNode);
  34746. $core.addMethod(
  34747. $core.method({
  34748. selector: "right:",
  34749. protocol: "accessing",
  34750. fn: function (aNode){
  34751. var self=this,$self=this;
  34752. $self["@right"]=aNode;
  34753. return self;
  34754. },
  34755. args: ["aNode"],
  34756. source: "right: aNode\x0a\x09right := aNode",
  34757. referencedClasses: [],
  34758. messageSends: []
  34759. }),
  34760. $globals.AssignmentNode);
  34761. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34762. $globals.BlockNode.comment="I represent an block closure node.";
  34763. $core.addMethod(
  34764. $core.method({
  34765. selector: "acceptDagVisitor:",
  34766. protocol: "visiting",
  34767. fn: function (aVisitor){
  34768. var self=this,$self=this;
  34769. return $core.withContext(function($ctx1) {
  34770. return $recv(aVisitor)._visitBlockNode_(self);
  34771. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34772. },
  34773. args: ["aVisitor"],
  34774. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34775. referencedClasses: [],
  34776. messageSends: ["visitBlockNode:"]
  34777. }),
  34778. $globals.BlockNode);
  34779. $core.addMethod(
  34780. $core.method({
  34781. selector: "isBlockNode",
  34782. protocol: "testing",
  34783. fn: function (){
  34784. var self=this,$self=this;
  34785. return true;
  34786. },
  34787. args: [],
  34788. source: "isBlockNode\x0a\x09^ true",
  34789. referencedClasses: [],
  34790. messageSends: []
  34791. }),
  34792. $globals.BlockNode);
  34793. $core.addMethod(
  34794. $core.method({
  34795. selector: "parameters",
  34796. protocol: "accessing",
  34797. fn: function (){
  34798. var self=this,$self=this;
  34799. return $core.withContext(function($ctx1) {
  34800. var $1,$receiver;
  34801. $1=$self["@parameters"];
  34802. if(($receiver = $1) == null || $receiver.a$nil){
  34803. $self["@parameters"]=$recv($globals.Array)._new();
  34804. return $self["@parameters"];
  34805. } else {
  34806. return $1;
  34807. }
  34808. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34809. },
  34810. args: [],
  34811. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34812. referencedClasses: ["Array"],
  34813. messageSends: ["ifNil:", "new"]
  34814. }),
  34815. $globals.BlockNode);
  34816. $core.addMethod(
  34817. $core.method({
  34818. selector: "parameters:",
  34819. protocol: "accessing",
  34820. fn: function (aCollection){
  34821. var self=this,$self=this;
  34822. $self["@parameters"]=aCollection;
  34823. return self;
  34824. },
  34825. args: ["aCollection"],
  34826. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34827. referencedClasses: [],
  34828. messageSends: []
  34829. }),
  34830. $globals.BlockNode);
  34831. $core.addMethod(
  34832. $core.method({
  34833. selector: "scope",
  34834. protocol: "accessing",
  34835. fn: function (){
  34836. var self=this,$self=this;
  34837. return $self["@scope"];
  34838. },
  34839. args: [],
  34840. source: "scope\x0a\x09^ scope",
  34841. referencedClasses: [],
  34842. messageSends: []
  34843. }),
  34844. $globals.BlockNode);
  34845. $core.addMethod(
  34846. $core.method({
  34847. selector: "scope:",
  34848. protocol: "accessing",
  34849. fn: function (aLexicalScope){
  34850. var self=this,$self=this;
  34851. $self["@scope"]=aLexicalScope;
  34852. return self;
  34853. },
  34854. args: ["aLexicalScope"],
  34855. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34856. referencedClasses: [],
  34857. messageSends: []
  34858. }),
  34859. $globals.BlockNode);
  34860. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34861. $globals.CascadeNode.comment="I represent an cascade node.";
  34862. $core.addMethod(
  34863. $core.method({
  34864. selector: "acceptDagVisitor:",
  34865. protocol: "visiting",
  34866. fn: function (aVisitor){
  34867. var self=this,$self=this;
  34868. return $core.withContext(function($ctx1) {
  34869. return $recv(aVisitor)._visitCascadeNode_(self);
  34870. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34871. },
  34872. args: ["aVisitor"],
  34873. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34874. referencedClasses: [],
  34875. messageSends: ["visitCascadeNode:"]
  34876. }),
  34877. $globals.CascadeNode);
  34878. $core.addMethod(
  34879. $core.method({
  34880. selector: "isCascadeNode",
  34881. protocol: "testing",
  34882. fn: function (){
  34883. var self=this,$self=this;
  34884. return true;
  34885. },
  34886. args: [],
  34887. source: "isCascadeNode\x0a\x09^ true",
  34888. referencedClasses: [],
  34889. messageSends: []
  34890. }),
  34891. $globals.CascadeNode);
  34892. $core.addMethod(
  34893. $core.method({
  34894. selector: "receiver",
  34895. protocol: "accessing",
  34896. fn: function (){
  34897. var self=this,$self=this;
  34898. return $self["@receiver"];
  34899. },
  34900. args: [],
  34901. source: "receiver\x0a\x09^ receiver",
  34902. referencedClasses: [],
  34903. messageSends: []
  34904. }),
  34905. $globals.CascadeNode);
  34906. $core.addMethod(
  34907. $core.method({
  34908. selector: "receiver:",
  34909. protocol: "accessing",
  34910. fn: function (aNode){
  34911. var self=this,$self=this;
  34912. $self["@receiver"]=aNode;
  34913. return self;
  34914. },
  34915. args: ["aNode"],
  34916. source: "receiver: aNode\x0a\x09receiver := aNode",
  34917. referencedClasses: [],
  34918. messageSends: []
  34919. }),
  34920. $globals.CascadeNode);
  34921. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34922. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34923. $core.addMethod(
  34924. $core.method({
  34925. selector: "acceptDagVisitor:",
  34926. protocol: "visiting",
  34927. fn: function (aVisitor){
  34928. var self=this,$self=this;
  34929. return $core.withContext(function($ctx1) {
  34930. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34931. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34932. },
  34933. args: ["aVisitor"],
  34934. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34935. referencedClasses: [],
  34936. messageSends: ["visitDynamicArrayNode:"]
  34937. }),
  34938. $globals.DynamicArrayNode);
  34939. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34940. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34941. $core.addMethod(
  34942. $core.method({
  34943. selector: "acceptDagVisitor:",
  34944. protocol: "visiting",
  34945. fn: function (aVisitor){
  34946. var self=this,$self=this;
  34947. return $core.withContext(function($ctx1) {
  34948. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34949. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34950. },
  34951. args: ["aVisitor"],
  34952. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34953. referencedClasses: [],
  34954. messageSends: ["visitDynamicDictionaryNode:"]
  34955. }),
  34956. $globals.DynamicDictionaryNode);
  34957. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34958. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34959. $core.addMethod(
  34960. $core.method({
  34961. selector: "acceptDagVisitor:",
  34962. protocol: "visiting",
  34963. fn: function (aVisitor){
  34964. var self=this,$self=this;
  34965. return $core.withContext(function($ctx1) {
  34966. return $recv(aVisitor)._visitJSStatementNode_(self);
  34967. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34968. },
  34969. args: ["aVisitor"],
  34970. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34971. referencedClasses: [],
  34972. messageSends: ["visitJSStatementNode:"]
  34973. }),
  34974. $globals.JSStatementNode);
  34975. $core.addMethod(
  34976. $core.method({
  34977. selector: "isJSStatementNode",
  34978. protocol: "testing",
  34979. fn: function (){
  34980. var self=this,$self=this;
  34981. return true;
  34982. },
  34983. args: [],
  34984. source: "isJSStatementNode\x0a\x09^ true",
  34985. referencedClasses: [],
  34986. messageSends: []
  34987. }),
  34988. $globals.JSStatementNode);
  34989. $core.addMethod(
  34990. $core.method({
  34991. selector: "requiresSmalltalkContext",
  34992. protocol: "testing",
  34993. fn: function (){
  34994. var self=this,$self=this;
  34995. return true;
  34996. },
  34997. args: [],
  34998. source: "requiresSmalltalkContext\x0a\x09^ true",
  34999. referencedClasses: [],
  35000. messageSends: []
  35001. }),
  35002. $globals.JSStatementNode);
  35003. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  35004. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  35005. $core.addMethod(
  35006. $core.method({
  35007. selector: "acceptDagVisitor:",
  35008. protocol: "visiting",
  35009. fn: function (aVisitor){
  35010. var self=this,$self=this;
  35011. return $core.withContext(function($ctx1) {
  35012. return $recv(aVisitor)._visitMethodNode_(self);
  35013. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  35014. },
  35015. args: ["aVisitor"],
  35016. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  35017. referencedClasses: [],
  35018. messageSends: ["visitMethodNode:"]
  35019. }),
  35020. $globals.MethodNode);
  35021. $core.addMethod(
  35022. $core.method({
  35023. selector: "arguments",
  35024. protocol: "accessing",
  35025. fn: function (){
  35026. var self=this,$self=this;
  35027. return $core.withContext(function($ctx1) {
  35028. var $1,$receiver;
  35029. $1=$self["@arguments"];
  35030. if(($receiver = $1) == null || $receiver.a$nil){
  35031. return [];
  35032. } else {
  35033. return $1;
  35034. }
  35035. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  35036. },
  35037. args: [],
  35038. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  35039. referencedClasses: [],
  35040. messageSends: ["ifNil:"]
  35041. }),
  35042. $globals.MethodNode);
  35043. $core.addMethod(
  35044. $core.method({
  35045. selector: "arguments:",
  35046. protocol: "accessing",
  35047. fn: function (aCollection){
  35048. var self=this,$self=this;
  35049. $self["@arguments"]=aCollection;
  35050. return self;
  35051. },
  35052. args: ["aCollection"],
  35053. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35054. referencedClasses: [],
  35055. messageSends: []
  35056. }),
  35057. $globals.MethodNode);
  35058. $core.addMethod(
  35059. $core.method({
  35060. selector: "classReferences",
  35061. protocol: "accessing",
  35062. fn: function (){
  35063. var self=this,$self=this;
  35064. return $self["@classReferences"];
  35065. },
  35066. args: [],
  35067. source: "classReferences\x0a\x09^ classReferences",
  35068. referencedClasses: [],
  35069. messageSends: []
  35070. }),
  35071. $globals.MethodNode);
  35072. $core.addMethod(
  35073. $core.method({
  35074. selector: "classReferences:",
  35075. protocol: "accessing",
  35076. fn: function (aCollection){
  35077. var self=this,$self=this;
  35078. $self["@classReferences"]=aCollection;
  35079. return self;
  35080. },
  35081. args: ["aCollection"],
  35082. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  35083. referencedClasses: [],
  35084. messageSends: []
  35085. }),
  35086. $globals.MethodNode);
  35087. $core.addMethod(
  35088. $core.method({
  35089. selector: "messageSends",
  35090. protocol: "accessing",
  35091. fn: function (){
  35092. var self=this,$self=this;
  35093. return $core.withContext(function($ctx1) {
  35094. return $recv($self._sendIndexes())._keys();
  35095. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  35096. },
  35097. args: [],
  35098. source: "messageSends\x0a\x09^ self sendIndexes keys",
  35099. referencedClasses: [],
  35100. messageSends: ["keys", "sendIndexes"]
  35101. }),
  35102. $globals.MethodNode);
  35103. $core.addMethod(
  35104. $core.method({
  35105. selector: "method",
  35106. protocol: "accessing",
  35107. fn: function (){
  35108. var self=this,$self=this;
  35109. return self;
  35110. },
  35111. args: [],
  35112. source: "method\x0a\x09^ self",
  35113. referencedClasses: [],
  35114. messageSends: []
  35115. }),
  35116. $globals.MethodNode);
  35117. $core.addMethod(
  35118. $core.method({
  35119. selector: "scope",
  35120. protocol: "accessing",
  35121. fn: function (){
  35122. var self=this,$self=this;
  35123. return $self["@scope"];
  35124. },
  35125. args: [],
  35126. source: "scope\x0a\x09^ scope",
  35127. referencedClasses: [],
  35128. messageSends: []
  35129. }),
  35130. $globals.MethodNode);
  35131. $core.addMethod(
  35132. $core.method({
  35133. selector: "scope:",
  35134. protocol: "accessing",
  35135. fn: function (aMethodScope){
  35136. var self=this,$self=this;
  35137. $self["@scope"]=aMethodScope;
  35138. return self;
  35139. },
  35140. args: ["aMethodScope"],
  35141. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  35142. referencedClasses: [],
  35143. messageSends: []
  35144. }),
  35145. $globals.MethodNode);
  35146. $core.addMethod(
  35147. $core.method({
  35148. selector: "selector",
  35149. protocol: "accessing",
  35150. fn: function (){
  35151. var self=this,$self=this;
  35152. return $self["@selector"];
  35153. },
  35154. args: [],
  35155. source: "selector\x0a\x09^ selector",
  35156. referencedClasses: [],
  35157. messageSends: []
  35158. }),
  35159. $globals.MethodNode);
  35160. $core.addMethod(
  35161. $core.method({
  35162. selector: "selector:",
  35163. protocol: "accessing",
  35164. fn: function (aString){
  35165. var self=this,$self=this;
  35166. $self["@selector"]=aString;
  35167. return self;
  35168. },
  35169. args: ["aString"],
  35170. source: "selector: aString\x0a\x09selector := aString",
  35171. referencedClasses: [],
  35172. messageSends: []
  35173. }),
  35174. $globals.MethodNode);
  35175. $core.addMethod(
  35176. $core.method({
  35177. selector: "sendIndexes",
  35178. protocol: "accessing",
  35179. fn: function (){
  35180. var self=this,$self=this;
  35181. return $self["@sendIndexes"];
  35182. },
  35183. args: [],
  35184. source: "sendIndexes\x0a\x09^ sendIndexes",
  35185. referencedClasses: [],
  35186. messageSends: []
  35187. }),
  35188. $globals.MethodNode);
  35189. $core.addMethod(
  35190. $core.method({
  35191. selector: "sendIndexes:",
  35192. protocol: "accessing",
  35193. fn: function (aDictionary){
  35194. var self=this,$self=this;
  35195. $self["@sendIndexes"]=aDictionary;
  35196. return self;
  35197. },
  35198. args: ["aDictionary"],
  35199. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  35200. referencedClasses: [],
  35201. messageSends: []
  35202. }),
  35203. $globals.MethodNode);
  35204. $core.addMethod(
  35205. $core.method({
  35206. selector: "sequenceNode",
  35207. protocol: "accessing",
  35208. fn: function (){
  35209. var self=this,$self=this;
  35210. return $core.withContext(function($ctx1) {
  35211. var $1;
  35212. var $early={};
  35213. try {
  35214. $recv($self._dagChildren())._do_((function(each){
  35215. return $core.withContext(function($ctx2) {
  35216. $1=$recv(each)._isSequenceNode();
  35217. if($core.assert($1)){
  35218. throw $early=[each];
  35219. }
  35220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35221. }));
  35222. return nil;
  35223. }
  35224. catch(e) {if(e===$early)return e[0]; throw e}
  35225. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  35226. },
  35227. args: [],
  35228. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  35229. referencedClasses: [],
  35230. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  35231. }),
  35232. $globals.MethodNode);
  35233. $core.addMethod(
  35234. $core.method({
  35235. selector: "source",
  35236. protocol: "accessing",
  35237. fn: function (){
  35238. var self=this,$self=this;
  35239. return $self["@source"];
  35240. },
  35241. args: [],
  35242. source: "source\x0a\x09^ source",
  35243. referencedClasses: [],
  35244. messageSends: []
  35245. }),
  35246. $globals.MethodNode);
  35247. $core.addMethod(
  35248. $core.method({
  35249. selector: "source:",
  35250. protocol: "accessing",
  35251. fn: function (aString){
  35252. var self=this,$self=this;
  35253. $self["@source"]=aString;
  35254. return self;
  35255. },
  35256. args: ["aString"],
  35257. source: "source: aString\x0a\x09source := aString",
  35258. referencedClasses: [],
  35259. messageSends: []
  35260. }),
  35261. $globals.MethodNode);
  35262. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  35263. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  35264. $core.addMethod(
  35265. $core.method({
  35266. selector: "acceptDagVisitor:",
  35267. protocol: "visiting",
  35268. fn: function (aVisitor){
  35269. var self=this,$self=this;
  35270. return $core.withContext(function($ctx1) {
  35271. return $recv(aVisitor)._visitReturnNode_(self);
  35272. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  35273. },
  35274. args: ["aVisitor"],
  35275. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  35276. referencedClasses: [],
  35277. messageSends: ["visitReturnNode:"]
  35278. }),
  35279. $globals.ReturnNode);
  35280. $core.addMethod(
  35281. $core.method({
  35282. selector: "isReturnNode",
  35283. protocol: "testing",
  35284. fn: function (){
  35285. var self=this,$self=this;
  35286. return true;
  35287. },
  35288. args: [],
  35289. source: "isReturnNode\x0a\x09^ true",
  35290. referencedClasses: [],
  35291. messageSends: []
  35292. }),
  35293. $globals.ReturnNode);
  35294. $core.addMethod(
  35295. $core.method({
  35296. selector: "nonLocalReturn",
  35297. protocol: "testing",
  35298. fn: function (){
  35299. var self=this,$self=this;
  35300. return $core.withContext(function($ctx1) {
  35301. return $recv($recv($self._scope())._isMethodScope())._not();
  35302. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  35303. },
  35304. args: [],
  35305. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  35306. referencedClasses: [],
  35307. messageSends: ["not", "isMethodScope", "scope"]
  35308. }),
  35309. $globals.ReturnNode);
  35310. $core.addMethod(
  35311. $core.method({
  35312. selector: "scope",
  35313. protocol: "accessing",
  35314. fn: function (){
  35315. var self=this,$self=this;
  35316. return $self["@scope"];
  35317. },
  35318. args: [],
  35319. source: "scope\x0a\x09^ scope",
  35320. referencedClasses: [],
  35321. messageSends: []
  35322. }),
  35323. $globals.ReturnNode);
  35324. $core.addMethod(
  35325. $core.method({
  35326. selector: "scope:",
  35327. protocol: "accessing",
  35328. fn: function (aLexicalScope){
  35329. var self=this,$self=this;
  35330. $self["@scope"]=aLexicalScope;
  35331. return self;
  35332. },
  35333. args: ["aLexicalScope"],
  35334. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35335. referencedClasses: [],
  35336. messageSends: []
  35337. }),
  35338. $globals.ReturnNode);
  35339. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  35340. $globals.SendNode.comment="I represent an message send node.";
  35341. $core.addMethod(
  35342. $core.method({
  35343. selector: "acceptDagVisitor:",
  35344. protocol: "visiting",
  35345. fn: function (aVisitor){
  35346. var self=this,$self=this;
  35347. return $core.withContext(function($ctx1) {
  35348. return $recv(aVisitor)._visitSendNode_(self);
  35349. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  35350. },
  35351. args: ["aVisitor"],
  35352. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  35353. referencedClasses: [],
  35354. messageSends: ["visitSendNode:"]
  35355. }),
  35356. $globals.SendNode);
  35357. $core.addMethod(
  35358. $core.method({
  35359. selector: "arguments",
  35360. protocol: "accessing",
  35361. fn: function (){
  35362. var self=this,$self=this;
  35363. return $core.withContext(function($ctx1) {
  35364. var $1,$receiver;
  35365. $1=$self["@arguments"];
  35366. if(($receiver = $1) == null || $receiver.a$nil){
  35367. $self["@arguments"]=[];
  35368. return $self["@arguments"];
  35369. } else {
  35370. return $1;
  35371. }
  35372. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  35373. },
  35374. args: [],
  35375. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  35376. referencedClasses: [],
  35377. messageSends: ["ifNil:"]
  35378. }),
  35379. $globals.SendNode);
  35380. $core.addMethod(
  35381. $core.method({
  35382. selector: "arguments:",
  35383. protocol: "accessing",
  35384. fn: function (aCollection){
  35385. var self=this,$self=this;
  35386. $self["@arguments"]=aCollection;
  35387. return self;
  35388. },
  35389. args: ["aCollection"],
  35390. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35391. referencedClasses: [],
  35392. messageSends: []
  35393. }),
  35394. $globals.SendNode);
  35395. $core.addMethod(
  35396. $core.method({
  35397. selector: "dagChildren",
  35398. protocol: "accessing",
  35399. fn: function (){
  35400. var self=this,$self=this;
  35401. return $core.withContext(function($ctx1) {
  35402. var $1,$2,$3,$receiver;
  35403. $1=$self._receiver();
  35404. $ctx1.sendIdx["receiver"]=1;
  35405. if(($receiver = $1) == null || $receiver.a$nil){
  35406. $2=$self._arguments();
  35407. $ctx1.sendIdx["arguments"]=1;
  35408. return $recv($2)._copy();
  35409. } else {
  35410. $1;
  35411. }
  35412. $3=$recv($globals.Array)._with_($self._receiver());
  35413. $recv($3)._addAll_($self._arguments());
  35414. return $recv($3)._yourself();
  35415. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  35416. },
  35417. args: [],
  35418. 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",
  35419. referencedClasses: ["Array"],
  35420. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  35421. }),
  35422. $globals.SendNode);
  35423. $core.addMethod(
  35424. $core.method({
  35425. selector: "index",
  35426. protocol: "accessing",
  35427. fn: function (){
  35428. var self=this,$self=this;
  35429. return $self["@index"];
  35430. },
  35431. args: [],
  35432. source: "index\x0a\x09^ index",
  35433. referencedClasses: [],
  35434. messageSends: []
  35435. }),
  35436. $globals.SendNode);
  35437. $core.addMethod(
  35438. $core.method({
  35439. selector: "index:",
  35440. protocol: "accessing",
  35441. fn: function (anInteger){
  35442. var self=this,$self=this;
  35443. $self["@index"]=anInteger;
  35444. return self;
  35445. },
  35446. args: ["anInteger"],
  35447. source: "index: anInteger\x0a\x09index := anInteger",
  35448. referencedClasses: [],
  35449. messageSends: []
  35450. }),
  35451. $globals.SendNode);
  35452. $core.addMethod(
  35453. $core.method({
  35454. selector: "isNavigationNode",
  35455. protocol: "testing",
  35456. fn: function (){
  35457. var self=this,$self=this;
  35458. return true;
  35459. },
  35460. args: [],
  35461. source: "isNavigationNode\x0a\x09^ true",
  35462. referencedClasses: [],
  35463. messageSends: []
  35464. }),
  35465. $globals.SendNode);
  35466. $core.addMethod(
  35467. $core.method({
  35468. selector: "isSendNode",
  35469. protocol: "testing",
  35470. fn: function (){
  35471. var self=this,$self=this;
  35472. return true;
  35473. },
  35474. args: [],
  35475. source: "isSendNode\x0a\x09^ true",
  35476. referencedClasses: [],
  35477. messageSends: []
  35478. }),
  35479. $globals.SendNode);
  35480. $core.addMethod(
  35481. $core.method({
  35482. selector: "navigationLink",
  35483. protocol: "accessing",
  35484. fn: function (){
  35485. var self=this,$self=this;
  35486. return $core.withContext(function($ctx1) {
  35487. return $self._selector();
  35488. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  35489. },
  35490. args: [],
  35491. source: "navigationLink\x0a\x09^ self selector",
  35492. referencedClasses: [],
  35493. messageSends: ["selector"]
  35494. }),
  35495. $globals.SendNode);
  35496. $core.addMethod(
  35497. $core.method({
  35498. selector: "receiver",
  35499. protocol: "accessing",
  35500. fn: function (){
  35501. var self=this,$self=this;
  35502. return $self["@receiver"];
  35503. },
  35504. args: [],
  35505. source: "receiver\x0a\x09^ receiver",
  35506. referencedClasses: [],
  35507. messageSends: []
  35508. }),
  35509. $globals.SendNode);
  35510. $core.addMethod(
  35511. $core.method({
  35512. selector: "receiver:",
  35513. protocol: "accessing",
  35514. fn: function (aNode){
  35515. var self=this,$self=this;
  35516. $self["@receiver"]=aNode;
  35517. return self;
  35518. },
  35519. args: ["aNode"],
  35520. source: "receiver: aNode\x0a\x09receiver := aNode",
  35521. referencedClasses: [],
  35522. messageSends: []
  35523. }),
  35524. $globals.SendNode);
  35525. $core.addMethod(
  35526. $core.method({
  35527. selector: "requiresSmalltalkContext",
  35528. protocol: "testing",
  35529. fn: function (){
  35530. var self=this,$self=this;
  35531. return true;
  35532. },
  35533. args: [],
  35534. source: "requiresSmalltalkContext\x0a\x09^ true",
  35535. referencedClasses: [],
  35536. messageSends: []
  35537. }),
  35538. $globals.SendNode);
  35539. $core.addMethod(
  35540. $core.method({
  35541. selector: "selector",
  35542. protocol: "accessing",
  35543. fn: function (){
  35544. var self=this,$self=this;
  35545. return $self["@selector"];
  35546. },
  35547. args: [],
  35548. source: "selector\x0a\x09^ selector",
  35549. referencedClasses: [],
  35550. messageSends: []
  35551. }),
  35552. $globals.SendNode);
  35553. $core.addMethod(
  35554. $core.method({
  35555. selector: "selector:",
  35556. protocol: "accessing",
  35557. fn: function (aString){
  35558. var self=this,$self=this;
  35559. $self["@selector"]=aString;
  35560. return self;
  35561. },
  35562. args: ["aString"],
  35563. source: "selector: aString\x0a\x09selector := aString",
  35564. referencedClasses: [],
  35565. messageSends: []
  35566. }),
  35567. $globals.SendNode);
  35568. $core.addMethod(
  35569. $core.method({
  35570. selector: "shouldBeInlined",
  35571. protocol: "accessing",
  35572. fn: function (){
  35573. var self=this,$self=this;
  35574. return $core.withContext(function($ctx1) {
  35575. var $1,$receiver;
  35576. $1=$self["@shouldBeInlined"];
  35577. if(($receiver = $1) == null || $receiver.a$nil){
  35578. return false;
  35579. } else {
  35580. return $1;
  35581. }
  35582. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  35583. },
  35584. args: [],
  35585. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  35586. referencedClasses: [],
  35587. messageSends: ["ifNil:"]
  35588. }),
  35589. $globals.SendNode);
  35590. $core.addMethod(
  35591. $core.method({
  35592. selector: "shouldBeInlined:",
  35593. protocol: "accessing",
  35594. fn: function (aBoolean){
  35595. var self=this,$self=this;
  35596. $self["@shouldBeInlined"]=aBoolean;
  35597. return self;
  35598. },
  35599. args: ["aBoolean"],
  35600. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  35601. referencedClasses: [],
  35602. messageSends: []
  35603. }),
  35604. $globals.SendNode);
  35605. $core.addMethod(
  35606. $core.method({
  35607. selector: "superSend",
  35608. protocol: "accessing",
  35609. fn: function (){
  35610. var self=this,$self=this;
  35611. return $core.withContext(function($ctx1) {
  35612. var $2,$1;
  35613. $2=$self._receiver();
  35614. $ctx1.sendIdx["receiver"]=1;
  35615. $1=$recv($2)._notNil();
  35616. return $recv($1)._and_((function(){
  35617. return $core.withContext(function($ctx2) {
  35618. return $recv($self._receiver())._isSuperKeyword();
  35619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35620. }));
  35621. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  35622. },
  35623. args: [],
  35624. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  35625. referencedClasses: [],
  35626. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  35627. }),
  35628. $globals.SendNode);
  35629. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  35630. $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).";
  35631. $core.addMethod(
  35632. $core.method({
  35633. selector: "acceptDagVisitor:",
  35634. protocol: "visiting",
  35635. fn: function (aVisitor){
  35636. var self=this,$self=this;
  35637. return $core.withContext(function($ctx1) {
  35638. return $recv(aVisitor)._visitSequenceNode_(self);
  35639. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  35640. },
  35641. args: ["aVisitor"],
  35642. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  35643. referencedClasses: [],
  35644. messageSends: ["visitSequenceNode:"]
  35645. }),
  35646. $globals.SequenceNode);
  35647. $core.addMethod(
  35648. $core.method({
  35649. selector: "asBlockSequenceNode",
  35650. protocol: "building",
  35651. fn: function (){
  35652. var self=this,$self=this;
  35653. return $core.withContext(function($ctx1) {
  35654. var $1;
  35655. $1=$recv($globals.BlockSequenceNode)._new();
  35656. $recv($1)._position_($self._position());
  35657. $recv($1)._source_($self._source());
  35658. $recv($1)._dagChildren_($self._dagChildren());
  35659. $recv($1)._temps_($self._temps());
  35660. return $recv($1)._yourself();
  35661. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  35662. },
  35663. args: [],
  35664. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  35665. referencedClasses: ["BlockSequenceNode"],
  35666. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  35667. }),
  35668. $globals.SequenceNode);
  35669. $core.addMethod(
  35670. $core.method({
  35671. selector: "isSequenceNode",
  35672. protocol: "testing",
  35673. fn: function (){
  35674. var self=this,$self=this;
  35675. return true;
  35676. },
  35677. args: [],
  35678. source: "isSequenceNode\x0a\x09^ true",
  35679. referencedClasses: [],
  35680. messageSends: []
  35681. }),
  35682. $globals.SequenceNode);
  35683. $core.addMethod(
  35684. $core.method({
  35685. selector: "scope",
  35686. protocol: "accessing",
  35687. fn: function (){
  35688. var self=this,$self=this;
  35689. return $self["@scope"];
  35690. },
  35691. args: [],
  35692. source: "scope\x0a\x09^ scope",
  35693. referencedClasses: [],
  35694. messageSends: []
  35695. }),
  35696. $globals.SequenceNode);
  35697. $core.addMethod(
  35698. $core.method({
  35699. selector: "scope:",
  35700. protocol: "accessing",
  35701. fn: function (aLexicalScope){
  35702. var self=this,$self=this;
  35703. $self["@scope"]=aLexicalScope;
  35704. return self;
  35705. },
  35706. args: ["aLexicalScope"],
  35707. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35708. referencedClasses: [],
  35709. messageSends: []
  35710. }),
  35711. $globals.SequenceNode);
  35712. $core.addMethod(
  35713. $core.method({
  35714. selector: "temps",
  35715. protocol: "accessing",
  35716. fn: function (){
  35717. var self=this,$self=this;
  35718. return $core.withContext(function($ctx1) {
  35719. var $1,$receiver;
  35720. $1=$self["@temps"];
  35721. if(($receiver = $1) == null || $receiver.a$nil){
  35722. return [];
  35723. } else {
  35724. return $1;
  35725. }
  35726. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35727. },
  35728. args: [],
  35729. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35730. referencedClasses: [],
  35731. messageSends: ["ifNil:"]
  35732. }),
  35733. $globals.SequenceNode);
  35734. $core.addMethod(
  35735. $core.method({
  35736. selector: "temps:",
  35737. protocol: "accessing",
  35738. fn: function (aCollection){
  35739. var self=this,$self=this;
  35740. $self["@temps"]=aCollection;
  35741. return self;
  35742. },
  35743. args: ["aCollection"],
  35744. source: "temps: aCollection\x0a\x09temps := aCollection",
  35745. referencedClasses: [],
  35746. messageSends: []
  35747. }),
  35748. $globals.SequenceNode);
  35749. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35750. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35751. $core.addMethod(
  35752. $core.method({
  35753. selector: "acceptDagVisitor:",
  35754. protocol: "visiting",
  35755. fn: function (aVisitor){
  35756. var self=this,$self=this;
  35757. return $core.withContext(function($ctx1) {
  35758. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35759. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35760. },
  35761. args: ["aVisitor"],
  35762. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35763. referencedClasses: [],
  35764. messageSends: ["visitBlockSequenceNode:"]
  35765. }),
  35766. $globals.BlockSequenceNode);
  35767. $core.addMethod(
  35768. $core.method({
  35769. selector: "isBlockSequenceNode",
  35770. protocol: "testing",
  35771. fn: function (){
  35772. var self=this,$self=this;
  35773. return true;
  35774. },
  35775. args: [],
  35776. source: "isBlockSequenceNode\x0a\x09^ true",
  35777. referencedClasses: [],
  35778. messageSends: []
  35779. }),
  35780. $globals.BlockSequenceNode);
  35781. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35782. $globals.ValueNode.comment="I represent a value node.";
  35783. $core.addMethod(
  35784. $core.method({
  35785. selector: "acceptDagVisitor:",
  35786. protocol: "visiting",
  35787. fn: function (aVisitor){
  35788. var self=this,$self=this;
  35789. return $core.withContext(function($ctx1) {
  35790. return $recv(aVisitor)._visitValueNode_(self);
  35791. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35792. },
  35793. args: ["aVisitor"],
  35794. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35795. referencedClasses: [],
  35796. messageSends: ["visitValueNode:"]
  35797. }),
  35798. $globals.ValueNode);
  35799. $core.addMethod(
  35800. $core.method({
  35801. selector: "isImmutable",
  35802. protocol: "testing",
  35803. fn: function (){
  35804. var self=this,$self=this;
  35805. return $core.withContext(function($ctx1) {
  35806. return $recv($self._value())._isImmutable();
  35807. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35808. },
  35809. args: [],
  35810. source: "isImmutable\x0a\x09^ self value isImmutable",
  35811. referencedClasses: [],
  35812. messageSends: ["isImmutable", "value"]
  35813. }),
  35814. $globals.ValueNode);
  35815. $core.addMethod(
  35816. $core.method({
  35817. selector: "isValueNode",
  35818. protocol: "testing",
  35819. fn: function (){
  35820. var self=this,$self=this;
  35821. return true;
  35822. },
  35823. args: [],
  35824. source: "isValueNode\x0a\x09^ true",
  35825. referencedClasses: [],
  35826. messageSends: []
  35827. }),
  35828. $globals.ValueNode);
  35829. $core.addMethod(
  35830. $core.method({
  35831. selector: "value",
  35832. protocol: "accessing",
  35833. fn: function (){
  35834. var self=this,$self=this;
  35835. return $self["@value"];
  35836. },
  35837. args: [],
  35838. source: "value\x0a\x09^ value",
  35839. referencedClasses: [],
  35840. messageSends: []
  35841. }),
  35842. $globals.ValueNode);
  35843. $core.addMethod(
  35844. $core.method({
  35845. selector: "value:",
  35846. protocol: "accessing",
  35847. fn: function (anObject){
  35848. var self=this,$self=this;
  35849. $self["@value"]=anObject;
  35850. return self;
  35851. },
  35852. args: ["anObject"],
  35853. source: "value: anObject\x0a\x09value := anObject",
  35854. referencedClasses: [],
  35855. messageSends: []
  35856. }),
  35857. $globals.ValueNode);
  35858. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35859. $globals.VariableNode.comment="I represent an variable node.";
  35860. $core.addMethod(
  35861. $core.method({
  35862. selector: "acceptDagVisitor:",
  35863. protocol: "visiting",
  35864. fn: function (aVisitor){
  35865. var self=this,$self=this;
  35866. return $core.withContext(function($ctx1) {
  35867. return $recv(aVisitor)._visitVariableNode_(self);
  35868. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35869. },
  35870. args: ["aVisitor"],
  35871. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35872. referencedClasses: [],
  35873. messageSends: ["visitVariableNode:"]
  35874. }),
  35875. $globals.VariableNode);
  35876. $core.addMethod(
  35877. $core.method({
  35878. selector: "alias",
  35879. protocol: "accessing",
  35880. fn: function (){
  35881. var self=this,$self=this;
  35882. return $core.withContext(function($ctx1) {
  35883. return $recv($self._binding())._alias();
  35884. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35885. },
  35886. args: [],
  35887. source: "alias\x0a\x09^ self binding alias",
  35888. referencedClasses: [],
  35889. messageSends: ["alias", "binding"]
  35890. }),
  35891. $globals.VariableNode);
  35892. $core.addMethod(
  35893. $core.method({
  35894. selector: "assigned",
  35895. protocol: "accessing",
  35896. fn: function (){
  35897. var self=this,$self=this;
  35898. return $core.withContext(function($ctx1) {
  35899. var $1,$receiver;
  35900. $1=$self["@assigned"];
  35901. if(($receiver = $1) == null || $receiver.a$nil){
  35902. return false;
  35903. } else {
  35904. return $1;
  35905. }
  35906. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35907. },
  35908. args: [],
  35909. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35910. referencedClasses: [],
  35911. messageSends: ["ifNil:"]
  35912. }),
  35913. $globals.VariableNode);
  35914. $core.addMethod(
  35915. $core.method({
  35916. selector: "assigned:",
  35917. protocol: "accessing",
  35918. fn: function (aBoolean){
  35919. var self=this,$self=this;
  35920. $self["@assigned"]=aBoolean;
  35921. return self;
  35922. },
  35923. args: ["aBoolean"],
  35924. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35925. referencedClasses: [],
  35926. messageSends: []
  35927. }),
  35928. $globals.VariableNode);
  35929. $core.addMethod(
  35930. $core.method({
  35931. selector: "beAssigned",
  35932. protocol: "accessing",
  35933. fn: function (){
  35934. var self=this,$self=this;
  35935. return $core.withContext(function($ctx1) {
  35936. $recv($self._binding())._validateAssignment();
  35937. $self["@assigned"]=true;
  35938. return self;
  35939. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35940. },
  35941. args: [],
  35942. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35943. referencedClasses: [],
  35944. messageSends: ["validateAssignment", "binding"]
  35945. }),
  35946. $globals.VariableNode);
  35947. $core.addMethod(
  35948. $core.method({
  35949. selector: "binding",
  35950. protocol: "accessing",
  35951. fn: function (){
  35952. var self=this,$self=this;
  35953. return $self["@binding"];
  35954. },
  35955. args: [],
  35956. source: "binding\x0a\x09^ binding",
  35957. referencedClasses: [],
  35958. messageSends: []
  35959. }),
  35960. $globals.VariableNode);
  35961. $core.addMethod(
  35962. $core.method({
  35963. selector: "binding:",
  35964. protocol: "accessing",
  35965. fn: function (aScopeVar){
  35966. var self=this,$self=this;
  35967. $self["@binding"]=aScopeVar;
  35968. return self;
  35969. },
  35970. args: ["aScopeVar"],
  35971. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35972. referencedClasses: [],
  35973. messageSends: []
  35974. }),
  35975. $globals.VariableNode);
  35976. $core.addMethod(
  35977. $core.method({
  35978. selector: "isArgument",
  35979. protocol: "testing",
  35980. fn: function (){
  35981. var self=this,$self=this;
  35982. return $core.withContext(function($ctx1) {
  35983. return $recv($self._binding())._isArgVar();
  35984. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35985. },
  35986. args: [],
  35987. source: "isArgument\x0a\x09^ self binding isArgVar",
  35988. referencedClasses: [],
  35989. messageSends: ["isArgVar", "binding"]
  35990. }),
  35991. $globals.VariableNode);
  35992. $core.addMethod(
  35993. $core.method({
  35994. selector: "isImmutable",
  35995. protocol: "testing",
  35996. fn: function (){
  35997. var self=this,$self=this;
  35998. return $core.withContext(function($ctx1) {
  35999. return $recv($self._binding())._isImmutable();
  36000. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  36001. },
  36002. args: [],
  36003. source: "isImmutable\x0a\x09^ self binding isImmutable",
  36004. referencedClasses: [],
  36005. messageSends: ["isImmutable", "binding"]
  36006. }),
  36007. $globals.VariableNode);
  36008. $core.addMethod(
  36009. $core.method({
  36010. selector: "isNavigationNode",
  36011. protocol: "testing",
  36012. fn: function (){
  36013. var self=this,$self=this;
  36014. return true;
  36015. },
  36016. args: [],
  36017. source: "isNavigationNode\x0a\x09^ true",
  36018. referencedClasses: [],
  36019. messageSends: []
  36020. }),
  36021. $globals.VariableNode);
  36022. $core.addMethod(
  36023. $core.method({
  36024. selector: "isSuperKeyword",
  36025. protocol: "testing",
  36026. fn: function (){
  36027. var self=this,$self=this;
  36028. return $core.withContext(function($ctx1) {
  36029. return $recv($self._value()).__eq("super");
  36030. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  36031. },
  36032. args: [],
  36033. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  36034. referencedClasses: [],
  36035. messageSends: ["=", "value"]
  36036. }),
  36037. $globals.VariableNode);
  36038. $core.addMethod(
  36039. $core.method({
  36040. selector: "isVariableNode",
  36041. protocol: "testing",
  36042. fn: function (){
  36043. var self=this,$self=this;
  36044. return true;
  36045. },
  36046. args: [],
  36047. source: "isVariableNode\x0a\x09^ true",
  36048. referencedClasses: [],
  36049. messageSends: []
  36050. }),
  36051. $globals.VariableNode);
  36052. $core.addMethod(
  36053. $core.method({
  36054. selector: "navigationLink",
  36055. protocol: "accessing",
  36056. fn: function (){
  36057. var self=this,$self=this;
  36058. return $core.withContext(function($ctx1) {
  36059. return $self._value();
  36060. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  36061. },
  36062. args: [],
  36063. source: "navigationLink\x0a\x09^ self value",
  36064. referencedClasses: [],
  36065. messageSends: ["value"]
  36066. }),
  36067. $globals.VariableNode);
  36068. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  36069. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  36070. $core.addMethod(
  36071. $core.method({
  36072. selector: "visit:",
  36073. protocol: "visiting",
  36074. fn: function (aNode){
  36075. var self=this,$self=this;
  36076. return $core.withContext(function($ctx1) {
  36077. var $1;
  36078. $recv($self._path())._ifNotEmpty_((function(p){
  36079. return $core.withContext(function($ctx2) {
  36080. return $recv(aNode)._parent_($recv(p)._last());
  36081. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  36082. }));
  36083. $1=(
  36084. $ctx1.supercall = true,
  36085. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  36086. $ctx1.supercall = false;
  36087. return $1;
  36088. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  36089. },
  36090. args: ["aNode"],
  36091. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  36092. referencedClasses: [],
  36093. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  36094. }),
  36095. $globals.ParentFakingPathDagVisitor);
  36096. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  36097. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  36098. $core.addMethod(
  36099. $core.method({
  36100. selector: "visitAssignmentNode:",
  36101. protocol: "visiting",
  36102. fn: function (aNode){
  36103. var self=this,$self=this;
  36104. return $core.withContext(function($ctx1) {
  36105. return $self._visitDagNode_(aNode);
  36106. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  36107. },
  36108. args: ["aNode"],
  36109. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36110. referencedClasses: [],
  36111. messageSends: ["visitDagNode:"]
  36112. }),
  36113. $globals.NodeVisitor);
  36114. $core.addMethod(
  36115. $core.method({
  36116. selector: "visitBlockNode:",
  36117. protocol: "visiting",
  36118. fn: function (aNode){
  36119. var self=this,$self=this;
  36120. return $core.withContext(function($ctx1) {
  36121. return $self._visitDagNode_(aNode);
  36122. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  36123. },
  36124. args: ["aNode"],
  36125. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36126. referencedClasses: [],
  36127. messageSends: ["visitDagNode:"]
  36128. }),
  36129. $globals.NodeVisitor);
  36130. $core.addMethod(
  36131. $core.method({
  36132. selector: "visitBlockSequenceNode:",
  36133. protocol: "visiting",
  36134. fn: function (aNode){
  36135. var self=this,$self=this;
  36136. return $core.withContext(function($ctx1) {
  36137. return $self._visitSequenceNode_(aNode);
  36138. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  36139. },
  36140. args: ["aNode"],
  36141. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  36142. referencedClasses: [],
  36143. messageSends: ["visitSequenceNode:"]
  36144. }),
  36145. $globals.NodeVisitor);
  36146. $core.addMethod(
  36147. $core.method({
  36148. selector: "visitCascadeNode:",
  36149. protocol: "visiting",
  36150. fn: function (aNode){
  36151. var self=this,$self=this;
  36152. return $core.withContext(function($ctx1) {
  36153. return $self._visitDagNode_(aNode);
  36154. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  36155. },
  36156. args: ["aNode"],
  36157. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36158. referencedClasses: [],
  36159. messageSends: ["visitDagNode:"]
  36160. }),
  36161. $globals.NodeVisitor);
  36162. $core.addMethod(
  36163. $core.method({
  36164. selector: "visitDagNode:",
  36165. protocol: "visiting",
  36166. fn: function (aNode){
  36167. var self=this,$self=this;
  36168. return $core.withContext(function($ctx1) {
  36169. return $self._visitDagNodeVariantSimple_(aNode);
  36170. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  36171. },
  36172. args: ["aNode"],
  36173. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  36174. referencedClasses: [],
  36175. messageSends: ["visitDagNodeVariantSimple:"]
  36176. }),
  36177. $globals.NodeVisitor);
  36178. $core.addMethod(
  36179. $core.method({
  36180. selector: "visitDynamicArrayNode:",
  36181. protocol: "visiting",
  36182. fn: function (aNode){
  36183. var self=this,$self=this;
  36184. return $core.withContext(function($ctx1) {
  36185. return $self._visitDagNode_(aNode);
  36186. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  36187. },
  36188. args: ["aNode"],
  36189. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36190. referencedClasses: [],
  36191. messageSends: ["visitDagNode:"]
  36192. }),
  36193. $globals.NodeVisitor);
  36194. $core.addMethod(
  36195. $core.method({
  36196. selector: "visitDynamicDictionaryNode:",
  36197. protocol: "visiting",
  36198. fn: function (aNode){
  36199. var self=this,$self=this;
  36200. return $core.withContext(function($ctx1) {
  36201. return $self._visitDagNode_(aNode);
  36202. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  36203. },
  36204. args: ["aNode"],
  36205. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36206. referencedClasses: [],
  36207. messageSends: ["visitDagNode:"]
  36208. }),
  36209. $globals.NodeVisitor);
  36210. $core.addMethod(
  36211. $core.method({
  36212. selector: "visitJSStatementNode:",
  36213. protocol: "visiting",
  36214. fn: function (aNode){
  36215. var self=this,$self=this;
  36216. return $core.withContext(function($ctx1) {
  36217. return $self._visitDagNode_(aNode);
  36218. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  36219. },
  36220. args: ["aNode"],
  36221. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36222. referencedClasses: [],
  36223. messageSends: ["visitDagNode:"]
  36224. }),
  36225. $globals.NodeVisitor);
  36226. $core.addMethod(
  36227. $core.method({
  36228. selector: "visitMethodNode:",
  36229. protocol: "visiting",
  36230. fn: function (aNode){
  36231. var self=this,$self=this;
  36232. return $core.withContext(function($ctx1) {
  36233. return $self._visitDagNode_(aNode);
  36234. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  36235. },
  36236. args: ["aNode"],
  36237. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36238. referencedClasses: [],
  36239. messageSends: ["visitDagNode:"]
  36240. }),
  36241. $globals.NodeVisitor);
  36242. $core.addMethod(
  36243. $core.method({
  36244. selector: "visitReturnNode:",
  36245. protocol: "visiting",
  36246. fn: function (aNode){
  36247. var self=this,$self=this;
  36248. return $core.withContext(function($ctx1) {
  36249. return $self._visitDagNode_(aNode);
  36250. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  36251. },
  36252. args: ["aNode"],
  36253. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36254. referencedClasses: [],
  36255. messageSends: ["visitDagNode:"]
  36256. }),
  36257. $globals.NodeVisitor);
  36258. $core.addMethod(
  36259. $core.method({
  36260. selector: "visitSendNode:",
  36261. protocol: "visiting",
  36262. fn: function (aNode){
  36263. var self=this,$self=this;
  36264. return $core.withContext(function($ctx1) {
  36265. return $self._visitDagNode_(aNode);
  36266. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  36267. },
  36268. args: ["aNode"],
  36269. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36270. referencedClasses: [],
  36271. messageSends: ["visitDagNode:"]
  36272. }),
  36273. $globals.NodeVisitor);
  36274. $core.addMethod(
  36275. $core.method({
  36276. selector: "visitSequenceNode:",
  36277. protocol: "visiting",
  36278. fn: function (aNode){
  36279. var self=this,$self=this;
  36280. return $core.withContext(function($ctx1) {
  36281. return $self._visitDagNode_(aNode);
  36282. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  36283. },
  36284. args: ["aNode"],
  36285. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36286. referencedClasses: [],
  36287. messageSends: ["visitDagNode:"]
  36288. }),
  36289. $globals.NodeVisitor);
  36290. $core.addMethod(
  36291. $core.method({
  36292. selector: "visitValueNode:",
  36293. protocol: "visiting",
  36294. fn: function (aNode){
  36295. var self=this,$self=this;
  36296. return $core.withContext(function($ctx1) {
  36297. return $self._visitDagNode_(aNode);
  36298. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  36299. },
  36300. args: ["aNode"],
  36301. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36302. referencedClasses: [],
  36303. messageSends: ["visitDagNode:"]
  36304. }),
  36305. $globals.NodeVisitor);
  36306. $core.addMethod(
  36307. $core.method({
  36308. selector: "visitVariableNode:",
  36309. protocol: "visiting",
  36310. fn: function (aNode){
  36311. var self=this,$self=this;
  36312. return $core.withContext(function($ctx1) {
  36313. return $self._visitDagNode_(aNode);
  36314. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  36315. },
  36316. args: ["aNode"],
  36317. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36318. referencedClasses: [],
  36319. messageSends: ["visitDagNode:"]
  36320. }),
  36321. $globals.NodeVisitor);
  36322. $core.addMethod(
  36323. $core.method({
  36324. selector: "ast",
  36325. protocol: "*Compiler-AST",
  36326. fn: function (){
  36327. var self=this,$self=this;
  36328. return $core.withContext(function($ctx1) {
  36329. var $1;
  36330. $1=$self._source();
  36331. $ctx1.sendIdx["source"]=1;
  36332. $recv($1)._ifEmpty_((function(){
  36333. return $core.withContext(function($ctx2) {
  36334. return $self._error_("Method source is empty");
  36335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36336. }));
  36337. return $recv($globals.Smalltalk)._parse_($self._source());
  36338. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  36339. },
  36340. args: [],
  36341. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  36342. referencedClasses: ["Smalltalk"],
  36343. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  36344. }),
  36345. $globals.CompiledMethod);
  36346. });
  36347. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36348. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36349. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36350. $core.addPackage("Compiler-Semantic");
  36351. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36352. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36353. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36354. $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.";
  36355. $core.addMethod(
  36356. $core.method({
  36357. selector: "addArg:",
  36358. protocol: "adding",
  36359. fn: function (aString){
  36360. var self=this,$self=this;
  36361. return $core.withContext(function($ctx1) {
  36362. var $1;
  36363. $1=$self._args();
  36364. $ctx1.sendIdx["args"]=1;
  36365. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36366. $recv($recv($self._args())._at_(aString))._scope_(self);
  36367. return self;
  36368. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36369. },
  36370. args: ["aString"],
  36371. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36372. referencedClasses: ["ArgVar"],
  36373. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36374. }),
  36375. $globals.LexicalScope);
  36376. $core.addMethod(
  36377. $core.method({
  36378. selector: "addTemp:",
  36379. protocol: "adding",
  36380. fn: function (aString){
  36381. var self=this,$self=this;
  36382. return $core.withContext(function($ctx1) {
  36383. var $1;
  36384. $1=$self._temps();
  36385. $ctx1.sendIdx["temps"]=1;
  36386. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36387. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36388. return self;
  36389. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36390. },
  36391. args: ["aString"],
  36392. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36393. referencedClasses: ["TempVar"],
  36394. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36395. }),
  36396. $globals.LexicalScope);
  36397. $core.addMethod(
  36398. $core.method({
  36399. selector: "alias",
  36400. protocol: "accessing",
  36401. fn: function (){
  36402. var self=this,$self=this;
  36403. return $core.withContext(function($ctx1) {
  36404. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36405. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36406. },
  36407. args: [],
  36408. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36409. referencedClasses: [],
  36410. messageSends: [",", "asString", "scopeLevel"]
  36411. }),
  36412. $globals.LexicalScope);
  36413. $core.addMethod(
  36414. $core.method({
  36415. selector: "allVariableNames",
  36416. protocol: "accessing",
  36417. fn: function (){
  36418. var self=this,$self=this;
  36419. return $core.withContext(function($ctx1) {
  36420. var $1;
  36421. $1=$recv($self._args())._keys();
  36422. $ctx1.sendIdx["keys"]=1;
  36423. return $recv($1).__comma($recv($self._temps())._keys());
  36424. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36425. },
  36426. args: [],
  36427. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36428. referencedClasses: [],
  36429. messageSends: [",", "keys", "args", "temps"]
  36430. }),
  36431. $globals.LexicalScope);
  36432. $core.addMethod(
  36433. $core.method({
  36434. selector: "args",
  36435. protocol: "accessing",
  36436. fn: function (){
  36437. var self=this,$self=this;
  36438. return $core.withContext(function($ctx1) {
  36439. var $1,$receiver;
  36440. $1=$self["@args"];
  36441. if(($receiver = $1) == null || $receiver.a$nil){
  36442. $self["@args"]=$recv($globals.Dictionary)._new();
  36443. return $self["@args"];
  36444. } else {
  36445. return $1;
  36446. }
  36447. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36448. },
  36449. args: [],
  36450. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36451. referencedClasses: ["Dictionary"],
  36452. messageSends: ["ifNil:", "new"]
  36453. }),
  36454. $globals.LexicalScope);
  36455. $core.addMethod(
  36456. $core.method({
  36457. selector: "bindingFor:",
  36458. protocol: "accessing",
  36459. fn: function (aStringOrNode){
  36460. var self=this,$self=this;
  36461. return $core.withContext(function($ctx1) {
  36462. var $2,$3,$4,$5,$1;
  36463. $2=$self._pseudoVars();
  36464. $3=$recv(aStringOrNode)._value();
  36465. $ctx1.sendIdx["value"]=1;
  36466. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36467. return $core.withContext(function($ctx2) {
  36468. $4=$self._args();
  36469. $5=$recv(aStringOrNode)._value();
  36470. $ctx2.sendIdx["value"]=2;
  36471. return $recv($4)._at_ifAbsent_($5,(function(){
  36472. return $core.withContext(function($ctx3) {
  36473. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36474. return nil;
  36475. }));
  36476. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36477. }));
  36478. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36480. }));
  36481. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36482. return $1;
  36483. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36484. },
  36485. args: ["aStringOrNode"],
  36486. 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 ]]]",
  36487. referencedClasses: [],
  36488. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36489. }),
  36490. $globals.LexicalScope);
  36491. $core.addMethod(
  36492. $core.method({
  36493. selector: "blockIndex",
  36494. protocol: "accessing",
  36495. fn: function (){
  36496. var self=this,$self=this;
  36497. return $core.withContext(function($ctx1) {
  36498. var $1,$receiver;
  36499. $1=$self["@blockIndex"];
  36500. if(($receiver = $1) == null || $receiver.a$nil){
  36501. return (0);
  36502. } else {
  36503. return $1;
  36504. }
  36505. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36506. },
  36507. args: [],
  36508. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36509. referencedClasses: [],
  36510. messageSends: ["ifNil:"]
  36511. }),
  36512. $globals.LexicalScope);
  36513. $core.addMethod(
  36514. $core.method({
  36515. selector: "blockIndex:",
  36516. protocol: "accessing",
  36517. fn: function (anInteger){
  36518. var self=this,$self=this;
  36519. $self["@blockIndex"]=anInteger;
  36520. return self;
  36521. },
  36522. args: ["anInteger"],
  36523. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36524. referencedClasses: [],
  36525. messageSends: []
  36526. }),
  36527. $globals.LexicalScope);
  36528. $core.addMethod(
  36529. $core.method({
  36530. selector: "canInlineNonLocalReturns",
  36531. protocol: "testing",
  36532. fn: function (){
  36533. var self=this,$self=this;
  36534. return $core.withContext(function($ctx1) {
  36535. return $recv($self._isInlined())._and_((function(){
  36536. return $core.withContext(function($ctx2) {
  36537. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36539. }));
  36540. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36541. },
  36542. args: [],
  36543. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36544. referencedClasses: [],
  36545. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36546. }),
  36547. $globals.LexicalScope);
  36548. $core.addMethod(
  36549. $core.method({
  36550. selector: "instruction",
  36551. protocol: "accessing",
  36552. fn: function (){
  36553. var self=this,$self=this;
  36554. return $self["@instruction"];
  36555. },
  36556. args: [],
  36557. source: "instruction\x0a\x09^ instruction",
  36558. referencedClasses: [],
  36559. messageSends: []
  36560. }),
  36561. $globals.LexicalScope);
  36562. $core.addMethod(
  36563. $core.method({
  36564. selector: "instruction:",
  36565. protocol: "accessing",
  36566. fn: function (anIRInstruction){
  36567. var self=this,$self=this;
  36568. $self["@instruction"]=anIRInstruction;
  36569. return self;
  36570. },
  36571. args: ["anIRInstruction"],
  36572. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36573. referencedClasses: [],
  36574. messageSends: []
  36575. }),
  36576. $globals.LexicalScope);
  36577. $core.addMethod(
  36578. $core.method({
  36579. selector: "isBlockScope",
  36580. protocol: "testing",
  36581. fn: function (){
  36582. var self=this,$self=this;
  36583. return $core.withContext(function($ctx1) {
  36584. return $recv($self._isMethodScope())._not();
  36585. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36586. },
  36587. args: [],
  36588. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36589. referencedClasses: [],
  36590. messageSends: ["not", "isMethodScope"]
  36591. }),
  36592. $globals.LexicalScope);
  36593. $core.addMethod(
  36594. $core.method({
  36595. selector: "isInlined",
  36596. protocol: "testing",
  36597. fn: function (){
  36598. var self=this,$self=this;
  36599. return $core.withContext(function($ctx1) {
  36600. var $2,$1;
  36601. $2=$self._instruction();
  36602. $ctx1.sendIdx["instruction"]=1;
  36603. $1=$recv($2)._notNil();
  36604. return $recv($1)._and_((function(){
  36605. return $core.withContext(function($ctx2) {
  36606. return $recv($self._instruction())._isInlined();
  36607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36608. }));
  36609. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36610. },
  36611. args: [],
  36612. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36613. referencedClasses: [],
  36614. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36615. }),
  36616. $globals.LexicalScope);
  36617. $core.addMethod(
  36618. $core.method({
  36619. selector: "isMethodScope",
  36620. protocol: "testing",
  36621. fn: function (){
  36622. var self=this,$self=this;
  36623. return false;
  36624. },
  36625. args: [],
  36626. source: "isMethodScope\x0a\x09^ false",
  36627. referencedClasses: [],
  36628. messageSends: []
  36629. }),
  36630. $globals.LexicalScope);
  36631. $core.addMethod(
  36632. $core.method({
  36633. selector: "lookupVariable:",
  36634. protocol: "accessing",
  36635. fn: function (aNode){
  36636. var self=this,$self=this;
  36637. var lookup;
  36638. return $core.withContext(function($ctx1) {
  36639. var $1,$2,$receiver;
  36640. lookup=$self._bindingFor_(aNode);
  36641. $1=lookup;
  36642. if(($receiver = $1) == null || $receiver.a$nil){
  36643. $2=$self._outerScope();
  36644. $ctx1.sendIdx["outerScope"]=1;
  36645. if(($receiver = $2) == null || $receiver.a$nil){
  36646. lookup=$2;
  36647. } else {
  36648. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36649. }
  36650. lookup;
  36651. } else {
  36652. $1;
  36653. }
  36654. return lookup;
  36655. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  36656. },
  36657. args: ["aNode"],
  36658. 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",
  36659. referencedClasses: [],
  36660. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  36661. }),
  36662. $globals.LexicalScope);
  36663. $core.addMethod(
  36664. $core.method({
  36665. selector: "methodScope",
  36666. protocol: "accessing",
  36667. fn: function (){
  36668. var self=this,$self=this;
  36669. return $core.withContext(function($ctx1) {
  36670. var $1,$receiver;
  36671. $1=$self._outerScope();
  36672. $ctx1.sendIdx["outerScope"]=1;
  36673. if(($receiver = $1) == null || $receiver.a$nil){
  36674. return $1;
  36675. } else {
  36676. return $recv($self._outerScope())._methodScope();
  36677. }
  36678. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  36679. },
  36680. args: [],
  36681. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  36682. referencedClasses: [],
  36683. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  36684. }),
  36685. $globals.LexicalScope);
  36686. $core.addMethod(
  36687. $core.method({
  36688. selector: "node",
  36689. protocol: "accessing",
  36690. fn: function (){
  36691. var self=this,$self=this;
  36692. return $self["@node"];
  36693. },
  36694. args: [],
  36695. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  36696. referencedClasses: [],
  36697. messageSends: []
  36698. }),
  36699. $globals.LexicalScope);
  36700. $core.addMethod(
  36701. $core.method({
  36702. selector: "node:",
  36703. protocol: "accessing",
  36704. fn: function (aNode){
  36705. var self=this,$self=this;
  36706. $self["@node"]=aNode;
  36707. return self;
  36708. },
  36709. args: ["aNode"],
  36710. source: "node: aNode\x0a\x09node := aNode",
  36711. referencedClasses: [],
  36712. messageSends: []
  36713. }),
  36714. $globals.LexicalScope);
  36715. $core.addMethod(
  36716. $core.method({
  36717. selector: "outerScope",
  36718. protocol: "accessing",
  36719. fn: function (){
  36720. var self=this,$self=this;
  36721. return $self["@outerScope"];
  36722. },
  36723. args: [],
  36724. source: "outerScope\x0a\x09^ outerScope",
  36725. referencedClasses: [],
  36726. messageSends: []
  36727. }),
  36728. $globals.LexicalScope);
  36729. $core.addMethod(
  36730. $core.method({
  36731. selector: "outerScope:",
  36732. protocol: "accessing",
  36733. fn: function (aLexicalScope){
  36734. var self=this,$self=this;
  36735. $self["@outerScope"]=aLexicalScope;
  36736. return self;
  36737. },
  36738. args: ["aLexicalScope"],
  36739. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  36740. referencedClasses: [],
  36741. messageSends: []
  36742. }),
  36743. $globals.LexicalScope);
  36744. $core.addMethod(
  36745. $core.method({
  36746. selector: "pseudoVars",
  36747. protocol: "accessing",
  36748. fn: function (){
  36749. var self=this,$self=this;
  36750. return $core.withContext(function($ctx1) {
  36751. return $recv($self._methodScope())._pseudoVars();
  36752. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  36753. },
  36754. args: [],
  36755. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  36756. referencedClasses: [],
  36757. messageSends: ["pseudoVars", "methodScope"]
  36758. }),
  36759. $globals.LexicalScope);
  36760. $core.addMethod(
  36761. $core.method({
  36762. selector: "scopeLevel",
  36763. protocol: "accessing",
  36764. fn: function (){
  36765. var self=this,$self=this;
  36766. return $core.withContext(function($ctx1) {
  36767. var $1,$2,$4,$3,$receiver;
  36768. $1=$self._outerScope();
  36769. $ctx1.sendIdx["outerScope"]=1;
  36770. if(($receiver = $1) == null || $receiver.a$nil){
  36771. return (1);
  36772. } else {
  36773. $1;
  36774. }
  36775. $2=$self._isInlined();
  36776. if($core.assert($2)){
  36777. $4=$self._outerScope();
  36778. $ctx1.sendIdx["outerScope"]=2;
  36779. $3=$recv($4)._scopeLevel();
  36780. $ctx1.sendIdx["scopeLevel"]=1;
  36781. return $3;
  36782. }
  36783. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  36784. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  36785. },
  36786. args: [],
  36787. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  36788. referencedClasses: [],
  36789. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  36790. }),
  36791. $globals.LexicalScope);
  36792. $core.addMethod(
  36793. $core.method({
  36794. selector: "temps",
  36795. protocol: "accessing",
  36796. fn: function (){
  36797. var self=this,$self=this;
  36798. return $core.withContext(function($ctx1) {
  36799. var $1,$receiver;
  36800. $1=$self["@temps"];
  36801. if(($receiver = $1) == null || $receiver.a$nil){
  36802. $self["@temps"]=$recv($globals.Dictionary)._new();
  36803. return $self["@temps"];
  36804. } else {
  36805. return $1;
  36806. }
  36807. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  36808. },
  36809. args: [],
  36810. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  36811. referencedClasses: ["Dictionary"],
  36812. messageSends: ["ifNil:", "new"]
  36813. }),
  36814. $globals.LexicalScope);
  36815. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  36816. $globals.MethodLexicalScope.comment="I represent a method scope.";
  36817. $core.addMethod(
  36818. $core.method({
  36819. selector: "addIVar:",
  36820. protocol: "adding",
  36821. fn: function (aString){
  36822. var self=this,$self=this;
  36823. return $core.withContext(function($ctx1) {
  36824. var $1;
  36825. $1=$self._iVars();
  36826. $ctx1.sendIdx["iVars"]=1;
  36827. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  36828. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  36829. return self;
  36830. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  36831. },
  36832. args: ["aString"],
  36833. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  36834. referencedClasses: ["InstanceVar"],
  36835. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  36836. }),
  36837. $globals.MethodLexicalScope);
  36838. $core.addMethod(
  36839. $core.method({
  36840. selector: "addNonLocalReturn:",
  36841. protocol: "adding",
  36842. fn: function (aScope){
  36843. var self=this,$self=this;
  36844. return $core.withContext(function($ctx1) {
  36845. $recv($self._nonLocalReturns())._add_(aScope);
  36846. return self;
  36847. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  36848. },
  36849. args: ["aScope"],
  36850. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  36851. referencedClasses: [],
  36852. messageSends: ["add:", "nonLocalReturns"]
  36853. }),
  36854. $globals.MethodLexicalScope);
  36855. $core.addMethod(
  36856. $core.method({
  36857. selector: "allVariableNames",
  36858. protocol: "accessing",
  36859. fn: function (){
  36860. var self=this,$self=this;
  36861. return $core.withContext(function($ctx1) {
  36862. var $1;
  36863. $1=(
  36864. $ctx1.supercall = true,
  36865. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  36866. $ctx1.supercall = false;
  36867. return $recv($1).__comma($recv($self._iVars())._keys());
  36868. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  36869. },
  36870. args: [],
  36871. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  36872. referencedClasses: [],
  36873. messageSends: [",", "allVariableNames", "keys", "iVars"]
  36874. }),
  36875. $globals.MethodLexicalScope);
  36876. $core.addMethod(
  36877. $core.method({
  36878. selector: "bindingFor:",
  36879. protocol: "accessing",
  36880. fn: function (aNode){
  36881. var self=this,$self=this;
  36882. return $core.withContext(function($ctx1) {
  36883. var $1,$receiver;
  36884. $1=(
  36885. $ctx1.supercall = true,
  36886. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  36887. $ctx1.supercall = false;
  36888. if(($receiver = $1) == null || $receiver.a$nil){
  36889. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  36890. return nil;
  36891. }));
  36892. } else {
  36893. return $1;
  36894. }
  36895. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  36896. },
  36897. args: ["aNode"],
  36898. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  36899. referencedClasses: [],
  36900. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  36901. }),
  36902. $globals.MethodLexicalScope);
  36903. $core.addMethod(
  36904. $core.method({
  36905. selector: "canInlineNonLocalReturns",
  36906. protocol: "testing",
  36907. fn: function (){
  36908. var self=this,$self=this;
  36909. return true;
  36910. },
  36911. args: [],
  36912. source: "canInlineNonLocalReturns\x0a\x09^ true",
  36913. referencedClasses: [],
  36914. messageSends: []
  36915. }),
  36916. $globals.MethodLexicalScope);
  36917. $core.addMethod(
  36918. $core.method({
  36919. selector: "hasLocalReturn",
  36920. protocol: "testing",
  36921. fn: function (){
  36922. var self=this,$self=this;
  36923. return $core.withContext(function($ctx1) {
  36924. return $self._localReturn();
  36925. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  36926. },
  36927. args: [],
  36928. source: "hasLocalReturn\x0a\x09^ self localReturn",
  36929. referencedClasses: [],
  36930. messageSends: ["localReturn"]
  36931. }),
  36932. $globals.MethodLexicalScope);
  36933. $core.addMethod(
  36934. $core.method({
  36935. selector: "hasNonLocalReturn",
  36936. protocol: "testing",
  36937. fn: function (){
  36938. var self=this,$self=this;
  36939. return $core.withContext(function($ctx1) {
  36940. return $recv($self._nonLocalReturns())._notEmpty();
  36941. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  36942. },
  36943. args: [],
  36944. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  36945. referencedClasses: [],
  36946. messageSends: ["notEmpty", "nonLocalReturns"]
  36947. }),
  36948. $globals.MethodLexicalScope);
  36949. $core.addMethod(
  36950. $core.method({
  36951. selector: "iVars",
  36952. protocol: "accessing",
  36953. fn: function (){
  36954. var self=this,$self=this;
  36955. return $core.withContext(function($ctx1) {
  36956. var $1,$receiver;
  36957. $1=$self["@iVars"];
  36958. if(($receiver = $1) == null || $receiver.a$nil){
  36959. $self["@iVars"]=$recv($globals.Dictionary)._new();
  36960. return $self["@iVars"];
  36961. } else {
  36962. return $1;
  36963. }
  36964. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  36965. },
  36966. args: [],
  36967. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  36968. referencedClasses: ["Dictionary"],
  36969. messageSends: ["ifNil:", "new"]
  36970. }),
  36971. $globals.MethodLexicalScope);
  36972. $core.addMethod(
  36973. $core.method({
  36974. selector: "isMethodScope",
  36975. protocol: "testing",
  36976. fn: function (){
  36977. var self=this,$self=this;
  36978. return true;
  36979. },
  36980. args: [],
  36981. source: "isMethodScope\x0a\x09^ true",
  36982. referencedClasses: [],
  36983. messageSends: []
  36984. }),
  36985. $globals.MethodLexicalScope);
  36986. $core.addMethod(
  36987. $core.method({
  36988. selector: "localReturn",
  36989. protocol: "accessing",
  36990. fn: function (){
  36991. var self=this,$self=this;
  36992. return $core.withContext(function($ctx1) {
  36993. var $1,$receiver;
  36994. $1=$self["@localReturn"];
  36995. if(($receiver = $1) == null || $receiver.a$nil){
  36996. return false;
  36997. } else {
  36998. return $1;
  36999. }
  37000. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37001. },
  37002. args: [],
  37003. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37004. referencedClasses: [],
  37005. messageSends: ["ifNil:"]
  37006. }),
  37007. $globals.MethodLexicalScope);
  37008. $core.addMethod(
  37009. $core.method({
  37010. selector: "localReturn:",
  37011. protocol: "accessing",
  37012. fn: function (aBoolean){
  37013. var self=this,$self=this;
  37014. $self["@localReturn"]=aBoolean;
  37015. return self;
  37016. },
  37017. args: ["aBoolean"],
  37018. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37019. referencedClasses: [],
  37020. messageSends: []
  37021. }),
  37022. $globals.MethodLexicalScope);
  37023. $core.addMethod(
  37024. $core.method({
  37025. selector: "methodScope",
  37026. protocol: "accessing",
  37027. fn: function (){
  37028. var self=this,$self=this;
  37029. return self;
  37030. },
  37031. args: [],
  37032. source: "methodScope\x0a\x09^ self",
  37033. referencedClasses: [],
  37034. messageSends: []
  37035. }),
  37036. $globals.MethodLexicalScope);
  37037. $core.addMethod(
  37038. $core.method({
  37039. selector: "nonLocalReturns",
  37040. protocol: "accessing",
  37041. fn: function (){
  37042. var self=this,$self=this;
  37043. return $core.withContext(function($ctx1) {
  37044. var $1,$receiver;
  37045. $1=$self["@nonLocalReturns"];
  37046. if(($receiver = $1) == null || $receiver.a$nil){
  37047. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37048. return $self["@nonLocalReturns"];
  37049. } else {
  37050. return $1;
  37051. }
  37052. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37053. },
  37054. args: [],
  37055. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37056. referencedClasses: ["OrderedCollection"],
  37057. messageSends: ["ifNil:", "new"]
  37058. }),
  37059. $globals.MethodLexicalScope);
  37060. $core.addMethod(
  37061. $core.method({
  37062. selector: "pseudoVars",
  37063. protocol: "accessing",
  37064. fn: function (){
  37065. var self=this,$self=this;
  37066. return $core.withContext(function($ctx1) {
  37067. var $1,$2,$4,$3,$receiver;
  37068. $1=$self["@pseudoVars"];
  37069. if(($receiver = $1) == null || $receiver.a$nil){
  37070. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37071. $self["@pseudoVars"];
  37072. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37073. return $core.withContext(function($ctx2) {
  37074. $2=$self["@pseudoVars"];
  37075. $4=$recv($globals.PseudoVar)._on_(each);
  37076. $recv($4)._scope_($self._methodScope());
  37077. $3=$recv($4)._yourself();
  37078. return $recv($2)._at_put_(each,$3);
  37079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37080. }));
  37081. } else {
  37082. $1;
  37083. }
  37084. return $self["@pseudoVars"];
  37085. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37086. },
  37087. args: [],
  37088. 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",
  37089. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37090. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37091. }),
  37092. $globals.MethodLexicalScope);
  37093. $core.addMethod(
  37094. $core.method({
  37095. selector: "removeNonLocalReturn:",
  37096. protocol: "adding",
  37097. fn: function (aScope){
  37098. var self=this,$self=this;
  37099. return $core.withContext(function($ctx1) {
  37100. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37101. }));
  37102. return self;
  37103. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37104. },
  37105. args: ["aScope"],
  37106. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37107. referencedClasses: [],
  37108. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37109. }),
  37110. $globals.MethodLexicalScope);
  37111. $core.addMethod(
  37112. $core.method({
  37113. selector: "unknownVariables",
  37114. protocol: "accessing",
  37115. fn: function (){
  37116. var self=this,$self=this;
  37117. return $core.withContext(function($ctx1) {
  37118. var $1,$receiver;
  37119. $1=$self["@unknownVariables"];
  37120. if(($receiver = $1) == null || $receiver.a$nil){
  37121. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37122. return $self["@unknownVariables"];
  37123. } else {
  37124. return $1;
  37125. }
  37126. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37127. },
  37128. args: [],
  37129. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37130. referencedClasses: ["OrderedCollection"],
  37131. messageSends: ["ifNil:", "new"]
  37132. }),
  37133. $globals.MethodLexicalScope);
  37134. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37135. $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.";
  37136. $core.addMethod(
  37137. $core.method({
  37138. selector: "alias",
  37139. protocol: "accessing",
  37140. fn: function (){
  37141. var self=this,$self=this;
  37142. return $core.withContext(function($ctx1) {
  37143. return $recv($self._name())._asVariableName();
  37144. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37145. },
  37146. args: [],
  37147. source: "alias\x0a\x09^ self name asVariableName",
  37148. referencedClasses: [],
  37149. messageSends: ["asVariableName", "name"]
  37150. }),
  37151. $globals.ScopeVar);
  37152. $core.addMethod(
  37153. $core.method({
  37154. selector: "isArgVar",
  37155. protocol: "testing",
  37156. fn: function (){
  37157. var self=this,$self=this;
  37158. return false;
  37159. },
  37160. args: [],
  37161. source: "isArgVar\x0a\x09^ false",
  37162. referencedClasses: [],
  37163. messageSends: []
  37164. }),
  37165. $globals.ScopeVar);
  37166. $core.addMethod(
  37167. $core.method({
  37168. selector: "isClassRefVar",
  37169. protocol: "testing",
  37170. fn: function (){
  37171. var self=this,$self=this;
  37172. return false;
  37173. },
  37174. args: [],
  37175. source: "isClassRefVar\x0a\x09^ false",
  37176. referencedClasses: [],
  37177. messageSends: []
  37178. }),
  37179. $globals.ScopeVar);
  37180. $core.addMethod(
  37181. $core.method({
  37182. selector: "isImmutable",
  37183. protocol: "testing",
  37184. fn: function (){
  37185. var self=this,$self=this;
  37186. return false;
  37187. },
  37188. args: [],
  37189. source: "isImmutable\x0a\x09^ false",
  37190. referencedClasses: [],
  37191. messageSends: []
  37192. }),
  37193. $globals.ScopeVar);
  37194. $core.addMethod(
  37195. $core.method({
  37196. selector: "isInstanceVar",
  37197. protocol: "testing",
  37198. fn: function (){
  37199. var self=this,$self=this;
  37200. return false;
  37201. },
  37202. args: [],
  37203. source: "isInstanceVar\x0a\x09^ false",
  37204. referencedClasses: [],
  37205. messageSends: []
  37206. }),
  37207. $globals.ScopeVar);
  37208. $core.addMethod(
  37209. $core.method({
  37210. selector: "isPseudoVar",
  37211. protocol: "testing",
  37212. fn: function (){
  37213. var self=this,$self=this;
  37214. return false;
  37215. },
  37216. args: [],
  37217. source: "isPseudoVar\x0a\x09^ false",
  37218. referencedClasses: [],
  37219. messageSends: []
  37220. }),
  37221. $globals.ScopeVar);
  37222. $core.addMethod(
  37223. $core.method({
  37224. selector: "isSelf",
  37225. protocol: "testing",
  37226. fn: function (){
  37227. var self=this,$self=this;
  37228. return false;
  37229. },
  37230. args: [],
  37231. source: "isSelf\x0a\x09^ false",
  37232. referencedClasses: [],
  37233. messageSends: []
  37234. }),
  37235. $globals.ScopeVar);
  37236. $core.addMethod(
  37237. $core.method({
  37238. selector: "isSuper",
  37239. protocol: "testing",
  37240. fn: function (){
  37241. var self=this,$self=this;
  37242. return false;
  37243. },
  37244. args: [],
  37245. source: "isSuper\x0a\x09^ false",
  37246. referencedClasses: [],
  37247. messageSends: []
  37248. }),
  37249. $globals.ScopeVar);
  37250. $core.addMethod(
  37251. $core.method({
  37252. selector: "isTempVar",
  37253. protocol: "testing",
  37254. fn: function (){
  37255. var self=this,$self=this;
  37256. return false;
  37257. },
  37258. args: [],
  37259. source: "isTempVar\x0a\x09^ false",
  37260. referencedClasses: [],
  37261. messageSends: []
  37262. }),
  37263. $globals.ScopeVar);
  37264. $core.addMethod(
  37265. $core.method({
  37266. selector: "isUnknownVar",
  37267. protocol: "testing",
  37268. fn: function (){
  37269. var self=this,$self=this;
  37270. return false;
  37271. },
  37272. args: [],
  37273. source: "isUnknownVar\x0a\x09^ false",
  37274. referencedClasses: [],
  37275. messageSends: []
  37276. }),
  37277. $globals.ScopeVar);
  37278. $core.addMethod(
  37279. $core.method({
  37280. selector: "name",
  37281. protocol: "accessing",
  37282. fn: function (){
  37283. var self=this,$self=this;
  37284. return $self["@name"];
  37285. },
  37286. args: [],
  37287. source: "name\x0a\x09^ name",
  37288. referencedClasses: [],
  37289. messageSends: []
  37290. }),
  37291. $globals.ScopeVar);
  37292. $core.addMethod(
  37293. $core.method({
  37294. selector: "name:",
  37295. protocol: "accessing",
  37296. fn: function (aString){
  37297. var self=this,$self=this;
  37298. $self["@name"]=aString;
  37299. return self;
  37300. },
  37301. args: ["aString"],
  37302. source: "name: aString\x0a\x09name := aString",
  37303. referencedClasses: [],
  37304. messageSends: []
  37305. }),
  37306. $globals.ScopeVar);
  37307. $core.addMethod(
  37308. $core.method({
  37309. selector: "scope",
  37310. protocol: "accessing",
  37311. fn: function (){
  37312. var self=this,$self=this;
  37313. return $self["@scope"];
  37314. },
  37315. args: [],
  37316. source: "scope\x0a\x09^ scope",
  37317. referencedClasses: [],
  37318. messageSends: []
  37319. }),
  37320. $globals.ScopeVar);
  37321. $core.addMethod(
  37322. $core.method({
  37323. selector: "scope:",
  37324. protocol: "accessing",
  37325. fn: function (aScope){
  37326. var self=this,$self=this;
  37327. $self["@scope"]=aScope;
  37328. return self;
  37329. },
  37330. args: ["aScope"],
  37331. source: "scope: aScope\x0a\x09scope := aScope",
  37332. referencedClasses: [],
  37333. messageSends: []
  37334. }),
  37335. $globals.ScopeVar);
  37336. $core.addMethod(
  37337. $core.method({
  37338. selector: "validateAssignment",
  37339. protocol: "testing",
  37340. fn: function (){
  37341. var self=this,$self=this;
  37342. return $core.withContext(function($ctx1) {
  37343. var $1,$2;
  37344. $1=$recv($self._isArgVar())._or_((function(){
  37345. return $core.withContext(function($ctx2) {
  37346. return $self._isPseudoVar();
  37347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37348. }));
  37349. if($core.assert($1)){
  37350. $2=$recv($globals.InvalidAssignmentError)._new();
  37351. $recv($2)._variableName_($self._name());
  37352. $recv($2)._signal();
  37353. }
  37354. return self;
  37355. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37356. },
  37357. args: [],
  37358. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37359. referencedClasses: ["InvalidAssignmentError"],
  37360. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37361. }),
  37362. $globals.ScopeVar);
  37363. $core.addMethod(
  37364. $core.method({
  37365. selector: "on:",
  37366. protocol: "instance creation",
  37367. fn: function (aString){
  37368. var self=this,$self=this;
  37369. return $core.withContext(function($ctx1) {
  37370. var $1;
  37371. $1=$self._new();
  37372. $recv($1)._name_(aString);
  37373. return $recv($1)._yourself();
  37374. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37375. },
  37376. args: ["aString"],
  37377. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37378. referencedClasses: [],
  37379. messageSends: ["name:", "new", "yourself"]
  37380. }),
  37381. $globals.ScopeVar.a$cls);
  37382. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37383. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37384. $core.addMethod(
  37385. $core.method({
  37386. selector: "isImmutable",
  37387. protocol: "testing",
  37388. fn: function (){
  37389. var self=this,$self=this;
  37390. return true;
  37391. },
  37392. args: [],
  37393. source: "isImmutable\x0a\x09^ true",
  37394. referencedClasses: [],
  37395. messageSends: []
  37396. }),
  37397. $globals.AliasVar);
  37398. $core.addMethod(
  37399. $core.method({
  37400. selector: "node",
  37401. protocol: "accessing",
  37402. fn: function (){
  37403. var self=this,$self=this;
  37404. return $self["@node"];
  37405. },
  37406. args: [],
  37407. source: "node\x0a\x09^ node",
  37408. referencedClasses: [],
  37409. messageSends: []
  37410. }),
  37411. $globals.AliasVar);
  37412. $core.addMethod(
  37413. $core.method({
  37414. selector: "node:",
  37415. protocol: "accessing",
  37416. fn: function (aNode){
  37417. var self=this,$self=this;
  37418. $self["@node"]=aNode;
  37419. return self;
  37420. },
  37421. args: ["aNode"],
  37422. source: "node: aNode\x0a\x09node := aNode",
  37423. referencedClasses: [],
  37424. messageSends: []
  37425. }),
  37426. $globals.AliasVar);
  37427. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37428. $globals.ArgVar.comment="I am an argument of a method or block.";
  37429. $core.addMethod(
  37430. $core.method({
  37431. selector: "isArgVar",
  37432. protocol: "testing",
  37433. fn: function (){
  37434. var self=this,$self=this;
  37435. return true;
  37436. },
  37437. args: [],
  37438. source: "isArgVar\x0a\x09^ true",
  37439. referencedClasses: [],
  37440. messageSends: []
  37441. }),
  37442. $globals.ArgVar);
  37443. $core.addMethod(
  37444. $core.method({
  37445. selector: "isImmutable",
  37446. protocol: "testing",
  37447. fn: function (){
  37448. var self=this,$self=this;
  37449. return true;
  37450. },
  37451. args: [],
  37452. source: "isImmutable\x0a\x09^ true",
  37453. referencedClasses: [],
  37454. messageSends: []
  37455. }),
  37456. $globals.ArgVar);
  37457. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37458. $globals.ClassRefVar.comment="I am an class reference variable";
  37459. $core.addMethod(
  37460. $core.method({
  37461. selector: "alias",
  37462. protocol: "accessing",
  37463. fn: function (){
  37464. var self=this,$self=this;
  37465. return $core.withContext(function($ctx1) {
  37466. return "$globals.".__comma($self._name());
  37467. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37468. },
  37469. args: [],
  37470. 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",
  37471. referencedClasses: [],
  37472. messageSends: [",", "name"]
  37473. }),
  37474. $globals.ClassRefVar);
  37475. $core.addMethod(
  37476. $core.method({
  37477. selector: "isClassRefVar",
  37478. protocol: "testing",
  37479. fn: function (){
  37480. var self=this,$self=this;
  37481. return true;
  37482. },
  37483. args: [],
  37484. source: "isClassRefVar\x0a\x09^ true",
  37485. referencedClasses: [],
  37486. messageSends: []
  37487. }),
  37488. $globals.ClassRefVar);
  37489. $core.addMethod(
  37490. $core.method({
  37491. selector: "isImmutable",
  37492. protocol: "testing",
  37493. fn: function (){
  37494. var self=this,$self=this;
  37495. return true;
  37496. },
  37497. args: [],
  37498. source: "isImmutable\x0a\x09^ true",
  37499. referencedClasses: [],
  37500. messageSends: []
  37501. }),
  37502. $globals.ClassRefVar);
  37503. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37504. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37505. $core.addMethod(
  37506. $core.method({
  37507. selector: "alias",
  37508. protocol: "testing",
  37509. fn: function (){
  37510. var self=this,$self=this;
  37511. return $core.withContext(function($ctx1) {
  37512. var $1;
  37513. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37514. $ctx1.sendIdx[","]=1;
  37515. return $1;
  37516. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37517. },
  37518. args: [],
  37519. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37520. referencedClasses: [],
  37521. messageSends: [",", "name"]
  37522. }),
  37523. $globals.InstanceVar);
  37524. $core.addMethod(
  37525. $core.method({
  37526. selector: "isInstanceVar",
  37527. protocol: "testing",
  37528. fn: function (){
  37529. var self=this,$self=this;
  37530. return true;
  37531. },
  37532. args: [],
  37533. source: "isInstanceVar\x0a\x09^ true",
  37534. referencedClasses: [],
  37535. messageSends: []
  37536. }),
  37537. $globals.InstanceVar);
  37538. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37539. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37540. $core.addMethod(
  37541. $core.method({
  37542. selector: "alias",
  37543. protocol: "accessing",
  37544. fn: function (){
  37545. var self=this,$self=this;
  37546. return $core.withContext(function($ctx1) {
  37547. return $self._name();
  37548. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37549. },
  37550. args: [],
  37551. source: "alias\x0a\x09^ self name",
  37552. referencedClasses: [],
  37553. messageSends: ["name"]
  37554. }),
  37555. $globals.PseudoVar);
  37556. $core.addMethod(
  37557. $core.method({
  37558. selector: "isImmutable",
  37559. protocol: "testing",
  37560. fn: function (){
  37561. var self=this,$self=this;
  37562. return true;
  37563. },
  37564. args: [],
  37565. source: "isImmutable\x0a\x09^ true",
  37566. referencedClasses: [],
  37567. messageSends: []
  37568. }),
  37569. $globals.PseudoVar);
  37570. $core.addMethod(
  37571. $core.method({
  37572. selector: "isPseudoVar",
  37573. protocol: "testing",
  37574. fn: function (){
  37575. var self=this,$self=this;
  37576. return true;
  37577. },
  37578. args: [],
  37579. source: "isPseudoVar\x0a\x09^ true",
  37580. referencedClasses: [],
  37581. messageSends: []
  37582. }),
  37583. $globals.PseudoVar);
  37584. $core.addMethod(
  37585. $core.method({
  37586. selector: "isSelf",
  37587. protocol: "testing",
  37588. fn: function (){
  37589. var self=this,$self=this;
  37590. return $core.withContext(function($ctx1) {
  37591. return $recv($self["@name"]).__eq("self");
  37592. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37593. },
  37594. args: [],
  37595. source: "isSelf\x0a\x09^ name = 'self'",
  37596. referencedClasses: [],
  37597. messageSends: ["="]
  37598. }),
  37599. $globals.PseudoVar);
  37600. $core.addMethod(
  37601. $core.method({
  37602. selector: "isSuper",
  37603. protocol: "testing",
  37604. fn: function (){
  37605. var self=this,$self=this;
  37606. return $core.withContext(function($ctx1) {
  37607. return $recv($self["@name"]).__eq("super");
  37608. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37609. },
  37610. args: [],
  37611. source: "isSuper\x0a\x09^ name = 'super'",
  37612. referencedClasses: [],
  37613. messageSends: ["="]
  37614. }),
  37615. $globals.PseudoVar);
  37616. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37617. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37618. $core.addMethod(
  37619. $core.method({
  37620. selector: "isTempVar",
  37621. protocol: "testing",
  37622. fn: function (){
  37623. var self=this,$self=this;
  37624. return true;
  37625. },
  37626. args: [],
  37627. source: "isTempVar\x0a\x09^ true",
  37628. referencedClasses: [],
  37629. messageSends: []
  37630. }),
  37631. $globals.TempVar);
  37632. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37633. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37634. $core.addMethod(
  37635. $core.method({
  37636. selector: "isUnknownVar",
  37637. protocol: "testing",
  37638. fn: function (){
  37639. var self=this,$self=this;
  37640. return true;
  37641. },
  37642. args: [],
  37643. source: "isUnknownVar\x0a\x09^ true",
  37644. referencedClasses: [],
  37645. messageSends: []
  37646. }),
  37647. $globals.UnknownVar);
  37648. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37649. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37650. $core.addMethod(
  37651. $core.method({
  37652. selector: "classReferences",
  37653. protocol: "accessing",
  37654. fn: function (){
  37655. var self=this,$self=this;
  37656. return $core.withContext(function($ctx1) {
  37657. var $1,$receiver;
  37658. $1=$self["@classReferences"];
  37659. if(($receiver = $1) == null || $receiver.a$nil){
  37660. $self["@classReferences"]=$recv($globals.Set)._new();
  37661. return $self["@classReferences"];
  37662. } else {
  37663. return $1;
  37664. }
  37665. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  37666. },
  37667. args: [],
  37668. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  37669. referencedClasses: ["Set"],
  37670. messageSends: ["ifNil:", "new"]
  37671. }),
  37672. $globals.SemanticAnalyzer);
  37673. $core.addMethod(
  37674. $core.method({
  37675. selector: "errorShadowingVariable:",
  37676. protocol: "error handling",
  37677. fn: function (aString){
  37678. var self=this,$self=this;
  37679. return $core.withContext(function($ctx1) {
  37680. var $1;
  37681. $1=$recv($globals.ShadowingVariableError)._new();
  37682. $recv($1)._variableName_(aString);
  37683. $recv($1)._signal();
  37684. return self;
  37685. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  37686. },
  37687. args: ["aString"],
  37688. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  37689. referencedClasses: ["ShadowingVariableError"],
  37690. messageSends: ["variableName:", "new", "signal"]
  37691. }),
  37692. $globals.SemanticAnalyzer);
  37693. $core.addMethod(
  37694. $core.method({
  37695. selector: "errorUnknownVariable:",
  37696. protocol: "error handling",
  37697. fn: function (aNode){
  37698. var self=this,$self=this;
  37699. var identifier;
  37700. return $core.withContext(function($ctx1) {
  37701. var $1,$2,$3;
  37702. identifier=$recv(aNode)._value();
  37703. $ctx1.sendIdx["value"]=1;
  37704. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  37705. return $core.withContext(function($ctx2) {
  37706. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  37707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37708. }));
  37709. if($core.assert($1)){
  37710. $2=$recv($globals.UnknownVariableError)._new();
  37711. $3=$recv(aNode)._value();
  37712. $ctx1.sendIdx["value"]=2;
  37713. $recv($2)._variableName_($3);
  37714. $recv($2)._signal();
  37715. } else {
  37716. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  37717. }
  37718. return self;
  37719. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  37720. },
  37721. args: ["aNode"],
  37722. 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 ]",
  37723. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  37724. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  37725. }),
  37726. $globals.SemanticAnalyzer);
  37727. $core.addMethod(
  37728. $core.method({
  37729. selector: "isVariableUndefined:inPackage:",
  37730. protocol: "testing",
  37731. fn: function (aString,aPackage){
  37732. var self=this,$self=this;
  37733. return $core.withContext(function($ctx1) {
  37734. var $1,$2,$receiver;
  37735. if(($receiver = aPackage) == null || $receiver.a$nil){
  37736. aPackage;
  37737. } else {
  37738. var packageKnownVars;
  37739. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  37740. packageKnownVars;
  37741. $1=$recv(packageKnownVars)._includes_(aString);
  37742. if($core.assert($1)){
  37743. return false;
  37744. }
  37745. }
  37746. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  37747. $ctx1.sendIdx[","]=1;
  37748. return $recv($globals.Compiler)._eval_($2);
  37749. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  37750. },
  37751. args: ["aString", "aPackage"],
  37752. 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'",
  37753. referencedClasses: ["Compiler"],
  37754. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  37755. }),
  37756. $globals.SemanticAnalyzer);
  37757. $core.addMethod(
  37758. $core.method({
  37759. selector: "messageSends",
  37760. protocol: "accessing",
  37761. fn: function (){
  37762. var self=this,$self=this;
  37763. return $core.withContext(function($ctx1) {
  37764. var $1,$receiver;
  37765. $1=$self["@messageSends"];
  37766. if(($receiver = $1) == null || $receiver.a$nil){
  37767. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  37768. return $self["@messageSends"];
  37769. } else {
  37770. return $1;
  37771. }
  37772. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  37773. },
  37774. args: [],
  37775. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  37776. referencedClasses: ["Dictionary"],
  37777. messageSends: ["ifNil:", "new"]
  37778. }),
  37779. $globals.SemanticAnalyzer);
  37780. $core.addMethod(
  37781. $core.method({
  37782. selector: "newBlockScope",
  37783. protocol: "factory",
  37784. fn: function (){
  37785. var self=this,$self=this;
  37786. return $core.withContext(function($ctx1) {
  37787. return $self._newScopeOfClass_($globals.LexicalScope);
  37788. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  37789. },
  37790. args: [],
  37791. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  37792. referencedClasses: ["LexicalScope"],
  37793. messageSends: ["newScopeOfClass:"]
  37794. }),
  37795. $globals.SemanticAnalyzer);
  37796. $core.addMethod(
  37797. $core.method({
  37798. selector: "newMethodScope",
  37799. protocol: "factory",
  37800. fn: function (){
  37801. var self=this,$self=this;
  37802. return $core.withContext(function($ctx1) {
  37803. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  37804. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  37805. },
  37806. args: [],
  37807. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  37808. referencedClasses: ["MethodLexicalScope"],
  37809. messageSends: ["newScopeOfClass:"]
  37810. }),
  37811. $globals.SemanticAnalyzer);
  37812. $core.addMethod(
  37813. $core.method({
  37814. selector: "newScopeOfClass:",
  37815. protocol: "factory",
  37816. fn: function (aLexicalScopeClass){
  37817. var self=this,$self=this;
  37818. return $core.withContext(function($ctx1) {
  37819. var $1;
  37820. $1=$recv(aLexicalScopeClass)._new();
  37821. $recv($1)._outerScope_($self["@currentScope"]);
  37822. return $recv($1)._yourself();
  37823. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  37824. },
  37825. args: ["aLexicalScopeClass"],
  37826. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  37827. referencedClasses: [],
  37828. messageSends: ["outerScope:", "new", "yourself"]
  37829. }),
  37830. $globals.SemanticAnalyzer);
  37831. $core.addMethod(
  37832. $core.method({
  37833. selector: "nextBlockIndex",
  37834. protocol: "private",
  37835. fn: function (){
  37836. var self=this,$self=this;
  37837. return $core.withContext(function($ctx1) {
  37838. var $1,$receiver;
  37839. $1=$self["@blockIndex"];
  37840. if(($receiver = $1) == null || $receiver.a$nil){
  37841. $self["@blockIndex"]=(0);
  37842. $self["@blockIndex"];
  37843. } else {
  37844. $1;
  37845. }
  37846. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  37847. return $self["@blockIndex"];
  37848. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  37849. },
  37850. args: [],
  37851. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  37852. referencedClasses: [],
  37853. messageSends: ["ifNil:", "+"]
  37854. }),
  37855. $globals.SemanticAnalyzer);
  37856. $core.addMethod(
  37857. $core.method({
  37858. selector: "popScope",
  37859. protocol: "scope",
  37860. fn: function (){
  37861. var self=this,$self=this;
  37862. return $core.withContext(function($ctx1) {
  37863. var $1,$receiver;
  37864. $1=$self["@currentScope"];
  37865. if(($receiver = $1) == null || $receiver.a$nil){
  37866. $1;
  37867. } else {
  37868. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  37869. $self["@currentScope"];
  37870. }
  37871. return self;
  37872. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  37873. },
  37874. args: [],
  37875. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  37876. referencedClasses: [],
  37877. messageSends: ["ifNotNil:", "outerScope"]
  37878. }),
  37879. $globals.SemanticAnalyzer);
  37880. $core.addMethod(
  37881. $core.method({
  37882. selector: "pushScope:",
  37883. protocol: "scope",
  37884. fn: function (aScope){
  37885. var self=this,$self=this;
  37886. return $core.withContext(function($ctx1) {
  37887. $recv(aScope)._outerScope_($self["@currentScope"]);
  37888. $self["@currentScope"]=aScope;
  37889. return self;
  37890. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  37891. },
  37892. args: ["aScope"],
  37893. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  37894. referencedClasses: [],
  37895. messageSends: ["outerScope:"]
  37896. }),
  37897. $globals.SemanticAnalyzer);
  37898. $core.addMethod(
  37899. $core.method({
  37900. selector: "theClass",
  37901. protocol: "accessing",
  37902. fn: function (){
  37903. var self=this,$self=this;
  37904. return $self["@theClass"];
  37905. },
  37906. args: [],
  37907. source: "theClass\x0a\x09^ theClass",
  37908. referencedClasses: [],
  37909. messageSends: []
  37910. }),
  37911. $globals.SemanticAnalyzer);
  37912. $core.addMethod(
  37913. $core.method({
  37914. selector: "theClass:",
  37915. protocol: "accessing",
  37916. fn: function (aClass){
  37917. var self=this,$self=this;
  37918. $self["@theClass"]=aClass;
  37919. return self;
  37920. },
  37921. args: ["aClass"],
  37922. source: "theClass: aClass\x0a\x09theClass := aClass",
  37923. referencedClasses: [],
  37924. messageSends: []
  37925. }),
  37926. $globals.SemanticAnalyzer);
  37927. $core.addMethod(
  37928. $core.method({
  37929. selector: "thePackage",
  37930. protocol: "accessing",
  37931. fn: function (){
  37932. var self=this,$self=this;
  37933. return $self["@thePackage"];
  37934. },
  37935. args: [],
  37936. source: "thePackage\x0a\x09^ thePackage",
  37937. referencedClasses: [],
  37938. messageSends: []
  37939. }),
  37940. $globals.SemanticAnalyzer);
  37941. $core.addMethod(
  37942. $core.method({
  37943. selector: "thePackage:",
  37944. protocol: "accessing",
  37945. fn: function (aPackage){
  37946. var self=this,$self=this;
  37947. $self["@thePackage"]=aPackage;
  37948. return self;
  37949. },
  37950. args: ["aPackage"],
  37951. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  37952. referencedClasses: [],
  37953. messageSends: []
  37954. }),
  37955. $globals.SemanticAnalyzer);
  37956. $core.addMethod(
  37957. $core.method({
  37958. selector: "validateVariableScope:",
  37959. protocol: "scope",
  37960. fn: function (aString){
  37961. var self=this,$self=this;
  37962. return $core.withContext(function($ctx1) {
  37963. var $1,$receiver;
  37964. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  37965. if(($receiver = $1) == null || $receiver.a$nil){
  37966. $1;
  37967. } else {
  37968. $self._errorShadowingVariable_(aString);
  37969. }
  37970. return self;
  37971. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  37972. },
  37973. args: ["aString"],
  37974. 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 ]",
  37975. referencedClasses: [],
  37976. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  37977. }),
  37978. $globals.SemanticAnalyzer);
  37979. $core.addMethod(
  37980. $core.method({
  37981. selector: "visitAssignmentNode:",
  37982. protocol: "visiting",
  37983. fn: function (aNode){
  37984. var self=this,$self=this;
  37985. return $core.withContext(function($ctx1) {
  37986. (
  37987. $ctx1.supercall = true,
  37988. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  37989. $ctx1.supercall = false;
  37990. $recv($recv(aNode)._left())._beAssigned();
  37991. return self;
  37992. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37993. },
  37994. args: ["aNode"],
  37995. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  37996. referencedClasses: [],
  37997. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  37998. }),
  37999. $globals.SemanticAnalyzer);
  38000. $core.addMethod(
  38001. $core.method({
  38002. selector: "visitBlockNode:",
  38003. protocol: "visiting",
  38004. fn: function (aNode){
  38005. var self=this,$self=this;
  38006. return $core.withContext(function($ctx1) {
  38007. $self._pushScope_($self._newBlockScope());
  38008. $recv(aNode)._scope_($self["@currentScope"]);
  38009. $recv($self["@currentScope"])._node_(aNode);
  38010. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38011. $recv($recv(aNode)._parameters())._do_((function(each){
  38012. return $core.withContext(function($ctx2) {
  38013. $self._validateVariableScope_(each);
  38014. return $recv($self["@currentScope"])._addArg_(each);
  38015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38016. }));
  38017. (
  38018. $ctx1.supercall = true,
  38019. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38020. $ctx1.supercall = false;
  38021. $self._popScope();
  38022. return self;
  38023. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38024. },
  38025. args: ["aNode"],
  38026. 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",
  38027. referencedClasses: [],
  38028. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38029. }),
  38030. $globals.SemanticAnalyzer);
  38031. $core.addMethod(
  38032. $core.method({
  38033. selector: "visitCascadeNode:",
  38034. protocol: "visiting",
  38035. fn: function (aNode){
  38036. var self=this,$self=this;
  38037. return $core.withContext(function($ctx1) {
  38038. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38039. (
  38040. $ctx1.supercall = true,
  38041. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38042. $ctx1.supercall = false;
  38043. return self;
  38044. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38045. },
  38046. args: ["aNode"],
  38047. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38048. referencedClasses: [],
  38049. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38050. }),
  38051. $globals.SemanticAnalyzer);
  38052. $core.addMethod(
  38053. $core.method({
  38054. selector: "visitMethodNode:",
  38055. protocol: "visiting",
  38056. fn: function (aNode){
  38057. var self=this,$self=this;
  38058. return $core.withContext(function($ctx1) {
  38059. $self._pushScope_($self._newMethodScope());
  38060. $recv(aNode)._scope_($self["@currentScope"]);
  38061. $recv($self["@currentScope"])._node_(aNode);
  38062. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38063. return $core.withContext(function($ctx2) {
  38064. return $recv($self["@currentScope"])._addIVar_(each);
  38065. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38066. }));
  38067. $ctx1.sendIdx["do:"]=1;
  38068. $recv($recv(aNode)._arguments())._do_((function(each){
  38069. return $core.withContext(function($ctx2) {
  38070. $self._validateVariableScope_(each);
  38071. return $recv($self["@currentScope"])._addArg_(each);
  38072. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38073. }));
  38074. (
  38075. $ctx1.supercall = true,
  38076. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38077. $ctx1.supercall = false;
  38078. $recv(aNode)._classReferences_($self._classReferences());
  38079. $recv(aNode)._sendIndexes_($self._messageSends());
  38080. $self._popScope();
  38081. return aNode;
  38082. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38083. },
  38084. args: ["aNode"],
  38085. 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",
  38086. referencedClasses: [],
  38087. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38088. }),
  38089. $globals.SemanticAnalyzer);
  38090. $core.addMethod(
  38091. $core.method({
  38092. selector: "visitReturnNode:",
  38093. protocol: "visiting",
  38094. fn: function (aNode){
  38095. var self=this,$self=this;
  38096. return $core.withContext(function($ctx1) {
  38097. var $1;
  38098. $recv(aNode)._scope_($self["@currentScope"]);
  38099. $1=$recv($self["@currentScope"])._isMethodScope();
  38100. if($core.assert($1)){
  38101. $recv($self["@currentScope"])._localReturn_(true);
  38102. } else {
  38103. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38104. }
  38105. (
  38106. $ctx1.supercall = true,
  38107. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38108. $ctx1.supercall = false;
  38109. return self;
  38110. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38111. },
  38112. args: ["aNode"],
  38113. 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",
  38114. referencedClasses: [],
  38115. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38116. }),
  38117. $globals.SemanticAnalyzer);
  38118. $core.addMethod(
  38119. $core.method({
  38120. selector: "visitSendNode:",
  38121. protocol: "visiting",
  38122. fn: function (aNode){
  38123. var self=this,$self=this;
  38124. var sends;
  38125. return $core.withContext(function($ctx1) {
  38126. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38127. return $core.withContext(function($ctx2) {
  38128. return $recv($globals.OrderedCollection)._new();
  38129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38130. }));
  38131. $recv(sends)._add_(aNode);
  38132. $recv(aNode)._index_($recv(sends)._size());
  38133. (
  38134. $ctx1.supercall = true,
  38135. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38136. $ctx1.supercall = false;
  38137. return self;
  38138. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38139. },
  38140. args: ["aNode"],
  38141. 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",
  38142. referencedClasses: ["OrderedCollection"],
  38143. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38144. }),
  38145. $globals.SemanticAnalyzer);
  38146. $core.addMethod(
  38147. $core.method({
  38148. selector: "visitSequenceNode:",
  38149. protocol: "visiting",
  38150. fn: function (aNode){
  38151. var self=this,$self=this;
  38152. return $core.withContext(function($ctx1) {
  38153. $recv($recv(aNode)._temps())._do_((function(each){
  38154. return $core.withContext(function($ctx2) {
  38155. $self._validateVariableScope_(each);
  38156. return $recv($self["@currentScope"])._addTemp_(each);
  38157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38158. }));
  38159. (
  38160. $ctx1.supercall = true,
  38161. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38162. $ctx1.supercall = false;
  38163. return self;
  38164. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38165. },
  38166. args: ["aNode"],
  38167. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38168. referencedClasses: [],
  38169. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38170. }),
  38171. $globals.SemanticAnalyzer);
  38172. $core.addMethod(
  38173. $core.method({
  38174. selector: "visitVariableNode:",
  38175. protocol: "visiting",
  38176. fn: function (aNode){
  38177. var self=this,$self=this;
  38178. var binding;
  38179. return $core.withContext(function($ctx1) {
  38180. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38181. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38182. $1=binding;
  38183. if(($receiver = $1) == null || $receiver.a$nil){
  38184. $3=$recv(aNode)._value();
  38185. $ctx1.sendIdx["value"]=1;
  38186. $2=$recv($3)._isCapitalized();
  38187. if($core.assert($2)){
  38188. $4=$recv($globals.ClassRefVar)._new();
  38189. $ctx1.sendIdx["new"]=1;
  38190. $5=$recv(aNode)._value();
  38191. $ctx1.sendIdx["value"]=2;
  38192. $recv($4)._name_($5);
  38193. $ctx1.sendIdx["name:"]=1;
  38194. $6=$recv($4)._yourself();
  38195. $ctx1.sendIdx["yourself"]=1;
  38196. binding=$6;
  38197. binding;
  38198. $7=$self._classReferences();
  38199. $8=$recv(aNode)._value();
  38200. $ctx1.sendIdx["value"]=3;
  38201. $recv($7)._add_($8);
  38202. } else {
  38203. $self._errorUnknownVariable_(aNode);
  38204. $9=$recv($globals.UnknownVar)._new();
  38205. $recv($9)._name_($recv(aNode)._value());
  38206. binding=$recv($9)._yourself();
  38207. binding;
  38208. }
  38209. } else {
  38210. $1;
  38211. }
  38212. $recv(aNode)._binding_(binding);
  38213. return self;
  38214. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38215. },
  38216. args: ["aNode"],
  38217. 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.",
  38218. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38219. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38220. }),
  38221. $globals.SemanticAnalyzer);
  38222. $core.addMethod(
  38223. $core.method({
  38224. selector: "on:",
  38225. protocol: "instance creation",
  38226. fn: function (aClass){
  38227. var self=this,$self=this;
  38228. return $core.withContext(function($ctx1) {
  38229. var $1;
  38230. $1=$self._new();
  38231. $recv($1)._theClass_(aClass);
  38232. return $recv($1)._yourself();
  38233. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38234. },
  38235. args: ["aClass"],
  38236. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38237. referencedClasses: [],
  38238. messageSends: ["theClass:", "new", "yourself"]
  38239. }),
  38240. $globals.SemanticAnalyzer.a$cls);
  38241. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38242. $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";
  38243. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38244. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38245. $core.addMethod(
  38246. $core.method({
  38247. selector: "messageText",
  38248. protocol: "accessing",
  38249. fn: function (){
  38250. var self=this,$self=this;
  38251. return $core.withContext(function($ctx1) {
  38252. return " Invalid assignment to variable: ".__comma($self._variableName());
  38253. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38254. },
  38255. args: [],
  38256. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38257. referencedClasses: [],
  38258. messageSends: [",", "variableName"]
  38259. }),
  38260. $globals.InvalidAssignmentError);
  38261. $core.addMethod(
  38262. $core.method({
  38263. selector: "variableName",
  38264. protocol: "accessing",
  38265. fn: function (){
  38266. var self=this,$self=this;
  38267. return $self["@variableName"];
  38268. },
  38269. args: [],
  38270. source: "variableName\x0a\x09^ variableName",
  38271. referencedClasses: [],
  38272. messageSends: []
  38273. }),
  38274. $globals.InvalidAssignmentError);
  38275. $core.addMethod(
  38276. $core.method({
  38277. selector: "variableName:",
  38278. protocol: "accessing",
  38279. fn: function (aString){
  38280. var self=this,$self=this;
  38281. $self["@variableName"]=aString;
  38282. return self;
  38283. },
  38284. args: ["aString"],
  38285. source: "variableName: aString\x0a\x09variableName := aString",
  38286. referencedClasses: [],
  38287. messageSends: []
  38288. }),
  38289. $globals.InvalidAssignmentError);
  38290. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38291. $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.";
  38292. $core.addMethod(
  38293. $core.method({
  38294. selector: "messageText",
  38295. protocol: "accessing",
  38296. fn: function (){
  38297. var self=this,$self=this;
  38298. return $core.withContext(function($ctx1) {
  38299. var $1;
  38300. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38301. $ctx1.sendIdx[","]=1;
  38302. return $1;
  38303. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38304. },
  38305. args: [],
  38306. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38307. referencedClasses: [],
  38308. messageSends: [",", "variableName"]
  38309. }),
  38310. $globals.ShadowingVariableError);
  38311. $core.addMethod(
  38312. $core.method({
  38313. selector: "variableName",
  38314. protocol: "accessing",
  38315. fn: function (){
  38316. var self=this,$self=this;
  38317. return $self["@variableName"];
  38318. },
  38319. args: [],
  38320. source: "variableName\x0a\x09^ variableName",
  38321. referencedClasses: [],
  38322. messageSends: []
  38323. }),
  38324. $globals.ShadowingVariableError);
  38325. $core.addMethod(
  38326. $core.method({
  38327. selector: "variableName:",
  38328. protocol: "accessing",
  38329. fn: function (aString){
  38330. var self=this,$self=this;
  38331. $self["@variableName"]=aString;
  38332. return self;
  38333. },
  38334. args: ["aString"],
  38335. source: "variableName: aString\x0a\x09variableName := aString",
  38336. referencedClasses: [],
  38337. messageSends: []
  38338. }),
  38339. $globals.ShadowingVariableError);
  38340. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38341. $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.";
  38342. $core.addMethod(
  38343. $core.method({
  38344. selector: "messageText",
  38345. protocol: "accessing",
  38346. fn: function (){
  38347. var self=this,$self=this;
  38348. return $core.withContext(function($ctx1) {
  38349. var $1;
  38350. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38351. $ctx1.sendIdx[","]=1;
  38352. return $1;
  38353. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38354. },
  38355. args: [],
  38356. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38357. referencedClasses: [],
  38358. messageSends: [",", "variableName"]
  38359. }),
  38360. $globals.UnknownVariableError);
  38361. $core.addMethod(
  38362. $core.method({
  38363. selector: "variableName",
  38364. protocol: "accessing",
  38365. fn: function (){
  38366. var self=this,$self=this;
  38367. return $self["@variableName"];
  38368. },
  38369. args: [],
  38370. source: "variableName\x0a\x09^ variableName",
  38371. referencedClasses: [],
  38372. messageSends: []
  38373. }),
  38374. $globals.UnknownVariableError);
  38375. $core.addMethod(
  38376. $core.method({
  38377. selector: "variableName:",
  38378. protocol: "accessing",
  38379. fn: function (aString){
  38380. var self=this,$self=this;
  38381. $self["@variableName"]=aString;
  38382. return self;
  38383. },
  38384. args: ["aString"],
  38385. source: "variableName: aString\x0a\x09variableName := aString",
  38386. referencedClasses: [],
  38387. messageSends: []
  38388. }),
  38389. $globals.UnknownVariableError);
  38390. });
  38391. 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";
  38392. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38393. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38394. $core.addPackage("Compiler-IR");
  38395. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38396. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38397. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38398. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38399. $core.addMethod(
  38400. $core.method({
  38401. selector: "alias:",
  38402. protocol: "visiting",
  38403. fn: function (aNode){
  38404. var self=this,$self=this;
  38405. var variable;
  38406. return $core.withContext(function($ctx1) {
  38407. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  38408. $1=$recv(aNode)._isImmutable();
  38409. if($core.assert($1)){
  38410. $2=$self._visit_(aNode);
  38411. $ctx1.sendIdx["visit:"]=1;
  38412. return $2;
  38413. }
  38414. $3=$recv($globals.IRVariable)._new();
  38415. $ctx1.sendIdx["new"]=1;
  38416. $5=$recv($globals.AliasVar)._new();
  38417. $ctx1.sendIdx["new"]=2;
  38418. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38419. $recv($3)._variable_($4);
  38420. $6=$recv($3)._yourself();
  38421. $ctx1.sendIdx["yourself"]=1;
  38422. variable=$6;
  38423. $7=$self._sequence();
  38424. $9=$recv($globals.IRAssignment)._new();
  38425. $recv($9)._add_(variable);
  38426. $ctx1.sendIdx["add:"]=2;
  38427. $recv($9)._add_($self._visit_(aNode));
  38428. $ctx1.sendIdx["add:"]=3;
  38429. $8=$recv($9)._yourself();
  38430. $recv($7)._add_($8);
  38431. $ctx1.sendIdx["add:"]=1;
  38432. $recv($recv($self._method())._internalVariables())._add_(variable);
  38433. return variable;
  38434. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38435. },
  38436. args: ["aNode"],
  38437. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38438. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38439. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  38440. }),
  38441. $globals.IRASTTranslator);
  38442. $core.addMethod(
  38443. $core.method({
  38444. selector: "aliasTemporally:",
  38445. protocol: "visiting",
  38446. fn: function (aCollection){
  38447. var self=this,$self=this;
  38448. var threshold,result;
  38449. return $core.withContext(function($ctx1) {
  38450. var $1,$2,$4,$3;
  38451. threshold=(0);
  38452. $recv(aCollection)._withIndexDo_((function(each,i){
  38453. return $core.withContext(function($ctx2) {
  38454. $1=$recv(each)._subtreeNeedsAliasing();
  38455. if($core.assert($1)){
  38456. threshold=i;
  38457. return threshold;
  38458. }
  38459. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38460. }));
  38461. $ctx1.sendIdx["withIndexDo:"]=1;
  38462. result=$recv($globals.OrderedCollection)._new();
  38463. $recv(aCollection)._withIndexDo_((function(each,i){
  38464. return $core.withContext(function($ctx2) {
  38465. $2=result;
  38466. $4=$recv(i).__lt_eq(threshold);
  38467. if($core.assert($4)){
  38468. $3=$self._alias_(each);
  38469. } else {
  38470. $3=$self._visit_(each);
  38471. }
  38472. return $recv($2)._add_($3);
  38473. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38474. }));
  38475. return result;
  38476. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38477. },
  38478. args: ["aCollection"],
  38479. 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",
  38480. referencedClasses: ["OrderedCollection"],
  38481. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38482. }),
  38483. $globals.IRASTTranslator);
  38484. $core.addMethod(
  38485. $core.method({
  38486. selector: "method",
  38487. protocol: "accessing",
  38488. fn: function (){
  38489. var self=this,$self=this;
  38490. return $self["@method"];
  38491. },
  38492. args: [],
  38493. source: "method\x0a\x09^ method",
  38494. referencedClasses: [],
  38495. messageSends: []
  38496. }),
  38497. $globals.IRASTTranslator);
  38498. $core.addMethod(
  38499. $core.method({
  38500. selector: "method:",
  38501. protocol: "accessing",
  38502. fn: function (anIRMethod){
  38503. var self=this,$self=this;
  38504. $self["@method"]=anIRMethod;
  38505. return self;
  38506. },
  38507. args: ["anIRMethod"],
  38508. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38509. referencedClasses: [],
  38510. messageSends: []
  38511. }),
  38512. $globals.IRASTTranslator);
  38513. $core.addMethod(
  38514. $core.method({
  38515. selector: "nextAlias",
  38516. protocol: "accessing",
  38517. fn: function (){
  38518. var self=this,$self=this;
  38519. return $core.withContext(function($ctx1) {
  38520. var $1,$receiver;
  38521. $1=$self["@nextAlias"];
  38522. if(($receiver = $1) == null || $receiver.a$nil){
  38523. $self["@nextAlias"]=(0);
  38524. $self["@nextAlias"];
  38525. } else {
  38526. $1;
  38527. }
  38528. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38529. return $recv($self["@nextAlias"])._asString();
  38530. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38531. },
  38532. args: [],
  38533. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38534. referencedClasses: [],
  38535. messageSends: ["ifNil:", "+", "asString"]
  38536. }),
  38537. $globals.IRASTTranslator);
  38538. $core.addMethod(
  38539. $core.method({
  38540. selector: "sequence",
  38541. protocol: "accessing",
  38542. fn: function (){
  38543. var self=this,$self=this;
  38544. return $self["@sequence"];
  38545. },
  38546. args: [],
  38547. source: "sequence\x0a\x09^ sequence",
  38548. referencedClasses: [],
  38549. messageSends: []
  38550. }),
  38551. $globals.IRASTTranslator);
  38552. $core.addMethod(
  38553. $core.method({
  38554. selector: "sequence:",
  38555. protocol: "accessing",
  38556. fn: function (anIRSequence){
  38557. var self=this,$self=this;
  38558. $self["@sequence"]=anIRSequence;
  38559. return self;
  38560. },
  38561. args: ["anIRSequence"],
  38562. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38563. referencedClasses: [],
  38564. messageSends: []
  38565. }),
  38566. $globals.IRASTTranslator);
  38567. $core.addMethod(
  38568. $core.method({
  38569. selector: "source",
  38570. protocol: "accessing",
  38571. fn: function (){
  38572. var self=this,$self=this;
  38573. return $self["@source"];
  38574. },
  38575. args: [],
  38576. source: "source\x0a\x09^ source",
  38577. referencedClasses: [],
  38578. messageSends: []
  38579. }),
  38580. $globals.IRASTTranslator);
  38581. $core.addMethod(
  38582. $core.method({
  38583. selector: "source:",
  38584. protocol: "accessing",
  38585. fn: function (aString){
  38586. var self=this,$self=this;
  38587. $self["@source"]=aString;
  38588. return self;
  38589. },
  38590. args: ["aString"],
  38591. source: "source: aString\x0a\x09source := aString",
  38592. referencedClasses: [],
  38593. messageSends: []
  38594. }),
  38595. $globals.IRASTTranslator);
  38596. $core.addMethod(
  38597. $core.method({
  38598. selector: "theClass",
  38599. protocol: "accessing",
  38600. fn: function (){
  38601. var self=this,$self=this;
  38602. return $self["@theClass"];
  38603. },
  38604. args: [],
  38605. source: "theClass\x0a\x09^ theClass",
  38606. referencedClasses: [],
  38607. messageSends: []
  38608. }),
  38609. $globals.IRASTTranslator);
  38610. $core.addMethod(
  38611. $core.method({
  38612. selector: "theClass:",
  38613. protocol: "accessing",
  38614. fn: function (aClass){
  38615. var self=this,$self=this;
  38616. $self["@theClass"]=aClass;
  38617. return self;
  38618. },
  38619. args: ["aClass"],
  38620. source: "theClass: aClass\x0a\x09theClass := aClass",
  38621. referencedClasses: [],
  38622. messageSends: []
  38623. }),
  38624. $globals.IRASTTranslator);
  38625. $core.addMethod(
  38626. $core.method({
  38627. selector: "visitAssignmentNode:",
  38628. protocol: "visiting",
  38629. fn: function (aNode){
  38630. var self=this,$self=this;
  38631. var left,right,assignment;
  38632. return $core.withContext(function($ctx1) {
  38633. var $1,$3,$2;
  38634. right=$self._visit_($recv(aNode)._right());
  38635. $ctx1.sendIdx["visit:"]=1;
  38636. left=$self._visit_($recv(aNode)._left());
  38637. $1=$self._sequence();
  38638. $3=$recv($globals.IRAssignment)._new();
  38639. $recv($3)._add_(left);
  38640. $ctx1.sendIdx["add:"]=2;
  38641. $recv($3)._add_(right);
  38642. $2=$recv($3)._yourself();
  38643. $recv($1)._add_($2);
  38644. $ctx1.sendIdx["add:"]=1;
  38645. return left;
  38646. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  38647. },
  38648. args: ["aNode"],
  38649. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  38650. referencedClasses: ["IRAssignment"],
  38651. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  38652. }),
  38653. $globals.IRASTTranslator);
  38654. $core.addMethod(
  38655. $core.method({
  38656. selector: "visitBlockNode:",
  38657. protocol: "visiting",
  38658. fn: function (aNode){
  38659. var self=this,$self=this;
  38660. var closure;
  38661. return $core.withContext(function($ctx1) {
  38662. var $1,$2,$3,$5,$4,$6,$8,$7;
  38663. $1=$recv($globals.IRClosure)._new();
  38664. $ctx1.sendIdx["new"]=1;
  38665. $recv($1)._arguments_($recv(aNode)._parameters());
  38666. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38667. $2=$recv(aNode)._scope();
  38668. $ctx1.sendIdx["scope"]=1;
  38669. $recv($1)._scope_($2);
  38670. $ctx1.sendIdx["scope:"]=1;
  38671. $3=$recv($1)._yourself();
  38672. $ctx1.sendIdx["yourself"]=1;
  38673. closure=$3;
  38674. $5=$recv(aNode)._scope();
  38675. $ctx1.sendIdx["scope"]=2;
  38676. $4=$recv($5)._temps();
  38677. $recv($4)._do_((function(each){
  38678. return $core.withContext(function($ctx2) {
  38679. $6=closure;
  38680. $8=$recv($globals.IRTempDeclaration)._new();
  38681. $recv($8)._name_($recv(each)._name());
  38682. $recv($8)._scope_($recv(aNode)._scope());
  38683. $7=$recv($8)._yourself();
  38684. return $recv($6)._add_($7);
  38685. $ctx2.sendIdx["add:"]=1;
  38686. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38687. }));
  38688. $ctx1.sendIdx["do:"]=1;
  38689. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38690. return $core.withContext(function($ctx2) {
  38691. return $recv(closure)._add_($self._visit_(each));
  38692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38693. }));
  38694. return closure;
  38695. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  38696. },
  38697. args: ["aNode"],
  38698. 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",
  38699. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  38700. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  38701. }),
  38702. $globals.IRASTTranslator);
  38703. $core.addMethod(
  38704. $core.method({
  38705. selector: "visitBlockSequenceNode:",
  38706. protocol: "visiting",
  38707. fn: function (aNode){
  38708. var self=this,$self=this;
  38709. return $core.withContext(function($ctx1) {
  38710. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  38711. $1=$recv($globals.IRBlockSequence)._new();
  38712. $ctx1.sendIdx["new"]=1;
  38713. return $self._withSequence_do_($1,(function(){
  38714. return $core.withContext(function($ctx2) {
  38715. $2=$recv(aNode)._dagChildren();
  38716. $ctx2.sendIdx["dagChildren"]=1;
  38717. return $recv($2)._ifNotEmpty_((function(){
  38718. return $core.withContext(function($ctx3) {
  38719. $4=$recv(aNode)._dagChildren();
  38720. $ctx3.sendIdx["dagChildren"]=2;
  38721. $3=$recv($4)._allButLast();
  38722. $recv($3)._do_((function(each){
  38723. return $core.withContext(function($ctx4) {
  38724. $5=$self._sequence();
  38725. $ctx4.sendIdx["sequence"]=1;
  38726. $6=$self._visitOrAlias_(each);
  38727. $ctx4.sendIdx["visitOrAlias:"]=1;
  38728. return $recv($5)._add_($6);
  38729. $ctx4.sendIdx["add:"]=1;
  38730. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38731. }));
  38732. $9=$recv(aNode)._dagChildren();
  38733. $ctx3.sendIdx["dagChildren"]=3;
  38734. $8=$recv($9)._last();
  38735. $ctx3.sendIdx["last"]=1;
  38736. $7=$recv($8)._isReturnNode();
  38737. if($core.assert($7)){
  38738. return $recv($self._sequence())._add_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  38739. } else {
  38740. $10=$self._sequence();
  38741. $ctx3.sendIdx["sequence"]=2;
  38742. $12=$recv($globals.IRBlockReturn)._new();
  38743. $15=$recv(aNode)._dagChildren();
  38744. $ctx3.sendIdx["dagChildren"]=4;
  38745. $14=$recv($15)._last();
  38746. $ctx3.sendIdx["last"]=2;
  38747. $13=$self._visitOrAlias_($14);
  38748. $ctx3.sendIdx["visitOrAlias:"]=2;
  38749. $recv($12)._add_($13);
  38750. $ctx3.sendIdx["add:"]=3;
  38751. $11=$recv($12)._yourself();
  38752. return $recv($10)._add_($11);
  38753. $ctx3.sendIdx["add:"]=2;
  38754. }
  38755. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38756. }));
  38757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38758. }));
  38759. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38760. },
  38761. args: ["aNode"],
  38762. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  38763. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  38764. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  38765. }),
  38766. $globals.IRASTTranslator);
  38767. $core.addMethod(
  38768. $core.method({
  38769. selector: "visitCascadeNode:",
  38770. protocol: "visiting",
  38771. fn: function (aNode){
  38772. var self=this,$self=this;
  38773. var receiver;
  38774. return $core.withContext(function($ctx1) {
  38775. var $1,$2,$4,$3;
  38776. receiver=$recv(aNode)._receiver();
  38777. $1=$recv(receiver)._isImmutable();
  38778. if(!$core.assert($1)){
  38779. var alias;
  38780. alias=$self._alias_(receiver);
  38781. alias;
  38782. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  38783. receiver;
  38784. }
  38785. $2=$recv(aNode)._dagChildren();
  38786. $ctx1.sendIdx["dagChildren"]=1;
  38787. $recv($2)._do_((function(each){
  38788. return $core.withContext(function($ctx2) {
  38789. return $recv(each)._receiver_(receiver);
  38790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38791. }));
  38792. $ctx1.sendIdx["do:"]=1;
  38793. $4=$recv(aNode)._dagChildren();
  38794. $ctx1.sendIdx["dagChildren"]=2;
  38795. $3=$recv($4)._allButLast();
  38796. $recv($3)._do_((function(each){
  38797. return $core.withContext(function($ctx2) {
  38798. return $recv($self._sequence())._add_($self._visit_(each));
  38799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  38800. }));
  38801. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  38802. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  38803. },
  38804. args: ["aNode"],
  38805. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  38806. referencedClasses: ["VariableNode"],
  38807. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  38808. }),
  38809. $globals.IRASTTranslator);
  38810. $core.addMethod(
  38811. $core.method({
  38812. selector: "visitDynamicArrayNode:",
  38813. protocol: "visiting",
  38814. fn: function (aNode){
  38815. var self=this,$self=this;
  38816. var array;
  38817. return $core.withContext(function($ctx1) {
  38818. array=$recv($globals.IRDynamicArray)._new();
  38819. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38820. return $core.withContext(function($ctx2) {
  38821. return $recv(array)._add_(each);
  38822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38823. }));
  38824. return array;
  38825. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  38826. },
  38827. args: ["aNode"],
  38828. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  38829. referencedClasses: ["IRDynamicArray"],
  38830. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38831. }),
  38832. $globals.IRASTTranslator);
  38833. $core.addMethod(
  38834. $core.method({
  38835. selector: "visitDynamicDictionaryNode:",
  38836. protocol: "visiting",
  38837. fn: function (aNode){
  38838. var self=this,$self=this;
  38839. var dictionary;
  38840. return $core.withContext(function($ctx1) {
  38841. dictionary=$recv($globals.IRDynamicDictionary)._new();
  38842. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38843. return $core.withContext(function($ctx2) {
  38844. return $recv(dictionary)._add_(each);
  38845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38846. }));
  38847. return dictionary;
  38848. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  38849. },
  38850. args: ["aNode"],
  38851. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  38852. referencedClasses: ["IRDynamicDictionary"],
  38853. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38854. }),
  38855. $globals.IRASTTranslator);
  38856. $core.addMethod(
  38857. $core.method({
  38858. selector: "visitJSStatementNode:",
  38859. protocol: "visiting",
  38860. fn: function (aNode){
  38861. var self=this,$self=this;
  38862. return $core.withContext(function($ctx1) {
  38863. var $1;
  38864. $1=$recv($globals.IRVerbatim)._new();
  38865. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  38866. return $recv($1)._yourself();
  38867. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38868. },
  38869. args: ["aNode"],
  38870. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  38871. referencedClasses: ["IRVerbatim"],
  38872. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  38873. }),
  38874. $globals.IRASTTranslator);
  38875. $core.addMethod(
  38876. $core.method({
  38877. selector: "visitMethodNode:",
  38878. protocol: "visiting",
  38879. fn: function (aNode){
  38880. var self=this,$self=this;
  38881. return $core.withContext(function($ctx1) {
  38882. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  38883. $2=$recv($globals.IRMethod)._new();
  38884. $ctx1.sendIdx["new"]=1;
  38885. $recv($2)._source_($recv($self._source())._crlfSanitized());
  38886. $ctx1.sendIdx["source:"]=1;
  38887. $recv($2)._theClass_($self._theClass());
  38888. $recv($2)._arguments_($recv(aNode)._arguments());
  38889. $recv($2)._selector_($recv(aNode)._selector());
  38890. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  38891. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38892. $recv($2)._classReferences_($recv(aNode)._classReferences());
  38893. $3=$recv(aNode)._scope();
  38894. $ctx1.sendIdx["scope"]=1;
  38895. $recv($2)._scope_($3);
  38896. $ctx1.sendIdx["scope:"]=1;
  38897. $4=$recv($2)._yourself();
  38898. $ctx1.sendIdx["yourself"]=1;
  38899. $1=$4;
  38900. $self._method_($1);
  38901. $6=$recv(aNode)._scope();
  38902. $ctx1.sendIdx["scope"]=2;
  38903. $5=$recv($6)._temps();
  38904. $recv($5)._do_((function(each){
  38905. return $core.withContext(function($ctx2) {
  38906. $7=$self._method();
  38907. $ctx2.sendIdx["method"]=1;
  38908. $9=$recv($globals.IRTempDeclaration)._new();
  38909. $ctx2.sendIdx["new"]=2;
  38910. $recv($9)._name_($recv(each)._name());
  38911. $10=$recv(aNode)._scope();
  38912. $ctx2.sendIdx["scope"]=3;
  38913. $recv($9)._scope_($10);
  38914. $11=$recv($9)._yourself();
  38915. $ctx2.sendIdx["yourself"]=2;
  38916. $8=$11;
  38917. return $recv($7)._add_($8);
  38918. $ctx2.sendIdx["add:"]=1;
  38919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38920. }));
  38921. $ctx1.sendIdx["do:"]=1;
  38922. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38923. return $core.withContext(function($ctx2) {
  38924. $12=$self._method();
  38925. $ctx2.sendIdx["method"]=2;
  38926. return $recv($12)._add_($self._visit_(each));
  38927. $ctx2.sendIdx["add:"]=2;
  38928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38929. }));
  38930. $14=$recv(aNode)._scope();
  38931. $ctx1.sendIdx["scope"]=4;
  38932. $13=$recv($14)._hasLocalReturn();
  38933. if(!$core.assert($13)){
  38934. $15=$self._method();
  38935. $ctx1.sendIdx["method"]=3;
  38936. $17=$recv($globals.IRReturn)._new();
  38937. $ctx1.sendIdx["new"]=3;
  38938. $19=$recv($globals.IRVariable)._new();
  38939. $ctx1.sendIdx["new"]=4;
  38940. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  38941. $20=$recv($19)._yourself();
  38942. $ctx1.sendIdx["yourself"]=3;
  38943. $18=$20;
  38944. $recv($17)._add_($18);
  38945. $ctx1.sendIdx["add:"]=4;
  38946. $21=$recv($17)._yourself();
  38947. $ctx1.sendIdx["yourself"]=4;
  38948. $16=$21;
  38949. $recv($15)._add_($16);
  38950. $ctx1.sendIdx["add:"]=3;
  38951. $23=$recv($globals.IRVerbatim)._new();
  38952. $recv($23)._source_("");
  38953. $22=$recv($23)._yourself();
  38954. $recv($15)._add_($22);
  38955. }
  38956. return $self._method();
  38957. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38958. },
  38959. args: ["aNode"],
  38960. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  38961. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  38962. 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"]
  38963. }),
  38964. $globals.IRASTTranslator);
  38965. $core.addMethod(
  38966. $core.method({
  38967. selector: "visitOrAlias:",
  38968. protocol: "visiting",
  38969. fn: function (aNode){
  38970. var self=this,$self=this;
  38971. return $core.withContext(function($ctx1) {
  38972. var $1;
  38973. $1=$recv(aNode)._shouldBeAliased();
  38974. if($core.assert($1)){
  38975. return $self._alias_(aNode);
  38976. } else {
  38977. return $self._visit_(aNode);
  38978. }
  38979. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  38980. },
  38981. args: ["aNode"],
  38982. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  38983. referencedClasses: [],
  38984. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  38985. }),
  38986. $globals.IRASTTranslator);
  38987. $core.addMethod(
  38988. $core.method({
  38989. selector: "visitReturnNode:",
  38990. protocol: "visiting",
  38991. fn: function (aNode){
  38992. var self=this,$self=this;
  38993. var return_;
  38994. return $core.withContext(function($ctx1) {
  38995. var $1;
  38996. $1=$recv(aNode)._nonLocalReturn();
  38997. if($core.assert($1)){
  38998. return_=$recv($globals.IRNonLocalReturn)._new();
  38999. $ctx1.sendIdx["new"]=1;
  39000. } else {
  39001. return_=$recv($globals.IRReturn)._new();
  39002. }
  39003. $recv(return_)._scope_($recv(aNode)._scope());
  39004. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39005. return $core.withContext(function($ctx2) {
  39006. return $recv(return_)._add_($self._visitOrAlias_(each));
  39007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39008. }));
  39009. return return_;
  39010. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39011. },
  39012. args: ["aNode"],
  39013. 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",
  39014. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39015. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39016. }),
  39017. $globals.IRASTTranslator);
  39018. $core.addMethod(
  39019. $core.method({
  39020. selector: "visitSendNode:",
  39021. protocol: "visiting",
  39022. fn: function (aNode){
  39023. var self=this,$self=this;
  39024. var send;
  39025. return $core.withContext(function($ctx1) {
  39026. var $1;
  39027. send=$recv($globals.IRSend)._new();
  39028. $1=send;
  39029. $recv($1)._selector_($recv(aNode)._selector());
  39030. $recv($1)._index_($recv(aNode)._index());
  39031. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39032. return $core.withContext(function($ctx2) {
  39033. return $recv(send)._add_(each);
  39034. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39035. }));
  39036. return send;
  39037. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39038. },
  39039. args: ["aNode"],
  39040. 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",
  39041. referencedClasses: ["IRSend"],
  39042. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39043. }),
  39044. $globals.IRASTTranslator);
  39045. $core.addMethod(
  39046. $core.method({
  39047. selector: "visitSequenceNode:",
  39048. protocol: "visiting",
  39049. fn: function (aNode){
  39050. var self=this,$self=this;
  39051. return $core.withContext(function($ctx1) {
  39052. var $1;
  39053. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39054. return $core.withContext(function($ctx2) {
  39055. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39056. var instruction;
  39057. return $core.withContext(function($ctx3) {
  39058. instruction=$self._visitOrAlias_(each);
  39059. instruction;
  39060. $1=$recv(instruction)._isVariable();
  39061. if(!$core.assert($1)){
  39062. return $recv($self._sequence())._add_(instruction);
  39063. }
  39064. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  39065. }));
  39066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39067. }));
  39068. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39069. },
  39070. args: ["aNode"],
  39071. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  39072. referencedClasses: ["IRSequence"],
  39073. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  39074. }),
  39075. $globals.IRASTTranslator);
  39076. $core.addMethod(
  39077. $core.method({
  39078. selector: "visitValueNode:",
  39079. protocol: "visiting",
  39080. fn: function (aNode){
  39081. var self=this,$self=this;
  39082. return $core.withContext(function($ctx1) {
  39083. var $1;
  39084. $1=$recv($globals.IRValue)._new();
  39085. $recv($1)._value_($recv(aNode)._value());
  39086. return $recv($1)._yourself();
  39087. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39088. },
  39089. args: ["aNode"],
  39090. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39091. referencedClasses: ["IRValue"],
  39092. messageSends: ["value:", "new", "value", "yourself"]
  39093. }),
  39094. $globals.IRASTTranslator);
  39095. $core.addMethod(
  39096. $core.method({
  39097. selector: "visitVariableNode:",
  39098. protocol: "visiting",
  39099. fn: function (aNode){
  39100. var self=this,$self=this;
  39101. return $core.withContext(function($ctx1) {
  39102. var $1;
  39103. $1=$recv($globals.IRVariable)._new();
  39104. $recv($1)._variable_($recv(aNode)._binding());
  39105. return $recv($1)._yourself();
  39106. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39107. },
  39108. args: ["aNode"],
  39109. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39110. referencedClasses: ["IRVariable"],
  39111. messageSends: ["variable:", "new", "binding", "yourself"]
  39112. }),
  39113. $globals.IRASTTranslator);
  39114. $core.addMethod(
  39115. $core.method({
  39116. selector: "withSequence:do:",
  39117. protocol: "accessing",
  39118. fn: function (aSequence,aBlock){
  39119. var self=this,$self=this;
  39120. var outerSequence;
  39121. return $core.withContext(function($ctx1) {
  39122. outerSequence=$self._sequence();
  39123. $self._sequence_(aSequence);
  39124. $ctx1.sendIdx["sequence:"]=1;
  39125. $recv(aBlock)._value();
  39126. $self._sequence_(outerSequence);
  39127. return aSequence;
  39128. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39129. },
  39130. args: ["aSequence", "aBlock"],
  39131. 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",
  39132. referencedClasses: [],
  39133. messageSends: ["sequence", "sequence:", "value"]
  39134. }),
  39135. $globals.IRASTTranslator);
  39136. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39137. $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.";
  39138. $core.addMethod(
  39139. $core.method({
  39140. selector: "add:",
  39141. protocol: "building",
  39142. fn: function (anObject){
  39143. var self=this,$self=this;
  39144. return $core.withContext(function($ctx1) {
  39145. $recv(anObject)._parent_(self);
  39146. return $recv($self._dagChildren())._add_(anObject);
  39147. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39148. },
  39149. args: ["anObject"],
  39150. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39151. referencedClasses: [],
  39152. messageSends: ["parent:", "add:", "dagChildren"]
  39153. }),
  39154. $globals.IRInstruction);
  39155. $core.addMethod(
  39156. $core.method({
  39157. selector: "isClosure",
  39158. protocol: "testing",
  39159. fn: function (){
  39160. var self=this,$self=this;
  39161. return false;
  39162. },
  39163. args: [],
  39164. source: "isClosure\x0a\x09^ false",
  39165. referencedClasses: [],
  39166. messageSends: []
  39167. }),
  39168. $globals.IRInstruction);
  39169. $core.addMethod(
  39170. $core.method({
  39171. selector: "isInlined",
  39172. protocol: "testing",
  39173. fn: function (){
  39174. var self=this,$self=this;
  39175. return false;
  39176. },
  39177. args: [],
  39178. source: "isInlined\x0a\x09^ false",
  39179. referencedClasses: [],
  39180. messageSends: []
  39181. }),
  39182. $globals.IRInstruction);
  39183. $core.addMethod(
  39184. $core.method({
  39185. selector: "isMethod",
  39186. protocol: "testing",
  39187. fn: function (){
  39188. var self=this,$self=this;
  39189. return false;
  39190. },
  39191. args: [],
  39192. source: "isMethod\x0a\x09^ false",
  39193. referencedClasses: [],
  39194. messageSends: []
  39195. }),
  39196. $globals.IRInstruction);
  39197. $core.addMethod(
  39198. $core.method({
  39199. selector: "isSelf",
  39200. protocol: "testing",
  39201. fn: function (){
  39202. var self=this,$self=this;
  39203. return false;
  39204. },
  39205. args: [],
  39206. source: "isSelf\x0a\x09^ false",
  39207. referencedClasses: [],
  39208. messageSends: []
  39209. }),
  39210. $globals.IRInstruction);
  39211. $core.addMethod(
  39212. $core.method({
  39213. selector: "isSend",
  39214. protocol: "testing",
  39215. fn: function (){
  39216. var self=this,$self=this;
  39217. return false;
  39218. },
  39219. args: [],
  39220. source: "isSend\x0a\x09^ false",
  39221. referencedClasses: [],
  39222. messageSends: []
  39223. }),
  39224. $globals.IRInstruction);
  39225. $core.addMethod(
  39226. $core.method({
  39227. selector: "isSequence",
  39228. protocol: "testing",
  39229. fn: function (){
  39230. var self=this,$self=this;
  39231. return false;
  39232. },
  39233. args: [],
  39234. source: "isSequence\x0a\x09^ false",
  39235. referencedClasses: [],
  39236. messageSends: []
  39237. }),
  39238. $globals.IRInstruction);
  39239. $core.addMethod(
  39240. $core.method({
  39241. selector: "isSuper",
  39242. protocol: "testing",
  39243. fn: function (){
  39244. var self=this,$self=this;
  39245. return false;
  39246. },
  39247. args: [],
  39248. source: "isSuper\x0a\x09^ false",
  39249. referencedClasses: [],
  39250. messageSends: []
  39251. }),
  39252. $globals.IRInstruction);
  39253. $core.addMethod(
  39254. $core.method({
  39255. selector: "isTempDeclaration",
  39256. protocol: "testing",
  39257. fn: function (){
  39258. var self=this,$self=this;
  39259. return false;
  39260. },
  39261. args: [],
  39262. source: "isTempDeclaration\x0a\x09^ false",
  39263. referencedClasses: [],
  39264. messageSends: []
  39265. }),
  39266. $globals.IRInstruction);
  39267. $core.addMethod(
  39268. $core.method({
  39269. selector: "isVariable",
  39270. protocol: "testing",
  39271. fn: function (){
  39272. var self=this,$self=this;
  39273. return false;
  39274. },
  39275. args: [],
  39276. source: "isVariable\x0a\x09^ false",
  39277. referencedClasses: [],
  39278. messageSends: []
  39279. }),
  39280. $globals.IRInstruction);
  39281. $core.addMethod(
  39282. $core.method({
  39283. selector: "method",
  39284. protocol: "accessing",
  39285. fn: function (){
  39286. var self=this,$self=this;
  39287. return $core.withContext(function($ctx1) {
  39288. return $recv($self._parent())._method();
  39289. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39290. },
  39291. args: [],
  39292. source: "method\x0a\x09^ self parent method",
  39293. referencedClasses: [],
  39294. messageSends: ["method", "parent"]
  39295. }),
  39296. $globals.IRInstruction);
  39297. $core.addMethod(
  39298. $core.method({
  39299. selector: "needsBoxingAsReceiver",
  39300. protocol: "testing",
  39301. fn: function (){
  39302. var self=this,$self=this;
  39303. return true;
  39304. },
  39305. args: [],
  39306. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39307. referencedClasses: [],
  39308. messageSends: []
  39309. }),
  39310. $globals.IRInstruction);
  39311. $core.addMethod(
  39312. $core.method({
  39313. selector: "parent",
  39314. protocol: "accessing",
  39315. fn: function (){
  39316. var self=this,$self=this;
  39317. return $self["@parent"];
  39318. },
  39319. args: [],
  39320. source: "parent\x0a\x09^ parent",
  39321. referencedClasses: [],
  39322. messageSends: []
  39323. }),
  39324. $globals.IRInstruction);
  39325. $core.addMethod(
  39326. $core.method({
  39327. selector: "parent:",
  39328. protocol: "accessing",
  39329. fn: function (anIRInstruction){
  39330. var self=this,$self=this;
  39331. $self["@parent"]=anIRInstruction;
  39332. return self;
  39333. },
  39334. args: ["anIRInstruction"],
  39335. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39336. referencedClasses: [],
  39337. messageSends: []
  39338. }),
  39339. $globals.IRInstruction);
  39340. $core.addMethod(
  39341. $core.method({
  39342. selector: "remove:",
  39343. protocol: "building",
  39344. fn: function (anIRInstruction){
  39345. var self=this,$self=this;
  39346. return $core.withContext(function($ctx1) {
  39347. $recv($self._dagChildren())._remove_(anIRInstruction);
  39348. return self;
  39349. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39350. },
  39351. args: ["anIRInstruction"],
  39352. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39353. referencedClasses: [],
  39354. messageSends: ["remove:", "dagChildren"]
  39355. }),
  39356. $globals.IRInstruction);
  39357. $core.addMethod(
  39358. $core.method({
  39359. selector: "replace:with:",
  39360. protocol: "building",
  39361. fn: function (anIRInstruction,anotherIRInstruction){
  39362. var self=this,$self=this;
  39363. return $core.withContext(function($ctx1) {
  39364. var $1;
  39365. $recv(anotherIRInstruction)._parent_(self);
  39366. $1=$self._dagChildren();
  39367. $ctx1.sendIdx["dagChildren"]=1;
  39368. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39369. return self;
  39370. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39371. },
  39372. args: ["anIRInstruction", "anotherIRInstruction"],
  39373. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39374. referencedClasses: [],
  39375. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39376. }),
  39377. $globals.IRInstruction);
  39378. $core.addMethod(
  39379. $core.method({
  39380. selector: "replaceWith:",
  39381. protocol: "building",
  39382. fn: function (anIRInstruction){
  39383. var self=this,$self=this;
  39384. return $core.withContext(function($ctx1) {
  39385. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39386. return self;
  39387. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39388. },
  39389. args: ["anIRInstruction"],
  39390. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39391. referencedClasses: [],
  39392. messageSends: ["replace:with:", "parent"]
  39393. }),
  39394. $globals.IRInstruction);
  39395. $core.addMethod(
  39396. $core.method({
  39397. selector: "scope",
  39398. protocol: "accessing",
  39399. fn: function (){
  39400. var self=this,$self=this;
  39401. return $core.withContext(function($ctx1) {
  39402. var $1,$receiver;
  39403. $1=$self._parent();
  39404. if(($receiver = $1) == null || $receiver.a$nil){
  39405. return $1;
  39406. } else {
  39407. var node;
  39408. node=$receiver;
  39409. return $recv(node)._scope();
  39410. }
  39411. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39412. },
  39413. args: [],
  39414. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39415. referencedClasses: [],
  39416. messageSends: ["ifNotNil:", "parent", "scope"]
  39417. }),
  39418. $globals.IRInstruction);
  39419. $core.addMethod(
  39420. $core.method({
  39421. selector: "yieldsValue",
  39422. protocol: "testing",
  39423. fn: function (){
  39424. var self=this,$self=this;
  39425. return true;
  39426. },
  39427. args: [],
  39428. source: "yieldsValue\x0a\x09^ true",
  39429. referencedClasses: [],
  39430. messageSends: []
  39431. }),
  39432. $globals.IRInstruction);
  39433. $core.addMethod(
  39434. $core.method({
  39435. selector: "on:",
  39436. protocol: "instance creation",
  39437. fn: function (aBuilder){
  39438. var self=this,$self=this;
  39439. return $core.withContext(function($ctx1) {
  39440. var $1;
  39441. $1=$self._new();
  39442. $recv($1)._builder_(aBuilder);
  39443. return $recv($1)._yourself();
  39444. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39445. },
  39446. args: ["aBuilder"],
  39447. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39448. referencedClasses: [],
  39449. messageSends: ["builder:", "new", "yourself"]
  39450. }),
  39451. $globals.IRInstruction.a$cls);
  39452. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39453. $core.addMethod(
  39454. $core.method({
  39455. selector: "acceptDagVisitor:",
  39456. protocol: "visiting",
  39457. fn: function (aVisitor){
  39458. var self=this,$self=this;
  39459. return $core.withContext(function($ctx1) {
  39460. return $recv(aVisitor)._visitIRAssignment_(self);
  39461. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39462. },
  39463. args: ["aVisitor"],
  39464. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39465. referencedClasses: [],
  39466. messageSends: ["visitIRAssignment:"]
  39467. }),
  39468. $globals.IRAssignment);
  39469. $core.addMethod(
  39470. $core.method({
  39471. selector: "left",
  39472. protocol: "accessing",
  39473. fn: function (){
  39474. var self=this,$self=this;
  39475. return $core.withContext(function($ctx1) {
  39476. return $recv($self._dagChildren())._first();
  39477. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39478. },
  39479. args: [],
  39480. source: "left\x0a\x09^ self dagChildren first",
  39481. referencedClasses: [],
  39482. messageSends: ["first", "dagChildren"]
  39483. }),
  39484. $globals.IRAssignment);
  39485. $core.addMethod(
  39486. $core.method({
  39487. selector: "right",
  39488. protocol: "accessing",
  39489. fn: function (){
  39490. var self=this,$self=this;
  39491. return $core.withContext(function($ctx1) {
  39492. return $recv($self._dagChildren())._last();
  39493. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39494. },
  39495. args: [],
  39496. source: "right\x0a\x09^ self dagChildren last",
  39497. referencedClasses: [],
  39498. messageSends: ["last", "dagChildren"]
  39499. }),
  39500. $globals.IRAssignment);
  39501. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39502. $core.addMethod(
  39503. $core.method({
  39504. selector: "acceptDagVisitor:",
  39505. protocol: "visiting",
  39506. fn: function (aVisitor){
  39507. var self=this,$self=this;
  39508. return $core.withContext(function($ctx1) {
  39509. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39510. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39511. },
  39512. args: ["aVisitor"],
  39513. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39514. referencedClasses: [],
  39515. messageSends: ["visitIRDynamicArray:"]
  39516. }),
  39517. $globals.IRDynamicArray);
  39518. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39519. $core.addMethod(
  39520. $core.method({
  39521. selector: "acceptDagVisitor:",
  39522. protocol: "visiting",
  39523. fn: function (aVisitor){
  39524. var self=this,$self=this;
  39525. return $core.withContext(function($ctx1) {
  39526. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39527. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39528. },
  39529. args: ["aVisitor"],
  39530. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39531. referencedClasses: [],
  39532. messageSends: ["visitIRDynamicDictionary:"]
  39533. }),
  39534. $globals.IRDynamicDictionary);
  39535. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39536. $core.addMethod(
  39537. $core.method({
  39538. selector: "scope",
  39539. protocol: "accessing",
  39540. fn: function (){
  39541. var self=this,$self=this;
  39542. return $self["@scope"];
  39543. },
  39544. args: [],
  39545. source: "scope\x0a\x09^ scope",
  39546. referencedClasses: [],
  39547. messageSends: []
  39548. }),
  39549. $globals.IRScopedInstruction);
  39550. $core.addMethod(
  39551. $core.method({
  39552. selector: "scope:",
  39553. protocol: "accessing",
  39554. fn: function (aScope){
  39555. var self=this,$self=this;
  39556. $self["@scope"]=aScope;
  39557. return self;
  39558. },
  39559. args: ["aScope"],
  39560. source: "scope: aScope\x0a\x09scope := aScope",
  39561. referencedClasses: [],
  39562. messageSends: []
  39563. }),
  39564. $globals.IRScopedInstruction);
  39565. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39566. $core.addMethod(
  39567. $core.method({
  39568. selector: "arguments",
  39569. protocol: "accessing",
  39570. fn: function (){
  39571. var self=this,$self=this;
  39572. return $core.withContext(function($ctx1) {
  39573. var $1,$receiver;
  39574. $1=$self["@arguments"];
  39575. if(($receiver = $1) == null || $receiver.a$nil){
  39576. return [];
  39577. } else {
  39578. return $1;
  39579. }
  39580. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39581. },
  39582. args: [],
  39583. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39584. referencedClasses: [],
  39585. messageSends: ["ifNil:"]
  39586. }),
  39587. $globals.IRClosureInstruction);
  39588. $core.addMethod(
  39589. $core.method({
  39590. selector: "arguments:",
  39591. protocol: "accessing",
  39592. fn: function (aCollection){
  39593. var self=this,$self=this;
  39594. $self["@arguments"]=aCollection;
  39595. return self;
  39596. },
  39597. args: ["aCollection"],
  39598. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39599. referencedClasses: [],
  39600. messageSends: []
  39601. }),
  39602. $globals.IRClosureInstruction);
  39603. $core.addMethod(
  39604. $core.method({
  39605. selector: "locals",
  39606. protocol: "accessing",
  39607. fn: function (){
  39608. var self=this,$self=this;
  39609. return $core.withContext(function($ctx1) {
  39610. var $1;
  39611. $1=$recv($self._arguments())._copy();
  39612. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39613. return $core.withContext(function($ctx2) {
  39614. return $recv(each)._name();
  39615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39616. })));
  39617. return $recv($1)._yourself();
  39618. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  39619. },
  39620. args: [],
  39621. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  39622. referencedClasses: [],
  39623. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  39624. }),
  39625. $globals.IRClosureInstruction);
  39626. $core.addMethod(
  39627. $core.method({
  39628. selector: "requiresSmalltalkContext",
  39629. protocol: "accessing",
  39630. fn: function (){
  39631. var self=this,$self=this;
  39632. return $core.withContext(function($ctx1) {
  39633. var $1,$receiver;
  39634. $1=$self["@requiresSmalltalkContext"];
  39635. if(($receiver = $1) == null || $receiver.a$nil){
  39636. return false;
  39637. } else {
  39638. return $1;
  39639. }
  39640. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  39641. },
  39642. args: [],
  39643. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  39644. referencedClasses: [],
  39645. messageSends: ["ifNil:"]
  39646. }),
  39647. $globals.IRClosureInstruction);
  39648. $core.addMethod(
  39649. $core.method({
  39650. selector: "requiresSmalltalkContext:",
  39651. protocol: "accessing",
  39652. fn: function (anObject){
  39653. var self=this,$self=this;
  39654. $self["@requiresSmalltalkContext"]=anObject;
  39655. return self;
  39656. },
  39657. args: ["anObject"],
  39658. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  39659. referencedClasses: [],
  39660. messageSends: []
  39661. }),
  39662. $globals.IRClosureInstruction);
  39663. $core.addMethod(
  39664. $core.method({
  39665. selector: "scope:",
  39666. protocol: "accessing",
  39667. fn: function (aScope){
  39668. var self=this,$self=this;
  39669. return $core.withContext(function($ctx1) {
  39670. (
  39671. $ctx1.supercall = true,
  39672. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  39673. $ctx1.supercall = false;
  39674. $recv(aScope)._instruction_(self);
  39675. return self;
  39676. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  39677. },
  39678. args: ["aScope"],
  39679. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  39680. referencedClasses: [],
  39681. messageSends: ["scope:", "instruction:"]
  39682. }),
  39683. $globals.IRClosureInstruction);
  39684. $core.addMethod(
  39685. $core.method({
  39686. selector: "tempDeclarations",
  39687. protocol: "accessing",
  39688. fn: function (){
  39689. var self=this,$self=this;
  39690. return $core.withContext(function($ctx1) {
  39691. return $recv($self._dagChildren())._select_((function(each){
  39692. return $core.withContext(function($ctx2) {
  39693. return $recv(each)._isTempDeclaration();
  39694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39695. }));
  39696. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  39697. },
  39698. args: [],
  39699. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  39700. referencedClasses: [],
  39701. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  39702. }),
  39703. $globals.IRClosureInstruction);
  39704. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  39705. $core.addMethod(
  39706. $core.method({
  39707. selector: "acceptDagVisitor:",
  39708. protocol: "visiting",
  39709. fn: function (aVisitor){
  39710. var self=this,$self=this;
  39711. return $core.withContext(function($ctx1) {
  39712. return $recv(aVisitor)._visitIRClosure_(self);
  39713. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  39714. },
  39715. args: ["aVisitor"],
  39716. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  39717. referencedClasses: [],
  39718. messageSends: ["visitIRClosure:"]
  39719. }),
  39720. $globals.IRClosure);
  39721. $core.addMethod(
  39722. $core.method({
  39723. selector: "isClosure",
  39724. protocol: "testing",
  39725. fn: function (){
  39726. var self=this,$self=this;
  39727. return true;
  39728. },
  39729. args: [],
  39730. source: "isClosure\x0a\x09^ true",
  39731. referencedClasses: [],
  39732. messageSends: []
  39733. }),
  39734. $globals.IRClosure);
  39735. $core.addMethod(
  39736. $core.method({
  39737. selector: "sequence",
  39738. protocol: "accessing",
  39739. fn: function (){
  39740. var self=this,$self=this;
  39741. return $core.withContext(function($ctx1) {
  39742. return $recv($self._dagChildren())._last();
  39743. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  39744. },
  39745. args: [],
  39746. source: "sequence\x0a\x09^ self dagChildren last",
  39747. referencedClasses: [],
  39748. messageSends: ["last", "dagChildren"]
  39749. }),
  39750. $globals.IRClosure);
  39751. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  39752. $globals.IRMethod.comment="I am a method instruction";
  39753. $core.addMethod(
  39754. $core.method({
  39755. selector: "acceptDagVisitor:",
  39756. protocol: "visiting",
  39757. fn: function (aVisitor){
  39758. var self=this,$self=this;
  39759. return $core.withContext(function($ctx1) {
  39760. return $recv(aVisitor)._visitIRMethod_(self);
  39761. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  39762. },
  39763. args: ["aVisitor"],
  39764. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  39765. referencedClasses: [],
  39766. messageSends: ["visitIRMethod:"]
  39767. }),
  39768. $globals.IRMethod);
  39769. $core.addMethod(
  39770. $core.method({
  39771. selector: "classReferences",
  39772. protocol: "accessing",
  39773. fn: function (){
  39774. var self=this,$self=this;
  39775. return $self["@classReferences"];
  39776. },
  39777. args: [],
  39778. source: "classReferences\x0a\x09^ classReferences",
  39779. referencedClasses: [],
  39780. messageSends: []
  39781. }),
  39782. $globals.IRMethod);
  39783. $core.addMethod(
  39784. $core.method({
  39785. selector: "classReferences:",
  39786. protocol: "accessing",
  39787. fn: function (aCollection){
  39788. var self=this,$self=this;
  39789. $self["@classReferences"]=aCollection;
  39790. return self;
  39791. },
  39792. args: ["aCollection"],
  39793. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  39794. referencedClasses: [],
  39795. messageSends: []
  39796. }),
  39797. $globals.IRMethod);
  39798. $core.addMethod(
  39799. $core.method({
  39800. selector: "internalVariables",
  39801. protocol: "accessing",
  39802. fn: function (){
  39803. var self=this,$self=this;
  39804. return $core.withContext(function($ctx1) {
  39805. var $1,$receiver;
  39806. $1=$self["@internalVariables"];
  39807. if(($receiver = $1) == null || $receiver.a$nil){
  39808. $self["@internalVariables"]=$recv($globals.Set)._new();
  39809. return $self["@internalVariables"];
  39810. } else {
  39811. return $1;
  39812. }
  39813. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  39814. },
  39815. args: [],
  39816. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  39817. referencedClasses: ["Set"],
  39818. messageSends: ["ifNil:", "new"]
  39819. }),
  39820. $globals.IRMethod);
  39821. $core.addMethod(
  39822. $core.method({
  39823. selector: "isMethod",
  39824. protocol: "testing",
  39825. fn: function (){
  39826. var self=this,$self=this;
  39827. return true;
  39828. },
  39829. args: [],
  39830. source: "isMethod\x0a\x09^ true",
  39831. referencedClasses: [],
  39832. messageSends: []
  39833. }),
  39834. $globals.IRMethod);
  39835. $core.addMethod(
  39836. $core.method({
  39837. selector: "messageSends",
  39838. protocol: "accessing",
  39839. fn: function (){
  39840. var self=this,$self=this;
  39841. return $core.withContext(function($ctx1) {
  39842. return $recv($self._sendIndexes())._keys();
  39843. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  39844. },
  39845. args: [],
  39846. source: "messageSends\x0a\x09^ self sendIndexes keys",
  39847. referencedClasses: [],
  39848. messageSends: ["keys", "sendIndexes"]
  39849. }),
  39850. $globals.IRMethod);
  39851. $core.addMethod(
  39852. $core.method({
  39853. selector: "method",
  39854. protocol: "accessing",
  39855. fn: function (){
  39856. var self=this,$self=this;
  39857. return self;
  39858. },
  39859. args: [],
  39860. source: "method\x0a\x09^ self",
  39861. referencedClasses: [],
  39862. messageSends: []
  39863. }),
  39864. $globals.IRMethod);
  39865. $core.addMethod(
  39866. $core.method({
  39867. selector: "selector",
  39868. protocol: "accessing",
  39869. fn: function (){
  39870. var self=this,$self=this;
  39871. return $self["@selector"];
  39872. },
  39873. args: [],
  39874. source: "selector\x0a\x09^ selector",
  39875. referencedClasses: [],
  39876. messageSends: []
  39877. }),
  39878. $globals.IRMethod);
  39879. $core.addMethod(
  39880. $core.method({
  39881. selector: "selector:",
  39882. protocol: "accessing",
  39883. fn: function (aString){
  39884. var self=this,$self=this;
  39885. $self["@selector"]=aString;
  39886. return self;
  39887. },
  39888. args: ["aString"],
  39889. source: "selector: aString\x0a\x09selector := aString",
  39890. referencedClasses: [],
  39891. messageSends: []
  39892. }),
  39893. $globals.IRMethod);
  39894. $core.addMethod(
  39895. $core.method({
  39896. selector: "sendIndexes",
  39897. protocol: "accessing",
  39898. fn: function (){
  39899. var self=this,$self=this;
  39900. return $self["@sendIndexes"];
  39901. },
  39902. args: [],
  39903. source: "sendIndexes\x0a\x09^ sendIndexes",
  39904. referencedClasses: [],
  39905. messageSends: []
  39906. }),
  39907. $globals.IRMethod);
  39908. $core.addMethod(
  39909. $core.method({
  39910. selector: "sendIndexes:",
  39911. protocol: "accessing",
  39912. fn: function (aDictionary){
  39913. var self=this,$self=this;
  39914. $self["@sendIndexes"]=aDictionary;
  39915. return self;
  39916. },
  39917. args: ["aDictionary"],
  39918. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  39919. referencedClasses: [],
  39920. messageSends: []
  39921. }),
  39922. $globals.IRMethod);
  39923. $core.addMethod(
  39924. $core.method({
  39925. selector: "source",
  39926. protocol: "accessing",
  39927. fn: function (){
  39928. var self=this,$self=this;
  39929. return $self["@source"];
  39930. },
  39931. args: [],
  39932. source: "source\x0a\x09^ source",
  39933. referencedClasses: [],
  39934. messageSends: []
  39935. }),
  39936. $globals.IRMethod);
  39937. $core.addMethod(
  39938. $core.method({
  39939. selector: "source:",
  39940. protocol: "accessing",
  39941. fn: function (aString){
  39942. var self=this,$self=this;
  39943. $self["@source"]=aString;
  39944. return self;
  39945. },
  39946. args: ["aString"],
  39947. source: "source: aString\x0a\x09source := aString",
  39948. referencedClasses: [],
  39949. messageSends: []
  39950. }),
  39951. $globals.IRMethod);
  39952. $core.addMethod(
  39953. $core.method({
  39954. selector: "theClass",
  39955. protocol: "accessing",
  39956. fn: function (){
  39957. var self=this,$self=this;
  39958. return $self["@theClass"];
  39959. },
  39960. args: [],
  39961. source: "theClass\x0a\x09^ theClass",
  39962. referencedClasses: [],
  39963. messageSends: []
  39964. }),
  39965. $globals.IRMethod);
  39966. $core.addMethod(
  39967. $core.method({
  39968. selector: "theClass:",
  39969. protocol: "accessing",
  39970. fn: function (aClass){
  39971. var self=this,$self=this;
  39972. $self["@theClass"]=aClass;
  39973. return self;
  39974. },
  39975. args: ["aClass"],
  39976. source: "theClass: aClass\x0a\x09theClass := aClass",
  39977. referencedClasses: [],
  39978. messageSends: []
  39979. }),
  39980. $globals.IRMethod);
  39981. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  39982. $globals.IRReturn.comment="I am a local return instruction.";
  39983. $core.addMethod(
  39984. $core.method({
  39985. selector: "acceptDagVisitor:",
  39986. protocol: "visiting",
  39987. fn: function (aVisitor){
  39988. var self=this,$self=this;
  39989. return $core.withContext(function($ctx1) {
  39990. return $recv(aVisitor)._visitIRReturn_(self);
  39991. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  39992. },
  39993. args: ["aVisitor"],
  39994. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  39995. referencedClasses: [],
  39996. messageSends: ["visitIRReturn:"]
  39997. }),
  39998. $globals.IRReturn);
  39999. $core.addMethod(
  40000. $core.method({
  40001. selector: "expression",
  40002. protocol: "accessing",
  40003. fn: function (){
  40004. var self=this,$self=this;
  40005. return $core.withContext(function($ctx1) {
  40006. return $recv($self._dagChildren())._single();
  40007. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40008. },
  40009. args: [],
  40010. source: "expression\x0a\x09^ self dagChildren single",
  40011. referencedClasses: [],
  40012. messageSends: ["single", "dagChildren"]
  40013. }),
  40014. $globals.IRReturn);
  40015. $core.addMethod(
  40016. $core.method({
  40017. selector: "scope",
  40018. protocol: "accessing",
  40019. fn: function (){
  40020. var self=this,$self=this;
  40021. return $core.withContext(function($ctx1) {
  40022. var $1,$receiver;
  40023. $1=$self["@scope"];
  40024. if(($receiver = $1) == null || $receiver.a$nil){
  40025. return $recv($self._parent())._scope();
  40026. } else {
  40027. return $1;
  40028. }
  40029. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40030. },
  40031. args: [],
  40032. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40033. referencedClasses: [],
  40034. messageSends: ["ifNil:", "scope", "parent"]
  40035. }),
  40036. $globals.IRReturn);
  40037. $core.addMethod(
  40038. $core.method({
  40039. selector: "yieldsValue",
  40040. protocol: "testing",
  40041. fn: function (){
  40042. var self=this,$self=this;
  40043. return false;
  40044. },
  40045. args: [],
  40046. source: "yieldsValue\x0a\x09^ false",
  40047. referencedClasses: [],
  40048. messageSends: []
  40049. }),
  40050. $globals.IRReturn);
  40051. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40052. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40053. $core.addMethod(
  40054. $core.method({
  40055. selector: "acceptDagVisitor:",
  40056. protocol: "visiting",
  40057. fn: function (aVisitor){
  40058. var self=this,$self=this;
  40059. return $core.withContext(function($ctx1) {
  40060. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40061. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40062. },
  40063. args: ["aVisitor"],
  40064. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40065. referencedClasses: [],
  40066. messageSends: ["visitIRBlockReturn:"]
  40067. }),
  40068. $globals.IRBlockReturn);
  40069. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40070. $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.";
  40071. $core.addMethod(
  40072. $core.method({
  40073. selector: "acceptDagVisitor:",
  40074. protocol: "visiting",
  40075. fn: function (aVisitor){
  40076. var self=this,$self=this;
  40077. return $core.withContext(function($ctx1) {
  40078. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40079. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40080. },
  40081. args: ["aVisitor"],
  40082. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40083. referencedClasses: [],
  40084. messageSends: ["visitIRNonLocalReturn:"]
  40085. }),
  40086. $globals.IRNonLocalReturn);
  40087. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40088. $core.addMethod(
  40089. $core.method({
  40090. selector: "acceptDagVisitor:",
  40091. protocol: "visiting",
  40092. fn: function (aVisitor){
  40093. var self=this,$self=this;
  40094. return $core.withContext(function($ctx1) {
  40095. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40096. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40097. },
  40098. args: ["aVisitor"],
  40099. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40100. referencedClasses: [],
  40101. messageSends: ["visitIRTempDeclaration:"]
  40102. }),
  40103. $globals.IRTempDeclaration);
  40104. $core.addMethod(
  40105. $core.method({
  40106. selector: "isTempDeclaration",
  40107. protocol: "testing",
  40108. fn: function (){
  40109. var self=this,$self=this;
  40110. return true;
  40111. },
  40112. args: [],
  40113. source: "isTempDeclaration\x0a\x09^ true",
  40114. referencedClasses: [],
  40115. messageSends: []
  40116. }),
  40117. $globals.IRTempDeclaration);
  40118. $core.addMethod(
  40119. $core.method({
  40120. selector: "name",
  40121. protocol: "accessing",
  40122. fn: function (){
  40123. var self=this,$self=this;
  40124. return $self["@name"];
  40125. },
  40126. args: [],
  40127. source: "name\x0a\x09^ name",
  40128. referencedClasses: [],
  40129. messageSends: []
  40130. }),
  40131. $globals.IRTempDeclaration);
  40132. $core.addMethod(
  40133. $core.method({
  40134. selector: "name:",
  40135. protocol: "accessing",
  40136. fn: function (aString){
  40137. var self=this,$self=this;
  40138. $self["@name"]=aString;
  40139. return self;
  40140. },
  40141. args: ["aString"],
  40142. source: "name: aString\x0a\x09name := aString",
  40143. referencedClasses: [],
  40144. messageSends: []
  40145. }),
  40146. $globals.IRTempDeclaration);
  40147. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40148. $globals.IRSend.comment="I am a message send instruction.";
  40149. $core.addMethod(
  40150. $core.method({
  40151. selector: "acceptDagVisitor:",
  40152. protocol: "visiting",
  40153. fn: function (aVisitor){
  40154. var self=this,$self=this;
  40155. return $core.withContext(function($ctx1) {
  40156. return $recv(aVisitor)._visitIRSend_(self);
  40157. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40158. },
  40159. args: ["aVisitor"],
  40160. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40161. referencedClasses: [],
  40162. messageSends: ["visitIRSend:"]
  40163. }),
  40164. $globals.IRSend);
  40165. $core.addMethod(
  40166. $core.method({
  40167. selector: "arguments",
  40168. protocol: "accessing",
  40169. fn: function (){
  40170. var self=this,$self=this;
  40171. return $core.withContext(function($ctx1) {
  40172. return $recv($self._dagChildren())._allButFirst();
  40173. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40174. },
  40175. args: [],
  40176. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40177. referencedClasses: [],
  40178. messageSends: ["allButFirst", "dagChildren"]
  40179. }),
  40180. $globals.IRSend);
  40181. $core.addMethod(
  40182. $core.method({
  40183. selector: "index",
  40184. protocol: "accessing",
  40185. fn: function (){
  40186. var self=this,$self=this;
  40187. return $self["@index"];
  40188. },
  40189. args: [],
  40190. source: "index\x0a\x09^ index",
  40191. referencedClasses: [],
  40192. messageSends: []
  40193. }),
  40194. $globals.IRSend);
  40195. $core.addMethod(
  40196. $core.method({
  40197. selector: "index:",
  40198. protocol: "accessing",
  40199. fn: function (anInteger){
  40200. var self=this,$self=this;
  40201. $self["@index"]=anInteger;
  40202. return self;
  40203. },
  40204. args: ["anInteger"],
  40205. source: "index: anInteger\x0a\x09index := anInteger",
  40206. referencedClasses: [],
  40207. messageSends: []
  40208. }),
  40209. $globals.IRSend);
  40210. $core.addMethod(
  40211. $core.method({
  40212. selector: "isSend",
  40213. protocol: "testing",
  40214. fn: function (){
  40215. var self=this,$self=this;
  40216. return true;
  40217. },
  40218. args: [],
  40219. source: "isSend\x0a\x09^ true",
  40220. referencedClasses: [],
  40221. messageSends: []
  40222. }),
  40223. $globals.IRSend);
  40224. $core.addMethod(
  40225. $core.method({
  40226. selector: "receiver",
  40227. protocol: "accessing",
  40228. fn: function (){
  40229. var self=this,$self=this;
  40230. return $core.withContext(function($ctx1) {
  40231. return $recv($self._dagChildren())._first();
  40232. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40233. },
  40234. args: [],
  40235. source: "receiver\x0a\x09^ self dagChildren first",
  40236. referencedClasses: [],
  40237. messageSends: ["first", "dagChildren"]
  40238. }),
  40239. $globals.IRSend);
  40240. $core.addMethod(
  40241. $core.method({
  40242. selector: "selector",
  40243. protocol: "accessing",
  40244. fn: function (){
  40245. var self=this,$self=this;
  40246. return $self["@selector"];
  40247. },
  40248. args: [],
  40249. source: "selector\x0a\x09^ selector",
  40250. referencedClasses: [],
  40251. messageSends: []
  40252. }),
  40253. $globals.IRSend);
  40254. $core.addMethod(
  40255. $core.method({
  40256. selector: "selector:",
  40257. protocol: "accessing",
  40258. fn: function (aString){
  40259. var self=this,$self=this;
  40260. $self["@selector"]=aString;
  40261. return self;
  40262. },
  40263. args: ["aString"],
  40264. source: "selector: aString\x0a\x09selector := aString",
  40265. referencedClasses: [],
  40266. messageSends: []
  40267. }),
  40268. $globals.IRSend);
  40269. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40270. $core.addMethod(
  40271. $core.method({
  40272. selector: "acceptDagVisitor:",
  40273. protocol: "visiting",
  40274. fn: function (aVisitor){
  40275. var self=this,$self=this;
  40276. return $core.withContext(function($ctx1) {
  40277. return $recv(aVisitor)._visitIRSequence_(self);
  40278. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40279. },
  40280. args: ["aVisitor"],
  40281. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40282. referencedClasses: [],
  40283. messageSends: ["visitIRSequence:"]
  40284. }),
  40285. $globals.IRSequence);
  40286. $core.addMethod(
  40287. $core.method({
  40288. selector: "isSequence",
  40289. protocol: "testing",
  40290. fn: function (){
  40291. var self=this,$self=this;
  40292. return true;
  40293. },
  40294. args: [],
  40295. source: "isSequence\x0a\x09^ true",
  40296. referencedClasses: [],
  40297. messageSends: []
  40298. }),
  40299. $globals.IRSequence);
  40300. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40301. $core.addMethod(
  40302. $core.method({
  40303. selector: "acceptDagVisitor:",
  40304. protocol: "visiting",
  40305. fn: function (aVisitor){
  40306. var self=this,$self=this;
  40307. return $core.withContext(function($ctx1) {
  40308. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40309. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40310. },
  40311. args: ["aVisitor"],
  40312. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40313. referencedClasses: [],
  40314. messageSends: ["visitIRBlockSequence:"]
  40315. }),
  40316. $globals.IRBlockSequence);
  40317. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40318. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40319. $core.addMethod(
  40320. $core.method({
  40321. selector: "acceptDagVisitor:",
  40322. protocol: "visiting",
  40323. fn: function (aVisitor){
  40324. var self=this,$self=this;
  40325. return $core.withContext(function($ctx1) {
  40326. return $recv(aVisitor)._visitIRValue_(self);
  40327. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40328. },
  40329. args: ["aVisitor"],
  40330. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40331. referencedClasses: [],
  40332. messageSends: ["visitIRValue:"]
  40333. }),
  40334. $globals.IRValue);
  40335. $core.addMethod(
  40336. $core.method({
  40337. selector: "needsBoxingAsReceiver",
  40338. protocol: "testing",
  40339. fn: function (){
  40340. var self=this,$self=this;
  40341. return false;
  40342. },
  40343. args: [],
  40344. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40345. referencedClasses: [],
  40346. messageSends: []
  40347. }),
  40348. $globals.IRValue);
  40349. $core.addMethod(
  40350. $core.method({
  40351. selector: "value",
  40352. protocol: "accessing",
  40353. fn: function (){
  40354. var self=this,$self=this;
  40355. return $self["@value"];
  40356. },
  40357. args: [],
  40358. source: "value\x0a\x09^ value",
  40359. referencedClasses: [],
  40360. messageSends: []
  40361. }),
  40362. $globals.IRValue);
  40363. $core.addMethod(
  40364. $core.method({
  40365. selector: "value:",
  40366. protocol: "accessing",
  40367. fn: function (aString){
  40368. var self=this,$self=this;
  40369. $self["@value"]=aString;
  40370. return self;
  40371. },
  40372. args: ["aString"],
  40373. source: "value: aString\x0a\x09value := aString",
  40374. referencedClasses: [],
  40375. messageSends: []
  40376. }),
  40377. $globals.IRValue);
  40378. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40379. $globals.IRVariable.comment="I am a variable instruction.";
  40380. $core.addMethod(
  40381. $core.method({
  40382. selector: "acceptDagVisitor:",
  40383. protocol: "visiting",
  40384. fn: function (aVisitor){
  40385. var self=this,$self=this;
  40386. return $core.withContext(function($ctx1) {
  40387. return $recv(aVisitor)._visitIRVariable_(self);
  40388. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40389. },
  40390. args: ["aVisitor"],
  40391. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40392. referencedClasses: [],
  40393. messageSends: ["visitIRVariable:"]
  40394. }),
  40395. $globals.IRVariable);
  40396. $core.addMethod(
  40397. $core.method({
  40398. selector: "isSelf",
  40399. protocol: "testing",
  40400. fn: function (){
  40401. var self=this,$self=this;
  40402. return $core.withContext(function($ctx1) {
  40403. return $recv($self._variable())._isSelf();
  40404. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40405. },
  40406. args: [],
  40407. source: "isSelf\x0a\x09^ self variable isSelf",
  40408. referencedClasses: [],
  40409. messageSends: ["isSelf", "variable"]
  40410. }),
  40411. $globals.IRVariable);
  40412. $core.addMethod(
  40413. $core.method({
  40414. selector: "isSuper",
  40415. protocol: "testing",
  40416. fn: function (){
  40417. var self=this,$self=this;
  40418. return $core.withContext(function($ctx1) {
  40419. return $recv($self._variable())._isSuper();
  40420. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40421. },
  40422. args: [],
  40423. source: "isSuper\x0a\x09^ self variable isSuper",
  40424. referencedClasses: [],
  40425. messageSends: ["isSuper", "variable"]
  40426. }),
  40427. $globals.IRVariable);
  40428. $core.addMethod(
  40429. $core.method({
  40430. selector: "isVariable",
  40431. protocol: "testing",
  40432. fn: function (){
  40433. var self=this,$self=this;
  40434. return true;
  40435. },
  40436. args: [],
  40437. source: "isVariable\x0a\x09^ true",
  40438. referencedClasses: [],
  40439. messageSends: []
  40440. }),
  40441. $globals.IRVariable);
  40442. $core.addMethod(
  40443. $core.method({
  40444. selector: "needsBoxingAsReceiver",
  40445. protocol: "testing",
  40446. fn: function (){
  40447. var self=this,$self=this;
  40448. return $core.withContext(function($ctx1) {
  40449. return $recv($recv($self._variable())._isPseudoVar())._not();
  40450. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40451. },
  40452. args: [],
  40453. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40454. referencedClasses: [],
  40455. messageSends: ["not", "isPseudoVar", "variable"]
  40456. }),
  40457. $globals.IRVariable);
  40458. $core.addMethod(
  40459. $core.method({
  40460. selector: "variable",
  40461. protocol: "accessing",
  40462. fn: function (){
  40463. var self=this,$self=this;
  40464. return $self["@variable"];
  40465. },
  40466. args: [],
  40467. source: "variable\x0a\x09^ variable",
  40468. referencedClasses: [],
  40469. messageSends: []
  40470. }),
  40471. $globals.IRVariable);
  40472. $core.addMethod(
  40473. $core.method({
  40474. selector: "variable:",
  40475. protocol: "accessing",
  40476. fn: function (aScopeVariable){
  40477. var self=this,$self=this;
  40478. $self["@variable"]=aScopeVariable;
  40479. return self;
  40480. },
  40481. args: ["aScopeVariable"],
  40482. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40483. referencedClasses: [],
  40484. messageSends: []
  40485. }),
  40486. $globals.IRVariable);
  40487. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40488. $core.addMethod(
  40489. $core.method({
  40490. selector: "acceptDagVisitor:",
  40491. protocol: "visiting",
  40492. fn: function (aVisitor){
  40493. var self=this,$self=this;
  40494. return $core.withContext(function($ctx1) {
  40495. return $recv(aVisitor)._visitIRVerbatim_(self);
  40496. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40497. },
  40498. args: ["aVisitor"],
  40499. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40500. referencedClasses: [],
  40501. messageSends: ["visitIRVerbatim:"]
  40502. }),
  40503. $globals.IRVerbatim);
  40504. $core.addMethod(
  40505. $core.method({
  40506. selector: "source",
  40507. protocol: "accessing",
  40508. fn: function (){
  40509. var self=this,$self=this;
  40510. return $self["@source"];
  40511. },
  40512. args: [],
  40513. source: "source\x0a\x09^ source",
  40514. referencedClasses: [],
  40515. messageSends: []
  40516. }),
  40517. $globals.IRVerbatim);
  40518. $core.addMethod(
  40519. $core.method({
  40520. selector: "source:",
  40521. protocol: "accessing",
  40522. fn: function (aString){
  40523. var self=this,$self=this;
  40524. $self["@source"]=aString;
  40525. return self;
  40526. },
  40527. args: ["aString"],
  40528. source: "source: aString\x0a\x09source := aString",
  40529. referencedClasses: [],
  40530. messageSends: []
  40531. }),
  40532. $globals.IRVerbatim);
  40533. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40534. $core.addMethod(
  40535. $core.method({
  40536. selector: "visitDagNode:",
  40537. protocol: "visiting",
  40538. fn: function (aNode){
  40539. var self=this,$self=this;
  40540. return $core.withContext(function($ctx1) {
  40541. return $self._visitDagNodeVariantSimple_(aNode);
  40542. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40543. },
  40544. args: ["aNode"],
  40545. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40546. referencedClasses: [],
  40547. messageSends: ["visitDagNodeVariantSimple:"]
  40548. }),
  40549. $globals.IRVisitor);
  40550. $core.addMethod(
  40551. $core.method({
  40552. selector: "visitIRAssignment:",
  40553. protocol: "visiting",
  40554. fn: function (anIRAssignment){
  40555. var self=this,$self=this;
  40556. return $core.withContext(function($ctx1) {
  40557. return $self._visitDagNode_(anIRAssignment);
  40558. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40559. },
  40560. args: ["anIRAssignment"],
  40561. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40562. referencedClasses: [],
  40563. messageSends: ["visitDagNode:"]
  40564. }),
  40565. $globals.IRVisitor);
  40566. $core.addMethod(
  40567. $core.method({
  40568. selector: "visitIRBlockReturn:",
  40569. protocol: "visiting",
  40570. fn: function (anIRBlockReturn){
  40571. var self=this,$self=this;
  40572. return $core.withContext(function($ctx1) {
  40573. return $self._visitIRReturn_(anIRBlockReturn);
  40574. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40575. },
  40576. args: ["anIRBlockReturn"],
  40577. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40578. referencedClasses: [],
  40579. messageSends: ["visitIRReturn:"]
  40580. }),
  40581. $globals.IRVisitor);
  40582. $core.addMethod(
  40583. $core.method({
  40584. selector: "visitIRBlockSequence:",
  40585. protocol: "visiting",
  40586. fn: function (anIRBlockSequence){
  40587. var self=this,$self=this;
  40588. return $core.withContext(function($ctx1) {
  40589. return $self._visitIRSequence_(anIRBlockSequence);
  40590. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40591. },
  40592. args: ["anIRBlockSequence"],
  40593. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40594. referencedClasses: [],
  40595. messageSends: ["visitIRSequence:"]
  40596. }),
  40597. $globals.IRVisitor);
  40598. $core.addMethod(
  40599. $core.method({
  40600. selector: "visitIRClosure:",
  40601. protocol: "visiting",
  40602. fn: function (anIRClosure){
  40603. var self=this,$self=this;
  40604. return $core.withContext(function($ctx1) {
  40605. return $self._visitDagNode_(anIRClosure);
  40606. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40607. },
  40608. args: ["anIRClosure"],
  40609. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40610. referencedClasses: [],
  40611. messageSends: ["visitDagNode:"]
  40612. }),
  40613. $globals.IRVisitor);
  40614. $core.addMethod(
  40615. $core.method({
  40616. selector: "visitIRDynamicArray:",
  40617. protocol: "visiting",
  40618. fn: function (anIRDynamicArray){
  40619. var self=this,$self=this;
  40620. return $core.withContext(function($ctx1) {
  40621. return $self._visitDagNode_(anIRDynamicArray);
  40622. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  40623. },
  40624. args: ["anIRDynamicArray"],
  40625. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  40626. referencedClasses: [],
  40627. messageSends: ["visitDagNode:"]
  40628. }),
  40629. $globals.IRVisitor);
  40630. $core.addMethod(
  40631. $core.method({
  40632. selector: "visitIRDynamicDictionary:",
  40633. protocol: "visiting",
  40634. fn: function (anIRDynamicDictionary){
  40635. var self=this,$self=this;
  40636. return $core.withContext(function($ctx1) {
  40637. return $self._visitDagNode_(anIRDynamicDictionary);
  40638. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  40639. },
  40640. args: ["anIRDynamicDictionary"],
  40641. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  40642. referencedClasses: [],
  40643. messageSends: ["visitDagNode:"]
  40644. }),
  40645. $globals.IRVisitor);
  40646. $core.addMethod(
  40647. $core.method({
  40648. selector: "visitIRInlinedClosure:",
  40649. protocol: "visiting",
  40650. fn: function (anIRInlinedClosure){
  40651. var self=this,$self=this;
  40652. return $core.withContext(function($ctx1) {
  40653. return $self._visitIRClosure_(anIRInlinedClosure);
  40654. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  40655. },
  40656. args: ["anIRInlinedClosure"],
  40657. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  40658. referencedClasses: [],
  40659. messageSends: ["visitIRClosure:"]
  40660. }),
  40661. $globals.IRVisitor);
  40662. $core.addMethod(
  40663. $core.method({
  40664. selector: "visitIRInlinedSequence:",
  40665. protocol: "visiting",
  40666. fn: function (anIRInlinedSequence){
  40667. var self=this,$self=this;
  40668. return $core.withContext(function($ctx1) {
  40669. return $self._visitIRSequence_(anIRInlinedSequence);
  40670. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  40671. },
  40672. args: ["anIRInlinedSequence"],
  40673. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  40674. referencedClasses: [],
  40675. messageSends: ["visitIRSequence:"]
  40676. }),
  40677. $globals.IRVisitor);
  40678. $core.addMethod(
  40679. $core.method({
  40680. selector: "visitIRMethod:",
  40681. protocol: "visiting",
  40682. fn: function (anIRMethod){
  40683. var self=this,$self=this;
  40684. return $core.withContext(function($ctx1) {
  40685. return $self._visitDagNode_(anIRMethod);
  40686. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  40687. },
  40688. args: ["anIRMethod"],
  40689. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  40690. referencedClasses: [],
  40691. messageSends: ["visitDagNode:"]
  40692. }),
  40693. $globals.IRVisitor);
  40694. $core.addMethod(
  40695. $core.method({
  40696. selector: "visitIRNonLocalReturn:",
  40697. protocol: "visiting",
  40698. fn: function (anIRNonLocalReturn){
  40699. var self=this,$self=this;
  40700. return $core.withContext(function($ctx1) {
  40701. return $self._visitDagNode_(anIRNonLocalReturn);
  40702. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  40703. },
  40704. args: ["anIRNonLocalReturn"],
  40705. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  40706. referencedClasses: [],
  40707. messageSends: ["visitDagNode:"]
  40708. }),
  40709. $globals.IRVisitor);
  40710. $core.addMethod(
  40711. $core.method({
  40712. selector: "visitIRNonLocalReturnHandling:",
  40713. protocol: "visiting",
  40714. fn: function (anIRNonLocalReturnHandling){
  40715. var self=this,$self=this;
  40716. return $core.withContext(function($ctx1) {
  40717. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  40718. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  40719. },
  40720. args: ["anIRNonLocalReturnHandling"],
  40721. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  40722. referencedClasses: [],
  40723. messageSends: ["visitDagNode:"]
  40724. }),
  40725. $globals.IRVisitor);
  40726. $core.addMethod(
  40727. $core.method({
  40728. selector: "visitIRReturn:",
  40729. protocol: "visiting",
  40730. fn: function (anIRReturn){
  40731. var self=this,$self=this;
  40732. return $core.withContext(function($ctx1) {
  40733. return $self._visitDagNode_(anIRReturn);
  40734. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  40735. },
  40736. args: ["anIRReturn"],
  40737. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  40738. referencedClasses: [],
  40739. messageSends: ["visitDagNode:"]
  40740. }),
  40741. $globals.IRVisitor);
  40742. $core.addMethod(
  40743. $core.method({
  40744. selector: "visitIRSend:",
  40745. protocol: "visiting",
  40746. fn: function (anIRSend){
  40747. var self=this,$self=this;
  40748. return $core.withContext(function($ctx1) {
  40749. return $self._visitDagNode_(anIRSend);
  40750. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  40751. },
  40752. args: ["anIRSend"],
  40753. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  40754. referencedClasses: [],
  40755. messageSends: ["visitDagNode:"]
  40756. }),
  40757. $globals.IRVisitor);
  40758. $core.addMethod(
  40759. $core.method({
  40760. selector: "visitIRSequence:",
  40761. protocol: "visiting",
  40762. fn: function (anIRSequence){
  40763. var self=this,$self=this;
  40764. return $core.withContext(function($ctx1) {
  40765. return $self._visitDagNode_(anIRSequence);
  40766. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  40767. },
  40768. args: ["anIRSequence"],
  40769. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  40770. referencedClasses: [],
  40771. messageSends: ["visitDagNode:"]
  40772. }),
  40773. $globals.IRVisitor);
  40774. $core.addMethod(
  40775. $core.method({
  40776. selector: "visitIRTempDeclaration:",
  40777. protocol: "visiting",
  40778. fn: function (anIRTempDeclaration){
  40779. var self=this,$self=this;
  40780. return $core.withContext(function($ctx1) {
  40781. return $self._visitDagNode_(anIRTempDeclaration);
  40782. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  40783. },
  40784. args: ["anIRTempDeclaration"],
  40785. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  40786. referencedClasses: [],
  40787. messageSends: ["visitDagNode:"]
  40788. }),
  40789. $globals.IRVisitor);
  40790. $core.addMethod(
  40791. $core.method({
  40792. selector: "visitIRValue:",
  40793. protocol: "visiting",
  40794. fn: function (anIRValue){
  40795. var self=this,$self=this;
  40796. return $core.withContext(function($ctx1) {
  40797. return $self._visitDagNode_(anIRValue);
  40798. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  40799. },
  40800. args: ["anIRValue"],
  40801. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  40802. referencedClasses: [],
  40803. messageSends: ["visitDagNode:"]
  40804. }),
  40805. $globals.IRVisitor);
  40806. $core.addMethod(
  40807. $core.method({
  40808. selector: "visitIRVariable:",
  40809. protocol: "visiting",
  40810. fn: function (anIRVariable){
  40811. var self=this,$self=this;
  40812. return $core.withContext(function($ctx1) {
  40813. return $self._visitDagNode_(anIRVariable);
  40814. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  40815. },
  40816. args: ["anIRVariable"],
  40817. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  40818. referencedClasses: [],
  40819. messageSends: ["visitDagNode:"]
  40820. }),
  40821. $globals.IRVisitor);
  40822. $core.addMethod(
  40823. $core.method({
  40824. selector: "visitIRVerbatim:",
  40825. protocol: "visiting",
  40826. fn: function (anIRVerbatim){
  40827. var self=this,$self=this;
  40828. return $core.withContext(function($ctx1) {
  40829. return $self._visitDagNode_(anIRVerbatim);
  40830. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  40831. },
  40832. args: ["anIRVerbatim"],
  40833. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  40834. referencedClasses: [],
  40835. messageSends: ["visitDagNode:"]
  40836. }),
  40837. $globals.IRVisitor);
  40838. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  40839. $core.addMethod(
  40840. $core.method({
  40841. selector: "contents",
  40842. protocol: "accessing",
  40843. fn: function (){
  40844. var self=this,$self=this;
  40845. return $core.withContext(function($ctx1) {
  40846. return $recv($self._stream())._contents();
  40847. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  40848. },
  40849. args: [],
  40850. source: "contents\x0a\x09^ self stream contents",
  40851. referencedClasses: [],
  40852. messageSends: ["contents", "stream"]
  40853. }),
  40854. $globals.IRJSTranslator);
  40855. $core.addMethod(
  40856. $core.method({
  40857. selector: "currentClass",
  40858. protocol: "accessing",
  40859. fn: function (){
  40860. var self=this,$self=this;
  40861. return $self["@currentClass"];
  40862. },
  40863. args: [],
  40864. source: "currentClass\x0a\x09^ currentClass",
  40865. referencedClasses: [],
  40866. messageSends: []
  40867. }),
  40868. $globals.IRJSTranslator);
  40869. $core.addMethod(
  40870. $core.method({
  40871. selector: "currentClass:",
  40872. protocol: "accessing",
  40873. fn: function (aClass){
  40874. var self=this,$self=this;
  40875. $self["@currentClass"]=aClass;
  40876. return self;
  40877. },
  40878. args: ["aClass"],
  40879. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  40880. referencedClasses: [],
  40881. messageSends: []
  40882. }),
  40883. $globals.IRJSTranslator);
  40884. $core.addMethod(
  40885. $core.method({
  40886. selector: "initialize",
  40887. protocol: "initialization",
  40888. fn: function (){
  40889. var self=this,$self=this;
  40890. return $core.withContext(function($ctx1) {
  40891. (
  40892. $ctx1.supercall = true,
  40893. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  40894. $ctx1.supercall = false;
  40895. $self["@stream"]=$recv($globals.JSStream)._new();
  40896. return self;
  40897. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  40898. },
  40899. args: [],
  40900. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  40901. referencedClasses: ["JSStream"],
  40902. messageSends: ["initialize", "new"]
  40903. }),
  40904. $globals.IRJSTranslator);
  40905. $core.addMethod(
  40906. $core.method({
  40907. selector: "stream",
  40908. protocol: "accessing",
  40909. fn: function (){
  40910. var self=this,$self=this;
  40911. return $self["@stream"];
  40912. },
  40913. args: [],
  40914. source: "stream\x0a\x09^ stream",
  40915. referencedClasses: [],
  40916. messageSends: []
  40917. }),
  40918. $globals.IRJSTranslator);
  40919. $core.addMethod(
  40920. $core.method({
  40921. selector: "stream:",
  40922. protocol: "accessing",
  40923. fn: function (aStream){
  40924. var self=this,$self=this;
  40925. $self["@stream"]=aStream;
  40926. return self;
  40927. },
  40928. args: ["aStream"],
  40929. source: "stream: aStream\x0a\x09stream := aStream",
  40930. referencedClasses: [],
  40931. messageSends: []
  40932. }),
  40933. $globals.IRJSTranslator);
  40934. $core.addMethod(
  40935. $core.method({
  40936. selector: "visitIRAssignment:",
  40937. protocol: "visiting",
  40938. fn: function (anIRAssignment){
  40939. var self=this,$self=this;
  40940. return $core.withContext(function($ctx1) {
  40941. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  40942. return $core.withContext(function($ctx2) {
  40943. return $self._visit_($recv(anIRAssignment)._left());
  40944. $ctx2.sendIdx["visit:"]=1;
  40945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40946. }),(function(){
  40947. return $core.withContext(function($ctx2) {
  40948. return $self._visit_($recv(anIRAssignment)._right());
  40949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40950. }));
  40951. return self;
  40952. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  40953. },
  40954. args: ["anIRAssignment"],
  40955. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  40956. referencedClasses: [],
  40957. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  40958. }),
  40959. $globals.IRJSTranslator);
  40960. $core.addMethod(
  40961. $core.method({
  40962. selector: "visitIRClosure:",
  40963. protocol: "visiting",
  40964. fn: function (anIRClosure){
  40965. var self=this,$self=this;
  40966. return $core.withContext(function($ctx1) {
  40967. var $1,$2;
  40968. $1=$self._stream();
  40969. $ctx1.sendIdx["stream"]=1;
  40970. $recv($1)._nextPutClosureWith_arguments_((function(){
  40971. return $core.withContext(function($ctx2) {
  40972. $2=$self._stream();
  40973. $ctx2.sendIdx["stream"]=2;
  40974. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  40975. return $core.withContext(function($ctx3) {
  40976. return $recv($recv(each)._name())._asVariableName();
  40977. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40978. })));
  40979. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  40980. return $core.withContext(function($ctx3) {
  40981. return (
  40982. $ctx3.supercall = true,
  40983. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  40984. $ctx3.supercall = false;
  40985. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40986. }));
  40987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40988. }),$recv(anIRClosure)._arguments());
  40989. return self;
  40990. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  40991. },
  40992. args: ["anIRClosure"],
  40993. 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",
  40994. referencedClasses: [],
  40995. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  40996. }),
  40997. $globals.IRJSTranslator);
  40998. $core.addMethod(
  40999. $core.method({
  41000. selector: "visitIRDynamicArray:",
  41001. protocol: "visiting",
  41002. fn: function (anIRDynamicArray){
  41003. var self=this,$self=this;
  41004. return $core.withContext(function($ctx1) {
  41005. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41006. return self;
  41007. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41008. },
  41009. args: ["anIRDynamicArray"],
  41010. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41011. referencedClasses: [],
  41012. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41013. }),
  41014. $globals.IRJSTranslator);
  41015. $core.addMethod(
  41016. $core.method({
  41017. selector: "visitIRDynamicDictionary:",
  41018. protocol: "visiting",
  41019. fn: function (anIRDynamicDictionary){
  41020. var self=this,$self=this;
  41021. return $core.withContext(function($ctx1) {
  41022. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41023. return self;
  41024. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41025. },
  41026. args: ["anIRDynamicDictionary"],
  41027. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41028. referencedClasses: [],
  41029. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41030. }),
  41031. $globals.IRJSTranslator);
  41032. $core.addMethod(
  41033. $core.method({
  41034. selector: "visitIRMethod:",
  41035. protocol: "visiting",
  41036. fn: function (anIRMethod){
  41037. var self=this,$self=this;
  41038. return $core.withContext(function($ctx1) {
  41039. var $1,$2,$3,$4,$5,$6,$7;
  41040. $1=$self._stream();
  41041. $ctx1.sendIdx["stream"]=1;
  41042. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41043. return $core.withContext(function($ctx2) {
  41044. $2=$self._stream();
  41045. $ctx2.sendIdx["stream"]=2;
  41046. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41047. return $core.withContext(function($ctx3) {
  41048. $3=$self._stream();
  41049. $ctx3.sendIdx["stream"]=3;
  41050. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41051. return $core.withContext(function($ctx4) {
  41052. return $recv($recv(each)._name())._asVariableName();
  41053. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41054. }));
  41055. $ctx3.sendIdx["collect:"]=1;
  41056. $recv($3)._nextPutVars_($4);
  41057. $ctx3.sendIdx["nextPutVars:"]=1;
  41058. $5=$self._stream();
  41059. $ctx3.sendIdx["stream"]=4;
  41060. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41061. return $core.withContext(function($ctx4) {
  41062. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41063. return $core.withContext(function($ctx5) {
  41064. $6=$self._stream();
  41065. $ctx5.sendIdx["stream"]=5;
  41066. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41067. return $core.withContext(function($ctx6) {
  41068. return $recv($recv(each)._variable())._alias();
  41069. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41070. })));
  41071. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41072. }));
  41073. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41074. if($core.assert($7)){
  41075. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41076. return $core.withContext(function($ctx5) {
  41077. return (
  41078. $ctx5.supercall = true,
  41079. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41080. $ctx5.supercall = false;
  41081. $ctx5.sendIdx["visitIRMethod:"]=1;
  41082. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41083. }));
  41084. } else {
  41085. return (
  41086. $ctx4.supercall = true,
  41087. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41088. $ctx4.supercall = false;
  41089. }
  41090. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41091. }));
  41092. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41093. }),$recv(anIRMethod)._arguments());
  41094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41095. }));
  41096. return $self._contents();
  41097. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41098. },
  41099. args: ["anIRMethod"],
  41100. 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",
  41101. referencedClasses: [],
  41102. 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"]
  41103. }),
  41104. $globals.IRJSTranslator);
  41105. $core.addMethod(
  41106. $core.method({
  41107. selector: "visitIRNonLocalReturn:",
  41108. protocol: "visiting",
  41109. fn: function (anIRNonLocalReturn){
  41110. var self=this,$self=this;
  41111. return $core.withContext(function($ctx1) {
  41112. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41113. return $core.withContext(function($ctx2) {
  41114. return (
  41115. $ctx2.supercall = true,
  41116. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41117. $ctx2.supercall = false;
  41118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41119. }));
  41120. return self;
  41121. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41122. },
  41123. args: ["anIRNonLocalReturn"],
  41124. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41125. referencedClasses: [],
  41126. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41127. }),
  41128. $globals.IRJSTranslator);
  41129. $core.addMethod(
  41130. $core.method({
  41131. selector: "visitIRReturn:",
  41132. protocol: "visiting",
  41133. fn: function (anIRReturn){
  41134. var self=this,$self=this;
  41135. return $core.withContext(function($ctx1) {
  41136. $recv($self._stream())._nextPutReturnWith_((function(){
  41137. return $core.withContext(function($ctx2) {
  41138. return (
  41139. $ctx2.supercall = true,
  41140. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41141. $ctx2.supercall = false;
  41142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41143. }));
  41144. return self;
  41145. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41146. },
  41147. args: ["anIRReturn"],
  41148. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41149. referencedClasses: [],
  41150. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41151. }),
  41152. $globals.IRJSTranslator);
  41153. $core.addMethod(
  41154. $core.method({
  41155. selector: "visitIRSend:",
  41156. protocol: "visiting",
  41157. fn: function (anIRSend){
  41158. var self=this,$self=this;
  41159. var sends,superclass;
  41160. return $core.withContext(function($ctx1) {
  41161. var $1,$2;
  41162. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41163. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41164. if($core.assert($1)){
  41165. $self._visitSuperSend_(anIRSend);
  41166. } else {
  41167. $self._visitSend_(anIRSend);
  41168. }
  41169. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41170. if($core.assert($2)){
  41171. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41172. }
  41173. return self;
  41174. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41175. },
  41176. args: ["anIRSend"],
  41177. 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 ]",
  41178. referencedClasses: [],
  41179. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41180. }),
  41181. $globals.IRJSTranslator);
  41182. $core.addMethod(
  41183. $core.method({
  41184. selector: "visitIRSequence:",
  41185. protocol: "visiting",
  41186. fn: function (anIRSequence){
  41187. var self=this,$self=this;
  41188. return $core.withContext(function($ctx1) {
  41189. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41190. return $core.withContext(function($ctx2) {
  41191. return $recv($self._stream())._nextPutStatementWith_((function(){
  41192. return $core.withContext(function($ctx3) {
  41193. return $self._visit_(each);
  41194. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41195. }));
  41196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41197. }));
  41198. return self;
  41199. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41200. },
  41201. args: ["anIRSequence"],
  41202. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41203. referencedClasses: [],
  41204. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41205. }),
  41206. $globals.IRJSTranslator);
  41207. $core.addMethod(
  41208. $core.method({
  41209. selector: "visitIRTempDeclaration:",
  41210. protocol: "visiting",
  41211. fn: function (anIRTempDeclaration){
  41212. var self=this,$self=this;
  41213. return self;
  41214. },
  41215. args: ["anIRTempDeclaration"],
  41216. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41217. referencedClasses: [],
  41218. messageSends: []
  41219. }),
  41220. $globals.IRJSTranslator);
  41221. $core.addMethod(
  41222. $core.method({
  41223. selector: "visitIRValue:",
  41224. protocol: "visiting",
  41225. fn: function (anIRValue){
  41226. var self=this,$self=this;
  41227. return $core.withContext(function($ctx1) {
  41228. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41229. return self;
  41230. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41231. },
  41232. args: ["anIRValue"],
  41233. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41234. referencedClasses: [],
  41235. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41236. }),
  41237. $globals.IRJSTranslator);
  41238. $core.addMethod(
  41239. $core.method({
  41240. selector: "visitIRVariable:",
  41241. protocol: "visiting",
  41242. fn: function (anIRVariable){
  41243. var self=this,$self=this;
  41244. return $core.withContext(function($ctx1) {
  41245. var $3,$2,$1,$4;
  41246. $3=$recv(anIRVariable)._variable();
  41247. $ctx1.sendIdx["variable"]=1;
  41248. $2=$recv($3)._name();
  41249. $1=$recv($2).__eq("thisContext");
  41250. if($core.assert($1)){
  41251. $4=$self._stream();
  41252. $ctx1.sendIdx["stream"]=1;
  41253. $recv($4)._nextPutAll_("$core.getThisContext()");
  41254. $ctx1.sendIdx["nextPutAll:"]=1;
  41255. } else {
  41256. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41257. }
  41258. return self;
  41259. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41260. },
  41261. args: ["anIRVariable"],
  41262. 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 ]",
  41263. referencedClasses: [],
  41264. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41265. }),
  41266. $globals.IRJSTranslator);
  41267. $core.addMethod(
  41268. $core.method({
  41269. selector: "visitIRVerbatim:",
  41270. protocol: "visiting",
  41271. fn: function (anIRVerbatim){
  41272. var self=this,$self=this;
  41273. return $core.withContext(function($ctx1) {
  41274. var $1;
  41275. $1=$self._stream();
  41276. $ctx1.sendIdx["stream"]=1;
  41277. $recv($1)._nextPutStatementWith_((function(){
  41278. return $core.withContext(function($ctx2) {
  41279. return $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41281. }));
  41282. return self;
  41283. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41284. },
  41285. args: ["anIRVerbatim"],
  41286. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  41287. referencedClasses: [],
  41288. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  41289. }),
  41290. $globals.IRJSTranslator);
  41291. $core.addMethod(
  41292. $core.method({
  41293. selector: "visitInstructionList:enclosedBetween:and:",
  41294. protocol: "visiting",
  41295. fn: function (anArray,aString,anotherString){
  41296. var self=this,$self=this;
  41297. return $core.withContext(function($ctx1) {
  41298. var $1;
  41299. $1=$self._stream();
  41300. $ctx1.sendIdx["stream"]=1;
  41301. $recv($1)._nextPutAll_(aString);
  41302. $ctx1.sendIdx["nextPutAll:"]=1;
  41303. $recv(anArray)._do_separatedBy_((function(each){
  41304. return $core.withContext(function($ctx2) {
  41305. return $self._visit_(each);
  41306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41307. }),(function(){
  41308. return $core.withContext(function($ctx2) {
  41309. return $recv($self._stream())._nextPutAll_(",");
  41310. $ctx2.sendIdx["nextPutAll:"]=2;
  41311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41312. }));
  41313. $recv($self["@stream"])._nextPutAll_(anotherString);
  41314. return self;
  41315. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41316. },
  41317. args: ["anArray", "aString", "anotherString"],
  41318. 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",
  41319. referencedClasses: [],
  41320. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41321. }),
  41322. $globals.IRJSTranslator);
  41323. $core.addMethod(
  41324. $core.method({
  41325. selector: "visitReceiver:",
  41326. protocol: "visiting",
  41327. fn: function (anIRInstruction){
  41328. var self=this,$self=this;
  41329. var instr;
  41330. return $core.withContext(function($ctx1) {
  41331. var $1,$2,$4,$5,$3,$6,$7,$8;
  41332. $1=$recv(anIRInstruction)._isSelf();
  41333. if($core.assert($1)){
  41334. $2=$recv(anIRInstruction)._copy();
  41335. $ctx1.sendIdx["copy"]=1;
  41336. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41337. $recv($4)._name_("$self");
  41338. $5=$recv($4)._yourself();
  41339. $ctx1.sendIdx["yourself"]=1;
  41340. $3=$5;
  41341. $recv($2)._variable_($3);
  41342. instr=$recv($2)._yourself();
  41343. instr;
  41344. } else {
  41345. instr=anIRInstruction;
  41346. instr;
  41347. }
  41348. $6=$recv(instr)._needsBoxingAsReceiver();
  41349. if(!$core.assert($6)){
  41350. $7=$self._visit_(instr);
  41351. $ctx1.sendIdx["visit:"]=1;
  41352. return $7;
  41353. }
  41354. $8=$self._stream();
  41355. $ctx1.sendIdx["stream"]=1;
  41356. $recv($8)._nextPutAll_("$recv(");
  41357. $ctx1.sendIdx["nextPutAll:"]=1;
  41358. $self._visit_(instr);
  41359. $recv($self._stream())._nextPutAll_(")");
  41360. return self;
  41361. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41362. },
  41363. args: ["anIRInstruction"],
  41364. 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: ')'",
  41365. referencedClasses: [],
  41366. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41367. }),
  41368. $globals.IRJSTranslator);
  41369. $core.addMethod(
  41370. $core.method({
  41371. selector: "visitSend:",
  41372. protocol: "visiting",
  41373. fn: function (anIRSend){
  41374. var self=this,$self=this;
  41375. return $core.withContext(function($ctx1) {
  41376. $self._visitReceiver_($recv(anIRSend)._receiver());
  41377. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41378. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41379. return self;
  41380. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41381. },
  41382. args: ["anIRSend"],
  41383. 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: ')'",
  41384. referencedClasses: [],
  41385. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41386. }),
  41387. $globals.IRJSTranslator);
  41388. $core.addMethod(
  41389. $core.method({
  41390. selector: "visitSuperSend:",
  41391. protocol: "visiting",
  41392. fn: function (anIRSend){
  41393. var self=this,$self=this;
  41394. return $core.withContext(function($ctx1) {
  41395. var $1,$4,$3,$2,$5,$6,$7,$8;
  41396. $1=$self._stream();
  41397. $ctx1.sendIdx["stream"]=1;
  41398. $recv($1)._nextPutAll_("(");
  41399. $ctx1.sendIdx["nextPutAll:"]=1;
  41400. $recv($1)._lf();
  41401. $ctx1.sendIdx["lf"]=1;
  41402. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41403. $ctx1.sendIdx["nextPutAll:"]=2;
  41404. $recv($1)._lf();
  41405. $ctx1.sendIdx["lf"]=2;
  41406. $4=$recv(anIRSend)._scope();
  41407. $ctx1.sendIdx["scope"]=1;
  41408. $3=$recv($4)._alias();
  41409. $ctx1.sendIdx["alias"]=1;
  41410. $2=$recv($3).__comma(".supercall = true,");
  41411. $ctx1.sendIdx[","]=1;
  41412. $recv($1)._nextPutAll_($2);
  41413. $ctx1.sendIdx["nextPutAll:"]=3;
  41414. $recv($1)._lf();
  41415. $ctx1.sendIdx["lf"]=3;
  41416. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41417. $ctx1.sendIdx["nextPutAll:"]=4;
  41418. $recv($1)._lf();
  41419. $ctx1.sendIdx["lf"]=4;
  41420. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41421. $ctx1.sendIdx[","]=2;
  41422. $recv($1)._nextPutAll_($5);
  41423. $ctx1.sendIdx["nextPutAll:"]=5;
  41424. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41425. $ctx1.sendIdx["nextPutAll:"]=6;
  41426. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41427. $ctx1.sendIdx[","]=3;
  41428. $recv($1)._nextPutAll_($6);
  41429. $ctx1.sendIdx["nextPutAll:"]=7;
  41430. $7=$recv($1)._nextPutAll_("$self, ");
  41431. $ctx1.sendIdx["nextPutAll:"]=8;
  41432. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41433. $8=$self._stream();
  41434. $recv($8)._nextPutAll_("));");
  41435. $ctx1.sendIdx["nextPutAll:"]=9;
  41436. $recv($8)._lf();
  41437. $ctx1.sendIdx["lf"]=5;
  41438. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41439. $ctx1.sendIdx["nextPutAll:"]=10;
  41440. $recv($8)._lf();
  41441. $ctx1.sendIdx["lf"]=6;
  41442. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41443. $ctx1.sendIdx["nextPutAll:"]=11;
  41444. $recv($8)._lf();
  41445. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41446. return self;
  41447. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41448. },
  41449. args: ["anIRSend"],
  41450. 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);'",
  41451. referencedClasses: [],
  41452. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41453. }),
  41454. $globals.IRJSTranslator);
  41455. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41456. $core.addMethod(
  41457. $core.method({
  41458. selector: "contents",
  41459. protocol: "accessing",
  41460. fn: function (){
  41461. var self=this,$self=this;
  41462. return $core.withContext(function($ctx1) {
  41463. return $recv($self["@stream"])._contents();
  41464. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41465. },
  41466. args: [],
  41467. source: "contents\x0a\x09^ stream contents",
  41468. referencedClasses: [],
  41469. messageSends: ["contents"]
  41470. }),
  41471. $globals.JSStream);
  41472. $core.addMethod(
  41473. $core.method({
  41474. selector: "initialize",
  41475. protocol: "initialization",
  41476. fn: function (){
  41477. var self=this,$self=this;
  41478. return $core.withContext(function($ctx1) {
  41479. (
  41480. $ctx1.supercall = true,
  41481. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41482. $ctx1.supercall = false;
  41483. $self["@stream"]=""._writeStream();
  41484. return self;
  41485. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41486. },
  41487. args: [],
  41488. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41489. referencedClasses: [],
  41490. messageSends: ["initialize", "writeStream"]
  41491. }),
  41492. $globals.JSStream);
  41493. $core.addMethod(
  41494. $core.method({
  41495. selector: "lf",
  41496. protocol: "streaming",
  41497. fn: function (){
  41498. var self=this,$self=this;
  41499. return $core.withContext(function($ctx1) {
  41500. $recv($self["@stream"])._lf();
  41501. return self;
  41502. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41503. },
  41504. args: [],
  41505. source: "lf\x0a\x09stream lf",
  41506. referencedClasses: [],
  41507. messageSends: ["lf"]
  41508. }),
  41509. $globals.JSStream);
  41510. $core.addMethod(
  41511. $core.method({
  41512. selector: "nextPut:",
  41513. protocol: "streaming",
  41514. fn: function (aString){
  41515. var self=this,$self=this;
  41516. return $core.withContext(function($ctx1) {
  41517. $recv($self["@stream"])._nextPut_(aString);
  41518. return self;
  41519. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41520. },
  41521. args: ["aString"],
  41522. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41523. referencedClasses: [],
  41524. messageSends: ["nextPut:"]
  41525. }),
  41526. $globals.JSStream);
  41527. $core.addMethod(
  41528. $core.method({
  41529. selector: "nextPutAll:",
  41530. protocol: "streaming",
  41531. fn: function (aString){
  41532. var self=this,$self=this;
  41533. return $core.withContext(function($ctx1) {
  41534. $recv($self["@stream"])._nextPutAll_(aString);
  41535. return self;
  41536. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41537. },
  41538. args: ["aString"],
  41539. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41540. referencedClasses: [],
  41541. messageSends: ["nextPutAll:"]
  41542. }),
  41543. $globals.JSStream);
  41544. $core.addMethod(
  41545. $core.method({
  41546. selector: "nextPutAssignLhs:rhs:",
  41547. protocol: "streaming",
  41548. fn: function (aBlock,anotherBlock){
  41549. var self=this,$self=this;
  41550. return $core.withContext(function($ctx1) {
  41551. $recv(aBlock)._value();
  41552. $ctx1.sendIdx["value"]=1;
  41553. $recv($self["@stream"])._nextPutAll_("=");
  41554. $recv(anotherBlock)._value();
  41555. return self;
  41556. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41557. },
  41558. args: ["aBlock", "anotherBlock"],
  41559. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41560. referencedClasses: [],
  41561. messageSends: ["value", "nextPutAll:"]
  41562. }),
  41563. $globals.JSStream);
  41564. $core.addMethod(
  41565. $core.method({
  41566. selector: "nextPutBlockContextFor:during:",
  41567. protocol: "streaming",
  41568. fn: function (anIRClosure,aBlock){
  41569. var self=this,$self=this;
  41570. return $core.withContext(function($ctx1) {
  41571. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41572. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41573. if(!$core.assert($1)){
  41574. $2=$recv(aBlock)._value();
  41575. $ctx1.sendIdx["value"]=1;
  41576. return $2;
  41577. }
  41578. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41579. $ctx1.sendIdx["nextPutAll:"]=1;
  41580. $self._lf();
  41581. $ctx1.sendIdx["lf"]=1;
  41582. $6=$recv(anIRClosure)._scope();
  41583. $ctx1.sendIdx["scope"]=1;
  41584. $5=$recv($6)._alias();
  41585. $ctx1.sendIdx["alias"]=1;
  41586. $4="return $core.withContext(function(".__comma($5);
  41587. $ctx1.sendIdx[","]=2;
  41588. $3=$recv($4).__comma(") {");
  41589. $ctx1.sendIdx[","]=1;
  41590. $self._nextPutAll_($3);
  41591. $ctx1.sendIdx["nextPutAll:"]=2;
  41592. $self._lf();
  41593. $ctx1.sendIdx["lf"]=2;
  41594. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41595. $ctx1.sendIdx["nextPutAll:"]=3;
  41596. $7=$self._lf();
  41597. $ctx1.sendIdx["lf"]=3;
  41598. $recv(aBlock)._value();
  41599. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41600. $ctx1.sendIdx["nextPutAll:"]=4;
  41601. $self._lf();
  41602. $ctx1.sendIdx["lf"]=4;
  41603. $11=$recv(anIRClosure)._scope();
  41604. $ctx1.sendIdx["scope"]=2;
  41605. $10=$recv($11)._alias();
  41606. $ctx1.sendIdx["alias"]=2;
  41607. $9="}, function(".__comma($10);
  41608. $ctx1.sendIdx[","]=4;
  41609. $8=$recv($9).__comma(") {");
  41610. $ctx1.sendIdx[","]=3;
  41611. $self._nextPutAll_($8);
  41612. $ctx1.sendIdx["nextPutAll:"]=5;
  41613. $15=$recv(anIRClosure)._scope();
  41614. $ctx1.sendIdx["scope"]=3;
  41615. $14=$recv($15)._alias();
  41616. $ctx1.sendIdx["alias"]=3;
  41617. $13=$recv($14).__comma(".fillBlock({");
  41618. $ctx1.sendIdx[","]=5;
  41619. $12=$self._nextPutAll_($13);
  41620. $ctx1.sendIdx["nextPutAll:"]=6;
  41621. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  41622. return $core.withContext(function($ctx2) {
  41623. $16=$recv(each)._asVariableName();
  41624. $ctx2.sendIdx["asVariableName"]=1;
  41625. $self._nextPutAll_($16);
  41626. $ctx2.sendIdx["nextPutAll:"]=7;
  41627. $self._nextPutAll_(":");
  41628. $ctx2.sendIdx["nextPutAll:"]=8;
  41629. $17=$self._nextPutAll_($recv(each)._asVariableName());
  41630. $ctx2.sendIdx["nextPutAll:"]=9;
  41631. return $17;
  41632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41633. }),(function(){
  41634. return $core.withContext(function($ctx2) {
  41635. return $self._nextPutAll_(",");
  41636. $ctx2.sendIdx["nextPutAll:"]=10;
  41637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41638. }));
  41639. $self._nextPutAll_("},");
  41640. $ctx1.sendIdx["nextPutAll:"]=11;
  41641. $23=$recv(anIRClosure)._scope();
  41642. $ctx1.sendIdx["scope"]=4;
  41643. $22=$recv($23)._outerScope();
  41644. $21=$recv($22)._alias();
  41645. $20=$recv($21).__comma(",");
  41646. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  41647. $ctx1.sendIdx[","]=7;
  41648. $18=$recv($19).__comma(")});");
  41649. $ctx1.sendIdx[","]=6;
  41650. $self._nextPutAll_($18);
  41651. $ctx1.sendIdx["nextPutAll:"]=12;
  41652. $self._lf();
  41653. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41654. return self;
  41655. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  41656. },
  41657. args: ["anIRClosure", "aBlock"],
  41658. 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);'",
  41659. referencedClasses: [],
  41660. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  41661. }),
  41662. $globals.JSStream);
  41663. $core.addMethod(
  41664. $core.method({
  41665. selector: "nextPutClosureWith:arguments:",
  41666. protocol: "streaming",
  41667. fn: function (aBlock,anArray){
  41668. var self=this,$self=this;
  41669. return $core.withContext(function($ctx1) {
  41670. var $1,$2,$3;
  41671. $recv($self["@stream"])._nextPutAll_("(function(");
  41672. $ctx1.sendIdx["nextPutAll:"]=1;
  41673. $recv(anArray)._do_separatedBy_((function(each){
  41674. return $core.withContext(function($ctx2) {
  41675. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41676. $ctx2.sendIdx["nextPutAll:"]=2;
  41677. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41678. }),(function(){
  41679. return $core.withContext(function($ctx2) {
  41680. return $recv($self["@stream"])._nextPut_(",");
  41681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41682. }));
  41683. $1=$self["@stream"];
  41684. $recv($1)._nextPutAll_("){");
  41685. $ctx1.sendIdx["nextPutAll:"]=3;
  41686. $2=$recv($1)._lf();
  41687. $ctx1.sendIdx["lf"]=1;
  41688. $recv(aBlock)._value();
  41689. $3=$self["@stream"];
  41690. $recv($3)._lf();
  41691. $recv($3)._nextPutAll_("})");
  41692. return self;
  41693. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41694. },
  41695. args: ["aBlock", "anArray"],
  41696. 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: '})'",
  41697. referencedClasses: [],
  41698. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41699. }),
  41700. $globals.JSStream);
  41701. $core.addMethod(
  41702. $core.method({
  41703. selector: "nextPutContextFor:during:",
  41704. protocol: "streaming",
  41705. fn: function (aMethod,aBlock){
  41706. var self=this,$self=this;
  41707. return $core.withContext(function($ctx1) {
  41708. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  41709. $1=$recv(aMethod)._requiresSmalltalkContext();
  41710. if(!$core.assert($1)){
  41711. $2=$recv(aBlock)._value();
  41712. $ctx1.sendIdx["value"]=1;
  41713. return $2;
  41714. }
  41715. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41716. $ctx1.sendIdx["nextPutAll:"]=1;
  41717. $self._lf();
  41718. $ctx1.sendIdx["lf"]=1;
  41719. $6=$recv(aMethod)._scope();
  41720. $ctx1.sendIdx["scope"]=1;
  41721. $5=$recv($6)._alias();
  41722. $ctx1.sendIdx["alias"]=1;
  41723. $4="return $core.withContext(function(".__comma($5);
  41724. $ctx1.sendIdx[","]=2;
  41725. $3=$recv($4).__comma(") {");
  41726. $ctx1.sendIdx[","]=1;
  41727. $self._nextPutAll_($3);
  41728. $ctx1.sendIdx["nextPutAll:"]=2;
  41729. $self._lf();
  41730. $ctx1.sendIdx["lf"]=2;
  41731. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41732. $ctx1.sendIdx["nextPutAll:"]=3;
  41733. $7=$self._lf();
  41734. $ctx1.sendIdx["lf"]=3;
  41735. $recv(aBlock)._value();
  41736. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41737. $ctx1.sendIdx["nextPutAll:"]=4;
  41738. $self._lf();
  41739. $ctx1.sendIdx["lf"]=4;
  41740. $12=$recv(aMethod)._scope();
  41741. $ctx1.sendIdx["scope"]=2;
  41742. $11=$recv($12)._alias();
  41743. $ctx1.sendIdx["alias"]=2;
  41744. $10="}, function(".__comma($11);
  41745. $ctx1.sendIdx[","]=5;
  41746. $9=$recv($10).__comma(") {");
  41747. $ctx1.sendIdx[","]=4;
  41748. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  41749. $ctx1.sendIdx[","]=3;
  41750. $self._nextPutAll_($8);
  41751. $ctx1.sendIdx["nextPutAll:"]=5;
  41752. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41753. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41754. $15=".fill(self,".__comma($16);
  41755. $14=$recv($15).__comma(",{");
  41756. $ctx1.sendIdx[","]=6;
  41757. $13=$self._nextPutAll_($14);
  41758. $ctx1.sendIdx["nextPutAll:"]=6;
  41759. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  41760. return $core.withContext(function($ctx2) {
  41761. $17=$recv(each)._asVariableName();
  41762. $ctx2.sendIdx["asVariableName"]=1;
  41763. $self._nextPutAll_($17);
  41764. $ctx2.sendIdx["nextPutAll:"]=7;
  41765. $self._nextPutAll_(":");
  41766. $ctx2.sendIdx["nextPutAll:"]=8;
  41767. $18=$self._nextPutAll_($recv(each)._asVariableName());
  41768. $ctx2.sendIdx["nextPutAll:"]=9;
  41769. return $18;
  41770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41771. }),(function(){
  41772. return $core.withContext(function($ctx2) {
  41773. return $self._nextPutAll_(",");
  41774. $ctx2.sendIdx["nextPutAll:"]=10;
  41775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41776. }));
  41777. $self._nextPutAll_("},");
  41778. $ctx1.sendIdx["nextPutAll:"]=11;
  41779. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  41780. $ctx1.sendIdx["nextPutAll:"]=12;
  41781. $self._nextPutAll_(")});");
  41782. $ctx1.sendIdx["nextPutAll:"]=13;
  41783. $self._lf();
  41784. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41785. return self;
  41786. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41787. },
  41788. args: ["aMethod", "aBlock"],
  41789. 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);'",
  41790. referencedClasses: [],
  41791. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  41792. }),
  41793. $globals.JSStream);
  41794. $core.addMethod(
  41795. $core.method({
  41796. selector: "nextPutFunctionWith:arguments:",
  41797. protocol: "streaming",
  41798. fn: function (aBlock,anArray){
  41799. var self=this,$self=this;
  41800. return $core.withContext(function($ctx1) {
  41801. var $1,$2,$3,$4,$5;
  41802. $recv($self["@stream"])._nextPutAll_("fn: function(");
  41803. $ctx1.sendIdx["nextPutAll:"]=1;
  41804. $recv(anArray)._do_separatedBy_((function(each){
  41805. return $core.withContext(function($ctx2) {
  41806. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41807. $ctx2.sendIdx["nextPutAll:"]=2;
  41808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41809. }),(function(){
  41810. return $core.withContext(function($ctx2) {
  41811. return $recv($self["@stream"])._nextPut_(",");
  41812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41813. }));
  41814. $1=$self["@stream"];
  41815. $recv($1)._nextPutAll_("){");
  41816. $ctx1.sendIdx["nextPutAll:"]=3;
  41817. $2=$recv($1)._lf();
  41818. $ctx1.sendIdx["lf"]=1;
  41819. $3=$self["@stream"];
  41820. $recv($3)._nextPutAll_("var self=this,$self=this;");
  41821. $ctx1.sendIdx["nextPutAll:"]=4;
  41822. $4=$recv($3)._lf();
  41823. $ctx1.sendIdx["lf"]=2;
  41824. $recv(aBlock)._value();
  41825. $5=$self["@stream"];
  41826. $recv($5)._lf();
  41827. $recv($5)._nextPutAll_("}");
  41828. return self;
  41829. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41830. },
  41831. args: ["aBlock", "anArray"],
  41832. 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: '}'",
  41833. referencedClasses: [],
  41834. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41835. }),
  41836. $globals.JSStream);
  41837. $core.addMethod(
  41838. $core.method({
  41839. selector: "nextPutIf:then:",
  41840. protocol: "streaming",
  41841. fn: function (aBlock,anotherBlock){
  41842. var self=this,$self=this;
  41843. return $core.withContext(function($ctx1) {
  41844. var $1;
  41845. $recv($self["@stream"])._nextPutAll_("if(");
  41846. $ctx1.sendIdx["nextPutAll:"]=1;
  41847. $recv(aBlock)._value();
  41848. $ctx1.sendIdx["value"]=1;
  41849. $1=$self["@stream"];
  41850. $recv($1)._nextPutAll_("){");
  41851. $ctx1.sendIdx["nextPutAll:"]=2;
  41852. $recv($1)._lf();
  41853. $recv(anotherBlock)._value();
  41854. $recv($self["@stream"])._nextPutAll_("}");
  41855. $self._omitSemicolon_(true);
  41856. return self;
  41857. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41858. },
  41859. args: ["aBlock", "anotherBlock"],
  41860. 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",
  41861. referencedClasses: [],
  41862. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41863. }),
  41864. $globals.JSStream);
  41865. $core.addMethod(
  41866. $core.method({
  41867. selector: "nextPutIf:then:else:",
  41868. protocol: "streaming",
  41869. fn: function (aBlock,ifBlock,elseBlock){
  41870. var self=this,$self=this;
  41871. return $core.withContext(function($ctx1) {
  41872. var $1,$2,$3;
  41873. $recv($self["@stream"])._nextPutAll_("if(");
  41874. $ctx1.sendIdx["nextPutAll:"]=1;
  41875. $recv(aBlock)._value();
  41876. $ctx1.sendIdx["value"]=1;
  41877. $1=$self["@stream"];
  41878. $recv($1)._nextPutAll_("){");
  41879. $ctx1.sendIdx["nextPutAll:"]=2;
  41880. $2=$recv($1)._lf();
  41881. $ctx1.sendIdx["lf"]=1;
  41882. $recv(ifBlock)._value();
  41883. $ctx1.sendIdx["value"]=2;
  41884. $3=$self["@stream"];
  41885. $recv($3)._nextPutAll_("} else {");
  41886. $ctx1.sendIdx["nextPutAll:"]=3;
  41887. $recv($3)._lf();
  41888. $recv(elseBlock)._value();
  41889. $recv($self["@stream"])._nextPutAll_("}");
  41890. $self._omitSemicolon_(true);
  41891. return self;
  41892. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  41893. },
  41894. args: ["aBlock", "ifBlock", "elseBlock"],
  41895. 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",
  41896. referencedClasses: [],
  41897. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41898. }),
  41899. $globals.JSStream);
  41900. $core.addMethod(
  41901. $core.method({
  41902. selector: "nextPutMethodDeclaration:with:",
  41903. protocol: "streaming",
  41904. fn: function (aMethod,aBlock){
  41905. var self=this,$self=this;
  41906. return $core.withContext(function($ctx1) {
  41907. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  41908. $1=$self["@stream"];
  41909. $recv($1)._nextPutAll_("$core.method({");
  41910. $ctx1.sendIdx["nextPutAll:"]=1;
  41911. $recv($1)._lf();
  41912. $ctx1.sendIdx["lf"]=1;
  41913. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41914. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41915. $3="selector: ".__comma($4);
  41916. $ctx1.sendIdx[","]=2;
  41917. $2=$recv($3).__comma(",");
  41918. $ctx1.sendIdx[","]=1;
  41919. $recv($1)._nextPutAll_($2);
  41920. $ctx1.sendIdx["nextPutAll:"]=2;
  41921. $recv($1)._lf();
  41922. $ctx1.sendIdx["lf"]=2;
  41923. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  41924. $ctx1.sendIdx["asJavaScriptSource"]=2;
  41925. $6="source: ".__comma($7);
  41926. $ctx1.sendIdx[","]=4;
  41927. $5=$recv($6).__comma(",");
  41928. $ctx1.sendIdx[","]=3;
  41929. $recv($1)._nextPutAll_($5);
  41930. $ctx1.sendIdx["nextPutAll:"]=3;
  41931. $8=$recv($1)._lf();
  41932. $ctx1.sendIdx["lf"]=3;
  41933. $recv(aBlock)._value();
  41934. $ctx1.sendIdx["value"]=1;
  41935. $9=$self["@stream"];
  41936. $12=$recv($globals.String)._lf();
  41937. $ctx1.sendIdx["lf"]=4;
  41938. $11=",".__comma($12);
  41939. $ctx1.sendIdx[","]=6;
  41940. $10=$recv($11).__comma("messageSends: ");
  41941. $ctx1.sendIdx[","]=5;
  41942. $recv($9)._nextPutAll_($10);
  41943. $ctx1.sendIdx["nextPutAll:"]=4;
  41944. $15=$recv($recv(aMethod)._messageSends())._asArray();
  41945. $ctx1.sendIdx["asArray"]=1;
  41946. $14=$recv($15)._asJavaScriptSource();
  41947. $ctx1.sendIdx["asJavaScriptSource"]=3;
  41948. $13=$recv($14).__comma(",");
  41949. $ctx1.sendIdx[","]=7;
  41950. $recv($9)._nextPutAll_($13);
  41951. $ctx1.sendIdx["nextPutAll:"]=5;
  41952. $recv($9)._lf();
  41953. $ctx1.sendIdx["lf"]=5;
  41954. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  41955. return $core.withContext(function($ctx2) {
  41956. return $recv(each)._value();
  41957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41958. })))._asArray())._asJavaScriptSource();
  41959. $ctx1.sendIdx["asJavaScriptSource"]=4;
  41960. $17="args: ".__comma($18);
  41961. $16=$recv($17).__comma(",");
  41962. $ctx1.sendIdx[","]=8;
  41963. $recv($9)._nextPutAll_($16);
  41964. $ctx1.sendIdx["nextPutAll:"]=6;
  41965. $recv($9)._lf();
  41966. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  41967. $ctx1.sendIdx["nextPutAll:"]=7;
  41968. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  41969. return $core.withContext(function($ctx2) {
  41970. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  41971. $ctx2.sendIdx["nextPutAll:"]=8;
  41972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41973. }),(function(){
  41974. return $core.withContext(function($ctx2) {
  41975. return $recv($self["@stream"])._nextPutAll_(",");
  41976. $ctx2.sendIdx["nextPutAll:"]=9;
  41977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41978. }));
  41979. $20=$self["@stream"];
  41980. $recv($20)._nextPutAll_("]");
  41981. $ctx1.sendIdx["nextPutAll:"]=10;
  41982. $recv($20)._nextPutAll_("})");
  41983. return self;
  41984. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41985. },
  41986. args: ["aMethod", "aBlock"],
  41987. 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: '})'",
  41988. referencedClasses: ["String"],
  41989. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  41990. }),
  41991. $globals.JSStream);
  41992. $core.addMethod(
  41993. $core.method({
  41994. selector: "nextPutNonLocalReturnHandlingWith:",
  41995. protocol: "streaming",
  41996. fn: function (aBlock){
  41997. var self=this,$self=this;
  41998. return $core.withContext(function($ctx1) {
  41999. var $1,$2,$3;
  42000. $1=$self["@stream"];
  42001. $recv($1)._nextPutAll_("var $early={};");
  42002. $ctx1.sendIdx["nextPutAll:"]=1;
  42003. $recv($1)._lf();
  42004. $ctx1.sendIdx["lf"]=1;
  42005. $recv($1)._nextPutAll_("try {");
  42006. $ctx1.sendIdx["nextPutAll:"]=2;
  42007. $2=$recv($1)._lf();
  42008. $ctx1.sendIdx["lf"]=2;
  42009. $recv(aBlock)._value();
  42010. $3=$self["@stream"];
  42011. $recv($3)._nextPutAll_("}");
  42012. $ctx1.sendIdx["nextPutAll:"]=3;
  42013. $recv($3)._lf();
  42014. $ctx1.sendIdx["lf"]=3;
  42015. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42016. $recv($3)._lf();
  42017. return self;
  42018. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42019. },
  42020. args: ["aBlock"],
  42021. 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",
  42022. referencedClasses: [],
  42023. messageSends: ["nextPutAll:", "lf", "value"]
  42024. }),
  42025. $globals.JSStream);
  42026. $core.addMethod(
  42027. $core.method({
  42028. selector: "nextPutNonLocalReturnWith:",
  42029. protocol: "streaming",
  42030. fn: function (aBlock){
  42031. var self=this,$self=this;
  42032. return $core.withContext(function($ctx1) {
  42033. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42034. $ctx1.sendIdx["nextPutAll:"]=1;
  42035. $recv(aBlock)._value();
  42036. $recv($self["@stream"])._nextPutAll_("]");
  42037. return self;
  42038. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42039. },
  42040. args: ["aBlock"],
  42041. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42042. referencedClasses: [],
  42043. messageSends: ["nextPutAll:", "value"]
  42044. }),
  42045. $globals.JSStream);
  42046. $core.addMethod(
  42047. $core.method({
  42048. selector: "nextPutReturnWith:",
  42049. protocol: "streaming",
  42050. fn: function (aBlock){
  42051. var self=this,$self=this;
  42052. return $core.withContext(function($ctx1) {
  42053. $recv($self["@stream"])._nextPutAll_("return ");
  42054. $recv(aBlock)._value();
  42055. return self;
  42056. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42057. },
  42058. args: ["aBlock"],
  42059. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42060. referencedClasses: [],
  42061. messageSends: ["nextPutAll:", "value"]
  42062. }),
  42063. $globals.JSStream);
  42064. $core.addMethod(
  42065. $core.method({
  42066. selector: "nextPutSendIndexFor:",
  42067. protocol: "streaming",
  42068. fn: function (anIRSend){
  42069. var self=this,$self=this;
  42070. return $core.withContext(function($ctx1) {
  42071. $self._nextPutAll_(";");
  42072. $ctx1.sendIdx["nextPutAll:"]=1;
  42073. $self._lf();
  42074. $ctx1.sendIdx["lf"]=1;
  42075. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42076. $ctx1.sendIdx["nextPutAll:"]=2;
  42077. $self._lf();
  42078. $ctx1.sendIdx["lf"]=2;
  42079. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42080. $ctx1.sendIdx["nextPutAll:"]=3;
  42081. $self._nextPutAll_(".sendIdx[");
  42082. $ctx1.sendIdx["nextPutAll:"]=4;
  42083. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42084. $ctx1.sendIdx["nextPutAll:"]=5;
  42085. $self._nextPutAll_("]=");
  42086. $ctx1.sendIdx["nextPutAll:"]=6;
  42087. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42088. $ctx1.sendIdx["nextPutAll:"]=7;
  42089. $self._nextPutAll_(";");
  42090. $ctx1.sendIdx["nextPutAll:"]=8;
  42091. $self._lf();
  42092. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42093. return self;
  42094. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42095. },
  42096. args: ["anIRSend"],
  42097. 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)'",
  42098. referencedClasses: [],
  42099. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42100. }),
  42101. $globals.JSStream);
  42102. $core.addMethod(
  42103. $core.method({
  42104. selector: "nextPutStatementWith:",
  42105. protocol: "streaming",
  42106. fn: function (aBlock){
  42107. var self=this,$self=this;
  42108. return $core.withContext(function($ctx1) {
  42109. var $1;
  42110. $self._omitSemicolon_(false);
  42111. $ctx1.sendIdx["omitSemicolon:"]=1;
  42112. $recv(aBlock)._value();
  42113. $1=$self._omitSemicolon();
  42114. if(!$core.assert($1)){
  42115. $recv($self["@stream"])._nextPutAll_(";");
  42116. }
  42117. $self._omitSemicolon_(false);
  42118. $recv($self["@stream"])._lf();
  42119. return self;
  42120. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42121. },
  42122. args: ["aBlock"],
  42123. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42124. referencedClasses: [],
  42125. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42126. }),
  42127. $globals.JSStream);
  42128. $core.addMethod(
  42129. $core.method({
  42130. selector: "nextPutVars:",
  42131. protocol: "streaming",
  42132. fn: function (aCollection){
  42133. var self=this,$self=this;
  42134. return $core.withContext(function($ctx1) {
  42135. var $1;
  42136. $recv(aCollection)._ifNotEmpty_((function(){
  42137. return $core.withContext(function($ctx2) {
  42138. $recv($self["@stream"])._nextPutAll_("var ");
  42139. $ctx2.sendIdx["nextPutAll:"]=1;
  42140. $recv(aCollection)._do_separatedBy_((function(each){
  42141. return $core.withContext(function($ctx3) {
  42142. return $recv($self["@stream"])._nextPutAll_(each);
  42143. $ctx3.sendIdx["nextPutAll:"]=2;
  42144. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42145. }),(function(){
  42146. return $core.withContext(function($ctx3) {
  42147. return $recv($self["@stream"])._nextPutAll_(",");
  42148. $ctx3.sendIdx["nextPutAll:"]=3;
  42149. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42150. }));
  42151. $1=$self["@stream"];
  42152. $recv($1)._nextPutAll_(";");
  42153. return $recv($1)._lf();
  42154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42155. }));
  42156. return self;
  42157. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42158. },
  42159. args: ["aCollection"],
  42160. 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 ]",
  42161. referencedClasses: [],
  42162. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42163. }),
  42164. $globals.JSStream);
  42165. $core.addMethod(
  42166. $core.method({
  42167. selector: "omitSemicolon",
  42168. protocol: "accessing",
  42169. fn: function (){
  42170. var self=this,$self=this;
  42171. return $self["@omitSemicolon"];
  42172. },
  42173. args: [],
  42174. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42175. referencedClasses: [],
  42176. messageSends: []
  42177. }),
  42178. $globals.JSStream);
  42179. $core.addMethod(
  42180. $core.method({
  42181. selector: "omitSemicolon:",
  42182. protocol: "accessing",
  42183. fn: function (aBoolean){
  42184. var self=this,$self=this;
  42185. $self["@omitSemicolon"]=aBoolean;
  42186. return self;
  42187. },
  42188. args: ["aBoolean"],
  42189. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42190. referencedClasses: [],
  42191. messageSends: []
  42192. }),
  42193. $globals.JSStream);
  42194. $core.addMethod(
  42195. $core.method({
  42196. selector: "isReferenced",
  42197. protocol: "*Compiler-IR",
  42198. fn: function (){
  42199. var self=this,$self=this;
  42200. return $core.withContext(function($ctx1) {
  42201. var $3,$2,$1;
  42202. $3=$self._parent();
  42203. $ctx1.sendIdx["parent"]=1;
  42204. $2=$recv($3)._isSequenceNode();
  42205. $1=$recv($2)._or_((function(){
  42206. return $core.withContext(function($ctx2) {
  42207. return $recv($self._parent())._isAssignmentNode();
  42208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42209. }));
  42210. return $recv($1)._not();
  42211. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42212. },
  42213. args: [],
  42214. 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",
  42215. referencedClasses: [],
  42216. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42217. }),
  42218. $globals.ASTNode);
  42219. $core.addMethod(
  42220. $core.method({
  42221. selector: "subtreeNeedsAliasing",
  42222. protocol: "*Compiler-IR",
  42223. fn: function (){
  42224. var self=this,$self=this;
  42225. return $core.withContext(function($ctx1) {
  42226. return $recv($self._shouldBeAliased())._or_((function(){
  42227. return $core.withContext(function($ctx2) {
  42228. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42229. return $core.withContext(function($ctx3) {
  42230. return $recv(each)._subtreeNeedsAliasing();
  42231. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42232. }));
  42233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42234. }));
  42235. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42236. },
  42237. args: [],
  42238. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42239. referencedClasses: [],
  42240. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42241. }),
  42242. $globals.ASTNode);
  42243. $core.addMethod(
  42244. $core.method({
  42245. selector: "shouldBeAliased",
  42246. protocol: "*Compiler-IR",
  42247. fn: function (){
  42248. var self=this,$self=this;
  42249. return $core.withContext(function($ctx1) {
  42250. var $1;
  42251. $1=(
  42252. $ctx1.supercall = true,
  42253. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42254. $ctx1.supercall = false;
  42255. return $recv($1)._or_((function(){
  42256. return $core.withContext(function($ctx2) {
  42257. return $self._isReferenced();
  42258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42259. }));
  42260. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42261. },
  42262. args: [],
  42263. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42264. referencedClasses: [],
  42265. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42266. }),
  42267. $globals.AssignmentNode);
  42268. $core.addMethod(
  42269. $core.method({
  42270. selector: "appendToInstruction:",
  42271. protocol: "*Compiler-IR",
  42272. fn: function (anIRInstruction){
  42273. var self=this,$self=this;
  42274. return $core.withContext(function($ctx1) {
  42275. $recv(anIRInstruction)._appendBlock_(self);
  42276. return self;
  42277. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42278. },
  42279. args: ["anIRInstruction"],
  42280. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42281. referencedClasses: [],
  42282. messageSends: ["appendBlock:"]
  42283. }),
  42284. $globals.BlockClosure);
  42285. $core.addMethod(
  42286. $core.method({
  42287. selector: "subtreeNeedsAliasing",
  42288. protocol: "*Compiler-IR",
  42289. fn: function (){
  42290. var self=this,$self=this;
  42291. return $core.withContext(function($ctx1) {
  42292. return $self._shouldBeAliased();
  42293. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42294. },
  42295. args: [],
  42296. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42297. referencedClasses: [],
  42298. messageSends: ["shouldBeAliased"]
  42299. }),
  42300. $globals.BlockNode);
  42301. $core.addMethod(
  42302. $core.method({
  42303. selector: "subtreeNeedsAliasing",
  42304. protocol: "*Compiler-IR",
  42305. fn: function (){
  42306. var self=this,$self=this;
  42307. return $core.withContext(function($ctx1) {
  42308. return $recv($recv($self._parent())._isSequenceNode())._not();
  42309. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42310. },
  42311. args: [],
  42312. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42313. referencedClasses: [],
  42314. messageSends: ["not", "isSequenceNode", "parent"]
  42315. }),
  42316. $globals.CascadeNode);
  42317. $core.addMethod(
  42318. $core.method({
  42319. selector: "shouldBeAliased",
  42320. protocol: "*Compiler-IR",
  42321. fn: function (){
  42322. var self=this,$self=this;
  42323. var sends;
  42324. return $core.withContext(function($ctx1) {
  42325. var $2,$1;
  42326. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42327. $2=(
  42328. $ctx1.supercall = true,
  42329. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42330. $ctx1.supercall = false;
  42331. $1=$recv($2)._or_((function(){
  42332. return $core.withContext(function($ctx2) {
  42333. return $recv($self._isReferenced())._and_((function(){
  42334. return $core.withContext(function($ctx3) {
  42335. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42336. return $core.withContext(function($ctx4) {
  42337. return $self._superSend();
  42338. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42339. }));
  42340. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42341. }));
  42342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42343. }));
  42344. $ctx1.sendIdx["or:"]=1;
  42345. return $1;
  42346. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42347. },
  42348. args: [],
  42349. 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 ] ] ])",
  42350. referencedClasses: [],
  42351. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42352. }),
  42353. $globals.SendNode);
  42354. $core.addMethod(
  42355. $core.method({
  42356. selector: "subtreeNeedsAliasing",
  42357. protocol: "*Compiler-IR",
  42358. fn: function (){
  42359. var self=this,$self=this;
  42360. return $core.withContext(function($ctx1) {
  42361. return $recv($self._shouldBeInlined())._or_((function(){
  42362. return $core.withContext(function($ctx2) {
  42363. return (
  42364. $ctx2.supercall = true,
  42365. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42366. $ctx2.supercall = false;
  42367. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42368. }));
  42369. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42370. },
  42371. args: [],
  42372. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42373. referencedClasses: [],
  42374. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42375. }),
  42376. $globals.SendNode);
  42377. });
  42378. 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";
  42379. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42380. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42381. $core.addPackage("Compiler-Inlining");
  42382. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42383. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42384. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42385. $core.addMethod(
  42386. $core.method({
  42387. selector: "visitSendNode:",
  42388. protocol: "visiting",
  42389. fn: function (aNode){
  42390. var self=this,$self=this;
  42391. return $core.withContext(function($ctx1) {
  42392. var $1,$2,$3,$4,$receiver;
  42393. $1=$recv(aNode)._superSend();
  42394. if(!$core.assert($1)){
  42395. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42396. if($core.assert($2)){
  42397. $recv(aNode)._shouldBeInlined_(true);
  42398. $3=$recv(aNode)._receiver();
  42399. if(($receiver = $3) == null || $receiver.a$nil){
  42400. $3;
  42401. } else {
  42402. var receiver;
  42403. receiver=$receiver;
  42404. $recv(receiver)._shouldBeAliased_(true);
  42405. }
  42406. }
  42407. }
  42408. $4=(
  42409. $ctx1.supercall = true,
  42410. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42411. $ctx1.supercall = false;
  42412. return $4;
  42413. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42414. },
  42415. args: ["aNode"],
  42416. 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",
  42417. referencedClasses: ["IRSendInliner"],
  42418. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42419. }),
  42420. $globals.ASTPreInliner);
  42421. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42422. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42423. $core.addMethod(
  42424. $core.method({
  42425. selector: "acceptDagVisitor:",
  42426. protocol: "visiting",
  42427. fn: function (aVisitor){
  42428. var self=this,$self=this;
  42429. return $core.withContext(function($ctx1) {
  42430. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42431. return self;
  42432. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42433. },
  42434. args: ["aVisitor"],
  42435. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42436. referencedClasses: [],
  42437. messageSends: ["visitIRInlinedClosure:"]
  42438. }),
  42439. $globals.IRInlinedClosure);
  42440. $core.addMethod(
  42441. $core.method({
  42442. selector: "isInlined",
  42443. protocol: "testing",
  42444. fn: function (){
  42445. var self=this,$self=this;
  42446. return true;
  42447. },
  42448. args: [],
  42449. source: "isInlined\x0a\x09^ true",
  42450. referencedClasses: [],
  42451. messageSends: []
  42452. }),
  42453. $globals.IRInlinedClosure);
  42454. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42455. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42456. $core.addMethod(
  42457. $core.method({
  42458. selector: "acceptDagVisitor:",
  42459. protocol: "visiting",
  42460. fn: function (aVisitor){
  42461. var self=this,$self=this;
  42462. return $core.withContext(function($ctx1) {
  42463. $recv(aVisitor)._visitInlinedSend_(self);
  42464. return self;
  42465. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42466. },
  42467. args: ["aVisitor"],
  42468. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42469. referencedClasses: [],
  42470. messageSends: ["visitInlinedSend:"]
  42471. }),
  42472. $globals.IRInlinedSend);
  42473. $core.addMethod(
  42474. $core.method({
  42475. selector: "internalVariables",
  42476. protocol: "accessing",
  42477. fn: function (){
  42478. var self=this,$self=this;
  42479. return [];
  42480. },
  42481. args: [],
  42482. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42483. referencedClasses: [],
  42484. messageSends: []
  42485. }),
  42486. $globals.IRInlinedSend);
  42487. $core.addMethod(
  42488. $core.method({
  42489. selector: "isInlined",
  42490. protocol: "testing",
  42491. fn: function (){
  42492. var self=this,$self=this;
  42493. return true;
  42494. },
  42495. args: [],
  42496. source: "isInlined\x0a\x09^ true",
  42497. referencedClasses: [],
  42498. messageSends: []
  42499. }),
  42500. $globals.IRInlinedSend);
  42501. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42502. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42503. $core.addMethod(
  42504. $core.method({
  42505. selector: "acceptDagVisitor:",
  42506. protocol: "visiting",
  42507. fn: function (aVisitor){
  42508. var self=this,$self=this;
  42509. return $core.withContext(function($ctx1) {
  42510. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42511. return self;
  42512. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42513. },
  42514. args: ["aVisitor"],
  42515. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42516. referencedClasses: [],
  42517. messageSends: ["visitIRInlinedIfFalse:"]
  42518. }),
  42519. $globals.IRInlinedIfFalse);
  42520. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42521. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42522. $core.addMethod(
  42523. $core.method({
  42524. selector: "acceptDagVisitor:",
  42525. protocol: "visiting",
  42526. fn: function (aVisitor){
  42527. var self=this,$self=this;
  42528. return $core.withContext(function($ctx1) {
  42529. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42530. return self;
  42531. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42532. },
  42533. args: ["aVisitor"],
  42534. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42535. referencedClasses: [],
  42536. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42537. }),
  42538. $globals.IRInlinedIfNilIfNotNil);
  42539. $core.addMethod(
  42540. $core.method({
  42541. selector: "internalVariables",
  42542. protocol: "accessing",
  42543. fn: function (){
  42544. var self=this,$self=this;
  42545. return $core.withContext(function($ctx1) {
  42546. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42547. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42548. },
  42549. args: [],
  42550. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42551. referencedClasses: ["Array"],
  42552. messageSends: ["with:", "receiverInternalVariable"]
  42553. }),
  42554. $globals.IRInlinedIfNilIfNotNil);
  42555. $core.addMethod(
  42556. $core.method({
  42557. selector: "receiverInternalVariable",
  42558. protocol: "accessing",
  42559. fn: function (){
  42560. var self=this,$self=this;
  42561. return $core.withContext(function($ctx1) {
  42562. var $1;
  42563. $1=$recv($globals.IRVariable)._new();
  42564. $ctx1.sendIdx["new"]=1;
  42565. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42566. return $recv($1)._yourself();
  42567. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42568. },
  42569. args: [],
  42570. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42571. referencedClasses: ["IRVariable", "AliasVar"],
  42572. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42573. }),
  42574. $globals.IRInlinedIfNilIfNotNil);
  42575. $core.addMethod(
  42576. $core.method({
  42577. selector: "receiverInternalVariableName",
  42578. protocol: "accessing",
  42579. fn: function (){
  42580. var self=this,$self=this;
  42581. return "$receiver";
  42582. },
  42583. args: [],
  42584. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42585. referencedClasses: [],
  42586. messageSends: []
  42587. }),
  42588. $globals.IRInlinedIfNilIfNotNil);
  42589. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42590. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42591. $core.addMethod(
  42592. $core.method({
  42593. selector: "acceptDagVisitor:",
  42594. protocol: "visiting",
  42595. fn: function (aVisitor){
  42596. var self=this,$self=this;
  42597. return $core.withContext(function($ctx1) {
  42598. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42599. return self;
  42600. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42601. },
  42602. args: ["aVisitor"],
  42603. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42604. referencedClasses: [],
  42605. messageSends: ["visitIRInlinedIfTrue:"]
  42606. }),
  42607. $globals.IRInlinedIfTrue);
  42608. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42609. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42610. $core.addMethod(
  42611. $core.method({
  42612. selector: "acceptDagVisitor:",
  42613. protocol: "visiting",
  42614. fn: function (aVisitor){
  42615. var self=this,$self=this;
  42616. return $core.withContext(function($ctx1) {
  42617. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42618. return self;
  42619. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42620. },
  42621. args: ["aVisitor"],
  42622. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  42623. referencedClasses: [],
  42624. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  42625. }),
  42626. $globals.IRInlinedIfTrueIfFalse);
  42627. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  42628. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  42629. $core.addMethod(
  42630. $core.method({
  42631. selector: "acceptDagVisitor:",
  42632. protocol: "visiting",
  42633. fn: function (aVisitor){
  42634. var self=this,$self=this;
  42635. return $core.withContext(function($ctx1) {
  42636. $recv(aVisitor)._visitIRInlinedSequence_(self);
  42637. return self;
  42638. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  42639. },
  42640. args: ["aVisitor"],
  42641. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  42642. referencedClasses: [],
  42643. messageSends: ["visitIRInlinedSequence:"]
  42644. }),
  42645. $globals.IRInlinedSequence);
  42646. $core.addMethod(
  42647. $core.method({
  42648. selector: "isInlined",
  42649. protocol: "testing",
  42650. fn: function (){
  42651. var self=this,$self=this;
  42652. return true;
  42653. },
  42654. args: [],
  42655. source: "isInlined\x0a\x09^ true",
  42656. referencedClasses: [],
  42657. messageSends: []
  42658. }),
  42659. $globals.IRInlinedSequence);
  42660. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  42661. $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`";
  42662. $core.addMethod(
  42663. $core.method({
  42664. selector: "assignmentInliner",
  42665. protocol: "factory",
  42666. fn: function (){
  42667. var self=this,$self=this;
  42668. return $core.withContext(function($ctx1) {
  42669. var $1;
  42670. $1=$recv($globals.IRAssignmentInliner)._new();
  42671. $recv($1)._translator_(self);
  42672. return $recv($1)._yourself();
  42673. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  42674. },
  42675. args: [],
  42676. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42677. referencedClasses: ["IRAssignmentInliner"],
  42678. messageSends: ["translator:", "new", "yourself"]
  42679. }),
  42680. $globals.IRInliner);
  42681. $core.addMethod(
  42682. $core.method({
  42683. selector: "returnInliner",
  42684. protocol: "factory",
  42685. fn: function (){
  42686. var self=this,$self=this;
  42687. return $core.withContext(function($ctx1) {
  42688. var $1;
  42689. $1=$recv($globals.IRReturnInliner)._new();
  42690. $recv($1)._translator_(self);
  42691. return $recv($1)._yourself();
  42692. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  42693. },
  42694. args: [],
  42695. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42696. referencedClasses: ["IRReturnInliner"],
  42697. messageSends: ["translator:", "new", "yourself"]
  42698. }),
  42699. $globals.IRInliner);
  42700. $core.addMethod(
  42701. $core.method({
  42702. selector: "sendInliner",
  42703. protocol: "factory",
  42704. fn: function (){
  42705. var self=this,$self=this;
  42706. return $core.withContext(function($ctx1) {
  42707. var $1;
  42708. $1=$recv($globals.IRSendInliner)._new();
  42709. $recv($1)._translator_(self);
  42710. return $recv($1)._yourself();
  42711. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  42712. },
  42713. args: [],
  42714. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42715. referencedClasses: ["IRSendInliner"],
  42716. messageSends: ["translator:", "new", "yourself"]
  42717. }),
  42718. $globals.IRInliner);
  42719. $core.addMethod(
  42720. $core.method({
  42721. selector: "shouldInlineAssignment:",
  42722. protocol: "testing",
  42723. fn: function (anIRAssignment){
  42724. var self=this,$self=this;
  42725. return $core.withContext(function($ctx1) {
  42726. var $3,$2,$1;
  42727. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  42728. return $core.withContext(function($ctx2) {
  42729. $3=$recv(anIRAssignment)._right();
  42730. $ctx2.sendIdx["right"]=1;
  42731. $2=$recv($3)._isSend();
  42732. return $recv($2)._and_((function(){
  42733. return $core.withContext(function($ctx3) {
  42734. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  42735. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42736. }));
  42737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42738. }));
  42739. $ctx1.sendIdx["and:"]=1;
  42740. return $1;
  42741. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42742. },
  42743. args: ["anIRAssignment"],
  42744. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  42745. referencedClasses: [],
  42746. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  42747. }),
  42748. $globals.IRInliner);
  42749. $core.addMethod(
  42750. $core.method({
  42751. selector: "shouldInlineReturn:",
  42752. protocol: "testing",
  42753. fn: function (anIRReturn){
  42754. var self=this,$self=this;
  42755. return $core.withContext(function($ctx1) {
  42756. var $3,$2,$1;
  42757. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  42758. return $core.withContext(function($ctx2) {
  42759. $3=$recv(anIRReturn)._expression();
  42760. $ctx2.sendIdx["expression"]=1;
  42761. $2=$recv($3)._isSend();
  42762. return $recv($2)._and_((function(){
  42763. return $core.withContext(function($ctx3) {
  42764. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  42765. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42766. }));
  42767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42768. }));
  42769. $ctx1.sendIdx["and:"]=1;
  42770. return $1;
  42771. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42772. },
  42773. args: ["anIRReturn"],
  42774. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  42775. referencedClasses: [],
  42776. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  42777. }),
  42778. $globals.IRInliner);
  42779. $core.addMethod(
  42780. $core.method({
  42781. selector: "shouldInlineSend:",
  42782. protocol: "testing",
  42783. fn: function (anIRSend){
  42784. var self=this,$self=this;
  42785. return $core.withContext(function($ctx1) {
  42786. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  42787. return $core.withContext(function($ctx2) {
  42788. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  42789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42790. }));
  42791. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42792. },
  42793. args: ["anIRSend"],
  42794. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  42795. referencedClasses: ["IRSendInliner"],
  42796. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  42797. }),
  42798. $globals.IRInliner);
  42799. $core.addMethod(
  42800. $core.method({
  42801. selector: "visitIRAssignment:",
  42802. protocol: "visiting",
  42803. fn: function (anIRAssignment){
  42804. var self=this,$self=this;
  42805. return $core.withContext(function($ctx1) {
  42806. var $1;
  42807. $1=$self._shouldInlineAssignment_(anIRAssignment);
  42808. if($core.assert($1)){
  42809. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  42810. } else {
  42811. return (
  42812. $ctx1.supercall = true,
  42813. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  42814. $ctx1.supercall = false;
  42815. }
  42816. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42817. },
  42818. args: ["anIRAssignment"],
  42819. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  42820. referencedClasses: [],
  42821. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  42822. }),
  42823. $globals.IRInliner);
  42824. $core.addMethod(
  42825. $core.method({
  42826. selector: "visitIRNonLocalReturn:",
  42827. protocol: "visiting",
  42828. fn: function (anIRNonLocalReturn){
  42829. var self=this,$self=this;
  42830. var localReturn;
  42831. return $core.withContext(function($ctx1) {
  42832. var $2,$1,$4,$3,$5,$6,$7;
  42833. $2=$recv(anIRNonLocalReturn)._scope();
  42834. $ctx1.sendIdx["scope"]=1;
  42835. $1=$recv($2)._canInlineNonLocalReturns();
  42836. if($core.assert($1)){
  42837. $4=$recv(anIRNonLocalReturn)._scope();
  42838. $ctx1.sendIdx["scope"]=2;
  42839. $3=$recv($4)._methodScope();
  42840. $5=$recv(anIRNonLocalReturn)._scope();
  42841. $ctx1.sendIdx["scope"]=3;
  42842. $recv($3)._removeNonLocalReturn_($5);
  42843. $6=$recv($globals.IRReturn)._new();
  42844. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  42845. localReturn=$recv($6)._yourself();
  42846. localReturn;
  42847. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  42848. return $core.withContext(function($ctx2) {
  42849. return $recv(localReturn)._add_(each);
  42850. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42851. }));
  42852. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  42853. return $self._visitIRReturn_(localReturn);
  42854. }
  42855. $7=(
  42856. $ctx1.supercall = true,
  42857. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  42858. $ctx1.supercall = false;
  42859. return $7;
  42860. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  42861. },
  42862. args: ["anIRNonLocalReturn"],
  42863. 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",
  42864. referencedClasses: ["IRReturn"],
  42865. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  42866. }),
  42867. $globals.IRInliner);
  42868. $core.addMethod(
  42869. $core.method({
  42870. selector: "visitIRReturn:",
  42871. protocol: "visiting",
  42872. fn: function (anIRReturn){
  42873. var self=this,$self=this;
  42874. return $core.withContext(function($ctx1) {
  42875. var $1;
  42876. $1=$self._shouldInlineReturn_(anIRReturn);
  42877. if($core.assert($1)){
  42878. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  42879. } else {
  42880. return (
  42881. $ctx1.supercall = true,
  42882. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  42883. $ctx1.supercall = false;
  42884. }
  42885. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42886. },
  42887. args: ["anIRReturn"],
  42888. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  42889. referencedClasses: [],
  42890. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  42891. }),
  42892. $globals.IRInliner);
  42893. $core.addMethod(
  42894. $core.method({
  42895. selector: "visitIRSend:",
  42896. protocol: "visiting",
  42897. fn: function (anIRSend){
  42898. var self=this,$self=this;
  42899. return $core.withContext(function($ctx1) {
  42900. var $1;
  42901. $1=$self._shouldInlineSend_(anIRSend);
  42902. if($core.assert($1)){
  42903. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  42904. } else {
  42905. return (
  42906. $ctx1.supercall = true,
  42907. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  42908. $ctx1.supercall = false;
  42909. }
  42910. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42911. },
  42912. args: ["anIRSend"],
  42913. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  42914. referencedClasses: [],
  42915. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  42916. }),
  42917. $globals.IRInliner);
  42918. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  42919. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  42920. $core.addMethod(
  42921. $core.method({
  42922. selector: "visitIRInlinedClosure:",
  42923. protocol: "visiting",
  42924. fn: function (anIRInlinedClosure){
  42925. var self=this,$self=this;
  42926. return $core.withContext(function($ctx1) {
  42927. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  42928. return $core.withContext(function($ctx2) {
  42929. return $recv($recv(each)._name())._asVariableName();
  42930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42931. })));
  42932. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  42933. return self;
  42934. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  42935. },
  42936. args: ["anIRInlinedClosure"],
  42937. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  42938. referencedClasses: [],
  42939. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  42940. }),
  42941. $globals.IRInliningJSTranslator);
  42942. $core.addMethod(
  42943. $core.method({
  42944. selector: "visitIRInlinedIfFalse:",
  42945. protocol: "visiting",
  42946. fn: function (anIRInlinedIfFalse){
  42947. var self=this,$self=this;
  42948. return $core.withContext(function($ctx1) {
  42949. var $1,$2,$4,$3;
  42950. $1=$self._stream();
  42951. $ctx1.sendIdx["stream"]=1;
  42952. $recv($1)._nextPutIf_then_((function(){
  42953. return $core.withContext(function($ctx2) {
  42954. $2=$self._stream();
  42955. $ctx2.sendIdx["stream"]=2;
  42956. $recv($2)._nextPutAll_("!$core.assert(");
  42957. $ctx2.sendIdx["nextPutAll:"]=1;
  42958. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  42959. $ctx2.sendIdx["dagChildren"]=1;
  42960. $3=$recv($4)._first();
  42961. $self._visit_($3);
  42962. $ctx2.sendIdx["visit:"]=1;
  42963. return $recv($self._stream())._nextPutAll_(")");
  42964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42965. }),(function(){
  42966. return $core.withContext(function($ctx2) {
  42967. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  42968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42969. }));
  42970. return self;
  42971. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  42972. },
  42973. args: ["anIRInlinedIfFalse"],
  42974. 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 ]",
  42975. referencedClasses: [],
  42976. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  42977. }),
  42978. $globals.IRInliningJSTranslator);
  42979. $core.addMethod(
  42980. $core.method({
  42981. selector: "visitIRInlinedIfNilIfNotNil:",
  42982. protocol: "visiting",
  42983. fn: function (anIRInlinedIfNilIfNotNil){
  42984. var self=this,$self=this;
  42985. return $core.withContext(function($ctx1) {
  42986. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  42987. $1=$self._stream();
  42988. $ctx1.sendIdx["stream"]=1;
  42989. $recv($1)._nextPutIf_then_else_((function(){
  42990. var recvVarName;
  42991. return $core.withContext(function($ctx2) {
  42992. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  42993. recvVarName;
  42994. $2=$self._stream();
  42995. $ctx2.sendIdx["stream"]=2;
  42996. $4="(".__comma(recvVarName);
  42997. $ctx2.sendIdx[","]=2;
  42998. $3=$recv($4).__comma(" = ");
  42999. $ctx2.sendIdx[","]=1;
  43000. $recv($2)._nextPutAll_($3);
  43001. $ctx2.sendIdx["nextPutAll:"]=1;
  43002. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43003. $ctx2.sendIdx["dagChildren"]=1;
  43004. $5=$recv($6)._first();
  43005. $self._visit_($5);
  43006. $ctx2.sendIdx["visit:"]=1;
  43007. $7=$self._stream();
  43008. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43009. $ctx2.sendIdx[","]=3;
  43010. return $recv($7)._nextPutAll_($8);
  43011. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43012. }),(function(){
  43013. return $core.withContext(function($ctx2) {
  43014. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43015. $ctx2.sendIdx["dagChildren"]=2;
  43016. $9=$recv($10)._second();
  43017. return $self._visit_($9);
  43018. $ctx2.sendIdx["visit:"]=2;
  43019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43020. }),(function(){
  43021. return $core.withContext(function($ctx2) {
  43022. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43024. }));
  43025. return self;
  43026. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43027. },
  43028. args: ["anIRInlinedIfNilIfNotNil"],
  43029. 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 ]",
  43030. referencedClasses: [],
  43031. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43032. }),
  43033. $globals.IRInliningJSTranslator);
  43034. $core.addMethod(
  43035. $core.method({
  43036. selector: "visitIRInlinedIfTrue:",
  43037. protocol: "visiting",
  43038. fn: function (anIRInlinedIfTrue){
  43039. var self=this,$self=this;
  43040. return $core.withContext(function($ctx1) {
  43041. var $1,$2,$4,$3;
  43042. $1=$self._stream();
  43043. $ctx1.sendIdx["stream"]=1;
  43044. $recv($1)._nextPutIf_then_((function(){
  43045. return $core.withContext(function($ctx2) {
  43046. $2=$self._stream();
  43047. $ctx2.sendIdx["stream"]=2;
  43048. $recv($2)._nextPutAll_("$core.assert(");
  43049. $ctx2.sendIdx["nextPutAll:"]=1;
  43050. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43051. $ctx2.sendIdx["dagChildren"]=1;
  43052. $3=$recv($4)._first();
  43053. $self._visit_($3);
  43054. $ctx2.sendIdx["visit:"]=1;
  43055. return $recv($self._stream())._nextPutAll_(")");
  43056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43057. }),(function(){
  43058. return $core.withContext(function($ctx2) {
  43059. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43061. }));
  43062. return self;
  43063. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43064. },
  43065. args: ["anIRInlinedIfTrue"],
  43066. 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 ]",
  43067. referencedClasses: [],
  43068. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43069. }),
  43070. $globals.IRInliningJSTranslator);
  43071. $core.addMethod(
  43072. $core.method({
  43073. selector: "visitIRInlinedIfTrueIfFalse:",
  43074. protocol: "visiting",
  43075. fn: function (anIRInlinedIfTrueIfFalse){
  43076. var self=this,$self=this;
  43077. return $core.withContext(function($ctx1) {
  43078. var $1,$2,$4,$3,$6,$5;
  43079. $1=$self._stream();
  43080. $ctx1.sendIdx["stream"]=1;
  43081. $recv($1)._nextPutIf_then_else_((function(){
  43082. return $core.withContext(function($ctx2) {
  43083. $2=$self._stream();
  43084. $ctx2.sendIdx["stream"]=2;
  43085. $recv($2)._nextPutAll_("$core.assert(");
  43086. $ctx2.sendIdx["nextPutAll:"]=1;
  43087. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43088. $ctx2.sendIdx["dagChildren"]=1;
  43089. $3=$recv($4)._first();
  43090. $self._visit_($3);
  43091. $ctx2.sendIdx["visit:"]=1;
  43092. return $recv($self._stream())._nextPutAll_(")");
  43093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43094. }),(function(){
  43095. return $core.withContext(function($ctx2) {
  43096. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43097. $ctx2.sendIdx["dagChildren"]=2;
  43098. $5=$recv($6)._second();
  43099. return $self._visit_($5);
  43100. $ctx2.sendIdx["visit:"]=2;
  43101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43102. }),(function(){
  43103. return $core.withContext(function($ctx2) {
  43104. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43106. }));
  43107. return self;
  43108. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43109. },
  43110. args: ["anIRInlinedIfTrueIfFalse"],
  43111. 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 ]",
  43112. referencedClasses: [],
  43113. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43114. }),
  43115. $globals.IRInliningJSTranslator);
  43116. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43117. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43118. $core.addMethod(
  43119. $core.method({
  43120. selector: "ifFalse:",
  43121. protocol: "inlining",
  43122. fn: function (anIRInstruction){
  43123. var self=this,$self=this;
  43124. return $core.withContext(function($ctx1) {
  43125. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43126. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43127. },
  43128. args: ["anIRInstruction"],
  43129. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43130. referencedClasses: ["IRInlinedIfFalse"],
  43131. messageSends: ["inlinedSend:withBlock:", "new"]
  43132. }),
  43133. $globals.IRSendInliner);
  43134. $core.addMethod(
  43135. $core.method({
  43136. selector: "ifFalse:ifTrue:",
  43137. protocol: "inlining",
  43138. fn: function (anIRInstruction,anotherIRInstruction){
  43139. var self=this,$self=this;
  43140. return $core.withContext(function($ctx1) {
  43141. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43142. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43143. },
  43144. args: ["anIRInstruction", "anotherIRInstruction"],
  43145. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43146. referencedClasses: [],
  43147. messageSends: ["perform:withArguments:"]
  43148. }),
  43149. $globals.IRSendInliner);
  43150. $core.addMethod(
  43151. $core.method({
  43152. selector: "ifNil:",
  43153. protocol: "inlining",
  43154. fn: function (anIRInstruction){
  43155. var self=this,$self=this;
  43156. return $core.withContext(function($ctx1) {
  43157. var $1,$3,$5,$6,$4,$2;
  43158. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43159. $ctx1.sendIdx["new"]=1;
  43160. $3=$recv($globals.IRClosure)._new();
  43161. $ctx1.sendIdx["new"]=2;
  43162. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43163. $5=$recv($globals.IRBlockSequence)._new();
  43164. $recv($5)._add_($recv($self._send())._receiver());
  43165. $6=$recv($5)._yourself();
  43166. $ctx1.sendIdx["yourself"]=1;
  43167. $4=$6;
  43168. $recv($3)._add_($4);
  43169. $ctx1.sendIdx["add:"]=1;
  43170. $2=$recv($3)._yourself();
  43171. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43172. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43173. },
  43174. args: ["anIRInstruction"],
  43175. 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)",
  43176. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43177. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43178. }),
  43179. $globals.IRSendInliner);
  43180. $core.addMethod(
  43181. $core.method({
  43182. selector: "ifNil:ifNotNil:",
  43183. protocol: "inlining",
  43184. fn: function (anIRInstruction,anotherIRInstruction){
  43185. var self=this,$self=this;
  43186. return $core.withContext(function($ctx1) {
  43187. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43188. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43189. },
  43190. args: ["anIRInstruction", "anotherIRInstruction"],
  43191. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43192. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43193. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43194. }),
  43195. $globals.IRSendInliner);
  43196. $core.addMethod(
  43197. $core.method({
  43198. selector: "ifNotNil:",
  43199. protocol: "inlining",
  43200. fn: function (anIRInstruction){
  43201. var self=this,$self=this;
  43202. return $core.withContext(function($ctx1) {
  43203. var $1,$3,$5,$6,$4,$2;
  43204. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43205. $ctx1.sendIdx["new"]=1;
  43206. $3=$recv($globals.IRClosure)._new();
  43207. $ctx1.sendIdx["new"]=2;
  43208. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43209. $5=$recv($globals.IRBlockSequence)._new();
  43210. $recv($5)._add_($recv($self._send())._receiver());
  43211. $6=$recv($5)._yourself();
  43212. $ctx1.sendIdx["yourself"]=1;
  43213. $4=$6;
  43214. $recv($3)._add_($4);
  43215. $ctx1.sendIdx["add:"]=1;
  43216. $2=$recv($3)._yourself();
  43217. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43218. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43219. },
  43220. args: ["anIRInstruction"],
  43221. 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",
  43222. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43223. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43224. }),
  43225. $globals.IRSendInliner);
  43226. $core.addMethod(
  43227. $core.method({
  43228. selector: "ifNotNil:ifNil:",
  43229. protocol: "inlining",
  43230. fn: function (anIRInstruction,anotherIRInstruction){
  43231. var self=this,$self=this;
  43232. return $core.withContext(function($ctx1) {
  43233. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43234. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43235. },
  43236. args: ["anIRInstruction", "anotherIRInstruction"],
  43237. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43238. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43239. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43240. }),
  43241. $globals.IRSendInliner);
  43242. $core.addMethod(
  43243. $core.method({
  43244. selector: "ifTrue:",
  43245. protocol: "inlining",
  43246. fn: function (anIRInstruction){
  43247. var self=this,$self=this;
  43248. return $core.withContext(function($ctx1) {
  43249. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43250. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43251. },
  43252. args: ["anIRInstruction"],
  43253. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43254. referencedClasses: ["IRInlinedIfTrue"],
  43255. messageSends: ["inlinedSend:withBlock:", "new"]
  43256. }),
  43257. $globals.IRSendInliner);
  43258. $core.addMethod(
  43259. $core.method({
  43260. selector: "ifTrue:ifFalse:",
  43261. protocol: "inlining",
  43262. fn: function (anIRInstruction,anotherIRInstruction){
  43263. var self=this,$self=this;
  43264. return $core.withContext(function($ctx1) {
  43265. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43266. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43267. },
  43268. args: ["anIRInstruction", "anotherIRInstruction"],
  43269. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43270. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43271. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43272. }),
  43273. $globals.IRSendInliner);
  43274. $core.addMethod(
  43275. $core.method({
  43276. selector: "inlineClosure:",
  43277. protocol: "inlining",
  43278. fn: function (anIRClosure){
  43279. var self=this,$self=this;
  43280. var inlinedClosure,sequence,statements;
  43281. return $core.withContext(function($ctx1) {
  43282. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43283. inlinedClosure=$self._inlinedClosure();
  43284. $1=inlinedClosure;
  43285. $2=$recv(anIRClosure)._scope();
  43286. $ctx1.sendIdx["scope"]=1;
  43287. $recv($1)._scope_($2);
  43288. $ctx1.sendIdx["scope:"]=1;
  43289. $recv($1)._parent_($recv(anIRClosure)._parent());
  43290. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43291. return $core.withContext(function($ctx2) {
  43292. return $recv(inlinedClosure)._add_(each);
  43293. $ctx2.sendIdx["add:"]=1;
  43294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43295. }));
  43296. $ctx1.sendIdx["do:"]=1;
  43297. sequence=$self._inlinedSequence();
  43298. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43299. return $core.withContext(function($ctx2) {
  43300. $3=inlinedClosure;
  43301. $5=$recv($globals.IRTempDeclaration)._new();
  43302. $ctx2.sendIdx["new"]=1;
  43303. $recv($5)._name_(each);
  43304. $ctx2.sendIdx["name:"]=1;
  43305. $6=$recv($5)._yourself();
  43306. $ctx2.sendIdx["yourself"]=1;
  43307. $4=$6;
  43308. $recv($3)._add_($4);
  43309. $ctx2.sendIdx["add:"]=2;
  43310. $7=sequence;
  43311. $9=$recv($globals.IRAssignment)._new();
  43312. $ctx2.sendIdx["new"]=2;
  43313. $11=$recv($globals.IRVariable)._new();
  43314. $ctx2.sendIdx["new"]=3;
  43315. $13=$recv($globals.AliasVar)._new();
  43316. $ctx2.sendIdx["new"]=4;
  43317. $14=$recv(inlinedClosure)._scope();
  43318. $ctx2.sendIdx["scope"]=2;
  43319. $recv($13)._scope_($14);
  43320. $ctx2.sendIdx["scope:"]=2;
  43321. $recv($13)._name_(each);
  43322. $ctx2.sendIdx["name:"]=2;
  43323. $15=$recv($13)._yourself();
  43324. $ctx2.sendIdx["yourself"]=2;
  43325. $12=$15;
  43326. $10=$recv($11)._variable_($12);
  43327. $ctx2.sendIdx["variable:"]=1;
  43328. $recv($9)._add_($10);
  43329. $ctx2.sendIdx["add:"]=4;
  43330. $17=$recv($globals.IRVariable)._new();
  43331. $ctx2.sendIdx["new"]=5;
  43332. $19=$recv($globals.AliasVar)._new();
  43333. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43334. $recv($19)._name_("$receiver");
  43335. $20=$recv($19)._yourself();
  43336. $ctx2.sendIdx["yourself"]=3;
  43337. $18=$20;
  43338. $16=$recv($17)._variable_($18);
  43339. $recv($9)._add_($16);
  43340. $ctx2.sendIdx["add:"]=5;
  43341. $8=$recv($9)._yourself();
  43342. return $recv($7)._add_($8);
  43343. $ctx2.sendIdx["add:"]=3;
  43344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43345. }));
  43346. $ctx1.sendIdx["do:"]=2;
  43347. $recv(inlinedClosure)._add_(sequence);
  43348. $ctx1.sendIdx["add:"]=6;
  43349. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43350. $recv(statements)._ifNotEmpty_((function(){
  43351. return $core.withContext(function($ctx2) {
  43352. $recv($recv(statements)._allButLast())._do_((function(each){
  43353. return $core.withContext(function($ctx3) {
  43354. return $recv(sequence)._add_(each);
  43355. $ctx3.sendIdx["add:"]=7;
  43356. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43357. }));
  43358. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43360. }));
  43361. return inlinedClosure;
  43362. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43363. },
  43364. args: ["anIRClosure"],
  43365. 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",
  43366. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43367. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43368. }),
  43369. $globals.IRSendInliner);
  43370. $core.addMethod(
  43371. $core.method({
  43372. selector: "inlineSend:",
  43373. protocol: "inlining",
  43374. fn: function (anIRSend){
  43375. var self=this,$self=this;
  43376. return $core.withContext(function($ctx1) {
  43377. var $2,$1;
  43378. $self._send_(anIRSend);
  43379. $2=$self._send();
  43380. $ctx1.sendIdx["send"]=1;
  43381. $1=$recv($2)._selector();
  43382. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43383. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43384. },
  43385. args: ["anIRSend"],
  43386. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43387. referencedClasses: [],
  43388. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43389. }),
  43390. $globals.IRSendInliner);
  43391. $core.addMethod(
  43392. $core.method({
  43393. selector: "inlineSend:andReplace:",
  43394. protocol: "private",
  43395. fn: function (anIRSend,anIRInstruction){
  43396. var self=this,$self=this;
  43397. return $core.withContext(function($ctx1) {
  43398. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43399. return $self._inlineSend_(anIRSend);
  43400. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43401. },
  43402. args: ["anIRSend", "anIRInstruction"],
  43403. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43404. referencedClasses: [],
  43405. messageSends: ["replaceWith:", "inlineSend:"]
  43406. }),
  43407. $globals.IRSendInliner);
  43408. $core.addMethod(
  43409. $core.method({
  43410. selector: "inlinedClosure",
  43411. protocol: "factory",
  43412. fn: function (){
  43413. var self=this,$self=this;
  43414. return $core.withContext(function($ctx1) {
  43415. return $recv($globals.IRInlinedClosure)._new();
  43416. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43417. },
  43418. args: [],
  43419. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43420. referencedClasses: ["IRInlinedClosure"],
  43421. messageSends: ["new"]
  43422. }),
  43423. $globals.IRSendInliner);
  43424. $core.addMethod(
  43425. $core.method({
  43426. selector: "inlinedSend:withBlock:",
  43427. protocol: "private",
  43428. fn: function (inlinedSend,anIRInstruction){
  43429. var self=this,$self=this;
  43430. var inlinedClosure;
  43431. return $core.withContext(function($ctx1) {
  43432. var $1,$2,$4,$3,$5;
  43433. $1=$recv(anIRInstruction)._isClosure();
  43434. if(!$core.assert($1)){
  43435. $self._inliningError_("Message argument should be a block");
  43436. $ctx1.sendIdx["inliningError:"]=1;
  43437. }
  43438. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43439. if(!$core.assert($2)){
  43440. $self._inliningError_("Inlined block should have zero argument");
  43441. }
  43442. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43443. $4=$self._send();
  43444. $ctx1.sendIdx["send"]=1;
  43445. $3=$recv($4)._receiver();
  43446. $recv(inlinedSend)._add_($3);
  43447. $ctx1.sendIdx["add:"]=1;
  43448. $recv(inlinedSend)._add_(inlinedClosure);
  43449. $recv($self._send())._replaceWith_(inlinedSend);
  43450. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43451. $ctx1.sendIdx["internalVariables"]=1;
  43452. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43453. return inlinedSend;
  43454. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43455. },
  43456. args: ["inlinedSend", "anIRInstruction"],
  43457. 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",
  43458. referencedClasses: [],
  43459. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43460. }),
  43461. $globals.IRSendInliner);
  43462. $core.addMethod(
  43463. $core.method({
  43464. selector: "inlinedSend:withBlock:withBlock:",
  43465. protocol: "private",
  43466. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43467. var self=this,$self=this;
  43468. var inlinedClosure1,inlinedClosure2;
  43469. return $core.withContext(function($ctx1) {
  43470. var $1,$2,$3,$4,$6,$5,$7;
  43471. $1=$recv(anIRInstruction)._isClosure();
  43472. $ctx1.sendIdx["isClosure"]=1;
  43473. if(!$core.assert($1)){
  43474. $self._inliningError_("Message argument should be a block");
  43475. $ctx1.sendIdx["inliningError:"]=1;
  43476. }
  43477. $2=$recv(anotherIRInstruction)._isClosure();
  43478. if(!$core.assert($2)){
  43479. $self._inliningError_("Message argument should be a block");
  43480. }
  43481. $3=$self._translator();
  43482. $ctx1.sendIdx["translator"]=1;
  43483. $4=$self._inlineClosure_(anIRInstruction);
  43484. $ctx1.sendIdx["inlineClosure:"]=1;
  43485. inlinedClosure1=$recv($3)._visit_($4);
  43486. $ctx1.sendIdx["visit:"]=1;
  43487. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43488. $6=$self._send();
  43489. $ctx1.sendIdx["send"]=1;
  43490. $5=$recv($6)._receiver();
  43491. $recv(inlinedSend)._add_($5);
  43492. $ctx1.sendIdx["add:"]=1;
  43493. $recv(inlinedSend)._add_(inlinedClosure1);
  43494. $ctx1.sendIdx["add:"]=2;
  43495. $recv(inlinedSend)._add_(inlinedClosure2);
  43496. $recv($self._send())._replaceWith_(inlinedSend);
  43497. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43498. $ctx1.sendIdx["internalVariables"]=1;
  43499. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43500. return inlinedSend;
  43501. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43502. },
  43503. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43504. 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",
  43505. referencedClasses: [],
  43506. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43507. }),
  43508. $globals.IRSendInliner);
  43509. $core.addMethod(
  43510. $core.method({
  43511. selector: "inlinedSequence",
  43512. protocol: "factory",
  43513. fn: function (){
  43514. var self=this,$self=this;
  43515. return $core.withContext(function($ctx1) {
  43516. return $recv($globals.IRInlinedSequence)._new();
  43517. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43518. },
  43519. args: [],
  43520. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43521. referencedClasses: ["IRInlinedSequence"],
  43522. messageSends: ["new"]
  43523. }),
  43524. $globals.IRSendInliner);
  43525. $core.addMethod(
  43526. $core.method({
  43527. selector: "inliningError:",
  43528. protocol: "error handling",
  43529. fn: function (aString){
  43530. var self=this,$self=this;
  43531. return $core.withContext(function($ctx1) {
  43532. $recv($globals.InliningError)._signal_(aString);
  43533. return self;
  43534. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43535. },
  43536. args: ["aString"],
  43537. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43538. referencedClasses: ["InliningError"],
  43539. messageSends: ["signal:"]
  43540. }),
  43541. $globals.IRSendInliner);
  43542. $core.addMethod(
  43543. $core.method({
  43544. selector: "send",
  43545. protocol: "accessing",
  43546. fn: function (){
  43547. var self=this,$self=this;
  43548. return $self["@send"];
  43549. },
  43550. args: [],
  43551. source: "send\x0a\x09^ send",
  43552. referencedClasses: [],
  43553. messageSends: []
  43554. }),
  43555. $globals.IRSendInliner);
  43556. $core.addMethod(
  43557. $core.method({
  43558. selector: "send:",
  43559. protocol: "accessing",
  43560. fn: function (anIRSend){
  43561. var self=this,$self=this;
  43562. $self["@send"]=anIRSend;
  43563. return self;
  43564. },
  43565. args: ["anIRSend"],
  43566. source: "send: anIRSend\x0a\x09send := anIRSend",
  43567. referencedClasses: [],
  43568. messageSends: []
  43569. }),
  43570. $globals.IRSendInliner);
  43571. $core.addMethod(
  43572. $core.method({
  43573. selector: "translator",
  43574. protocol: "accessing",
  43575. fn: function (){
  43576. var self=this,$self=this;
  43577. return $self["@translator"];
  43578. },
  43579. args: [],
  43580. source: "translator\x0a\x09^ translator",
  43581. referencedClasses: [],
  43582. messageSends: []
  43583. }),
  43584. $globals.IRSendInliner);
  43585. $core.addMethod(
  43586. $core.method({
  43587. selector: "translator:",
  43588. protocol: "accessing",
  43589. fn: function (anASTTranslator){
  43590. var self=this,$self=this;
  43591. $self["@translator"]=anASTTranslator;
  43592. return self;
  43593. },
  43594. args: ["anASTTranslator"],
  43595. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43596. referencedClasses: [],
  43597. messageSends: []
  43598. }),
  43599. $globals.IRSendInliner);
  43600. $core.addMethod(
  43601. $core.method({
  43602. selector: "inlinedSelectors",
  43603. protocol: "accessing",
  43604. fn: function (){
  43605. var self=this,$self=this;
  43606. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43607. },
  43608. args: [],
  43609. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43610. referencedClasses: [],
  43611. messageSends: []
  43612. }),
  43613. $globals.IRSendInliner.a$cls);
  43614. $core.addMethod(
  43615. $core.method({
  43616. selector: "shouldInline:",
  43617. protocol: "accessing",
  43618. fn: function (anIRSend){
  43619. var self=this,$self=this;
  43620. return $core.withContext(function($ctx1) {
  43621. var $1;
  43622. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43623. if(!$core.assert($1)){
  43624. return false;
  43625. }
  43626. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  43627. return $core.withContext(function($ctx2) {
  43628. return $recv(each)._isClosure();
  43629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43630. }));
  43631. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  43632. },
  43633. args: ["anIRSend"],
  43634. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  43635. referencedClasses: [],
  43636. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  43637. }),
  43638. $globals.IRSendInliner.a$cls);
  43639. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  43640. $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};";
  43641. $core.addMethod(
  43642. $core.method({
  43643. selector: "inlineAssignment:",
  43644. protocol: "inlining",
  43645. fn: function (anIRAssignment){
  43646. var self=this,$self=this;
  43647. return $core.withContext(function($ctx1) {
  43648. $self._target_($recv(anIRAssignment)._left());
  43649. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  43650. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  43651. },
  43652. args: ["anIRAssignment"],
  43653. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  43654. referencedClasses: [],
  43655. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  43656. }),
  43657. $globals.IRAssignmentInliner);
  43658. $core.addMethod(
  43659. $core.method({
  43660. selector: "inlineClosure:",
  43661. protocol: "inlining",
  43662. fn: function (anIRClosure){
  43663. var self=this,$self=this;
  43664. var closure,sequence,statements;
  43665. return $core.withContext(function($ctx1) {
  43666. var $1,$2,$3,$5,$4;
  43667. closure=(
  43668. $ctx1.supercall = true,
  43669. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43670. $ctx1.supercall = false;
  43671. sequence=$recv(closure)._sequence();
  43672. statements=$recv(sequence)._dagChildren();
  43673. $recv(statements)._ifNotEmpty_((function(){
  43674. var final;
  43675. return $core.withContext(function($ctx2) {
  43676. final=$recv(statements)._last();
  43677. final;
  43678. $1=$recv(final)._yieldsValue();
  43679. if($core.assert($1)){
  43680. $2=sequence;
  43681. $3=final;
  43682. $5=$recv($globals.IRAssignment)._new();
  43683. $recv($5)._add_($self._target());
  43684. $ctx2.sendIdx["add:"]=1;
  43685. $recv($5)._add_($recv(final)._copy());
  43686. $4=$recv($5)._yourself();
  43687. return $recv($2)._replace_with_($3,$4);
  43688. }
  43689. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43690. }));
  43691. return closure;
  43692. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  43693. },
  43694. args: ["anIRClosure"],
  43695. 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",
  43696. referencedClasses: ["IRAssignment"],
  43697. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  43698. }),
  43699. $globals.IRAssignmentInliner);
  43700. $core.addMethod(
  43701. $core.method({
  43702. selector: "target",
  43703. protocol: "accessing",
  43704. fn: function (){
  43705. var self=this,$self=this;
  43706. return $self["@target"];
  43707. },
  43708. args: [],
  43709. source: "target\x0a\x09^ target",
  43710. referencedClasses: [],
  43711. messageSends: []
  43712. }),
  43713. $globals.IRAssignmentInliner);
  43714. $core.addMethod(
  43715. $core.method({
  43716. selector: "target:",
  43717. protocol: "accessing",
  43718. fn: function (anObject){
  43719. var self=this,$self=this;
  43720. $self["@target"]=anObject;
  43721. return self;
  43722. },
  43723. args: ["anObject"],
  43724. source: "target: anObject\x0a\x09target := anObject",
  43725. referencedClasses: [],
  43726. messageSends: []
  43727. }),
  43728. $globals.IRAssignmentInliner);
  43729. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  43730. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  43731. $core.addMethod(
  43732. $core.method({
  43733. selector: "inlineClosure:",
  43734. protocol: "inlining",
  43735. fn: function (anIRClosure){
  43736. var self=this,$self=this;
  43737. var closure,sequence,statements;
  43738. return $core.withContext(function($ctx1) {
  43739. var $1,$2,$3,$5,$4;
  43740. closure=(
  43741. $ctx1.supercall = true,
  43742. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43743. $ctx1.supercall = false;
  43744. sequence=$recv(closure)._sequence();
  43745. statements=$recv(sequence)._dagChildren();
  43746. $recv(statements)._ifNotEmpty_((function(){
  43747. var final;
  43748. return $core.withContext(function($ctx2) {
  43749. final=$recv(statements)._last();
  43750. final;
  43751. $1=$recv(final)._yieldsValue();
  43752. if($core.assert($1)){
  43753. $2=sequence;
  43754. $3=final;
  43755. $5=$recv($globals.IRReturn)._new();
  43756. $recv($5)._add_($recv(final)._copy());
  43757. $4=$recv($5)._yourself();
  43758. return $recv($2)._replace_with_($3,$4);
  43759. }
  43760. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43761. }));
  43762. return closure;
  43763. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  43764. },
  43765. args: ["anIRClosure"],
  43766. 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",
  43767. referencedClasses: ["IRReturn"],
  43768. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  43769. }),
  43770. $globals.IRReturnInliner);
  43771. $core.addMethod(
  43772. $core.method({
  43773. selector: "inlineReturn:",
  43774. protocol: "inlining",
  43775. fn: function (anIRReturn){
  43776. var self=this,$self=this;
  43777. return $core.withContext(function($ctx1) {
  43778. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  43779. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  43780. },
  43781. args: ["anIRReturn"],
  43782. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  43783. referencedClasses: [],
  43784. messageSends: ["inlineSend:andReplace:", "expression"]
  43785. }),
  43786. $globals.IRReturnInliner);
  43787. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  43788. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  43789. $core.addMethod(
  43790. $core.method({
  43791. selector: "inliner",
  43792. protocol: "compiling",
  43793. fn: function (){
  43794. var self=this,$self=this;
  43795. return $core.withContext(function($ctx1) {
  43796. return $recv($globals.IRInliner)._new();
  43797. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  43798. },
  43799. args: [],
  43800. source: "inliner\x0a\x09^ IRInliner new",
  43801. referencedClasses: ["IRInliner"],
  43802. messageSends: ["new"]
  43803. }),
  43804. $globals.InliningCodeGenerator);
  43805. $core.addMethod(
  43806. $core.method({
  43807. selector: "irTranslatorClass",
  43808. protocol: "compiling",
  43809. fn: function (){
  43810. var self=this,$self=this;
  43811. return $globals.IRInliningJSTranslator;
  43812. },
  43813. args: [],
  43814. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  43815. referencedClasses: ["IRInliningJSTranslator"],
  43816. messageSends: []
  43817. }),
  43818. $globals.InliningCodeGenerator);
  43819. $core.addMethod(
  43820. $core.method({
  43821. selector: "preInliner",
  43822. protocol: "compiling",
  43823. fn: function (){
  43824. var self=this,$self=this;
  43825. return $core.withContext(function($ctx1) {
  43826. return $recv($globals.ASTPreInliner)._new();
  43827. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  43828. },
  43829. args: [],
  43830. source: "preInliner\x0a\x09^ ASTPreInliner new",
  43831. referencedClasses: ["ASTPreInliner"],
  43832. messageSends: ["new"]
  43833. }),
  43834. $globals.InliningCodeGenerator);
  43835. $core.addMethod(
  43836. $core.method({
  43837. selector: "transformersDictionary",
  43838. protocol: "compiling",
  43839. fn: function (){
  43840. var self=this,$self=this;
  43841. return $core.withContext(function($ctx1) {
  43842. var $1,$2,$receiver;
  43843. $1=$self["@transformersDictionary"];
  43844. if(($receiver = $1) == null || $receiver.a$nil){
  43845. $2=(
  43846. $ctx1.supercall = true,
  43847. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  43848. $ctx1.supercall = false;
  43849. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  43850. $ctx1.sendIdx["at:put:"]=1;
  43851. $recv($2)._at_put_("6000-inliner",$self._inliner());
  43852. $ctx1.sendIdx["at:put:"]=2;
  43853. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  43854. $self["@transformersDictionary"]=$recv($2)._yourself();
  43855. return $self["@transformersDictionary"];
  43856. } else {
  43857. return $1;
  43858. }
  43859. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  43860. },
  43861. args: [],
  43862. 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 ]",
  43863. referencedClasses: [],
  43864. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  43865. }),
  43866. $globals.InliningCodeGenerator);
  43867. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  43868. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  43869. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  43870. $core.addMethod(
  43871. $core.method({
  43872. selector: "visitSendNode:",
  43873. protocol: "visiting",
  43874. fn: function (aNode){
  43875. var self=this,$self=this;
  43876. return $core.withContext(function($ctx1) {
  43877. var $1,$2,$3,$receiver;
  43878. $1=$recv(aNode)._superSend();
  43879. if(!$core.assert($1)){
  43880. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  43881. if($core.assert($2)){
  43882. $recv(aNode)._shouldBeInlined_(true);
  43883. $3=$recv(aNode)._receiver();
  43884. if(($receiver = $3) == null || $receiver.a$nil){
  43885. $3;
  43886. } else {
  43887. var receiver;
  43888. receiver=$receiver;
  43889. $recv(receiver)._shouldBeAliased_(true);
  43890. }
  43891. }
  43892. }
  43893. (
  43894. $ctx1.supercall = true,
  43895. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  43896. $ctx1.supercall = false;
  43897. return self;
  43898. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  43899. },
  43900. args: ["aNode"],
  43901. 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",
  43902. referencedClasses: ["IRSendInliner"],
  43903. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  43904. }),
  43905. $globals.InliningSemanticAnalyzer);
  43906. $core.addMethod(
  43907. $core.method({
  43908. selector: "asInlinedBlockResult",
  43909. protocol: "*Compiler-Inlining",
  43910. fn: function (){
  43911. var self=this,$self=this;
  43912. return $core.withContext(function($ctx1) {
  43913. return $self._expression();
  43914. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  43915. },
  43916. args: [],
  43917. source: "asInlinedBlockResult\x0a\x09^ self expression",
  43918. referencedClasses: [],
  43919. messageSends: ["expression"]
  43920. }),
  43921. $globals.IRBlockReturn);
  43922. $core.addMethod(
  43923. $core.method({
  43924. selector: "asInlinedBlockResult",
  43925. protocol: "*Compiler-Inlining",
  43926. fn: function (){
  43927. var self=this,$self=this;
  43928. return self;
  43929. },
  43930. args: [],
  43931. source: "asInlinedBlockResult\x0a\x09^ self",
  43932. referencedClasses: [],
  43933. messageSends: []
  43934. }),
  43935. $globals.IRInstruction);
  43936. });
  43937. 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";
  43938. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  43939. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43940. $core.addPackage("Compiler-Interpreter");
  43941. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  43942. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43943. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  43944. $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`).";
  43945. $core.addMethod(
  43946. $core.method({
  43947. selector: "applyTo:arguments:",
  43948. protocol: "evaluating",
  43949. fn: function (anObject,aCollection){
  43950. var self=this,$self=this;
  43951. return $core.withContext(function($ctx1) {
  43952. $self._interpreterError();
  43953. return self;
  43954. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  43955. },
  43956. args: ["anObject", "aCollection"],
  43957. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  43958. referencedClasses: [],
  43959. messageSends: ["interpreterError"]
  43960. }),
  43961. $globals.AIBlockClosure);
  43962. $core.addMethod(
  43963. $core.method({
  43964. selector: "compiledSource",
  43965. protocol: "accessing",
  43966. fn: function (){
  43967. var self=this,$self=this;
  43968. return "[ AST Block closure ]";
  43969. },
  43970. args: [],
  43971. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  43972. referencedClasses: [],
  43973. messageSends: []
  43974. }),
  43975. $globals.AIBlockClosure);
  43976. $core.addMethod(
  43977. $core.method({
  43978. selector: "currySelf",
  43979. protocol: "converting",
  43980. fn: function (){
  43981. var self=this,$self=this;
  43982. return $core.withContext(function($ctx1) {
  43983. $self._interpreterError();
  43984. return self;
  43985. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  43986. },
  43987. args: [],
  43988. source: "currySelf\x0a\x09self interpreterError",
  43989. referencedClasses: [],
  43990. messageSends: ["interpreterError"]
  43991. }),
  43992. $globals.AIBlockClosure);
  43993. $core.addMethod(
  43994. $core.method({
  43995. selector: "initializeWithContext:node:",
  43996. protocol: "initialization",
  43997. fn: function (aContext,aNode){
  43998. var self=this,$self=this;
  43999. $self["@node"]=aNode;
  44000. $self["@outerContext"]=aContext;
  44001. return self;
  44002. },
  44003. args: ["aContext", "aNode"],
  44004. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44005. referencedClasses: [],
  44006. messageSends: []
  44007. }),
  44008. $globals.AIBlockClosure);
  44009. $core.addMethod(
  44010. $core.method({
  44011. selector: "interpreterError",
  44012. protocol: "error handling",
  44013. fn: function (){
  44014. var self=this,$self=this;
  44015. return $core.withContext(function($ctx1) {
  44016. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44017. return self;
  44018. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44019. },
  44020. args: [],
  44021. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44022. referencedClasses: ["ASTInterpreterError"],
  44023. messageSends: ["signal:"]
  44024. }),
  44025. $globals.AIBlockClosure);
  44026. $core.addMethod(
  44027. $core.method({
  44028. selector: "numArgs",
  44029. protocol: "accessing",
  44030. fn: function (){
  44031. var self=this,$self=this;
  44032. return $core.withContext(function($ctx1) {
  44033. return $recv($recv($self["@node"])._temps())._size();
  44034. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44035. },
  44036. args: [],
  44037. source: "numArgs\x0a\x09^ node temps size",
  44038. referencedClasses: [],
  44039. messageSends: ["size", "temps"]
  44040. }),
  44041. $globals.AIBlockClosure);
  44042. $core.addMethod(
  44043. $core.method({
  44044. selector: "value",
  44045. protocol: "evaluating",
  44046. fn: function (){
  44047. var self=this,$self=this;
  44048. return $core.withContext(function($ctx1) {
  44049. return $self._valueWithPossibleArguments_([]);
  44050. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44051. },
  44052. args: [],
  44053. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44054. referencedClasses: [],
  44055. messageSends: ["valueWithPossibleArguments:"]
  44056. }),
  44057. $globals.AIBlockClosure);
  44058. $core.addMethod(
  44059. $core.method({
  44060. selector: "value:",
  44061. protocol: "evaluating",
  44062. fn: function (anArgument){
  44063. var self=this,$self=this;
  44064. return $core.withContext(function($ctx1) {
  44065. return $self._valueWithPossibleArguments_([anArgument]);
  44066. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44067. },
  44068. args: ["anArgument"],
  44069. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44070. referencedClasses: [],
  44071. messageSends: ["valueWithPossibleArguments:"]
  44072. }),
  44073. $globals.AIBlockClosure);
  44074. $core.addMethod(
  44075. $core.method({
  44076. selector: "value:value:",
  44077. protocol: "evaluating",
  44078. fn: function (firstArgument,secondArgument){
  44079. var self=this,$self=this;
  44080. return $core.withContext(function($ctx1) {
  44081. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44082. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44083. },
  44084. args: ["firstArgument", "secondArgument"],
  44085. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44086. referencedClasses: [],
  44087. messageSends: ["valueWithPossibleArguments:"]
  44088. }),
  44089. $globals.AIBlockClosure);
  44090. $core.addMethod(
  44091. $core.method({
  44092. selector: "value:value:value:",
  44093. protocol: "evaluating",
  44094. fn: function (firstArgument,secondArgument,thirdArgument){
  44095. var self=this,$self=this;
  44096. return $core.withContext(function($ctx1) {
  44097. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44098. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44099. },
  44100. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44101. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44102. referencedClasses: [],
  44103. messageSends: ["valueWithPossibleArguments:"]
  44104. }),
  44105. $globals.AIBlockClosure);
  44106. $core.addMethod(
  44107. $core.method({
  44108. selector: "valueWithPossibleArguments:",
  44109. protocol: "evaluating",
  44110. fn: function (aCollection){
  44111. var self=this,$self=this;
  44112. var context,sequenceNode;
  44113. return $core.withContext(function($ctx1) {
  44114. var $1,$2,$3;
  44115. context=$recv($self["@outerContext"])._newInnerContext();
  44116. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44117. $recv($1)._parent_(nil);
  44118. sequenceNode=$recv($1)._yourself();
  44119. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44120. return $core.withContext(function($ctx2) {
  44121. return $recv(context)._defineLocal_(each);
  44122. $ctx2.sendIdx["defineLocal:"]=1;
  44123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44124. }));
  44125. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44126. return $core.withContext(function($ctx2) {
  44127. $recv(context)._defineLocal_(each);
  44128. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44129. return nil;
  44130. })));
  44131. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44132. }));
  44133. $2=$recv(context)._interpreter();
  44134. $ctx1.sendIdx["interpreter"]=1;
  44135. $recv($2)._node_(sequenceNode);
  44136. $recv($2)._enterNode();
  44137. $recv($2)._proceed();
  44138. $3=$recv($self["@outerContext"])._interpreter();
  44139. $ctx1.sendIdx["interpreter"]=2;
  44140. $recv($3)._setNonLocalReturnFromContext_(context);
  44141. return $recv($recv(context)._interpreter())._pop();
  44142. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44143. },
  44144. args: ["aCollection"],
  44145. 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",
  44146. referencedClasses: [],
  44147. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44148. }),
  44149. $globals.AIBlockClosure);
  44150. $core.addMethod(
  44151. $core.method({
  44152. selector: "forContext:node:",
  44153. protocol: "instance creation",
  44154. fn: function (aContext,aNode){
  44155. var self=this,$self=this;
  44156. return $core.withContext(function($ctx1) {
  44157. var $1;
  44158. $1=$self._new();
  44159. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44160. return $recv($1)._yourself();
  44161. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44162. },
  44163. args: ["aContext", "aNode"],
  44164. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44165. referencedClasses: [],
  44166. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44167. }),
  44168. $globals.AIBlockClosure.a$cls);
  44169. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44170. $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)";
  44171. $core.addMethod(
  44172. $core.method({
  44173. selector: "arguments",
  44174. protocol: "interpreting",
  44175. fn: function (){
  44176. var self=this,$self=this;
  44177. return $core.withContext(function($ctx1) {
  44178. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44179. return $core.withContext(function($ctx2) {
  44180. return $self._localAt_ifAbsent_(each,(function(){
  44181. return $core.withContext(function($ctx3) {
  44182. return $self._error_("Argument not in context");
  44183. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44184. }));
  44185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44186. }));
  44187. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44188. },
  44189. args: [],
  44190. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44191. referencedClasses: [],
  44192. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44193. }),
  44194. $globals.AIContext);
  44195. $core.addMethod(
  44196. $core.method({
  44197. selector: "ast",
  44198. protocol: "interpreting",
  44199. fn: function (){
  44200. var self=this,$self=this;
  44201. return $core.withContext(function($ctx1) {
  44202. var $1,$2,$3,$receiver;
  44203. $1=$self._isBlockContext();
  44204. if($core.assert($1)){
  44205. $2=$self._outerContext();
  44206. if(($receiver = $2) == null || $receiver.a$nil){
  44207. return $2;
  44208. } else {
  44209. var context;
  44210. context=$receiver;
  44211. return $recv(context)._ast();
  44212. }
  44213. }
  44214. $3=$self["@ast"];
  44215. if(($receiver = $3) == null || $receiver.a$nil){
  44216. $self._initializeAST();
  44217. } else {
  44218. $3;
  44219. }
  44220. return $self["@ast"];
  44221. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44222. },
  44223. args: [],
  44224. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44225. referencedClasses: [],
  44226. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44227. }),
  44228. $globals.AIContext);
  44229. $core.addMethod(
  44230. $core.method({
  44231. selector: "basicLocalAt:",
  44232. protocol: "private",
  44233. fn: function (aString){
  44234. var self=this,$self=this;
  44235. return $core.withContext(function($ctx1) {
  44236. return $recv($self._locals())._at_(aString);
  44237. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44238. },
  44239. args: ["aString"],
  44240. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44241. referencedClasses: [],
  44242. messageSends: ["at:", "locals"]
  44243. }),
  44244. $globals.AIContext);
  44245. $core.addMethod(
  44246. $core.method({
  44247. selector: "basicLocalAt:put:",
  44248. protocol: "private",
  44249. fn: function (aString,anObject){
  44250. var self=this,$self=this;
  44251. return $core.withContext(function($ctx1) {
  44252. $recv($self._locals())._at_put_(aString,anObject);
  44253. return self;
  44254. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44255. },
  44256. args: ["aString", "anObject"],
  44257. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44258. referencedClasses: [],
  44259. messageSends: ["at:put:", "locals"]
  44260. }),
  44261. $globals.AIContext);
  44262. $core.addMethod(
  44263. $core.method({
  44264. selector: "basicReceiver",
  44265. protocol: "interpreting",
  44266. fn: function (){
  44267. var self=this,$self=this;
  44268. return $core.withContext(function($ctx1) {
  44269. return $self._localAt_("self");
  44270. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44271. },
  44272. args: [],
  44273. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44274. referencedClasses: [],
  44275. messageSends: ["localAt:"]
  44276. }),
  44277. $globals.AIContext);
  44278. $core.addMethod(
  44279. $core.method({
  44280. selector: "defineLocal:",
  44281. protocol: "accessing",
  44282. fn: function (aString){
  44283. var self=this,$self=this;
  44284. return $core.withContext(function($ctx1) {
  44285. $recv($self._locals())._at_put_(aString,nil);
  44286. return self;
  44287. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44288. },
  44289. args: ["aString"],
  44290. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44291. referencedClasses: [],
  44292. messageSends: ["at:put:", "locals"]
  44293. }),
  44294. $globals.AIContext);
  44295. $core.addMethod(
  44296. $core.method({
  44297. selector: "evaluate:on:",
  44298. protocol: "evaluating",
  44299. fn: function (aString,anEvaluator){
  44300. var self=this,$self=this;
  44301. return $core.withContext(function($ctx1) {
  44302. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44303. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44304. },
  44305. args: ["aString", "anEvaluator"],
  44306. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44307. referencedClasses: [],
  44308. messageSends: ["evaluate:context:"]
  44309. }),
  44310. $globals.AIContext);
  44311. $core.addMethod(
  44312. $core.method({
  44313. selector: "evaluateNode:",
  44314. protocol: "evaluating",
  44315. fn: function (aNode){
  44316. var self=this,$self=this;
  44317. return $core.withContext(function($ctx1) {
  44318. var $1;
  44319. $1=$recv($globals.ASTInterpreter)._new();
  44320. $recv($1)._context_(self);
  44321. $recv($1)._node_(aNode);
  44322. $recv($1)._enterNode();
  44323. $recv($1)._proceed();
  44324. return $recv($1)._result();
  44325. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44326. },
  44327. args: ["aNode"],
  44328. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44329. referencedClasses: ["ASTInterpreter"],
  44330. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44331. }),
  44332. $globals.AIContext);
  44333. $core.addMethod(
  44334. $core.method({
  44335. selector: "evaluatedSelector",
  44336. protocol: "accessing",
  44337. fn: function (){
  44338. var self=this,$self=this;
  44339. return $self["@evaluatedSelector"];
  44340. },
  44341. args: [],
  44342. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44343. referencedClasses: [],
  44344. messageSends: []
  44345. }),
  44346. $globals.AIContext);
  44347. $core.addMethod(
  44348. $core.method({
  44349. selector: "evaluatedSelector:",
  44350. protocol: "accessing",
  44351. fn: function (aString){
  44352. var self=this,$self=this;
  44353. $self["@evaluatedSelector"]=aString;
  44354. return self;
  44355. },
  44356. args: ["aString"],
  44357. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44358. referencedClasses: [],
  44359. messageSends: []
  44360. }),
  44361. $globals.AIContext);
  44362. $core.addMethod(
  44363. $core.method({
  44364. selector: "index",
  44365. protocol: "accessing",
  44366. fn: function (){
  44367. var self=this,$self=this;
  44368. return $core.withContext(function($ctx1) {
  44369. var $1,$receiver;
  44370. $1=$self["@index"];
  44371. if(($receiver = $1) == null || $receiver.a$nil){
  44372. return (0);
  44373. } else {
  44374. return $1;
  44375. }
  44376. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44377. },
  44378. args: [],
  44379. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44380. referencedClasses: [],
  44381. messageSends: ["ifNil:"]
  44382. }),
  44383. $globals.AIContext);
  44384. $core.addMethod(
  44385. $core.method({
  44386. selector: "index:",
  44387. protocol: "accessing",
  44388. fn: function (anInteger){
  44389. var self=this,$self=this;
  44390. $self["@index"]=anInteger;
  44391. return self;
  44392. },
  44393. args: ["anInteger"],
  44394. source: "index: anInteger\x0a\x09index := anInteger",
  44395. referencedClasses: [],
  44396. messageSends: []
  44397. }),
  44398. $globals.AIContext);
  44399. $core.addMethod(
  44400. $core.method({
  44401. selector: "initializeAST",
  44402. protocol: "initialization",
  44403. fn: function (){
  44404. var self=this,$self=this;
  44405. return $core.withContext(function($ctx1) {
  44406. var $1;
  44407. $1=$self._method();
  44408. $ctx1.sendIdx["method"]=1;
  44409. $self["@ast"]=$recv($1)._ast();
  44410. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44411. return self;
  44412. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44413. },
  44414. args: [],
  44415. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44416. referencedClasses: ["SemanticAnalyzer"],
  44417. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44418. }),
  44419. $globals.AIContext);
  44420. $core.addMethod(
  44421. $core.method({
  44422. selector: "initializeFromMethodContext:",
  44423. protocol: "initialization",
  44424. fn: function (aMethodContext){
  44425. var self=this,$self=this;
  44426. return $core.withContext(function($ctx1) {
  44427. var $1,$2,$3,$receiver;
  44428. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44429. $self._index_($recv(aMethodContext)._index());
  44430. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44431. $self._receiver_($recv(aMethodContext)._receiver());
  44432. $self._supercall_($recv(aMethodContext)._supercall());
  44433. $self._selector_($recv(aMethodContext)._selector());
  44434. $1=$recv(aMethodContext)._outerContext();
  44435. $ctx1.sendIdx["outerContext"]=1;
  44436. if(($receiver = $1) == null || $receiver.a$nil){
  44437. $1;
  44438. } else {
  44439. var outer;
  44440. outer=$receiver;
  44441. $2=$recv(outer)._methodContext();
  44442. if(($receiver = $2) == null || $receiver.a$nil){
  44443. $2;
  44444. } else {
  44445. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44446. }
  44447. $3=$recv(aMethodContext)._locals();
  44448. $ctx1.sendIdx["locals"]=1;
  44449. $recv($3)._keysAndValuesDo_((function(key,value){
  44450. return $core.withContext(function($ctx2) {
  44451. return $recv($self._locals())._at_put_(key,value);
  44452. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44453. }));
  44454. }
  44455. return self;
  44456. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44457. },
  44458. args: ["aMethodContext"],
  44459. 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 ] ]",
  44460. referencedClasses: [],
  44461. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44462. }),
  44463. $globals.AIContext);
  44464. $core.addMethod(
  44465. $core.method({
  44466. selector: "initializeInterpreter",
  44467. protocol: "initialization",
  44468. fn: function (){
  44469. var self=this,$self=this;
  44470. return $core.withContext(function($ctx1) {
  44471. var $1,$2,$receiver;
  44472. $1=$recv($globals.ASTInterpreter)._new();
  44473. $recv($1)._context_(self);
  44474. $self["@interpreter"]=$recv($1)._yourself();
  44475. $2=$self._innerContext();
  44476. if(($receiver = $2) == null || $receiver.a$nil){
  44477. $2;
  44478. } else {
  44479. $self._setupInterpreter_($self["@interpreter"]);
  44480. }
  44481. return self;
  44482. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44483. },
  44484. args: [],
  44485. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44486. referencedClasses: ["ASTInterpreter"],
  44487. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44488. }),
  44489. $globals.AIContext);
  44490. $core.addMethod(
  44491. $core.method({
  44492. selector: "initializeLocals",
  44493. protocol: "initialization",
  44494. fn: function (){
  44495. var self=this,$self=this;
  44496. return $core.withContext(function($ctx1) {
  44497. $self["@locals"]=$recv($globals.Dictionary)._new();
  44498. $recv($self["@locals"])._at_put_("thisContext",self);
  44499. return self;
  44500. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44501. },
  44502. args: [],
  44503. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44504. referencedClasses: ["Dictionary"],
  44505. messageSends: ["new", "at:put:"]
  44506. }),
  44507. $globals.AIContext);
  44508. $core.addMethod(
  44509. $core.method({
  44510. selector: "innerContext",
  44511. protocol: "accessing",
  44512. fn: function (){
  44513. var self=this,$self=this;
  44514. return $self["@innerContext"];
  44515. },
  44516. args: [],
  44517. source: "innerContext\x0a\x09^ innerContext",
  44518. referencedClasses: [],
  44519. messageSends: []
  44520. }),
  44521. $globals.AIContext);
  44522. $core.addMethod(
  44523. $core.method({
  44524. selector: "innerContext:",
  44525. protocol: "accessing",
  44526. fn: function (anAIContext){
  44527. var self=this,$self=this;
  44528. $self["@innerContext"]=anAIContext;
  44529. return self;
  44530. },
  44531. args: ["anAIContext"],
  44532. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44533. referencedClasses: [],
  44534. messageSends: []
  44535. }),
  44536. $globals.AIContext);
  44537. $core.addMethod(
  44538. $core.method({
  44539. selector: "interpreter",
  44540. protocol: "interpreting",
  44541. fn: function (){
  44542. var self=this,$self=this;
  44543. return $core.withContext(function($ctx1) {
  44544. var $1,$receiver;
  44545. $1=$self["@interpreter"];
  44546. if(($receiver = $1) == null || $receiver.a$nil){
  44547. $self._initializeInterpreter();
  44548. } else {
  44549. $1;
  44550. }
  44551. return $self["@interpreter"];
  44552. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44553. },
  44554. args: [],
  44555. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44556. referencedClasses: [],
  44557. messageSends: ["ifNil:", "initializeInterpreter"]
  44558. }),
  44559. $globals.AIContext);
  44560. $core.addMethod(
  44561. $core.method({
  44562. selector: "interpreter:",
  44563. protocol: "interpreting",
  44564. fn: function (anInterpreter){
  44565. var self=this,$self=this;
  44566. $self["@interpreter"]=anInterpreter;
  44567. return self;
  44568. },
  44569. args: ["anInterpreter"],
  44570. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44571. referencedClasses: [],
  44572. messageSends: []
  44573. }),
  44574. $globals.AIContext);
  44575. $core.addMethod(
  44576. $core.method({
  44577. selector: "isTopContext",
  44578. protocol: "testing",
  44579. fn: function (){
  44580. var self=this,$self=this;
  44581. return $core.withContext(function($ctx1) {
  44582. return $recv($self._innerContext())._isNil();
  44583. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44584. },
  44585. args: [],
  44586. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44587. referencedClasses: [],
  44588. messageSends: ["isNil", "innerContext"]
  44589. }),
  44590. $globals.AIContext);
  44591. $core.addMethod(
  44592. $core.method({
  44593. selector: "localAt:",
  44594. protocol: "accessing",
  44595. fn: function (aString){
  44596. var self=this,$self=this;
  44597. var context;
  44598. return $core.withContext(function($ctx1) {
  44599. context=$self._lookupContextForLocal_(aString);
  44600. return $recv(context)._basicLocalAt_(aString);
  44601. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44602. },
  44603. args: ["aString"],
  44604. 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",
  44605. referencedClasses: [],
  44606. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44607. }),
  44608. $globals.AIContext);
  44609. $core.addMethod(
  44610. $core.method({
  44611. selector: "localAt:ifAbsent:",
  44612. protocol: "accessing",
  44613. fn: function (aString,aBlock){
  44614. var self=this,$self=this;
  44615. var context;
  44616. return $core.withContext(function($ctx1) {
  44617. var $early={};
  44618. try {
  44619. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44620. return $core.withContext(function($ctx2) {
  44621. throw $early=[$recv(aBlock)._value()];
  44622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44623. }));
  44624. return $recv(context)._basicLocalAt_(aString);
  44625. }
  44626. catch(e) {if(e===$early)return e[0]; throw e}
  44627. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  44628. },
  44629. args: ["aString", "aBlock"],
  44630. 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",
  44631. referencedClasses: [],
  44632. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  44633. }),
  44634. $globals.AIContext);
  44635. $core.addMethod(
  44636. $core.method({
  44637. selector: "localAt:put:",
  44638. protocol: "accessing",
  44639. fn: function (aString,anObject){
  44640. var self=this,$self=this;
  44641. var context;
  44642. return $core.withContext(function($ctx1) {
  44643. context=$self._lookupContextForLocal_(aString);
  44644. $recv(context)._basicLocalAt_put_(aString,anObject);
  44645. return self;
  44646. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  44647. },
  44648. args: ["aString", "anObject"],
  44649. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  44650. referencedClasses: [],
  44651. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  44652. }),
  44653. $globals.AIContext);
  44654. $core.addMethod(
  44655. $core.method({
  44656. selector: "locals",
  44657. protocol: "accessing",
  44658. fn: function (){
  44659. var self=this,$self=this;
  44660. return $core.withContext(function($ctx1) {
  44661. var $1,$receiver;
  44662. $1=$self["@locals"];
  44663. if(($receiver = $1) == null || $receiver.a$nil){
  44664. $self._initializeLocals();
  44665. } else {
  44666. $1;
  44667. }
  44668. return $self["@locals"];
  44669. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  44670. },
  44671. args: [],
  44672. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  44673. referencedClasses: [],
  44674. messageSends: ["ifNil:", "initializeLocals"]
  44675. }),
  44676. $globals.AIContext);
  44677. $core.addMethod(
  44678. $core.method({
  44679. selector: "lookupContextForLocal:",
  44680. protocol: "private",
  44681. fn: function (aString){
  44682. var self=this,$self=this;
  44683. return $core.withContext(function($ctx1) {
  44684. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  44685. return $core.withContext(function($ctx2) {
  44686. return $self._variableNotFound();
  44687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44688. }));
  44689. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  44690. },
  44691. args: ["aString"],
  44692. 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 ]",
  44693. referencedClasses: [],
  44694. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  44695. }),
  44696. $globals.AIContext);
  44697. $core.addMethod(
  44698. $core.method({
  44699. selector: "lookupContextForLocal:ifNone:",
  44700. protocol: "private",
  44701. fn: function (aString,aBlock){
  44702. var self=this,$self=this;
  44703. return $core.withContext(function($ctx1) {
  44704. var $1;
  44705. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  44706. return self;
  44707. }),(function(){
  44708. return $core.withContext(function($ctx2) {
  44709. $1=$self._outerContext();
  44710. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  44711. return $core.withContext(function($ctx3) {
  44712. return $recv(context)._lookupContextForLocal_(aString);
  44713. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  44714. }));
  44715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44716. }));
  44717. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  44718. },
  44719. args: ["aString", "aBlock"],
  44720. 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 ] ]",
  44721. referencedClasses: [],
  44722. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  44723. }),
  44724. $globals.AIContext);
  44725. $core.addMethod(
  44726. $core.method({
  44727. selector: "newInnerContext",
  44728. protocol: "factory",
  44729. fn: function (){
  44730. var self=this,$self=this;
  44731. return $core.withContext(function($ctx1) {
  44732. var $1;
  44733. $1=$recv($self._class())._new();
  44734. $recv($1)._outerContext_(self);
  44735. return $recv($1)._yourself();
  44736. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  44737. },
  44738. args: [],
  44739. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  44740. referencedClasses: [],
  44741. messageSends: ["outerContext:", "new", "class", "yourself"]
  44742. }),
  44743. $globals.AIContext);
  44744. $core.addMethod(
  44745. $core.method({
  44746. selector: "outerContext",
  44747. protocol: "accessing",
  44748. fn: function (){
  44749. var self=this,$self=this;
  44750. return $self["@outerContext"];
  44751. },
  44752. args: [],
  44753. source: "outerContext\x0a\x09^ outerContext",
  44754. referencedClasses: [],
  44755. messageSends: []
  44756. }),
  44757. $globals.AIContext);
  44758. $core.addMethod(
  44759. $core.method({
  44760. selector: "outerContext:",
  44761. protocol: "accessing",
  44762. fn: function (anAIContext){
  44763. var self=this,$self=this;
  44764. return $core.withContext(function($ctx1) {
  44765. var $1,$receiver;
  44766. $self["@outerContext"]=anAIContext;
  44767. $1=$self["@outerContext"];
  44768. if(($receiver = $1) == null || $receiver.a$nil){
  44769. $1;
  44770. } else {
  44771. var context;
  44772. context=$receiver;
  44773. $recv(context)._innerContext_(self);
  44774. }
  44775. return self;
  44776. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  44777. },
  44778. args: ["anAIContext"],
  44779. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  44780. referencedClasses: [],
  44781. messageSends: ["ifNotNil:", "innerContext:"]
  44782. }),
  44783. $globals.AIContext);
  44784. $core.addMethod(
  44785. $core.method({
  44786. selector: "receiver:",
  44787. protocol: "interpreting",
  44788. fn: function (anObject){
  44789. var self=this,$self=this;
  44790. return $core.withContext(function($ctx1) {
  44791. $recv($self._locals())._at_put_("self",anObject);
  44792. return self;
  44793. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  44794. },
  44795. args: ["anObject"],
  44796. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  44797. referencedClasses: [],
  44798. messageSends: ["at:put:", "locals"]
  44799. }),
  44800. $globals.AIContext);
  44801. $core.addMethod(
  44802. $core.method({
  44803. selector: "selector",
  44804. protocol: "accessing",
  44805. fn: function (){
  44806. var self=this,$self=this;
  44807. return $self["@selector"];
  44808. },
  44809. args: [],
  44810. source: "selector\x0a\x09^ selector",
  44811. referencedClasses: [],
  44812. messageSends: []
  44813. }),
  44814. $globals.AIContext);
  44815. $core.addMethod(
  44816. $core.method({
  44817. selector: "selector:",
  44818. protocol: "accessing",
  44819. fn: function (aString){
  44820. var self=this,$self=this;
  44821. $self["@selector"]=aString;
  44822. return self;
  44823. },
  44824. args: ["aString"],
  44825. source: "selector: aString\x0a\x09selector := aString",
  44826. referencedClasses: [],
  44827. messageSends: []
  44828. }),
  44829. $globals.AIContext);
  44830. $core.addMethod(
  44831. $core.method({
  44832. selector: "sendIndexAt:",
  44833. protocol: "accessing",
  44834. fn: function (aString){
  44835. var self=this,$self=this;
  44836. return $core.withContext(function($ctx1) {
  44837. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  44838. return (0);
  44839. }));
  44840. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  44841. },
  44842. args: ["aString"],
  44843. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  44844. referencedClasses: [],
  44845. messageSends: ["at:ifAbsent:", "sendIndexes"]
  44846. }),
  44847. $globals.AIContext);
  44848. $core.addMethod(
  44849. $core.method({
  44850. selector: "sendIndexes",
  44851. protocol: "accessing",
  44852. fn: function (){
  44853. var self=this,$self=this;
  44854. return $core.withContext(function($ctx1) {
  44855. var $1,$receiver;
  44856. $1=$self["@sendIndexes"];
  44857. if(($receiver = $1) == null || $receiver.a$nil){
  44858. return $recv($globals.Dictionary)._new();
  44859. } else {
  44860. return $1;
  44861. }
  44862. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  44863. },
  44864. args: [],
  44865. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  44866. referencedClasses: ["Dictionary"],
  44867. messageSends: ["ifNil:", "new"]
  44868. }),
  44869. $globals.AIContext);
  44870. $core.addMethod(
  44871. $core.method({
  44872. selector: "sendIndexes:",
  44873. protocol: "accessing",
  44874. fn: function (aDictionary){
  44875. var self=this,$self=this;
  44876. $self["@sendIndexes"]=aDictionary;
  44877. return self;
  44878. },
  44879. args: ["aDictionary"],
  44880. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  44881. referencedClasses: [],
  44882. messageSends: []
  44883. }),
  44884. $globals.AIContext);
  44885. $core.addMethod(
  44886. $core.method({
  44887. selector: "setupInterpreter:",
  44888. protocol: "interpreting",
  44889. fn: function (anInterpreter){
  44890. var self=this,$self=this;
  44891. var currentNode;
  44892. return $core.withContext(function($ctx1) {
  44893. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  44894. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44895. $2=$self._evaluatedSelector();
  44896. $ctx1.sendIdx["evaluatedSelector"]=1;
  44897. $recv($1)._selector_($2);
  44898. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  44899. $3=$self._ast();
  44900. $ctx1.sendIdx["ast"]=1;
  44901. $recv($1)._visit_($3);
  44902. currentNode=$recv($1)._currentNode();
  44903. $4=$recv($self._ast())._sequenceNode();
  44904. if(($receiver = $4) == null || $receiver.a$nil){
  44905. $4;
  44906. } else {
  44907. var sequence;
  44908. sequence=$receiver;
  44909. $recv($recv(sequence)._temps())._do_((function(each){
  44910. return $core.withContext(function($ctx2) {
  44911. return $self._defineLocal_(each);
  44912. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44913. }));
  44914. $ctx1.sendIdx["do:"]=1;
  44915. }
  44916. $recv(anInterpreter)._node_(currentNode);
  44917. $7=$self._innerContext();
  44918. $ctx1.sendIdx["innerContext"]=1;
  44919. $6=$recv($7)._arguments();
  44920. $5=$recv($6)._reversed();
  44921. $recv($5)._do_((function(each){
  44922. return $core.withContext(function($ctx2) {
  44923. return $recv(anInterpreter)._push_(each);
  44924. $ctx2.sendIdx["push:"]=1;
  44925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  44926. }));
  44927. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  44928. return self;
  44929. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  44930. },
  44931. args: ["anInterpreter"],
  44932. 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)",
  44933. referencedClasses: ["ASTPCNodeVisitor"],
  44934. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  44935. }),
  44936. $globals.AIContext);
  44937. $core.addMethod(
  44938. $core.method({
  44939. selector: "supercall",
  44940. protocol: "interpreting",
  44941. fn: function (){
  44942. var self=this,$self=this;
  44943. return $core.withContext(function($ctx1) {
  44944. var $1,$receiver;
  44945. $1=$self["@supercall"];
  44946. if(($receiver = $1) == null || $receiver.a$nil){
  44947. return false;
  44948. } else {
  44949. return $1;
  44950. }
  44951. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  44952. },
  44953. args: [],
  44954. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  44955. referencedClasses: [],
  44956. messageSends: ["ifNil:"]
  44957. }),
  44958. $globals.AIContext);
  44959. $core.addMethod(
  44960. $core.method({
  44961. selector: "supercall:",
  44962. protocol: "interpreting",
  44963. fn: function (aBoolean){
  44964. var self=this,$self=this;
  44965. $self["@supercall"]=aBoolean;
  44966. return self;
  44967. },
  44968. args: ["aBoolean"],
  44969. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  44970. referencedClasses: [],
  44971. messageSends: []
  44972. }),
  44973. $globals.AIContext);
  44974. $core.addMethod(
  44975. $core.method({
  44976. selector: "variableNotFound",
  44977. protocol: "error handling",
  44978. fn: function (){
  44979. var self=this,$self=this;
  44980. return $core.withContext(function($ctx1) {
  44981. $self._error_("Variable missing");
  44982. return self;
  44983. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  44984. },
  44985. args: [],
  44986. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  44987. referencedClasses: [],
  44988. messageSends: ["error:"]
  44989. }),
  44990. $globals.AIContext);
  44991. $core.addMethod(
  44992. $core.method({
  44993. selector: "fromMethodContext:",
  44994. protocol: "instance creation",
  44995. fn: function (aMethodContext){
  44996. var self=this,$self=this;
  44997. return $core.withContext(function($ctx1) {
  44998. var $1;
  44999. $1=$self._new();
  45000. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45001. return $recv($1)._yourself();
  45002. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45003. },
  45004. args: ["aMethodContext"],
  45005. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45006. referencedClasses: [],
  45007. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45008. }),
  45009. $globals.AIContext.a$cls);
  45010. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45011. $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.";
  45012. $core.addMethod(
  45013. $core.method({
  45014. selector: "context",
  45015. protocol: "accessing",
  45016. fn: function (){
  45017. var self=this,$self=this;
  45018. return $self["@context"];
  45019. },
  45020. args: [],
  45021. source: "context\x0a\x09^ context",
  45022. referencedClasses: [],
  45023. messageSends: []
  45024. }),
  45025. $globals.AISemanticAnalyzer);
  45026. $core.addMethod(
  45027. $core.method({
  45028. selector: "context:",
  45029. protocol: "accessing",
  45030. fn: function (anAIContext){
  45031. var self=this,$self=this;
  45032. $self["@context"]=anAIContext;
  45033. return self;
  45034. },
  45035. args: ["anAIContext"],
  45036. source: "context: anAIContext\x0a\x09context := anAIContext",
  45037. referencedClasses: [],
  45038. messageSends: []
  45039. }),
  45040. $globals.AISemanticAnalyzer);
  45041. $core.addMethod(
  45042. $core.method({
  45043. selector: "visitVariableNode:",
  45044. protocol: "visiting",
  45045. fn: function (aNode){
  45046. var self=this,$self=this;
  45047. return $core.withContext(function($ctx1) {
  45048. var $1;
  45049. var $early={};
  45050. try {
  45051. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45052. return $core.withContext(function($ctx2) {
  45053. $1=(
  45054. $ctx2.supercall = true,
  45055. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45056. $ctx2.supercall = false;
  45057. throw $early=[$1];
  45058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45059. }));
  45060. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45061. return self;
  45062. }
  45063. catch(e) {if(e===$early)return e[0]; throw e}
  45064. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45065. },
  45066. args: ["aNode"],
  45067. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45068. referencedClasses: ["ASTContextVar"],
  45069. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45070. }),
  45071. $globals.AISemanticAnalyzer);
  45072. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45073. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45074. $core.addMethod(
  45075. $core.method({
  45076. selector: "context",
  45077. protocol: "accessing",
  45078. fn: function (){
  45079. var self=this,$self=this;
  45080. return $self["@context"];
  45081. },
  45082. args: [],
  45083. source: "context\x0a\x09^ context",
  45084. referencedClasses: [],
  45085. messageSends: []
  45086. }),
  45087. $globals.ASTContextVar);
  45088. $core.addMethod(
  45089. $core.method({
  45090. selector: "context:",
  45091. protocol: "accessing",
  45092. fn: function (anObject){
  45093. var self=this,$self=this;
  45094. $self["@context"]=anObject;
  45095. return self;
  45096. },
  45097. args: ["anObject"],
  45098. source: "context: anObject\x0a\x09context := anObject",
  45099. referencedClasses: [],
  45100. messageSends: []
  45101. }),
  45102. $globals.ASTContextVar);
  45103. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45104. $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.";
  45105. $core.addMethod(
  45106. $core.method({
  45107. selector: "atEnd",
  45108. protocol: "testing",
  45109. fn: function (){
  45110. var self=this,$self=this;
  45111. return $core.withContext(function($ctx1) {
  45112. var $1,$receiver;
  45113. $1=$self._context();
  45114. $ctx1.sendIdx["context"]=1;
  45115. if(($receiver = $1) == null || $receiver.a$nil){
  45116. return true;
  45117. } else {
  45118. $1;
  45119. }
  45120. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45121. return $core.withContext(function($ctx2) {
  45122. return $recv($self._context())._isTopContext();
  45123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45124. }));
  45125. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45126. },
  45127. args: [],
  45128. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45129. referencedClasses: [],
  45130. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45131. }),
  45132. $globals.ASTDebugger);
  45133. $core.addMethod(
  45134. $core.method({
  45135. selector: "context",
  45136. protocol: "accessing",
  45137. fn: function (){
  45138. var self=this,$self=this;
  45139. return $self["@context"];
  45140. },
  45141. args: [],
  45142. source: "context\x0a\x09^ context",
  45143. referencedClasses: [],
  45144. messageSends: []
  45145. }),
  45146. $globals.ASTDebugger);
  45147. $core.addMethod(
  45148. $core.method({
  45149. selector: "context:",
  45150. protocol: "accessing",
  45151. fn: function (aContext){
  45152. var self=this,$self=this;
  45153. $self["@context"]=aContext;
  45154. return self;
  45155. },
  45156. args: ["aContext"],
  45157. source: "context: aContext\x0a\x09context := aContext",
  45158. referencedClasses: [],
  45159. messageSends: []
  45160. }),
  45161. $globals.ASTDebugger);
  45162. $core.addMethod(
  45163. $core.method({
  45164. selector: "flushInnerContexts",
  45165. protocol: "actions",
  45166. fn: function (){
  45167. var self=this,$self=this;
  45168. return $core.withContext(function($ctx1) {
  45169. var $1,$receiver;
  45170. $1=$self._context();
  45171. if(($receiver = $1) == null || $receiver.a$nil){
  45172. $1;
  45173. } else {
  45174. var cxt;
  45175. cxt=$receiver;
  45176. $recv(cxt)._innerContext_(nil);
  45177. }
  45178. return self;
  45179. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45180. },
  45181. args: [],
  45182. 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 ]",
  45183. referencedClasses: [],
  45184. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45185. }),
  45186. $globals.ASTDebugger);
  45187. $core.addMethod(
  45188. $core.method({
  45189. selector: "interpreter",
  45190. protocol: "accessing",
  45191. fn: function (){
  45192. var self=this,$self=this;
  45193. return $core.withContext(function($ctx1) {
  45194. var $1,$receiver;
  45195. $1=$self._context();
  45196. if(($receiver = $1) == null || $receiver.a$nil){
  45197. return $1;
  45198. } else {
  45199. var ctx;
  45200. ctx=$receiver;
  45201. return $recv(ctx)._interpreter();
  45202. }
  45203. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45204. },
  45205. args: [],
  45206. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45207. referencedClasses: [],
  45208. messageSends: ["ifNotNil:", "context", "interpreter"]
  45209. }),
  45210. $globals.ASTDebugger);
  45211. $core.addMethod(
  45212. $core.method({
  45213. selector: "method",
  45214. protocol: "accessing",
  45215. fn: function (){
  45216. var self=this,$self=this;
  45217. return $core.withContext(function($ctx1) {
  45218. return $recv($self._context())._method();
  45219. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45220. },
  45221. args: [],
  45222. source: "method\x0a\x09^ self context method",
  45223. referencedClasses: [],
  45224. messageSends: ["method", "context"]
  45225. }),
  45226. $globals.ASTDebugger);
  45227. $core.addMethod(
  45228. $core.method({
  45229. selector: "node",
  45230. protocol: "accessing",
  45231. fn: function (){
  45232. var self=this,$self=this;
  45233. return $core.withContext(function($ctx1) {
  45234. var $1,$receiver;
  45235. $1=$self._interpreter();
  45236. $ctx1.sendIdx["interpreter"]=1;
  45237. if(($receiver = $1) == null || $receiver.a$nil){
  45238. return $1;
  45239. } else {
  45240. return $recv($self._interpreter())._node();
  45241. }
  45242. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45243. },
  45244. args: [],
  45245. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45246. referencedClasses: [],
  45247. messageSends: ["ifNotNil:", "interpreter", "node"]
  45248. }),
  45249. $globals.ASTDebugger);
  45250. $core.addMethod(
  45251. $core.method({
  45252. selector: "onStep",
  45253. protocol: "private",
  45254. fn: function (){
  45255. var self=this,$self=this;
  45256. return $core.withContext(function($ctx1) {
  45257. var $1,$3,$2,$4,$6,$5,$receiver;
  45258. $1=$self._interpreter();
  45259. $ctx1.sendIdx["interpreter"]=1;
  45260. $self["@result"]=$recv($1)._result();
  45261. $3=$self._interpreter();
  45262. $ctx1.sendIdx["interpreter"]=2;
  45263. $2=$recv($3)._atEnd();
  45264. $ctx1.sendIdx["atEnd"]=1;
  45265. if($core.assert($2)){
  45266. $4=$recv($self._context())._outerContext();
  45267. if(($receiver = $4) == null || $receiver.a$nil){
  45268. $4;
  45269. } else {
  45270. var outerContext;
  45271. outerContext=$receiver;
  45272. $self._context_(outerContext);
  45273. }
  45274. $6=$self._interpreter();
  45275. $ctx1.sendIdx["interpreter"]=3;
  45276. $5=$recv($6)._atEnd();
  45277. if(!$core.assert($5)){
  45278. $recv($self._interpreter())._skip();
  45279. }
  45280. }
  45281. $self._flushInnerContexts();
  45282. return self;
  45283. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45284. },
  45285. args: [],
  45286. 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",
  45287. referencedClasses: [],
  45288. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45289. }),
  45290. $globals.ASTDebugger);
  45291. $core.addMethod(
  45292. $core.method({
  45293. selector: "proceed",
  45294. protocol: "stepping",
  45295. fn: function (){
  45296. var self=this,$self=this;
  45297. return $core.withContext(function($ctx1) {
  45298. $recv((function(){
  45299. return $core.withContext(function($ctx2) {
  45300. return $self._atEnd();
  45301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45302. }))._whileFalse_((function(){
  45303. return $core.withContext(function($ctx2) {
  45304. return $self._stepOver();
  45305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45306. }));
  45307. return self;
  45308. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45309. },
  45310. args: [],
  45311. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45312. referencedClasses: [],
  45313. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45314. }),
  45315. $globals.ASTDebugger);
  45316. $core.addMethod(
  45317. $core.method({
  45318. selector: "restart",
  45319. protocol: "stepping",
  45320. fn: function (){
  45321. var self=this,$self=this;
  45322. return $core.withContext(function($ctx1) {
  45323. $recv($self._interpreter())._restart();
  45324. $self._flushInnerContexts();
  45325. return self;
  45326. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45327. },
  45328. args: [],
  45329. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45330. referencedClasses: [],
  45331. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45332. }),
  45333. $globals.ASTDebugger);
  45334. $core.addMethod(
  45335. $core.method({
  45336. selector: "result",
  45337. protocol: "accessing",
  45338. fn: function (){
  45339. var self=this,$self=this;
  45340. return $self["@result"];
  45341. },
  45342. args: [],
  45343. source: "result\x0a\x09^ result",
  45344. referencedClasses: [],
  45345. messageSends: []
  45346. }),
  45347. $globals.ASTDebugger);
  45348. $core.addMethod(
  45349. $core.method({
  45350. selector: "stepInto",
  45351. protocol: "stepping",
  45352. fn: function (){
  45353. var self=this,$self=this;
  45354. return $core.withContext(function($ctx1) {
  45355. $self._shouldBeImplemented();
  45356. return self;
  45357. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45358. },
  45359. args: [],
  45360. source: "stepInto\x0a\x09self shouldBeImplemented",
  45361. referencedClasses: [],
  45362. messageSends: ["shouldBeImplemented"]
  45363. }),
  45364. $globals.ASTDebugger);
  45365. $core.addMethod(
  45366. $core.method({
  45367. selector: "stepOver",
  45368. protocol: "stepping",
  45369. fn: function (){
  45370. var self=this,$self=this;
  45371. return $core.withContext(function($ctx1) {
  45372. var $1,$2;
  45373. $1=$recv($self._context())._isTopContext();
  45374. if($core.assert($1)){
  45375. $recv($self._interpreter())._stepOver();
  45376. } else {
  45377. $2=$self._interpreter();
  45378. $ctx1.sendIdx["interpreter"]=1;
  45379. $recv($2)._skip();
  45380. }
  45381. $self._onStep();
  45382. return self;
  45383. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45384. },
  45385. args: [],
  45386. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45387. referencedClasses: [],
  45388. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45389. }),
  45390. $globals.ASTDebugger);
  45391. $core.addMethod(
  45392. $core.method({
  45393. selector: "context:",
  45394. protocol: "instance creation",
  45395. fn: function (aContext){
  45396. var self=this,$self=this;
  45397. return $core.withContext(function($ctx1) {
  45398. var $1;
  45399. $1=$self._new();
  45400. $recv($1)._context_(aContext);
  45401. return $recv($1)._yourself();
  45402. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45403. },
  45404. args: ["aContext"],
  45405. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45406. referencedClasses: [],
  45407. messageSends: ["context:", "new", "yourself"]
  45408. }),
  45409. $globals.ASTDebugger.a$cls);
  45410. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45411. $core.addMethod(
  45412. $core.method({
  45413. selector: "interpreter",
  45414. protocol: "accessing",
  45415. fn: function (){
  45416. var self=this,$self=this;
  45417. return $self["@interpreter"];
  45418. },
  45419. args: [],
  45420. source: "interpreter\x0a\x09^ interpreter",
  45421. referencedClasses: [],
  45422. messageSends: []
  45423. }),
  45424. $globals.ASTEnterNode);
  45425. $core.addMethod(
  45426. $core.method({
  45427. selector: "interpreter:",
  45428. protocol: "accessing",
  45429. fn: function (anObject){
  45430. var self=this,$self=this;
  45431. $self["@interpreter"]=anObject;
  45432. return self;
  45433. },
  45434. args: ["anObject"],
  45435. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45436. referencedClasses: [],
  45437. messageSends: []
  45438. }),
  45439. $globals.ASTEnterNode);
  45440. $core.addMethod(
  45441. $core.method({
  45442. selector: "visitBlockNode:",
  45443. protocol: "visiting",
  45444. fn: function (aNode){
  45445. var self=this,$self=this;
  45446. return aNode;
  45447. },
  45448. args: ["aNode"],
  45449. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45450. referencedClasses: [],
  45451. messageSends: []
  45452. }),
  45453. $globals.ASTEnterNode);
  45454. $core.addMethod(
  45455. $core.method({
  45456. selector: "visitDagNode:",
  45457. protocol: "visiting",
  45458. fn: function (aNode){
  45459. var self=this,$self=this;
  45460. return $core.withContext(function($ctx1) {
  45461. var $early={};
  45462. try {
  45463. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45464. throw $early=[aNode];
  45465. }),(function(nodes){
  45466. return $core.withContext(function($ctx2) {
  45467. throw $early=[$self._visit_($recv(nodes)._first())];
  45468. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45469. }));
  45470. return self;
  45471. }
  45472. catch(e) {if(e===$early)return e[0]; throw e}
  45473. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45474. },
  45475. args: ["aNode"],
  45476. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45477. referencedClasses: [],
  45478. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45479. }),
  45480. $globals.ASTEnterNode);
  45481. $core.addMethod(
  45482. $core.method({
  45483. selector: "visitSequenceNode:",
  45484. protocol: "visiting",
  45485. fn: function (aNode){
  45486. var self=this,$self=this;
  45487. return $core.withContext(function($ctx1) {
  45488. var $1;
  45489. $recv($recv(aNode)._temps())._do_((function(each){
  45490. return $core.withContext(function($ctx2) {
  45491. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45493. }));
  45494. $1=(
  45495. $ctx1.supercall = true,
  45496. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45497. $ctx1.supercall = false;
  45498. return $1;
  45499. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45500. },
  45501. args: ["aNode"],
  45502. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45503. referencedClasses: [],
  45504. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45505. }),
  45506. $globals.ASTEnterNode);
  45507. $core.addMethod(
  45508. $core.method({
  45509. selector: "on:",
  45510. protocol: "instance creation",
  45511. fn: function (anInterpreter){
  45512. var self=this,$self=this;
  45513. return $core.withContext(function($ctx1) {
  45514. var $1;
  45515. $1=$self._new();
  45516. $recv($1)._interpreter_(anInterpreter);
  45517. return $recv($1)._yourself();
  45518. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45519. },
  45520. args: ["anInterpreter"],
  45521. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45522. referencedClasses: [],
  45523. messageSends: ["interpreter:", "new", "yourself"]
  45524. }),
  45525. $globals.ASTEnterNode.a$cls);
  45526. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45527. $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";
  45528. $core.addMethod(
  45529. $core.method({
  45530. selector: "assign:to:",
  45531. protocol: "private",
  45532. fn: function (aNode,anObject){
  45533. var self=this,$self=this;
  45534. return $core.withContext(function($ctx1) {
  45535. var $1,$3,$2,$4;
  45536. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45537. if($core.assert($1)){
  45538. $3=$self._context();
  45539. $ctx1.sendIdx["context"]=1;
  45540. $2=$recv($3)._receiver();
  45541. $4=$recv(aNode)._value();
  45542. $ctx1.sendIdx["value"]=1;
  45543. $recv($2)._instVarAt_put_($4,anObject);
  45544. } else {
  45545. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45546. }
  45547. return self;
  45548. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45549. },
  45550. args: ["aNode", "anObject"],
  45551. 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 ]",
  45552. referencedClasses: [],
  45553. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45554. }),
  45555. $globals.ASTInterpreter);
  45556. $core.addMethod(
  45557. $core.method({
  45558. selector: "atEnd",
  45559. protocol: "testing",
  45560. fn: function (){
  45561. var self=this,$self=this;
  45562. return $core.withContext(function($ctx1) {
  45563. var $1;
  45564. $1=$self["@forceAtEnd"];
  45565. if($core.assert($1)){
  45566. return true;
  45567. }
  45568. return $recv($self._hasReturned())._or_((function(){
  45569. return $core.withContext(function($ctx2) {
  45570. return $recv($self._node())._isNil();
  45571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45572. }));
  45573. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45574. },
  45575. args: [],
  45576. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45577. referencedClasses: [],
  45578. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45579. }),
  45580. $globals.ASTInterpreter);
  45581. $core.addMethod(
  45582. $core.method({
  45583. selector: "context",
  45584. protocol: "accessing",
  45585. fn: function (){
  45586. var self=this,$self=this;
  45587. return $self["@context"];
  45588. },
  45589. args: [],
  45590. source: "context\x0a\x09^ context",
  45591. referencedClasses: [],
  45592. messageSends: []
  45593. }),
  45594. $globals.ASTInterpreter);
  45595. $core.addMethod(
  45596. $core.method({
  45597. selector: "context:",
  45598. protocol: "accessing",
  45599. fn: function (aContext){
  45600. var self=this,$self=this;
  45601. $self["@context"]=aContext;
  45602. return self;
  45603. },
  45604. args: ["aContext"],
  45605. source: "context: aContext\x0a\x09context := aContext",
  45606. referencedClasses: [],
  45607. messageSends: []
  45608. }),
  45609. $globals.ASTInterpreter);
  45610. $core.addMethod(
  45611. $core.method({
  45612. selector: "enterNode",
  45613. protocol: "interpreting",
  45614. fn: function (){
  45615. var self=this,$self=this;
  45616. return $core.withContext(function($ctx1) {
  45617. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45618. return self;
  45619. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45620. },
  45621. args: [],
  45622. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45623. referencedClasses: ["ASTEnterNode"],
  45624. messageSends: ["node:", "visit:", "on:", "node"]
  45625. }),
  45626. $globals.ASTInterpreter);
  45627. $core.addMethod(
  45628. $core.method({
  45629. selector: "eval:",
  45630. protocol: "private",
  45631. fn: function (aString){
  45632. var self=this,$self=this;
  45633. var source,function_;
  45634. return $core.withContext(function($ctx1) {
  45635. var $3,$2,$1;
  45636. source=$recv($globals.String)._streamContents_((function(str){
  45637. return $core.withContext(function($ctx2) {
  45638. $recv(str)._nextPutAll_("0,(function(");
  45639. $ctx2.sendIdx["nextPutAll:"]=1;
  45640. $3=$self._context();
  45641. $ctx2.sendIdx["context"]=1;
  45642. $2=$recv($3)._locals();
  45643. $ctx2.sendIdx["locals"]=1;
  45644. $1=$recv($2)._keys();
  45645. $recv($1)._do_separatedBy_((function(each){
  45646. return $core.withContext(function($ctx3) {
  45647. return $recv(str)._nextPutAll_(each);
  45648. $ctx3.sendIdx["nextPutAll:"]=2;
  45649. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  45650. }),(function(){
  45651. return $core.withContext(function($ctx3) {
  45652. return $recv(str)._nextPutAll_(",");
  45653. $ctx3.sendIdx["nextPutAll:"]=3;
  45654. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45655. }));
  45656. $recv(str)._nextPutAll_("){ return (function() {");
  45657. $ctx2.sendIdx["nextPutAll:"]=4;
  45658. $recv(str)._nextPutAll_(aString);
  45659. $ctx2.sendIdx["nextPutAll:"]=5;
  45660. return $recv(str)._nextPutAll_("})()})");
  45661. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  45662. }));
  45663. function_=$recv($globals.Compiler)._eval_(source);
  45664. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  45665. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  45666. },
  45667. args: ["aString"],
  45668. 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",
  45669. referencedClasses: ["String", "Compiler"],
  45670. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  45671. }),
  45672. $globals.ASTInterpreter);
  45673. $core.addMethod(
  45674. $core.method({
  45675. selector: "hasReturned",
  45676. protocol: "testing",
  45677. fn: function (){
  45678. var self=this,$self=this;
  45679. return $core.withContext(function($ctx1) {
  45680. var $1,$receiver;
  45681. $1=$self["@returned"];
  45682. if(($receiver = $1) == null || $receiver.a$nil){
  45683. return false;
  45684. } else {
  45685. return $1;
  45686. }
  45687. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  45688. },
  45689. args: [],
  45690. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  45691. referencedClasses: [],
  45692. messageSends: ["ifNil:"]
  45693. }),
  45694. $globals.ASTInterpreter);
  45695. $core.addMethod(
  45696. $core.method({
  45697. selector: "initialize",
  45698. protocol: "initialization",
  45699. fn: function (){
  45700. var self=this,$self=this;
  45701. return $core.withContext(function($ctx1) {
  45702. (
  45703. $ctx1.supercall = true,
  45704. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  45705. $ctx1.supercall = false;
  45706. $self["@forceAtEnd"]=false;
  45707. return self;
  45708. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  45709. },
  45710. args: [],
  45711. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  45712. referencedClasses: [],
  45713. messageSends: ["initialize"]
  45714. }),
  45715. $globals.ASTInterpreter);
  45716. $core.addMethod(
  45717. $core.method({
  45718. selector: "interpret",
  45719. protocol: "interpreting",
  45720. fn: function (){
  45721. var self=this,$self=this;
  45722. return $core.withContext(function($ctx1) {
  45723. $self._visit_($self._node());
  45724. return self;
  45725. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  45726. },
  45727. args: [],
  45728. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  45729. referencedClasses: [],
  45730. messageSends: ["visit:", "node"]
  45731. }),
  45732. $globals.ASTInterpreter);
  45733. $core.addMethod(
  45734. $core.method({
  45735. selector: "messageFromSendNode:arguments:",
  45736. protocol: "private",
  45737. fn: function (aSendNode,aCollection){
  45738. var self=this,$self=this;
  45739. return $core.withContext(function($ctx1) {
  45740. var $1;
  45741. $1=$recv($globals.Message)._new();
  45742. $recv($1)._selector_($recv(aSendNode)._selector());
  45743. $recv($1)._arguments_(aCollection);
  45744. return $recv($1)._yourself();
  45745. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  45746. },
  45747. args: ["aSendNode", "aCollection"],
  45748. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  45749. referencedClasses: ["Message"],
  45750. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  45751. }),
  45752. $globals.ASTInterpreter);
  45753. $core.addMethod(
  45754. $core.method({
  45755. selector: "messageNotUnderstood:receiver:",
  45756. protocol: "private",
  45757. fn: function (aMessage,anObject){
  45758. var self=this,$self=this;
  45759. return $core.withContext(function($ctx1) {
  45760. var $1;
  45761. $1=$recv($globals.MessageNotUnderstood)._new();
  45762. $recv($1)._message_(aMessage);
  45763. $recv($1)._receiver_(anObject);
  45764. $recv($1)._signal();
  45765. return self;
  45766. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  45767. },
  45768. args: ["aMessage", "anObject"],
  45769. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  45770. referencedClasses: ["MessageNotUnderstood"],
  45771. messageSends: ["message:", "new", "receiver:", "signal"]
  45772. }),
  45773. $globals.ASTInterpreter);
  45774. $core.addMethod(
  45775. $core.method({
  45776. selector: "next",
  45777. protocol: "interpreting",
  45778. fn: function (){
  45779. var self=this,$self=this;
  45780. var nd,nextNode;
  45781. return $core.withContext(function($ctx1) {
  45782. var $1,$2,$receiver;
  45783. nd=$self._node();
  45784. $1=$recv(nd)._parent();
  45785. if(($receiver = $1) == null || $receiver.a$nil){
  45786. nextNode=$1;
  45787. } else {
  45788. var parent;
  45789. parent=$receiver;
  45790. $2=$recv(parent)._nextSiblingNode_(nd);
  45791. if(($receiver = $2) == null || $receiver.a$nil){
  45792. nextNode=parent;
  45793. } else {
  45794. var sibling;
  45795. sibling=$receiver;
  45796. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  45797. }
  45798. }
  45799. $self._node_(nextNode);
  45800. return self;
  45801. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  45802. },
  45803. args: [],
  45804. 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",
  45805. referencedClasses: ["ASTEnterNode"],
  45806. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  45807. }),
  45808. $globals.ASTInterpreter);
  45809. $core.addMethod(
  45810. $core.method({
  45811. selector: "node",
  45812. protocol: "accessing",
  45813. fn: function (){
  45814. var self=this,$self=this;
  45815. return $self["@node"];
  45816. },
  45817. args: [],
  45818. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  45819. referencedClasses: [],
  45820. messageSends: []
  45821. }),
  45822. $globals.ASTInterpreter);
  45823. $core.addMethod(
  45824. $core.method({
  45825. selector: "node:",
  45826. protocol: "accessing",
  45827. fn: function (aNode){
  45828. var self=this,$self=this;
  45829. $self["@node"]=aNode;
  45830. return self;
  45831. },
  45832. args: ["aNode"],
  45833. source: "node: aNode\x0a\x09node := aNode",
  45834. referencedClasses: [],
  45835. messageSends: []
  45836. }),
  45837. $globals.ASTInterpreter);
  45838. $core.addMethod(
  45839. $core.method({
  45840. selector: "peek",
  45841. protocol: "stack",
  45842. fn: function (){
  45843. var self=this,$self=this;
  45844. return $core.withContext(function($ctx1) {
  45845. var $1;
  45846. var $early={};
  45847. try {
  45848. $1=$self._stack();
  45849. $ctx1.sendIdx["stack"]=1;
  45850. $recv($1)._ifEmpty_((function(){
  45851. throw $early=[nil];
  45852. }));
  45853. return $recv($self._stack())._last();
  45854. }
  45855. catch(e) {if(e===$early)return e[0]; throw e}
  45856. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  45857. },
  45858. args: [],
  45859. 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",
  45860. referencedClasses: [],
  45861. messageSends: ["ifEmpty:", "stack", "last"]
  45862. }),
  45863. $globals.ASTInterpreter);
  45864. $core.addMethod(
  45865. $core.method({
  45866. selector: "pop",
  45867. protocol: "stack",
  45868. fn: function (){
  45869. var self=this,$self=this;
  45870. var peekedValue;
  45871. return $core.withContext(function($ctx1) {
  45872. peekedValue=$self._peek();
  45873. $recv($self._stack())._removeLast();
  45874. return peekedValue;
  45875. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  45876. },
  45877. args: [],
  45878. 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",
  45879. referencedClasses: [],
  45880. messageSends: ["peek", "removeLast", "stack"]
  45881. }),
  45882. $globals.ASTInterpreter);
  45883. $core.addMethod(
  45884. $core.method({
  45885. selector: "proceed",
  45886. protocol: "interpreting",
  45887. fn: function (){
  45888. var self=this,$self=this;
  45889. return $core.withContext(function($ctx1) {
  45890. $recv((function(){
  45891. return $core.withContext(function($ctx2) {
  45892. return $self._atEnd();
  45893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45894. }))._whileFalse_((function(){
  45895. return $core.withContext(function($ctx2) {
  45896. return $self._step();
  45897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45898. }));
  45899. return self;
  45900. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  45901. },
  45902. args: [],
  45903. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  45904. referencedClasses: [],
  45905. messageSends: ["whileFalse:", "atEnd", "step"]
  45906. }),
  45907. $globals.ASTInterpreter);
  45908. $core.addMethod(
  45909. $core.method({
  45910. selector: "push:",
  45911. protocol: "stack",
  45912. fn: function (anObject){
  45913. var self=this,$self=this;
  45914. return $core.withContext(function($ctx1) {
  45915. return $recv($self._stack())._add_(anObject);
  45916. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  45917. },
  45918. args: ["anObject"],
  45919. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  45920. referencedClasses: [],
  45921. messageSends: ["add:", "stack"]
  45922. }),
  45923. $globals.ASTInterpreter);
  45924. $core.addMethod(
  45925. $core.method({
  45926. selector: "restart",
  45927. protocol: "interpreting",
  45928. fn: function (){
  45929. var self=this,$self=this;
  45930. return $core.withContext(function($ctx1) {
  45931. $self._node_($recv($self._context())._ast());
  45932. $self._enterNode();
  45933. return self;
  45934. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  45935. },
  45936. args: [],
  45937. source: "restart\x0a\x09self node: self context ast; enterNode",
  45938. referencedClasses: [],
  45939. messageSends: ["node:", "ast", "context", "enterNode"]
  45940. }),
  45941. $globals.ASTInterpreter);
  45942. $core.addMethod(
  45943. $core.method({
  45944. selector: "result",
  45945. protocol: "accessing",
  45946. fn: function (){
  45947. var self=this,$self=this;
  45948. return $core.withContext(function($ctx1) {
  45949. var $1;
  45950. $1=$self._hasReturned();
  45951. if($core.assert($1)){
  45952. return $self._returnValue();
  45953. } else {
  45954. return $recv($self._context())._receiver();
  45955. }
  45956. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  45957. },
  45958. args: [],
  45959. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  45960. referencedClasses: [],
  45961. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  45962. }),
  45963. $globals.ASTInterpreter);
  45964. $core.addMethod(
  45965. $core.method({
  45966. selector: "returnValue",
  45967. protocol: "accessing",
  45968. fn: function (){
  45969. var self=this,$self=this;
  45970. return $self["@returnValue"];
  45971. },
  45972. args: [],
  45973. source: "returnValue\x0a\x09^ returnValue",
  45974. referencedClasses: [],
  45975. messageSends: []
  45976. }),
  45977. $globals.ASTInterpreter);
  45978. $core.addMethod(
  45979. $core.method({
  45980. selector: "returnValue:",
  45981. protocol: "accessing",
  45982. fn: function (anObject){
  45983. var self=this,$self=this;
  45984. $self["@returnValue"]=anObject;
  45985. return self;
  45986. },
  45987. args: ["anObject"],
  45988. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  45989. referencedClasses: [],
  45990. messageSends: []
  45991. }),
  45992. $globals.ASTInterpreter);
  45993. $core.addMethod(
  45994. $core.method({
  45995. selector: "sendMessage:to:superSend:",
  45996. protocol: "private",
  45997. fn: function (aMessage,anObject,aBoolean){
  45998. var self=this,$self=this;
  45999. var method;
  46000. return $core.withContext(function($ctx1) {
  46001. var $2,$1,$3,$receiver;
  46002. var $early={};
  46003. try {
  46004. if(!$core.assert(aBoolean)){
  46005. return $recv(aMessage)._sendTo_(anObject);
  46006. }
  46007. $2=$recv(anObject)._class();
  46008. $ctx1.sendIdx["class"]=1;
  46009. $1=$recv($2)._superclass();
  46010. $ctx1.sendIdx["superclass"]=1;
  46011. if(($receiver = $1) == null || $receiver.a$nil){
  46012. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46013. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46014. return $3;
  46015. } else {
  46016. $1;
  46017. }
  46018. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46019. return $core.withContext(function($ctx2) {
  46020. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46022. }));
  46023. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46024. }
  46025. catch(e) {if(e===$early)return e[0]; throw e}
  46026. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46027. },
  46028. args: ["aMessage", "anObject", "aBoolean"],
  46029. 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",
  46030. referencedClasses: [],
  46031. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46032. }),
  46033. $globals.ASTInterpreter);
  46034. $core.addMethod(
  46035. $core.method({
  46036. selector: "setNonLocalReturnFromContext:",
  46037. protocol: "interpreting",
  46038. fn: function (aContext){
  46039. var self=this,$self=this;
  46040. return $core.withContext(function($ctx1) {
  46041. var $2,$1;
  46042. $2=$recv(aContext)._interpreter();
  46043. $ctx1.sendIdx["interpreter"]=1;
  46044. $1=$recv($2)._hasReturned();
  46045. if($core.assert($1)){
  46046. $self["@returned"]=true;
  46047. $self["@returned"];
  46048. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46049. }
  46050. return self;
  46051. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46052. },
  46053. args: ["aContext"],
  46054. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46055. referencedClasses: [],
  46056. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46057. }),
  46058. $globals.ASTInterpreter);
  46059. $core.addMethod(
  46060. $core.method({
  46061. selector: "skip",
  46062. protocol: "interpreting",
  46063. fn: function (){
  46064. var self=this,$self=this;
  46065. return $core.withContext(function($ctx1) {
  46066. $self._next();
  46067. return self;
  46068. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46069. },
  46070. args: [],
  46071. source: "skip\x0a\x09self next",
  46072. referencedClasses: [],
  46073. messageSends: ["next"]
  46074. }),
  46075. $globals.ASTInterpreter);
  46076. $core.addMethod(
  46077. $core.method({
  46078. selector: "stack",
  46079. protocol: "accessing",
  46080. fn: function (){
  46081. var self=this,$self=this;
  46082. return $core.withContext(function($ctx1) {
  46083. var $1,$receiver;
  46084. $1=$self["@stack"];
  46085. if(($receiver = $1) == null || $receiver.a$nil){
  46086. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46087. return $self["@stack"];
  46088. } else {
  46089. return $1;
  46090. }
  46091. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46092. },
  46093. args: [],
  46094. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46095. referencedClasses: ["OrderedCollection"],
  46096. messageSends: ["ifNil:", "new"]
  46097. }),
  46098. $globals.ASTInterpreter);
  46099. $core.addMethod(
  46100. $core.method({
  46101. selector: "step",
  46102. protocol: "interpreting",
  46103. fn: function (){
  46104. var self=this,$self=this;
  46105. return $core.withContext(function($ctx1) {
  46106. $self._interpret();
  46107. $self._next();
  46108. return self;
  46109. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46110. },
  46111. args: [],
  46112. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46113. referencedClasses: [],
  46114. messageSends: ["interpret", "next"]
  46115. }),
  46116. $globals.ASTInterpreter);
  46117. $core.addMethod(
  46118. $core.method({
  46119. selector: "stepOver",
  46120. protocol: "interpreting",
  46121. fn: function (){
  46122. var self=this,$self=this;
  46123. return $core.withContext(function($ctx1) {
  46124. var $2,$1;
  46125. $self._step();
  46126. $ctx1.sendIdx["step"]=1;
  46127. $recv((function(){
  46128. return $core.withContext(function($ctx2) {
  46129. $2=$self._node();
  46130. $ctx2.sendIdx["node"]=1;
  46131. $1=$recv($2)._isNil();
  46132. return $recv($1)._or_((function(){
  46133. return $core.withContext(function($ctx3) {
  46134. return $recv($self._node())._isSteppingNode();
  46135. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46136. }));
  46137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46138. }))._whileFalse_((function(){
  46139. return $core.withContext(function($ctx2) {
  46140. return $self._step();
  46141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46142. }));
  46143. return self;
  46144. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46145. },
  46146. args: [],
  46147. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46148. referencedClasses: [],
  46149. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46150. }),
  46151. $globals.ASTInterpreter);
  46152. $core.addMethod(
  46153. $core.method({
  46154. selector: "visit:",
  46155. protocol: "visiting",
  46156. fn: function (aNode){
  46157. var self=this,$self=this;
  46158. return $core.withContext(function($ctx1) {
  46159. var $1;
  46160. $1=$self._hasReturned();
  46161. if(!$core.assert($1)){
  46162. (
  46163. $ctx1.supercall = true,
  46164. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46165. $ctx1.supercall = false;
  46166. }
  46167. return self;
  46168. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46169. },
  46170. args: ["aNode"],
  46171. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46172. referencedClasses: [],
  46173. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46174. }),
  46175. $globals.ASTInterpreter);
  46176. $core.addMethod(
  46177. $core.method({
  46178. selector: "visitAssignmentNode:",
  46179. protocol: "visiting",
  46180. fn: function (aNode){
  46181. var self=this,$self=this;
  46182. var poppedValue;
  46183. return $core.withContext(function($ctx1) {
  46184. poppedValue=$self._pop();
  46185. $ctx1.sendIdx["pop"]=1;
  46186. $self._pop();
  46187. $self._push_(poppedValue);
  46188. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46189. return self;
  46190. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46191. },
  46192. args: ["aNode"],
  46193. 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",
  46194. referencedClasses: [],
  46195. messageSends: ["pop", "push:", "assign:to:", "left"]
  46196. }),
  46197. $globals.ASTInterpreter);
  46198. $core.addMethod(
  46199. $core.method({
  46200. selector: "visitBlockNode:",
  46201. protocol: "visiting",
  46202. fn: function (aNode){
  46203. var self=this,$self=this;
  46204. var block;
  46205. return $core.withContext(function($ctx1) {
  46206. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46207. $self._push_(block);
  46208. return self;
  46209. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46210. },
  46211. args: ["aNode"],
  46212. 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",
  46213. referencedClasses: ["AIBlockClosure"],
  46214. messageSends: ["forContext:node:", "context", "push:"]
  46215. }),
  46216. $globals.ASTInterpreter);
  46217. $core.addMethod(
  46218. $core.method({
  46219. selector: "visitBlockSequenceNode:",
  46220. protocol: "visiting",
  46221. fn: function (aNode){
  46222. var self=this,$self=this;
  46223. return $core.withContext(function($ctx1) {
  46224. (
  46225. $ctx1.supercall = true,
  46226. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46227. $ctx1.supercall = false;
  46228. $self["@forceAtEnd"]=true;
  46229. return self;
  46230. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46231. },
  46232. args: ["aNode"],
  46233. 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",
  46234. referencedClasses: [],
  46235. messageSends: ["visitBlockSequenceNode:"]
  46236. }),
  46237. $globals.ASTInterpreter);
  46238. $core.addMethod(
  46239. $core.method({
  46240. selector: "visitDagNode:",
  46241. protocol: "visiting",
  46242. fn: function (aNode){
  46243. var self=this,$self=this;
  46244. return self;
  46245. },
  46246. args: ["aNode"],
  46247. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46248. referencedClasses: [],
  46249. messageSends: []
  46250. }),
  46251. $globals.ASTInterpreter);
  46252. $core.addMethod(
  46253. $core.method({
  46254. selector: "visitDynamicArrayNode:",
  46255. protocol: "visiting",
  46256. fn: function (aNode){
  46257. var self=this,$self=this;
  46258. var array;
  46259. return $core.withContext(function($ctx1) {
  46260. array=[];
  46261. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46262. return $core.withContext(function($ctx2) {
  46263. return $recv(array)._addFirst_($self._pop());
  46264. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46265. }));
  46266. $self._push_(array);
  46267. return self;
  46268. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46269. },
  46270. args: ["aNode"],
  46271. 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",
  46272. referencedClasses: [],
  46273. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46274. }),
  46275. $globals.ASTInterpreter);
  46276. $core.addMethod(
  46277. $core.method({
  46278. selector: "visitDynamicDictionaryNode:",
  46279. protocol: "visiting",
  46280. fn: function (aNode){
  46281. var self=this,$self=this;
  46282. var keyValueList;
  46283. return $core.withContext(function($ctx1) {
  46284. keyValueList=$recv($globals.OrderedCollection)._new();
  46285. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46286. return $core.withContext(function($ctx2) {
  46287. return $recv(keyValueList)._add_($self._pop());
  46288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46289. }));
  46290. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46291. return self;
  46292. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46293. },
  46294. args: ["aNode"],
  46295. 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)",
  46296. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46297. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46298. }),
  46299. $globals.ASTInterpreter);
  46300. $core.addMethod(
  46301. $core.method({
  46302. selector: "visitJSStatementNode:",
  46303. protocol: "visiting",
  46304. fn: function (aNode){
  46305. var self=this,$self=this;
  46306. return $core.withContext(function($ctx1) {
  46307. $self["@returned"]=true;
  46308. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46309. return self;
  46310. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46311. },
  46312. args: ["aNode"],
  46313. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46314. referencedClasses: [],
  46315. messageSends: ["returnValue:", "eval:", "source"]
  46316. }),
  46317. $globals.ASTInterpreter);
  46318. $core.addMethod(
  46319. $core.method({
  46320. selector: "visitReturnNode:",
  46321. protocol: "visiting",
  46322. fn: function (aNode){
  46323. var self=this,$self=this;
  46324. return $core.withContext(function($ctx1) {
  46325. $self["@returned"]=true;
  46326. $self._returnValue_($self._pop());
  46327. return self;
  46328. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46329. },
  46330. args: ["aNode"],
  46331. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46332. referencedClasses: [],
  46333. messageSends: ["returnValue:", "pop"]
  46334. }),
  46335. $globals.ASTInterpreter);
  46336. $core.addMethod(
  46337. $core.method({
  46338. selector: "visitSendNode:",
  46339. protocol: "visiting",
  46340. fn: function (aNode){
  46341. var self=this,$self=this;
  46342. var receiver,args,message,result;
  46343. return $core.withContext(function($ctx1) {
  46344. var $1;
  46345. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46346. return $core.withContext(function($ctx2) {
  46347. return $self._pop();
  46348. $ctx2.sendIdx["pop"]=1;
  46349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46350. }));
  46351. receiver=$self._peek();
  46352. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46353. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46354. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46355. return $core.withContext(function($ctx2) {
  46356. return $recv($recv(aNode)._isLastChild())._not();
  46357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46358. }));
  46359. if(!$core.assert($1)){
  46360. $self._pop();
  46361. $self._push_(result);
  46362. }
  46363. return self;
  46364. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46365. },
  46366. args: ["aNode"],
  46367. 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 ]",
  46368. referencedClasses: [],
  46369. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46370. }),
  46371. $globals.ASTInterpreter);
  46372. $core.addMethod(
  46373. $core.method({
  46374. selector: "visitValueNode:",
  46375. protocol: "visiting",
  46376. fn: function (aNode){
  46377. var self=this,$self=this;
  46378. return $core.withContext(function($ctx1) {
  46379. $self._push_($recv(aNode)._value());
  46380. return self;
  46381. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46382. },
  46383. args: ["aNode"],
  46384. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46385. referencedClasses: [],
  46386. messageSends: ["push:", "value"]
  46387. }),
  46388. $globals.ASTInterpreter);
  46389. $core.addMethod(
  46390. $core.method({
  46391. selector: "visitVariableNode:",
  46392. protocol: "visiting",
  46393. fn: function (aNode){
  46394. var self=this,$self=this;
  46395. return $core.withContext(function($ctx1) {
  46396. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46397. $2=$recv(aNode)._binding();
  46398. $ctx1.sendIdx["binding"]=1;
  46399. $1=$recv($2)._isUnknownVar();
  46400. if($core.assert($1)){
  46401. $5=$recv($globals.Platform)._globals();
  46402. $ctx1.sendIdx["globals"]=1;
  46403. $6=$recv(aNode)._value();
  46404. $ctx1.sendIdx["value"]=1;
  46405. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46406. return $core.withContext(function($ctx2) {
  46407. return $self._error_("Unknown variable");
  46408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46409. }));
  46410. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46411. $3=$self._push_($4);
  46412. $ctx1.sendIdx["push:"]=1;
  46413. return $3;
  46414. }
  46415. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46416. if($core.assert($8)){
  46417. $10=$self._context();
  46418. $ctx1.sendIdx["context"]=1;
  46419. $9=$recv($10)._receiver();
  46420. $11=$recv(aNode)._value();
  46421. $ctx1.sendIdx["value"]=2;
  46422. $7=$recv($9)._instVarAt_($11);
  46423. } else {
  46424. $12=$self._context();
  46425. $13=$recv(aNode)._value();
  46426. $ctx1.sendIdx["value"]=3;
  46427. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46428. return $core.withContext(function($ctx2) {
  46429. $15=$recv(aNode)._value();
  46430. $ctx2.sendIdx["value"]=4;
  46431. $14=$recv($15)._isCapitalized();
  46432. if($core.assert($14)){
  46433. $16=$recv($globals.Smalltalk)._globals();
  46434. $ctx2.sendIdx["globals"]=2;
  46435. $17=$recv(aNode)._value();
  46436. $ctx2.sendIdx["value"]=5;
  46437. return $recv($16)._at_ifAbsent_($17,(function(){
  46438. return $core.withContext(function($ctx3) {
  46439. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46440. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46441. }));
  46442. }
  46443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46444. }));
  46445. }
  46446. $self._push_($7);
  46447. return self;
  46448. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46449. },
  46450. args: ["aNode"],
  46451. 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 ] ] ] ])",
  46452. referencedClasses: ["Platform", "Smalltalk"],
  46453. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46454. }),
  46455. $globals.ASTInterpreter);
  46456. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46457. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46458. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46459. $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`";
  46460. $core.addMethod(
  46461. $core.method({
  46462. selector: "currentNode",
  46463. protocol: "accessing",
  46464. fn: function (){
  46465. var self=this,$self=this;
  46466. return $self["@currentNode"];
  46467. },
  46468. args: [],
  46469. source: "currentNode\x0a\x09^ currentNode",
  46470. referencedClasses: [],
  46471. messageSends: []
  46472. }),
  46473. $globals.ASTPCNodeVisitor);
  46474. $core.addMethod(
  46475. $core.method({
  46476. selector: "increaseTrackedIndex",
  46477. protocol: "accessing",
  46478. fn: function (){
  46479. var self=this,$self=this;
  46480. return $core.withContext(function($ctx1) {
  46481. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46482. return self;
  46483. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46484. },
  46485. args: [],
  46486. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46487. referencedClasses: [],
  46488. messageSends: ["+", "trackedIndex"]
  46489. }),
  46490. $globals.ASTPCNodeVisitor);
  46491. $core.addMethod(
  46492. $core.method({
  46493. selector: "index",
  46494. protocol: "accessing",
  46495. fn: function (){
  46496. var self=this,$self=this;
  46497. return $self["@index"];
  46498. },
  46499. args: [],
  46500. source: "index\x0a\x09^ index",
  46501. referencedClasses: [],
  46502. messageSends: []
  46503. }),
  46504. $globals.ASTPCNodeVisitor);
  46505. $core.addMethod(
  46506. $core.method({
  46507. selector: "index:",
  46508. protocol: "accessing",
  46509. fn: function (aNumber){
  46510. var self=this,$self=this;
  46511. $self["@index"]=aNumber;
  46512. return self;
  46513. },
  46514. args: ["aNumber"],
  46515. source: "index: aNumber\x0a\x09index := aNumber",
  46516. referencedClasses: [],
  46517. messageSends: []
  46518. }),
  46519. $globals.ASTPCNodeVisitor);
  46520. $core.addMethod(
  46521. $core.method({
  46522. selector: "selector",
  46523. protocol: "accessing",
  46524. fn: function (){
  46525. var self=this,$self=this;
  46526. return $self["@selector"];
  46527. },
  46528. args: [],
  46529. source: "selector\x0a\x09^ selector",
  46530. referencedClasses: [],
  46531. messageSends: []
  46532. }),
  46533. $globals.ASTPCNodeVisitor);
  46534. $core.addMethod(
  46535. $core.method({
  46536. selector: "selector:",
  46537. protocol: "accessing",
  46538. fn: function (aString){
  46539. var self=this,$self=this;
  46540. $self["@selector"]=aString;
  46541. return self;
  46542. },
  46543. args: ["aString"],
  46544. source: "selector: aString\x0a\x09selector := aString",
  46545. referencedClasses: [],
  46546. messageSends: []
  46547. }),
  46548. $globals.ASTPCNodeVisitor);
  46549. $core.addMethod(
  46550. $core.method({
  46551. selector: "trackedIndex",
  46552. protocol: "accessing",
  46553. fn: function (){
  46554. var self=this,$self=this;
  46555. return $core.withContext(function($ctx1) {
  46556. var $1,$receiver;
  46557. $1=$self["@trackedIndex"];
  46558. if(($receiver = $1) == null || $receiver.a$nil){
  46559. $self["@trackedIndex"]=(0);
  46560. return $self["@trackedIndex"];
  46561. } else {
  46562. return $1;
  46563. }
  46564. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46565. },
  46566. args: [],
  46567. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46568. referencedClasses: [],
  46569. messageSends: ["ifNil:"]
  46570. }),
  46571. $globals.ASTPCNodeVisitor);
  46572. $core.addMethod(
  46573. $core.method({
  46574. selector: "visitJSStatementNode:",
  46575. protocol: "visiting",
  46576. fn: function (aNode){
  46577. var self=this,$self=this;
  46578. $self["@currentNode"]=aNode;
  46579. return self;
  46580. },
  46581. args: ["aNode"],
  46582. 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",
  46583. referencedClasses: [],
  46584. messageSends: []
  46585. }),
  46586. $globals.ASTPCNodeVisitor);
  46587. $core.addMethod(
  46588. $core.method({
  46589. selector: "visitSendNode:",
  46590. protocol: "visiting",
  46591. fn: function (aNode){
  46592. var self=this,$self=this;
  46593. return $core.withContext(function($ctx1) {
  46594. var $2,$1,$3;
  46595. (
  46596. $ctx1.supercall = true,
  46597. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46598. $ctx1.supercall = false;
  46599. $2=$self._selector();
  46600. $ctx1.sendIdx["selector"]=1;
  46601. $1=$recv($2).__eq($recv(aNode)._selector());
  46602. $ctx1.sendIdx["="]=1;
  46603. if($core.assert($1)){
  46604. $3=$recv($self._trackedIndex()).__eq($self._index());
  46605. if($core.assert($3)){
  46606. $self["@currentNode"]=aNode;
  46607. $self["@currentNode"];
  46608. }
  46609. $self._increaseTrackedIndex();
  46610. }
  46611. return self;
  46612. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46613. },
  46614. args: ["aNode"],
  46615. 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 ]",
  46616. referencedClasses: [],
  46617. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46618. }),
  46619. $globals.ASTPCNodeVisitor);
  46620. $core.addMethod(
  46621. $core.method({
  46622. selector: "isLastChild",
  46623. protocol: "*Compiler-Interpreter",
  46624. fn: function (){
  46625. var self=this,$self=this;
  46626. return $core.withContext(function($ctx1) {
  46627. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  46628. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  46629. },
  46630. args: [],
  46631. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  46632. referencedClasses: [],
  46633. messageSends: ["=", "last", "dagChildren", "parent"]
  46634. }),
  46635. $globals.ASTNode);
  46636. $core.addMethod(
  46637. $core.method({
  46638. selector: "isSteppingNode",
  46639. protocol: "*Compiler-Interpreter",
  46640. fn: function (){
  46641. var self=this,$self=this;
  46642. return false;
  46643. },
  46644. args: [],
  46645. source: "isSteppingNode\x0a\x09^ false",
  46646. referencedClasses: [],
  46647. messageSends: []
  46648. }),
  46649. $globals.ASTNode);
  46650. $core.addMethod(
  46651. $core.method({
  46652. selector: "nextSiblingNode:",
  46653. protocol: "*Compiler-Interpreter",
  46654. fn: function (aNode){
  46655. var self=this,$self=this;
  46656. return $core.withContext(function($ctx1) {
  46657. var $1;
  46658. var $early={};
  46659. try {
  46660. $1=$self._dagChildren();
  46661. $ctx1.sendIdx["dagChildren"]=1;
  46662. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  46663. throw $early=[nil];
  46664. }));
  46665. }
  46666. catch(e) {if(e===$early)return e[0]; throw e}
  46667. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  46668. },
  46669. args: ["aNode"],
  46670. 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 ]",
  46671. referencedClasses: [],
  46672. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  46673. }),
  46674. $globals.ASTNode);
  46675. $core.addMethod(
  46676. $core.method({
  46677. selector: "isSteppingNode",
  46678. protocol: "*Compiler-Interpreter",
  46679. fn: function (){
  46680. var self=this,$self=this;
  46681. return true;
  46682. },
  46683. args: [],
  46684. source: "isSteppingNode\x0a\x09^ true",
  46685. referencedClasses: [],
  46686. messageSends: []
  46687. }),
  46688. $globals.AssignmentNode);
  46689. $core.addMethod(
  46690. $core.method({
  46691. selector: "isSteppingNode",
  46692. protocol: "*Compiler-Interpreter",
  46693. fn: function (){
  46694. var self=this,$self=this;
  46695. return true;
  46696. },
  46697. args: [],
  46698. source: "isSteppingNode\x0a\x09^ true",
  46699. referencedClasses: [],
  46700. messageSends: []
  46701. }),
  46702. $globals.BlockNode);
  46703. $core.addMethod(
  46704. $core.method({
  46705. selector: "nextSiblingNode:",
  46706. protocol: "*Compiler-Interpreter",
  46707. fn: function (aNode){
  46708. var self=this,$self=this;
  46709. return nil;
  46710. },
  46711. args: ["aNode"],
  46712. 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",
  46713. referencedClasses: [],
  46714. messageSends: []
  46715. }),
  46716. $globals.BlockNode);
  46717. $core.addMethod(
  46718. $core.method({
  46719. selector: "isSteppingNode",
  46720. protocol: "*Compiler-Interpreter",
  46721. fn: function (){
  46722. var self=this,$self=this;
  46723. return true;
  46724. },
  46725. args: [],
  46726. source: "isSteppingNode\x0a\x09^ true",
  46727. referencedClasses: [],
  46728. messageSends: []
  46729. }),
  46730. $globals.DynamicArrayNode);
  46731. $core.addMethod(
  46732. $core.method({
  46733. selector: "isSteppingNode",
  46734. protocol: "*Compiler-Interpreter",
  46735. fn: function (){
  46736. var self=this,$self=this;
  46737. return true;
  46738. },
  46739. args: [],
  46740. source: "isSteppingNode\x0a\x09^ true",
  46741. referencedClasses: [],
  46742. messageSends: []
  46743. }),
  46744. $globals.DynamicDictionaryNode);
  46745. $core.addMethod(
  46746. $core.method({
  46747. selector: "isSteppingNode",
  46748. protocol: "*Compiler-Interpreter",
  46749. fn: function (){
  46750. var self=this,$self=this;
  46751. return true;
  46752. },
  46753. args: [],
  46754. source: "isSteppingNode\x0a\x09^ true",
  46755. referencedClasses: [],
  46756. messageSends: []
  46757. }),
  46758. $globals.JSStatementNode);
  46759. $core.addMethod(
  46760. $core.method({
  46761. selector: "isCascadeSendNode",
  46762. protocol: "*Compiler-Interpreter",
  46763. fn: function (){
  46764. var self=this,$self=this;
  46765. return $core.withContext(function($ctx1) {
  46766. return $recv($self._parent())._isCascadeNode();
  46767. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  46768. },
  46769. args: [],
  46770. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  46771. referencedClasses: [],
  46772. messageSends: ["isCascadeNode", "parent"]
  46773. }),
  46774. $globals.SendNode);
  46775. $core.addMethod(
  46776. $core.method({
  46777. selector: "isSteppingNode",
  46778. protocol: "*Compiler-Interpreter",
  46779. fn: function (){
  46780. var self=this,$self=this;
  46781. return true;
  46782. },
  46783. args: [],
  46784. source: "isSteppingNode\x0a\x09^ true",
  46785. referencedClasses: [],
  46786. messageSends: []
  46787. }),
  46788. $globals.SendNode);
  46789. });
  46790. define('amber/lang',[
  46791. './deploy',
  46792. './boot', // pre-fetch, dep of ./helpers
  46793. './helpers', // pre-fetch, dep of ./deploy
  46794. './parser',
  46795. // --- packages for the Amber reflection begin here ---
  46796. 'amber_core/Platform-ImportExport',
  46797. 'amber_core/Compiler-Core',
  46798. 'amber_core/Compiler-AST',
  46799. 'amber_core/Compiler-Semantic',
  46800. 'amber_core/Compiler-IR',
  46801. 'amber_core/Compiler-Inlining',
  46802. 'amber_core/Compiler-Interpreter'
  46803. // --- packages for the Amber reflection end here ---
  46804. ], function (amber) {
  46805. return amber;
  46806. });
  46807. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  46808. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46809. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46810. $core.addPackage("Platform-DOM");
  46811. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  46812. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46813. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  46814. $core.addMethod(
  46815. $core.method({
  46816. selector: "isDomNode:",
  46817. protocol: "testing",
  46818. fn: function (anObject){
  46819. var self=this,$self=this;
  46820. return $core.withContext(function($ctx1) {
  46821. return anObject.nodeType > 0 &&
  46822. Object.prototype.toString.call(anObject) !== "[object Object]";
  46823. return self;
  46824. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  46825. },
  46826. args: ["anObject"],
  46827. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  46828. referencedClasses: [],
  46829. messageSends: []
  46830. }),
  46831. $globals.PlatformDom.a$cls);
  46832. $core.addMethod(
  46833. $core.method({
  46834. selector: "isFeasible",
  46835. protocol: "testing",
  46836. fn: function (){
  46837. var self=this,$self=this;
  46838. return $core.withContext(function($ctx1) {
  46839. if (typeof document === "undefined") return false;
  46840. try {
  46841. var d = document.createElement("div"),
  46842. f = document.createDocumentFragment(),
  46843. t = document.createTextNode("Hello, Amber!");
  46844. f.appendChild(t);
  46845. d.insertBefore(f, null);
  46846. return d.innerHTML === "Hello, Amber!";
  46847. } catch (e) {
  46848. return false;
  46849. };
  46850. return self;
  46851. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  46852. },
  46853. args: [],
  46854. 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'>",
  46855. referencedClasses: [],
  46856. messageSends: []
  46857. }),
  46858. $globals.PlatformDom.a$cls);
  46859. $core.addMethod(
  46860. $core.method({
  46861. selector: "newCustomEvent:detail:",
  46862. protocol: "creation",
  46863. fn: function (aString,anObject){
  46864. var self=this,$self=this;
  46865. return $core.withContext(function($ctx1) {
  46866. return new CustomEvent(aString, {detail: anObject});
  46867. return self;
  46868. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  46869. },
  46870. args: ["aString", "anObject"],
  46871. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  46872. referencedClasses: [],
  46873. messageSends: []
  46874. }),
  46875. $globals.PlatformDom.a$cls);
  46876. $core.addMethod(
  46877. $core.method({
  46878. selector: "toArray:",
  46879. protocol: "converting",
  46880. fn: function (aDomList){
  46881. var self=this,$self=this;
  46882. return $core.withContext(function($ctx1) {
  46883. return Array.prototype.slice.call(aDomList);
  46884. return self;
  46885. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  46886. },
  46887. args: ["aDomList"],
  46888. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  46889. referencedClasses: [],
  46890. messageSends: []
  46891. }),
  46892. $globals.PlatformDom.a$cls);
  46893. $core.addMethod(
  46894. $core.method({
  46895. selector: "asDomNode",
  46896. protocol: "*Platform-DOM",
  46897. fn: function (){
  46898. var self=this,$self=this;
  46899. return $core.withContext(function($ctx1) {
  46900. return $recv(document)._createTextNode_($self._asString());
  46901. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  46902. },
  46903. args: [],
  46904. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  46905. referencedClasses: [],
  46906. messageSends: ["createTextNode:", "asString"]
  46907. }),
  46908. $globals.CharacterArray);
  46909. $core.addMethod(
  46910. $core.method({
  46911. selector: "asDomNode",
  46912. protocol: "*Platform-DOM",
  46913. fn: function (){
  46914. var self=this,$self=this;
  46915. var fragment;
  46916. return $core.withContext(function($ctx1) {
  46917. fragment=$recv(document)._createDocumentFragment();
  46918. $self._do_((function(each){
  46919. return $core.withContext(function($ctx2) {
  46920. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  46921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46922. }));
  46923. return fragment;
  46924. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  46925. },
  46926. args: [],
  46927. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  46928. referencedClasses: [],
  46929. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  46930. }),
  46931. $globals.Collection);
  46932. $core.addMethod(
  46933. $core.method({
  46934. selector: "asDomNode",
  46935. protocol: "*Platform-DOM",
  46936. fn: function (){
  46937. var self=this,$self=this;
  46938. return $core.withContext(function($ctx1) {
  46939. var $1,$2;
  46940. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  46941. if($core.assert($1)){
  46942. return $self["@jsObject"];
  46943. } else {
  46944. $2=(
  46945. $ctx1.supercall = true,
  46946. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  46947. $ctx1.supercall = false;
  46948. return $2;
  46949. }
  46950. return self;
  46951. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  46952. },
  46953. args: [],
  46954. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  46955. referencedClasses: ["PlatformDom"],
  46956. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  46957. }),
  46958. $globals.JSObjectProxy);
  46959. $core.addMethod(
  46960. $core.method({
  46961. selector: "htmlTextContent",
  46962. protocol: "*Platform-DOM",
  46963. fn: function (){
  46964. var self=this,$self=this;
  46965. return $core.withContext(function($ctx1) {
  46966. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  46967. return self;
  46968. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  46969. },
  46970. args: [],
  46971. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  46972. referencedClasses: [],
  46973. messageSends: []
  46974. }),
  46975. $globals.String);
  46976. });
  46977. 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";
  46978. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46979. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46980. $core.addPackage("SUnit");
  46981. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  46982. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46983. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  46984. $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.";
  46985. $core.addMethod(
  46986. $core.method({
  46987. selector: "result",
  46988. protocol: "accessing",
  46989. fn: function (){
  46990. var self=this,$self=this;
  46991. return $self["@result"];
  46992. },
  46993. args: [],
  46994. source: "result\x0a\x09^ result",
  46995. referencedClasses: [],
  46996. messageSends: []
  46997. }),
  46998. $globals.ResultAnnouncement);
  46999. $core.addMethod(
  47000. $core.method({
  47001. selector: "result:",
  47002. protocol: "accessing",
  47003. fn: function (aTestResult){
  47004. var self=this,$self=this;
  47005. $self["@result"]=aTestResult;
  47006. return self;
  47007. },
  47008. args: ["aTestResult"],
  47009. source: "result: aTestResult\x0a\x09result := aTestResult",
  47010. referencedClasses: [],
  47011. messageSends: []
  47012. }),
  47013. $globals.ResultAnnouncement);
  47014. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47015. $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.";
  47016. $core.addMethod(
  47017. $core.method({
  47018. selector: "assert:",
  47019. protocol: "testing",
  47020. fn: function (aBoolean){
  47021. var self=this,$self=this;
  47022. return $core.withContext(function($ctx1) {
  47023. $self._assert_description_(aBoolean,"Assertion failed");
  47024. return self;
  47025. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47026. },
  47027. args: ["aBoolean"],
  47028. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47029. referencedClasses: [],
  47030. messageSends: ["assert:description:"]
  47031. }),
  47032. $globals.TestCase);
  47033. $core.addMethod(
  47034. $core.method({
  47035. selector: "assert:description:",
  47036. protocol: "testing",
  47037. fn: function (aBoolean,aString){
  47038. var self=this,$self=this;
  47039. return $core.withContext(function($ctx1) {
  47040. if(!$core.assert(aBoolean)){
  47041. $self._signalFailure_(aString);
  47042. }
  47043. return self;
  47044. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47045. },
  47046. args: ["aBoolean", "aString"],
  47047. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47048. referencedClasses: [],
  47049. messageSends: ["ifFalse:", "signalFailure:"]
  47050. }),
  47051. $globals.TestCase);
  47052. $core.addMethod(
  47053. $core.method({
  47054. selector: "assert:equals:",
  47055. protocol: "testing",
  47056. fn: function (actual,expected){
  47057. var self=this,$self=this;
  47058. return $core.withContext(function($ctx1) {
  47059. var $1,$5,$4,$3,$2;
  47060. $1=$recv(actual).__eq(expected);
  47061. $5=$recv(expected)._printString();
  47062. $ctx1.sendIdx["printString"]=1;
  47063. $4="Expected: ".__comma($5);
  47064. $3=$recv($4).__comma(" but was: ");
  47065. $ctx1.sendIdx[","]=2;
  47066. $2=$recv($3).__comma($recv(actual)._printString());
  47067. $ctx1.sendIdx[","]=1;
  47068. return $self._assert_description_($1,$2);
  47069. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47070. },
  47071. args: ["actual", "expected"],
  47072. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47073. referencedClasses: [],
  47074. messageSends: ["assert:description:", "=", ",", "printString"]
  47075. }),
  47076. $globals.TestCase);
  47077. $core.addMethod(
  47078. $core.method({
  47079. selector: "async:",
  47080. protocol: "async",
  47081. fn: function (aBlock){
  47082. var self=this,$self=this;
  47083. var c;
  47084. return $core.withContext(function($ctx1) {
  47085. var $1;
  47086. $self._errorIfNotAsync_("#async");
  47087. c=$self["@context"];
  47088. return (function(){
  47089. return $core.withContext(function($ctx2) {
  47090. $1=$self._isAsync();
  47091. if($core.assert($1)){
  47092. return $recv(c)._execute_(aBlock);
  47093. }
  47094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47095. });
  47096. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47097. },
  47098. args: ["aBlock"],
  47099. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47100. referencedClasses: [],
  47101. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47102. }),
  47103. $globals.TestCase);
  47104. $core.addMethod(
  47105. $core.method({
  47106. selector: "context:",
  47107. protocol: "accessing",
  47108. fn: function (aRunningTestContext){
  47109. var self=this,$self=this;
  47110. $self["@context"]=aRunningTestContext;
  47111. return self;
  47112. },
  47113. args: ["aRunningTestContext"],
  47114. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47115. referencedClasses: [],
  47116. messageSends: []
  47117. }),
  47118. $globals.TestCase);
  47119. $core.addMethod(
  47120. $core.method({
  47121. selector: "deny:",
  47122. protocol: "testing",
  47123. fn: function (aBoolean){
  47124. var self=this,$self=this;
  47125. return $core.withContext(function($ctx1) {
  47126. $self._assert_($recv(aBoolean)._not());
  47127. return self;
  47128. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47129. },
  47130. args: ["aBoolean"],
  47131. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47132. referencedClasses: [],
  47133. messageSends: ["assert:", "not"]
  47134. }),
  47135. $globals.TestCase);
  47136. $core.addMethod(
  47137. $core.method({
  47138. selector: "errorIfNotAsync:",
  47139. protocol: "error handling",
  47140. fn: function (aString){
  47141. var self=this,$self=this;
  47142. return $core.withContext(function($ctx1) {
  47143. var $1;
  47144. $1=$self._isAsync();
  47145. if(!$core.assert($1)){
  47146. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47147. }
  47148. return self;
  47149. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47150. },
  47151. args: ["aString"],
  47152. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47153. referencedClasses: [],
  47154. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47155. }),
  47156. $globals.TestCase);
  47157. $core.addMethod(
  47158. $core.method({
  47159. selector: "finished",
  47160. protocol: "async",
  47161. fn: function (){
  47162. var self=this,$self=this;
  47163. return $core.withContext(function($ctx1) {
  47164. $self._errorIfNotAsync_("#finished");
  47165. $self["@asyncTimeout"]=nil;
  47166. return self;
  47167. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47168. },
  47169. args: [],
  47170. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47171. referencedClasses: [],
  47172. messageSends: ["errorIfNotAsync:"]
  47173. }),
  47174. $globals.TestCase);
  47175. $core.addMethod(
  47176. $core.method({
  47177. selector: "isAsync",
  47178. protocol: "testing",
  47179. fn: function (){
  47180. var self=this,$self=this;
  47181. return $core.withContext(function($ctx1) {
  47182. return $recv($self["@asyncTimeout"])._notNil();
  47183. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47184. },
  47185. args: [],
  47186. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47187. referencedClasses: [],
  47188. messageSends: ["notNil"]
  47189. }),
  47190. $globals.TestCase);
  47191. $core.addMethod(
  47192. $core.method({
  47193. selector: "performTest",
  47194. protocol: "running",
  47195. fn: function (){
  47196. var self=this,$self=this;
  47197. return $core.withContext(function($ctx1) {
  47198. $self["@asyncTimeout"]=nil;
  47199. $self._perform_($self._selector());
  47200. return self;
  47201. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47202. },
  47203. args: [],
  47204. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47205. referencedClasses: [],
  47206. messageSends: ["perform:", "selector"]
  47207. }),
  47208. $globals.TestCase);
  47209. $core.addMethod(
  47210. $core.method({
  47211. selector: "runCase",
  47212. protocol: "running",
  47213. fn: function (){
  47214. var self=this,$self=this;
  47215. return $core.withContext(function($ctx1) {
  47216. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47217. return self;
  47218. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47219. },
  47220. args: [],
  47221. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47222. referencedClasses: ["TestContext"],
  47223. messageSends: ["start", "testCase:"]
  47224. }),
  47225. $globals.TestCase);
  47226. $core.addMethod(
  47227. $core.method({
  47228. selector: "selector",
  47229. protocol: "accessing",
  47230. fn: function (){
  47231. var self=this,$self=this;
  47232. return $self["@testSelector"];
  47233. },
  47234. args: [],
  47235. source: "selector\x0a\x09^ testSelector",
  47236. referencedClasses: [],
  47237. messageSends: []
  47238. }),
  47239. $globals.TestCase);
  47240. $core.addMethod(
  47241. $core.method({
  47242. selector: "setTestSelector:",
  47243. protocol: "accessing",
  47244. fn: function (aSelector){
  47245. var self=this,$self=this;
  47246. $self["@testSelector"]=aSelector;
  47247. return self;
  47248. },
  47249. args: ["aSelector"],
  47250. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47251. referencedClasses: [],
  47252. messageSends: []
  47253. }),
  47254. $globals.TestCase);
  47255. $core.addMethod(
  47256. $core.method({
  47257. selector: "setUp",
  47258. protocol: "running",
  47259. fn: function (){
  47260. var self=this,$self=this;
  47261. return self;
  47262. },
  47263. args: [],
  47264. source: "setUp",
  47265. referencedClasses: [],
  47266. messageSends: []
  47267. }),
  47268. $globals.TestCase);
  47269. $core.addMethod(
  47270. $core.method({
  47271. selector: "should:",
  47272. protocol: "testing",
  47273. fn: function (aBlock){
  47274. var self=this,$self=this;
  47275. return $core.withContext(function($ctx1) {
  47276. $self._assert_($recv(aBlock)._value());
  47277. return self;
  47278. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47279. },
  47280. args: ["aBlock"],
  47281. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47282. referencedClasses: [],
  47283. messageSends: ["assert:", "value"]
  47284. }),
  47285. $globals.TestCase);
  47286. $core.addMethod(
  47287. $core.method({
  47288. selector: "should:raise:",
  47289. protocol: "testing",
  47290. fn: function (aBlock,anExceptionClass){
  47291. var self=this,$self=this;
  47292. return $core.withContext(function($ctx1) {
  47293. $self._assert_($recv((function(){
  47294. return $core.withContext(function($ctx2) {
  47295. $recv(aBlock)._value();
  47296. return false;
  47297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47298. }))._on_do_(anExceptionClass,(function(ex){
  47299. return true;
  47300. })));
  47301. return self;
  47302. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47303. },
  47304. args: ["aBlock", "anExceptionClass"],
  47305. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47306. referencedClasses: [],
  47307. messageSends: ["assert:", "on:do:", "value"]
  47308. }),
  47309. $globals.TestCase);
  47310. $core.addMethod(
  47311. $core.method({
  47312. selector: "shouldnt:raise:",
  47313. protocol: "testing",
  47314. fn: function (aBlock,anExceptionClass){
  47315. var self=this,$self=this;
  47316. return $core.withContext(function($ctx1) {
  47317. $self._assert_($recv((function(){
  47318. return $core.withContext(function($ctx2) {
  47319. $recv(aBlock)._value();
  47320. return true;
  47321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47322. }))._on_do_(anExceptionClass,(function(ex){
  47323. return false;
  47324. })));
  47325. return self;
  47326. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47327. },
  47328. args: ["aBlock", "anExceptionClass"],
  47329. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47330. referencedClasses: [],
  47331. messageSends: ["assert:", "on:do:", "value"]
  47332. }),
  47333. $globals.TestCase);
  47334. $core.addMethod(
  47335. $core.method({
  47336. selector: "signalFailure:",
  47337. protocol: "private",
  47338. fn: function (aString){
  47339. var self=this,$self=this;
  47340. return $core.withContext(function($ctx1) {
  47341. var $1;
  47342. $1=$recv($globals.TestFailure)._new();
  47343. $recv($1)._messageText_(aString);
  47344. $recv($1)._signal();
  47345. return self;
  47346. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47347. },
  47348. args: ["aString"],
  47349. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47350. referencedClasses: ["TestFailure"],
  47351. messageSends: ["messageText:", "new", "signal"]
  47352. }),
  47353. $globals.TestCase);
  47354. $core.addMethod(
  47355. $core.method({
  47356. selector: "tearDown",
  47357. protocol: "running",
  47358. fn: function (){
  47359. var self=this,$self=this;
  47360. return self;
  47361. },
  47362. args: [],
  47363. source: "tearDown",
  47364. referencedClasses: [],
  47365. messageSends: []
  47366. }),
  47367. $globals.TestCase);
  47368. $core.addMethod(
  47369. $core.method({
  47370. selector: "timeout:",
  47371. protocol: "async",
  47372. fn: function (aNumber){
  47373. var self=this,$self=this;
  47374. return $core.withContext(function($ctx1) {
  47375. var $1,$receiver;
  47376. $1=$self["@asyncTimeout"];
  47377. if(($receiver = $1) == null || $receiver.a$nil){
  47378. $1;
  47379. } else {
  47380. $recv($self["@asyncTimeout"])._clearTimeout();
  47381. }
  47382. $self["@asyncTimeout"]=(0);
  47383. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47384. return $core.withContext(function($ctx2) {
  47385. return $self._assert_description_(false,"SUnit grace time exhausted");
  47386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47387. })))._valueWithTimeout_(aNumber);
  47388. return self;
  47389. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47390. },
  47391. args: ["aNumber"],
  47392. 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",
  47393. referencedClasses: [],
  47394. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47395. }),
  47396. $globals.TestCase);
  47397. $core.addMethod(
  47398. $core.method({
  47399. selector: "allTestSelectors",
  47400. protocol: "accessing",
  47401. fn: function (){
  47402. var self=this,$self=this;
  47403. var selectors;
  47404. return $core.withContext(function($ctx1) {
  47405. var $1;
  47406. selectors=$self._testSelectors();
  47407. $1=$self._shouldInheritSelectors();
  47408. if($core.assert($1)){
  47409. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47410. }
  47411. return selectors;
  47412. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47413. },
  47414. args: [],
  47415. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47416. referencedClasses: [],
  47417. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47418. }),
  47419. $globals.TestCase.a$cls);
  47420. $core.addMethod(
  47421. $core.method({
  47422. selector: "buildSuite",
  47423. protocol: "accessing",
  47424. fn: function (){
  47425. var self=this,$self=this;
  47426. return $core.withContext(function($ctx1) {
  47427. return $recv($self._allTestSelectors())._collect_((function(each){
  47428. return $core.withContext(function($ctx2) {
  47429. return $self._selector_(each);
  47430. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47431. }));
  47432. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47433. },
  47434. args: [],
  47435. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47436. referencedClasses: [],
  47437. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47438. }),
  47439. $globals.TestCase.a$cls);
  47440. $core.addMethod(
  47441. $core.method({
  47442. selector: "classTag",
  47443. protocol: "accessing",
  47444. fn: function (){
  47445. var self=this,$self=this;
  47446. return "test";
  47447. },
  47448. args: [],
  47449. 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'",
  47450. referencedClasses: [],
  47451. messageSends: []
  47452. }),
  47453. $globals.TestCase.a$cls);
  47454. $core.addMethod(
  47455. $core.method({
  47456. selector: "isAbstract",
  47457. protocol: "testing",
  47458. fn: function (){
  47459. var self=this,$self=this;
  47460. return $core.withContext(function($ctx1) {
  47461. return $recv($self._name()).__eq("TestCase");
  47462. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47463. },
  47464. args: [],
  47465. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47466. referencedClasses: [],
  47467. messageSends: ["=", "name"]
  47468. }),
  47469. $globals.TestCase.a$cls);
  47470. $core.addMethod(
  47471. $core.method({
  47472. selector: "isTestClass",
  47473. protocol: "testing",
  47474. fn: function (){
  47475. var self=this,$self=this;
  47476. return $core.withContext(function($ctx1) {
  47477. return $recv($self._isAbstract())._not();
  47478. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47479. },
  47480. args: [],
  47481. source: "isTestClass\x0a\x09^ self isAbstract not",
  47482. referencedClasses: [],
  47483. messageSends: ["not", "isAbstract"]
  47484. }),
  47485. $globals.TestCase.a$cls);
  47486. $core.addMethod(
  47487. $core.method({
  47488. selector: "lookupHierarchyRoot",
  47489. protocol: "accessing",
  47490. fn: function (){
  47491. var self=this,$self=this;
  47492. return $globals.TestCase;
  47493. },
  47494. args: [],
  47495. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47496. referencedClasses: ["TestCase"],
  47497. messageSends: []
  47498. }),
  47499. $globals.TestCase.a$cls);
  47500. $core.addMethod(
  47501. $core.method({
  47502. selector: "selector:",
  47503. protocol: "accessing",
  47504. fn: function (aSelector){
  47505. var self=this,$self=this;
  47506. return $core.withContext(function($ctx1) {
  47507. var $1;
  47508. $1=$self._new();
  47509. $recv($1)._setTestSelector_(aSelector);
  47510. return $recv($1)._yourself();
  47511. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47512. },
  47513. args: ["aSelector"],
  47514. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47515. referencedClasses: [],
  47516. messageSends: ["setTestSelector:", "new", "yourself"]
  47517. }),
  47518. $globals.TestCase.a$cls);
  47519. $core.addMethod(
  47520. $core.method({
  47521. selector: "shouldInheritSelectors",
  47522. protocol: "testing",
  47523. fn: function (){
  47524. var self=this,$self=this;
  47525. return $core.withContext(function($ctx1) {
  47526. return $self.__tild_eq($self._lookupHierarchyRoot());
  47527. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47528. },
  47529. args: [],
  47530. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47531. referencedClasses: [],
  47532. messageSends: ["~=", "lookupHierarchyRoot"]
  47533. }),
  47534. $globals.TestCase.a$cls);
  47535. $core.addMethod(
  47536. $core.method({
  47537. selector: "testSelectors",
  47538. protocol: "accessing",
  47539. fn: function (){
  47540. var self=this,$self=this;
  47541. return $core.withContext(function($ctx1) {
  47542. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47543. return $core.withContext(function($ctx2) {
  47544. return $recv(each)._match_("^test");
  47545. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47546. }));
  47547. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47548. },
  47549. args: [],
  47550. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47551. referencedClasses: [],
  47552. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47553. }),
  47554. $globals.TestCase.a$cls);
  47555. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47556. $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).";
  47557. $core.addMethod(
  47558. $core.method({
  47559. selector: "execute:",
  47560. protocol: "running",
  47561. fn: function (aBlock){
  47562. var self=this,$self=this;
  47563. var failed;
  47564. return $core.withContext(function($ctx1) {
  47565. var $1,$2;
  47566. $recv($self["@testCase"])._context_(self);
  47567. $ctx1.sendIdx["context:"]=1;
  47568. $recv((function(){
  47569. return $core.withContext(function($ctx2) {
  47570. failed=true;
  47571. failed;
  47572. $recv(aBlock)._value();
  47573. failed=false;
  47574. return failed;
  47575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47576. }))._ensure_((function(){
  47577. return $core.withContext(function($ctx2) {
  47578. $recv($self["@testCase"])._context_(nil);
  47579. $1=$recv(failed)._and_((function(){
  47580. return $core.withContext(function($ctx3) {
  47581. return $recv($self["@testCase"])._isAsync();
  47582. $ctx3.sendIdx["isAsync"]=1;
  47583. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47584. }));
  47585. if($core.assert($1)){
  47586. $recv($self["@testCase"])._finished();
  47587. }
  47588. $2=$recv($self["@testCase"])._isAsync();
  47589. if(!$core.assert($2)){
  47590. return $recv($self["@testCase"])._tearDown();
  47591. }
  47592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47593. }));
  47594. return self;
  47595. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47596. },
  47597. args: ["aBlock"],
  47598. 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 ] ]",
  47599. referencedClasses: [],
  47600. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47601. }),
  47602. $globals.TestContext);
  47603. $core.addMethod(
  47604. $core.method({
  47605. selector: "start",
  47606. protocol: "running",
  47607. fn: function (){
  47608. var self=this,$self=this;
  47609. return $core.withContext(function($ctx1) {
  47610. $self._execute_((function(){
  47611. return $core.withContext(function($ctx2) {
  47612. $recv($self["@testCase"])._setUp();
  47613. return $recv($self["@testCase"])._performTest();
  47614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47615. }));
  47616. return self;
  47617. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47618. },
  47619. args: [],
  47620. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47621. referencedClasses: [],
  47622. messageSends: ["execute:", "setUp", "performTest"]
  47623. }),
  47624. $globals.TestContext);
  47625. $core.addMethod(
  47626. $core.method({
  47627. selector: "testCase:",
  47628. protocol: "accessing",
  47629. fn: function (aTestCase){
  47630. var self=this,$self=this;
  47631. $self["@testCase"]=aTestCase;
  47632. return self;
  47633. },
  47634. args: ["aTestCase"],
  47635. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  47636. referencedClasses: [],
  47637. messageSends: []
  47638. }),
  47639. $globals.TestContext);
  47640. $core.addMethod(
  47641. $core.method({
  47642. selector: "testCase:",
  47643. protocol: "instance creation",
  47644. fn: function (aTestCase){
  47645. var self=this,$self=this;
  47646. return $core.withContext(function($ctx1) {
  47647. var $1;
  47648. $1=$self._new();
  47649. $recv($1)._testCase_(aTestCase);
  47650. return $recv($1)._yourself();
  47651. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  47652. },
  47653. args: ["aTestCase"],
  47654. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  47655. referencedClasses: [],
  47656. messageSends: ["testCase:", "new", "yourself"]
  47657. }),
  47658. $globals.TestContext.a$cls);
  47659. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  47660. $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`.";
  47661. $core.addMethod(
  47662. $core.method({
  47663. selector: "execute:",
  47664. protocol: "running",
  47665. fn: function (aBlock){
  47666. var self=this,$self=this;
  47667. return $core.withContext(function($ctx1) {
  47668. var $1;
  47669. $recv((function(){
  47670. return $core.withContext(function($ctx2) {
  47671. return $self._withErrorReporting_((function(){
  47672. return $core.withContext(function($ctx3) {
  47673. return (
  47674. $ctx3.supercall = true,
  47675. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  47676. $ctx3.supercall = false;
  47677. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47678. }));
  47679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47680. }))._ensure_((function(){
  47681. return $core.withContext(function($ctx2) {
  47682. $1=$recv($self["@testCase"])._isAsync();
  47683. if(!$core.assert($1)){
  47684. $recv($self["@result"])._increaseRuns();
  47685. return $recv($self["@finished"])._value();
  47686. }
  47687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47688. }));
  47689. return self;
  47690. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47691. },
  47692. args: ["aBlock"],
  47693. 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 ] ]",
  47694. referencedClasses: [],
  47695. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  47696. }),
  47697. $globals.ReportingTestContext);
  47698. $core.addMethod(
  47699. $core.method({
  47700. selector: "finished:",
  47701. protocol: "accessing",
  47702. fn: function (aBlock){
  47703. var self=this,$self=this;
  47704. $self["@finished"]=aBlock;
  47705. return self;
  47706. },
  47707. args: ["aBlock"],
  47708. source: "finished: aBlock\x0a\x09finished := aBlock",
  47709. referencedClasses: [],
  47710. messageSends: []
  47711. }),
  47712. $globals.ReportingTestContext);
  47713. $core.addMethod(
  47714. $core.method({
  47715. selector: "result:",
  47716. protocol: "accessing",
  47717. fn: function (aTestResult){
  47718. var self=this,$self=this;
  47719. $self["@result"]=aTestResult;
  47720. return self;
  47721. },
  47722. args: ["aTestResult"],
  47723. source: "result: aTestResult\x0a\x09result := aTestResult",
  47724. referencedClasses: [],
  47725. messageSends: []
  47726. }),
  47727. $globals.ReportingTestContext);
  47728. $core.addMethod(
  47729. $core.method({
  47730. selector: "withErrorReporting:",
  47731. protocol: "private",
  47732. fn: function (aBlock){
  47733. var self=this,$self=this;
  47734. return $core.withContext(function($ctx1) {
  47735. $recv((function(){
  47736. return $core.withContext(function($ctx2) {
  47737. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  47738. return $core.withContext(function($ctx3) {
  47739. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  47740. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  47741. }));
  47742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47743. }))._on_do_($globals.Error,(function(ex){
  47744. return $core.withContext(function($ctx2) {
  47745. return $recv($self["@result"])._addError_($self["@testCase"]);
  47746. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  47747. }));
  47748. $ctx1.sendIdx["on:do:"]=1;
  47749. return self;
  47750. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47751. },
  47752. args: ["aBlock"],
  47753. 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 ]",
  47754. referencedClasses: ["TestFailure", "Error"],
  47755. messageSends: ["on:do:", "addFailure:", "addError:"]
  47756. }),
  47757. $globals.ReportingTestContext);
  47758. $core.addMethod(
  47759. $core.method({
  47760. selector: "testCase:result:finished:",
  47761. protocol: "instance creation",
  47762. fn: function (aTestCase,aTestResult,aBlock){
  47763. var self=this,$self=this;
  47764. return $core.withContext(function($ctx1) {
  47765. var $1;
  47766. $1=(
  47767. $ctx1.supercall = true,
  47768. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  47769. $ctx1.supercall = false;
  47770. $recv($1)._result_(aTestResult);
  47771. $recv($1)._finished_(aBlock);
  47772. return $recv($1)._yourself();
  47773. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  47774. },
  47775. args: ["aTestCase", "aTestResult", "aBlock"],
  47776. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  47777. referencedClasses: [],
  47778. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  47779. }),
  47780. $globals.ReportingTestContext.a$cls);
  47781. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  47782. $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.";
  47783. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  47784. $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";
  47785. $core.addMethod(
  47786. $core.method({
  47787. selector: "addError:",
  47788. protocol: "accessing",
  47789. fn: function (anError){
  47790. var self=this,$self=this;
  47791. return $core.withContext(function($ctx1) {
  47792. $recv($self._errors())._add_(anError);
  47793. return self;
  47794. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  47795. },
  47796. args: ["anError"],
  47797. source: "addError: anError\x0a\x09self errors add: anError",
  47798. referencedClasses: [],
  47799. messageSends: ["add:", "errors"]
  47800. }),
  47801. $globals.TestResult);
  47802. $core.addMethod(
  47803. $core.method({
  47804. selector: "addFailure:",
  47805. protocol: "accessing",
  47806. fn: function (aFailure){
  47807. var self=this,$self=this;
  47808. return $core.withContext(function($ctx1) {
  47809. $recv($self._failures())._add_(aFailure);
  47810. return self;
  47811. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  47812. },
  47813. args: ["aFailure"],
  47814. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  47815. referencedClasses: [],
  47816. messageSends: ["add:", "failures"]
  47817. }),
  47818. $globals.TestResult);
  47819. $core.addMethod(
  47820. $core.method({
  47821. selector: "errors",
  47822. protocol: "accessing",
  47823. fn: function (){
  47824. var self=this,$self=this;
  47825. return $self["@errors"];
  47826. },
  47827. args: [],
  47828. source: "errors\x0a\x09^ errors",
  47829. referencedClasses: [],
  47830. messageSends: []
  47831. }),
  47832. $globals.TestResult);
  47833. $core.addMethod(
  47834. $core.method({
  47835. selector: "failures",
  47836. protocol: "accessing",
  47837. fn: function (){
  47838. var self=this,$self=this;
  47839. return $self["@failures"];
  47840. },
  47841. args: [],
  47842. source: "failures\x0a\x09^ failures",
  47843. referencedClasses: [],
  47844. messageSends: []
  47845. }),
  47846. $globals.TestResult);
  47847. $core.addMethod(
  47848. $core.method({
  47849. selector: "increaseRuns",
  47850. protocol: "accessing",
  47851. fn: function (){
  47852. var self=this,$self=this;
  47853. return $core.withContext(function($ctx1) {
  47854. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  47855. return self;
  47856. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  47857. },
  47858. args: [],
  47859. source: "increaseRuns\x0a\x09runs := runs + 1",
  47860. referencedClasses: [],
  47861. messageSends: ["+"]
  47862. }),
  47863. $globals.TestResult);
  47864. $core.addMethod(
  47865. $core.method({
  47866. selector: "initialize",
  47867. protocol: "initialization",
  47868. fn: function (){
  47869. var self=this,$self=this;
  47870. return $core.withContext(function($ctx1) {
  47871. (
  47872. $ctx1.supercall = true,
  47873. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  47874. $ctx1.supercall = false;
  47875. $self["@timestamp"]=$recv($globals.Date)._now();
  47876. $self["@runs"]=(0);
  47877. $self["@errors"]=$recv($globals.Array)._new();
  47878. $ctx1.sendIdx["new"]=1;
  47879. $self["@failures"]=$recv($globals.Array)._new();
  47880. $self["@total"]=(0);
  47881. return self;
  47882. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  47883. },
  47884. args: [],
  47885. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  47886. referencedClasses: ["Date", "Array"],
  47887. messageSends: ["initialize", "now", "new"]
  47888. }),
  47889. $globals.TestResult);
  47890. $core.addMethod(
  47891. $core.method({
  47892. selector: "nextRunDo:",
  47893. protocol: "running",
  47894. fn: function (aBlock){
  47895. var self=this,$self=this;
  47896. return $core.withContext(function($ctx1) {
  47897. var $2,$1;
  47898. $2=$self._runs();
  47899. $ctx1.sendIdx["runs"]=1;
  47900. $1=$recv($2).__eq_eq($self._total());
  47901. if(!$core.assert($1)){
  47902. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  47903. }
  47904. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  47905. },
  47906. args: ["aBlock"],
  47907. 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 ]",
  47908. referencedClasses: [],
  47909. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  47910. }),
  47911. $globals.TestResult);
  47912. $core.addMethod(
  47913. $core.method({
  47914. selector: "runCase:",
  47915. protocol: "running",
  47916. fn: function (aTestCase){
  47917. var self=this,$self=this;
  47918. return $core.withContext(function($ctx1) {
  47919. $recv((function(){
  47920. return $core.withContext(function($ctx2) {
  47921. return $recv((function(){
  47922. return $core.withContext(function($ctx3) {
  47923. $self._increaseRuns();
  47924. return $recv(aTestCase)._runCase();
  47925. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47926. }))._on_do_($globals.TestFailure,(function(ex){
  47927. return $core.withContext(function($ctx3) {
  47928. return $self._addFailure_(aTestCase);
  47929. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47930. }));
  47931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47932. }))._on_do_($globals.Error,(function(ex){
  47933. return $core.withContext(function($ctx2) {
  47934. return $self._addError_(aTestCase);
  47935. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  47936. }));
  47937. $ctx1.sendIdx["on:do:"]=1;
  47938. return self;
  47939. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  47940. },
  47941. args: ["aTestCase"],
  47942. 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 ]",
  47943. referencedClasses: ["TestFailure", "Error"],
  47944. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  47945. }),
  47946. $globals.TestResult);
  47947. $core.addMethod(
  47948. $core.method({
  47949. selector: "runs",
  47950. protocol: "accessing",
  47951. fn: function (){
  47952. var self=this,$self=this;
  47953. return $self["@runs"];
  47954. },
  47955. args: [],
  47956. source: "runs\x0a\x09^ runs",
  47957. referencedClasses: [],
  47958. messageSends: []
  47959. }),
  47960. $globals.TestResult);
  47961. $core.addMethod(
  47962. $core.method({
  47963. selector: "status",
  47964. protocol: "accessing",
  47965. fn: function (){
  47966. var self=this,$self=this;
  47967. return $core.withContext(function($ctx1) {
  47968. var $1;
  47969. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  47970. return "error";
  47971. }),(function(){
  47972. return $core.withContext(function($ctx2) {
  47973. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  47974. return "failure";
  47975. }),(function(){
  47976. return "success";
  47977. }));
  47978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47979. }));
  47980. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  47981. return $1;
  47982. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  47983. },
  47984. args: [],
  47985. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  47986. referencedClasses: [],
  47987. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  47988. }),
  47989. $globals.TestResult);
  47990. $core.addMethod(
  47991. $core.method({
  47992. selector: "timestamp",
  47993. protocol: "accessing",
  47994. fn: function (){
  47995. var self=this,$self=this;
  47996. return $self["@timestamp"];
  47997. },
  47998. args: [],
  47999. source: "timestamp\x0a\x09^ timestamp",
  48000. referencedClasses: [],
  48001. messageSends: []
  48002. }),
  48003. $globals.TestResult);
  48004. $core.addMethod(
  48005. $core.method({
  48006. selector: "total",
  48007. protocol: "accessing",
  48008. fn: function (){
  48009. var self=this,$self=this;
  48010. return $self["@total"];
  48011. },
  48012. args: [],
  48013. source: "total\x0a\x09^ total",
  48014. referencedClasses: [],
  48015. messageSends: []
  48016. }),
  48017. $globals.TestResult);
  48018. $core.addMethod(
  48019. $core.method({
  48020. selector: "total:",
  48021. protocol: "accessing",
  48022. fn: function (aNumber){
  48023. var self=this,$self=this;
  48024. $self["@total"]=aNumber;
  48025. return self;
  48026. },
  48027. args: ["aNumber"],
  48028. source: "total: aNumber\x0a\x09total := aNumber",
  48029. referencedClasses: [],
  48030. messageSends: []
  48031. }),
  48032. $globals.TestResult);
  48033. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48034. $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`.";
  48035. $core.addMethod(
  48036. $core.method({
  48037. selector: "announcer",
  48038. protocol: "accessing",
  48039. fn: function (){
  48040. var self=this,$self=this;
  48041. return $self["@announcer"];
  48042. },
  48043. args: [],
  48044. source: "announcer\x0a\x09^ announcer",
  48045. referencedClasses: [],
  48046. messageSends: []
  48047. }),
  48048. $globals.TestSuiteRunner);
  48049. $core.addMethod(
  48050. $core.method({
  48051. selector: "contextOf:",
  48052. protocol: "private",
  48053. fn: function (anInteger){
  48054. var self=this,$self=this;
  48055. return $core.withContext(function($ctx1) {
  48056. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48057. return $core.withContext(function($ctx2) {
  48058. return $self._resume();
  48059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48060. }));
  48061. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48062. },
  48063. args: ["anInteger"],
  48064. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48065. referencedClasses: ["ReportingTestContext"],
  48066. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48067. }),
  48068. $globals.TestSuiteRunner);
  48069. $core.addMethod(
  48070. $core.method({
  48071. selector: "initialize",
  48072. protocol: "initialization",
  48073. fn: function (){
  48074. var self=this,$self=this;
  48075. return $core.withContext(function($ctx1) {
  48076. var $1;
  48077. (
  48078. $ctx1.supercall = true,
  48079. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48080. $ctx1.supercall = false;
  48081. $self["@announcer"]=$recv($globals.Announcer)._new();
  48082. $ctx1.sendIdx["new"]=1;
  48083. $self["@result"]=$recv($globals.TestResult)._new();
  48084. $self["@runNextTest"]=(function(){
  48085. var runs;
  48086. return $core.withContext(function($ctx2) {
  48087. runs=$recv($self["@result"])._runs();
  48088. runs;
  48089. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48090. if($core.assert($1)){
  48091. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48092. }
  48093. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48094. });
  48095. return self;
  48096. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48097. },
  48098. args: [],
  48099. 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 ] ].",
  48100. referencedClasses: ["Announcer", "TestResult"],
  48101. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48102. }),
  48103. $globals.TestSuiteRunner);
  48104. $core.addMethod(
  48105. $core.method({
  48106. selector: "result",
  48107. protocol: "accessing",
  48108. fn: function (){
  48109. var self=this,$self=this;
  48110. return $self["@result"];
  48111. },
  48112. args: [],
  48113. source: "result\x0a\x09^ result",
  48114. referencedClasses: [],
  48115. messageSends: []
  48116. }),
  48117. $globals.TestSuiteRunner);
  48118. $core.addMethod(
  48119. $core.method({
  48120. selector: "resume",
  48121. protocol: "actions",
  48122. fn: function (){
  48123. var self=this,$self=this;
  48124. return $core.withContext(function($ctx1) {
  48125. $recv($self["@runNextTest"])._fork();
  48126. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48127. return self;
  48128. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48129. },
  48130. args: [],
  48131. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48132. referencedClasses: ["ResultAnnouncement"],
  48133. messageSends: ["fork", "announce:", "result:", "new"]
  48134. }),
  48135. $globals.TestSuiteRunner);
  48136. $core.addMethod(
  48137. $core.method({
  48138. selector: "run",
  48139. protocol: "actions",
  48140. fn: function (){
  48141. var self=this,$self=this;
  48142. return $core.withContext(function($ctx1) {
  48143. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48144. $self._resume();
  48145. return self;
  48146. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48147. },
  48148. args: [],
  48149. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48150. referencedClasses: [],
  48151. messageSends: ["total:", "size", "resume"]
  48152. }),
  48153. $globals.TestSuiteRunner);
  48154. $core.addMethod(
  48155. $core.method({
  48156. selector: "suite:",
  48157. protocol: "accessing",
  48158. fn: function (aCollection){
  48159. var self=this,$self=this;
  48160. $self["@suite"]=aCollection;
  48161. return self;
  48162. },
  48163. args: ["aCollection"],
  48164. source: "suite: aCollection\x0a\x09suite := aCollection",
  48165. referencedClasses: [],
  48166. messageSends: []
  48167. }),
  48168. $globals.TestSuiteRunner);
  48169. $core.addMethod(
  48170. $core.method({
  48171. selector: "new",
  48172. protocol: "instance creation",
  48173. fn: function (){
  48174. var self=this,$self=this;
  48175. return $core.withContext(function($ctx1) {
  48176. $self._shouldNotImplement();
  48177. return self;
  48178. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48179. },
  48180. args: [],
  48181. source: "new\x0a\x09self shouldNotImplement",
  48182. referencedClasses: [],
  48183. messageSends: ["shouldNotImplement"]
  48184. }),
  48185. $globals.TestSuiteRunner.a$cls);
  48186. $core.addMethod(
  48187. $core.method({
  48188. selector: "on:",
  48189. protocol: "instance creation",
  48190. fn: function (aCollection){
  48191. var self=this,$self=this;
  48192. return $core.withContext(function($ctx1) {
  48193. var $1;
  48194. $1=(
  48195. $ctx1.supercall = true,
  48196. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48197. $ctx1.supercall = false;
  48198. return $recv($1)._suite_(aCollection);
  48199. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48200. },
  48201. args: ["aCollection"],
  48202. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48203. referencedClasses: [],
  48204. messageSends: ["suite:", "new"]
  48205. }),
  48206. $globals.TestSuiteRunner.a$cls);
  48207. $core.addMethod(
  48208. $core.method({
  48209. selector: "isTestPackage",
  48210. protocol: "*SUnit",
  48211. fn: function (){
  48212. var self=this,$self=this;
  48213. return $core.withContext(function($ctx1) {
  48214. return $recv($self._classes())._anySatisfy_((function(each){
  48215. return $core.withContext(function($ctx2) {
  48216. return $recv(each)._isTestClass();
  48217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48218. }));
  48219. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48220. },
  48221. args: [],
  48222. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48223. referencedClasses: [],
  48224. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48225. }),
  48226. $globals.Package);
  48227. $core.addMethod(
  48228. $core.method({
  48229. selector: "isTestClass",
  48230. protocol: "*SUnit",
  48231. fn: function (){
  48232. var self=this,$self=this;
  48233. return false;
  48234. },
  48235. args: [],
  48236. source: "isTestClass\x0a\x09^ false",
  48237. referencedClasses: [],
  48238. messageSends: []
  48239. }),
  48240. $globals.TBehaviorDefaults);
  48241. });
  48242. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48243. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48244. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48245. $core.addPackage("Compiler-Tests");
  48246. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48247. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48248. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48249. $core.addMethod(
  48250. $core.method({
  48251. selector: "analyze:forClass:",
  48252. protocol: "convenience",
  48253. fn: function (aNode,aClass){
  48254. var self=this,$self=this;
  48255. return $core.withContext(function($ctx1) {
  48256. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  48257. return aNode;
  48258. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  48259. },
  48260. args: ["aNode", "aClass"],
  48261. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  48262. referencedClasses: ["SemanticAnalyzer"],
  48263. messageSends: ["visit:", "on:"]
  48264. }),
  48265. $globals.ASTParsingTest);
  48266. $core.addMethod(
  48267. $core.method({
  48268. selector: "parse:",
  48269. protocol: "parsing",
  48270. fn: function (aString){
  48271. var self=this,$self=this;
  48272. return $core.withContext(function($ctx1) {
  48273. return $recv($globals.Smalltalk)._parse_(aString);
  48274. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  48275. },
  48276. args: ["aString"],
  48277. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  48278. referencedClasses: ["Smalltalk"],
  48279. messageSends: ["parse:"]
  48280. }),
  48281. $globals.ASTParsingTest);
  48282. $core.addMethod(
  48283. $core.method({
  48284. selector: "parse:forClass:",
  48285. protocol: "parsing",
  48286. fn: function (aString,aClass){
  48287. var self=this,$self=this;
  48288. return $core.withContext(function($ctx1) {
  48289. return $self._analyze_forClass_($self._parse_(aString),aClass);
  48290. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48291. },
  48292. args: ["aString", "aClass"],
  48293. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  48294. referencedClasses: [],
  48295. messageSends: ["analyze:forClass:", "parse:"]
  48296. }),
  48297. $globals.ASTParsingTest);
  48298. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48299. $core.addMethod(
  48300. $core.method({
  48301. selector: "astPCNodeVisitor",
  48302. protocol: "factory",
  48303. fn: function (){
  48304. var self=this,$self=this;
  48305. return $core.withContext(function($ctx1) {
  48306. var $1;
  48307. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48308. $recv($1)._index_((0));
  48309. return $recv($1)._yourself();
  48310. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48311. },
  48312. args: [],
  48313. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48314. referencedClasses: ["ASTPCNodeVisitor"],
  48315. messageSends: ["index:", "new", "yourself"]
  48316. }),
  48317. $globals.ASTPCNodeVisitorTest);
  48318. $core.addMethod(
  48319. $core.method({
  48320. selector: "astPCNodeVisitorForSelector:",
  48321. protocol: "factory",
  48322. fn: function (aString){
  48323. var self=this,$self=this;
  48324. return $core.withContext(function($ctx1) {
  48325. var $1;
  48326. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48327. $recv($1)._selector_(aString);
  48328. $recv($1)._index_((0));
  48329. return $recv($1)._yourself();
  48330. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48331. },
  48332. args: ["aString"],
  48333. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48334. referencedClasses: ["ASTPCNodeVisitor"],
  48335. messageSends: ["selector:", "new", "index:", "yourself"]
  48336. }),
  48337. $globals.ASTPCNodeVisitorTest);
  48338. $core.addMethod(
  48339. $core.method({
  48340. selector: "testJSStatementNode",
  48341. protocol: "tests",
  48342. fn: function (){
  48343. var self=this,$self=this;
  48344. var ast,visitor;
  48345. return $core.withContext(function($ctx1) {
  48346. var $3,$2,$1;
  48347. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48348. $3=$self._astPCNodeVisitor();
  48349. $recv($3)._visit_(ast);
  48350. $2=$recv($3)._currentNode();
  48351. $1=$recv($2)._isJSStatementNode();
  48352. $self._assert_($1);
  48353. return self;
  48354. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48355. },
  48356. args: [],
  48357. 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",
  48358. referencedClasses: ["Object"],
  48359. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48360. }),
  48361. $globals.ASTPCNodeVisitorTest);
  48362. $core.addMethod(
  48363. $core.method({
  48364. selector: "testLegacyJSStatementNode",
  48365. protocol: "tests",
  48366. fn: function (){
  48367. var self=this,$self=this;
  48368. var ast,visitor;
  48369. return $core.withContext(function($ctx1) {
  48370. var $3,$2,$1;
  48371. ast=$self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  48372. $3=$self._astPCNodeVisitor();
  48373. $recv($3)._visit_(ast);
  48374. $2=$recv($3)._currentNode();
  48375. $1=$recv($2)._isJSStatementNode();
  48376. $self._assert_($1);
  48377. return self;
  48378. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48379. },
  48380. args: [],
  48381. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  48382. referencedClasses: ["Object"],
  48383. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48384. }),
  48385. $globals.ASTPCNodeVisitorTest);
  48386. $core.addMethod(
  48387. $core.method({
  48388. selector: "testMessageSend",
  48389. protocol: "tests",
  48390. fn: function (){
  48391. var self=this,$self=this;
  48392. var ast;
  48393. return $core.withContext(function($ctx1) {
  48394. var $3,$2,$1;
  48395. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48396. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48397. $recv($3)._visit_(ast);
  48398. $2=$recv($3)._currentNode();
  48399. $1=$recv($2)._selector();
  48400. $self._assert_equals_($1,"yourself");
  48401. return self;
  48402. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48403. },
  48404. args: [],
  48405. 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'",
  48406. referencedClasses: ["Object"],
  48407. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48408. }),
  48409. $globals.ASTPCNodeVisitorTest);
  48410. $core.addMethod(
  48411. $core.method({
  48412. selector: "testMessageSendWithBlocks",
  48413. protocol: "tests",
  48414. fn: function (){
  48415. var self=this,$self=this;
  48416. var ast;
  48417. return $core.withContext(function($ctx1) {
  48418. var $3,$2,$1;
  48419. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48420. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48421. $recv($3)._visit_(ast);
  48422. $2=$recv($3)._currentNode();
  48423. $1=$recv($2)._selector();
  48424. $self._assert_equals_($1,"yourself");
  48425. return self;
  48426. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48427. },
  48428. args: [],
  48429. 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'",
  48430. referencedClasses: ["Object"],
  48431. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48432. }),
  48433. $globals.ASTPCNodeVisitorTest);
  48434. $core.addMethod(
  48435. $core.method({
  48436. selector: "testMessageSendWithInlining",
  48437. protocol: "tests",
  48438. fn: function (){
  48439. var self=this,$self=this;
  48440. var ast;
  48441. return $core.withContext(function($ctx1) {
  48442. var $3,$4,$2,$1,$7,$6,$5;
  48443. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48444. $ctx1.sendIdx["parse:forClass:"]=1;
  48445. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48446. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48447. $recv($3)._visit_(ast);
  48448. $ctx1.sendIdx["visit:"]=1;
  48449. $4=$recv($3)._currentNode();
  48450. $ctx1.sendIdx["currentNode"]=1;
  48451. $2=$4;
  48452. $1=$recv($2)._selector();
  48453. $ctx1.sendIdx["selector"]=1;
  48454. $self._assert_equals_($1,"yourself");
  48455. $ctx1.sendIdx["assert:equals:"]=1;
  48456. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48457. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48458. $recv($7)._visit_(ast);
  48459. $6=$recv($7)._currentNode();
  48460. $5=$recv($6)._selector();
  48461. $self._assert_equals_($5,"asBoolean");
  48462. return self;
  48463. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48464. },
  48465. args: [],
  48466. 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'",
  48467. referencedClasses: ["Object"],
  48468. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48469. }),
  48470. $globals.ASTPCNodeVisitorTest);
  48471. $core.addMethod(
  48472. $core.method({
  48473. selector: "testNoMessageSend",
  48474. protocol: "tests",
  48475. fn: function (){
  48476. var self=this,$self=this;
  48477. var ast;
  48478. return $core.withContext(function($ctx1) {
  48479. var $3,$2,$1;
  48480. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48481. $3=$self._astPCNodeVisitor();
  48482. $recv($3)._visit_(ast);
  48483. $2=$recv($3)._currentNode();
  48484. $1=$recv($2)._isNil();
  48485. $self._assert_($1);
  48486. return self;
  48487. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48488. },
  48489. args: [],
  48490. 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",
  48491. referencedClasses: ["Object"],
  48492. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48493. }),
  48494. $globals.ASTPCNodeVisitorTest);
  48495. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48496. $core.addMethod(
  48497. $core.method({
  48498. selector: "testNodeAtPosition",
  48499. protocol: "tests",
  48500. fn: function (){
  48501. var self=this,$self=this;
  48502. var node;
  48503. return $core.withContext(function($ctx1) {
  48504. var $3,$4,$2,$1,$7,$8,$6,$5;
  48505. node=$self._parse_("yourself\x0a\x09^ self");
  48506. $ctx1.sendIdx["parse:"]=1;
  48507. $3=node;
  48508. $4=(2).__at((4));
  48509. $ctx1.sendIdx["@"]=1;
  48510. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48511. return nil;
  48512. }));
  48513. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48514. $1=$recv($2)._source();
  48515. $self._assert_equals_($1,"self");
  48516. $ctx1.sendIdx["assert:equals:"]=1;
  48517. node=$self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  48518. $ctx1.sendIdx["parse:"]=2;
  48519. $7=node;
  48520. $8=(2).__at((7));
  48521. $ctx1.sendIdx["@"]=2;
  48522. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48523. return nil;
  48524. }));
  48525. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48526. $5=$recv($6)._selector();
  48527. $ctx1.sendIdx["selector"]=1;
  48528. $self._assert_equals_($5,"ifTrue:");
  48529. $ctx1.sendIdx["assert:equals:"]=2;
  48530. node=$self._parse_("foo\x0a\x09self foo; bar; baz");
  48531. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48532. return nil;
  48533. })))._selector(),"foo");
  48534. return self;
  48535. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48536. },
  48537. args: [],
  48538. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48539. referencedClasses: [],
  48540. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48541. }),
  48542. $globals.ASTPositionTest);
  48543. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48544. $core.addMethod(
  48545. $core.method({
  48546. selector: "codeGeneratorClass",
  48547. protocol: "accessing",
  48548. fn: function (){
  48549. var self=this,$self=this;
  48550. return $globals.CodeGenerator;
  48551. },
  48552. args: [],
  48553. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48554. referencedClasses: ["CodeGenerator"],
  48555. messageSends: []
  48556. }),
  48557. $globals.CodeGeneratorTest);
  48558. $core.addMethod(
  48559. $core.method({
  48560. selector: "compiler",
  48561. protocol: "factory",
  48562. fn: function (){
  48563. var self=this,$self=this;
  48564. return $core.withContext(function($ctx1) {
  48565. var $1;
  48566. $1=$recv($globals.Compiler)._new();
  48567. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48568. return $recv($1)._yourself();
  48569. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48570. },
  48571. args: [],
  48572. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48573. referencedClasses: ["Compiler"],
  48574. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48575. }),
  48576. $globals.CodeGeneratorTest);
  48577. $core.addMethod(
  48578. $core.method({
  48579. selector: "setUp",
  48580. protocol: "initialization",
  48581. fn: function (){
  48582. var self=this,$self=this;
  48583. return $core.withContext(function($ctx1) {
  48584. $self["@receiver"]=$recv($globals.DoIt)._new();
  48585. return self;
  48586. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48587. },
  48588. args: [],
  48589. source: "setUp\x0a\x09receiver := DoIt new",
  48590. referencedClasses: ["DoIt"],
  48591. messageSends: ["new"]
  48592. }),
  48593. $globals.CodeGeneratorTest);
  48594. $core.addMethod(
  48595. $core.method({
  48596. selector: "should:receiver:raise:",
  48597. protocol: "testing",
  48598. fn: function (aString,anObject,anErrorClass){
  48599. var self=this,$self=this;
  48600. var method,result;
  48601. return $core.withContext(function($ctx1) {
  48602. var $1,$2,$3,$receiver;
  48603. $self["@receiver"]=anObject;
  48604. $recv((function(){
  48605. return $core.withContext(function($ctx2) {
  48606. return $self._should_raise_((function(){
  48607. return $core.withContext(function($ctx3) {
  48608. $1=$self._compiler();
  48609. $2=$recv(anObject)._class();
  48610. $ctx3.sendIdx["class"]=1;
  48611. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48612. method;
  48613. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48614. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48615. }),anErrorClass);
  48616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48617. }))._ensure_((function(){
  48618. return $core.withContext(function($ctx2) {
  48619. $3=method;
  48620. if(($receiver = $3) == null || $receiver.a$nil){
  48621. return $3;
  48622. } else {
  48623. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48624. }
  48625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48626. }));
  48627. return self;
  48628. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48629. },
  48630. args: ["aString", "anObject", "anErrorClass"],
  48631. 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 ] ]",
  48632. referencedClasses: [],
  48633. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48634. }),
  48635. $globals.CodeGeneratorTest);
  48636. $core.addMethod(
  48637. $core.method({
  48638. selector: "should:receiver:return:",
  48639. protocol: "testing",
  48640. fn: function (aString,anObject,aResult){
  48641. var self=this,$self=this;
  48642. var method,result;
  48643. return $core.withContext(function($ctx1) {
  48644. var $1,$2;
  48645. $self["@receiver"]=anObject;
  48646. $1=$self._compiler();
  48647. $2=$recv(anObject)._class();
  48648. $ctx1.sendIdx["class"]=1;
  48649. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48650. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48651. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48652. $self._assert_equals_(aResult,result);
  48653. return self;
  48654. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48655. },
  48656. args: ["aString", "anObject", "aResult"],
  48657. 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",
  48658. referencedClasses: [],
  48659. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48660. }),
  48661. $globals.CodeGeneratorTest);
  48662. $core.addMethod(
  48663. $core.method({
  48664. selector: "should:return:",
  48665. protocol: "testing",
  48666. fn: function (aString,anObject){
  48667. var self=this,$self=this;
  48668. return $core.withContext(function($ctx1) {
  48669. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48670. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48671. },
  48672. args: ["aString", "anObject"],
  48673. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48674. referencedClasses: [],
  48675. messageSends: ["should:receiver:return:"]
  48676. }),
  48677. $globals.CodeGeneratorTest);
  48678. $core.addMethod(
  48679. $core.method({
  48680. selector: "tearDown",
  48681. protocol: "initialization",
  48682. fn: function (){
  48683. var self=this,$self=this;
  48684. return self;
  48685. },
  48686. args: [],
  48687. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  48688. referencedClasses: [],
  48689. messageSends: []
  48690. }),
  48691. $globals.CodeGeneratorTest);
  48692. $core.addMethod(
  48693. $core.method({
  48694. selector: "testAssignment",
  48695. protocol: "tests",
  48696. fn: function (){
  48697. var self=this,$self=this;
  48698. return $core.withContext(function($ctx1) {
  48699. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  48700. $ctx1.sendIdx["should:return:"]=1;
  48701. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  48702. $ctx1.sendIdx["should:return:"]=2;
  48703. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  48704. return self;
  48705. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  48706. },
  48707. args: [],
  48708. 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",
  48709. referencedClasses: [],
  48710. messageSends: ["should:return:"]
  48711. }),
  48712. $globals.CodeGeneratorTest);
  48713. $core.addMethod(
  48714. $core.method({
  48715. selector: "testBackslashSelectors",
  48716. protocol: "tests",
  48717. fn: function (){
  48718. var self=this,$self=this;
  48719. return $core.withContext(function($ctx1) {
  48720. $self._should_return_("\x5c arg ^ 4",(4));
  48721. $ctx1.sendIdx["should:return:"]=1;
  48722. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  48723. return self;
  48724. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  48725. },
  48726. args: [],
  48727. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  48728. referencedClasses: [],
  48729. messageSends: ["should:return:"]
  48730. }),
  48731. $globals.CodeGeneratorTest);
  48732. $core.addMethod(
  48733. $core.method({
  48734. selector: "testBlockReturn",
  48735. protocol: "tests",
  48736. fn: function (){
  48737. var self=this,$self=this;
  48738. return $core.withContext(function($ctx1) {
  48739. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  48740. $ctx1.sendIdx["should:return:"]=1;
  48741. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  48742. $ctx1.sendIdx["should:return:"]=2;
  48743. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  48744. return self;
  48745. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  48746. },
  48747. args: [],
  48748. 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).",
  48749. referencedClasses: [],
  48750. messageSends: ["should:return:"]
  48751. }),
  48752. $globals.CodeGeneratorTest);
  48753. $core.addMethod(
  48754. $core.method({
  48755. selector: "testCascades",
  48756. protocol: "tests",
  48757. fn: function (){
  48758. var self=this,$self=this;
  48759. return $core.withContext(function($ctx1) {
  48760. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  48761. return self;
  48762. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  48763. },
  48764. args: [],
  48765. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  48766. referencedClasses: [],
  48767. messageSends: ["should:return:"]
  48768. }),
  48769. $globals.CodeGeneratorTest);
  48770. $core.addMethod(
  48771. $core.method({
  48772. selector: "testCascadesInDynamicArray",
  48773. protocol: "tests",
  48774. fn: function (){
  48775. var self=this,$self=this;
  48776. return $core.withContext(function($ctx1) {
  48777. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  48778. return self;
  48779. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  48780. },
  48781. args: [],
  48782. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  48783. referencedClasses: [],
  48784. messageSends: ["should:return:"]
  48785. }),
  48786. $globals.CodeGeneratorTest);
  48787. $core.addMethod(
  48788. $core.method({
  48789. selector: "testCascadesInDynamicDictioary",
  48790. protocol: "tests",
  48791. fn: function (){
  48792. var self=this,$self=this;
  48793. return $core.withContext(function($ctx1) {
  48794. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  48795. return self;
  48796. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  48797. },
  48798. args: [],
  48799. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  48800. referencedClasses: [],
  48801. messageSends: ["should:return:"]
  48802. }),
  48803. $globals.CodeGeneratorTest);
  48804. $core.addMethod(
  48805. $core.method({
  48806. selector: "testCascadesInSend",
  48807. protocol: "tests",
  48808. fn: function (){
  48809. var self=this,$self=this;
  48810. return $core.withContext(function($ctx1) {
  48811. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  48812. return self;
  48813. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  48814. },
  48815. args: [],
  48816. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  48817. referencedClasses: [],
  48818. messageSends: ["should:return:"]
  48819. }),
  48820. $globals.CodeGeneratorTest);
  48821. $core.addMethod(
  48822. $core.method({
  48823. selector: "testCascadesWithInlining",
  48824. protocol: "tests",
  48825. fn: function (){
  48826. var self=this,$self=this;
  48827. return $core.withContext(function($ctx1) {
  48828. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  48829. $ctx1.sendIdx["should:return:"]=1;
  48830. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  48831. return self;
  48832. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  48833. },
  48834. args: [],
  48835. 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",
  48836. referencedClasses: [],
  48837. messageSends: ["should:return:"]
  48838. }),
  48839. $globals.CodeGeneratorTest);
  48840. $core.addMethod(
  48841. $core.method({
  48842. selector: "testDynamicArrayElementsOrdered",
  48843. protocol: "tests",
  48844. fn: function (){
  48845. var self=this,$self=this;
  48846. return $core.withContext(function($ctx1) {
  48847. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  48848. $ctx1.sendIdx["should:return:"]=1;
  48849. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  48850. return self;
  48851. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  48852. },
  48853. args: [],
  48854. 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).",
  48855. referencedClasses: [],
  48856. messageSends: ["should:return:"]
  48857. }),
  48858. $globals.CodeGeneratorTest);
  48859. $core.addMethod(
  48860. $core.method({
  48861. selector: "testDynamicDictionaryElementsOrdered",
  48862. protocol: "tests",
  48863. fn: function (){
  48864. var self=this,$self=this;
  48865. return $core.withContext(function($ctx1) {
  48866. $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)]));
  48867. return self;
  48868. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  48869. },
  48870. args: [],
  48871. 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}.",
  48872. referencedClasses: [],
  48873. messageSends: ["should:return:"]
  48874. }),
  48875. $globals.CodeGeneratorTest);
  48876. $core.addMethod(
  48877. $core.method({
  48878. selector: "testDynamicDictionaryWithMoreArrows",
  48879. protocol: "tests",
  48880. fn: function (){
  48881. var self=this,$self=this;
  48882. return $core.withContext(function($ctx1) {
  48883. var $2,$1;
  48884. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  48885. $ctx1.sendIdx["->"]=1;
  48886. $1=$recv($globals.HashedCollection)._with_($2);
  48887. $self._should_return_("foo ^ #{1->2->3}",$1);
  48888. return self;
  48889. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  48890. },
  48891. args: [],
  48892. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  48893. referencedClasses: ["HashedCollection"],
  48894. messageSends: ["should:return:", "with:", "->"]
  48895. }),
  48896. $globals.CodeGeneratorTest);
  48897. $core.addMethod(
  48898. $core.method({
  48899. selector: "testGlobalVar",
  48900. protocol: "tests",
  48901. fn: function (){
  48902. var self=this,$self=this;
  48903. return $core.withContext(function($ctx1) {
  48904. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  48905. $ctx1.sendIdx["should:return:"]=1;
  48906. $self._should_return_("foo ^ Math cos: 0",(1));
  48907. $ctx1.sendIdx["should:return:"]=2;
  48908. $self._should_return_("foo ^ NonExistingVar",nil);
  48909. return self;
  48910. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  48911. },
  48912. args: [],
  48913. 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",
  48914. referencedClasses: ["BlockClosure"],
  48915. messageSends: ["should:return:"]
  48916. }),
  48917. $globals.CodeGeneratorTest);
  48918. $core.addMethod(
  48919. $core.method({
  48920. selector: "testInnerTemporalDependentElementsOrdered",
  48921. protocol: "tests",
  48922. fn: function (){
  48923. var self=this,$self=this;
  48924. return $core.withContext(function($ctx1) {
  48925. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  48926. $2="foo".__minus_gt($globals.Array);
  48927. $ctx1.sendIdx["->"]=1;
  48928. $3="bar".__minus_gt((2));
  48929. $ctx1.sendIdx["->"]=2;
  48930. $1=[$2,$3];
  48931. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  48932. $ctx1.sendIdx["should:return:"]=1;
  48933. $5="foo".__minus_gt($globals.Array);
  48934. $ctx1.sendIdx["->"]=3;
  48935. $6="bar".__minus_gt((2));
  48936. $ctx1.sendIdx["->"]=4;
  48937. $4=[$5,$6];
  48938. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  48939. $ctx1.sendIdx["should:return:"]=2;
  48940. $8="foo".__minus_gt((1));
  48941. $ctx1.sendIdx["->"]=5;
  48942. $9="bar".__minus_gt((2));
  48943. $ctx1.sendIdx["->"]=6;
  48944. $7=[$8,$9];
  48945. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  48946. $ctx1.sendIdx["should:return:"]=3;
  48947. $11="foo".__minus_gt((1));
  48948. $ctx1.sendIdx["->"]=7;
  48949. $10=[$11,"bar".__minus_gt((2))];
  48950. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  48951. $ctx1.sendIdx["should:return:"]=4;
  48952. $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)]));
  48953. return self;
  48954. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  48955. },
  48956. args: [],
  48957. 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}.",
  48958. referencedClasses: ["Array"],
  48959. messageSends: ["should:return:", "->"]
  48960. }),
  48961. $globals.CodeGeneratorTest);
  48962. $core.addMethod(
  48963. $core.method({
  48964. selector: "testJSStatement",
  48965. protocol: "tests",
  48966. fn: function (){
  48967. var self=this,$self=this;
  48968. return $core.withContext(function($ctx1) {
  48969. $self._should_return_("foo <return 2+3>",(5));
  48970. return self;
  48971. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  48972. },
  48973. args: [],
  48974. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  48975. referencedClasses: [],
  48976. messageSends: ["should:return:"]
  48977. }),
  48978. $globals.CodeGeneratorTest);
  48979. $core.addMethod(
  48980. $core.method({
  48981. selector: "testLexicalScope",
  48982. protocol: "tests",
  48983. fn: function (){
  48984. var self=this,$self=this;
  48985. return $core.withContext(function($ctx1) {
  48986. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  48987. return self;
  48988. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  48989. },
  48990. args: [],
  48991. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  48992. referencedClasses: [],
  48993. messageSends: ["should:return:"]
  48994. }),
  48995. $globals.CodeGeneratorTest);
  48996. $core.addMethod(
  48997. $core.method({
  48998. selector: "testLiterals",
  48999. protocol: "tests",
  49000. fn: function (){
  49001. var self=this,$self=this;
  49002. return $core.withContext(function($ctx1) {
  49003. $self._should_return_("foo ^ 1",(1));
  49004. $ctx1.sendIdx["should:return:"]=1;
  49005. $self._should_return_("foo ^ 'hello'","hello");
  49006. $ctx1.sendIdx["should:return:"]=2;
  49007. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49008. $ctx1.sendIdx["should:return:"]=3;
  49009. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49010. $ctx1.sendIdx["should:return:"]=4;
  49011. $self._should_return_("foo ^ true",true);
  49012. $ctx1.sendIdx["should:return:"]=5;
  49013. $self._should_return_("foo ^ false",false);
  49014. $ctx1.sendIdx["should:return:"]=6;
  49015. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49016. $ctx1.sendIdx["should:return:"]=7;
  49017. $self._should_return_("foo ^ #hello","hello");
  49018. $ctx1.sendIdx["should:return:"]=8;
  49019. $self._should_return_("foo ^ $h","h");
  49020. $ctx1.sendIdx["should:return:"]=9;
  49021. $self._should_return_("foo ^ -123.456",(-123.456));
  49022. $ctx1.sendIdx["should:return:"]=10;
  49023. $self._should_return_("foo ^ -2.5e4",(-25000));
  49024. return self;
  49025. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49026. },
  49027. args: [],
  49028. 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.",
  49029. referencedClasses: [],
  49030. messageSends: ["should:return:"]
  49031. }),
  49032. $globals.CodeGeneratorTest);
  49033. $core.addMethod(
  49034. $core.method({
  49035. selector: "testLocalReturn",
  49036. protocol: "tests",
  49037. fn: function (){
  49038. var self=this,$self=this;
  49039. return $core.withContext(function($ctx1) {
  49040. $self._should_return_("foo ^ 1",(1));
  49041. $ctx1.sendIdx["should:return:"]=1;
  49042. $self._should_return_("foo ^ 1 + 1",(2));
  49043. $ctx1.sendIdx["should:return:"]=2;
  49044. $self._should_return_("foo ",$self["@receiver"]);
  49045. $ctx1.sendIdx["should:return:"]=3;
  49046. $self._should_return_("foo self asString",$self["@receiver"]);
  49047. $ctx1.sendIdx["should:return:"]=4;
  49048. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49049. return self;
  49050. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49051. },
  49052. args: [],
  49053. 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",
  49054. referencedClasses: [],
  49055. messageSends: ["should:return:"]
  49056. }),
  49057. $globals.CodeGeneratorTest);
  49058. $core.addMethod(
  49059. $core.method({
  49060. selector: "testMessageSends",
  49061. protocol: "tests",
  49062. fn: function (){
  49063. var self=this,$self=this;
  49064. return $core.withContext(function($ctx1) {
  49065. $self._should_return_("foo ^ 1 asString","1");
  49066. $ctx1.sendIdx["should:return:"]=1;
  49067. $self._should_return_("foo ^ 1 + 1",(2));
  49068. $ctx1.sendIdx["should:return:"]=2;
  49069. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49070. $ctx1.sendIdx["should:return:"]=3;
  49071. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49072. $ctx1.sendIdx["should:return:"]=4;
  49073. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49074. return self;
  49075. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49076. },
  49077. args: [],
  49078. 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)",
  49079. referencedClasses: [],
  49080. messageSends: ["should:return:"]
  49081. }),
  49082. $globals.CodeGeneratorTest);
  49083. $core.addMethod(
  49084. $core.method({
  49085. selector: "testMistypedPragmaJSStatement",
  49086. protocol: "tests",
  49087. fn: function (){
  49088. var self=this,$self=this;
  49089. return $core.withContext(function($ctx1) {
  49090. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49091. return self;
  49092. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49093. },
  49094. args: [],
  49095. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49096. referencedClasses: ["ParseError"],
  49097. messageSends: ["should:receiver:raise:"]
  49098. }),
  49099. $globals.CodeGeneratorTest);
  49100. $core.addMethod(
  49101. $core.method({
  49102. selector: "testMultipleSequences",
  49103. protocol: "tests",
  49104. fn: function (){
  49105. var self=this,$self=this;
  49106. return $core.withContext(function($ctx1) {
  49107. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49108. return self;
  49109. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49110. },
  49111. args: [],
  49112. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49113. referencedClasses: [],
  49114. messageSends: ["should:return:"]
  49115. }),
  49116. $globals.CodeGeneratorTest);
  49117. $core.addMethod(
  49118. $core.method({
  49119. selector: "testMutableLiterals",
  49120. protocol: "tests",
  49121. fn: function (){
  49122. var self=this,$self=this;
  49123. return $core.withContext(function($ctx1) {
  49124. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49125. return self;
  49126. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49127. },
  49128. args: [],
  49129. 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)",
  49130. referencedClasses: [],
  49131. messageSends: ["should:return:"]
  49132. }),
  49133. $globals.CodeGeneratorTest);
  49134. $core.addMethod(
  49135. $core.method({
  49136. selector: "testNestedIfTrue",
  49137. protocol: "tests",
  49138. fn: function (){
  49139. var self=this,$self=this;
  49140. return $core.withContext(function($ctx1) {
  49141. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49142. $ctx1.sendIdx["should:return:"]=1;
  49143. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49144. $ctx1.sendIdx["should:return:"]=2;
  49145. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49146. $ctx1.sendIdx["should:return:"]=3;
  49147. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49148. return self;
  49149. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49150. },
  49151. args: [],
  49152. 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.",
  49153. referencedClasses: [],
  49154. messageSends: ["should:return:"]
  49155. }),
  49156. $globals.CodeGeneratorTest);
  49157. $core.addMethod(
  49158. $core.method({
  49159. selector: "testNestedSends",
  49160. protocol: "tests",
  49161. fn: function (){
  49162. var self=this,$self=this;
  49163. return $core.withContext(function($ctx1) {
  49164. $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());
  49165. return self;
  49166. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49167. },
  49168. args: [],
  49169. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49170. referencedClasses: ["Point"],
  49171. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49172. }),
  49173. $globals.CodeGeneratorTest);
  49174. $core.addMethod(
  49175. $core.method({
  49176. selector: "testNonLocalReturn",
  49177. protocol: "tests",
  49178. fn: function (){
  49179. var self=this,$self=this;
  49180. return $core.withContext(function($ctx1) {
  49181. $self._should_return_("foo [ ^ 1 ] value",(1));
  49182. $ctx1.sendIdx["should:return:"]=1;
  49183. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49184. $ctx1.sendIdx["should:return:"]=2;
  49185. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49186. $ctx1.sendIdx["should:return:"]=3;
  49187. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49188. return self;
  49189. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49190. },
  49191. args: [],
  49192. 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",
  49193. referencedClasses: [],
  49194. messageSends: ["should:return:"]
  49195. }),
  49196. $globals.CodeGeneratorTest);
  49197. $core.addMethod(
  49198. $core.method({
  49199. selector: "testPascalCaseGlobal",
  49200. protocol: "tests",
  49201. fn: function (){
  49202. var self=this,$self=this;
  49203. return $core.withContext(function($ctx1) {
  49204. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49205. $ctx1.sendIdx["should:return:"]=1;
  49206. $self._should_return_("foo ^NonExistent",nil);
  49207. return self;
  49208. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49209. },
  49210. args: [],
  49211. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49212. referencedClasses: ["Smalltalk"],
  49213. messageSends: ["should:return:", "at:", "globals"]
  49214. }),
  49215. $globals.CodeGeneratorTest);
  49216. $core.addMethod(
  49217. $core.method({
  49218. selector: "testPragmaJSStatement",
  49219. protocol: "tests",
  49220. fn: function (){
  49221. var self=this,$self=this;
  49222. return $core.withContext(function($ctx1) {
  49223. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49224. return self;
  49225. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49226. },
  49227. args: [],
  49228. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49229. referencedClasses: [],
  49230. messageSends: ["should:return:"]
  49231. }),
  49232. $globals.CodeGeneratorTest);
  49233. $core.addMethod(
  49234. $core.method({
  49235. selector: "testRootSuperSend",
  49236. protocol: "tests",
  49237. fn: function (){
  49238. var self=this,$self=this;
  49239. return $core.withContext(function($ctx1) {
  49240. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49241. return self;
  49242. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49243. },
  49244. args: [],
  49245. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49246. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49247. messageSends: ["should:receiver:raise:", "new"]
  49248. }),
  49249. $globals.CodeGeneratorTest);
  49250. $core.addMethod(
  49251. $core.method({
  49252. selector: "testSendReceiverAndArgumentsOrdered",
  49253. protocol: "tests",
  49254. fn: function (){
  49255. var self=this,$self=this;
  49256. return $core.withContext(function($ctx1) {
  49257. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49258. $ctx1.sendIdx["should:return:"]=1;
  49259. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49260. return self;
  49261. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49262. },
  49263. args: [],
  49264. 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}.",
  49265. referencedClasses: ["Array"],
  49266. messageSends: ["should:return:"]
  49267. }),
  49268. $globals.CodeGeneratorTest);
  49269. $core.addMethod(
  49270. $core.method({
  49271. selector: "testSuperSend",
  49272. protocol: "tests",
  49273. fn: function (){
  49274. var self=this,$self=this;
  49275. return $core.withContext(function($ctx1) {
  49276. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49277. return self;
  49278. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49279. },
  49280. args: [],
  49281. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49282. referencedClasses: [],
  49283. messageSends: ["should:receiver:return:"]
  49284. }),
  49285. $globals.CodeGeneratorTest);
  49286. $core.addMethod(
  49287. $core.method({
  49288. selector: "testTempVariables",
  49289. protocol: "tests",
  49290. fn: function (){
  49291. var self=this,$self=this;
  49292. return $core.withContext(function($ctx1) {
  49293. $self._should_return_("foo | a | ^ a",nil);
  49294. $ctx1.sendIdx["should:return:"]=1;
  49295. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49296. $ctx1.sendIdx["should:return:"]=2;
  49297. $self._should_return_("foo | a b c | ^ c",nil);
  49298. $ctx1.sendIdx["should:return:"]=3;
  49299. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49300. $ctx1.sendIdx["should:return:"]=4;
  49301. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49302. $ctx1.sendIdx["should:return:"]=5;
  49303. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49304. return self;
  49305. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49306. },
  49307. args: [],
  49308. 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.",
  49309. referencedClasses: [],
  49310. messageSends: ["should:return:"]
  49311. }),
  49312. $globals.CodeGeneratorTest);
  49313. $core.addMethod(
  49314. $core.method({
  49315. selector: "testThisContext",
  49316. protocol: "tests",
  49317. fn: function (){
  49318. var self=this,$self=this;
  49319. return $core.withContext(function($ctx1) {
  49320. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49321. return self;
  49322. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49323. },
  49324. args: [],
  49325. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49326. referencedClasses: [],
  49327. messageSends: ["should:return:"]
  49328. }),
  49329. $globals.CodeGeneratorTest);
  49330. $core.addMethod(
  49331. $core.method({
  49332. selector: "testifFalse",
  49333. protocol: "tests",
  49334. fn: function (){
  49335. var self=this,$self=this;
  49336. return $core.withContext(function($ctx1) {
  49337. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49338. $ctx1.sendIdx["should:return:"]=1;
  49339. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49340. $ctx1.sendIdx["should:return:"]=2;
  49341. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49342. $ctx1.sendIdx["should:return:"]=3;
  49343. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49344. return self;
  49345. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49346. },
  49347. args: [],
  49348. 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.",
  49349. referencedClasses: [],
  49350. messageSends: ["should:return:"]
  49351. }),
  49352. $globals.CodeGeneratorTest);
  49353. $core.addMethod(
  49354. $core.method({
  49355. selector: "testifFalseIfTrue",
  49356. protocol: "tests",
  49357. fn: function (){
  49358. var self=this,$self=this;
  49359. return $core.withContext(function($ctx1) {
  49360. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49361. $ctx1.sendIdx["should:return:"]=1;
  49362. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49363. $ctx1.sendIdx["should:return:"]=2;
  49364. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49365. $ctx1.sendIdx["should:return:"]=3;
  49366. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49367. return self;
  49368. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49369. },
  49370. args: [],
  49371. 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.",
  49372. referencedClasses: [],
  49373. messageSends: ["should:return:"]
  49374. }),
  49375. $globals.CodeGeneratorTest);
  49376. $core.addMethod(
  49377. $core.method({
  49378. selector: "testifNil",
  49379. protocol: "tests",
  49380. fn: function (){
  49381. var self=this,$self=this;
  49382. return $core.withContext(function($ctx1) {
  49383. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49384. $ctx1.sendIdx["should:return:"]=1;
  49385. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49386. $ctx1.sendIdx["should:return:"]=2;
  49387. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49388. $ctx1.sendIdx["should:return:"]=3;
  49389. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49390. return self;
  49391. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49392. },
  49393. args: [],
  49394. 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.",
  49395. referencedClasses: [],
  49396. messageSends: ["should:return:"]
  49397. }),
  49398. $globals.CodeGeneratorTest);
  49399. $core.addMethod(
  49400. $core.method({
  49401. selector: "testifNilIfNotNil",
  49402. protocol: "tests",
  49403. fn: function (){
  49404. var self=this,$self=this;
  49405. return $core.withContext(function($ctx1) {
  49406. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49407. $ctx1.sendIdx["should:return:"]=1;
  49408. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49409. $ctx1.sendIdx["should:return:"]=2;
  49410. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49411. $ctx1.sendIdx["should:return:"]=3;
  49412. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49413. return self;
  49414. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49415. },
  49416. args: [],
  49417. 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.",
  49418. referencedClasses: [],
  49419. messageSends: ["should:return:"]
  49420. }),
  49421. $globals.CodeGeneratorTest);
  49422. $core.addMethod(
  49423. $core.method({
  49424. selector: "testifNotNil",
  49425. protocol: "tests",
  49426. fn: function (){
  49427. var self=this,$self=this;
  49428. return $core.withContext(function($ctx1) {
  49429. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49430. $ctx1.sendIdx["should:return:"]=1;
  49431. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49432. $ctx1.sendIdx["should:return:"]=2;
  49433. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49434. $ctx1.sendIdx["should:return:"]=3;
  49435. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49436. return self;
  49437. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49438. },
  49439. args: [],
  49440. 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.",
  49441. referencedClasses: [],
  49442. messageSends: ["should:return:"]
  49443. }),
  49444. $globals.CodeGeneratorTest);
  49445. $core.addMethod(
  49446. $core.method({
  49447. selector: "testifNotNilWithArgument",
  49448. protocol: "tests",
  49449. fn: function (){
  49450. var self=this,$self=this;
  49451. return $core.withContext(function($ctx1) {
  49452. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49453. $ctx1.sendIdx["should:return:"]=1;
  49454. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49455. $ctx1.sendIdx["should:return:"]=2;
  49456. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49457. $ctx1.sendIdx["should:return:"]=3;
  49458. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49459. $ctx1.sendIdx["should:return:"]=4;
  49460. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49461. $ctx1.sendIdx["should:return:"]=5;
  49462. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49463. return self;
  49464. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49465. },
  49466. args: [],
  49467. 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",
  49468. referencedClasses: [],
  49469. messageSends: ["should:return:"]
  49470. }),
  49471. $globals.CodeGeneratorTest);
  49472. $core.addMethod(
  49473. $core.method({
  49474. selector: "testifTrue",
  49475. protocol: "tests",
  49476. fn: function (){
  49477. var self=this,$self=this;
  49478. return $core.withContext(function($ctx1) {
  49479. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49480. $ctx1.sendIdx["should:return:"]=1;
  49481. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49482. $ctx1.sendIdx["should:return:"]=2;
  49483. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49484. $ctx1.sendIdx["should:return:"]=3;
  49485. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49486. return self;
  49487. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49488. },
  49489. args: [],
  49490. 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.",
  49491. referencedClasses: [],
  49492. messageSends: ["should:return:"]
  49493. }),
  49494. $globals.CodeGeneratorTest);
  49495. $core.addMethod(
  49496. $core.method({
  49497. selector: "testifTrueIfFalse",
  49498. protocol: "tests",
  49499. fn: function (){
  49500. var self=this,$self=this;
  49501. return $core.withContext(function($ctx1) {
  49502. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49503. $ctx1.sendIdx["should:return:"]=1;
  49504. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49505. $ctx1.sendIdx["should:return:"]=2;
  49506. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49507. $ctx1.sendIdx["should:return:"]=3;
  49508. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49509. return self;
  49510. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49511. },
  49512. args: [],
  49513. 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.",
  49514. referencedClasses: [],
  49515. messageSends: ["should:return:"]
  49516. }),
  49517. $globals.CodeGeneratorTest);
  49518. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49519. $core.addMethod(
  49520. $core.method({
  49521. selector: "analyze:forClass:",
  49522. protocol: "parsing",
  49523. fn: function (aNode,aClass){
  49524. var self=this,$self=this;
  49525. return $core.withContext(function($ctx1) {
  49526. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  49527. return aNode;
  49528. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  49529. },
  49530. args: ["aNode", "aClass"],
  49531. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  49532. referencedClasses: ["SemanticAnalyzer"],
  49533. messageSends: ["visit:", "on:"]
  49534. }),
  49535. $globals.ASTInterpreterTest);
  49536. $core.addMethod(
  49537. $core.method({
  49538. selector: "interpret:receiver:withArguments:",
  49539. protocol: "private",
  49540. fn: function (aString,anObject,aDictionary){
  49541. var self=this,$self=this;
  49542. var ctx,ast,interpreter;
  49543. return $core.withContext(function($ctx1) {
  49544. var $1,$2,$3,$receiver;
  49545. interpreter=$recv($globals.ASTInterpreter)._new();
  49546. $ctx1.sendIdx["new"]=1;
  49547. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49548. $1=$recv($globals.AIContext)._new();
  49549. $recv($1)._receiver_(anObject);
  49550. $recv($1)._interpreter_(interpreter);
  49551. ctx=$recv($1)._yourself();
  49552. $2=$recv(ast)._sequenceNode();
  49553. if(($receiver = $2) == null || $receiver.a$nil){
  49554. $2;
  49555. } else {
  49556. var sequence;
  49557. sequence=$receiver;
  49558. $recv($recv(sequence)._temps())._do_((function(each){
  49559. return $core.withContext(function($ctx2) {
  49560. return $recv(ctx)._defineLocal_(each);
  49561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49562. }));
  49563. }
  49564. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49565. return $core.withContext(function($ctx2) {
  49566. return $recv(ctx)._localAt_put_(key,value);
  49567. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49568. }));
  49569. $3=interpreter;
  49570. $recv($3)._context_(ctx);
  49571. $recv($3)._node_(ast);
  49572. $recv($3)._enterNode();
  49573. $recv($3)._proceed();
  49574. return $recv($3)._result();
  49575. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49576. },
  49577. args: ["aString", "anObject", "aDictionary"],
  49578. 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",
  49579. referencedClasses: ["ASTInterpreter", "AIContext"],
  49580. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49581. }),
  49582. $globals.ASTInterpreterTest);
  49583. $core.addMethod(
  49584. $core.method({
  49585. selector: "parse:",
  49586. protocol: "parsing",
  49587. fn: function (aString){
  49588. var self=this,$self=this;
  49589. return $core.withContext(function($ctx1) {
  49590. return $recv($globals.Smalltalk)._parse_(aString);
  49591. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  49592. },
  49593. args: ["aString"],
  49594. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  49595. referencedClasses: ["Smalltalk"],
  49596. messageSends: ["parse:"]
  49597. }),
  49598. $globals.ASTInterpreterTest);
  49599. $core.addMethod(
  49600. $core.method({
  49601. selector: "parse:forClass:",
  49602. protocol: "parsing",
  49603. fn: function (aString,aClass){
  49604. var self=this,$self=this;
  49605. return $core.withContext(function($ctx1) {
  49606. return $self._analyze_forClass_($self._parse_(aString),aClass);
  49607. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  49608. },
  49609. args: ["aString", "aClass"],
  49610. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  49611. referencedClasses: [],
  49612. messageSends: ["analyze:forClass:", "parse:"]
  49613. }),
  49614. $globals.ASTInterpreterTest);
  49615. $core.addMethod(
  49616. $core.method({
  49617. selector: "should:receiver:return:",
  49618. protocol: "testing",
  49619. fn: function (aString,anObject,aResult){
  49620. var self=this,$self=this;
  49621. return $core.withContext(function($ctx1) {
  49622. $self["@receiver"]=anObject;
  49623. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49624. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49625. },
  49626. args: ["aString", "anObject", "aResult"],
  49627. 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",
  49628. referencedClasses: [],
  49629. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49630. }),
  49631. $globals.ASTInterpreterTest);
  49632. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49633. $core.addMethod(
  49634. $core.method({
  49635. selector: "interpret:receiver:withArguments:",
  49636. protocol: "private",
  49637. fn: function (aString,anObject,aDictionary){
  49638. var self=this,$self=this;
  49639. var ctx,ast,debugger_;
  49640. return $core.withContext(function($ctx1) {
  49641. var $1,$2,$3,$4,$5,$receiver;
  49642. $1=$recv($globals.AIContext)._new();
  49643. $ctx1.sendIdx["new"]=1;
  49644. $recv($1)._receiver_(anObject);
  49645. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49646. ctx=$recv($1)._yourself();
  49647. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49648. $2=$recv(ast)._sequenceNode();
  49649. if(($receiver = $2) == null || $receiver.a$nil){
  49650. $2;
  49651. } else {
  49652. var sequence;
  49653. sequence=$receiver;
  49654. $recv($recv(sequence)._temps())._do_((function(each){
  49655. return $core.withContext(function($ctx2) {
  49656. return $recv(ctx)._defineLocal_(each);
  49657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49658. }));
  49659. }
  49660. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49661. return $core.withContext(function($ctx2) {
  49662. return $recv(ctx)._localAt_put_(key,value);
  49663. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49664. }));
  49665. $3=$recv(ctx)._interpreter();
  49666. $ctx1.sendIdx["interpreter"]=1;
  49667. $recv($3)._context_(ctx);
  49668. $ctx1.sendIdx["context:"]=1;
  49669. $4=$recv(ctx)._interpreter();
  49670. $recv($4)._node_(ast);
  49671. $recv($4)._enterNode();
  49672. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49673. $5=debugger_;
  49674. $recv($5)._proceed();
  49675. return $recv($5)._result();
  49676. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49677. },
  49678. args: ["aString", "anObject", "aDictionary"],
  49679. 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",
  49680. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49681. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49682. }),
  49683. $globals.ASTDebuggerTest);
  49684. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49685. $core.addMethod(
  49686. $core.method({
  49687. selector: "codeGeneratorClass",
  49688. protocol: "accessing",
  49689. fn: function (){
  49690. var self=this,$self=this;
  49691. return $globals.InliningCodeGenerator;
  49692. },
  49693. args: [],
  49694. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49695. referencedClasses: ["InliningCodeGenerator"],
  49696. messageSends: []
  49697. }),
  49698. $globals.InliningCodeGeneratorTest);
  49699. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49700. $core.addMethod(
  49701. $core.method({
  49702. selector: "testClassRefVar",
  49703. protocol: "tests",
  49704. fn: function (){
  49705. var self=this,$self=this;
  49706. var node;
  49707. return $core.withContext(function($ctx1) {
  49708. var $1,$2;
  49709. $1=$recv($globals.VariableNode)._new();
  49710. $ctx1.sendIdx["new"]=1;
  49711. $recv($1)._value_("Object");
  49712. node=$recv($1)._yourself();
  49713. $2=$recv($globals.SemanticAnalyzer)._new();
  49714. $ctx1.sendIdx["new"]=2;
  49715. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49716. $recv($2)._visit_(node);
  49717. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  49718. return self;
  49719. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  49720. },
  49721. args: [],
  49722. 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",
  49723. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  49724. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  49725. }),
  49726. $globals.ScopeVarTest);
  49727. $core.addMethod(
  49728. $core.method({
  49729. selector: "testInstanceVar",
  49730. protocol: "tests",
  49731. fn: function (){
  49732. var self=this,$self=this;
  49733. var node,scope;
  49734. return $core.withContext(function($ctx1) {
  49735. var $1;
  49736. $1=$recv($globals.VariableNode)._new();
  49737. $ctx1.sendIdx["new"]=1;
  49738. $recv($1)._value_("bzzz");
  49739. node=$recv($1)._yourself();
  49740. scope=$recv($globals.MethodLexicalScope)._new();
  49741. $recv(scope)._addIVar_("bzzz");
  49742. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  49743. return self;
  49744. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49745. },
  49746. args: [],
  49747. 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",
  49748. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49749. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  49750. }),
  49751. $globals.ScopeVarTest);
  49752. $core.addMethod(
  49753. $core.method({
  49754. selector: "testPseudoVar",
  49755. protocol: "tests",
  49756. fn: function (){
  49757. var self=this,$self=this;
  49758. var node,pseudoVars;
  49759. return $core.withContext(function($ctx1) {
  49760. var $1;
  49761. pseudoVars=["self", "super", "true", "false", "nil"];
  49762. $recv(pseudoVars)._do_((function(each){
  49763. return $core.withContext(function($ctx2) {
  49764. $1=$recv($globals.VariableNode)._new();
  49765. $ctx2.sendIdx["new"]=1;
  49766. $recv($1)._value_(each);
  49767. node=$recv($1)._yourself();
  49768. node;
  49769. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  49770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49771. }));
  49772. return self;
  49773. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  49774. },
  49775. args: [],
  49776. 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]",
  49777. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49778. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  49779. }),
  49780. $globals.ScopeVarTest);
  49781. $core.addMethod(
  49782. $core.method({
  49783. selector: "testTempVar",
  49784. protocol: "tests",
  49785. fn: function (){
  49786. var self=this,$self=this;
  49787. var node,scope;
  49788. return $core.withContext(function($ctx1) {
  49789. var $1;
  49790. $1=$recv($globals.VariableNode)._new();
  49791. $ctx1.sendIdx["new"]=1;
  49792. $recv($1)._value_("bzzz");
  49793. node=$recv($1)._yourself();
  49794. scope=$recv($globals.MethodLexicalScope)._new();
  49795. $recv(scope)._addTemp_("bzzz");
  49796. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  49797. return self;
  49798. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49799. },
  49800. args: [],
  49801. 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",
  49802. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49803. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  49804. }),
  49805. $globals.ScopeVarTest);
  49806. $core.addMethod(
  49807. $core.method({
  49808. selector: "testUnknownVar",
  49809. protocol: "tests",
  49810. fn: function (){
  49811. var self=this,$self=this;
  49812. var node;
  49813. return $core.withContext(function($ctx1) {
  49814. var $1;
  49815. $1=$recv($globals.VariableNode)._new();
  49816. $ctx1.sendIdx["new"]=1;
  49817. $recv($1)._value_("bzzz");
  49818. node=$recv($1)._yourself();
  49819. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  49820. return self;
  49821. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  49822. },
  49823. args: [],
  49824. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  49825. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49826. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  49827. }),
  49828. $globals.ScopeVarTest);
  49829. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  49830. $core.addMethod(
  49831. $core.method({
  49832. selector: "setUp",
  49833. protocol: "running",
  49834. fn: function (){
  49835. var self=this,$self=this;
  49836. return $core.withContext(function($ctx1) {
  49837. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  49838. return self;
  49839. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  49840. },
  49841. args: [],
  49842. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  49843. referencedClasses: ["SemanticAnalyzer", "Object"],
  49844. messageSends: ["on:"]
  49845. }),
  49846. $globals.SemanticAnalyzerTest);
  49847. $core.addMethod(
  49848. $core.method({
  49849. selector: "testAssignment",
  49850. protocol: "tests",
  49851. fn: function (){
  49852. var self=this,$self=this;
  49853. var src,ast;
  49854. return $core.withContext(function($ctx1) {
  49855. src="foo self := 1";
  49856. ast=$recv($globals.Smalltalk)._parse_(src);
  49857. $self._should_raise_((function(){
  49858. return $core.withContext(function($ctx2) {
  49859. return $recv($self["@analyzer"])._visit_(ast);
  49860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49861. }),$globals.InvalidAssignmentError);
  49862. return self;
  49863. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49864. },
  49865. args: [],
  49866. 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",
  49867. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  49868. messageSends: ["parse:", "should:raise:", "visit:"]
  49869. }),
  49870. $globals.SemanticAnalyzerTest);
  49871. $core.addMethod(
  49872. $core.method({
  49873. selector: "testNonLocalReturn",
  49874. protocol: "tests",
  49875. fn: function (){
  49876. var self=this,$self=this;
  49877. var src,ast;
  49878. return $core.withContext(function($ctx1) {
  49879. src="foo | a | a + 1. ^ a";
  49880. ast=$recv($globals.Smalltalk)._parse_(src);
  49881. $recv($self["@analyzer"])._visit_(ast);
  49882. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49883. return self;
  49884. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49885. },
  49886. args: [],
  49887. 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",
  49888. referencedClasses: ["Smalltalk"],
  49889. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  49890. }),
  49891. $globals.SemanticAnalyzerTest);
  49892. $core.addMethod(
  49893. $core.method({
  49894. selector: "testNonLocalReturn2",
  49895. protocol: "tests",
  49896. fn: function (){
  49897. var self=this,$self=this;
  49898. var src,ast;
  49899. return $core.withContext(function($ctx1) {
  49900. src="foo | a | a + 1. [ [ ^ a] ]";
  49901. ast=$recv($globals.Smalltalk)._parse_(src);
  49902. $recv($self["@analyzer"])._visit_(ast);
  49903. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49904. return self;
  49905. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49906. },
  49907. args: [],
  49908. 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",
  49909. referencedClasses: ["Smalltalk"],
  49910. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  49911. }),
  49912. $globals.SemanticAnalyzerTest);
  49913. $core.addMethod(
  49914. $core.method({
  49915. selector: "testScope",
  49916. protocol: "tests",
  49917. fn: function (){
  49918. var self=this,$self=this;
  49919. var src,ast;
  49920. return $core.withContext(function($ctx1) {
  49921. var $4,$3,$2,$1;
  49922. src="foo | a | a + 1. [ | b | b := a ]";
  49923. ast=$recv($globals.Smalltalk)._parse_(src);
  49924. $recv($self["@analyzer"])._visit_(ast);
  49925. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49926. $ctx1.sendIdx["dagChildren"]=1;
  49927. $3=$recv($4)._last();
  49928. $2=$recv($3)._scope();
  49929. $ctx1.sendIdx["scope"]=1;
  49930. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49931. $self._deny_($1);
  49932. return self;
  49933. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49934. },
  49935. args: [],
  49936. 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.",
  49937. referencedClasses: ["Smalltalk"],
  49938. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  49939. }),
  49940. $globals.SemanticAnalyzerTest);
  49941. $core.addMethod(
  49942. $core.method({
  49943. selector: "testScope2",
  49944. protocol: "tests",
  49945. fn: function (){
  49946. var self=this,$self=this;
  49947. var src,ast;
  49948. return $core.withContext(function($ctx1) {
  49949. var $8,$7,$6,$5,$4,$3,$2,$1;
  49950. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49951. ast=$recv($globals.Smalltalk)._parse_(src);
  49952. $recv($self["@analyzer"])._visit_(ast);
  49953. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49954. $ctx1.sendIdx["dagChildren"]=3;
  49955. $7=$recv($8)._last();
  49956. $6=$recv($7)._dagChildren();
  49957. $ctx1.sendIdx["dagChildren"]=2;
  49958. $5=$recv($6)._first();
  49959. $ctx1.sendIdx["first"]=2;
  49960. $4=$recv($5)._dagChildren();
  49961. $ctx1.sendIdx["dagChildren"]=1;
  49962. $3=$recv($4)._first();
  49963. $ctx1.sendIdx["first"]=1;
  49964. $2=$recv($3)._scope();
  49965. $ctx1.sendIdx["scope"]=1;
  49966. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49967. $self._deny_($1);
  49968. return self;
  49969. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49970. },
  49971. args: [],
  49972. 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.",
  49973. referencedClasses: ["Smalltalk"],
  49974. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  49975. }),
  49976. $globals.SemanticAnalyzerTest);
  49977. $core.addMethod(
  49978. $core.method({
  49979. selector: "testScopeLevel",
  49980. protocol: "tests",
  49981. fn: function (){
  49982. var self=this,$self=this;
  49983. var src,ast;
  49984. return $core.withContext(function($ctx1) {
  49985. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  49986. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49987. ast=$recv($globals.Smalltalk)._parse_(src);
  49988. $recv($self["@analyzer"])._visit_(ast);
  49989. $2=$recv(ast)._scope();
  49990. $ctx1.sendIdx["scope"]=1;
  49991. $1=$recv($2)._scopeLevel();
  49992. $ctx1.sendIdx["scopeLevel"]=1;
  49993. $self._assert_equals_($1,(1));
  49994. $ctx1.sendIdx["assert:equals:"]=1;
  49995. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49996. $ctx1.sendIdx["dagChildren"]=3;
  49997. $9=$recv($10)._last();
  49998. $8=$recv($9)._dagChildren();
  49999. $ctx1.sendIdx["dagChildren"]=2;
  50000. $7=$recv($8)._first();
  50001. $ctx1.sendIdx["first"]=2;
  50002. $6=$recv($7)._dagChildren();
  50003. $ctx1.sendIdx["dagChildren"]=1;
  50004. $5=$recv($6)._first();
  50005. $ctx1.sendIdx["first"]=1;
  50006. $4=$recv($5)._scope();
  50007. $3=$recv($4)._scopeLevel();
  50008. $self._assert_equals_($3,(3));
  50009. return self;
  50010. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50011. },
  50012. args: [],
  50013. 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",
  50014. referencedClasses: ["Smalltalk"],
  50015. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50016. }),
  50017. $globals.SemanticAnalyzerTest);
  50018. $core.addMethod(
  50019. $core.method({
  50020. selector: "testUnknownVariables",
  50021. protocol: "tests",
  50022. fn: function (){
  50023. var self=this,$self=this;
  50024. var src,ast;
  50025. return $core.withContext(function($ctx1) {
  50026. src="foo | a | b + a";
  50027. ast=$recv($globals.Smalltalk)._parse_(src);
  50028. $self._should_raise_((function(){
  50029. return $core.withContext(function($ctx2) {
  50030. return $recv($self["@analyzer"])._visit_(ast);
  50031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50032. }),$globals.UnknownVariableError);
  50033. return self;
  50034. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50035. },
  50036. args: [],
  50037. 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",
  50038. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50039. messageSends: ["parse:", "should:raise:", "visit:"]
  50040. }),
  50041. $globals.SemanticAnalyzerTest);
  50042. $core.addMethod(
  50043. $core.method({
  50044. selector: "testUnknownVariablesWithScope",
  50045. protocol: "tests",
  50046. fn: function (){
  50047. var self=this,$self=this;
  50048. var src,ast;
  50049. return $core.withContext(function($ctx1) {
  50050. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50051. ast=$recv($globals.Smalltalk)._parse_(src);
  50052. $self._should_raise_((function(){
  50053. return $core.withContext(function($ctx2) {
  50054. return $recv($self["@analyzer"])._visit_(ast);
  50055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50056. }),$globals.UnknownVariableError);
  50057. return self;
  50058. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50059. },
  50060. args: [],
  50061. 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",
  50062. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50063. messageSends: ["parse:", "should:raise:", "visit:"]
  50064. }),
  50065. $globals.SemanticAnalyzerTest);
  50066. $core.addMethod(
  50067. $core.method({
  50068. selector: "testVariableShadowing",
  50069. protocol: "tests",
  50070. fn: function (){
  50071. var self=this,$self=this;
  50072. var src,ast;
  50073. return $core.withContext(function($ctx1) {
  50074. src="foo | a | a + 1";
  50075. ast=$recv($globals.Smalltalk)._parse_(src);
  50076. $recv($self["@analyzer"])._visit_(ast);
  50077. return self;
  50078. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50079. },
  50080. args: [],
  50081. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50082. referencedClasses: ["Smalltalk"],
  50083. messageSends: ["parse:", "visit:"]
  50084. }),
  50085. $globals.SemanticAnalyzerTest);
  50086. $core.addMethod(
  50087. $core.method({
  50088. selector: "testVariableShadowing2",
  50089. protocol: "tests",
  50090. fn: function (){
  50091. var self=this,$self=this;
  50092. var src,ast;
  50093. return $core.withContext(function($ctx1) {
  50094. src="foo | a | a + 1. [ | a | a := 2 ]";
  50095. ast=$recv($globals.Smalltalk)._parse_(src);
  50096. $self._should_raise_((function(){
  50097. return $core.withContext(function($ctx2) {
  50098. return $recv($self["@analyzer"])._visit_(ast);
  50099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50100. }),$globals.ShadowingVariableError);
  50101. return self;
  50102. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50103. },
  50104. args: [],
  50105. 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",
  50106. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50107. messageSends: ["parse:", "should:raise:", "visit:"]
  50108. }),
  50109. $globals.SemanticAnalyzerTest);
  50110. $core.addMethod(
  50111. $core.method({
  50112. selector: "testVariableShadowing3",
  50113. protocol: "tests",
  50114. fn: function (){
  50115. var self=this,$self=this;
  50116. var src,ast;
  50117. return $core.withContext(function($ctx1) {
  50118. src="foo | a | a + 1. [ | b | b := 2 ]";
  50119. ast=$recv($globals.Smalltalk)._parse_(src);
  50120. $recv($self["@analyzer"])._visit_(ast);
  50121. return self;
  50122. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50123. },
  50124. args: [],
  50125. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50126. referencedClasses: ["Smalltalk"],
  50127. messageSends: ["parse:", "visit:"]
  50128. }),
  50129. $globals.SemanticAnalyzerTest);
  50130. $core.addMethod(
  50131. $core.method({
  50132. selector: "testVariableShadowing4",
  50133. protocol: "tests",
  50134. fn: function (){
  50135. var self=this,$self=this;
  50136. var src,ast;
  50137. return $core.withContext(function($ctx1) {
  50138. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50139. ast=$recv($globals.Smalltalk)._parse_(src);
  50140. $recv($self["@analyzer"])._visit_(ast);
  50141. return self;
  50142. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50143. },
  50144. args: [],
  50145. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50146. referencedClasses: ["Smalltalk"],
  50147. messageSends: ["parse:", "visit:"]
  50148. }),
  50149. $globals.SemanticAnalyzerTest);
  50150. $core.addMethod(
  50151. $core.method({
  50152. selector: "testVariableShadowing5",
  50153. protocol: "tests",
  50154. fn: function (){
  50155. var self=this,$self=this;
  50156. var src,ast;
  50157. return $core.withContext(function($ctx1) {
  50158. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50159. ast=$recv($globals.Smalltalk)._parse_(src);
  50160. $self._should_raise_((function(){
  50161. return $core.withContext(function($ctx2) {
  50162. return $recv($self["@analyzer"])._visit_(ast);
  50163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50164. }),$globals.ShadowingVariableError);
  50165. return self;
  50166. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50167. },
  50168. args: [],
  50169. 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",
  50170. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50171. messageSends: ["parse:", "should:raise:", "visit:"]
  50172. }),
  50173. $globals.SemanticAnalyzerTest);
  50174. $core.addMethod(
  50175. $core.method({
  50176. selector: "testVariablesLookup",
  50177. protocol: "tests",
  50178. fn: function (){
  50179. var self=this,$self=this;
  50180. var src,ast;
  50181. return $core.withContext(function($ctx1) {
  50182. 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;
  50183. src="foo | a | a + 1. [ | b | b := a ]";
  50184. ast=$recv($globals.Smalltalk)._parse_(src);
  50185. $recv($self["@analyzer"])._visit_(ast);
  50186. $7=$recv(ast)._dagChildren();
  50187. $ctx1.sendIdx["dagChildren"]=2;
  50188. $6=$recv($7)._first();
  50189. $ctx1.sendIdx["first"]=2;
  50190. $5=$recv($6)._dagChildren();
  50191. $ctx1.sendIdx["dagChildren"]=1;
  50192. $4=$recv($5)._first();
  50193. $ctx1.sendIdx["first"]=1;
  50194. $3=$recv($4)._receiver();
  50195. $ctx1.sendIdx["receiver"]=1;
  50196. $2=$recv($3)._binding();
  50197. $ctx1.sendIdx["binding"]=1;
  50198. $1=$recv($2)._isTempVar();
  50199. $ctx1.sendIdx["isTempVar"]=1;
  50200. $self._assert_($1);
  50201. $ctx1.sendIdx["assert:"]=1;
  50202. $15=$recv(ast)._dagChildren();
  50203. $ctx1.sendIdx["dagChildren"]=4;
  50204. $14=$recv($15)._first();
  50205. $ctx1.sendIdx["first"]=4;
  50206. $13=$recv($14)._dagChildren();
  50207. $ctx1.sendIdx["dagChildren"]=3;
  50208. $12=$recv($13)._first();
  50209. $ctx1.sendIdx["first"]=3;
  50210. $11=$recv($12)._receiver();
  50211. $10=$recv($11)._binding();
  50212. $ctx1.sendIdx["binding"]=2;
  50213. $9=$recv($10)._scope();
  50214. $ctx1.sendIdx["scope"]=1;
  50215. $16=$recv(ast)._scope();
  50216. $ctx1.sendIdx["scope"]=2;
  50217. $8=$recv($9).__eq_eq($16);
  50218. $ctx1.sendIdx["=="]=1;
  50219. $self._assert_($8);
  50220. $ctx1.sendIdx["assert:"]=2;
  50221. $27=$recv(ast)._dagChildren();
  50222. $ctx1.sendIdx["dagChildren"]=8;
  50223. $26=$recv($27)._first();
  50224. $ctx1.sendIdx["first"]=7;
  50225. $25=$recv($26)._dagChildren();
  50226. $ctx1.sendIdx["dagChildren"]=7;
  50227. $24=$recv($25)._last();
  50228. $ctx1.sendIdx["last"]=1;
  50229. $23=$recv($24)._dagChildren();
  50230. $ctx1.sendIdx["dagChildren"]=6;
  50231. $22=$recv($23)._first();
  50232. $ctx1.sendIdx["first"]=6;
  50233. $21=$recv($22)._dagChildren();
  50234. $ctx1.sendIdx["dagChildren"]=5;
  50235. $20=$recv($21)._first();
  50236. $ctx1.sendIdx["first"]=5;
  50237. $19=$recv($20)._left();
  50238. $ctx1.sendIdx["left"]=1;
  50239. $18=$recv($19)._binding();
  50240. $ctx1.sendIdx["binding"]=3;
  50241. $17=$recv($18)._isTempVar();
  50242. $self._assert_($17);
  50243. $ctx1.sendIdx["assert:"]=3;
  50244. $39=$recv(ast)._dagChildren();
  50245. $ctx1.sendIdx["dagChildren"]=12;
  50246. $38=$recv($39)._first();
  50247. $ctx1.sendIdx["first"]=10;
  50248. $37=$recv($38)._dagChildren();
  50249. $ctx1.sendIdx["dagChildren"]=11;
  50250. $36=$recv($37)._last();
  50251. $ctx1.sendIdx["last"]=2;
  50252. $35=$recv($36)._dagChildren();
  50253. $ctx1.sendIdx["dagChildren"]=10;
  50254. $34=$recv($35)._first();
  50255. $ctx1.sendIdx["first"]=9;
  50256. $33=$recv($34)._dagChildren();
  50257. $ctx1.sendIdx["dagChildren"]=9;
  50258. $32=$recv($33)._first();
  50259. $ctx1.sendIdx["first"]=8;
  50260. $31=$recv($32)._left();
  50261. $30=$recv($31)._binding();
  50262. $29=$recv($30)._scope();
  50263. $ctx1.sendIdx["scope"]=3;
  50264. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50265. $ctx1.sendIdx["dagChildren"]=13;
  50266. $41=$recv($42)._last();
  50267. $40=$recv($41)._scope();
  50268. $28=$recv($29).__eq_eq($40);
  50269. $self._assert_($28);
  50270. return self;
  50271. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50272. },
  50273. args: [],
  50274. 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.",
  50275. referencedClasses: ["Smalltalk"],
  50276. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50277. }),
  50278. $globals.SemanticAnalyzerTest);
  50279. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50280. $core.addMethod(
  50281. $core.method({
  50282. selector: "setUp",
  50283. protocol: "running",
  50284. fn: function (){
  50285. var self=this,$self=this;
  50286. return $core.withContext(function($ctx1) {
  50287. var $1,$3,$4,$2;
  50288. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50289. $3=$recv($globals.AIContext)._new();
  50290. $recv($3)._defineLocal_("local");
  50291. $recv($3)._localAt_put_("local",(3));
  50292. $4=$recv($3)._yourself();
  50293. $ctx1.sendIdx["yourself"]=1;
  50294. $2=$4;
  50295. $recv($1)._context_($2);
  50296. $self["@analyzer"]=$recv($1)._yourself();
  50297. return self;
  50298. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50299. },
  50300. args: [],
  50301. 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",
  50302. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50303. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50304. }),
  50305. $globals.AISemanticAnalyzerTest);
  50306. $core.addMethod(
  50307. $core.method({
  50308. selector: "testContextVariables",
  50309. protocol: "tests",
  50310. fn: function (){
  50311. var self=this,$self=this;
  50312. var src,ast;
  50313. return $core.withContext(function($ctx1) {
  50314. src="foo | a | local + a";
  50315. ast=$recv($globals.Smalltalk)._parse_(src);
  50316. $self._shouldnt_raise_((function(){
  50317. return $core.withContext(function($ctx2) {
  50318. return $recv($self["@analyzer"])._visit_(ast);
  50319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50320. }),$globals.UnknownVariableError);
  50321. return self;
  50322. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50323. },
  50324. args: [],
  50325. 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",
  50326. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50327. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50328. }),
  50329. $globals.AISemanticAnalyzerTest);
  50330. });
  50331. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50332. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50333. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50334. $core.addPackage("Kernel-Tests");
  50335. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50336. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50337. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50338. $core.addMethod(
  50339. $core.method({
  50340. selector: "testAddExtensionMethod",
  50341. protocol: "tests",
  50342. fn: function (){
  50343. var self=this,$self=this;
  50344. var method,dirty;
  50345. return $core.withContext(function($ctx1) {
  50346. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50347. $2=$self._class();
  50348. $ctx1.sendIdx["class"]=1;
  50349. $1=$recv($2)._package();
  50350. $ctx1.sendIdx["package"]=1;
  50351. dirty=$recv($1)._isDirty();
  50352. $ctx1.sendIdx["isDirty"]=1;
  50353. $4=$self._class();
  50354. $ctx1.sendIdx["class"]=2;
  50355. $3=$recv($4)._package();
  50356. $ctx1.sendIdx["package"]=2;
  50357. $recv($3)._beClean();
  50358. $5=$self._class();
  50359. $ctx1.sendIdx["class"]=3;
  50360. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50361. $8=$self._class();
  50362. $ctx1.sendIdx["class"]=4;
  50363. $7=$recv($8)._package();
  50364. $ctx1.sendIdx["package"]=3;
  50365. $6=$recv($7)._isDirty();
  50366. $self._deny_($6);
  50367. $9=$self._class();
  50368. $ctx1.sendIdx["class"]=5;
  50369. $recv($9)._removeCompiledMethod_(method);
  50370. $10=dirty;
  50371. if($core.assert($10)){
  50372. $recv($recv($self._class())._package())._beDirty();
  50373. }
  50374. return self;
  50375. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50376. },
  50377. args: [],
  50378. 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 ]",
  50379. referencedClasses: [],
  50380. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50381. }),
  50382. $globals.AnnouncementSubscriptionTest);
  50383. $core.addMethod(
  50384. $core.method({
  50385. selector: "testHandlesAnnouncement",
  50386. protocol: "tests",
  50387. fn: function (){
  50388. var self=this,$self=this;
  50389. var subscription,announcementClass1,announcementClass2,classBuilder;
  50390. return $core.withContext(function($ctx1) {
  50391. var $1,$2;
  50392. classBuilder=$recv($globals.ClassBuilder)._new();
  50393. $ctx1.sendIdx["new"]=1;
  50394. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50395. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50396. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50397. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50398. $self._assert_equals_($1,true);
  50399. $ctx1.sendIdx["assert:equals:"]=1;
  50400. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50401. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50402. $self._assert_equals_($2,true);
  50403. $ctx1.sendIdx["assert:equals:"]=2;
  50404. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50405. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50406. return self;
  50407. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50408. },
  50409. args: [],
  50410. 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.",
  50411. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50412. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50413. }),
  50414. $globals.AnnouncementSubscriptionTest);
  50415. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50416. $core.addMethod(
  50417. $core.method({
  50418. selector: "testOnDo",
  50419. protocol: "tests",
  50420. fn: function (){
  50421. var self=this,$self=this;
  50422. var counter,announcer;
  50423. return $core.withContext(function($ctx1) {
  50424. var $1,$2;
  50425. counter=(0);
  50426. announcer=$recv($globals.Announcer)._new();
  50427. $ctx1.sendIdx["new"]=1;
  50428. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50429. return $core.withContext(function($ctx2) {
  50430. counter=$recv(counter).__plus((1));
  50431. return counter;
  50432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50433. }));
  50434. $1=announcer;
  50435. $2=$recv($globals.SystemAnnouncement)._new();
  50436. $ctx1.sendIdx["new"]=2;
  50437. $recv($1)._announce_($2);
  50438. $ctx1.sendIdx["announce:"]=1;
  50439. $self._assert_equals_(counter,(1));
  50440. $ctx1.sendIdx["assert:equals:"]=1;
  50441. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50442. $self._assert_equals_(counter,(2));
  50443. return self;
  50444. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50445. },
  50446. args: [],
  50447. 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.",
  50448. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50449. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50450. }),
  50451. $globals.AnnouncerTest);
  50452. $core.addMethod(
  50453. $core.method({
  50454. selector: "testOnDoFor",
  50455. protocol: "tests",
  50456. fn: function (){
  50457. var self=this,$self=this;
  50458. var counter,announcer;
  50459. return $core.withContext(function($ctx1) {
  50460. var $1,$2,$3,$4;
  50461. counter=(0);
  50462. announcer=$recv($globals.Announcer)._new();
  50463. $ctx1.sendIdx["new"]=1;
  50464. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50465. return $core.withContext(function($ctx2) {
  50466. counter=$recv(counter).__plus((1));
  50467. return counter;
  50468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50469. }),self);
  50470. $1=announcer;
  50471. $2=$recv($globals.SystemAnnouncement)._new();
  50472. $ctx1.sendIdx["new"]=2;
  50473. $recv($1)._announce_($2);
  50474. $ctx1.sendIdx["announce:"]=1;
  50475. $self._assert_equals_(counter,(1));
  50476. $ctx1.sendIdx["assert:equals:"]=1;
  50477. $3=announcer;
  50478. $4=$recv($globals.SystemAnnouncement)._new();
  50479. $ctx1.sendIdx["new"]=3;
  50480. $recv($3)._announce_($4);
  50481. $ctx1.sendIdx["announce:"]=2;
  50482. $self._assert_equals_(counter,(2));
  50483. $ctx1.sendIdx["assert:equals:"]=2;
  50484. $recv(announcer)._unsubscribe_(self);
  50485. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50486. $self._assert_equals_(counter,(2));
  50487. return self;
  50488. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50489. },
  50490. args: [],
  50491. 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.",
  50492. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50493. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50494. }),
  50495. $globals.AnnouncerTest);
  50496. $core.addMethod(
  50497. $core.method({
  50498. selector: "testOnDoOnce",
  50499. protocol: "tests",
  50500. fn: function (){
  50501. var self=this,$self=this;
  50502. var counter,announcer;
  50503. return $core.withContext(function($ctx1) {
  50504. var $1,$2;
  50505. counter=(0);
  50506. announcer=$recv($globals.Announcer)._new();
  50507. $ctx1.sendIdx["new"]=1;
  50508. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50509. return $core.withContext(function($ctx2) {
  50510. counter=$recv(counter).__plus((1));
  50511. return counter;
  50512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50513. }));
  50514. $1=announcer;
  50515. $2=$recv($globals.SystemAnnouncement)._new();
  50516. $ctx1.sendIdx["new"]=2;
  50517. $recv($1)._announce_($2);
  50518. $ctx1.sendIdx["announce:"]=1;
  50519. $self._assert_equals_(counter,(1));
  50520. $ctx1.sendIdx["assert:equals:"]=1;
  50521. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50522. $self._assert_equals_(counter,(1));
  50523. return self;
  50524. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50525. },
  50526. args: [],
  50527. 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.",
  50528. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50529. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50530. }),
  50531. $globals.AnnouncerTest);
  50532. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50533. $core.addMethod(
  50534. $core.method({
  50535. selector: "localReturnOnDoCatch",
  50536. protocol: "fixture",
  50537. fn: function (){
  50538. var self=this,$self=this;
  50539. return $core.withContext(function($ctx1) {
  50540. var $early={};
  50541. try {
  50542. $recv((function(){
  50543. throw $early=[(2)];
  50544. }))._on_do_($globals.Error,(function(){
  50545. }));
  50546. return (3);
  50547. }
  50548. catch(e) {if(e===$early)return e[0]; throw e}
  50549. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50550. },
  50551. args: [],
  50552. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50553. referencedClasses: ["Error"],
  50554. messageSends: ["on:do:"]
  50555. }),
  50556. $globals.BlockClosureTest);
  50557. $core.addMethod(
  50558. $core.method({
  50559. selector: "localReturnOnDoMiss",
  50560. protocol: "fixture",
  50561. fn: function (){
  50562. var self=this,$self=this;
  50563. return $core.withContext(function($ctx1) {
  50564. var $early={};
  50565. try {
  50566. $recv((function(){
  50567. throw $early=[(2)];
  50568. }))._on_do_($globals.Class,(function(){
  50569. }));
  50570. return (3);
  50571. }
  50572. catch(e) {if(e===$early)return e[0]; throw e}
  50573. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50574. },
  50575. args: [],
  50576. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50577. referencedClasses: ["Class"],
  50578. messageSends: ["on:do:"]
  50579. }),
  50580. $globals.BlockClosureTest);
  50581. $core.addMethod(
  50582. $core.method({
  50583. selector: "testCanClearInterval",
  50584. protocol: "tests",
  50585. fn: function (){
  50586. var self=this,$self=this;
  50587. return $core.withContext(function($ctx1) {
  50588. $self._shouldnt_raise_((function(){
  50589. return $core.withContext(function($ctx2) {
  50590. return $recv($recv((function(){
  50591. return $core.withContext(function($ctx3) {
  50592. return $recv($recv($globals.Error)._new())._signal();
  50593. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50594. }))._valueWithInterval_((0)))._clearInterval();
  50595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50596. }),$globals.Error);
  50597. return self;
  50598. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50599. },
  50600. args: [],
  50601. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50602. referencedClasses: ["Error"],
  50603. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50604. }),
  50605. $globals.BlockClosureTest);
  50606. $core.addMethod(
  50607. $core.method({
  50608. selector: "testCanClearTimeout",
  50609. protocol: "tests",
  50610. fn: function (){
  50611. var self=this,$self=this;
  50612. return $core.withContext(function($ctx1) {
  50613. $self._shouldnt_raise_((function(){
  50614. return $core.withContext(function($ctx2) {
  50615. return $recv($recv((function(){
  50616. return $core.withContext(function($ctx3) {
  50617. return $recv($recv($globals.Error)._new())._signal();
  50618. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50619. }))._valueWithTimeout_((0)))._clearTimeout();
  50620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50621. }),$globals.Error);
  50622. return self;
  50623. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50624. },
  50625. args: [],
  50626. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50627. referencedClasses: ["Error"],
  50628. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50629. }),
  50630. $globals.BlockClosureTest);
  50631. $core.addMethod(
  50632. $core.method({
  50633. selector: "testCompiledSource",
  50634. protocol: "tests",
  50635. fn: function (){
  50636. var self=this,$self=this;
  50637. return $core.withContext(function($ctx1) {
  50638. $self._assert_($recv($recv((function(){
  50639. return $core.withContext(function($ctx2) {
  50640. return (1).__plus((1));
  50641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50642. }))._compiledSource())._includesSubString_("function"));
  50643. return self;
  50644. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50645. },
  50646. args: [],
  50647. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50648. referencedClasses: [],
  50649. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50650. }),
  50651. $globals.BlockClosureTest);
  50652. $core.addMethod(
  50653. $core.method({
  50654. selector: "testCurrySelf",
  50655. protocol: "tests",
  50656. fn: function (){
  50657. var self=this,$self=this;
  50658. var curriedMethod,array;
  50659. return $core.withContext(function($ctx1) {
  50660. curriedMethod=$recv($recv((function(selfarg,x){
  50661. return $core.withContext(function($ctx2) {
  50662. return $recv(selfarg)._at_(x);
  50663. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50664. }))._currySelf())._asCompiledMethod_("foo:");
  50665. array=[(3), (1), (4)];
  50666. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50667. $recv((function(){
  50668. return $core.withContext(function($ctx2) {
  50669. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50671. }))._ensure_((function(){
  50672. return $core.withContext(function($ctx2) {
  50673. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50675. }));
  50676. return self;
  50677. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50678. },
  50679. args: [],
  50680. 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 ]",
  50681. referencedClasses: ["ClassBuilder", "Array"],
  50682. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50683. }),
  50684. $globals.BlockClosureTest);
  50685. $core.addMethod(
  50686. $core.method({
  50687. selector: "testEnsure",
  50688. protocol: "tests",
  50689. fn: function (){
  50690. var self=this,$self=this;
  50691. return $core.withContext(function($ctx1) {
  50692. $self._assert_equals_($recv((function(){
  50693. return (3);
  50694. }))._ensure_((function(){
  50695. return (4);
  50696. })),(3));
  50697. return self;
  50698. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50699. },
  50700. args: [],
  50701. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50702. referencedClasses: [],
  50703. messageSends: ["assert:equals:", "ensure:"]
  50704. }),
  50705. $globals.BlockClosureTest);
  50706. $core.addMethod(
  50707. $core.method({
  50708. selector: "testEnsureRaises",
  50709. protocol: "tests",
  50710. fn: function (){
  50711. var self=this,$self=this;
  50712. return $core.withContext(function($ctx1) {
  50713. $self._should_raise_((function(){
  50714. return $core.withContext(function($ctx2) {
  50715. return $recv((function(){
  50716. return $core.withContext(function($ctx3) {
  50717. return $recv($recv($globals.Error)._new())._signal();
  50718. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50719. }))._ensure_((function(){
  50720. return true;
  50721. }));
  50722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50723. }),$globals.Error);
  50724. return self;
  50725. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  50726. },
  50727. args: [],
  50728. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50729. referencedClasses: ["Error"],
  50730. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50731. }),
  50732. $globals.BlockClosureTest);
  50733. $core.addMethod(
  50734. $core.method({
  50735. selector: "testExceptionSemantics",
  50736. protocol: "tests",
  50737. fn: function (){
  50738. var self=this,$self=this;
  50739. return $core.withContext(function($ctx1) {
  50740. $self._timeout_((100));
  50741. $recv($self._async_((function(){
  50742. return $core.withContext(function($ctx2) {
  50743. return $recv((function(){
  50744. return $core.withContext(function($ctx3) {
  50745. $self._assert_(true);
  50746. $recv($globals.Error)._signal();
  50747. $self._deny_(true);
  50748. return $self._finished();
  50749. $ctx3.sendIdx["finished"]=1;
  50750. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50751. }))._on_do_($globals.Error,(function(ex){
  50752. return $core.withContext(function($ctx3) {
  50753. return $self._finished();
  50754. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50755. }));
  50756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50757. })))._valueWithTimeout_((0));
  50758. return self;
  50759. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  50760. },
  50761. args: [],
  50762. 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",
  50763. referencedClasses: ["Error"],
  50764. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  50765. }),
  50766. $globals.BlockClosureTest);
  50767. $core.addMethod(
  50768. $core.method({
  50769. selector: "testLocalReturnOnDoCatch",
  50770. protocol: "tests",
  50771. fn: function (){
  50772. var self=this,$self=this;
  50773. return $core.withContext(function($ctx1) {
  50774. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  50775. return self;
  50776. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50777. },
  50778. args: [],
  50779. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  50780. referencedClasses: [],
  50781. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  50782. }),
  50783. $globals.BlockClosureTest);
  50784. $core.addMethod(
  50785. $core.method({
  50786. selector: "testLocalReturnOnDoMiss",
  50787. protocol: "tests",
  50788. fn: function (){
  50789. var self=this,$self=this;
  50790. return $core.withContext(function($ctx1) {
  50791. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  50792. return self;
  50793. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50794. },
  50795. args: [],
  50796. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  50797. referencedClasses: [],
  50798. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  50799. }),
  50800. $globals.BlockClosureTest);
  50801. $core.addMethod(
  50802. $core.method({
  50803. selector: "testNewWithValues",
  50804. protocol: "tests",
  50805. fn: function (){
  50806. var self=this,$self=this;
  50807. return $core.withContext(function($ctx1) {
  50808. function TestConstructor(arg1, arg2, arg3) {}
  50809. TestConstructor.prototype.name = "theTestPrototype";
  50810. var wrappedConstructor = $recv(TestConstructor);
  50811. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  50812. $self._assert_(result instanceof TestConstructor);
  50813. $self._assert_equals_(result.name, "theTestPrototype");
  50814. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  50815. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  50816. return self;
  50817. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  50818. },
  50819. args: [],
  50820. 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'>",
  50821. referencedClasses: [],
  50822. messageSends: []
  50823. }),
  50824. $globals.BlockClosureTest);
  50825. $core.addMethod(
  50826. $core.method({
  50827. selector: "testNumArgs",
  50828. protocol: "tests",
  50829. fn: function (){
  50830. var self=this,$self=this;
  50831. return $core.withContext(function($ctx1) {
  50832. var $1;
  50833. $1=$recv((function(){
  50834. }))._numArgs();
  50835. $ctx1.sendIdx["numArgs"]=1;
  50836. $self._assert_equals_($1,(0));
  50837. $ctx1.sendIdx["assert:equals:"]=1;
  50838. $self._assert_equals_($recv((function(a,b){
  50839. }))._numArgs(),(2));
  50840. return self;
  50841. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  50842. },
  50843. args: [],
  50844. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  50845. referencedClasses: [],
  50846. messageSends: ["assert:equals:", "numArgs"]
  50847. }),
  50848. $globals.BlockClosureTest);
  50849. $core.addMethod(
  50850. $core.method({
  50851. selector: "testOnDo",
  50852. protocol: "tests",
  50853. fn: function (){
  50854. var self=this,$self=this;
  50855. return $core.withContext(function($ctx1) {
  50856. $self._assert_($recv((function(){
  50857. return $core.withContext(function($ctx2) {
  50858. return $recv($recv($globals.Error)._new())._signal();
  50859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50860. }))._on_do_($globals.Error,(function(ex){
  50861. return true;
  50862. })));
  50863. return self;
  50864. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  50865. },
  50866. args: [],
  50867. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  50868. referencedClasses: ["Error"],
  50869. messageSends: ["assert:", "on:do:", "signal", "new"]
  50870. }),
  50871. $globals.BlockClosureTest);
  50872. $core.addMethod(
  50873. $core.method({
  50874. selector: "testValue",
  50875. protocol: "tests",
  50876. fn: function (){
  50877. var self=this,$self=this;
  50878. return $core.withContext(function($ctx1) {
  50879. var $1;
  50880. $1=$recv((function(){
  50881. return $core.withContext(function($ctx2) {
  50882. return (1).__plus((1));
  50883. $ctx2.sendIdx["+"]=1;
  50884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50885. }))._value();
  50886. $ctx1.sendIdx["value"]=1;
  50887. $self._assert_equals_($1,(2));
  50888. $ctx1.sendIdx["assert:equals:"]=1;
  50889. $self._assert_equals_($recv((function(x){
  50890. return $core.withContext(function($ctx2) {
  50891. return $recv(x).__plus((1));
  50892. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  50893. }))._value_((2)),(3));
  50894. $ctx1.sendIdx["assert:equals:"]=2;
  50895. $self._assert_equals_($recv((function(x,y){
  50896. return $core.withContext(function($ctx2) {
  50897. return $recv(x).__star(y);
  50898. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  50899. }))._value_value_((2),(4)),(8));
  50900. $ctx1.sendIdx["assert:equals:"]=3;
  50901. $self._assert_equals_($recv((function(a,b,c){
  50902. return (1);
  50903. }))._value(),(1));
  50904. return self;
  50905. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  50906. },
  50907. args: [],
  50908. 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",
  50909. referencedClasses: [],
  50910. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  50911. }),
  50912. $globals.BlockClosureTest);
  50913. $core.addMethod(
  50914. $core.method({
  50915. selector: "testValueWithPossibleArguments",
  50916. protocol: "tests",
  50917. fn: function (){
  50918. var self=this,$self=this;
  50919. return $core.withContext(function($ctx1) {
  50920. var $1,$2;
  50921. $1=$recv((function(){
  50922. return (1);
  50923. }))._valueWithPossibleArguments_([(3), (4)]);
  50924. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  50925. $self._assert_equals_($1,(1));
  50926. $ctx1.sendIdx["assert:equals:"]=1;
  50927. $2=$recv((function(a){
  50928. return $core.withContext(function($ctx2) {
  50929. return $recv(a).__plus((4));
  50930. $ctx2.sendIdx["+"]=1;
  50931. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  50932. }))._valueWithPossibleArguments_([(3), (4)]);
  50933. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  50934. $self._assert_equals_($2,(7));
  50935. $ctx1.sendIdx["assert:equals:"]=2;
  50936. $self._assert_equals_($recv((function(a,b){
  50937. return $core.withContext(function($ctx2) {
  50938. return $recv(a).__plus(b);
  50939. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  50940. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  50941. return self;
  50942. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  50943. },
  50944. args: [],
  50945. 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.",
  50946. referencedClasses: [],
  50947. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  50948. }),
  50949. $globals.BlockClosureTest);
  50950. $core.addMethod(
  50951. $core.method({
  50952. selector: "testWhileFalse",
  50953. protocol: "tests",
  50954. fn: function (){
  50955. var self=this,$self=this;
  50956. var i;
  50957. return $core.withContext(function($ctx1) {
  50958. i=(0);
  50959. $recv((function(){
  50960. return $core.withContext(function($ctx2) {
  50961. return $recv(i).__gt((5));
  50962. $ctx2.sendIdx[">"]=1;
  50963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50964. }))._whileFalse_((function(){
  50965. return $core.withContext(function($ctx2) {
  50966. i=$recv(i).__plus((1));
  50967. $ctx2.sendIdx["+"]=1;
  50968. return i;
  50969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50970. }));
  50971. $self._assert_equals_(i,(6));
  50972. $ctx1.sendIdx["assert:equals:"]=1;
  50973. i=(0);
  50974. $recv((function(){
  50975. return $core.withContext(function($ctx2) {
  50976. i=$recv(i).__plus((1));
  50977. i;
  50978. return $recv(i).__gt((5));
  50979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50980. }))._whileFalse();
  50981. $self._assert_equals_(i,(6));
  50982. return self;
  50983. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  50984. },
  50985. args: [],
  50986. 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",
  50987. referencedClasses: [],
  50988. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  50989. }),
  50990. $globals.BlockClosureTest);
  50991. $core.addMethod(
  50992. $core.method({
  50993. selector: "testWhileTrue",
  50994. protocol: "tests",
  50995. fn: function (){
  50996. var self=this,$self=this;
  50997. var i;
  50998. return $core.withContext(function($ctx1) {
  50999. i=(0);
  51000. $recv((function(){
  51001. return $core.withContext(function($ctx2) {
  51002. return $recv(i).__lt((5));
  51003. $ctx2.sendIdx["<"]=1;
  51004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51005. }))._whileTrue_((function(){
  51006. return $core.withContext(function($ctx2) {
  51007. i=$recv(i).__plus((1));
  51008. $ctx2.sendIdx["+"]=1;
  51009. return i;
  51010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51011. }));
  51012. $self._assert_equals_(i,(5));
  51013. $ctx1.sendIdx["assert:equals:"]=1;
  51014. i=(0);
  51015. $recv((function(){
  51016. return $core.withContext(function($ctx2) {
  51017. i=$recv(i).__plus((1));
  51018. i;
  51019. return $recv(i).__lt((5));
  51020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51021. }))._whileTrue();
  51022. $self._assert_equals_(i,(5));
  51023. return self;
  51024. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51025. },
  51026. args: [],
  51027. 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",
  51028. referencedClasses: [],
  51029. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51030. }),
  51031. $globals.BlockClosureTest);
  51032. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51033. $core.addMethod(
  51034. $core.method({
  51035. selector: "testEquality",
  51036. protocol: "tests",
  51037. fn: function (){
  51038. var self=this,$self=this;
  51039. return $core.withContext(function($ctx1) {
  51040. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51041. $1=(0).__eq(false);
  51042. $ctx1.sendIdx["="]=1;
  51043. $self._deny_($1);
  51044. $ctx1.sendIdx["deny:"]=1;
  51045. $2=false.__eq((0));
  51046. $ctx1.sendIdx["="]=2;
  51047. $self._deny_($2);
  51048. $ctx1.sendIdx["deny:"]=2;
  51049. $3="".__eq(false);
  51050. $ctx1.sendIdx["="]=3;
  51051. $self._deny_($3);
  51052. $ctx1.sendIdx["deny:"]=3;
  51053. $4=false.__eq("");
  51054. $ctx1.sendIdx["="]=4;
  51055. $self._deny_($4);
  51056. $ctx1.sendIdx["deny:"]=4;
  51057. $5=true.__eq(true);
  51058. $ctx1.sendIdx["="]=5;
  51059. $self._assert_($5);
  51060. $ctx1.sendIdx["assert:"]=1;
  51061. $6=false.__eq(true);
  51062. $ctx1.sendIdx["="]=6;
  51063. $self._deny_($6);
  51064. $ctx1.sendIdx["deny:"]=5;
  51065. $7=true.__eq(false);
  51066. $ctx1.sendIdx["="]=7;
  51067. $self._deny_($7);
  51068. $8=false.__eq(false);
  51069. $ctx1.sendIdx["="]=8;
  51070. $self._assert_($8);
  51071. $ctx1.sendIdx["assert:"]=2;
  51072. $10=true._yourself();
  51073. $ctx1.sendIdx["yourself"]=1;
  51074. $9=$recv($10).__eq(true);
  51075. $ctx1.sendIdx["="]=9;
  51076. $self._assert_($9);
  51077. $ctx1.sendIdx["assert:"]=3;
  51078. $12=true._yourself();
  51079. $ctx1.sendIdx["yourself"]=2;
  51080. $11=$recv($12).__eq(true._yourself());
  51081. $self._assert_($11);
  51082. return self;
  51083. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51084. },
  51085. args: [],
  51086. 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)",
  51087. referencedClasses: [],
  51088. messageSends: ["deny:", "=", "assert:", "yourself"]
  51089. }),
  51090. $globals.BooleanTest);
  51091. $core.addMethod(
  51092. $core.method({
  51093. selector: "testIdentity",
  51094. protocol: "tests",
  51095. fn: function (){
  51096. var self=this,$self=this;
  51097. return $core.withContext(function($ctx1) {
  51098. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51099. $1=(0).__eq_eq(false);
  51100. $ctx1.sendIdx["=="]=1;
  51101. $self._deny_($1);
  51102. $ctx1.sendIdx["deny:"]=1;
  51103. $2=false.__eq_eq((0));
  51104. $ctx1.sendIdx["=="]=2;
  51105. $self._deny_($2);
  51106. $ctx1.sendIdx["deny:"]=2;
  51107. $3="".__eq_eq(false);
  51108. $ctx1.sendIdx["=="]=3;
  51109. $self._deny_($3);
  51110. $ctx1.sendIdx["deny:"]=3;
  51111. $4=false.__eq_eq("");
  51112. $ctx1.sendIdx["=="]=4;
  51113. $self._deny_($4);
  51114. $ctx1.sendIdx["deny:"]=4;
  51115. $5=true.__eq_eq(true);
  51116. $ctx1.sendIdx["=="]=5;
  51117. $self._assert_($5);
  51118. $ctx1.sendIdx["assert:"]=1;
  51119. $6=false.__eq_eq(true);
  51120. $ctx1.sendIdx["=="]=6;
  51121. $self._deny_($6);
  51122. $ctx1.sendIdx["deny:"]=5;
  51123. $7=true.__eq_eq(false);
  51124. $ctx1.sendIdx["=="]=7;
  51125. $self._deny_($7);
  51126. $8=false.__eq_eq(false);
  51127. $ctx1.sendIdx["=="]=8;
  51128. $self._assert_($8);
  51129. $ctx1.sendIdx["assert:"]=2;
  51130. $10=true._yourself();
  51131. $ctx1.sendIdx["yourself"]=1;
  51132. $9=$recv($10).__eq_eq(true);
  51133. $ctx1.sendIdx["=="]=9;
  51134. $self._assert_($9);
  51135. $ctx1.sendIdx["assert:"]=3;
  51136. $12=true._yourself();
  51137. $ctx1.sendIdx["yourself"]=2;
  51138. $11=$recv($12).__eq_eq(true._yourself());
  51139. $self._assert_($11);
  51140. return self;
  51141. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51142. },
  51143. args: [],
  51144. 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",
  51145. referencedClasses: [],
  51146. messageSends: ["deny:", "==", "assert:", "yourself"]
  51147. }),
  51148. $globals.BooleanTest);
  51149. $core.addMethod(
  51150. $core.method({
  51151. selector: "testIfTrueIfFalse",
  51152. protocol: "tests",
  51153. fn: function (){
  51154. var self=this,$self=this;
  51155. return $core.withContext(function($ctx1) {
  51156. var $1,$2,$3,$4,$5,$6,$7,$8;
  51157. if($core.assert(true)){
  51158. $1="alternative block";
  51159. }
  51160. $self._assert_equals_($1,"alternative block");
  51161. $ctx1.sendIdx["assert:equals:"]=1;
  51162. if(!$core.assert(true)){
  51163. $2="alternative block";
  51164. }
  51165. $self._assert_equals_($2,nil);
  51166. $ctx1.sendIdx["assert:equals:"]=2;
  51167. if($core.assert(false)){
  51168. $3="alternative block";
  51169. }
  51170. $self._assert_equals_($3,nil);
  51171. $ctx1.sendIdx["assert:equals:"]=3;
  51172. if(!$core.assert(false)){
  51173. $4="alternative block";
  51174. }
  51175. $self._assert_equals_($4,"alternative block");
  51176. $ctx1.sendIdx["assert:equals:"]=4;
  51177. if($core.assert(false)){
  51178. $5="alternative block";
  51179. } else {
  51180. $5="alternative block2";
  51181. }
  51182. $self._assert_equals_($5,"alternative block2");
  51183. $ctx1.sendIdx["assert:equals:"]=5;
  51184. if($core.assert(false)){
  51185. $6="alternative block2";
  51186. } else {
  51187. $6="alternative block";
  51188. }
  51189. $self._assert_equals_($6,"alternative block");
  51190. $ctx1.sendIdx["assert:equals:"]=6;
  51191. if($core.assert(true)){
  51192. $7="alternative block";
  51193. } else {
  51194. $7="alternative block2";
  51195. }
  51196. $self._assert_equals_($7,"alternative block");
  51197. $ctx1.sendIdx["assert:equals:"]=7;
  51198. if($core.assert(true)){
  51199. $8="alternative block2";
  51200. } else {
  51201. $8="alternative block";
  51202. }
  51203. $self._assert_equals_($8,"alternative block2");
  51204. return self;
  51205. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51206. },
  51207. args: [],
  51208. 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'.",
  51209. referencedClasses: [],
  51210. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51211. }),
  51212. $globals.BooleanTest);
  51213. $core.addMethod(
  51214. $core.method({
  51215. selector: "testIfTrueIfFalseWithBoxing",
  51216. protocol: "tests",
  51217. fn: function (){
  51218. var self=this,$self=this;
  51219. return $core.withContext(function($ctx1) {
  51220. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51221. $2=true._yourself();
  51222. $ctx1.sendIdx["yourself"]=1;
  51223. if($core.assert($2)){
  51224. $1="alternative block";
  51225. }
  51226. $self._assert_equals_($1,"alternative block");
  51227. $ctx1.sendIdx["assert:equals:"]=1;
  51228. $4=true._yourself();
  51229. $ctx1.sendIdx["yourself"]=2;
  51230. if(!$core.assert($4)){
  51231. $3="alternative block";
  51232. }
  51233. $self._assert_equals_($3,nil);
  51234. $ctx1.sendIdx["assert:equals:"]=2;
  51235. $6=false._yourself();
  51236. $ctx1.sendIdx["yourself"]=3;
  51237. if($core.assert($6)){
  51238. $5="alternative block";
  51239. }
  51240. $self._assert_equals_($5,nil);
  51241. $ctx1.sendIdx["assert:equals:"]=3;
  51242. $8=false._yourself();
  51243. $ctx1.sendIdx["yourself"]=4;
  51244. if(!$core.assert($8)){
  51245. $7="alternative block";
  51246. }
  51247. $self._assert_equals_($7,"alternative block");
  51248. $ctx1.sendIdx["assert:equals:"]=4;
  51249. $10=false._yourself();
  51250. $ctx1.sendIdx["yourself"]=5;
  51251. if($core.assert($10)){
  51252. $9="alternative block";
  51253. } else {
  51254. $9="alternative block2";
  51255. }
  51256. $self._assert_equals_($9,"alternative block2");
  51257. $ctx1.sendIdx["assert:equals:"]=5;
  51258. $12=false._yourself();
  51259. $ctx1.sendIdx["yourself"]=6;
  51260. if($core.assert($12)){
  51261. $11="alternative block2";
  51262. } else {
  51263. $11="alternative block";
  51264. }
  51265. $self._assert_equals_($11,"alternative block");
  51266. $ctx1.sendIdx["assert:equals:"]=6;
  51267. $14=true._yourself();
  51268. $ctx1.sendIdx["yourself"]=7;
  51269. if($core.assert($14)){
  51270. $13="alternative block";
  51271. } else {
  51272. $13="alternative block2";
  51273. }
  51274. $self._assert_equals_($13,"alternative block");
  51275. $ctx1.sendIdx["assert:equals:"]=7;
  51276. $16=true._yourself();
  51277. if($core.assert($16)){
  51278. $15="alternative block2";
  51279. } else {
  51280. $15="alternative block";
  51281. }
  51282. $self._assert_equals_($15,"alternative block2");
  51283. return self;
  51284. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51285. },
  51286. args: [],
  51287. 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'.",
  51288. referencedClasses: [],
  51289. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51290. }),
  51291. $globals.BooleanTest);
  51292. $core.addMethod(
  51293. $core.method({
  51294. selector: "testLogic",
  51295. protocol: "tests",
  51296. fn: function (){
  51297. var self=this,$self=this;
  51298. return $core.withContext(function($ctx1) {
  51299. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51300. $1=true.__and(true);
  51301. $ctx1.sendIdx["&"]=1;
  51302. $self._assert_($1);
  51303. $ctx1.sendIdx["assert:"]=1;
  51304. $2=true.__and(false);
  51305. $ctx1.sendIdx["&"]=2;
  51306. $self._deny_($2);
  51307. $ctx1.sendIdx["deny:"]=1;
  51308. $3=false.__and(true);
  51309. $ctx1.sendIdx["&"]=3;
  51310. $self._deny_($3);
  51311. $ctx1.sendIdx["deny:"]=2;
  51312. $5=false.__and(false);
  51313. $ctx1.sendIdx["&"]=4;
  51314. $4=$self._deny_($5);
  51315. $ctx1.sendIdx["deny:"]=3;
  51316. $6=true.__or(true);
  51317. $ctx1.sendIdx["|"]=1;
  51318. $self._assert_($6);
  51319. $ctx1.sendIdx["assert:"]=2;
  51320. $7=true.__or(false);
  51321. $ctx1.sendIdx["|"]=2;
  51322. $self._assert_($7);
  51323. $ctx1.sendIdx["assert:"]=3;
  51324. $8=false.__or(true);
  51325. $ctx1.sendIdx["|"]=3;
  51326. $self._assert_($8);
  51327. $ctx1.sendIdx["assert:"]=4;
  51328. $10=false.__or(false);
  51329. $ctx1.sendIdx["|"]=4;
  51330. $9=$self._deny_($10);
  51331. $ctx1.sendIdx["deny:"]=4;
  51332. $12=(1).__gt((0));
  51333. $ctx1.sendIdx[">"]=1;
  51334. $11=true.__and($12);
  51335. $ctx1.sendIdx["&"]=5;
  51336. $self._assert_($11);
  51337. $ctx1.sendIdx["assert:"]=5;
  51338. $14=(1).__gt((0));
  51339. $ctx1.sendIdx[">"]=2;
  51340. $13=$recv($14).__and(false);
  51341. $ctx1.sendIdx["&"]=6;
  51342. $self._deny_($13);
  51343. $ctx1.sendIdx["deny:"]=5;
  51344. $16=(1).__gt((0));
  51345. $ctx1.sendIdx[">"]=3;
  51346. $17=(1).__gt((2));
  51347. $ctx1.sendIdx[">"]=4;
  51348. $15=$recv($16).__and($17);
  51349. $self._deny_($15);
  51350. $19=(1).__gt((0));
  51351. $ctx1.sendIdx[">"]=5;
  51352. $18=false.__or($19);
  51353. $ctx1.sendIdx["|"]=5;
  51354. $self._assert_($18);
  51355. $ctx1.sendIdx["assert:"]=6;
  51356. $21=(1).__gt((0));
  51357. $ctx1.sendIdx[">"]=6;
  51358. $20=$recv($21).__or(false);
  51359. $ctx1.sendIdx["|"]=6;
  51360. $self._assert_($20);
  51361. $ctx1.sendIdx["assert:"]=7;
  51362. $23=(1).__gt((0));
  51363. $ctx1.sendIdx[">"]=7;
  51364. $22=$recv($23).__or((1).__gt((2)));
  51365. $self._assert_($22);
  51366. return self;
  51367. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51368. },
  51369. args: [],
  51370. 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))",
  51371. referencedClasses: [],
  51372. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51373. }),
  51374. $globals.BooleanTest);
  51375. $core.addMethod(
  51376. $core.method({
  51377. selector: "testLogicKeywords",
  51378. protocol: "tests",
  51379. fn: function (){
  51380. var self=this,$self=this;
  51381. return $core.withContext(function($ctx1) {
  51382. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51383. $1=true._and_((function(){
  51384. return true;
  51385. }));
  51386. $ctx1.sendIdx["and:"]=1;
  51387. $self._assert_($1);
  51388. $ctx1.sendIdx["assert:"]=1;
  51389. $2=true._and_((function(){
  51390. return false;
  51391. }));
  51392. $ctx1.sendIdx["and:"]=2;
  51393. $self._deny_($2);
  51394. $ctx1.sendIdx["deny:"]=1;
  51395. $3=false._and_((function(){
  51396. return true;
  51397. }));
  51398. $ctx1.sendIdx["and:"]=3;
  51399. $self._deny_($3);
  51400. $ctx1.sendIdx["deny:"]=2;
  51401. $5=false._and_((function(){
  51402. return false;
  51403. }));
  51404. $ctx1.sendIdx["and:"]=4;
  51405. $4=$self._deny_($5);
  51406. $ctx1.sendIdx["deny:"]=3;
  51407. $6=true._or_((function(){
  51408. return true;
  51409. }));
  51410. $ctx1.sendIdx["or:"]=1;
  51411. $self._assert_($6);
  51412. $ctx1.sendIdx["assert:"]=2;
  51413. $7=true._or_((function(){
  51414. return false;
  51415. }));
  51416. $ctx1.sendIdx["or:"]=2;
  51417. $self._assert_($7);
  51418. $ctx1.sendIdx["assert:"]=3;
  51419. $8=false._or_((function(){
  51420. return true;
  51421. }));
  51422. $ctx1.sendIdx["or:"]=3;
  51423. $self._assert_($8);
  51424. $ctx1.sendIdx["assert:"]=4;
  51425. $10=false._or_((function(){
  51426. return false;
  51427. }));
  51428. $ctx1.sendIdx["or:"]=4;
  51429. $9=$self._deny_($10);
  51430. $ctx1.sendIdx["deny:"]=4;
  51431. $11=true._and_((function(){
  51432. return $core.withContext(function($ctx2) {
  51433. return (1).__gt((0));
  51434. $ctx2.sendIdx[">"]=1;
  51435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51436. }));
  51437. $ctx1.sendIdx["and:"]=5;
  51438. $self._assert_($11);
  51439. $ctx1.sendIdx["assert:"]=5;
  51440. $13=(1).__gt((0));
  51441. $ctx1.sendIdx[">"]=2;
  51442. $12=$recv($13)._and_((function(){
  51443. return false;
  51444. }));
  51445. $ctx1.sendIdx["and:"]=6;
  51446. $self._deny_($12);
  51447. $ctx1.sendIdx["deny:"]=5;
  51448. $15=(1).__gt((0));
  51449. $ctx1.sendIdx[">"]=3;
  51450. $14=$recv($15)._and_((function(){
  51451. return $core.withContext(function($ctx2) {
  51452. return (1).__gt((2));
  51453. $ctx2.sendIdx[">"]=4;
  51454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51455. }));
  51456. $self._deny_($14);
  51457. $16=false._or_((function(){
  51458. return $core.withContext(function($ctx2) {
  51459. return (1).__gt((0));
  51460. $ctx2.sendIdx[">"]=5;
  51461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51462. }));
  51463. $ctx1.sendIdx["or:"]=5;
  51464. $self._assert_($16);
  51465. $ctx1.sendIdx["assert:"]=6;
  51466. $18=(1).__gt((0));
  51467. $ctx1.sendIdx[">"]=6;
  51468. $17=$recv($18)._or_((function(){
  51469. return false;
  51470. }));
  51471. $ctx1.sendIdx["or:"]=6;
  51472. $self._assert_($17);
  51473. $ctx1.sendIdx["assert:"]=7;
  51474. $20=(1).__gt((0));
  51475. $ctx1.sendIdx[">"]=7;
  51476. $19=$recv($20)._or_((function(){
  51477. return $core.withContext(function($ctx2) {
  51478. return (1).__gt((2));
  51479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51480. }));
  51481. $self._assert_($19);
  51482. return self;
  51483. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51484. },
  51485. args: [],
  51486. 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 ])",
  51487. referencedClasses: [],
  51488. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51489. }),
  51490. $globals.BooleanTest);
  51491. $core.addMethod(
  51492. $core.method({
  51493. selector: "testNonBooleanError",
  51494. protocol: "tests",
  51495. fn: function (){
  51496. var self=this,$self=this;
  51497. return $core.withContext(function($ctx1) {
  51498. $self._should_raise_((function(){
  51499. return $core.withContext(function($ctx2) {
  51500. if($core.assert("")){
  51501. } else {
  51502. }
  51503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51504. }),$globals.NonBooleanReceiver);
  51505. return self;
  51506. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51507. },
  51508. args: [],
  51509. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51510. referencedClasses: ["NonBooleanReceiver"],
  51511. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51512. }),
  51513. $globals.BooleanTest);
  51514. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51515. $core.addMethod(
  51516. $core.method({
  51517. selector: "setUp",
  51518. protocol: "running",
  51519. fn: function (){
  51520. var self=this,$self=this;
  51521. return $core.withContext(function($ctx1) {
  51522. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51523. return self;
  51524. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51525. },
  51526. args: [],
  51527. source: "setUp\x0a\x09builder := ClassBuilder new",
  51528. referencedClasses: ["ClassBuilder"],
  51529. messageSends: ["new"]
  51530. }),
  51531. $globals.ClassBuilderTest);
  51532. $core.addMethod(
  51533. $core.method({
  51534. selector: "tearDown",
  51535. protocol: "running",
  51536. fn: function (){
  51537. var self=this,$self=this;
  51538. return $core.withContext(function($ctx1) {
  51539. var $1,$receiver;
  51540. $1=$self["@theClass"];
  51541. if(($receiver = $1) == null || $receiver.a$nil){
  51542. $1;
  51543. } else {
  51544. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51545. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51546. $self["@theClass"]=nil;
  51547. $self["@theClass"];
  51548. }
  51549. return self;
  51550. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51551. },
  51552. args: [],
  51553. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51554. referencedClasses: ["Smalltalk"],
  51555. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51556. }),
  51557. $globals.ClassBuilderTest);
  51558. $core.addMethod(
  51559. $core.method({
  51560. selector: "testAddTrait",
  51561. protocol: "tests",
  51562. fn: function (){
  51563. var self=this,$self=this;
  51564. return $core.withContext(function($ctx1) {
  51565. var $3,$2,$1,$4;
  51566. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51567. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51568. $ctx1.sendIdx["assert:equals:"]=1;
  51569. $3=$recv($self["@theClass"])._package();
  51570. $ctx1.sendIdx["package"]=1;
  51571. $2=$recv($3)._classes();
  51572. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51573. $self._assert_equals_($1,(1));
  51574. $ctx1.sendIdx["assert:equals:"]=2;
  51575. $4=$recv($self["@theClass"])._package();
  51576. $ctx1.sendIdx["package"]=2;
  51577. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51578. return self;
  51579. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51580. },
  51581. args: [],
  51582. 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",
  51583. referencedClasses: ["ObjectMock"],
  51584. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51585. }),
  51586. $globals.ClassBuilderTest);
  51587. $core.addMethod(
  51588. $core.method({
  51589. selector: "testClassCopy",
  51590. protocol: "tests",
  51591. fn: function (){
  51592. var self=this,$self=this;
  51593. return $core.withContext(function($ctx1) {
  51594. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51595. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51596. $2=$recv($self["@theClass"])._superclass();
  51597. $ctx1.sendIdx["superclass"]=1;
  51598. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51599. $ctx1.sendIdx["=="]=1;
  51600. $self._assert_($1);
  51601. $ctx1.sendIdx["assert:"]=1;
  51602. $4=$recv($self["@theClass"])._instanceVariableNames();
  51603. $ctx1.sendIdx["instanceVariableNames"]=1;
  51604. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51605. $ctx1.sendIdx["=="]=2;
  51606. $self._assert_($3);
  51607. $ctx1.sendIdx["assert:"]=2;
  51608. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51609. $ctx1.sendIdx["assert:equals:"]=1;
  51610. $6=$recv($self["@theClass"])._package();
  51611. $ctx1.sendIdx["package"]=1;
  51612. $7=$recv($globals.ObjectMock)._package();
  51613. $ctx1.sendIdx["package"]=2;
  51614. $5=$recv($6).__eq_eq($7);
  51615. $self._assert_($5);
  51616. $ctx1.sendIdx["assert:"]=3;
  51617. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51618. $9=$recv($self["@theClass"])._methodDictionary();
  51619. $ctx1.sendIdx["methodDictionary"]=1;
  51620. $8=$recv($9)._keys();
  51621. $ctx1.sendIdx["keys"]=1;
  51622. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51623. return self;
  51624. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51625. },
  51626. args: [],
  51627. 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",
  51628. referencedClasses: ["ObjectMock"],
  51629. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51630. }),
  51631. $globals.ClassBuilderTest);
  51632. $core.addMethod(
  51633. $core.method({
  51634. selector: "testClassMigration",
  51635. protocol: "tests",
  51636. fn: function (){
  51637. var self=this,$self=this;
  51638. var instance,oldClass;
  51639. return $core.withContext(function($ctx1) {
  51640. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51641. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51642. $2=$recv($globals.Smalltalk)._globals();
  51643. $ctx1.sendIdx["globals"]=1;
  51644. $1=$recv($2)._at_("ObjectMock2");
  51645. $ctx1.sendIdx["at:"]=1;
  51646. instance=$recv($1)._new();
  51647. $4=$recv($globals.Smalltalk)._globals();
  51648. $ctx1.sendIdx["globals"]=2;
  51649. $3=$recv($4)._at_("ObjectMock2");
  51650. $ctx1.sendIdx["at:"]=2;
  51651. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51652. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51653. $ctx1.sendIdx["=="]=1;
  51654. $self._deny_($5);
  51655. $ctx1.sendIdx["deny:"]=1;
  51656. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51657. $ctx1.sendIdx["=="]=2;
  51658. $self._assert_($6);
  51659. $ctx1.sendIdx["assert:"]=1;
  51660. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51661. $ctx1.sendIdx["assert:"]=2;
  51662. $7=$recv($globals.ObjectMock2)._selectors();
  51663. $ctx1.sendIdx["selectors"]=1;
  51664. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51665. $ctx1.sendIdx["assert:equals:"]=1;
  51666. $8=$recv($globals.ObjectMock2)._comment();
  51667. $ctx1.sendIdx["comment"]=1;
  51668. $self._assert_equals_($8,$recv(oldClass)._comment());
  51669. $ctx1.sendIdx["assert:equals:"]=2;
  51670. $10=$recv($globals.ObjectMock2)._package();
  51671. $ctx1.sendIdx["package"]=1;
  51672. $9=$recv($10)._name();
  51673. $ctx1.sendIdx["name"]=1;
  51674. $self._assert_equals_($9,"Kernel-Tests");
  51675. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51676. $ctx1.sendIdx["assert:"]=3;
  51677. $12=$recv(instance)._class();
  51678. $ctx1.sendIdx["class"]=1;
  51679. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51680. $self._deny_($11);
  51681. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51682. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51683. return self;
  51684. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51685. },
  51686. args: [],
  51687. 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",
  51688. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51689. 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:"]
  51690. }),
  51691. $globals.ClassBuilderTest);
  51692. $core.addMethod(
  51693. $core.method({
  51694. selector: "testClassMigrationWithClassInstanceVariables",
  51695. protocol: "tests",
  51696. fn: function (){
  51697. var self=this,$self=this;
  51698. return $core.withContext(function($ctx1) {
  51699. var $1;
  51700. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51701. $1=$recv($globals.ObjectMock2)._class();
  51702. $ctx1.sendIdx["class"]=1;
  51703. $recv($1)._instanceVariableNames_("foo bar");
  51704. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51705. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51706. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51707. return self;
  51708. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51709. },
  51710. args: [],
  51711. 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",
  51712. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  51713. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  51714. }),
  51715. $globals.ClassBuilderTest);
  51716. $core.addMethod(
  51717. $core.method({
  51718. selector: "testClassMigrationWithSubclasses",
  51719. protocol: "tests",
  51720. fn: function (){
  51721. var self=this,$self=this;
  51722. return $core.withContext(function($ctx1) {
  51723. var $2,$1,$4,$3;
  51724. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51725. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  51726. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  51727. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  51728. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  51729. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51730. $2=$recv($globals.ObjectMock)._subclasses();
  51731. $ctx1.sendIdx["subclasses"]=1;
  51732. $1=$recv($2)._includes_($globals.ObjectMock2);
  51733. $ctx1.sendIdx["includes:"]=1;
  51734. $self._assert_($1);
  51735. $ctx1.sendIdx["assert:"]=1;
  51736. $4=$recv($globals.ObjectMock2)._subclasses();
  51737. $ctx1.sendIdx["subclasses"]=2;
  51738. $3=$recv($4)._includes_($globals.ObjectMock3);
  51739. $ctx1.sendIdx["includes:"]=2;
  51740. $self._assert_($3);
  51741. $ctx1.sendIdx["assert:"]=2;
  51742. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  51743. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  51744. return $core.withContext(function($ctx2) {
  51745. return $recv($globals.Smalltalk)._removeClass_(each);
  51746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51747. }));
  51748. return self;
  51749. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  51750. },
  51751. args: [],
  51752. 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 ]",
  51753. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  51754. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  51755. }),
  51756. $globals.ClassBuilderTest);
  51757. $core.addMethod(
  51758. $core.method({
  51759. selector: "testInstanceVariableNames",
  51760. protocol: "tests",
  51761. fn: function (){
  51762. var self=this,$self=this;
  51763. return $core.withContext(function($ctx1) {
  51764. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  51765. return self;
  51766. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  51767. },
  51768. args: [],
  51769. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  51770. referencedClasses: [],
  51771. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  51772. }),
  51773. $globals.ClassBuilderTest);
  51774. $core.addMethod(
  51775. $core.method({
  51776. selector: "testSubclass",
  51777. protocol: "tests",
  51778. fn: function (){
  51779. var self=this,$self=this;
  51780. return $core.withContext(function($ctx1) {
  51781. var $3,$2,$1,$4;
  51782. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  51783. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  51784. $ctx1.sendIdx["assert:equals:"]=1;
  51785. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  51786. $ctx1.sendIdx["assert:equals:"]=2;
  51787. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51788. $ctx1.sendIdx["assert:equals:"]=3;
  51789. $3=$recv($self["@theClass"])._package();
  51790. $ctx1.sendIdx["package"]=1;
  51791. $2=$recv($3)._classes();
  51792. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51793. $self._assert_equals_($1,(1));
  51794. $ctx1.sendIdx["assert:equals:"]=4;
  51795. $4=$recv($self["@theClass"])._package();
  51796. $ctx1.sendIdx["package"]=2;
  51797. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51798. $ctx1.sendIdx["assert:equals:"]=5;
  51799. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  51800. return self;
  51801. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  51802. },
  51803. args: [],
  51804. 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",
  51805. referencedClasses: ["ObjectMock"],
  51806. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  51807. }),
  51808. $globals.ClassBuilderTest);
  51809. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51810. $core.addMethod(
  51811. $core.method({
  51812. selector: "jsConstructor",
  51813. protocol: "running",
  51814. fn: function (){
  51815. var self=this,$self=this;
  51816. return $core.withContext(function($ctx1) {
  51817. function Foo(){}
  51818. Foo.prototype.valueOf = function () {return 4;};
  51819. return Foo;
  51820. ;
  51821. return self;
  51822. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  51823. },
  51824. args: [],
  51825. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  51826. referencedClasses: [],
  51827. messageSends: []
  51828. }),
  51829. $globals.ClassTest);
  51830. $core.addMethod(
  51831. $core.method({
  51832. selector: "setUp",
  51833. protocol: "running",
  51834. fn: function (){
  51835. var self=this,$self=this;
  51836. return $core.withContext(function($ctx1) {
  51837. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51838. return self;
  51839. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  51840. },
  51841. args: [],
  51842. source: "setUp\x0a\x09builder := ClassBuilder new",
  51843. referencedClasses: ["ClassBuilder"],
  51844. messageSends: ["new"]
  51845. }),
  51846. $globals.ClassTest);
  51847. $core.addMethod(
  51848. $core.method({
  51849. selector: "tearDown",
  51850. protocol: "running",
  51851. fn: function (){
  51852. var self=this,$self=this;
  51853. return $core.withContext(function($ctx1) {
  51854. var $1,$receiver;
  51855. $1=$self["@theClass"];
  51856. if(($receiver = $1) == null || $receiver.a$nil){
  51857. $1;
  51858. } else {
  51859. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  51860. return $core.withContext(function($ctx2) {
  51861. return $recv($globals.Smalltalk)._removeClass_(each);
  51862. $ctx2.sendIdx["removeClass:"]=1;
  51863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51864. }));
  51865. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51866. $self["@theClass"]=nil;
  51867. $self["@theClass"];
  51868. }
  51869. return self;
  51870. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  51871. },
  51872. args: [],
  51873. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  51874. referencedClasses: ["Smalltalk"],
  51875. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  51876. }),
  51877. $globals.ClassTest);
  51878. $core.addMethod(
  51879. $core.method({
  51880. selector: "testAllSubclasses",
  51881. protocol: "tests",
  51882. fn: function (){
  51883. var self=this,$self=this;
  51884. var subclasses,index;
  51885. return $core.withContext(function($ctx1) {
  51886. subclasses=$recv($globals.Object)._subclasses();
  51887. $ctx1.sendIdx["subclasses"]=1;
  51888. index=(1);
  51889. $recv((function(){
  51890. return $core.withContext(function($ctx2) {
  51891. return $recv(index).__gt($recv(subclasses)._size());
  51892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51893. }))._whileFalse_((function(){
  51894. return $core.withContext(function($ctx2) {
  51895. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  51896. index=$recv(index).__plus((1));
  51897. return index;
  51898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51899. }));
  51900. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  51901. return self;
  51902. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  51903. },
  51904. args: [],
  51905. 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",
  51906. referencedClasses: ["Object"],
  51907. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  51908. }),
  51909. $globals.ClassTest);
  51910. $core.addMethod(
  51911. $core.method({
  51912. selector: "testMetaclassSubclasses",
  51913. protocol: "tests",
  51914. fn: function (){
  51915. var self=this,$self=this;
  51916. var subclasses;
  51917. return $core.withContext(function($ctx1) {
  51918. var $4,$3,$2,$1;
  51919. $4=$recv($globals.Object)._class();
  51920. $ctx1.sendIdx["class"]=1;
  51921. $3=$recv($4)._instanceClass();
  51922. $2=$recv($3)._subclasses();
  51923. $ctx1.sendIdx["subclasses"]=1;
  51924. $1=$recv($2)._select_((function(each){
  51925. return $core.withContext(function($ctx2) {
  51926. return $recv($recv(each)._isMetaclass())._not();
  51927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51928. }));
  51929. subclasses=$recv($1)._collect_((function(each){
  51930. return $core.withContext(function($ctx2) {
  51931. return $recv(each)._theMetaClass();
  51932. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51933. }));
  51934. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  51935. return self;
  51936. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  51937. },
  51938. args: [],
  51939. 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",
  51940. referencedClasses: ["Object"],
  51941. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  51942. }),
  51943. $globals.ClassTest);
  51944. $core.addMethod(
  51945. $core.method({
  51946. selector: "testSetJavaScriptConstructor",
  51947. protocol: "tests",
  51948. fn: function (){
  51949. var self=this,$self=this;
  51950. var instance;
  51951. return $core.withContext(function($ctx1) {
  51952. var $2,$1,$4,$3,$6,$5,$8,$7;
  51953. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51954. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  51955. $2=$recv($self["@theClass"])._superclass();
  51956. $ctx1.sendIdx["superclass"]=1;
  51957. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51958. $ctx1.sendIdx["=="]=1;
  51959. $self._assert_($1);
  51960. $ctx1.sendIdx["assert:"]=1;
  51961. $4=$recv($self["@theClass"])._instanceVariableNames();
  51962. $ctx1.sendIdx["instanceVariableNames"]=1;
  51963. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51964. $ctx1.sendIdx["=="]=2;
  51965. $self._assert_($3);
  51966. $ctx1.sendIdx["assert:"]=2;
  51967. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51968. $ctx1.sendIdx["assert:equals:"]=1;
  51969. $6=$recv($self["@theClass"])._package();
  51970. $ctx1.sendIdx["package"]=1;
  51971. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  51972. $ctx1.sendIdx["=="]=3;
  51973. $self._assert_($5);
  51974. $ctx1.sendIdx["assert:"]=3;
  51975. $8=$recv($self["@theClass"])._methodDictionary();
  51976. $ctx1.sendIdx["methodDictionary"]=1;
  51977. $7=$recv($8)._keys();
  51978. $ctx1.sendIdx["keys"]=1;
  51979. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51980. $ctx1.sendIdx["assert:equals:"]=2;
  51981. instance=$recv($self["@theClass"])._new();
  51982. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  51983. $self._assert_equals_($recv(instance)._value(),(4));
  51984. $ctx1.sendIdx["assert:equals:"]=3;
  51985. $self._shouldnt_raise_((function(){
  51986. return $core.withContext(function($ctx2) {
  51987. return $recv(instance)._foo_((9));
  51988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51989. }),$globals.Error);
  51990. $self._assert_equals_($recv(instance)._foo(),(9));
  51991. return self;
  51992. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  51993. },
  51994. args: [],
  51995. 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",
  51996. referencedClasses: ["ObjectMock", "Error"],
  51997. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  51998. }),
  51999. $globals.ClassTest);
  52000. $core.addMethod(
  52001. $core.method({
  52002. selector: "testTrickySetJavaScriptConstructor",
  52003. protocol: "tests",
  52004. fn: function (){
  52005. var self=this,$self=this;
  52006. var instance;
  52007. return $core.withContext(function($ctx1) {
  52008. var $2,$1,$4,$3,$6,$5,$8,$7;
  52009. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52010. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52011. $2=$recv($self["@theClass"])._superclass();
  52012. $ctx1.sendIdx["superclass"]=1;
  52013. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52014. $ctx1.sendIdx["=="]=1;
  52015. $self._assert_($1);
  52016. $ctx1.sendIdx["assert:"]=1;
  52017. $4=$recv($self["@theClass"])._instanceVariableNames();
  52018. $ctx1.sendIdx["instanceVariableNames"]=1;
  52019. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52020. $ctx1.sendIdx["=="]=2;
  52021. $self._assert_($3);
  52022. $ctx1.sendIdx["assert:"]=2;
  52023. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52024. $ctx1.sendIdx["assert:equals:"]=1;
  52025. $6=$recv($self["@theClass"])._package();
  52026. $ctx1.sendIdx["package"]=1;
  52027. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52028. $ctx1.sendIdx["=="]=3;
  52029. $self._assert_($5);
  52030. $ctx1.sendIdx["assert:"]=3;
  52031. $8=$recv($self["@theClass"])._methodDictionary();
  52032. $ctx1.sendIdx["methodDictionary"]=1;
  52033. $7=$recv($8)._keys();
  52034. $ctx1.sendIdx["keys"]=1;
  52035. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52036. $ctx1.sendIdx["assert:equals:"]=2;
  52037. instance=$recv($self["@theClass"])._new();
  52038. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52039. $self._assert_equals_($recv(instance)._value(),(4));
  52040. $ctx1.sendIdx["assert:equals:"]=3;
  52041. $self._shouldnt_raise_((function(){
  52042. return $core.withContext(function($ctx2) {
  52043. return $recv(instance)._foo_((9));
  52044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52045. }),$globals.Error);
  52046. $self._assert_equals_($recv(instance)._foo(),(9));
  52047. return self;
  52048. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52049. },
  52050. args: [],
  52051. 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",
  52052. referencedClasses: ["ObjectMock", "Error"],
  52053. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52054. }),
  52055. $globals.ClassTest);
  52056. $core.addMethod(
  52057. $core.method({
  52058. selector: "trickyJsConstructor",
  52059. protocol: "running",
  52060. fn: function (){
  52061. var self=this,$self=this;
  52062. return $core.withContext(function($ctx1) {
  52063. function Foo(){}
  52064. Foo.prototype.valueOf = function () {return 4;};
  52065. Foo.prototype._foo = function () {return "bar";};
  52066. return Foo;
  52067. ;
  52068. return self;
  52069. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52070. },
  52071. args: [],
  52072. 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'>",
  52073. referencedClasses: [],
  52074. messageSends: []
  52075. }),
  52076. $globals.ClassTest);
  52077. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52078. $core.addMethod(
  52079. $core.method({
  52080. selector: "assertSameContents:as:",
  52081. protocol: "convenience",
  52082. fn: function (aCollection,anotherCollection){
  52083. var self=this,$self=this;
  52084. return $core.withContext(function($ctx1) {
  52085. var $2,$1,$4,$3;
  52086. $2=$recv(aCollection)._size();
  52087. $ctx1.sendIdx["size"]=1;
  52088. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52089. $ctx1.sendIdx["="]=1;
  52090. $self._assert_($1);
  52091. $ctx1.sendIdx["assert:"]=1;
  52092. $recv(aCollection)._do_((function(each){
  52093. return $core.withContext(function($ctx2) {
  52094. $4=$recv(aCollection)._occurrencesOf_(each);
  52095. $ctx2.sendIdx["occurrencesOf:"]=1;
  52096. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52097. return $self._assert_($3);
  52098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52099. }));
  52100. return self;
  52101. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52102. },
  52103. args: ["aCollection", "anotherCollection"],
  52104. 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)) ]",
  52105. referencedClasses: [],
  52106. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52107. }),
  52108. $globals.CollectionTest);
  52109. $core.addMethod(
  52110. $core.method({
  52111. selector: "collection",
  52112. protocol: "fixture",
  52113. fn: function (){
  52114. var self=this,$self=this;
  52115. return $core.withContext(function($ctx1) {
  52116. $self._subclassResponsibility();
  52117. return self;
  52118. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52119. },
  52120. args: [],
  52121. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52122. referencedClasses: [],
  52123. messageSends: ["subclassResponsibility"]
  52124. }),
  52125. $globals.CollectionTest);
  52126. $core.addMethod(
  52127. $core.method({
  52128. selector: "collectionClass",
  52129. protocol: "fixture",
  52130. fn: function (){
  52131. var self=this,$self=this;
  52132. return $core.withContext(function($ctx1) {
  52133. return $recv($self._class())._collectionClass();
  52134. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52135. },
  52136. args: [],
  52137. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52138. referencedClasses: [],
  52139. messageSends: ["collectionClass", "class"]
  52140. }),
  52141. $globals.CollectionTest);
  52142. $core.addMethod(
  52143. $core.method({
  52144. selector: "collectionOfPrintStrings",
  52145. protocol: "fixture",
  52146. fn: function (){
  52147. var self=this,$self=this;
  52148. return $core.withContext(function($ctx1) {
  52149. $self._subclassResponsibility();
  52150. return self;
  52151. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52152. },
  52153. args: [],
  52154. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52155. referencedClasses: [],
  52156. messageSends: ["subclassResponsibility"]
  52157. }),
  52158. $globals.CollectionTest);
  52159. $core.addMethod(
  52160. $core.method({
  52161. selector: "collectionSize",
  52162. protocol: "fixture",
  52163. fn: function (){
  52164. var self=this,$self=this;
  52165. return $core.withContext(function($ctx1) {
  52166. $self._subclassResponsibility();
  52167. return self;
  52168. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52169. },
  52170. args: [],
  52171. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52172. referencedClasses: [],
  52173. messageSends: ["subclassResponsibility"]
  52174. }),
  52175. $globals.CollectionTest);
  52176. $core.addMethod(
  52177. $core.method({
  52178. selector: "collectionWithDuplicates",
  52179. protocol: "fixture",
  52180. fn: function (){
  52181. var self=this,$self=this;
  52182. return $core.withContext(function($ctx1) {
  52183. $self._subclassResponsibility();
  52184. return self;
  52185. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52186. },
  52187. args: [],
  52188. 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",
  52189. referencedClasses: [],
  52190. messageSends: ["subclassResponsibility"]
  52191. }),
  52192. $globals.CollectionTest);
  52193. $core.addMethod(
  52194. $core.method({
  52195. selector: "collectionWithNewValue",
  52196. protocol: "fixture",
  52197. fn: function (){
  52198. var self=this,$self=this;
  52199. return $core.withContext(function($ctx1) {
  52200. $self._subclassResponsibility();
  52201. return self;
  52202. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52203. },
  52204. args: [],
  52205. 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",
  52206. referencedClasses: [],
  52207. messageSends: ["subclassResponsibility"]
  52208. }),
  52209. $globals.CollectionTest);
  52210. $core.addMethod(
  52211. $core.method({
  52212. selector: "initialize",
  52213. protocol: "initialization",
  52214. fn: function (){
  52215. var self=this,$self=this;
  52216. return $core.withContext(function($ctx1) {
  52217. (
  52218. $ctx1.supercall = true,
  52219. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52220. $ctx1.supercall = false;
  52221. $self["@sampleBlock"]=(function(){
  52222. });
  52223. return self;
  52224. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52225. },
  52226. args: [],
  52227. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52228. referencedClasses: [],
  52229. messageSends: ["initialize"]
  52230. }),
  52231. $globals.CollectionTest);
  52232. $core.addMethod(
  52233. $core.method({
  52234. selector: "sampleNewValue",
  52235. protocol: "fixture",
  52236. fn: function (){
  52237. var self=this,$self=this;
  52238. return "N";
  52239. },
  52240. args: [],
  52241. 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'",
  52242. referencedClasses: [],
  52243. messageSends: []
  52244. }),
  52245. $globals.CollectionTest);
  52246. $core.addMethod(
  52247. $core.method({
  52248. selector: "sampleNewValueAsCollection",
  52249. protocol: "fixture",
  52250. fn: function (){
  52251. var self=this,$self=this;
  52252. return $core.withContext(function($ctx1) {
  52253. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52254. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52255. },
  52256. args: [],
  52257. 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",
  52258. referencedClasses: [],
  52259. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52260. }),
  52261. $globals.CollectionTest);
  52262. $core.addMethod(
  52263. $core.method({
  52264. selector: "testAddAll",
  52265. protocol: "tests",
  52266. fn: function (){
  52267. var self=this,$self=this;
  52268. return $core.withContext(function($ctx1) {
  52269. 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;
  52270. $2=$self._collection();
  52271. $ctx1.sendIdx["collection"]=1;
  52272. $4=$self._collectionClass();
  52273. $ctx1.sendIdx["collectionClass"]=1;
  52274. $3=$recv($4)._new();
  52275. $ctx1.sendIdx["new"]=1;
  52276. $recv($2)._addAll_($3);
  52277. $ctx1.sendIdx["addAll:"]=1;
  52278. $5=$recv($2)._yourself();
  52279. $ctx1.sendIdx["yourself"]=1;
  52280. $1=$5;
  52281. $6=$self._collection();
  52282. $ctx1.sendIdx["collection"]=2;
  52283. $self._assert_equals_($1,$6);
  52284. $ctx1.sendIdx["assert:equals:"]=1;
  52285. $9=$self._collectionClass();
  52286. $ctx1.sendIdx["collectionClass"]=2;
  52287. $8=$recv($9)._new();
  52288. $ctx1.sendIdx["new"]=2;
  52289. $10=$self._collection();
  52290. $ctx1.sendIdx["collection"]=3;
  52291. $recv($8)._addAll_($10);
  52292. $ctx1.sendIdx["addAll:"]=2;
  52293. $11=$recv($8)._yourself();
  52294. $ctx1.sendIdx["yourself"]=2;
  52295. $7=$11;
  52296. $12=$self._collection();
  52297. $ctx1.sendIdx["collection"]=4;
  52298. $self._assert_equals_($7,$12);
  52299. $ctx1.sendIdx["assert:equals:"]=2;
  52300. $15=$self._collectionClass();
  52301. $ctx1.sendIdx["collectionClass"]=3;
  52302. $14=$recv($15)._new();
  52303. $ctx1.sendIdx["new"]=3;
  52304. $17=$self._collectionClass();
  52305. $ctx1.sendIdx["collectionClass"]=4;
  52306. $16=$recv($17)._new();
  52307. $ctx1.sendIdx["new"]=4;
  52308. $recv($14)._addAll_($16);
  52309. $ctx1.sendIdx["addAll:"]=3;
  52310. $18=$recv($14)._yourself();
  52311. $ctx1.sendIdx["yourself"]=3;
  52312. $13=$18;
  52313. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52314. $ctx1.sendIdx["assert:equals:"]=3;
  52315. $20=$self._collection();
  52316. $ctx1.sendIdx["collection"]=5;
  52317. $21=$self._sampleNewValueAsCollection();
  52318. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52319. $recv($20)._addAll_($21);
  52320. $ctx1.sendIdx["addAll:"]=4;
  52321. $22=$recv($20)._yourself();
  52322. $ctx1.sendIdx["yourself"]=4;
  52323. $19=$22;
  52324. $23=$self._collectionWithNewValue();
  52325. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52326. $self._assert_equals_($19,$23);
  52327. $25=$self._sampleNewValueAsCollection();
  52328. $recv($25)._addAll_($self._collection());
  52329. $24=$recv($25)._yourself();
  52330. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52331. return self;
  52332. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52333. },
  52334. args: [],
  52335. 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",
  52336. referencedClasses: [],
  52337. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52338. }),
  52339. $globals.CollectionTest);
  52340. $core.addMethod(
  52341. $core.method({
  52342. selector: "testAllSatisfy",
  52343. protocol: "tests",
  52344. fn: function (){
  52345. var self=this,$self=this;
  52346. var collection,anyOne;
  52347. return $core.withContext(function($ctx1) {
  52348. var $1;
  52349. collection=$self._collection();
  52350. anyOne=$recv(collection)._anyOne();
  52351. $1=$recv(collection)._allSatisfy_((function(each){
  52352. return $core.withContext(function($ctx2) {
  52353. return $recv(collection)._includes_(each);
  52354. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52355. }));
  52356. $ctx1.sendIdx["allSatisfy:"]=1;
  52357. $self._assert_($1);
  52358. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52359. return $core.withContext(function($ctx2) {
  52360. return $recv(each).__tild_eq(anyOne);
  52361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52362. })));
  52363. return self;
  52364. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52365. },
  52366. args: [],
  52367. 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 ])",
  52368. referencedClasses: [],
  52369. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52370. }),
  52371. $globals.CollectionTest);
  52372. $core.addMethod(
  52373. $core.method({
  52374. selector: "testAnyOne",
  52375. protocol: "tests",
  52376. fn: function (){
  52377. var self=this,$self=this;
  52378. return $core.withContext(function($ctx1) {
  52379. var $2,$1;
  52380. $self._should_raise_((function(){
  52381. return $core.withContext(function($ctx2) {
  52382. return $recv($recv($self._collectionClass())._new())._anyOne();
  52383. $ctx2.sendIdx["anyOne"]=1;
  52384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52385. }),$globals.Error);
  52386. $2=$self._collection();
  52387. $ctx1.sendIdx["collection"]=1;
  52388. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52389. $self._assert_($1);
  52390. return self;
  52391. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52392. },
  52393. args: [],
  52394. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52395. referencedClasses: ["Error"],
  52396. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52397. }),
  52398. $globals.CollectionTest);
  52399. $core.addMethod(
  52400. $core.method({
  52401. selector: "testAnySatisfy",
  52402. protocol: "tests",
  52403. fn: function (){
  52404. var self=this,$self=this;
  52405. var anyOne;
  52406. return $core.withContext(function($ctx1) {
  52407. var $1,$3,$2;
  52408. $1=$self._collection();
  52409. $ctx1.sendIdx["collection"]=1;
  52410. anyOne=$recv($1)._anyOne();
  52411. $3=$self._collection();
  52412. $ctx1.sendIdx["collection"]=2;
  52413. $2=$recv($3)._anySatisfy_((function(each){
  52414. return $core.withContext(function($ctx2) {
  52415. return $recv(each).__eq(anyOne);
  52416. $ctx2.sendIdx["="]=1;
  52417. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52418. }));
  52419. $ctx1.sendIdx["anySatisfy:"]=1;
  52420. $self._assert_($2);
  52421. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52422. return $core.withContext(function($ctx2) {
  52423. return $recv(each).__eq($recv($globals.Object)._new());
  52424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52425. })));
  52426. return self;
  52427. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52428. },
  52429. args: [],
  52430. 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 ])",
  52431. referencedClasses: ["Object"],
  52432. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52433. }),
  52434. $globals.CollectionTest);
  52435. $core.addMethod(
  52436. $core.method({
  52437. selector: "testAsArray",
  52438. protocol: "tests",
  52439. fn: function (){
  52440. var self=this,$self=this;
  52441. return $core.withContext(function($ctx1) {
  52442. var $1;
  52443. $1=$self._collection();
  52444. $ctx1.sendIdx["collection"]=1;
  52445. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52446. return self;
  52447. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52448. },
  52449. args: [],
  52450. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52451. referencedClasses: [],
  52452. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52453. }),
  52454. $globals.CollectionTest);
  52455. $core.addMethod(
  52456. $core.method({
  52457. selector: "testAsOrderedCollection",
  52458. protocol: "tests",
  52459. fn: function (){
  52460. var self=this,$self=this;
  52461. return $core.withContext(function($ctx1) {
  52462. var $1;
  52463. $1=$self._collection();
  52464. $ctx1.sendIdx["collection"]=1;
  52465. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52466. return self;
  52467. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52468. },
  52469. args: [],
  52470. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52471. referencedClasses: [],
  52472. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52473. }),
  52474. $globals.CollectionTest);
  52475. $core.addMethod(
  52476. $core.method({
  52477. selector: "testAsSet",
  52478. protocol: "tests",
  52479. fn: function (){
  52480. var self=this,$self=this;
  52481. var c,set;
  52482. return $core.withContext(function($ctx1) {
  52483. c=$self._collectionWithDuplicates();
  52484. set=$recv(c)._asSet();
  52485. $self._assert_equals_($recv(set)._size(),(6));
  52486. $recv(c)._do_((function(each){
  52487. return $core.withContext(function($ctx2) {
  52488. return $self._assert_($recv(set)._includes_(each));
  52489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52490. }));
  52491. return self;
  52492. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52493. },
  52494. args: [],
  52495. 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) ]",
  52496. referencedClasses: [],
  52497. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52498. }),
  52499. $globals.CollectionTest);
  52500. $core.addMethod(
  52501. $core.method({
  52502. selector: "testCollect",
  52503. protocol: "tests",
  52504. fn: function (){
  52505. var self=this,$self=this;
  52506. return $core.withContext(function($ctx1) {
  52507. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52508. $2=$self._collection();
  52509. $ctx1.sendIdx["collection"]=1;
  52510. $1=$recv($2)._collect_((function(each){
  52511. return each;
  52512. }));
  52513. $ctx1.sendIdx["collect:"]=1;
  52514. $3=$self._collection();
  52515. $ctx1.sendIdx["collection"]=2;
  52516. $self._assert_equals_($1,$3);
  52517. $ctx1.sendIdx["assert:equals:"]=1;
  52518. $5=$self._collectionWithNewValue();
  52519. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52520. $4=$recv($5)._collect_((function(each){
  52521. return each;
  52522. }));
  52523. $ctx1.sendIdx["collect:"]=2;
  52524. $self._assert_equals_($4,$self._collectionWithNewValue());
  52525. $ctx1.sendIdx["assert:equals:"]=2;
  52526. $8=$self._collectionClass();
  52527. $ctx1.sendIdx["collectionClass"]=1;
  52528. $7=$recv($8)._new();
  52529. $ctx1.sendIdx["new"]=1;
  52530. $6=$recv($7)._collect_((function(each){
  52531. return $core.withContext(function($ctx2) {
  52532. return $recv(each)._printString();
  52533. $ctx2.sendIdx["printString"]=1;
  52534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52535. }));
  52536. $ctx1.sendIdx["collect:"]=3;
  52537. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52538. $ctx1.sendIdx["assert:equals:"]=3;
  52539. $11=$self._collection();
  52540. $ctx1.sendIdx["collection"]=3;
  52541. $10=$recv($11)._collect_((function(){
  52542. return $core.withContext(function($ctx2) {
  52543. return $self._sampleNewValue();
  52544. $ctx2.sendIdx["sampleNewValue"]=1;
  52545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52546. }));
  52547. $ctx1.sendIdx["collect:"]=4;
  52548. $9=$recv($10)._detect_((function(){
  52549. return true;
  52550. }));
  52551. $self._assert_equals_($9,$self._sampleNewValue());
  52552. $ctx1.sendIdx["assert:equals:"]=4;
  52553. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52554. return $core.withContext(function($ctx2) {
  52555. return $recv(each)._printString();
  52556. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52557. })),$self._collectionOfPrintStrings());
  52558. return self;
  52559. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52560. },
  52561. args: [],
  52562. 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",
  52563. referencedClasses: [],
  52564. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52565. }),
  52566. $globals.CollectionTest);
  52567. $core.addMethod(
  52568. $core.method({
  52569. selector: "testComma",
  52570. protocol: "tests",
  52571. fn: function (){
  52572. var self=this,$self=this;
  52573. return $core.withContext(function($ctx1) {
  52574. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52575. $2=$self._collection();
  52576. $ctx1.sendIdx["collection"]=1;
  52577. $4=$self._collectionClass();
  52578. $ctx1.sendIdx["collectionClass"]=1;
  52579. $3=$recv($4)._new();
  52580. $ctx1.sendIdx["new"]=1;
  52581. $1=$recv($2).__comma($3);
  52582. $ctx1.sendIdx[","]=1;
  52583. $5=$self._collection();
  52584. $ctx1.sendIdx["collection"]=2;
  52585. $self._assert_equals_($1,$5);
  52586. $ctx1.sendIdx["assert:equals:"]=1;
  52587. $8=$self._collectionClass();
  52588. $ctx1.sendIdx["collectionClass"]=2;
  52589. $7=$recv($8)._new();
  52590. $ctx1.sendIdx["new"]=2;
  52591. $9=$self._collection();
  52592. $ctx1.sendIdx["collection"]=3;
  52593. $6=$recv($7).__comma($9);
  52594. $ctx1.sendIdx[","]=2;
  52595. $10=$self._collection();
  52596. $ctx1.sendIdx["collection"]=4;
  52597. $self._assert_equals_($6,$10);
  52598. $ctx1.sendIdx["assert:equals:"]=2;
  52599. $13=$self._collectionClass();
  52600. $ctx1.sendIdx["collectionClass"]=3;
  52601. $12=$recv($13)._new();
  52602. $ctx1.sendIdx["new"]=3;
  52603. $15=$self._collectionClass();
  52604. $ctx1.sendIdx["collectionClass"]=4;
  52605. $14=$recv($15)._new();
  52606. $ctx1.sendIdx["new"]=4;
  52607. $11=$recv($12).__comma($14);
  52608. $ctx1.sendIdx[","]=3;
  52609. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52610. $ctx1.sendIdx["assert:equals:"]=3;
  52611. $17=$self._collection();
  52612. $ctx1.sendIdx["collection"]=5;
  52613. $18=$self._sampleNewValueAsCollection();
  52614. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52615. $16=$recv($17).__comma($18);
  52616. $ctx1.sendIdx[","]=4;
  52617. $19=$self._collectionWithNewValue();
  52618. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52619. $self._assert_equals_($16,$19);
  52620. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52621. return self;
  52622. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52623. },
  52624. args: [],
  52625. 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",
  52626. referencedClasses: [],
  52627. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52628. }),
  52629. $globals.CollectionTest);
  52630. $core.addMethod(
  52631. $core.method({
  52632. selector: "testCopy",
  52633. protocol: "tests",
  52634. fn: function (){
  52635. var self=this,$self=this;
  52636. return $core.withContext(function($ctx1) {
  52637. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52638. $3=$self._collectionClass();
  52639. $ctx1.sendIdx["collectionClass"]=1;
  52640. $2=$recv($3)._new();
  52641. $ctx1.sendIdx["new"]=1;
  52642. $1=$recv($2)._copy();
  52643. $ctx1.sendIdx["copy"]=1;
  52644. $5=$self._collectionClass();
  52645. $ctx1.sendIdx["collectionClass"]=2;
  52646. $4=$recv($5)._new();
  52647. $ctx1.sendIdx["new"]=2;
  52648. $self._assert_equals_($1,$4);
  52649. $ctx1.sendIdx["assert:equals:"]=1;
  52650. $7=$self._collection();
  52651. $ctx1.sendIdx["collection"]=1;
  52652. $6=$recv($7)._copy();
  52653. $ctx1.sendIdx["copy"]=2;
  52654. $8=$self._collection();
  52655. $ctx1.sendIdx["collection"]=2;
  52656. $self._assert_equals_($6,$8);
  52657. $ctx1.sendIdx["assert:equals:"]=2;
  52658. $10=$self._collectionWithNewValue();
  52659. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52660. $9=$recv($10)._copy();
  52661. $ctx1.sendIdx["copy"]=3;
  52662. $11=$self._collectionWithNewValue();
  52663. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52664. $self._assert_equals_($9,$11);
  52665. $15=$self._collectionClass();
  52666. $ctx1.sendIdx["collectionClass"]=3;
  52667. $14=$recv($15)._new();
  52668. $ctx1.sendIdx["new"]=3;
  52669. $13=$recv($14)._copy();
  52670. $ctx1.sendIdx["copy"]=4;
  52671. $16=$self._collection();
  52672. $ctx1.sendIdx["collection"]=3;
  52673. $12=$recv($13).__eq($16);
  52674. $ctx1.sendIdx["="]=1;
  52675. $self._deny_($12);
  52676. $ctx1.sendIdx["deny:"]=1;
  52677. $19=$self._collection();
  52678. $ctx1.sendIdx["collection"]=4;
  52679. $18=$recv($19)._copy();
  52680. $ctx1.sendIdx["copy"]=5;
  52681. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52682. $ctx1.sendIdx["="]=2;
  52683. $self._deny_($17);
  52684. $ctx1.sendIdx["deny:"]=2;
  52685. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52686. return self;
  52687. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52688. },
  52689. args: [],
  52690. 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",
  52691. referencedClasses: [],
  52692. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52693. }),
  52694. $globals.CollectionTest);
  52695. $core.addMethod(
  52696. $core.method({
  52697. selector: "testCopySeparates",
  52698. protocol: "tests",
  52699. fn: function (){
  52700. var self=this,$self=this;
  52701. var original,copy;
  52702. return $core.withContext(function($ctx1) {
  52703. original=$self._collection();
  52704. $ctx1.sendIdx["collection"]=1;
  52705. copy=$recv(original)._copy();
  52706. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52707. $self._assert_($recv(original).__eq($self._collection()));
  52708. return self;
  52709. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52710. },
  52711. args: [],
  52712. 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",
  52713. referencedClasses: [],
  52714. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52715. }),
  52716. $globals.CollectionTest);
  52717. $core.addMethod(
  52718. $core.method({
  52719. selector: "testDetect",
  52720. protocol: "tests",
  52721. fn: function (){
  52722. var self=this,$self=this;
  52723. return $core.withContext(function($ctx1) {
  52724. var $1,$2,$3,$4,$6,$5,$7;
  52725. $self._shouldnt_raise_((function(){
  52726. return $core.withContext(function($ctx2) {
  52727. $1=$self._collection();
  52728. $ctx2.sendIdx["collection"]=1;
  52729. return $recv($1)._detect_((function(){
  52730. return true;
  52731. }));
  52732. $ctx2.sendIdx["detect:"]=1;
  52733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52734. }),$globals.Error);
  52735. $self._should_raise_((function(){
  52736. return $core.withContext(function($ctx2) {
  52737. $2=$self._collection();
  52738. $ctx2.sendIdx["collection"]=2;
  52739. return $recv($2)._detect_((function(){
  52740. return false;
  52741. }));
  52742. $ctx2.sendIdx["detect:"]=2;
  52743. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52744. }),$globals.Error);
  52745. $ctx1.sendIdx["should:raise:"]=1;
  52746. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  52747. return true;
  52748. }));
  52749. $ctx1.sendIdx["detect:"]=3;
  52750. $4=$self._sampleNewValue();
  52751. $ctx1.sendIdx["sampleNewValue"]=1;
  52752. $self._assert_equals_($3,$4);
  52753. $ctx1.sendIdx["assert:equals:"]=1;
  52754. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  52755. return $core.withContext(function($ctx2) {
  52756. $6=$self._sampleNewValue();
  52757. $ctx2.sendIdx["sampleNewValue"]=2;
  52758. return $recv(each).__eq($6);
  52759. $ctx2.sendIdx["="]=1;
  52760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52761. }));
  52762. $ctx1.sendIdx["detect:"]=4;
  52763. $7=$self._sampleNewValue();
  52764. $ctx1.sendIdx["sampleNewValue"]=3;
  52765. $self._assert_equals_($5,$7);
  52766. $self._should_raise_((function(){
  52767. return $core.withContext(function($ctx2) {
  52768. return $recv($self._collection())._detect_((function(each){
  52769. return $core.withContext(function($ctx3) {
  52770. return $recv(each).__eq($self._sampleNewValue());
  52771. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  52772. }));
  52773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  52774. }),$globals.Error);
  52775. return self;
  52776. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  52777. },
  52778. args: [],
  52779. 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",
  52780. referencedClasses: ["Error"],
  52781. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52782. }),
  52783. $globals.CollectionTest);
  52784. $core.addMethod(
  52785. $core.method({
  52786. selector: "testDetectIfNone",
  52787. protocol: "tests",
  52788. fn: function (){
  52789. var self=this,$self=this;
  52790. var sentinel;
  52791. return $core.withContext(function($ctx1) {
  52792. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  52793. sentinel=$recv($globals.Object)._new();
  52794. $3=$self._collection();
  52795. $ctx1.sendIdx["collection"]=1;
  52796. $2=$recv($3)._detect_ifNone_((function(){
  52797. return true;
  52798. }),(function(){
  52799. return sentinel;
  52800. }));
  52801. $ctx1.sendIdx["detect:ifNone:"]=1;
  52802. $1=$recv($2).__tild_eq(sentinel);
  52803. $self._assert_($1);
  52804. $5=$self._collection();
  52805. $ctx1.sendIdx["collection"]=2;
  52806. $4=$recv($5)._detect_ifNone_((function(){
  52807. return false;
  52808. }),(function(){
  52809. return sentinel;
  52810. }));
  52811. $ctx1.sendIdx["detect:ifNone:"]=2;
  52812. $self._assert_equals_($4,sentinel);
  52813. $ctx1.sendIdx["assert:equals:"]=1;
  52814. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  52815. return true;
  52816. }),(function(){
  52817. return sentinel;
  52818. }));
  52819. $ctx1.sendIdx["detect:ifNone:"]=3;
  52820. $7=$self._sampleNewValue();
  52821. $ctx1.sendIdx["sampleNewValue"]=1;
  52822. $self._assert_equals_($6,$7);
  52823. $ctx1.sendIdx["assert:equals:"]=2;
  52824. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  52825. return $core.withContext(function($ctx2) {
  52826. $9=$self._sampleNewValue();
  52827. $ctx2.sendIdx["sampleNewValue"]=2;
  52828. return $recv(each).__eq($9);
  52829. $ctx2.sendIdx["="]=1;
  52830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  52831. }),(function(){
  52832. return sentinel;
  52833. }));
  52834. $ctx1.sendIdx["detect:ifNone:"]=4;
  52835. $10=$self._sampleNewValue();
  52836. $ctx1.sendIdx["sampleNewValue"]=3;
  52837. $self._assert_equals_($8,$10);
  52838. $ctx1.sendIdx["assert:equals:"]=3;
  52839. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  52840. return $core.withContext(function($ctx2) {
  52841. return $recv(each).__eq($self._sampleNewValue());
  52842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  52843. }),(function(){
  52844. return sentinel;
  52845. })),sentinel);
  52846. return self;
  52847. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  52848. },
  52849. args: [],
  52850. 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",
  52851. referencedClasses: ["Object"],
  52852. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52853. }),
  52854. $globals.CollectionTest);
  52855. $core.addMethod(
  52856. $core.method({
  52857. selector: "testDo",
  52858. protocol: "tests",
  52859. fn: function (){
  52860. var self=this,$self=this;
  52861. var newCollection;
  52862. return $core.withContext(function($ctx1) {
  52863. var $1,$2;
  52864. newCollection=$recv($globals.OrderedCollection)._new();
  52865. $ctx1.sendIdx["new"]=1;
  52866. $1=$self._collection();
  52867. $ctx1.sendIdx["collection"]=1;
  52868. $recv($1)._do_((function(each){
  52869. return $core.withContext(function($ctx2) {
  52870. return $recv(newCollection)._add_(each);
  52871. $ctx2.sendIdx["add:"]=1;
  52872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52873. }));
  52874. $ctx1.sendIdx["do:"]=1;
  52875. $self._assertSameContents_as_($self._collection(),newCollection);
  52876. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52877. newCollection=$recv($globals.OrderedCollection)._new();
  52878. $2=$self._collectionWithDuplicates();
  52879. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  52880. $recv($2)._do_((function(each){
  52881. return $core.withContext(function($ctx2) {
  52882. return $recv(newCollection)._add_(each);
  52883. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52884. }));
  52885. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  52886. return self;
  52887. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  52888. },
  52889. args: [],
  52890. 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",
  52891. referencedClasses: ["OrderedCollection"],
  52892. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  52893. }),
  52894. $globals.CollectionTest);
  52895. $core.addMethod(
  52896. $core.method({
  52897. selector: "testEquality",
  52898. protocol: "tests",
  52899. fn: function (){
  52900. var self=this,$self=this;
  52901. return $core.withContext(function($ctx1) {
  52902. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  52903. $2=$self._collectionClass();
  52904. $ctx1.sendIdx["collectionClass"]=1;
  52905. $1=$recv($2)._new();
  52906. $ctx1.sendIdx["new"]=1;
  52907. $4=$self._collectionClass();
  52908. $ctx1.sendIdx["collectionClass"]=2;
  52909. $3=$recv($4)._new();
  52910. $ctx1.sendIdx["new"]=2;
  52911. $self._assert_equals_($1,$3);
  52912. $ctx1.sendIdx["assert:equals:"]=1;
  52913. $5=$self._collection();
  52914. $ctx1.sendIdx["collection"]=1;
  52915. $6=$self._collection();
  52916. $ctx1.sendIdx["collection"]=2;
  52917. $self._assert_equals_($5,$6);
  52918. $ctx1.sendIdx["assert:equals:"]=2;
  52919. $7=$self._collectionWithNewValue();
  52920. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52921. $8=$self._collectionWithNewValue();
  52922. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52923. $self._assert_equals_($7,$8);
  52924. $11=$self._collectionClass();
  52925. $ctx1.sendIdx["collectionClass"]=3;
  52926. $10=$recv($11)._new();
  52927. $ctx1.sendIdx["new"]=3;
  52928. $12=$self._collection();
  52929. $ctx1.sendIdx["collection"]=3;
  52930. $9=$recv($10).__eq($12);
  52931. $ctx1.sendIdx["="]=1;
  52932. $self._deny_($9);
  52933. $ctx1.sendIdx["deny:"]=1;
  52934. $14=$self._collection();
  52935. $ctx1.sendIdx["collection"]=4;
  52936. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  52937. $ctx1.sendIdx["="]=2;
  52938. $self._deny_($13);
  52939. $ctx1.sendIdx["deny:"]=2;
  52940. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  52941. return self;
  52942. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  52943. },
  52944. args: [],
  52945. 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",
  52946. referencedClasses: [],
  52947. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52948. }),
  52949. $globals.CollectionTest);
  52950. $core.addMethod(
  52951. $core.method({
  52952. selector: "testIfEmptyFamily",
  52953. protocol: "tests",
  52954. fn: function (){
  52955. var self=this,$self=this;
  52956. return $core.withContext(function($ctx1) {
  52957. 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;
  52958. $3=$self._collectionClass();
  52959. $ctx1.sendIdx["collectionClass"]=1;
  52960. $2=$recv($3)._new();
  52961. $ctx1.sendIdx["new"]=1;
  52962. $1=$recv($2)._ifEmpty_((function(){
  52963. return (42);
  52964. }));
  52965. $ctx1.sendIdx["ifEmpty:"]=1;
  52966. $self._assert_equals_($1,(42));
  52967. $ctx1.sendIdx["assert:equals:"]=1;
  52968. $5=$self._collection();
  52969. $ctx1.sendIdx["collection"]=1;
  52970. $4=$recv($5)._ifEmpty_((function(){
  52971. return (42);
  52972. }));
  52973. $6=$self._collection();
  52974. $ctx1.sendIdx["collection"]=2;
  52975. $self._assert_equals_($4,$6);
  52976. $ctx1.sendIdx["assert:equals:"]=2;
  52977. $9=$self._collectionClass();
  52978. $ctx1.sendIdx["collectionClass"]=2;
  52979. $8=$recv($9)._new();
  52980. $ctx1.sendIdx["new"]=2;
  52981. $7=$recv($8)._ifNotEmpty_((function(){
  52982. return (42);
  52983. }));
  52984. $ctx1.sendIdx["ifNotEmpty:"]=1;
  52985. $11=$self._collectionClass();
  52986. $ctx1.sendIdx["collectionClass"]=3;
  52987. $10=$recv($11)._new();
  52988. $ctx1.sendIdx["new"]=3;
  52989. $self._assert_equals_($7,$10);
  52990. $ctx1.sendIdx["assert:equals:"]=3;
  52991. $13=$self._collection();
  52992. $ctx1.sendIdx["collection"]=3;
  52993. $12=$recv($13)._ifNotEmpty_((function(){
  52994. return (42);
  52995. }));
  52996. $ctx1.sendIdx["ifNotEmpty:"]=2;
  52997. $self._assert_equals_($12,(42));
  52998. $ctx1.sendIdx["assert:equals:"]=4;
  52999. $15=$self._collection();
  53000. $ctx1.sendIdx["collection"]=4;
  53001. $14=$recv($15)._ifNotEmpty_((function(col){
  53002. return col;
  53003. }));
  53004. $16=$self._collection();
  53005. $ctx1.sendIdx["collection"]=5;
  53006. $self._assert_equals_($14,$16);
  53007. $ctx1.sendIdx["assert:equals:"]=5;
  53008. $19=$self._collectionClass();
  53009. $ctx1.sendIdx["collectionClass"]=4;
  53010. $18=$recv($19)._new();
  53011. $ctx1.sendIdx["new"]=4;
  53012. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53013. return (42);
  53014. }),(function(){
  53015. return (999);
  53016. }));
  53017. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53018. $self._assert_equals_($17,(42));
  53019. $ctx1.sendIdx["assert:equals:"]=6;
  53020. $21=$self._collection();
  53021. $ctx1.sendIdx["collection"]=6;
  53022. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53023. return (42);
  53024. }),(function(){
  53025. return (999);
  53026. }));
  53027. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53028. $self._assert_equals_($20,(999));
  53029. $ctx1.sendIdx["assert:equals:"]=7;
  53030. $23=$self._collection();
  53031. $ctx1.sendIdx["collection"]=7;
  53032. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53033. return (42);
  53034. }),(function(col){
  53035. return col;
  53036. }));
  53037. $24=$self._collection();
  53038. $ctx1.sendIdx["collection"]=8;
  53039. $self._assert_equals_($22,$24);
  53040. $ctx1.sendIdx["assert:equals:"]=8;
  53041. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53042. return (42);
  53043. }),(function(){
  53044. return (999);
  53045. }));
  53046. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53047. $self._assert_equals_($25,(999));
  53048. $ctx1.sendIdx["assert:equals:"]=9;
  53049. $27=$self._collection();
  53050. $ctx1.sendIdx["collection"]=9;
  53051. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53052. return (42);
  53053. }),(function(){
  53054. return (999);
  53055. }));
  53056. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53057. $self._assert_equals_($26,(42));
  53058. $ctx1.sendIdx["assert:equals:"]=10;
  53059. $29=$self._collection();
  53060. $ctx1.sendIdx["collection"]=10;
  53061. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53062. return col;
  53063. }),(function(){
  53064. return (999);
  53065. }));
  53066. $self._assert_equals_($28,$self._collection());
  53067. return self;
  53068. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53069. },
  53070. args: [],
  53071. 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.",
  53072. referencedClasses: [],
  53073. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53074. }),
  53075. $globals.CollectionTest);
  53076. $core.addMethod(
  53077. $core.method({
  53078. selector: "testIsEmpty",
  53079. protocol: "tests",
  53080. fn: function (){
  53081. var self=this,$self=this;
  53082. return $core.withContext(function($ctx1) {
  53083. var $1;
  53084. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53085. $ctx1.sendIdx["isEmpty"]=1;
  53086. $self._assert_($1);
  53087. $self._deny_($recv($self._collection())._isEmpty());
  53088. return self;
  53089. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53090. },
  53091. args: [],
  53092. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53093. referencedClasses: [],
  53094. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53095. }),
  53096. $globals.CollectionTest);
  53097. $core.addMethod(
  53098. $core.method({
  53099. selector: "testNoneSatisfy",
  53100. protocol: "tests",
  53101. fn: function (){
  53102. var self=this,$self=this;
  53103. var anyOne;
  53104. return $core.withContext(function($ctx1) {
  53105. var $1,$3,$2;
  53106. $1=$self._collection();
  53107. $ctx1.sendIdx["collection"]=1;
  53108. anyOne=$recv($1)._anyOne();
  53109. $3=$self._collection();
  53110. $ctx1.sendIdx["collection"]=2;
  53111. $2=$recv($3)._noneSatisfy_((function(each){
  53112. return $core.withContext(function($ctx2) {
  53113. return $recv(each).__eq(anyOne);
  53114. $ctx2.sendIdx["="]=1;
  53115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53116. }));
  53117. $ctx1.sendIdx["noneSatisfy:"]=1;
  53118. $self._deny_($2);
  53119. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53120. return $core.withContext(function($ctx2) {
  53121. return $recv(each).__eq($recv($globals.Object)._new());
  53122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53123. })));
  53124. return self;
  53125. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53126. },
  53127. args: [],
  53128. 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 ])",
  53129. referencedClasses: ["Object"],
  53130. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53131. }),
  53132. $globals.CollectionTest);
  53133. $core.addMethod(
  53134. $core.method({
  53135. selector: "testRegression1224",
  53136. protocol: "tests",
  53137. fn: function (){
  53138. var self=this,$self=this;
  53139. return $core.withContext(function($ctx1) {
  53140. var $3,$2,$1;
  53141. $3=$recv($self._collectionClass())._new();
  53142. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53143. }));
  53144. $2=$recv($3)._yourself();
  53145. $1=$recv($2)._size();
  53146. $self._assert_equals_($1,(0));
  53147. return self;
  53148. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53149. },
  53150. args: [],
  53151. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53152. referencedClasses: [],
  53153. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53154. }),
  53155. $globals.CollectionTest);
  53156. $core.addMethod(
  53157. $core.method({
  53158. selector: "testRemoveAll",
  53159. protocol: "tests",
  53160. fn: function (){
  53161. var self=this,$self=this;
  53162. return $core.withContext(function($ctx1) {
  53163. var $2,$1;
  53164. $2=$self._collection();
  53165. $recv($2)._removeAll();
  53166. $1=$recv($2)._yourself();
  53167. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53168. return self;
  53169. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53170. },
  53171. args: [],
  53172. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53173. referencedClasses: [],
  53174. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53175. }),
  53176. $globals.CollectionTest);
  53177. $core.addMethod(
  53178. $core.method({
  53179. selector: "testSelect",
  53180. protocol: "tests",
  53181. fn: function (){
  53182. var self=this,$self=this;
  53183. return $core.withContext(function($ctx1) {
  53184. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53185. $2=$self._collection();
  53186. $ctx1.sendIdx["collection"]=1;
  53187. $1=$recv($2)._select_((function(){
  53188. return false;
  53189. }));
  53190. $ctx1.sendIdx["select:"]=1;
  53191. $4=$self._collectionClass();
  53192. $ctx1.sendIdx["collectionClass"]=1;
  53193. $3=$recv($4)._new();
  53194. $ctx1.sendIdx["new"]=1;
  53195. $self._assert_equals_($1,$3);
  53196. $ctx1.sendIdx["assert:equals:"]=1;
  53197. $6=$self._collection();
  53198. $ctx1.sendIdx["collection"]=2;
  53199. $5=$recv($6)._select_((function(){
  53200. return true;
  53201. }));
  53202. $ctx1.sendIdx["select:"]=2;
  53203. $7=$self._collection();
  53204. $ctx1.sendIdx["collection"]=3;
  53205. $self._assert_equals_($5,$7);
  53206. $ctx1.sendIdx["assert:equals:"]=2;
  53207. $9=$self._collectionWithNewValue();
  53208. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53209. $8=$recv($9)._select_((function(each){
  53210. return $core.withContext(function($ctx2) {
  53211. $10=$self._sampleNewValue();
  53212. $ctx2.sendIdx["sampleNewValue"]=1;
  53213. return $recv(each).__eq($10);
  53214. $ctx2.sendIdx["="]=1;
  53215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53216. }));
  53217. $ctx1.sendIdx["select:"]=3;
  53218. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53219. $ctx1.sendIdx["assert:equals:"]=3;
  53220. $12=$self._collectionWithNewValue();
  53221. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53222. $11=$recv($12)._select_((function(each){
  53223. return $core.withContext(function($ctx2) {
  53224. $13=$self._sampleNewValue();
  53225. $ctx2.sendIdx["sampleNewValue"]=2;
  53226. return $recv(each).__tild_eq($13);
  53227. $ctx2.sendIdx["~="]=1;
  53228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53229. }));
  53230. $ctx1.sendIdx["select:"]=4;
  53231. $14=$self._collection();
  53232. $ctx1.sendIdx["collection"]=4;
  53233. $self._assert_equals_($11,$14);
  53234. $ctx1.sendIdx["assert:equals:"]=4;
  53235. $16=$self._collection();
  53236. $ctx1.sendIdx["collection"]=5;
  53237. $15=$recv($16)._select_((function(each){
  53238. return $core.withContext(function($ctx2) {
  53239. $17=$self._sampleNewValue();
  53240. $ctx2.sendIdx["sampleNewValue"]=3;
  53241. return $recv(each).__eq($17);
  53242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53243. }));
  53244. $ctx1.sendIdx["select:"]=5;
  53245. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53246. $ctx1.sendIdx["assert:equals:"]=5;
  53247. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53248. return $core.withContext(function($ctx2) {
  53249. return $recv(each).__tild_eq($self._sampleNewValue());
  53250. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53251. })),$self._collection());
  53252. return self;
  53253. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53254. },
  53255. args: [],
  53256. 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",
  53257. referencedClasses: [],
  53258. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53259. }),
  53260. $globals.CollectionTest);
  53261. $core.addMethod(
  53262. $core.method({
  53263. selector: "testSelectThenCollect",
  53264. protocol: "tests",
  53265. fn: function (){
  53266. var self=this,$self=this;
  53267. return $core.withContext(function($ctx1) {
  53268. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53269. $2=$self._collection();
  53270. $ctx1.sendIdx["collection"]=1;
  53271. $1=$recv($2)._select_thenCollect_((function(){
  53272. return false;
  53273. }),"isString");
  53274. $ctx1.sendIdx["select:thenCollect:"]=1;
  53275. $4=$self._collectionClass();
  53276. $ctx1.sendIdx["collectionClass"]=1;
  53277. $3=$recv($4)._new();
  53278. $ctx1.sendIdx["new"]=1;
  53279. $self._assert_equals_($1,$3);
  53280. $ctx1.sendIdx["assert:equals:"]=1;
  53281. $6=$self._collection();
  53282. $ctx1.sendIdx["collection"]=2;
  53283. $5=$recv($6)._select_thenCollect_((function(){
  53284. return true;
  53285. }),(function(x){
  53286. return x;
  53287. }));
  53288. $ctx1.sendIdx["select:thenCollect:"]=2;
  53289. $7=$self._collection();
  53290. $ctx1.sendIdx["collection"]=3;
  53291. $self._assert_equals_($5,$7);
  53292. $ctx1.sendIdx["assert:equals:"]=2;
  53293. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53294. return $core.withContext(function($ctx2) {
  53295. $9=$self._sampleNewValue();
  53296. $ctx2.sendIdx["sampleNewValue"]=1;
  53297. return $recv(each).__eq($9);
  53298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53299. }),(function(x){
  53300. return x;
  53301. }));
  53302. $ctx1.sendIdx["select:thenCollect:"]=3;
  53303. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53304. $ctx1.sendIdx["assert:equals:"]=3;
  53305. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53306. return $core.withContext(function($ctx2) {
  53307. return $recv(each).__tild_eq($self._sampleNewValue());
  53308. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53309. }),"printString"),$self._collectionOfPrintStrings());
  53310. return self;
  53311. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53312. },
  53313. args: [],
  53314. 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",
  53315. referencedClasses: [],
  53316. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53317. }),
  53318. $globals.CollectionTest);
  53319. $core.addMethod(
  53320. $core.method({
  53321. selector: "testSingle",
  53322. protocol: "tests",
  53323. fn: function (){
  53324. var self=this,$self=this;
  53325. return $core.withContext(function($ctx1) {
  53326. $self._should_raise_((function(){
  53327. return $core.withContext(function($ctx2) {
  53328. return $recv($recv($self._collectionClass())._new())._single();
  53329. $ctx2.sendIdx["single"]=1;
  53330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53331. }),$globals.Error);
  53332. $ctx1.sendIdx["should:raise:"]=1;
  53333. $self._should_raise_((function(){
  53334. return $core.withContext(function($ctx2) {
  53335. return $recv($self._collection())._single();
  53336. $ctx2.sendIdx["single"]=2;
  53337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53338. }),$globals.Error);
  53339. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53340. return self;
  53341. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53342. },
  53343. args: [],
  53344. 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",
  53345. referencedClasses: ["Error"],
  53346. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53347. }),
  53348. $globals.CollectionTest);
  53349. $core.addMethod(
  53350. $core.method({
  53351. selector: "testSize",
  53352. protocol: "tests",
  53353. fn: function (){
  53354. var self=this,$self=this;
  53355. return $core.withContext(function($ctx1) {
  53356. var $1,$2;
  53357. $1=$recv($recv($self._collectionClass())._new())._size();
  53358. $ctx1.sendIdx["size"]=1;
  53359. $self._assert_equals_($1,(0));
  53360. $ctx1.sendIdx["assert:equals:"]=1;
  53361. $2=$recv($self._sampleNewValueAsCollection())._size();
  53362. $ctx1.sendIdx["size"]=2;
  53363. $self._assert_equals_($2,(1));
  53364. $ctx1.sendIdx["assert:equals:"]=2;
  53365. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53366. return self;
  53367. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53368. },
  53369. args: [],
  53370. 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",
  53371. referencedClasses: [],
  53372. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53373. }),
  53374. $globals.CollectionTest);
  53375. $core.addMethod(
  53376. $core.method({
  53377. selector: "collectionClass",
  53378. protocol: "fixture",
  53379. fn: function (){
  53380. var self=this,$self=this;
  53381. return nil;
  53382. },
  53383. args: [],
  53384. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53385. referencedClasses: [],
  53386. messageSends: []
  53387. }),
  53388. $globals.CollectionTest.a$cls);
  53389. $core.addMethod(
  53390. $core.method({
  53391. selector: "isAbstract",
  53392. protocol: "testing",
  53393. fn: function (){
  53394. var self=this,$self=this;
  53395. return $core.withContext(function($ctx1) {
  53396. return $recv($self._collectionClass())._isNil();
  53397. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53398. },
  53399. args: [],
  53400. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53401. referencedClasses: [],
  53402. messageSends: ["isNil", "collectionClass"]
  53403. }),
  53404. $globals.CollectionTest.a$cls);
  53405. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53406. $core.addMethod(
  53407. $core.method({
  53408. selector: "collectionWithNewValue",
  53409. protocol: "fixture",
  53410. fn: function (){
  53411. var self=this,$self=this;
  53412. return $core.withContext(function($ctx1) {
  53413. $self._subclassResponsibility();
  53414. return self;
  53415. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53416. },
  53417. args: [],
  53418. 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",
  53419. referencedClasses: [],
  53420. messageSends: ["subclassResponsibility"]
  53421. }),
  53422. $globals.IndexableCollectionTest);
  53423. $core.addMethod(
  53424. $core.method({
  53425. selector: "nonIndexesDo:",
  53426. protocol: "fixture",
  53427. fn: function (aBlock){
  53428. var self=this,$self=this;
  53429. return $core.withContext(function($ctx1) {
  53430. $self._subclassResponsibility();
  53431. return self;
  53432. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53433. },
  53434. args: ["aBlock"],
  53435. 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",
  53436. referencedClasses: [],
  53437. messageSends: ["subclassResponsibility"]
  53438. }),
  53439. $globals.IndexableCollectionTest);
  53440. $core.addMethod(
  53441. $core.method({
  53442. selector: "sampleNewIndex",
  53443. protocol: "fixture",
  53444. fn: function (){
  53445. var self=this,$self=this;
  53446. return $core.withContext(function($ctx1) {
  53447. $self._subclassResponsibility();
  53448. return self;
  53449. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53450. },
  53451. args: [],
  53452. 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",
  53453. referencedClasses: [],
  53454. messageSends: ["subclassResponsibility"]
  53455. }),
  53456. $globals.IndexableCollectionTest);
  53457. $core.addMethod(
  53458. $core.method({
  53459. selector: "samplesDo:",
  53460. protocol: "fixture",
  53461. fn: function (aBlock){
  53462. var self=this,$self=this;
  53463. return $core.withContext(function($ctx1) {
  53464. $self._subclassResponsibility();
  53465. return self;
  53466. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53467. },
  53468. args: ["aBlock"],
  53469. 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",
  53470. referencedClasses: [],
  53471. messageSends: ["subclassResponsibility"]
  53472. }),
  53473. $globals.IndexableCollectionTest);
  53474. $core.addMethod(
  53475. $core.method({
  53476. selector: "testAt",
  53477. protocol: "tests",
  53478. fn: function (){
  53479. var self=this,$self=this;
  53480. return $core.withContext(function($ctx1) {
  53481. var $1;
  53482. $self._nonIndexesDo_((function(each){
  53483. return $core.withContext(function($ctx2) {
  53484. return $self._should_raise_((function(){
  53485. return $core.withContext(function($ctx3) {
  53486. $1=$self._collection();
  53487. $ctx3.sendIdx["collection"]=1;
  53488. return $recv($1)._at_(each);
  53489. $ctx3.sendIdx["at:"]=1;
  53490. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53491. }),$globals.Error);
  53492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53493. }));
  53494. $self._samplesDo_((function(index,value){
  53495. return $core.withContext(function($ctx2) {
  53496. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53497. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53498. }));
  53499. return self;
  53500. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53501. },
  53502. args: [],
  53503. 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 ]",
  53504. referencedClasses: ["Error"],
  53505. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53506. }),
  53507. $globals.IndexableCollectionTest);
  53508. $core.addMethod(
  53509. $core.method({
  53510. selector: "testAtIfAbsent",
  53511. protocol: "tests",
  53512. fn: function (){
  53513. var self=this,$self=this;
  53514. return $core.withContext(function($ctx1) {
  53515. var $2,$1,$3;
  53516. $self._nonIndexesDo_((function(each){
  53517. return $core.withContext(function($ctx2) {
  53518. $2=$self._collection();
  53519. $ctx2.sendIdx["collection"]=1;
  53520. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53521. return $core.withContext(function($ctx3) {
  53522. return $self._sampleNewValue();
  53523. $ctx3.sendIdx["sampleNewValue"]=1;
  53524. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53525. }));
  53526. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53527. $3=$self._sampleNewValue();
  53528. $ctx2.sendIdx["sampleNewValue"]=2;
  53529. return $self._assert_equals_($1,$3);
  53530. $ctx2.sendIdx["assert:equals:"]=1;
  53531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53532. }));
  53533. $self._samplesDo_((function(index,value){
  53534. return $core.withContext(function($ctx2) {
  53535. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53536. return $core.withContext(function($ctx3) {
  53537. return $self._sampleNewValue();
  53538. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53539. })),value);
  53540. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53541. }));
  53542. return self;
  53543. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53544. },
  53545. args: [],
  53546. 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 ].",
  53547. referencedClasses: [],
  53548. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53549. }),
  53550. $globals.IndexableCollectionTest);
  53551. $core.addMethod(
  53552. $core.method({
  53553. selector: "testAtIfAbsentPut",
  53554. protocol: "tests",
  53555. fn: function (){
  53556. var self=this,$self=this;
  53557. var newCollection;
  53558. return $core.withContext(function($ctx1) {
  53559. var $1;
  53560. newCollection=$self._collection();
  53561. $ctx1.sendIdx["collection"]=1;
  53562. $self._samplesDo_((function(index,value){
  53563. return $core.withContext(function($ctx2) {
  53564. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53565. return $core.withContext(function($ctx3) {
  53566. return $self._sampleNewValue();
  53567. $ctx3.sendIdx["sampleNewValue"]=1;
  53568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53569. }));
  53570. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53571. return $self._assert_equals_($1,value);
  53572. $ctx2.sendIdx["assert:equals:"]=1;
  53573. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53574. }));
  53575. $self._assert_equals_(newCollection,$self._collection());
  53576. $ctx1.sendIdx["assert:equals:"]=2;
  53577. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53578. return $core.withContext(function($ctx2) {
  53579. return $self._sampleNewValue();
  53580. $ctx2.sendIdx["sampleNewValue"]=2;
  53581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53582. })),$self._sampleNewValue());
  53583. $ctx1.sendIdx["assert:equals:"]=3;
  53584. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53585. return self;
  53586. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53587. },
  53588. args: [],
  53589. 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",
  53590. referencedClasses: [],
  53591. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53592. }),
  53593. $globals.IndexableCollectionTest);
  53594. $core.addMethod(
  53595. $core.method({
  53596. selector: "testAtIfPresent",
  53597. protocol: "tests",
  53598. fn: function (){
  53599. var self=this,$self=this;
  53600. var visited,sentinel;
  53601. return $core.withContext(function($ctx1) {
  53602. var $2,$1,$4,$3;
  53603. sentinel=$recv($globals.Object)._new();
  53604. $self._nonIndexesDo_((function(each){
  53605. return $core.withContext(function($ctx2) {
  53606. visited=nil;
  53607. visited;
  53608. $2=$self._collection();
  53609. $ctx2.sendIdx["collection"]=1;
  53610. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53611. visited=value1;
  53612. visited;
  53613. return sentinel;
  53614. }));
  53615. $ctx2.sendIdx["at:ifPresent:"]=1;
  53616. $self._assert_equals_($1,nil);
  53617. $ctx2.sendIdx["assert:equals:"]=1;
  53618. return $self._assert_($recv(visited)._isNil());
  53619. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53620. }));
  53621. $self._samplesDo_((function(index,value){
  53622. return $core.withContext(function($ctx2) {
  53623. visited=nil;
  53624. visited;
  53625. $4=$self._collection();
  53626. $ctx2.sendIdx["collection"]=2;
  53627. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53628. visited=value2;
  53629. visited;
  53630. return sentinel;
  53631. }));
  53632. $self._assert_equals_($3,sentinel);
  53633. $ctx2.sendIdx["assert:equals:"]=2;
  53634. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53635. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53636. }));
  53637. return self;
  53638. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53639. },
  53640. args: [],
  53641. 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) ]",
  53642. referencedClasses: ["Object"],
  53643. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53644. }),
  53645. $globals.IndexableCollectionTest);
  53646. $core.addMethod(
  53647. $core.method({
  53648. selector: "testAtIfPresentIfAbsent",
  53649. protocol: "tests",
  53650. fn: function (){
  53651. var self=this,$self=this;
  53652. var visited,sentinel;
  53653. return $core.withContext(function($ctx1) {
  53654. var $2,$1,$3,$5,$4;
  53655. sentinel=$recv($globals.Object)._new();
  53656. $self._nonIndexesDo_((function(each){
  53657. return $core.withContext(function($ctx2) {
  53658. visited=nil;
  53659. visited;
  53660. $2=$self._collection();
  53661. $ctx2.sendIdx["collection"]=1;
  53662. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53663. visited=value1;
  53664. visited;
  53665. return sentinel;
  53666. }),(function(){
  53667. return $core.withContext(function($ctx3) {
  53668. return $self._sampleNewValue();
  53669. $ctx3.sendIdx["sampleNewValue"]=1;
  53670. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53671. }));
  53672. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53673. $3=$self._sampleNewValue();
  53674. $ctx2.sendIdx["sampleNewValue"]=2;
  53675. $self._assert_equals_($1,$3);
  53676. $ctx2.sendIdx["assert:equals:"]=1;
  53677. return $self._assert_($recv(visited)._isNil());
  53678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53679. }));
  53680. $self._samplesDo_((function(index,value){
  53681. return $core.withContext(function($ctx2) {
  53682. visited=nil;
  53683. visited;
  53684. $5=$self._collection();
  53685. $ctx2.sendIdx["collection"]=2;
  53686. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53687. visited=value2;
  53688. visited;
  53689. return sentinel;
  53690. }),(function(){
  53691. return $core.withContext(function($ctx3) {
  53692. return $self._sampleNewValue();
  53693. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53694. }));
  53695. $self._assert_equals_($4,sentinel);
  53696. $ctx2.sendIdx["assert:equals:"]=2;
  53697. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53698. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53699. }));
  53700. return self;
  53701. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53702. },
  53703. args: [],
  53704. 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) ]",
  53705. referencedClasses: ["Object"],
  53706. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53707. }),
  53708. $globals.IndexableCollectionTest);
  53709. $core.addMethod(
  53710. $core.method({
  53711. selector: "testAtPut",
  53712. protocol: "tests",
  53713. fn: function (){
  53714. var self=this,$self=this;
  53715. var newCollection;
  53716. return $core.withContext(function($ctx1) {
  53717. newCollection=$self._collection();
  53718. $ctx1.sendIdx["collection"]=1;
  53719. $self._samplesDo_((function(index,value){
  53720. return $core.withContext(function($ctx2) {
  53721. return $recv(newCollection)._at_put_(index,value);
  53722. $ctx2.sendIdx["at:put:"]=1;
  53723. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53724. }));
  53725. $self._assert_equals_(newCollection,$self._collection());
  53726. $ctx1.sendIdx["assert:equals:"]=1;
  53727. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  53728. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53729. return self;
  53730. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53731. },
  53732. args: [],
  53733. 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",
  53734. referencedClasses: [],
  53735. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  53736. }),
  53737. $globals.IndexableCollectionTest);
  53738. $core.addMethod(
  53739. $core.method({
  53740. selector: "testIndexOf",
  53741. protocol: "tests",
  53742. fn: function (){
  53743. var self=this,$self=this;
  53744. return $core.withContext(function($ctx1) {
  53745. var $1;
  53746. $self._should_raise_((function(){
  53747. return $core.withContext(function($ctx2) {
  53748. $1=$self._collection();
  53749. $ctx2.sendIdx["collection"]=1;
  53750. return $recv($1)._indexOf_($self._sampleNewValue());
  53751. $ctx2.sendIdx["indexOf:"]=1;
  53752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53753. }),$globals.Error);
  53754. $self._samplesDo_((function(index,value){
  53755. return $core.withContext(function($ctx2) {
  53756. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  53757. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  53758. }));
  53759. return self;
  53760. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  53761. },
  53762. args: [],
  53763. 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 ]",
  53764. referencedClasses: ["Error"],
  53765. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  53766. }),
  53767. $globals.IndexableCollectionTest);
  53768. $core.addMethod(
  53769. $core.method({
  53770. selector: "testIndexOfWithNull",
  53771. protocol: "tests",
  53772. fn: function (){
  53773. var self=this,$self=this;
  53774. var jsNull;
  53775. return $core.withContext(function($ctx1) {
  53776. var $2,$1;
  53777. jsNull=$recv($globals.JSON)._parse_("null");
  53778. $self._samplesDo_((function(index,value){
  53779. return $core.withContext(function($ctx2) {
  53780. $2=$self._collection();
  53781. $recv($2)._at_put_(index,jsNull);
  53782. $1=$recv($2)._indexOf_(jsNull);
  53783. return $self._assert_equals_($1,index);
  53784. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53785. }));
  53786. return self;
  53787. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  53788. },
  53789. args: [],
  53790. 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 ]",
  53791. referencedClasses: ["JSON"],
  53792. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  53793. }),
  53794. $globals.IndexableCollectionTest);
  53795. $core.addMethod(
  53796. $core.method({
  53797. selector: "testWithIndexDo",
  53798. protocol: "tests",
  53799. fn: function (){
  53800. var self=this,$self=this;
  53801. var collection;
  53802. return $core.withContext(function($ctx1) {
  53803. collection=$self._collection();
  53804. $ctx1.sendIdx["collection"]=1;
  53805. $recv($self._collection())._withIndexDo_((function(each,index){
  53806. return $core.withContext(function($ctx2) {
  53807. return $self._assert_equals_($recv(collection)._at_(index),each);
  53808. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  53809. }));
  53810. return self;
  53811. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  53812. },
  53813. args: [],
  53814. 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 ]",
  53815. referencedClasses: [],
  53816. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  53817. }),
  53818. $globals.IndexableCollectionTest);
  53819. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  53820. $core.addMethod(
  53821. $core.method({
  53822. selector: "collectionKeys",
  53823. protocol: "fixture",
  53824. fn: function (){
  53825. var self=this,$self=this;
  53826. return $core.withContext(function($ctx1) {
  53827. $self._subclassResponsibility();
  53828. return self;
  53829. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  53830. },
  53831. args: [],
  53832. source: "collectionKeys\x0a\x09self subclassResponsibility",
  53833. referencedClasses: [],
  53834. messageSends: ["subclassResponsibility"]
  53835. }),
  53836. $globals.AssociativeCollectionTest);
  53837. $core.addMethod(
  53838. $core.method({
  53839. selector: "collectionValues",
  53840. protocol: "fixture",
  53841. fn: function (){
  53842. var self=this,$self=this;
  53843. return $core.withContext(function($ctx1) {
  53844. $self._subclassResponsibility();
  53845. return self;
  53846. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  53847. },
  53848. args: [],
  53849. source: "collectionValues\x0a\x09self subclassResponsibility",
  53850. referencedClasses: [],
  53851. messageSends: ["subclassResponsibility"]
  53852. }),
  53853. $globals.AssociativeCollectionTest);
  53854. $core.addMethod(
  53855. $core.method({
  53856. selector: "nonIndexesDo:",
  53857. protocol: "fixture",
  53858. fn: function (aBlock){
  53859. var self=this,$self=this;
  53860. return $core.withContext(function($ctx1) {
  53861. $recv(aBlock)._value_((5));
  53862. $ctx1.sendIdx["value:"]=1;
  53863. $recv(aBlock)._value_((function(){
  53864. }));
  53865. $ctx1.sendIdx["value:"]=2;
  53866. $recv(aBlock)._value_($recv($globals.Object)._new());
  53867. $ctx1.sendIdx["value:"]=3;
  53868. $recv(aBlock)._value_("z");
  53869. return self;
  53870. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53871. },
  53872. args: ["aBlock"],
  53873. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  53874. referencedClasses: ["Object"],
  53875. messageSends: ["value:", "new"]
  53876. }),
  53877. $globals.AssociativeCollectionTest);
  53878. $core.addMethod(
  53879. $core.method({
  53880. selector: "sampleNewIndex",
  53881. protocol: "fixture",
  53882. fn: function (){
  53883. var self=this,$self=this;
  53884. return "new";
  53885. },
  53886. args: [],
  53887. source: "sampleNewIndex\x0a\x09^ 'new'",
  53888. referencedClasses: [],
  53889. messageSends: []
  53890. }),
  53891. $globals.AssociativeCollectionTest);
  53892. $core.addMethod(
  53893. $core.method({
  53894. selector: "samplesDo:",
  53895. protocol: "fixture",
  53896. fn: function (aBlock){
  53897. var self=this,$self=this;
  53898. return $core.withContext(function($ctx1) {
  53899. $recv(aBlock)._value_value_("a",(2));
  53900. return self;
  53901. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53902. },
  53903. args: ["aBlock"],
  53904. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  53905. referencedClasses: [],
  53906. messageSends: ["value:value:"]
  53907. }),
  53908. $globals.AssociativeCollectionTest);
  53909. $core.addMethod(
  53910. $core.method({
  53911. selector: "testAddAll",
  53912. protocol: "tests",
  53913. fn: function (){
  53914. var self=this,$self=this;
  53915. return $core.withContext(function($ctx1) {
  53916. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  53917. (
  53918. $ctx1.supercall = true,
  53919. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  53920. $ctx1.supercall = false;
  53921. $2=$self._collection();
  53922. $ctx1.sendIdx["collection"]=1;
  53923. $3=$self._collection();
  53924. $ctx1.sendIdx["collection"]=2;
  53925. $recv($2)._addAll_($3);
  53926. $ctx1.sendIdx["addAll:"]=1;
  53927. $4=$recv($2)._yourself();
  53928. $ctx1.sendIdx["yourself"]=1;
  53929. $1=$4;
  53930. $5=$self._collection();
  53931. $ctx1.sendIdx["collection"]=3;
  53932. $self._assert_equals_($1,$5);
  53933. $ctx1.sendIdx["assert:equals:"]=1;
  53934. $7=$self._collection();
  53935. $ctx1.sendIdx["collection"]=4;
  53936. $8=$self._collectionWithNewValue();
  53937. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53938. $recv($7)._addAll_($8);
  53939. $ctx1.sendIdx["addAll:"]=2;
  53940. $9=$recv($7)._yourself();
  53941. $ctx1.sendIdx["yourself"]=2;
  53942. $6=$9;
  53943. $10=$self._collectionWithNewValue();
  53944. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53945. $self._assert_equals_($6,$10);
  53946. $ctx1.sendIdx["assert:equals:"]=2;
  53947. $12=$self._collectionWithNewValue();
  53948. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53949. $recv($12)._addAll_($self._collection());
  53950. $11=$recv($12)._yourself();
  53951. $self._assert_equals_($11,$self._collectionWithNewValue());
  53952. return self;
  53953. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  53954. },
  53955. args: [],
  53956. 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",
  53957. referencedClasses: [],
  53958. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53959. }),
  53960. $globals.AssociativeCollectionTest);
  53961. $core.addMethod(
  53962. $core.method({
  53963. selector: "testAsDictionary",
  53964. protocol: "tests",
  53965. fn: function (){
  53966. var self=this,$self=this;
  53967. return $core.withContext(function($ctx1) {
  53968. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  53969. return self;
  53970. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  53971. },
  53972. args: [],
  53973. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  53974. referencedClasses: ["Dictionary"],
  53975. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  53976. }),
  53977. $globals.AssociativeCollectionTest);
  53978. $core.addMethod(
  53979. $core.method({
  53980. selector: "testAsHashedCollection",
  53981. protocol: "tests",
  53982. fn: function (){
  53983. var self=this,$self=this;
  53984. return $core.withContext(function($ctx1) {
  53985. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  53986. return self;
  53987. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  53988. },
  53989. args: [],
  53990. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  53991. referencedClasses: ["HashedCollection"],
  53992. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  53993. }),
  53994. $globals.AssociativeCollectionTest);
  53995. $core.addMethod(
  53996. $core.method({
  53997. selector: "testComma",
  53998. protocol: "tests",
  53999. fn: function (){
  54000. var self=this,$self=this;
  54001. return $core.withContext(function($ctx1) {
  54002. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54003. (
  54004. $ctx1.supercall = true,
  54005. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54006. $ctx1.supercall = false;
  54007. $2=$self._collection();
  54008. $ctx1.sendIdx["collection"]=1;
  54009. $3=$self._collection();
  54010. $ctx1.sendIdx["collection"]=2;
  54011. $1=$recv($2).__comma($3);
  54012. $ctx1.sendIdx[","]=1;
  54013. $4=$self._collection();
  54014. $ctx1.sendIdx["collection"]=3;
  54015. $self._assert_equals_($1,$4);
  54016. $ctx1.sendIdx["assert:equals:"]=1;
  54017. $6=$self._collection();
  54018. $ctx1.sendIdx["collection"]=4;
  54019. $7=$self._collectionWithNewValue();
  54020. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54021. $5=$recv($6).__comma($7);
  54022. $ctx1.sendIdx[","]=2;
  54023. $8=$self._collectionWithNewValue();
  54024. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54025. $self._assert_equals_($5,$8);
  54026. $ctx1.sendIdx["assert:equals:"]=2;
  54027. $10=$self._collectionWithNewValue();
  54028. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54029. $9=$recv($10).__comma($self._collection());
  54030. $self._assert_equals_($9,$self._collectionWithNewValue());
  54031. return self;
  54032. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54033. },
  54034. args: [],
  54035. 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",
  54036. referencedClasses: [],
  54037. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54038. }),
  54039. $globals.AssociativeCollectionTest);
  54040. $core.addMethod(
  54041. $core.method({
  54042. selector: "testFrom",
  54043. protocol: "tests",
  54044. fn: function (){
  54045. var self=this,$self=this;
  54046. var associations;
  54047. return $core.withContext(function($ctx1) {
  54048. var $1;
  54049. $1="a".__minus_gt((1));
  54050. $ctx1.sendIdx["->"]=1;
  54051. associations=[$1,"b".__minus_gt((2))];
  54052. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54053. return self;
  54054. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54055. },
  54056. args: [],
  54057. 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 }.",
  54058. referencedClasses: [],
  54059. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54060. }),
  54061. $globals.AssociativeCollectionTest);
  54062. $core.addMethod(
  54063. $core.method({
  54064. selector: "testKeys",
  54065. protocol: "tests",
  54066. fn: function (){
  54067. var self=this,$self=this;
  54068. return $core.withContext(function($ctx1) {
  54069. var $2,$1,$3,$4;
  54070. $2=$recv($recv($self._collectionClass())._new())._keys();
  54071. $ctx1.sendIdx["keys"]=1;
  54072. $1=$recv($2)._isEmpty();
  54073. $self._assert_($1);
  54074. $3=$recv($self._collection())._keys();
  54075. $ctx1.sendIdx["keys"]=2;
  54076. $4=$self._collectionKeys();
  54077. $ctx1.sendIdx["collectionKeys"]=1;
  54078. $self._assertSameContents_as_($3,$4);
  54079. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54080. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54081. return self;
  54082. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54083. },
  54084. args: [],
  54085. 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 }",
  54086. referencedClasses: [],
  54087. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54088. }),
  54089. $globals.AssociativeCollectionTest);
  54090. $core.addMethod(
  54091. $core.method({
  54092. selector: "testNewFromPairs",
  54093. protocol: "tests",
  54094. fn: function (){
  54095. var self=this,$self=this;
  54096. var flattenedAssociations;
  54097. return $core.withContext(function($ctx1) {
  54098. flattenedAssociations=["a",(1),"b",(2)];
  54099. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54100. return self;
  54101. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54102. },
  54103. args: [],
  54104. 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 }.",
  54105. referencedClasses: [],
  54106. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54107. }),
  54108. $globals.AssociativeCollectionTest);
  54109. $core.addMethod(
  54110. $core.method({
  54111. selector: "testPrintString",
  54112. protocol: "tests",
  54113. fn: function (){
  54114. var self=this,$self=this;
  54115. return $core.withContext(function($ctx1) {
  54116. var $3,$2,$1,$4;
  54117. $3=$self._collectionClass();
  54118. $ctx1.sendIdx["collectionClass"]=1;
  54119. $2=$recv($3)._new();
  54120. $recv($2)._at_put_("firstname","James");
  54121. $ctx1.sendIdx["at:put:"]=1;
  54122. $recv($2)._at_put_("lastname","Bond");
  54123. $1=$recv($2)._printString();
  54124. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54125. $ctx1.sendIdx[","]=1;
  54126. $self._assert_equals_($1,$4);
  54127. return self;
  54128. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54129. },
  54130. args: [],
  54131. 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'')'",
  54132. referencedClasses: [],
  54133. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54134. }),
  54135. $globals.AssociativeCollectionTest);
  54136. $core.addMethod(
  54137. $core.method({
  54138. selector: "testRemoveKey",
  54139. protocol: "tests",
  54140. fn: function (){
  54141. var self=this,$self=this;
  54142. return $core.withContext(function($ctx1) {
  54143. var $1,$2,$3,$5,$6,$4,$8,$7;
  54144. $self._nonIndexesDo_((function(each){
  54145. var collection;
  54146. return $core.withContext(function($ctx2) {
  54147. collection=$self._collection();
  54148. $ctx2.sendIdx["collection"]=1;
  54149. collection;
  54150. $self._should_raise_((function(){
  54151. return $core.withContext(function($ctx3) {
  54152. return $recv(collection)._removeKey_(each);
  54153. $ctx3.sendIdx["removeKey:"]=1;
  54154. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54155. }),$globals.Error);
  54156. $1=collection;
  54157. $2=$self._collection();
  54158. $ctx2.sendIdx["collection"]=2;
  54159. return $self._assert_equals_($1,$2);
  54160. $ctx2.sendIdx["assert:equals:"]=1;
  54161. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54162. }));
  54163. $self._samplesDo_((function(index,value){
  54164. var collection;
  54165. return $core.withContext(function($ctx2) {
  54166. collection=$self._collection();
  54167. $ctx2.sendIdx["collection"]=3;
  54168. collection;
  54169. $3=$recv(collection)._removeKey_(index);
  54170. $ctx2.sendIdx["removeKey:"]=2;
  54171. $self._assert_equals_($3,value);
  54172. $ctx2.sendIdx["assert:equals:"]=2;
  54173. $5=collection;
  54174. $6=$self._collection();
  54175. $ctx2.sendIdx["collection"]=4;
  54176. $4=$recv($5).__eq($6);
  54177. return $self._deny_($4);
  54178. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54179. }));
  54180. $8=$self._collectionWithNewValue();
  54181. $recv($8)._removeKey_($self._sampleNewIndex());
  54182. $7=$recv($8)._yourself();
  54183. $self._assert_equals_($7,$self._collection());
  54184. return self;
  54185. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54186. },
  54187. args: [],
  54188. 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",
  54189. referencedClasses: ["Error"],
  54190. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54191. }),
  54192. $globals.AssociativeCollectionTest);
  54193. $core.addMethod(
  54194. $core.method({
  54195. selector: "testRemoveKeyIfAbsent",
  54196. protocol: "tests",
  54197. fn: function (){
  54198. var self=this,$self=this;
  54199. return $core.withContext(function($ctx1) {
  54200. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54201. $self._nonIndexesDo_((function(each){
  54202. var collection;
  54203. return $core.withContext(function($ctx2) {
  54204. collection=$self._collection();
  54205. $ctx2.sendIdx["collection"]=1;
  54206. collection;
  54207. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54208. return $core.withContext(function($ctx3) {
  54209. return $self._sampleNewValue();
  54210. $ctx3.sendIdx["sampleNewValue"]=1;
  54211. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54212. }));
  54213. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54214. $2=$self._sampleNewValue();
  54215. $ctx2.sendIdx["sampleNewValue"]=2;
  54216. $self._assert_equals_($1,$2);
  54217. $ctx2.sendIdx["assert:equals:"]=1;
  54218. $3=collection;
  54219. $4=$self._collection();
  54220. $ctx2.sendIdx["collection"]=2;
  54221. return $self._assert_equals_($3,$4);
  54222. $ctx2.sendIdx["assert:equals:"]=2;
  54223. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54224. }));
  54225. $self._samplesDo_((function(index,value){
  54226. var collection;
  54227. return $core.withContext(function($ctx2) {
  54228. collection=$self._collection();
  54229. $ctx2.sendIdx["collection"]=3;
  54230. collection;
  54231. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54232. return $core.withContext(function($ctx3) {
  54233. return $self._sampleNewValue();
  54234. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54235. }));
  54236. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54237. $self._assert_equals_($5,value);
  54238. $ctx2.sendIdx["assert:equals:"]=3;
  54239. $7=collection;
  54240. $8=$self._collection();
  54241. $ctx2.sendIdx["collection"]=4;
  54242. $6=$recv($7).__eq($8);
  54243. return $self._deny_($6);
  54244. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54245. }));
  54246. $10=$self._collectionWithNewValue();
  54247. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54248. return $core.withContext(function($ctx2) {
  54249. return $self._assert_(false);
  54250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54251. }));
  54252. $9=$recv($10)._yourself();
  54253. $self._assert_equals_($9,$self._collection());
  54254. return self;
  54255. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54256. },
  54257. args: [],
  54258. 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",
  54259. referencedClasses: [],
  54260. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54261. }),
  54262. $globals.AssociativeCollectionTest);
  54263. $core.addMethod(
  54264. $core.method({
  54265. selector: "testValues",
  54266. protocol: "tests",
  54267. fn: function (){
  54268. var self=this,$self=this;
  54269. return $core.withContext(function($ctx1) {
  54270. var $2,$1,$3,$4;
  54271. $2=$recv($recv($self._collectionClass())._new())._values();
  54272. $ctx1.sendIdx["values"]=1;
  54273. $1=$recv($2)._isEmpty();
  54274. $self._assert_($1);
  54275. $3=$recv($self._collection())._values();
  54276. $ctx1.sendIdx["values"]=2;
  54277. $4=$self._collectionValues();
  54278. $ctx1.sendIdx["collectionValues"]=1;
  54279. $self._assertSameContents_as_($3,$4);
  54280. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54281. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54282. return self;
  54283. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54284. },
  54285. args: [],
  54286. 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 }",
  54287. referencedClasses: [],
  54288. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54289. }),
  54290. $globals.AssociativeCollectionTest);
  54291. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54292. $core.addMethod(
  54293. $core.method({
  54294. selector: "collection",
  54295. protocol: "fixture",
  54296. fn: function (){
  54297. var self=this,$self=this;
  54298. return $core.withContext(function($ctx1) {
  54299. var $1;
  54300. $1=$recv($globals.Dictionary)._new();
  54301. $recv($1)._at_put_((1),(1));
  54302. $ctx1.sendIdx["at:put:"]=1;
  54303. $recv($1)._at_put_("a",(2));
  54304. $ctx1.sendIdx["at:put:"]=2;
  54305. $recv($1)._at_put_(true,(3));
  54306. $ctx1.sendIdx["at:put:"]=3;
  54307. $recv($1)._at_put_((1).__at((3)),(-4));
  54308. $ctx1.sendIdx["at:put:"]=4;
  54309. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54310. return $recv($1)._yourself();
  54311. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54312. },
  54313. args: [],
  54314. 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",
  54315. referencedClasses: ["Dictionary"],
  54316. messageSends: ["at:put:", "new", "@", "yourself"]
  54317. }),
  54318. $globals.DictionaryTest);
  54319. $core.addMethod(
  54320. $core.method({
  54321. selector: "collectionKeys",
  54322. protocol: "fixture",
  54323. fn: function (){
  54324. var self=this,$self=this;
  54325. return $core.withContext(function($ctx1) {
  54326. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54327. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54328. },
  54329. args: [],
  54330. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54331. referencedClasses: [],
  54332. messageSends: ["@"]
  54333. }),
  54334. $globals.DictionaryTest);
  54335. $core.addMethod(
  54336. $core.method({
  54337. selector: "collectionOfPrintStrings",
  54338. protocol: "fixture",
  54339. fn: function (){
  54340. var self=this,$self=this;
  54341. return $core.withContext(function($ctx1) {
  54342. var $1;
  54343. $1=$recv($globals.Dictionary)._new();
  54344. $recv($1)._at_put_((1),"1");
  54345. $ctx1.sendIdx["at:put:"]=1;
  54346. $recv($1)._at_put_("a","2");
  54347. $ctx1.sendIdx["at:put:"]=2;
  54348. $recv($1)._at_put_(true,"3");
  54349. $ctx1.sendIdx["at:put:"]=3;
  54350. $recv($1)._at_put_((1).__at((3)),"-4");
  54351. $ctx1.sendIdx["at:put:"]=4;
  54352. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54353. return $recv($1)._yourself();
  54354. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54355. },
  54356. args: [],
  54357. 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",
  54358. referencedClasses: ["Dictionary"],
  54359. messageSends: ["at:put:", "new", "@", "yourself"]
  54360. }),
  54361. $globals.DictionaryTest);
  54362. $core.addMethod(
  54363. $core.method({
  54364. selector: "collectionSize",
  54365. protocol: "fixture",
  54366. fn: function (){
  54367. var self=this,$self=this;
  54368. return (5);
  54369. },
  54370. args: [],
  54371. source: "collectionSize\x0a\x09^ 5",
  54372. referencedClasses: [],
  54373. messageSends: []
  54374. }),
  54375. $globals.DictionaryTest);
  54376. $core.addMethod(
  54377. $core.method({
  54378. selector: "collectionValues",
  54379. protocol: "fixture",
  54380. fn: function (){
  54381. var self=this,$self=this;
  54382. return [(1),(2),(3),(-4),(9)];
  54383. },
  54384. args: [],
  54385. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54386. referencedClasses: [],
  54387. messageSends: []
  54388. }),
  54389. $globals.DictionaryTest);
  54390. $core.addMethod(
  54391. $core.method({
  54392. selector: "collectionWithDuplicates",
  54393. protocol: "fixture",
  54394. fn: function (){
  54395. var self=this,$self=this;
  54396. return $core.withContext(function($ctx1) {
  54397. var $1;
  54398. $1=$recv($globals.Dictionary)._new();
  54399. $recv($1)._at_put_((1),(1));
  54400. $ctx1.sendIdx["at:put:"]=1;
  54401. $recv($1)._at_put_("a",(2));
  54402. $ctx1.sendIdx["at:put:"]=2;
  54403. $recv($1)._at_put_(true,(3));
  54404. $ctx1.sendIdx["at:put:"]=3;
  54405. $recv($1)._at_put_((4),(-4));
  54406. $ctx1.sendIdx["at:put:"]=4;
  54407. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54408. $ctx1.sendIdx["at:put:"]=5;
  54409. $recv($1)._at_put_("b",(1));
  54410. $ctx1.sendIdx["at:put:"]=6;
  54411. $recv($1)._at_put_((3),(3));
  54412. $ctx1.sendIdx["at:put:"]=7;
  54413. $recv($1)._at_put_(false,(12));
  54414. return $recv($1)._yourself();
  54415. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54416. },
  54417. args: [],
  54418. 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",
  54419. referencedClasses: ["Dictionary"],
  54420. messageSends: ["at:put:", "new", "yourself"]
  54421. }),
  54422. $globals.DictionaryTest);
  54423. $core.addMethod(
  54424. $core.method({
  54425. selector: "collectionWithNewValue",
  54426. protocol: "fixture",
  54427. fn: function (){
  54428. var self=this,$self=this;
  54429. return $core.withContext(function($ctx1) {
  54430. var $1;
  54431. $1=$recv($globals.Dictionary)._new();
  54432. $recv($1)._at_put_((1),(1));
  54433. $ctx1.sendIdx["at:put:"]=1;
  54434. $recv($1)._at_put_("a",(2));
  54435. $ctx1.sendIdx["at:put:"]=2;
  54436. $recv($1)._at_put_(true,(3));
  54437. $ctx1.sendIdx["at:put:"]=3;
  54438. $recv($1)._at_put_((1).__at((3)),(-4));
  54439. $ctx1.sendIdx["at:put:"]=4;
  54440. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54441. $ctx1.sendIdx["at:put:"]=5;
  54442. $recv($1)._at_put_("new","N");
  54443. return $recv($1)._yourself();
  54444. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54445. },
  54446. args: [],
  54447. 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",
  54448. referencedClasses: ["Dictionary"],
  54449. messageSends: ["at:put:", "new", "@", "yourself"]
  54450. }),
  54451. $globals.DictionaryTest);
  54452. $core.addMethod(
  54453. $core.method({
  54454. selector: "sampleNewValueAsCollection",
  54455. protocol: "fixture",
  54456. fn: function (){
  54457. var self=this,$self=this;
  54458. return $core.withContext(function($ctx1) {
  54459. var $1;
  54460. $1=$recv($globals.Dictionary)._new();
  54461. $recv($1)._at_put_("new","N");
  54462. return $recv($1)._yourself();
  54463. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54464. },
  54465. args: [],
  54466. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54467. referencedClasses: ["Dictionary"],
  54468. messageSends: ["at:put:", "new", "yourself"]
  54469. }),
  54470. $globals.DictionaryTest);
  54471. $core.addMethod(
  54472. $core.method({
  54473. selector: "samplesDo:",
  54474. protocol: "fixture",
  54475. fn: function (aBlock){
  54476. var self=this,$self=this;
  54477. return $core.withContext(function($ctx1) {
  54478. (
  54479. $ctx1.supercall = true,
  54480. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54481. $ctx1.supercall = false;
  54482. $recv(aBlock)._value_value_(true,(3));
  54483. $ctx1.sendIdx["value:value:"]=1;
  54484. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54485. $ctx1.sendIdx["value:value:"]=2;
  54486. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54487. return self;
  54488. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54489. },
  54490. args: ["aBlock"],
  54491. 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",
  54492. referencedClasses: [],
  54493. messageSends: ["samplesDo:", "value:value:", "@"]
  54494. }),
  54495. $globals.DictionaryTest);
  54496. $core.addMethod(
  54497. $core.method({
  54498. selector: "testAccessing",
  54499. protocol: "tests",
  54500. fn: function (){
  54501. var self=this,$self=this;
  54502. var d;
  54503. return $core.withContext(function($ctx1) {
  54504. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54505. d=$recv($globals.Dictionary)._new();
  54506. $recv(d)._at_put_("hello","world");
  54507. $ctx1.sendIdx["at:put:"]=1;
  54508. $1=$recv(d)._at_("hello");
  54509. $ctx1.sendIdx["at:"]=1;
  54510. $self._assert_equals_($1,"world");
  54511. $ctx1.sendIdx["assert:equals:"]=1;
  54512. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54513. return nil;
  54514. }));
  54515. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54516. $self._assert_equals_($2,"world");
  54517. $ctx1.sendIdx["assert:equals:"]=2;
  54518. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54519. return nil;
  54520. }))).__eq("world"));
  54521. $ctx1.sendIdx["deny:"]=1;
  54522. $3=$recv(d)._includesKey_("hello");
  54523. $ctx1.sendIdx["includesKey:"]=1;
  54524. $self._assert_($3);
  54525. $ctx1.sendIdx["assert:"]=1;
  54526. $4=$recv(d)._includesKey_("foo");
  54527. $ctx1.sendIdx["includesKey:"]=2;
  54528. $self._deny_($4);
  54529. $ctx1.sendIdx["deny:"]=2;
  54530. $recv(d)._at_put_((1),(2));
  54531. $ctx1.sendIdx["at:put:"]=2;
  54532. $5=$recv(d)._at_((1));
  54533. $ctx1.sendIdx["at:"]=2;
  54534. $self._assert_equals_($5,(2));
  54535. $ctx1.sendIdx["assert:equals:"]=3;
  54536. $6=d;
  54537. $7=(1).__at((3));
  54538. $ctx1.sendIdx["@"]=1;
  54539. $recv($6)._at_put_($7,(3));
  54540. $9=d;
  54541. $10=(1).__at((3));
  54542. $ctx1.sendIdx["@"]=2;
  54543. $8=$recv($9)._at_($10);
  54544. $self._assert_equals_($8,(3));
  54545. $12=d;
  54546. $13=(1).__at((3));
  54547. $ctx1.sendIdx["@"]=3;
  54548. $11=$recv($12)._includesKey_($13);
  54549. $ctx1.sendIdx["includesKey:"]=3;
  54550. $self._assert_($11);
  54551. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54552. return self;
  54553. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54554. },
  54555. args: [],
  54556. 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)",
  54557. referencedClasses: ["Dictionary"],
  54558. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54559. }),
  54560. $globals.DictionaryTest);
  54561. $core.addMethod(
  54562. $core.method({
  54563. selector: "testDynamicDictionaries",
  54564. protocol: "tests",
  54565. fn: function (){
  54566. var self=this,$self=this;
  54567. return $core.withContext(function($ctx1) {
  54568. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54569. return self;
  54570. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54571. },
  54572. args: [],
  54573. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54574. referencedClasses: ["Dictionary"],
  54575. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54576. }),
  54577. $globals.DictionaryTest);
  54578. $core.addMethod(
  54579. $core.method({
  54580. selector: "collectionClass",
  54581. protocol: "fixture",
  54582. fn: function (){
  54583. var self=this,$self=this;
  54584. return $globals.Dictionary;
  54585. },
  54586. args: [],
  54587. source: "collectionClass\x0a\x09^ Dictionary",
  54588. referencedClasses: ["Dictionary"],
  54589. messageSends: []
  54590. }),
  54591. $globals.DictionaryTest.a$cls);
  54592. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54593. $core.addMethod(
  54594. $core.method({
  54595. selector: "collection",
  54596. protocol: "fixture",
  54597. fn: function (){
  54598. var self=this,$self=this;
  54599. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54600. },
  54601. args: [],
  54602. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54603. referencedClasses: [],
  54604. messageSends: []
  54605. }),
  54606. $globals.HashedCollectionTest);
  54607. $core.addMethod(
  54608. $core.method({
  54609. selector: "collectionKeys",
  54610. protocol: "fixture",
  54611. fn: function (){
  54612. var self=this,$self=this;
  54613. return ["b","a","c","d"];
  54614. },
  54615. args: [],
  54616. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54617. referencedClasses: [],
  54618. messageSends: []
  54619. }),
  54620. $globals.HashedCollectionTest);
  54621. $core.addMethod(
  54622. $core.method({
  54623. selector: "collectionOfPrintStrings",
  54624. protocol: "fixture",
  54625. fn: function (){
  54626. var self=this,$self=this;
  54627. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54628. },
  54629. args: [],
  54630. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54631. referencedClasses: [],
  54632. messageSends: []
  54633. }),
  54634. $globals.HashedCollectionTest);
  54635. $core.addMethod(
  54636. $core.method({
  54637. selector: "collectionSize",
  54638. protocol: "fixture",
  54639. fn: function (){
  54640. var self=this,$self=this;
  54641. return (4);
  54642. },
  54643. args: [],
  54644. source: "collectionSize\x0a\x09^ 4",
  54645. referencedClasses: [],
  54646. messageSends: []
  54647. }),
  54648. $globals.HashedCollectionTest);
  54649. $core.addMethod(
  54650. $core.method({
  54651. selector: "collectionValues",
  54652. protocol: "fixture",
  54653. fn: function (){
  54654. var self=this,$self=this;
  54655. return [(1),(2),(3),(-4)];
  54656. },
  54657. args: [],
  54658. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54659. referencedClasses: [],
  54660. messageSends: []
  54661. }),
  54662. $globals.HashedCollectionTest);
  54663. $core.addMethod(
  54664. $core.method({
  54665. selector: "collectionWithDuplicates",
  54666. protocol: "fixture",
  54667. fn: function (){
  54668. var self=this,$self=this;
  54669. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54670. },
  54671. args: [],
  54672. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54673. referencedClasses: [],
  54674. messageSends: []
  54675. }),
  54676. $globals.HashedCollectionTest);
  54677. $core.addMethod(
  54678. $core.method({
  54679. selector: "collectionWithNewValue",
  54680. protocol: "fixture",
  54681. fn: function (){
  54682. var self=this,$self=this;
  54683. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54684. },
  54685. args: [],
  54686. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54687. referencedClasses: [],
  54688. messageSends: []
  54689. }),
  54690. $globals.HashedCollectionTest);
  54691. $core.addMethod(
  54692. $core.method({
  54693. selector: "sampleNewValueAsCollection",
  54694. protocol: "fixture",
  54695. fn: function (){
  54696. var self=this,$self=this;
  54697. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54698. },
  54699. args: [],
  54700. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54701. referencedClasses: [],
  54702. messageSends: []
  54703. }),
  54704. $globals.HashedCollectionTest);
  54705. $core.addMethod(
  54706. $core.method({
  54707. selector: "testDynamicDictionaries",
  54708. protocol: "tests",
  54709. fn: function (){
  54710. var self=this,$self=this;
  54711. return $core.withContext(function($ctx1) {
  54712. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54713. return self;
  54714. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54715. },
  54716. args: [],
  54717. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54718. referencedClasses: ["HashedCollection"],
  54719. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54720. }),
  54721. $globals.HashedCollectionTest);
  54722. $core.addMethod(
  54723. $core.method({
  54724. selector: "collectionClass",
  54725. protocol: "fixture",
  54726. fn: function (){
  54727. var self=this,$self=this;
  54728. return $globals.HashedCollection;
  54729. },
  54730. args: [],
  54731. source: "collectionClass\x0a\x09^ HashedCollection",
  54732. referencedClasses: ["HashedCollection"],
  54733. messageSends: []
  54734. }),
  54735. $globals.HashedCollectionTest.a$cls);
  54736. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54737. $core.addMethod(
  54738. $core.method({
  54739. selector: "collectionFirst",
  54740. protocol: "fixture",
  54741. fn: function (){
  54742. var self=this,$self=this;
  54743. return $core.withContext(function($ctx1) {
  54744. $self._subclassResponsibility();
  54745. return self;
  54746. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  54747. },
  54748. args: [],
  54749. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54750. referencedClasses: [],
  54751. messageSends: ["subclassResponsibility"]
  54752. }),
  54753. $globals.SequenceableCollectionTest);
  54754. $core.addMethod(
  54755. $core.method({
  54756. selector: "collectionFirstTwo",
  54757. protocol: "fixture",
  54758. fn: function (){
  54759. var self=this,$self=this;
  54760. return $core.withContext(function($ctx1) {
  54761. $self._subclassResponsibility();
  54762. return self;
  54763. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  54764. },
  54765. args: [],
  54766. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  54767. referencedClasses: [],
  54768. messageSends: ["subclassResponsibility"]
  54769. }),
  54770. $globals.SequenceableCollectionTest);
  54771. $core.addMethod(
  54772. $core.method({
  54773. selector: "collectionLast",
  54774. protocol: "fixture",
  54775. fn: function (){
  54776. var self=this,$self=this;
  54777. return $core.withContext(function($ctx1) {
  54778. $self._subclassResponsibility();
  54779. return self;
  54780. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  54781. },
  54782. args: [],
  54783. source: "collectionLast\x0a\x09self subclassResponsibility",
  54784. referencedClasses: [],
  54785. messageSends: ["subclassResponsibility"]
  54786. }),
  54787. $globals.SequenceableCollectionTest);
  54788. $core.addMethod(
  54789. $core.method({
  54790. selector: "collectionLastTwo",
  54791. protocol: "fixture",
  54792. fn: function (){
  54793. var self=this,$self=this;
  54794. return $core.withContext(function($ctx1) {
  54795. $self._subclassResponsibility();
  54796. return self;
  54797. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  54798. },
  54799. args: [],
  54800. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  54801. referencedClasses: [],
  54802. messageSends: ["subclassResponsibility"]
  54803. }),
  54804. $globals.SequenceableCollectionTest);
  54805. $core.addMethod(
  54806. $core.method({
  54807. selector: "nonIndexesDo:",
  54808. protocol: "fixture",
  54809. fn: function (aBlock){
  54810. var self=this,$self=this;
  54811. return $core.withContext(function($ctx1) {
  54812. $recv(aBlock)._value_((0));
  54813. $ctx1.sendIdx["value:"]=1;
  54814. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  54815. $ctx1.sendIdx["value:"]=2;
  54816. $recv(aBlock)._value_("z");
  54817. return self;
  54818. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54819. },
  54820. args: ["aBlock"],
  54821. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  54822. referencedClasses: [],
  54823. messageSends: ["value:", "+", "collectionSize"]
  54824. }),
  54825. $globals.SequenceableCollectionTest);
  54826. $core.addMethod(
  54827. $core.method({
  54828. selector: "samplesDo:",
  54829. protocol: "fixture",
  54830. fn: function (aBlock){
  54831. var self=this,$self=this;
  54832. return $core.withContext(function($ctx1) {
  54833. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  54834. $ctx1.sendIdx["value:value:"]=1;
  54835. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  54836. return self;
  54837. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54838. },
  54839. args: ["aBlock"],
  54840. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  54841. referencedClasses: [],
  54842. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  54843. }),
  54844. $globals.SequenceableCollectionTest);
  54845. $core.addMethod(
  54846. $core.method({
  54847. selector: "testBeginsWith",
  54848. protocol: "tests",
  54849. fn: function (){
  54850. var self=this,$self=this;
  54851. return $core.withContext(function($ctx1) {
  54852. var $2,$1,$4,$5,$3,$7,$6;
  54853. $2=$self._collection();
  54854. $ctx1.sendIdx["collection"]=1;
  54855. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  54856. $ctx1.sendIdx["beginsWith:"]=1;
  54857. $self._assert_($1);
  54858. $ctx1.sendIdx["assert:"]=1;
  54859. $4=$self._collection();
  54860. $ctx1.sendIdx["collection"]=2;
  54861. $5=$self._collection();
  54862. $ctx1.sendIdx["collection"]=3;
  54863. $3=$recv($4)._beginsWith_($5);
  54864. $ctx1.sendIdx["beginsWith:"]=2;
  54865. $self._assert_($3);
  54866. $ctx1.sendIdx["assert:"]=2;
  54867. $7=$self._collection();
  54868. $ctx1.sendIdx["collection"]=4;
  54869. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  54870. $ctx1.sendIdx["beginsWith:"]=3;
  54871. $self._assert_($6);
  54872. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  54873. return self;
  54874. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  54875. },
  54876. args: [],
  54877. 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)",
  54878. referencedClasses: [],
  54879. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  54880. }),
  54881. $globals.SequenceableCollectionTest);
  54882. $core.addMethod(
  54883. $core.method({
  54884. selector: "testEndsWith",
  54885. protocol: "tests",
  54886. fn: function (){
  54887. var self=this,$self=this;
  54888. return $core.withContext(function($ctx1) {
  54889. var $2,$1,$4,$5,$3,$7,$6;
  54890. $2=$self._collection();
  54891. $ctx1.sendIdx["collection"]=1;
  54892. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  54893. $ctx1.sendIdx["endsWith:"]=1;
  54894. $self._assert_($1);
  54895. $ctx1.sendIdx["assert:"]=1;
  54896. $4=$self._collection();
  54897. $ctx1.sendIdx["collection"]=2;
  54898. $5=$self._collection();
  54899. $ctx1.sendIdx["collection"]=3;
  54900. $3=$recv($4)._endsWith_($5);
  54901. $ctx1.sendIdx["endsWith:"]=2;
  54902. $self._assert_($3);
  54903. $ctx1.sendIdx["assert:"]=2;
  54904. $7=$self._collection();
  54905. $ctx1.sendIdx["collection"]=4;
  54906. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  54907. $ctx1.sendIdx["endsWith:"]=3;
  54908. $self._assert_($6);
  54909. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  54910. return self;
  54911. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  54912. },
  54913. args: [],
  54914. 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)",
  54915. referencedClasses: [],
  54916. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  54917. }),
  54918. $globals.SequenceableCollectionTest);
  54919. $core.addMethod(
  54920. $core.method({
  54921. selector: "testFirst",
  54922. protocol: "tests",
  54923. fn: function (){
  54924. var self=this,$self=this;
  54925. return $core.withContext(function($ctx1) {
  54926. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  54927. return self;
  54928. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  54929. },
  54930. args: [],
  54931. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  54932. referencedClasses: [],
  54933. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  54934. }),
  54935. $globals.SequenceableCollectionTest);
  54936. $core.addMethod(
  54937. $core.method({
  54938. selector: "testFirstN",
  54939. protocol: "tests",
  54940. fn: function (){
  54941. var self=this,$self=this;
  54942. return $core.withContext(function($ctx1) {
  54943. var $2,$1,$4,$3,$6,$5,$7;
  54944. $2=$self._collection();
  54945. $ctx1.sendIdx["collection"]=1;
  54946. $1=$recv($2)._first_((2));
  54947. $ctx1.sendIdx["first:"]=1;
  54948. $self._assert_equals_($1,$self._collectionFirstTwo());
  54949. $ctx1.sendIdx["assert:equals:"]=1;
  54950. $4=$self._collection();
  54951. $ctx1.sendIdx["collection"]=2;
  54952. $3=$recv($4)._first_((0));
  54953. $ctx1.sendIdx["first:"]=2;
  54954. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  54955. $ctx1.sendIdx["assert:equals:"]=2;
  54956. $6=$self._collection();
  54957. $ctx1.sendIdx["collection"]=3;
  54958. $5=$recv($6)._first_($self._collectionSize());
  54959. $ctx1.sendIdx["first:"]=3;
  54960. $7=$self._collection();
  54961. $ctx1.sendIdx["collection"]=4;
  54962. $self._assert_equals_($5,$7);
  54963. $self._should_raise_((function(){
  54964. return $core.withContext(function($ctx2) {
  54965. return $recv($self._collection())._first_((33));
  54966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54967. }),$globals.Error);
  54968. return self;
  54969. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  54970. },
  54971. args: [],
  54972. 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",
  54973. referencedClasses: ["Error"],
  54974. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  54975. }),
  54976. $globals.SequenceableCollectionTest);
  54977. $core.addMethod(
  54978. $core.method({
  54979. selector: "testFourth",
  54980. protocol: "tests",
  54981. fn: function (){
  54982. var self=this,$self=this;
  54983. return $core.withContext(function($ctx1) {
  54984. var $2,$1;
  54985. $2=$self._collection();
  54986. $ctx1.sendIdx["collection"]=1;
  54987. $1=$recv($2)._fourth();
  54988. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  54989. return self;
  54990. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  54991. },
  54992. args: [],
  54993. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  54994. referencedClasses: [],
  54995. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  54996. }),
  54997. $globals.SequenceableCollectionTest);
  54998. $core.addMethod(
  54999. $core.method({
  55000. selector: "testIndexOfStartingAt",
  55001. protocol: "tests",
  55002. fn: function (){
  55003. var self=this,$self=this;
  55004. var jsNull;
  55005. return $core.withContext(function($ctx1) {
  55006. var $2,$1,$4,$3;
  55007. jsNull=$recv($globals.JSON)._parse_("null");
  55008. $self._samplesDo_((function(index,value){
  55009. return $core.withContext(function($ctx2) {
  55010. $2=$self._collection();
  55011. $ctx2.sendIdx["collection"]=1;
  55012. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55013. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55014. $self._assert_equals_($1,index);
  55015. $ctx2.sendIdx["assert:equals:"]=1;
  55016. $4=$self._collection();
  55017. $ctx2.sendIdx["collection"]=2;
  55018. $3=$recv($4)._indexOf_startingAt_(value,index);
  55019. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55020. $self._assert_equals_($3,index);
  55021. $ctx2.sendIdx["assert:equals:"]=2;
  55022. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55023. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55024. }));
  55025. return self;
  55026. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55027. },
  55028. args: [],
  55029. 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 ]",
  55030. referencedClasses: ["JSON"],
  55031. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55032. }),
  55033. $globals.SequenceableCollectionTest);
  55034. $core.addMethod(
  55035. $core.method({
  55036. selector: "testIndexOfStartingAtWithNull",
  55037. protocol: "tests",
  55038. fn: function (){
  55039. var self=this,$self=this;
  55040. var jsNull;
  55041. return $core.withContext(function($ctx1) {
  55042. var $1,$2;
  55043. jsNull=$recv($globals.JSON)._parse_("null");
  55044. $self._samplesDo_((function(index,value){
  55045. var collection;
  55046. return $core.withContext(function($ctx2) {
  55047. collection=$self._collection();
  55048. collection;
  55049. $recv(collection)._at_put_(index,jsNull);
  55050. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55051. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55052. $self._assert_equals_($1,index);
  55053. $ctx2.sendIdx["assert:equals:"]=1;
  55054. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55055. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55056. $self._assert_equals_($2,index);
  55057. $ctx2.sendIdx["assert:equals:"]=2;
  55058. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55059. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55060. }));
  55061. return self;
  55062. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55063. },
  55064. args: [],
  55065. 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 ]",
  55066. referencedClasses: ["JSON"],
  55067. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55068. }),
  55069. $globals.SequenceableCollectionTest);
  55070. $core.addMethod(
  55071. $core.method({
  55072. selector: "testLast",
  55073. protocol: "tests",
  55074. fn: function (){
  55075. var self=this,$self=this;
  55076. return $core.withContext(function($ctx1) {
  55077. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55078. return self;
  55079. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55080. },
  55081. args: [],
  55082. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55083. referencedClasses: [],
  55084. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55085. }),
  55086. $globals.SequenceableCollectionTest);
  55087. $core.addMethod(
  55088. $core.method({
  55089. selector: "testLastN",
  55090. protocol: "tests",
  55091. fn: function (){
  55092. var self=this,$self=this;
  55093. return $core.withContext(function($ctx1) {
  55094. var $2,$1,$4,$3,$6,$5,$7;
  55095. $2=$self._collection();
  55096. $ctx1.sendIdx["collection"]=1;
  55097. $1=$recv($2)._last_((2));
  55098. $ctx1.sendIdx["last:"]=1;
  55099. $self._assert_equals_($1,$self._collectionLastTwo());
  55100. $ctx1.sendIdx["assert:equals:"]=1;
  55101. $4=$self._collection();
  55102. $ctx1.sendIdx["collection"]=2;
  55103. $3=$recv($4)._last_((0));
  55104. $ctx1.sendIdx["last:"]=2;
  55105. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55106. $ctx1.sendIdx["assert:equals:"]=2;
  55107. $6=$self._collection();
  55108. $ctx1.sendIdx["collection"]=3;
  55109. $5=$recv($6)._last_($self._collectionSize());
  55110. $ctx1.sendIdx["last:"]=3;
  55111. $7=$self._collection();
  55112. $ctx1.sendIdx["collection"]=4;
  55113. $self._assert_equals_($5,$7);
  55114. $self._should_raise_((function(){
  55115. return $core.withContext(function($ctx2) {
  55116. return $recv($self._collection())._last_((33));
  55117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55118. }),$globals.Error);
  55119. return self;
  55120. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55121. },
  55122. args: [],
  55123. 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",
  55124. referencedClasses: ["Error"],
  55125. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55126. }),
  55127. $globals.SequenceableCollectionTest);
  55128. $core.addMethod(
  55129. $core.method({
  55130. selector: "testSecond",
  55131. protocol: "tests",
  55132. fn: function (){
  55133. var self=this,$self=this;
  55134. return $core.withContext(function($ctx1) {
  55135. var $2,$1;
  55136. $2=$self._collection();
  55137. $ctx1.sendIdx["collection"]=1;
  55138. $1=$recv($2)._second();
  55139. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55140. return self;
  55141. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55142. },
  55143. args: [],
  55144. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55145. referencedClasses: [],
  55146. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55147. }),
  55148. $globals.SequenceableCollectionTest);
  55149. $core.addMethod(
  55150. $core.method({
  55151. selector: "testThird",
  55152. protocol: "tests",
  55153. fn: function (){
  55154. var self=this,$self=this;
  55155. return $core.withContext(function($ctx1) {
  55156. var $2,$1;
  55157. $2=$self._collection();
  55158. $ctx1.sendIdx["collection"]=1;
  55159. $1=$recv($2)._third();
  55160. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55161. return self;
  55162. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55163. },
  55164. args: [],
  55165. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55166. referencedClasses: [],
  55167. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55168. }),
  55169. $globals.SequenceableCollectionTest);
  55170. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55171. $core.addMethod(
  55172. $core.method({
  55173. selector: "collection",
  55174. protocol: "fixture",
  55175. fn: function (){
  55176. var self=this,$self=this;
  55177. return [(1), (2), (3), (-4)];
  55178. },
  55179. args: [],
  55180. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55181. referencedClasses: [],
  55182. messageSends: []
  55183. }),
  55184. $globals.ArrayTest);
  55185. $core.addMethod(
  55186. $core.method({
  55187. selector: "collectionFirst",
  55188. protocol: "fixture",
  55189. fn: function (){
  55190. var self=this,$self=this;
  55191. return (1);
  55192. },
  55193. args: [],
  55194. source: "collectionFirst\x0a\x09^ 1",
  55195. referencedClasses: [],
  55196. messageSends: []
  55197. }),
  55198. $globals.ArrayTest);
  55199. $core.addMethod(
  55200. $core.method({
  55201. selector: "collectionFirstTwo",
  55202. protocol: "fixture",
  55203. fn: function (){
  55204. var self=this,$self=this;
  55205. return [(1), (2)];
  55206. },
  55207. args: [],
  55208. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55209. referencedClasses: [],
  55210. messageSends: []
  55211. }),
  55212. $globals.ArrayTest);
  55213. $core.addMethod(
  55214. $core.method({
  55215. selector: "collectionLast",
  55216. protocol: "fixture",
  55217. fn: function (){
  55218. var self=this,$self=this;
  55219. return (-4);
  55220. },
  55221. args: [],
  55222. source: "collectionLast\x0a\x09^ -4",
  55223. referencedClasses: [],
  55224. messageSends: []
  55225. }),
  55226. $globals.ArrayTest);
  55227. $core.addMethod(
  55228. $core.method({
  55229. selector: "collectionLastTwo",
  55230. protocol: "fixture",
  55231. fn: function (){
  55232. var self=this,$self=this;
  55233. return [(3), (-4)];
  55234. },
  55235. args: [],
  55236. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55237. referencedClasses: [],
  55238. messageSends: []
  55239. }),
  55240. $globals.ArrayTest);
  55241. $core.addMethod(
  55242. $core.method({
  55243. selector: "collectionOfPrintStrings",
  55244. protocol: "fixture",
  55245. fn: function (){
  55246. var self=this,$self=this;
  55247. return ["1", "2", "3", "-4"];
  55248. },
  55249. args: [],
  55250. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55251. referencedClasses: [],
  55252. messageSends: []
  55253. }),
  55254. $globals.ArrayTest);
  55255. $core.addMethod(
  55256. $core.method({
  55257. selector: "collectionSize",
  55258. protocol: "fixture",
  55259. fn: function (){
  55260. var self=this,$self=this;
  55261. return (4);
  55262. },
  55263. args: [],
  55264. source: "collectionSize\x0a\x09^ 4",
  55265. referencedClasses: [],
  55266. messageSends: []
  55267. }),
  55268. $globals.ArrayTest);
  55269. $core.addMethod(
  55270. $core.method({
  55271. selector: "collectionWithDuplicates",
  55272. protocol: "fixture",
  55273. fn: function (){
  55274. var self=this,$self=this;
  55275. return ["a", "b", "c", (1), (2), (1), "a", []];
  55276. },
  55277. args: [],
  55278. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55279. referencedClasses: [],
  55280. messageSends: []
  55281. }),
  55282. $globals.ArrayTest);
  55283. $core.addMethod(
  55284. $core.method({
  55285. selector: "collectionWithNewValue",
  55286. protocol: "fixture",
  55287. fn: function (){
  55288. var self=this,$self=this;
  55289. return [(1), (2), (3), (-4), "N"];
  55290. },
  55291. args: [],
  55292. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55293. referencedClasses: [],
  55294. messageSends: []
  55295. }),
  55296. $globals.ArrayTest);
  55297. $core.addMethod(
  55298. $core.method({
  55299. selector: "sampleNewIndex",
  55300. protocol: "fixture",
  55301. fn: function (){
  55302. var self=this,$self=this;
  55303. return (5);
  55304. },
  55305. args: [],
  55306. source: "sampleNewIndex\x0a\x09^ 5",
  55307. referencedClasses: [],
  55308. messageSends: []
  55309. }),
  55310. $globals.ArrayTest);
  55311. $core.addMethod(
  55312. $core.method({
  55313. selector: "samplesDo:",
  55314. protocol: "fixture",
  55315. fn: function (aBlock){
  55316. var self=this,$self=this;
  55317. return $core.withContext(function($ctx1) {
  55318. (
  55319. $ctx1.supercall = true,
  55320. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55321. $ctx1.supercall = false;
  55322. $recv(aBlock)._value_value_((3),(3));
  55323. return self;
  55324. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55325. },
  55326. args: ["aBlock"],
  55327. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55328. referencedClasses: [],
  55329. messageSends: ["samplesDo:", "value:value:"]
  55330. }),
  55331. $globals.ArrayTest);
  55332. $core.addMethod(
  55333. $core.method({
  55334. selector: "testAdd",
  55335. protocol: "tests",
  55336. fn: function (){
  55337. var self=this,$self=this;
  55338. var array;
  55339. return $core.withContext(function($ctx1) {
  55340. array=$self._collection();
  55341. $recv(array)._add_((6));
  55342. $self._assert_equals_($recv(array)._last(),(6));
  55343. return self;
  55344. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55345. },
  55346. args: [],
  55347. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55348. referencedClasses: [],
  55349. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55350. }),
  55351. $globals.ArrayTest);
  55352. $core.addMethod(
  55353. $core.method({
  55354. selector: "testAddFirst",
  55355. protocol: "tests",
  55356. fn: function (){
  55357. var self=this,$self=this;
  55358. return $core.withContext(function($ctx1) {
  55359. var $3,$2,$1;
  55360. $3=$self._collection();
  55361. $recv($3)._addFirst_((0));
  55362. $2=$recv($3)._yourself();
  55363. $1=$recv($2)._first();
  55364. $self._assert_equals_($1,(0));
  55365. return self;
  55366. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55367. },
  55368. args: [],
  55369. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55370. referencedClasses: [],
  55371. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55372. }),
  55373. $globals.ArrayTest);
  55374. $core.addMethod(
  55375. $core.method({
  55376. selector: "testPrintString",
  55377. protocol: "tests",
  55378. fn: function (){
  55379. var self=this,$self=this;
  55380. var array;
  55381. return $core.withContext(function($ctx1) {
  55382. var $1,$2,$3,$4,$5,$6,$7,$8;
  55383. array=$recv($globals.Array)._new();
  55384. $1=$recv(array)._printString();
  55385. $ctx1.sendIdx["printString"]=1;
  55386. $self._assert_equals_($1,"an Array ()");
  55387. $ctx1.sendIdx["assert:equals:"]=1;
  55388. $2=array;
  55389. $recv($2)._add_((1));
  55390. $ctx1.sendIdx["add:"]=1;
  55391. $3=$recv($2)._add_((3));
  55392. $ctx1.sendIdx["add:"]=2;
  55393. $4=$recv(array)._printString();
  55394. $ctx1.sendIdx["printString"]=2;
  55395. $self._assert_equals_($4,"an Array (1 3)");
  55396. $ctx1.sendIdx["assert:equals:"]=2;
  55397. $recv(array)._add_("foo");
  55398. $5=$recv(array)._printString();
  55399. $ctx1.sendIdx["printString"]=3;
  55400. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55401. $ctx1.sendIdx["assert:equals:"]=3;
  55402. $6=array;
  55403. $recv($6)._remove_((1));
  55404. $ctx1.sendIdx["remove:"]=1;
  55405. $recv($6)._remove_((3));
  55406. $7=$recv(array)._printString();
  55407. $ctx1.sendIdx["printString"]=4;
  55408. $self._assert_equals_($7,"an Array ('foo')");
  55409. $ctx1.sendIdx["assert:equals:"]=4;
  55410. $recv(array)._addLast_((3));
  55411. $ctx1.sendIdx["addLast:"]=1;
  55412. $8=$recv(array)._printString();
  55413. $ctx1.sendIdx["printString"]=5;
  55414. $self._assert_equals_($8,"an Array ('foo' 3)");
  55415. $ctx1.sendIdx["assert:equals:"]=5;
  55416. $recv(array)._addLast_((3));
  55417. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55418. return self;
  55419. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55420. },
  55421. args: [],
  55422. 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)'.",
  55423. referencedClasses: ["Array"],
  55424. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55425. }),
  55426. $globals.ArrayTest);
  55427. $core.addMethod(
  55428. $core.method({
  55429. selector: "testRemove",
  55430. protocol: "tests",
  55431. fn: function (){
  55432. var self=this,$self=this;
  55433. var array;
  55434. return $core.withContext(function($ctx1) {
  55435. array=[(1), (2), (3), (4), (5)];
  55436. $recv(array)._remove_((3));
  55437. $ctx1.sendIdx["remove:"]=1;
  55438. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55439. $self._should_raise_((function(){
  55440. return $core.withContext(function($ctx2) {
  55441. return $recv(array)._remove_((3));
  55442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55443. }),$globals.Error);
  55444. return self;
  55445. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55446. },
  55447. args: [],
  55448. 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",
  55449. referencedClasses: ["Error"],
  55450. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55451. }),
  55452. $globals.ArrayTest);
  55453. $core.addMethod(
  55454. $core.method({
  55455. selector: "testRemoveFromTo",
  55456. protocol: "tests",
  55457. fn: function (){
  55458. var self=this,$self=this;
  55459. return $core.withContext(function($ctx1) {
  55460. var $1,$2;
  55461. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55462. $ctx1.sendIdx["removeFrom:to:"]=1;
  55463. $self._assert_equals_($1,[(4)]);
  55464. $ctx1.sendIdx["assert:equals:"]=1;
  55465. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55466. $ctx1.sendIdx["removeFrom:to:"]=2;
  55467. $self._assert_equals_($2,[(1), (4)]);
  55468. $ctx1.sendIdx["assert:equals:"]=2;
  55469. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55470. return self;
  55471. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55472. },
  55473. args: [],
  55474. 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)",
  55475. referencedClasses: [],
  55476. messageSends: ["assert:equals:", "removeFrom:to:"]
  55477. }),
  55478. $globals.ArrayTest);
  55479. $core.addMethod(
  55480. $core.method({
  55481. selector: "testRemoveIndex",
  55482. protocol: "tests",
  55483. fn: function (){
  55484. var self=this,$self=this;
  55485. return $core.withContext(function($ctx1) {
  55486. var $1,$2;
  55487. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55488. $ctx1.sendIdx["removeIndex:"]=1;
  55489. $self._assert_equals_($1,[(1), (3), (4)]);
  55490. $ctx1.sendIdx["assert:equals:"]=1;
  55491. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55492. $ctx1.sendIdx["removeIndex:"]=2;
  55493. $self._assert_equals_($2,[(2), (3), (4)]);
  55494. $ctx1.sendIdx["assert:equals:"]=2;
  55495. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55496. return self;
  55497. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55498. },
  55499. args: [],
  55500. 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: #()",
  55501. referencedClasses: [],
  55502. messageSends: ["assert:equals:", "removeIndex:"]
  55503. }),
  55504. $globals.ArrayTest);
  55505. $core.addMethod(
  55506. $core.method({
  55507. selector: "testRemoveLast",
  55508. protocol: "tests",
  55509. fn: function (){
  55510. var self=this,$self=this;
  55511. var array;
  55512. return $core.withContext(function($ctx1) {
  55513. array=[(1), (2)];
  55514. $recv(array)._removeLast();
  55515. $self._assert_equals_($recv(array)._last(),(1));
  55516. return self;
  55517. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55518. },
  55519. args: [],
  55520. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55521. referencedClasses: [],
  55522. messageSends: ["removeLast", "assert:equals:", "last"]
  55523. }),
  55524. $globals.ArrayTest);
  55525. $core.addMethod(
  55526. $core.method({
  55527. selector: "testReversed",
  55528. protocol: "tests",
  55529. fn: function (){
  55530. var self=this,$self=this;
  55531. var array;
  55532. return $core.withContext(function($ctx1) {
  55533. array=[(5), (4), (3), (2), (1)];
  55534. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55535. return self;
  55536. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55537. },
  55538. args: [],
  55539. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55540. referencedClasses: [],
  55541. messageSends: ["assert:equals:", "reversed"]
  55542. }),
  55543. $globals.ArrayTest);
  55544. $core.addMethod(
  55545. $core.method({
  55546. selector: "testSort",
  55547. protocol: "tests",
  55548. fn: function (){
  55549. var self=this,$self=this;
  55550. var array;
  55551. return $core.withContext(function($ctx1) {
  55552. array=[(10), (1), (5)];
  55553. $recv(array)._sort();
  55554. $self._assert_equals_(array,[(1), (5), (10)]);
  55555. return self;
  55556. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55557. },
  55558. args: [],
  55559. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55560. referencedClasses: [],
  55561. messageSends: ["sort", "assert:equals:"]
  55562. }),
  55563. $globals.ArrayTest);
  55564. $core.addMethod(
  55565. $core.method({
  55566. selector: "collectionClass",
  55567. protocol: "fixture",
  55568. fn: function (){
  55569. var self=this,$self=this;
  55570. return $globals.Array;
  55571. },
  55572. args: [],
  55573. source: "collectionClass\x0a\x09^ Array",
  55574. referencedClasses: ["Array"],
  55575. messageSends: []
  55576. }),
  55577. $globals.ArrayTest.a$cls);
  55578. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55579. $core.addMethod(
  55580. $core.method({
  55581. selector: "collection",
  55582. protocol: "fixture",
  55583. fn: function (){
  55584. var self=this,$self=this;
  55585. return "helLo";
  55586. },
  55587. args: [],
  55588. source: "collection\x0a\x09^ 'helLo'",
  55589. referencedClasses: [],
  55590. messageSends: []
  55591. }),
  55592. $globals.StringTest);
  55593. $core.addMethod(
  55594. $core.method({
  55595. selector: "collectionFirst",
  55596. protocol: "fixture",
  55597. fn: function (){
  55598. var self=this,$self=this;
  55599. return "h";
  55600. },
  55601. args: [],
  55602. source: "collectionFirst\x0a\x09^ 'h'",
  55603. referencedClasses: [],
  55604. messageSends: []
  55605. }),
  55606. $globals.StringTest);
  55607. $core.addMethod(
  55608. $core.method({
  55609. selector: "collectionFirstTwo",
  55610. protocol: "fixture",
  55611. fn: function (){
  55612. var self=this,$self=this;
  55613. return "he";
  55614. },
  55615. args: [],
  55616. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55617. referencedClasses: [],
  55618. messageSends: []
  55619. }),
  55620. $globals.StringTest);
  55621. $core.addMethod(
  55622. $core.method({
  55623. selector: "collectionLast",
  55624. protocol: "fixture",
  55625. fn: function (){
  55626. var self=this,$self=this;
  55627. return "o";
  55628. },
  55629. args: [],
  55630. source: "collectionLast\x0a\x09^ 'o'",
  55631. referencedClasses: [],
  55632. messageSends: []
  55633. }),
  55634. $globals.StringTest);
  55635. $core.addMethod(
  55636. $core.method({
  55637. selector: "collectionLastTwo",
  55638. protocol: "fixture",
  55639. fn: function (){
  55640. var self=this,$self=this;
  55641. return "Lo";
  55642. },
  55643. args: [],
  55644. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55645. referencedClasses: [],
  55646. messageSends: []
  55647. }),
  55648. $globals.StringTest);
  55649. $core.addMethod(
  55650. $core.method({
  55651. selector: "collectionOfPrintStrings",
  55652. protocol: "fixture",
  55653. fn: function (){
  55654. var self=this,$self=this;
  55655. return "'h''e''l''L''o'";
  55656. },
  55657. args: [],
  55658. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55659. referencedClasses: [],
  55660. messageSends: []
  55661. }),
  55662. $globals.StringTest);
  55663. $core.addMethod(
  55664. $core.method({
  55665. selector: "collectionSize",
  55666. protocol: "fixture",
  55667. fn: function (){
  55668. var self=this,$self=this;
  55669. return (5);
  55670. },
  55671. args: [],
  55672. source: "collectionSize\x0a\x09^ 5",
  55673. referencedClasses: [],
  55674. messageSends: []
  55675. }),
  55676. $globals.StringTest);
  55677. $core.addMethod(
  55678. $core.method({
  55679. selector: "collectionWithDuplicates",
  55680. protocol: "fixture",
  55681. fn: function (){
  55682. var self=this,$self=this;
  55683. return "abbaerten";
  55684. },
  55685. args: [],
  55686. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55687. referencedClasses: [],
  55688. messageSends: []
  55689. }),
  55690. $globals.StringTest);
  55691. $core.addMethod(
  55692. $core.method({
  55693. selector: "collectionWithNewValue",
  55694. protocol: "fixture",
  55695. fn: function (){
  55696. var self=this,$self=this;
  55697. return "helLoN";
  55698. },
  55699. args: [],
  55700. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55701. referencedClasses: [],
  55702. messageSends: []
  55703. }),
  55704. $globals.StringTest);
  55705. $core.addMethod(
  55706. $core.method({
  55707. selector: "sampleNewValueAsCollection",
  55708. protocol: "fixture",
  55709. fn: function (){
  55710. var self=this,$self=this;
  55711. return "N";
  55712. },
  55713. args: [],
  55714. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55715. referencedClasses: [],
  55716. messageSends: []
  55717. }),
  55718. $globals.StringTest);
  55719. $core.addMethod(
  55720. $core.method({
  55721. selector: "samplesDo:",
  55722. protocol: "fixture",
  55723. fn: function (aBlock){
  55724. var self=this,$self=this;
  55725. return $core.withContext(function($ctx1) {
  55726. (
  55727. $ctx1.supercall = true,
  55728. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55729. $ctx1.supercall = false;
  55730. $recv(aBlock)._value_value_((3),"l");
  55731. return self;
  55732. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  55733. },
  55734. args: ["aBlock"],
  55735. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55736. referencedClasses: [],
  55737. messageSends: ["samplesDo:", "value:value:"]
  55738. }),
  55739. $globals.StringTest);
  55740. $core.addMethod(
  55741. $core.method({
  55742. selector: "testAddAll",
  55743. protocol: "tests",
  55744. fn: function (){
  55745. var self=this,$self=this;
  55746. return $core.withContext(function($ctx1) {
  55747. var $1;
  55748. $self._should_raise_((function(){
  55749. return $core.withContext(function($ctx2) {
  55750. $1=$self._collection();
  55751. $ctx2.sendIdx["collection"]=1;
  55752. return $recv($1)._addAll_($self._collection());
  55753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55754. }),$globals.Error);
  55755. return self;
  55756. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  55757. },
  55758. args: [],
  55759. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  55760. referencedClasses: ["Error"],
  55761. messageSends: ["should:raise:", "addAll:", "collection"]
  55762. }),
  55763. $globals.StringTest);
  55764. $core.addMethod(
  55765. $core.method({
  55766. selector: "testAddRemove",
  55767. protocol: "tests",
  55768. fn: function (){
  55769. var self=this,$self=this;
  55770. return $core.withContext(function($ctx1) {
  55771. $self._should_raise_((function(){
  55772. return $core.withContext(function($ctx2) {
  55773. return "hello"._add_("a");
  55774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55775. }),$globals.Error);
  55776. $ctx1.sendIdx["should:raise:"]=1;
  55777. $self._should_raise_((function(){
  55778. return $core.withContext(function($ctx2) {
  55779. return "hello"._remove_("h");
  55780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55781. }),$globals.Error);
  55782. return self;
  55783. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  55784. },
  55785. args: [],
  55786. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  55787. referencedClasses: ["Error"],
  55788. messageSends: ["should:raise:", "add:", "remove:"]
  55789. }),
  55790. $globals.StringTest);
  55791. $core.addMethod(
  55792. $core.method({
  55793. selector: "testAsArray",
  55794. protocol: "tests",
  55795. fn: function (){
  55796. var self=this,$self=this;
  55797. return $core.withContext(function($ctx1) {
  55798. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  55799. return self;
  55800. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  55801. },
  55802. args: [],
  55803. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  55804. referencedClasses: [],
  55805. messageSends: ["assert:equals:", "asArray"]
  55806. }),
  55807. $globals.StringTest);
  55808. $core.addMethod(
  55809. $core.method({
  55810. selector: "testAsLowerCase",
  55811. protocol: "tests",
  55812. fn: function (){
  55813. var self=this,$self=this;
  55814. return $core.withContext(function($ctx1) {
  55815. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  55816. return self;
  55817. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  55818. },
  55819. args: [],
  55820. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  55821. referencedClasses: [],
  55822. messageSends: ["assert:equals:", "asLowercase"]
  55823. }),
  55824. $globals.StringTest);
  55825. $core.addMethod(
  55826. $core.method({
  55827. selector: "testAsNumber",
  55828. protocol: "tests",
  55829. fn: function (){
  55830. var self=this,$self=this;
  55831. return $core.withContext(function($ctx1) {
  55832. var $1,$2;
  55833. $1="3"._asNumber();
  55834. $ctx1.sendIdx["asNumber"]=1;
  55835. $self._assert_equals_($1,(3));
  55836. $ctx1.sendIdx["assert:equals:"]=1;
  55837. $2="-3"._asNumber();
  55838. $ctx1.sendIdx["asNumber"]=2;
  55839. $self._assert_equals_($2,(-3));
  55840. $ctx1.sendIdx["assert:equals:"]=2;
  55841. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  55842. return self;
  55843. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  55844. },
  55845. args: [],
  55846. 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.",
  55847. referencedClasses: [],
  55848. messageSends: ["assert:equals:", "asNumber"]
  55849. }),
  55850. $globals.StringTest);
  55851. $core.addMethod(
  55852. $core.method({
  55853. selector: "testAsUpperCase",
  55854. protocol: "tests",
  55855. fn: function (){
  55856. var self=this,$self=this;
  55857. return $core.withContext(function($ctx1) {
  55858. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  55859. return self;
  55860. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  55861. },
  55862. args: [],
  55863. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  55864. referencedClasses: [],
  55865. messageSends: ["assert:equals:", "asUppercase"]
  55866. }),
  55867. $globals.StringTest);
  55868. $core.addMethod(
  55869. $core.method({
  55870. selector: "testAsciiValue",
  55871. protocol: "tests",
  55872. fn: function (){
  55873. var self=this,$self=this;
  55874. var characterA,characterU;
  55875. return $core.withContext(function($ctx1) {
  55876. var $1;
  55877. characterA="A";
  55878. characterU="U";
  55879. $1=$recv(characterA)._asciiValue();
  55880. $ctx1.sendIdx["asciiValue"]=1;
  55881. $self._assert_equals_($1,(65));
  55882. $ctx1.sendIdx["assert:equals:"]=1;
  55883. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  55884. return self;
  55885. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  55886. },
  55887. args: [],
  55888. 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",
  55889. referencedClasses: [],
  55890. messageSends: ["assert:equals:", "asciiValue"]
  55891. }),
  55892. $globals.StringTest);
  55893. $core.addMethod(
  55894. $core.method({
  55895. selector: "testAtIfAbsentPut",
  55896. protocol: "tests",
  55897. fn: function (){
  55898. var self=this,$self=this;
  55899. return $core.withContext(function($ctx1) {
  55900. $self._should_raise_((function(){
  55901. return $core.withContext(function($ctx2) {
  55902. return "hello"._at_ifAbsentPut_((6),(function(){
  55903. return "a";
  55904. }));
  55905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55906. }),$globals.Error);
  55907. return self;
  55908. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  55909. },
  55910. args: [],
  55911. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  55912. referencedClasses: ["Error"],
  55913. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  55914. }),
  55915. $globals.StringTest);
  55916. $core.addMethod(
  55917. $core.method({
  55918. selector: "testAtPut",
  55919. protocol: "tests",
  55920. fn: function (){
  55921. var self=this,$self=this;
  55922. return $core.withContext(function($ctx1) {
  55923. $self._should_raise_((function(){
  55924. return $core.withContext(function($ctx2) {
  55925. return "hello"._at_put_((1),"a");
  55926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55927. }),$globals.Error);
  55928. return self;
  55929. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  55930. },
  55931. args: [],
  55932. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  55933. referencedClasses: ["Error"],
  55934. messageSends: ["should:raise:", "at:put:"]
  55935. }),
  55936. $globals.StringTest);
  55937. $core.addMethod(
  55938. $core.method({
  55939. selector: "testCapitalized",
  55940. protocol: "tests",
  55941. fn: function (){
  55942. var self=this,$self=this;
  55943. return $core.withContext(function($ctx1) {
  55944. var $1,$2,$3;
  55945. $1="test"._capitalized();
  55946. $ctx1.sendIdx["capitalized"]=1;
  55947. $self._assert_equals_($1,"Test");
  55948. $ctx1.sendIdx["assert:equals:"]=1;
  55949. $2="Test"._capitalized();
  55950. $ctx1.sendIdx["capitalized"]=2;
  55951. $self._assert_equals_($2,"Test");
  55952. $ctx1.sendIdx["assert:equals:"]=2;
  55953. $self._assert_equals_(""._capitalized(),"");
  55954. $ctx1.sendIdx["assert:equals:"]=3;
  55955. $3="Test"._isCapitalized();
  55956. $ctx1.sendIdx["isCapitalized"]=1;
  55957. $self._assert_equals_($3,true);
  55958. $ctx1.sendIdx["assert:equals:"]=4;
  55959. $self._assert_equals_("test"._isCapitalized(),false);
  55960. return self;
  55961. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  55962. },
  55963. args: [],
  55964. 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.",
  55965. referencedClasses: [],
  55966. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  55967. }),
  55968. $globals.StringTest);
  55969. $core.addMethod(
  55970. $core.method({
  55971. selector: "testCharCodeAt",
  55972. protocol: "tests",
  55973. fn: function (){
  55974. var self=this,$self=this;
  55975. return $core.withContext(function($ctx1) {
  55976. var $1,$2,$3,$4,$5;
  55977. $1="jackie"._charCodeAt_((1));
  55978. $ctx1.sendIdx["charCodeAt:"]=1;
  55979. $self._assert_equals_($1,(106));
  55980. $ctx1.sendIdx["assert:equals:"]=1;
  55981. $2="jackie"._charCodeAt_((2));
  55982. $ctx1.sendIdx["charCodeAt:"]=2;
  55983. $self._assert_equals_($2,(97));
  55984. $ctx1.sendIdx["assert:equals:"]=2;
  55985. $3="jackie"._charCodeAt_((3));
  55986. $ctx1.sendIdx["charCodeAt:"]=3;
  55987. $self._assert_equals_($3,(99));
  55988. $ctx1.sendIdx["assert:equals:"]=3;
  55989. $4="jackie"._charCodeAt_((4));
  55990. $ctx1.sendIdx["charCodeAt:"]=4;
  55991. $self._assert_equals_($4,(107));
  55992. $ctx1.sendIdx["assert:equals:"]=4;
  55993. $5="jackie"._charCodeAt_((5));
  55994. $ctx1.sendIdx["charCodeAt:"]=5;
  55995. $self._assert_equals_($5,(105));
  55996. $ctx1.sendIdx["assert:equals:"]=5;
  55997. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  55998. return self;
  55999. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56000. },
  56001. args: [],
  56002. 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",
  56003. referencedClasses: [],
  56004. messageSends: ["assert:equals:", "charCodeAt:"]
  56005. }),
  56006. $globals.StringTest);
  56007. $core.addMethod(
  56008. $core.method({
  56009. selector: "testCopyFromTo",
  56010. protocol: "tests",
  56011. fn: function (){
  56012. var self=this,$self=this;
  56013. return $core.withContext(function($ctx1) {
  56014. var $1;
  56015. $1="jackie"._copyFrom_to_((1),(3));
  56016. $ctx1.sendIdx["copyFrom:to:"]=1;
  56017. $self._assert_equals_($1,"jac");
  56018. $ctx1.sendIdx["assert:equals:"]=1;
  56019. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56020. return self;
  56021. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56022. },
  56023. args: [],
  56024. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56025. referencedClasses: [],
  56026. messageSends: ["assert:equals:", "copyFrom:to:"]
  56027. }),
  56028. $globals.StringTest);
  56029. $core.addMethod(
  56030. $core.method({
  56031. selector: "testCopySeparates",
  56032. protocol: "tests",
  56033. fn: function (){
  56034. var self=this,$self=this;
  56035. return $core.withContext(function($ctx1) {
  56036. var $3,$2,$1;
  56037. $3=$self._collection();
  56038. $ctx1.sendIdx["collection"]=1;
  56039. $2=$recv($3)._copy();
  56040. $1=$recv($2).__eq_eq($self._collection());
  56041. $self._assert_($1);
  56042. return self;
  56043. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56044. },
  56045. args: [],
  56046. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56047. referencedClasses: [],
  56048. messageSends: ["assert:", "==", "copy", "collection"]
  56049. }),
  56050. $globals.StringTest);
  56051. $core.addMethod(
  56052. $core.method({
  56053. selector: "testCopyWithoutAll",
  56054. protocol: "tests",
  56055. fn: function (){
  56056. var self=this,$self=this;
  56057. return $core.withContext(function($ctx1) {
  56058. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56059. return self;
  56060. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56061. },
  56062. args: [],
  56063. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56064. referencedClasses: [],
  56065. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56066. }),
  56067. $globals.StringTest);
  56068. $core.addMethod(
  56069. $core.method({
  56070. selector: "testEquality",
  56071. protocol: "tests",
  56072. fn: function (){
  56073. var self=this,$self=this;
  56074. return $core.withContext(function($ctx1) {
  56075. var $1,$2,$3;
  56076. $self._assert_equals_("hello","hello");
  56077. $ctx1.sendIdx["assert:equals:"]=1;
  56078. $1="hello".__eq("world");
  56079. $ctx1.sendIdx["="]=1;
  56080. $self._deny_($1);
  56081. $ctx1.sendIdx["deny:"]=1;
  56082. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56083. })));
  56084. $ctx1.sendIdx["="]=2;
  56085. $self._deny_($2);
  56086. $ctx1.sendIdx["deny:"]=2;
  56087. $3="hello"._yourself();
  56088. $ctx1.sendIdx["yourself"]=1;
  56089. $self._assert_equals_("hello",$3);
  56090. $ctx1.sendIdx["assert:equals:"]=2;
  56091. $self._assert_equals_("hello"._yourself(),"hello");
  56092. $self._deny_("".__eq((0)));
  56093. return self;
  56094. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56095. },
  56096. args: [],
  56097. 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",
  56098. referencedClasses: [],
  56099. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56100. }),
  56101. $globals.StringTest);
  56102. $core.addMethod(
  56103. $core.method({
  56104. selector: "testIdentity",
  56105. protocol: "tests",
  56106. fn: function (){
  56107. var self=this,$self=this;
  56108. return $core.withContext(function($ctx1) {
  56109. var $1,$2,$4,$3,$5;
  56110. $1="hello".__eq_eq("hello");
  56111. $ctx1.sendIdx["=="]=1;
  56112. $self._assert_($1);
  56113. $ctx1.sendIdx["assert:"]=1;
  56114. $2="hello".__eq_eq("world");
  56115. $ctx1.sendIdx["=="]=2;
  56116. $self._deny_($2);
  56117. $ctx1.sendIdx["deny:"]=1;
  56118. $4="hello"._yourself();
  56119. $ctx1.sendIdx["yourself"]=1;
  56120. $3="hello".__eq_eq($4);
  56121. $ctx1.sendIdx["=="]=3;
  56122. $self._assert_($3);
  56123. $ctx1.sendIdx["assert:"]=2;
  56124. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56125. $ctx1.sendIdx["=="]=4;
  56126. $self._assert_($5);
  56127. $self._deny_("".__eq_eq((0)));
  56128. return self;
  56129. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56130. },
  56131. args: [],
  56132. 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",
  56133. referencedClasses: [],
  56134. messageSends: ["assert:", "==", "deny:", "yourself"]
  56135. }),
  56136. $globals.StringTest);
  56137. $core.addMethod(
  56138. $core.method({
  56139. selector: "testIncludesSubString",
  56140. protocol: "tests",
  56141. fn: function (){
  56142. var self=this,$self=this;
  56143. return $core.withContext(function($ctx1) {
  56144. var $1;
  56145. $1="amber"._includesSubString_("ber");
  56146. $ctx1.sendIdx["includesSubString:"]=1;
  56147. $self._assert_($1);
  56148. $self._deny_("amber"._includesSubString_("zork"));
  56149. return self;
  56150. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56151. },
  56152. args: [],
  56153. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56154. referencedClasses: [],
  56155. messageSends: ["assert:", "includesSubString:", "deny:"]
  56156. }),
  56157. $globals.StringTest);
  56158. $core.addMethod(
  56159. $core.method({
  56160. selector: "testIndexOfStartingAtWithNull",
  56161. protocol: "tests",
  56162. fn: function (){
  56163. var self=this,$self=this;
  56164. return self;
  56165. },
  56166. args: [],
  56167. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56168. referencedClasses: [],
  56169. messageSends: []
  56170. }),
  56171. $globals.StringTest);
  56172. $core.addMethod(
  56173. $core.method({
  56174. selector: "testIndexOfWithNull",
  56175. protocol: "tests",
  56176. fn: function (){
  56177. var self=this,$self=this;
  56178. return self;
  56179. },
  56180. args: [],
  56181. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56182. referencedClasses: [],
  56183. messageSends: []
  56184. }),
  56185. $globals.StringTest);
  56186. $core.addMethod(
  56187. $core.method({
  56188. selector: "testIsVowel",
  56189. protocol: "tests",
  56190. fn: function (){
  56191. var self=this,$self=this;
  56192. var vowel,consonant;
  56193. return $core.withContext(function($ctx1) {
  56194. var $1;
  56195. vowel="u";
  56196. consonant="z";
  56197. $1=$recv(vowel)._isVowel();
  56198. $ctx1.sendIdx["isVowel"]=1;
  56199. $self._assert_equals_($1,true);
  56200. $ctx1.sendIdx["assert:equals:"]=1;
  56201. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56202. return self;
  56203. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56204. },
  56205. args: [],
  56206. 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",
  56207. referencedClasses: [],
  56208. messageSends: ["assert:equals:", "isVowel"]
  56209. }),
  56210. $globals.StringTest);
  56211. $core.addMethod(
  56212. $core.method({
  56213. selector: "testJoin",
  56214. protocol: "tests",
  56215. fn: function (){
  56216. var self=this,$self=this;
  56217. return $core.withContext(function($ctx1) {
  56218. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56219. return self;
  56220. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56221. },
  56222. args: [],
  56223. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56224. referencedClasses: [],
  56225. messageSends: ["assert:equals:", "join:"]
  56226. }),
  56227. $globals.StringTest);
  56228. $core.addMethod(
  56229. $core.method({
  56230. selector: "testRegression1224",
  56231. protocol: "tests",
  56232. fn: function (){
  56233. var self=this,$self=this;
  56234. return $core.withContext(function($ctx1) {
  56235. var $2,$1;
  56236. $self._should_raise_((function(){
  56237. return $core.withContext(function($ctx2) {
  56238. $2=$recv($self._collectionClass())._new();
  56239. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56240. }));
  56241. $1=$recv($2)._yourself();
  56242. return $recv($1)._size();
  56243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56244. }),$globals.Error);
  56245. return self;
  56246. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56247. },
  56248. args: [],
  56249. 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",
  56250. referencedClasses: ["Error"],
  56251. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56252. }),
  56253. $globals.StringTest);
  56254. $core.addMethod(
  56255. $core.method({
  56256. selector: "testRemoveAll",
  56257. protocol: "tests",
  56258. fn: function (){
  56259. var self=this,$self=this;
  56260. return $core.withContext(function($ctx1) {
  56261. $self._should_raise_((function(){
  56262. return $core.withContext(function($ctx2) {
  56263. return $recv($self._collection())._removeAll();
  56264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56265. }),$globals.Error);
  56266. return self;
  56267. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56268. },
  56269. args: [],
  56270. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56271. referencedClasses: ["Error"],
  56272. messageSends: ["should:raise:", "removeAll", "collection"]
  56273. }),
  56274. $globals.StringTest);
  56275. $core.addMethod(
  56276. $core.method({
  56277. selector: "testReversed",
  56278. protocol: "tests",
  56279. fn: function (){
  56280. var self=this,$self=this;
  56281. return $core.withContext(function($ctx1) {
  56282. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56283. return self;
  56284. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56285. },
  56286. args: [],
  56287. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56288. referencedClasses: [],
  56289. messageSends: ["assert:equals:", "reversed"]
  56290. }),
  56291. $globals.StringTest);
  56292. $core.addMethod(
  56293. $core.method({
  56294. selector: "testStreamContents",
  56295. protocol: "tests",
  56296. fn: function (){
  56297. var self=this,$self=this;
  56298. return $core.withContext(function($ctx1) {
  56299. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56300. return $core.withContext(function($ctx2) {
  56301. $recv(aStream)._nextPutAll_("hello");
  56302. $ctx2.sendIdx["nextPutAll:"]=1;
  56303. $recv(aStream)._space();
  56304. return $recv(aStream)._nextPutAll_("world");
  56305. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56306. })),"hello world");
  56307. return self;
  56308. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56309. },
  56310. args: [],
  56311. 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'",
  56312. referencedClasses: ["String"],
  56313. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56314. }),
  56315. $globals.StringTest);
  56316. $core.addMethod(
  56317. $core.method({
  56318. selector: "testSubStrings",
  56319. protocol: "tests",
  56320. fn: function (){
  56321. var self=this,$self=this;
  56322. return $core.withContext(function($ctx1) {
  56323. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56324. return self;
  56325. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56326. },
  56327. args: [],
  56328. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56329. referencedClasses: [],
  56330. messageSends: ["assert:equals:", "subStrings:"]
  56331. }),
  56332. $globals.StringTest);
  56333. $core.addMethod(
  56334. $core.method({
  56335. selector: "testTrim",
  56336. protocol: "tests",
  56337. fn: function (){
  56338. var self=this,$self=this;
  56339. return $core.withContext(function($ctx1) {
  56340. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56341. $ctx1.sendIdx["assert:equals:"]=1;
  56342. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56343. return self;
  56344. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56345. },
  56346. args: [],
  56347. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56348. referencedClasses: [],
  56349. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56350. }),
  56351. $globals.StringTest);
  56352. $core.addMethod(
  56353. $core.method({
  56354. selector: "testValue",
  56355. protocol: "tests",
  56356. fn: function (){
  56357. var self=this,$self=this;
  56358. return $core.withContext(function($ctx1) {
  56359. $self._assert_equals_("asString"._value_((1)),"1");
  56360. $ctx1.sendIdx["assert:equals:"]=1;
  56361. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56362. return self;
  56363. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56364. },
  56365. args: [],
  56366. 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')",
  56367. referencedClasses: [],
  56368. messageSends: ["assert:equals:", "value:", "collect:"]
  56369. }),
  56370. $globals.StringTest);
  56371. $core.addMethod(
  56372. $core.method({
  56373. selector: "collectionClass",
  56374. protocol: "fixture",
  56375. fn: function (){
  56376. var self=this,$self=this;
  56377. return $globals.String;
  56378. },
  56379. args: [],
  56380. source: "collectionClass\x0a\x09^ String",
  56381. referencedClasses: ["String"],
  56382. messageSends: []
  56383. }),
  56384. $globals.StringTest.a$cls);
  56385. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56386. $core.addMethod(
  56387. $core.method({
  56388. selector: "collection",
  56389. protocol: "fixture",
  56390. fn: function (){
  56391. var self=this,$self=this;
  56392. return $core.withContext(function($ctx1) {
  56393. var $1;
  56394. $1=$recv($globals.Set)._new();
  56395. $recv($1)._add_($globals.Smalltalk);
  56396. $ctx1.sendIdx["add:"]=1;
  56397. $recv($1)._add_(nil);
  56398. $ctx1.sendIdx["add:"]=2;
  56399. $recv($1)._add_((3).__at((3)));
  56400. $ctx1.sendIdx["add:"]=3;
  56401. $recv($1)._add_(false);
  56402. $ctx1.sendIdx["add:"]=4;
  56403. $recv($1)._add_($self["@sampleBlock"]);
  56404. return $recv($1)._yourself();
  56405. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56406. },
  56407. args: [],
  56408. 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",
  56409. referencedClasses: ["Set", "Smalltalk"],
  56410. messageSends: ["add:", "new", "@", "yourself"]
  56411. }),
  56412. $globals.SetTest);
  56413. $core.addMethod(
  56414. $core.method({
  56415. selector: "collectionOfPrintStrings",
  56416. protocol: "fixture",
  56417. fn: function (){
  56418. var self=this,$self=this;
  56419. return $core.withContext(function($ctx1) {
  56420. var $1;
  56421. $1=$recv($globals.Set)._new();
  56422. $recv($1)._add_("a SmalltalkImage");
  56423. $ctx1.sendIdx["add:"]=1;
  56424. $recv($1)._add_("nil");
  56425. $ctx1.sendIdx["add:"]=2;
  56426. $recv($1)._add_("3@3");
  56427. $ctx1.sendIdx["add:"]=3;
  56428. $recv($1)._add_("false");
  56429. $ctx1.sendIdx["add:"]=4;
  56430. $recv($1)._add_("a BlockClosure");
  56431. return $recv($1)._yourself();
  56432. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56433. },
  56434. args: [],
  56435. 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",
  56436. referencedClasses: ["Set"],
  56437. messageSends: ["add:", "new", "yourself"]
  56438. }),
  56439. $globals.SetTest);
  56440. $core.addMethod(
  56441. $core.method({
  56442. selector: "collectionSize",
  56443. protocol: "fixture",
  56444. fn: function (){
  56445. var self=this,$self=this;
  56446. return (5);
  56447. },
  56448. args: [],
  56449. source: "collectionSize\x0a\x09^ 5",
  56450. referencedClasses: [],
  56451. messageSends: []
  56452. }),
  56453. $globals.SetTest);
  56454. $core.addMethod(
  56455. $core.method({
  56456. selector: "collectionWithDuplicates",
  56457. protocol: "fixture",
  56458. fn: function (){
  56459. var self=this,$self=this;
  56460. return $core.withContext(function($ctx1) {
  56461. var $1;
  56462. $1=$self._collection();
  56463. $recv($1)._add_((0));
  56464. return $recv($1)._yourself();
  56465. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56466. },
  56467. args: [],
  56468. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56469. referencedClasses: [],
  56470. messageSends: ["add:", "collection", "yourself"]
  56471. }),
  56472. $globals.SetTest);
  56473. $core.addMethod(
  56474. $core.method({
  56475. selector: "collectionWithNewValue",
  56476. protocol: "fixture",
  56477. fn: function (){
  56478. var self=this,$self=this;
  56479. return $core.withContext(function($ctx1) {
  56480. var $1;
  56481. $1=$recv($globals.Set)._new();
  56482. $recv($1)._add_($globals.Smalltalk);
  56483. $ctx1.sendIdx["add:"]=1;
  56484. $recv($1)._add_(nil);
  56485. $ctx1.sendIdx["add:"]=2;
  56486. $recv($1)._add_((3).__at((3)));
  56487. $ctx1.sendIdx["add:"]=3;
  56488. $recv($1)._add_("N");
  56489. $ctx1.sendIdx["add:"]=4;
  56490. $recv($1)._add_(false);
  56491. $ctx1.sendIdx["add:"]=5;
  56492. $recv($1)._add_($self["@sampleBlock"]);
  56493. return $recv($1)._yourself();
  56494. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56495. },
  56496. args: [],
  56497. 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",
  56498. referencedClasses: ["Set", "Smalltalk"],
  56499. messageSends: ["add:", "new", "@", "yourself"]
  56500. }),
  56501. $globals.SetTest);
  56502. $core.addMethod(
  56503. $core.method({
  56504. selector: "testAddAll",
  56505. protocol: "tests",
  56506. fn: function (){
  56507. var self=this,$self=this;
  56508. return $core.withContext(function($ctx1) {
  56509. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56510. (
  56511. $ctx1.supercall = true,
  56512. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56513. $ctx1.supercall = false;
  56514. $2=$self._collection();
  56515. $ctx1.sendIdx["collection"]=1;
  56516. $3=$self._collection();
  56517. $ctx1.sendIdx["collection"]=2;
  56518. $recv($2)._addAll_($3);
  56519. $ctx1.sendIdx["addAll:"]=1;
  56520. $4=$recv($2)._yourself();
  56521. $ctx1.sendIdx["yourself"]=1;
  56522. $1=$4;
  56523. $5=$self._collection();
  56524. $ctx1.sendIdx["collection"]=3;
  56525. $self._assert_equals_($1,$5);
  56526. $ctx1.sendIdx["assert:equals:"]=1;
  56527. $7=$self._collection();
  56528. $ctx1.sendIdx["collection"]=4;
  56529. $8=$self._collectionWithNewValue();
  56530. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56531. $recv($7)._addAll_($8);
  56532. $ctx1.sendIdx["addAll:"]=2;
  56533. $9=$recv($7)._yourself();
  56534. $ctx1.sendIdx["yourself"]=2;
  56535. $6=$9;
  56536. $10=$self._collectionWithNewValue();
  56537. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56538. $self._assert_equals_($6,$10);
  56539. $ctx1.sendIdx["assert:equals:"]=2;
  56540. $12=$self._collectionWithNewValue();
  56541. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56542. $recv($12)._addAll_($self._collection());
  56543. $11=$recv($12)._yourself();
  56544. $self._assert_equals_($11,$self._collectionWithNewValue());
  56545. return self;
  56546. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56547. },
  56548. args: [],
  56549. 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",
  56550. referencedClasses: [],
  56551. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56552. }),
  56553. $globals.SetTest);
  56554. $core.addMethod(
  56555. $core.method({
  56556. selector: "testAddRemove",
  56557. protocol: "tests",
  56558. fn: function (){
  56559. var self=this,$self=this;
  56560. var set;
  56561. return $core.withContext(function($ctx1) {
  56562. var $1,$2;
  56563. set=$recv($globals.Set)._new();
  56564. $self._assert_($recv(set)._isEmpty());
  56565. $ctx1.sendIdx["assert:"]=1;
  56566. $recv(set)._add_((3));
  56567. $ctx1.sendIdx["add:"]=1;
  56568. $1=$recv(set)._includes_((3));
  56569. $ctx1.sendIdx["includes:"]=1;
  56570. $self._assert_($1);
  56571. $ctx1.sendIdx["assert:"]=2;
  56572. $recv(set)._add_((5));
  56573. $2=$recv(set)._includes_((5));
  56574. $ctx1.sendIdx["includes:"]=2;
  56575. $self._assert_($2);
  56576. $recv(set)._remove_((3));
  56577. $self._deny_($recv(set)._includes_((3)));
  56578. return self;
  56579. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56580. },
  56581. args: [],
  56582. 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)",
  56583. referencedClasses: ["Set"],
  56584. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56585. }),
  56586. $globals.SetTest);
  56587. $core.addMethod(
  56588. $core.method({
  56589. selector: "testAt",
  56590. protocol: "tests",
  56591. fn: function (){
  56592. var self=this,$self=this;
  56593. return $core.withContext(function($ctx1) {
  56594. $self._should_raise_((function(){
  56595. return $core.withContext(function($ctx2) {
  56596. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56598. }),$globals.Error);
  56599. return self;
  56600. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56601. },
  56602. args: [],
  56603. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56604. referencedClasses: ["Set", "Error"],
  56605. messageSends: ["should:raise:", "at:put:", "new"]
  56606. }),
  56607. $globals.SetTest);
  56608. $core.addMethod(
  56609. $core.method({
  56610. selector: "testCollect",
  56611. protocol: "tests",
  56612. fn: function (){
  56613. var self=this,$self=this;
  56614. return $core.withContext(function($ctx1) {
  56615. var $2,$1;
  56616. (
  56617. $ctx1.supercall = true,
  56618. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56619. $ctx1.supercall = false;
  56620. $2=[(5), (6), (8)]._asSet();
  56621. $ctx1.sendIdx["asSet"]=1;
  56622. $1=$recv($2)._collect_((function(x){
  56623. return $core.withContext(function($ctx2) {
  56624. return $recv(x).__backslash_backslash((3));
  56625. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56626. }));
  56627. $self._assert_equals_($1,[(0), (2)]._asSet());
  56628. return self;
  56629. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56630. },
  56631. args: [],
  56632. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56633. referencedClasses: [],
  56634. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56635. }),
  56636. $globals.SetTest);
  56637. $core.addMethod(
  56638. $core.method({
  56639. selector: "testComma",
  56640. protocol: "tests",
  56641. fn: function (){
  56642. var self=this,$self=this;
  56643. return $core.withContext(function($ctx1) {
  56644. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56645. (
  56646. $ctx1.supercall = true,
  56647. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56648. $ctx1.supercall = false;
  56649. $2=$self._collection();
  56650. $ctx1.sendIdx["collection"]=1;
  56651. $3=$self._collection();
  56652. $ctx1.sendIdx["collection"]=2;
  56653. $1=$recv($2).__comma($3);
  56654. $ctx1.sendIdx[","]=1;
  56655. $4=$self._collection();
  56656. $ctx1.sendIdx["collection"]=3;
  56657. $self._assert_equals_($1,$4);
  56658. $ctx1.sendIdx["assert:equals:"]=1;
  56659. $6=$self._collection();
  56660. $ctx1.sendIdx["collection"]=4;
  56661. $7=$self._collectionWithNewValue();
  56662. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56663. $5=$recv($6).__comma($7);
  56664. $ctx1.sendIdx[","]=2;
  56665. $8=$self._collectionWithNewValue();
  56666. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56667. $self._assert_equals_($5,$8);
  56668. $ctx1.sendIdx["assert:equals:"]=2;
  56669. $10=$self._collectionWithNewValue();
  56670. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56671. $9=$recv($10).__comma($self._collection());
  56672. $self._assert_equals_($9,$self._collectionWithNewValue());
  56673. return self;
  56674. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56675. },
  56676. args: [],
  56677. 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",
  56678. referencedClasses: [],
  56679. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56680. }),
  56681. $globals.SetTest);
  56682. $core.addMethod(
  56683. $core.method({
  56684. selector: "testComparing",
  56685. protocol: "tests",
  56686. fn: function (){
  56687. var self=this,$self=this;
  56688. return $core.withContext(function($ctx1) {
  56689. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56690. $1=[(0), (2)]._asSet();
  56691. $ctx1.sendIdx["asSet"]=1;
  56692. $2=[(0), (2)]._asSet();
  56693. $ctx1.sendIdx["asSet"]=2;
  56694. $self._assert_equals_($1,$2);
  56695. $ctx1.sendIdx["assert:equals:"]=1;
  56696. $3=[(2), (0)]._asSet();
  56697. $ctx1.sendIdx["asSet"]=3;
  56698. $4=[(0), (2)]._asSet();
  56699. $ctx1.sendIdx["asSet"]=4;
  56700. $self._assert_equals_($3,$4);
  56701. $6=[(0), (2), (3)]._asSet();
  56702. $ctx1.sendIdx["asSet"]=5;
  56703. $7=[(0), (2)]._asSet();
  56704. $ctx1.sendIdx["asSet"]=6;
  56705. $5=$recv($6).__eq($7);
  56706. $ctx1.sendIdx["="]=1;
  56707. $self._deny_($5);
  56708. $ctx1.sendIdx["deny:"]=1;
  56709. $9=[(1), (2)]._asSet();
  56710. $ctx1.sendIdx["asSet"]=7;
  56711. $8=$recv($9).__eq([(0), (2)]._asSet());
  56712. $self._deny_($8);
  56713. return self;
  56714. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56715. },
  56716. args: [],
  56717. 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",
  56718. referencedClasses: [],
  56719. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56720. }),
  56721. $globals.SetTest);
  56722. $core.addMethod(
  56723. $core.method({
  56724. selector: "testPrintString",
  56725. protocol: "tests",
  56726. fn: function (){
  56727. var self=this,$self=this;
  56728. var set;
  56729. return $core.withContext(function($ctx1) {
  56730. var $1,$2,$3,$4,$5,$6,$7,$8;
  56731. set=$recv($globals.Set)._new();
  56732. $1=$recv(set)._printString();
  56733. $ctx1.sendIdx["printString"]=1;
  56734. $self._assert_equals_($1,"a Set ()");
  56735. $ctx1.sendIdx["assert:equals:"]=1;
  56736. $2=set;
  56737. $recv($2)._add_((1));
  56738. $ctx1.sendIdx["add:"]=1;
  56739. $3=$recv($2)._add_((3));
  56740. $ctx1.sendIdx["add:"]=2;
  56741. $4=$recv(set)._printString();
  56742. $ctx1.sendIdx["printString"]=2;
  56743. $self._assert_equals_($4,"a Set (1 3)");
  56744. $ctx1.sendIdx["assert:equals:"]=2;
  56745. $recv(set)._add_("foo");
  56746. $ctx1.sendIdx["add:"]=3;
  56747. $5=$recv(set)._printString();
  56748. $ctx1.sendIdx["printString"]=3;
  56749. $self._assert_equals_($5,"a Set (1 3 'foo')");
  56750. $ctx1.sendIdx["assert:equals:"]=3;
  56751. $6=set;
  56752. $recv($6)._remove_((1));
  56753. $ctx1.sendIdx["remove:"]=1;
  56754. $recv($6)._remove_((3));
  56755. $7=$recv(set)._printString();
  56756. $ctx1.sendIdx["printString"]=4;
  56757. $self._assert_equals_($7,"a Set ('foo')");
  56758. $ctx1.sendIdx["assert:equals:"]=4;
  56759. $recv(set)._add_((3));
  56760. $ctx1.sendIdx["add:"]=4;
  56761. $8=$recv(set)._printString();
  56762. $ctx1.sendIdx["printString"]=5;
  56763. $self._assert_equals_($8,"a Set (3 'foo')");
  56764. $ctx1.sendIdx["assert:equals:"]=5;
  56765. $recv(set)._add_((3));
  56766. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  56767. return self;
  56768. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  56769. },
  56770. args: [],
  56771. 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'')'",
  56772. referencedClasses: ["Set"],
  56773. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  56774. }),
  56775. $globals.SetTest);
  56776. $core.addMethod(
  56777. $core.method({
  56778. selector: "testUnboxedObjects",
  56779. protocol: "tests",
  56780. fn: function (){
  56781. var self=this,$self=this;
  56782. return $core.withContext(function($ctx1) {
  56783. var $4,$3,$2,$1;
  56784. $4="foo"._yourself();
  56785. $ctx1.sendIdx["yourself"]=1;
  56786. $3=[$4,"foo"._yourself()];
  56787. $2=$recv($3)._asSet();
  56788. $1=$recv($2)._asArray();
  56789. $self._assert_equals_($1,["foo"]);
  56790. return self;
  56791. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  56792. },
  56793. args: [],
  56794. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  56795. referencedClasses: [],
  56796. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  56797. }),
  56798. $globals.SetTest);
  56799. $core.addMethod(
  56800. $core.method({
  56801. selector: "testUnicity",
  56802. protocol: "tests",
  56803. fn: function (){
  56804. var self=this,$self=this;
  56805. var set;
  56806. return $core.withContext(function($ctx1) {
  56807. var $1;
  56808. set=$recv($globals.Set)._new();
  56809. $recv(set)._add_((21));
  56810. $ctx1.sendIdx["add:"]=1;
  56811. $recv(set)._add_("hello");
  56812. $ctx1.sendIdx["add:"]=2;
  56813. $recv(set)._add_((21));
  56814. $ctx1.sendIdx["add:"]=3;
  56815. $1=$recv(set)._size();
  56816. $ctx1.sendIdx["size"]=1;
  56817. $self._assert_equals_($1,(2));
  56818. $ctx1.sendIdx["assert:equals:"]=1;
  56819. $recv(set)._add_("hello");
  56820. $self._assert_equals_($recv(set)._size(),(2));
  56821. $ctx1.sendIdx["assert:equals:"]=2;
  56822. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  56823. return self;
  56824. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  56825. },
  56826. args: [],
  56827. 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')",
  56828. referencedClasses: ["Set"],
  56829. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  56830. }),
  56831. $globals.SetTest);
  56832. $core.addMethod(
  56833. $core.method({
  56834. selector: "collectionClass",
  56835. protocol: "fixture",
  56836. fn: function (){
  56837. var self=this,$self=this;
  56838. return $globals.Set;
  56839. },
  56840. args: [],
  56841. source: "collectionClass\x0a\x09^ Set",
  56842. referencedClasses: ["Set"],
  56843. messageSends: []
  56844. }),
  56845. $globals.SetTest.a$cls);
  56846. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  56847. $core.addMethod(
  56848. $core.method({
  56849. selector: "testShow",
  56850. protocol: "tests",
  56851. fn: function (){
  56852. var self=this,$self=this;
  56853. var originalTranscript;
  56854. return $core.withContext(function($ctx1) {
  56855. originalTranscript=$recv($globals.Transcript)._current();
  56856. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  56857. $ctx1.sendIdx["register:"]=1;
  56858. $self._shouldnt_raise_((function(){
  56859. return $core.withContext(function($ctx2) {
  56860. return $recv($globals.Transcript)._show_("Hello console!");
  56861. $ctx2.sendIdx["show:"]=1;
  56862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56863. }),$globals.Error);
  56864. $ctx1.sendIdx["shouldnt:raise:"]=1;
  56865. $self._shouldnt_raise_((function(){
  56866. return $core.withContext(function($ctx2) {
  56867. return $recv($globals.Transcript)._show_(console);
  56868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56869. }),$globals.Error);
  56870. $recv($globals.Transcript)._register_(originalTranscript);
  56871. return self;
  56872. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  56873. },
  56874. args: [],
  56875. 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.",
  56876. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  56877. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  56878. }),
  56879. $globals.ConsoleTranscriptTest);
  56880. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  56881. $core.addMethod(
  56882. $core.method({
  56883. selector: "testEquality",
  56884. protocol: "tests",
  56885. fn: function (){
  56886. var self=this,$self=this;
  56887. var now;
  56888. return $core.withContext(function($ctx1) {
  56889. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56890. now=$recv($globals.Date)._new();
  56891. $1=$recv(now).__eq(now);
  56892. $ctx1.sendIdx["="]=1;
  56893. $self._assert_($1);
  56894. $ctx1.sendIdx["assert:"]=1;
  56895. $3=now;
  56896. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56897. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56898. $2=$recv($3).__eq($4);
  56899. $ctx1.sendIdx["="]=2;
  56900. $self._deny_($2);
  56901. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56902. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56903. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56904. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56905. $5=$recv($6).__eq($7);
  56906. $ctx1.sendIdx["="]=3;
  56907. $self._assert_($5);
  56908. $ctx1.sendIdx["assert:"]=2;
  56909. $9=now;
  56910. $11=$recv(now)._asMilliseconds();
  56911. $ctx1.sendIdx["asMilliseconds"]=1;
  56912. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56913. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56914. $8=$recv($9).__eq($10);
  56915. $ctx1.sendIdx["="]=4;
  56916. $self._assert_($8);
  56917. $ctx1.sendIdx["assert:"]=3;
  56918. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  56919. return self;
  56920. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  56921. },
  56922. args: [],
  56923. 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",
  56924. referencedClasses: ["Date"],
  56925. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56926. }),
  56927. $globals.DateTest);
  56928. $core.addMethod(
  56929. $core.method({
  56930. selector: "testIdentity",
  56931. protocol: "tests",
  56932. fn: function (){
  56933. var self=this,$self=this;
  56934. var now;
  56935. return $core.withContext(function($ctx1) {
  56936. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56937. now=$recv($globals.Date)._new();
  56938. $1=$recv(now).__eq_eq(now);
  56939. $ctx1.sendIdx["=="]=1;
  56940. $self._assert_($1);
  56941. $3=now;
  56942. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56943. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56944. $2=$recv($3).__eq_eq($4);
  56945. $ctx1.sendIdx["=="]=2;
  56946. $self._deny_($2);
  56947. $ctx1.sendIdx["deny:"]=1;
  56948. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56949. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56950. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56951. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56952. $5=$recv($6).__eq_eq($7);
  56953. $ctx1.sendIdx["=="]=3;
  56954. $self._deny_($5);
  56955. $ctx1.sendIdx["deny:"]=2;
  56956. $9=now;
  56957. $11=$recv(now)._asMilliseconds();
  56958. $ctx1.sendIdx["asMilliseconds"]=1;
  56959. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56960. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56961. $8=$recv($9).__eq_eq($10);
  56962. $ctx1.sendIdx["=="]=4;
  56963. $self._deny_($8);
  56964. $ctx1.sendIdx["deny:"]=3;
  56965. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  56966. return self;
  56967. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  56968. },
  56969. args: [],
  56970. 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",
  56971. referencedClasses: ["Date"],
  56972. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56973. }),
  56974. $globals.DateTest);
  56975. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  56976. $core.addMethod(
  56977. $core.method({
  56978. selector: "jsObject",
  56979. protocol: "accessing",
  56980. fn: function (){
  56981. var self=this,$self=this;
  56982. return $core.withContext(function($ctx1) {
  56983. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  56984. return self;
  56985. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  56986. },
  56987. args: [],
  56988. 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}'>",
  56989. referencedClasses: [],
  56990. messageSends: []
  56991. }),
  56992. $globals.JSObjectProxyTest);
  56993. $core.addMethod(
  56994. $core.method({
  56995. selector: "jsUndefined",
  56996. protocol: "accessing",
  56997. fn: function (){
  56998. var self=this,$self=this;
  56999. return $core.withContext(function($ctx1) {
  57000. return;
  57001. return self;
  57002. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57003. },
  57004. args: [],
  57005. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57006. referencedClasses: [],
  57007. messageSends: []
  57008. }),
  57009. $globals.JSObjectProxyTest);
  57010. $core.addMethod(
  57011. $core.method({
  57012. selector: "testAtIfAbsent",
  57013. protocol: "tests",
  57014. fn: function (){
  57015. var self=this,$self=this;
  57016. var testObject;
  57017. return $core.withContext(function($ctx1) {
  57018. var $1,$2,$3;
  57019. testObject=$self._jsObject();
  57020. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57021. return "Property does not exist";
  57022. }));
  57023. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57024. $self._assert_equals_($1,"Property does not exist");
  57025. $ctx1.sendIdx["assert:equals:"]=1;
  57026. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57027. return "Property does not exist";
  57028. }));
  57029. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57030. $self._assert_equals_($2,nil);
  57031. $ctx1.sendIdx["assert:equals:"]=2;
  57032. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57033. return "Property does not exist";
  57034. }));
  57035. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57036. $self._assert_equals_($3,(1));
  57037. $ctx1.sendIdx["assert:equals:"]=3;
  57038. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57039. return "Property does not exist";
  57040. })),nil);
  57041. return self;
  57042. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57043. },
  57044. args: [],
  57045. 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.",
  57046. referencedClasses: [],
  57047. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57048. }),
  57049. $globals.JSObjectProxyTest);
  57050. $core.addMethod(
  57051. $core.method({
  57052. selector: "testAtIfPresent",
  57053. protocol: "tests",
  57054. fn: function (){
  57055. var self=this,$self=this;
  57056. var testObject;
  57057. return $core.withContext(function($ctx1) {
  57058. var $2,$1,$4,$3,$6,$5;
  57059. testObject=$self._jsObject();
  57060. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57061. return $core.withContext(function($ctx2) {
  57062. $2=$recv(x)._asString();
  57063. $ctx2.sendIdx["asString"]=1;
  57064. return "hello ".__comma($2);
  57065. $ctx2.sendIdx[","]=1;
  57066. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57067. }));
  57068. $ctx1.sendIdx["at:ifPresent:"]=1;
  57069. $self._assert_equals_($1,nil);
  57070. $ctx1.sendIdx["assert:equals:"]=1;
  57071. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57072. return $core.withContext(function($ctx2) {
  57073. $4=$recv(x)._asString();
  57074. $ctx2.sendIdx["asString"]=2;
  57075. return "hello ".__comma($4);
  57076. $ctx2.sendIdx[","]=2;
  57077. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57078. }));
  57079. $ctx1.sendIdx["at:ifPresent:"]=2;
  57080. $self._assert_equals_($3,"hello nil");
  57081. $ctx1.sendIdx["assert:equals:"]=2;
  57082. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57083. return $core.withContext(function($ctx2) {
  57084. $6=$recv(x)._asString();
  57085. $ctx2.sendIdx["asString"]=3;
  57086. return "hello ".__comma($6);
  57087. $ctx2.sendIdx[","]=3;
  57088. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57089. }));
  57090. $ctx1.sendIdx["at:ifPresent:"]=3;
  57091. $self._assert_equals_($5,"hello 1");
  57092. $ctx1.sendIdx["assert:equals:"]=3;
  57093. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57094. return $core.withContext(function($ctx2) {
  57095. return "hello ".__comma($recv(x)._asString());
  57096. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57097. })),"hello nil");
  57098. return self;
  57099. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57100. },
  57101. args: [],
  57102. 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'.",
  57103. referencedClasses: [],
  57104. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57105. }),
  57106. $globals.JSObjectProxyTest);
  57107. $core.addMethod(
  57108. $core.method({
  57109. selector: "testAtIfPresentIfAbsent",
  57110. protocol: "tests",
  57111. fn: function (){
  57112. var self=this,$self=this;
  57113. var testObject;
  57114. return $core.withContext(function($ctx1) {
  57115. var $2,$1,$4,$3,$6,$5;
  57116. testObject=$self._jsObject();
  57117. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57118. return $core.withContext(function($ctx2) {
  57119. $2=$recv(x)._asString();
  57120. $ctx2.sendIdx["asString"]=1;
  57121. return "hello ".__comma($2);
  57122. $ctx2.sendIdx[","]=1;
  57123. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57124. }),(function(){
  57125. return "not present";
  57126. }));
  57127. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57128. $self._assert_equals_($1,"not present");
  57129. $ctx1.sendIdx["assert:equals:"]=1;
  57130. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57131. return $core.withContext(function($ctx2) {
  57132. $4=$recv(x)._asString();
  57133. $ctx2.sendIdx["asString"]=2;
  57134. return "hello ".__comma($4);
  57135. $ctx2.sendIdx[","]=2;
  57136. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57137. }),(function(){
  57138. return "not present";
  57139. }));
  57140. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57141. $self._assert_equals_($3,"hello nil");
  57142. $ctx1.sendIdx["assert:equals:"]=2;
  57143. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57144. return $core.withContext(function($ctx2) {
  57145. $6=$recv(x)._asString();
  57146. $ctx2.sendIdx["asString"]=3;
  57147. return "hello ".__comma($6);
  57148. $ctx2.sendIdx[","]=3;
  57149. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57150. }),(function(){
  57151. return "not present";
  57152. }));
  57153. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57154. $self._assert_equals_($5,"hello 1");
  57155. $ctx1.sendIdx["assert:equals:"]=3;
  57156. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57157. return $core.withContext(function($ctx2) {
  57158. return "hello ".__comma($recv(x)._asString());
  57159. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57160. }),(function(){
  57161. return "not present";
  57162. })),"hello nil");
  57163. return self;
  57164. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57165. },
  57166. args: [],
  57167. 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'.",
  57168. referencedClasses: [],
  57169. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57170. }),
  57171. $globals.JSObjectProxyTest);
  57172. $core.addMethod(
  57173. $core.method({
  57174. selector: "testAtPut",
  57175. protocol: "tests",
  57176. fn: function (){
  57177. var self=this,$self=this;
  57178. var testObject;
  57179. return $core.withContext(function($ctx1) {
  57180. var $2,$1;
  57181. testObject=$self._jsObject();
  57182. $2=$recv(testObject)._at_("abc");
  57183. $ctx1.sendIdx["at:"]=1;
  57184. $1=$recv($2).__tild_eq("xyz");
  57185. $self._assert_($1);
  57186. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57187. $ctx1.sendIdx["assert:equals:"]=1;
  57188. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57189. return self;
  57190. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57191. },
  57192. args: [],
  57193. 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'",
  57194. referencedClasses: [],
  57195. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57196. }),
  57197. $globals.JSObjectProxyTest);
  57198. $core.addMethod(
  57199. $core.method({
  57200. selector: "testComparison",
  57201. protocol: "tests",
  57202. fn: function (){
  57203. var self=this,$self=this;
  57204. return $core.withContext(function($ctx1) {
  57205. var $1,$2;
  57206. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57207. $1=$recv(console).__eq(console);
  57208. $ctx1.sendIdx["="]=1;
  57209. $self._assert_($1);
  57210. $2=$recv(console).__eq($recv($globals.Object)._new());
  57211. $ctx1.sendIdx["="]=2;
  57212. $self._deny_($2);
  57213. $ctx1.sendIdx["deny:"]=1;
  57214. $self._deny_($recv(console).__eq($self._jsObject()));
  57215. return self;
  57216. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57217. },
  57218. args: [],
  57219. 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",
  57220. referencedClasses: ["Object"],
  57221. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57222. }),
  57223. $globals.JSObjectProxyTest);
  57224. $core.addMethod(
  57225. $core.method({
  57226. selector: "testDNU",
  57227. protocol: "tests",
  57228. fn: function (){
  57229. var self=this,$self=this;
  57230. return $core.withContext(function($ctx1) {
  57231. $self._should_raise_((function(){
  57232. return $core.withContext(function($ctx2) {
  57233. return $recv($self._jsObject())._foo();
  57234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57235. }),$globals.MessageNotUnderstood);
  57236. return self;
  57237. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57238. },
  57239. args: [],
  57240. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57241. referencedClasses: ["MessageNotUnderstood"],
  57242. messageSends: ["should:raise:", "foo", "jsObject"]
  57243. }),
  57244. $globals.JSObjectProxyTest);
  57245. $core.addMethod(
  57246. $core.method({
  57247. selector: "testDNUWithAllowJavaScriptCalls",
  57248. protocol: "tests",
  57249. fn: function (){
  57250. var self=this,$self=this;
  57251. var jsObject;
  57252. return $core.withContext(function($ctx1) {
  57253. jsObject=[];
  57254. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57255. $self._should_raise_((function(){
  57256. return $core.withContext(function($ctx2) {
  57257. return $recv(jsObject)._foo();
  57258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57259. }),$globals.MessageNotUnderstood);
  57260. return self;
  57261. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57262. },
  57263. args: [],
  57264. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57265. referencedClasses: ["MessageNotUnderstood"],
  57266. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57267. }),
  57268. $globals.JSObjectProxyTest);
  57269. $core.addMethod(
  57270. $core.method({
  57271. selector: "testMessageSend",
  57272. protocol: "tests",
  57273. fn: function (){
  57274. var self=this,$self=this;
  57275. return $core.withContext(function($ctx1) {
  57276. var $2,$1,$4,$3;
  57277. $2=$self._jsObject();
  57278. $ctx1.sendIdx["jsObject"]=1;
  57279. $1=$recv($2)._a();
  57280. $self._assert_equals_($1,(1));
  57281. $ctx1.sendIdx["assert:equals:"]=1;
  57282. $4=$self._jsObject();
  57283. $ctx1.sendIdx["jsObject"]=2;
  57284. $3=$recv($4)._b();
  57285. $self._assert_equals_($3,(2));
  57286. $ctx1.sendIdx["assert:equals:"]=2;
  57287. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57288. return self;
  57289. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57290. },
  57291. args: [],
  57292. 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",
  57293. referencedClasses: [],
  57294. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57295. }),
  57296. $globals.JSObjectProxyTest);
  57297. $core.addMethod(
  57298. $core.method({
  57299. selector: "testMethodWithArguments",
  57300. protocol: "tests",
  57301. fn: function (){
  57302. var self=this,$self=this;
  57303. return $core.withContext(function($ctx1) {
  57304. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57305. return self;
  57306. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57307. },
  57308. args: [],
  57309. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57310. referencedClasses: [],
  57311. messageSends: ["assert:equals:", "c:", "jsObject"]
  57312. }),
  57313. $globals.JSObjectProxyTest);
  57314. $core.addMethod(
  57315. $core.method({
  57316. selector: "testNull",
  57317. protocol: "tests",
  57318. fn: function (){
  57319. var self=this,$self=this;
  57320. return $core.withContext(function($ctx1) {
  57321. var $2,$1;
  57322. $2=$recv($globals.JSObjectProxy)._null();
  57323. $ctx1.sendIdx["null"]=1;
  57324. $1=$recv($2)._isNil();
  57325. $self._assert_($1);
  57326. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57327. return self;
  57328. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57329. },
  57330. args: [],
  57331. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57332. referencedClasses: ["JSObjectProxy", "JSON"],
  57333. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57334. }),
  57335. $globals.JSObjectProxyTest);
  57336. $core.addMethod(
  57337. $core.method({
  57338. selector: "testPrinting",
  57339. protocol: "tests",
  57340. fn: function (){
  57341. var self=this,$self=this;
  57342. return $core.withContext(function($ctx1) {
  57343. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57344. return self;
  57345. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57346. },
  57347. args: [],
  57348. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57349. referencedClasses: [],
  57350. messageSends: ["assert:equals:", "printString", "jsObject"]
  57351. }),
  57352. $globals.JSObjectProxyTest);
  57353. $core.addMethod(
  57354. $core.method({
  57355. selector: "testPropertyThatReturnsEmptyString",
  57356. protocol: "tests",
  57357. fn: function (){
  57358. var self=this,$self=this;
  57359. var object;
  57360. return $core.withContext(function($ctx1) {
  57361. var $1;
  57362. object=$self._jsObject();
  57363. $1=$recv(object)._d();
  57364. $ctx1.sendIdx["d"]=1;
  57365. $self._assert_equals_($1,"");
  57366. $ctx1.sendIdx["assert:equals:"]=1;
  57367. $recv(object)._d_("hello");
  57368. $self._assert_equals_($recv(object)._d(),"hello");
  57369. return self;
  57370. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57371. },
  57372. args: [],
  57373. 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'",
  57374. referencedClasses: [],
  57375. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57376. }),
  57377. $globals.JSObjectProxyTest);
  57378. $core.addMethod(
  57379. $core.method({
  57380. selector: "testPropertyThatReturnsUndefined",
  57381. protocol: "tests",
  57382. fn: function (){
  57383. var self=this,$self=this;
  57384. var object;
  57385. return $core.withContext(function($ctx1) {
  57386. object=$self._jsObject();
  57387. $self._shouldnt_raise_((function(){
  57388. return $core.withContext(function($ctx2) {
  57389. return $recv(object)._e();
  57390. $ctx2.sendIdx["e"]=1;
  57391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57392. }),$globals.MessageNotUnderstood);
  57393. $self._assert_($recv($recv(object)._e())._isNil());
  57394. return self;
  57395. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57396. },
  57397. args: [],
  57398. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57399. referencedClasses: ["MessageNotUnderstood"],
  57400. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57401. }),
  57402. $globals.JSObjectProxyTest);
  57403. $core.addMethod(
  57404. $core.method({
  57405. selector: "testSetPropertyWithFalsyValue",
  57406. protocol: "tests",
  57407. fn: function (){
  57408. var self=this,$self=this;
  57409. var jsObject;
  57410. return $core.withContext(function($ctx1) {
  57411. var $1,$2,$3,$4,$5;
  57412. jsObject=$self._jsObject();
  57413. $1=$recv(jsObject)._a();
  57414. $ctx1.sendIdx["a"]=1;
  57415. $self._assert_equals_($1,(1));
  57416. $ctx1.sendIdx["assert:equals:"]=1;
  57417. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57418. $ctx1.sendIdx["a:"]=1;
  57419. $2=$recv(jsObject)._a();
  57420. $ctx1.sendIdx["a"]=2;
  57421. $self._assert_equals_($2,nil);
  57422. $ctx1.sendIdx["assert:equals:"]=2;
  57423. $recv(jsObject)._a_((0));
  57424. $ctx1.sendIdx["a:"]=2;
  57425. $3=$recv(jsObject)._a();
  57426. $ctx1.sendIdx["a"]=3;
  57427. $self._assert_equals_($3,(0));
  57428. $ctx1.sendIdx["assert:equals:"]=3;
  57429. $recv(jsObject)._a_($self._jsUndefined());
  57430. $ctx1.sendIdx["a:"]=3;
  57431. $4=$recv(jsObject)._a();
  57432. $ctx1.sendIdx["a"]=4;
  57433. $self._assert_equals_($4,nil);
  57434. $ctx1.sendIdx["assert:equals:"]=4;
  57435. $recv(jsObject)._a_("");
  57436. $ctx1.sendIdx["a:"]=4;
  57437. $5=$recv(jsObject)._a();
  57438. $ctx1.sendIdx["a"]=5;
  57439. $self._assert_equals_($5,"");
  57440. $ctx1.sendIdx["assert:equals:"]=5;
  57441. $recv(jsObject)._a_(false);
  57442. $self._assert_equals_($recv(jsObject)._a(),false);
  57443. return self;
  57444. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57445. },
  57446. args: [],
  57447. 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",
  57448. referencedClasses: ["JSObjectProxy"],
  57449. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57450. }),
  57451. $globals.JSObjectProxyTest);
  57452. $core.addMethod(
  57453. $core.method({
  57454. selector: "testUndefined",
  57455. protocol: "tests",
  57456. fn: function (){
  57457. var self=this,$self=this;
  57458. return $core.withContext(function($ctx1) {
  57459. var $2,$1;
  57460. $2=$recv($globals.JSObjectProxy)._undefined();
  57461. $ctx1.sendIdx["undefined"]=1;
  57462. $1=$recv($2)._isNil();
  57463. $self._assert_($1);
  57464. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57465. return self;
  57466. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57467. },
  57468. args: [],
  57469. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57470. referencedClasses: ["JSObjectProxy", "JSON"],
  57471. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57472. }),
  57473. $globals.JSObjectProxyTest);
  57474. $core.addMethod(
  57475. $core.method({
  57476. selector: "testValue",
  57477. protocol: "tests",
  57478. fn: function (){
  57479. var self=this,$self=this;
  57480. var testObject;
  57481. return $core.withContext(function($ctx1) {
  57482. testObject=$self._jsObject();
  57483. $recv(testObject)._at_put_("value","aValue");
  57484. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57485. return self;
  57486. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57487. },
  57488. args: [],
  57489. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57490. referencedClasses: [],
  57491. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57492. }),
  57493. $globals.JSObjectProxyTest);
  57494. $core.addMethod(
  57495. $core.method({
  57496. selector: "testYourself",
  57497. protocol: "tests",
  57498. fn: function (){
  57499. var self=this,$self=this;
  57500. var object;
  57501. return $core.withContext(function($ctx1) {
  57502. var $1;
  57503. $1=$self._jsObject();
  57504. $recv($1)._d_("test");
  57505. object=$recv($1)._yourself();
  57506. $self._assert_equals_($recv(object)._d(),"test");
  57507. return self;
  57508. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57509. },
  57510. args: [],
  57511. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57512. referencedClasses: [],
  57513. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57514. }),
  57515. $globals.JSObjectProxyTest);
  57516. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57517. $core.addMethod(
  57518. $core.method({
  57519. selector: "testCatchingException",
  57520. protocol: "tests",
  57521. fn: function (){
  57522. var self=this,$self=this;
  57523. return $core.withContext(function($ctx1) {
  57524. $recv((function(){
  57525. return $core.withContext(function($ctx2) {
  57526. return $self._throwException();
  57527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57528. }))._on_do_($globals.Error,(function(error){
  57529. return $core.withContext(function($ctx2) {
  57530. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57531. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57532. }));
  57533. return self;
  57534. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57535. },
  57536. args: [],
  57537. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57538. referencedClasses: ["Error"],
  57539. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57540. }),
  57541. $globals.JavaScriptExceptionTest);
  57542. $core.addMethod(
  57543. $core.method({
  57544. selector: "testRaisingException",
  57545. protocol: "tests",
  57546. fn: function (){
  57547. var self=this,$self=this;
  57548. return $core.withContext(function($ctx1) {
  57549. $self._should_raise_((function(){
  57550. return $core.withContext(function($ctx2) {
  57551. return $self._throwException();
  57552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57553. }),$globals.JavaScriptException);
  57554. return self;
  57555. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57556. },
  57557. args: [],
  57558. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57559. referencedClasses: ["JavaScriptException"],
  57560. messageSends: ["should:raise:", "throwException"]
  57561. }),
  57562. $globals.JavaScriptExceptionTest);
  57563. $core.addMethod(
  57564. $core.method({
  57565. selector: "throwException",
  57566. protocol: "helpers",
  57567. fn: function (){
  57568. var self=this,$self=this;
  57569. return $core.withContext(function($ctx1) {
  57570. throw "test";
  57571. return self;
  57572. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57573. },
  57574. args: [],
  57575. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57576. referencedClasses: [],
  57577. messageSends: []
  57578. }),
  57579. $globals.JavaScriptExceptionTest);
  57580. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57581. $core.addMethod(
  57582. $core.method({
  57583. selector: "testValue",
  57584. protocol: "tests",
  57585. fn: function (){
  57586. var self=this,$self=this;
  57587. var messageSend;
  57588. return $core.withContext(function($ctx1) {
  57589. var $1;
  57590. $1=$recv($globals.MessageSend)._new();
  57591. $ctx1.sendIdx["new"]=1;
  57592. $recv($1)._receiver_($recv($globals.Object)._new());
  57593. $recv($1)._selector_("asString");
  57594. messageSend=$recv($1)._yourself();
  57595. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57596. return self;
  57597. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57598. },
  57599. args: [],
  57600. 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'",
  57601. referencedClasses: ["MessageSend", "Object"],
  57602. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57603. }),
  57604. $globals.MessageSendTest);
  57605. $core.addMethod(
  57606. $core.method({
  57607. selector: "testValueWithArguments",
  57608. protocol: "tests",
  57609. fn: function (){
  57610. var self=this,$self=this;
  57611. var messageSend;
  57612. return $core.withContext(function($ctx1) {
  57613. var $1;
  57614. $1=$recv($globals.MessageSend)._new();
  57615. $recv($1)._receiver_((2));
  57616. $recv($1)._selector_("+");
  57617. messageSend=$recv($1)._yourself();
  57618. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57619. $ctx1.sendIdx["assert:equals:"]=1;
  57620. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57621. return self;
  57622. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57623. },
  57624. args: [],
  57625. 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",
  57626. referencedClasses: ["MessageSend"],
  57627. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57628. }),
  57629. $globals.MessageSendTest);
  57630. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57631. $core.addMethod(
  57632. $core.method({
  57633. selector: "codeGeneratorClass",
  57634. protocol: "accessing",
  57635. fn: function (){
  57636. var self=this,$self=this;
  57637. return $globals.CodeGenerator;
  57638. },
  57639. args: [],
  57640. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57641. referencedClasses: ["CodeGenerator"],
  57642. messageSends: []
  57643. }),
  57644. $globals.MethodInheritanceTest);
  57645. $core.addMethod(
  57646. $core.method({
  57647. selector: "compiler",
  57648. protocol: "factory",
  57649. fn: function (){
  57650. var self=this,$self=this;
  57651. return $core.withContext(function($ctx1) {
  57652. var $1;
  57653. $1=$recv($globals.Compiler)._new();
  57654. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57655. return $recv($1)._yourself();
  57656. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57657. },
  57658. args: [],
  57659. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57660. referencedClasses: ["Compiler"],
  57661. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57662. }),
  57663. $globals.MethodInheritanceTest);
  57664. $core.addMethod(
  57665. $core.method({
  57666. selector: "deinstallBottom",
  57667. protocol: "testing",
  57668. fn: function (){
  57669. var self=this,$self=this;
  57670. return $core.withContext(function($ctx1) {
  57671. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57672. return self;
  57673. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57674. },
  57675. args: [],
  57676. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57677. referencedClasses: [],
  57678. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57679. }),
  57680. $globals.MethodInheritanceTest);
  57681. $core.addMethod(
  57682. $core.method({
  57683. selector: "deinstallMiddle",
  57684. protocol: "testing",
  57685. fn: function (){
  57686. var self=this,$self=this;
  57687. return $core.withContext(function($ctx1) {
  57688. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  57689. return self;
  57690. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  57691. },
  57692. args: [],
  57693. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  57694. referencedClasses: [],
  57695. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  57696. }),
  57697. $globals.MethodInheritanceTest);
  57698. $core.addMethod(
  57699. $core.method({
  57700. selector: "deinstallTop",
  57701. protocol: "testing",
  57702. fn: function (){
  57703. var self=this,$self=this;
  57704. return $core.withContext(function($ctx1) {
  57705. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  57706. return self;
  57707. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  57708. },
  57709. args: [],
  57710. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  57711. referencedClasses: [],
  57712. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  57713. }),
  57714. $globals.MethodInheritanceTest);
  57715. $core.addMethod(
  57716. $core.method({
  57717. selector: "installBottom:",
  57718. protocol: "testing",
  57719. fn: function (aString){
  57720. var self=this,$self=this;
  57721. return $core.withContext(function($ctx1) {
  57722. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  57723. return self;
  57724. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  57725. },
  57726. args: ["aString"],
  57727. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  57728. referencedClasses: [],
  57729. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  57730. }),
  57731. $globals.MethodInheritanceTest);
  57732. $core.addMethod(
  57733. $core.method({
  57734. selector: "installMiddle:",
  57735. protocol: "testing",
  57736. fn: function (aString){
  57737. var self=this,$self=this;
  57738. return $core.withContext(function($ctx1) {
  57739. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  57740. return self;
  57741. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  57742. },
  57743. args: ["aString"],
  57744. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  57745. referencedClasses: [],
  57746. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  57747. }),
  57748. $globals.MethodInheritanceTest);
  57749. $core.addMethod(
  57750. $core.method({
  57751. selector: "installTop:",
  57752. protocol: "testing",
  57753. fn: function (aString){
  57754. var self=this,$self=this;
  57755. return $core.withContext(function($ctx1) {
  57756. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  57757. return self;
  57758. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  57759. },
  57760. args: ["aString"],
  57761. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  57762. referencedClasses: [],
  57763. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  57764. }),
  57765. $globals.MethodInheritanceTest);
  57766. $core.addMethod(
  57767. $core.method({
  57768. selector: "setUp",
  57769. protocol: "initialization",
  57770. fn: function (){
  57771. var self=this,$self=this;
  57772. return $core.withContext(function($ctx1) {
  57773. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  57774. $ctx1.sendIdx["new"]=1;
  57775. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  57776. $ctx1.sendIdx["new"]=2;
  57777. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  57778. $self["@method"]=nil;
  57779. $self["@performBlock"]=(function(){
  57780. return $core.withContext(function($ctx2) {
  57781. return $self._error_("performBlock not initialized");
  57782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57783. });
  57784. return self;
  57785. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  57786. },
  57787. args: [],
  57788. 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' ]",
  57789. referencedClasses: [],
  57790. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  57791. }),
  57792. $globals.MethodInheritanceTest);
  57793. $core.addMethod(
  57794. $core.method({
  57795. selector: "shouldMNU",
  57796. protocol: "testing",
  57797. fn: function (){
  57798. var self=this,$self=this;
  57799. return $core.withContext(function($ctx1) {
  57800. $self._shouldMNUTop();
  57801. $self._shouldMNUMiddle();
  57802. $self._shouldMNUBottom();
  57803. return self;
  57804. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  57805. },
  57806. args: [],
  57807. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  57808. referencedClasses: [],
  57809. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  57810. }),
  57811. $globals.MethodInheritanceTest);
  57812. $core.addMethod(
  57813. $core.method({
  57814. selector: "shouldMNUBottom",
  57815. protocol: "testing",
  57816. fn: function (){
  57817. var self=this,$self=this;
  57818. return $core.withContext(function($ctx1) {
  57819. $self._should_raise_((function(){
  57820. return $core.withContext(function($ctx2) {
  57821. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57823. }),$globals.MessageNotUnderstood);
  57824. return self;
  57825. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  57826. },
  57827. args: [],
  57828. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  57829. referencedClasses: ["MessageNotUnderstood"],
  57830. messageSends: ["should:raise:", "value:"]
  57831. }),
  57832. $globals.MethodInheritanceTest);
  57833. $core.addMethod(
  57834. $core.method({
  57835. selector: "shouldMNUMiddle",
  57836. protocol: "testing",
  57837. fn: function (){
  57838. var self=this,$self=this;
  57839. return $core.withContext(function($ctx1) {
  57840. $self._should_raise_((function(){
  57841. return $core.withContext(function($ctx2) {
  57842. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57844. }),$globals.MessageNotUnderstood);
  57845. return self;
  57846. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  57847. },
  57848. args: [],
  57849. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  57850. referencedClasses: ["MessageNotUnderstood"],
  57851. messageSends: ["should:raise:", "value:"]
  57852. }),
  57853. $globals.MethodInheritanceTest);
  57854. $core.addMethod(
  57855. $core.method({
  57856. selector: "shouldMNUTop",
  57857. protocol: "testing",
  57858. fn: function (){
  57859. var self=this,$self=this;
  57860. return $core.withContext(function($ctx1) {
  57861. $self._should_raise_((function(){
  57862. return $core.withContext(function($ctx2) {
  57863. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57865. }),$globals.MessageNotUnderstood);
  57866. return self;
  57867. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  57868. },
  57869. args: [],
  57870. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  57871. referencedClasses: ["MessageNotUnderstood"],
  57872. messageSends: ["should:raise:", "value:"]
  57873. }),
  57874. $globals.MethodInheritanceTest);
  57875. $core.addMethod(
  57876. $core.method({
  57877. selector: "shouldReturn:",
  57878. protocol: "testing",
  57879. fn: function (anObject){
  57880. var self=this,$self=this;
  57881. var result;
  57882. return $core.withContext(function($ctx1) {
  57883. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57884. $ctx1.sendIdx["value:"]=1;
  57885. $self._assert_equals_(["top",anObject],["top",result]);
  57886. $ctx1.sendIdx["assert:equals:"]=1;
  57887. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57888. $ctx1.sendIdx["value:"]=2;
  57889. $self._assert_equals_(["middle",anObject],["middle",result]);
  57890. $ctx1.sendIdx["assert:equals:"]=2;
  57891. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57892. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  57893. return self;
  57894. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  57895. },
  57896. args: ["anObject"],
  57897. 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 }",
  57898. referencedClasses: [],
  57899. messageSends: ["value:", "assert:equals:"]
  57900. }),
  57901. $globals.MethodInheritanceTest);
  57902. $core.addMethod(
  57903. $core.method({
  57904. selector: "shouldReturn:and:and:",
  57905. protocol: "testing",
  57906. fn: function (anObject,anObject2,anObject3){
  57907. var self=this,$self=this;
  57908. var result;
  57909. return $core.withContext(function($ctx1) {
  57910. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57911. $ctx1.sendIdx["value:"]=1;
  57912. $self._assert_equals_(["top",anObject],["top",result]);
  57913. $ctx1.sendIdx["assert:equals:"]=1;
  57914. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57915. $ctx1.sendIdx["value:"]=2;
  57916. $self._assert_equals_(["middle",anObject2],["middle",result]);
  57917. $ctx1.sendIdx["assert:equals:"]=2;
  57918. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57919. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  57920. return self;
  57921. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  57922. },
  57923. args: ["anObject", "anObject2", "anObject3"],
  57924. 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 }",
  57925. referencedClasses: [],
  57926. messageSends: ["value:", "assert:equals:"]
  57927. }),
  57928. $globals.MethodInheritanceTest);
  57929. $core.addMethod(
  57930. $core.method({
  57931. selector: "targetClassBottom",
  57932. protocol: "accessing",
  57933. fn: function (){
  57934. var self=this,$self=this;
  57935. return $globals.JavaScriptException;
  57936. },
  57937. args: [],
  57938. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  57939. referencedClasses: ["JavaScriptException"],
  57940. messageSends: []
  57941. }),
  57942. $globals.MethodInheritanceTest);
  57943. $core.addMethod(
  57944. $core.method({
  57945. selector: "targetClassMiddle",
  57946. protocol: "accessing",
  57947. fn: function (){
  57948. var self=this,$self=this;
  57949. return $globals.Error;
  57950. },
  57951. args: [],
  57952. source: "targetClassMiddle\x0a\x09^ Error",
  57953. referencedClasses: ["Error"],
  57954. messageSends: []
  57955. }),
  57956. $globals.MethodInheritanceTest);
  57957. $core.addMethod(
  57958. $core.method({
  57959. selector: "targetClassTop",
  57960. protocol: "accessing",
  57961. fn: function (){
  57962. var self=this,$self=this;
  57963. return $globals.Object;
  57964. },
  57965. args: [],
  57966. source: "targetClassTop\x0a\x09^ Object",
  57967. referencedClasses: ["Object"],
  57968. messageSends: []
  57969. }),
  57970. $globals.MethodInheritanceTest);
  57971. $core.addMethod(
  57972. $core.method({
  57973. selector: "tearDown",
  57974. protocol: "initialization",
  57975. fn: function (){
  57976. var self=this,$self=this;
  57977. return $core.withContext(function($ctx1) {
  57978. $recv((function(){
  57979. return $core.withContext(function($ctx2) {
  57980. return $self._deinstallTop();
  57981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57982. }))._on_do_($globals.Error,(function(){
  57983. }));
  57984. $ctx1.sendIdx["on:do:"]=1;
  57985. $recv((function(){
  57986. return $core.withContext(function($ctx2) {
  57987. return $self._deinstallMiddle();
  57988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57989. }))._on_do_($globals.Error,(function(){
  57990. }));
  57991. $ctx1.sendIdx["on:do:"]=2;
  57992. $recv((function(){
  57993. return $core.withContext(function($ctx2) {
  57994. return $self._deinstallBottom();
  57995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57996. }))._on_do_($globals.Error,(function(){
  57997. }));
  57998. return self;
  57999. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58000. },
  58001. args: [],
  58002. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58003. referencedClasses: ["Error"],
  58004. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58005. }),
  58006. $globals.MethodInheritanceTest);
  58007. $core.addMethod(
  58008. $core.method({
  58009. selector: "testMNU11",
  58010. protocol: "tests",
  58011. fn: function (){
  58012. var self=this,$self=this;
  58013. return $core.withContext(function($ctx1) {
  58014. $self["@performBlock"]=(function(x){
  58015. return $core.withContext(function($ctx2) {
  58016. return $recv(x)._foo();
  58017. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58018. });
  58019. $self._shouldMNU();
  58020. $ctx1.sendIdx["shouldMNU"]=1;
  58021. $self._installTop_("foo ^ false");
  58022. $ctx1.sendIdx["installTop:"]=1;
  58023. $self._installTop_("foo ^ true");
  58024. $self._deinstallTop();
  58025. $self._shouldMNU();
  58026. return self;
  58027. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58028. },
  58029. args: [],
  58030. 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",
  58031. referencedClasses: [],
  58032. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58033. }),
  58034. $globals.MethodInheritanceTest);
  58035. $core.addMethod(
  58036. $core.method({
  58037. selector: "testMNU22",
  58038. protocol: "tests",
  58039. fn: function (){
  58040. var self=this,$self=this;
  58041. return $core.withContext(function($ctx1) {
  58042. $self["@performBlock"]=(function(x){
  58043. return $core.withContext(function($ctx2) {
  58044. return $recv(x)._foo();
  58045. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58046. });
  58047. $self._shouldMNU();
  58048. $ctx1.sendIdx["shouldMNU"]=1;
  58049. $self._installMiddle_("foo ^ false");
  58050. $ctx1.sendIdx["installMiddle:"]=1;
  58051. $self._installMiddle_("foo ^ true");
  58052. $self._deinstallMiddle();
  58053. $self._shouldMNU();
  58054. return self;
  58055. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58056. },
  58057. args: [],
  58058. 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",
  58059. referencedClasses: [],
  58060. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58061. }),
  58062. $globals.MethodInheritanceTest);
  58063. $core.addMethod(
  58064. $core.method({
  58065. selector: "testReturns1",
  58066. protocol: "tests",
  58067. fn: function (){
  58068. var self=this,$self=this;
  58069. return $core.withContext(function($ctx1) {
  58070. $self["@performBlock"]=(function(x){
  58071. return $core.withContext(function($ctx2) {
  58072. return $recv(x)._foo();
  58073. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58074. });
  58075. $self._installTop_("foo ^ false");
  58076. $ctx1.sendIdx["installTop:"]=1;
  58077. $self._shouldReturn_(false);
  58078. $ctx1.sendIdx["shouldReturn:"]=1;
  58079. $self._installTop_("foo ^ true");
  58080. $self._shouldReturn_(true);
  58081. return self;
  58082. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58083. },
  58084. args: [],
  58085. 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",
  58086. referencedClasses: [],
  58087. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58088. }),
  58089. $globals.MethodInheritanceTest);
  58090. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58091. $core.addMethod(
  58092. $core.method({
  58093. selector: "testAbs",
  58094. protocol: "tests",
  58095. fn: function (){
  58096. var self=this,$self=this;
  58097. return $core.withContext(function($ctx1) {
  58098. var $1;
  58099. $1=(4)._abs();
  58100. $ctx1.sendIdx["abs"]=1;
  58101. $self._assert_equals_($1,(4));
  58102. $ctx1.sendIdx["assert:equals:"]=1;
  58103. $self._assert_equals_((-4)._abs(),(4));
  58104. return self;
  58105. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58106. },
  58107. args: [],
  58108. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58109. referencedClasses: [],
  58110. messageSends: ["assert:equals:", "abs"]
  58111. }),
  58112. $globals.NumberTest);
  58113. $core.addMethod(
  58114. $core.method({
  58115. selector: "testArithmetic",
  58116. protocol: "tests",
  58117. fn: function (){
  58118. var self=this,$self=this;
  58119. return $core.withContext(function($ctx1) {
  58120. var $1,$2,$3,$5,$4;
  58121. $1=(1.5).__plus((1));
  58122. $ctx1.sendIdx["+"]=1;
  58123. $self._assert_equals_($1,(2.5));
  58124. $ctx1.sendIdx["assert:equals:"]=1;
  58125. $2=(2).__minus((1));
  58126. $ctx1.sendIdx["-"]=1;
  58127. $self._assert_equals_($2,(1));
  58128. $ctx1.sendIdx["assert:equals:"]=2;
  58129. $self._assert_equals_((-2).__minus((1)),(-3));
  58130. $ctx1.sendIdx["assert:equals:"]=3;
  58131. $self._assert_equals_((12).__slash((2)),(6));
  58132. $ctx1.sendIdx["assert:equals:"]=4;
  58133. $3=(3).__star((4));
  58134. $ctx1.sendIdx["*"]=1;
  58135. $self._assert_equals_($3,(12));
  58136. $ctx1.sendIdx["assert:equals:"]=5;
  58137. $self._assert_equals_((7).__slash_slash((2)),(3));
  58138. $ctx1.sendIdx["assert:equals:"]=6;
  58139. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58140. $ctx1.sendIdx["assert:equals:"]=7;
  58141. $5=(1).__plus((2));
  58142. $ctx1.sendIdx["+"]=2;
  58143. $4=$recv($5).__star((3));
  58144. $ctx1.sendIdx["*"]=2;
  58145. $self._assert_equals_($4,(9));
  58146. $ctx1.sendIdx["assert:equals:"]=8;
  58147. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58148. return self;
  58149. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58150. },
  58151. args: [],
  58152. 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",
  58153. referencedClasses: [],
  58154. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58155. }),
  58156. $globals.NumberTest);
  58157. $core.addMethod(
  58158. $core.method({
  58159. selector: "testAsNumber",
  58160. protocol: "tests",
  58161. fn: function (){
  58162. var self=this,$self=this;
  58163. return $core.withContext(function($ctx1) {
  58164. $self._assert_equals_((3)._asNumber(),(3));
  58165. return self;
  58166. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58167. },
  58168. args: [],
  58169. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58170. referencedClasses: [],
  58171. messageSends: ["assert:equals:", "asNumber"]
  58172. }),
  58173. $globals.NumberTest);
  58174. $core.addMethod(
  58175. $core.method({
  58176. selector: "testBetweenAnd",
  58177. protocol: "tests",
  58178. fn: function (){
  58179. var self=this,$self=this;
  58180. return $core.withContext(function($ctx1) {
  58181. var $1,$3,$2,$5,$4;
  58182. $1=(4)._between_and_((3),(5));
  58183. $ctx1.sendIdx["between:and:"]=1;
  58184. $self._assert_($1);
  58185. $ctx1.sendIdx["assert:"]=1;
  58186. $3=(1)._between_and_((5),(6));
  58187. $ctx1.sendIdx["between:and:"]=2;
  58188. $2=$recv($3)._not();
  58189. $ctx1.sendIdx["not"]=1;
  58190. $self._assert_($2);
  58191. $ctx1.sendIdx["assert:"]=2;
  58192. $5=(90)._between_and_((67),(87));
  58193. $ctx1.sendIdx["between:and:"]=3;
  58194. $4=$recv($5)._not();
  58195. $self._assert_($4);
  58196. $ctx1.sendIdx["assert:"]=3;
  58197. $self._assert_((1)._between_and_((1),(1)));
  58198. return self;
  58199. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58200. },
  58201. args: [],
  58202. 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).",
  58203. referencedClasses: [],
  58204. messageSends: ["assert:", "between:and:", "not"]
  58205. }),
  58206. $globals.NumberTest);
  58207. $core.addMethod(
  58208. $core.method({
  58209. selector: "testBitAnd",
  58210. protocol: "tests",
  58211. fn: function (){
  58212. var self=this,$self=this;
  58213. return $core.withContext(function($ctx1) {
  58214. var $1,$2;
  58215. $1=(15)._bitAnd_((2));
  58216. $ctx1.sendIdx["bitAnd:"]=1;
  58217. $self._assert_equals_($1,(2));
  58218. $ctx1.sendIdx["assert:equals:"]=1;
  58219. $2=(15)._bitAnd_((15));
  58220. $ctx1.sendIdx["bitAnd:"]=2;
  58221. $self._assert_equals_($2,(15));
  58222. $ctx1.sendIdx["assert:equals:"]=2;
  58223. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58224. return self;
  58225. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58226. },
  58227. args: [],
  58228. 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",
  58229. referencedClasses: [],
  58230. messageSends: ["assert:equals:", "bitAnd:"]
  58231. }),
  58232. $globals.NumberTest);
  58233. $core.addMethod(
  58234. $core.method({
  58235. selector: "testBitNot",
  58236. protocol: "tests",
  58237. fn: function (){
  58238. var self=this,$self=this;
  58239. return $core.withContext(function($ctx1) {
  58240. var $1,$2;
  58241. $1=(2)._bitNot();
  58242. $ctx1.sendIdx["bitNot"]=1;
  58243. $self._assert_equals_($1,(-3));
  58244. $ctx1.sendIdx["assert:equals:"]=1;
  58245. $2=(-1)._bitNot();
  58246. $ctx1.sendIdx["bitNot"]=2;
  58247. $self._assert_equals_($2,(0));
  58248. $ctx1.sendIdx["assert:equals:"]=2;
  58249. $self._assert_equals_((-1022)._bitNot(),(1021));
  58250. return self;
  58251. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58252. },
  58253. args: [],
  58254. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58255. referencedClasses: [],
  58256. messageSends: ["assert:equals:", "bitNot"]
  58257. }),
  58258. $globals.NumberTest);
  58259. $core.addMethod(
  58260. $core.method({
  58261. selector: "testBitOr",
  58262. protocol: "tests",
  58263. fn: function (){
  58264. var self=this,$self=this;
  58265. return $core.withContext(function($ctx1) {
  58266. var $1,$2;
  58267. $1=(2)._bitOr_((4));
  58268. $ctx1.sendIdx["bitOr:"]=1;
  58269. $self._assert_equals_($1,(6));
  58270. $ctx1.sendIdx["assert:equals:"]=1;
  58271. $2=(7)._bitOr_((2));
  58272. $ctx1.sendIdx["bitOr:"]=2;
  58273. $self._assert_equals_($2,(7));
  58274. $ctx1.sendIdx["assert:equals:"]=2;
  58275. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58276. return self;
  58277. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58278. },
  58279. args: [],
  58280. 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",
  58281. referencedClasses: [],
  58282. messageSends: ["assert:equals:", "bitOr:"]
  58283. }),
  58284. $globals.NumberTest);
  58285. $core.addMethod(
  58286. $core.method({
  58287. selector: "testBitXor",
  58288. protocol: "tests",
  58289. fn: function (){
  58290. var self=this,$self=this;
  58291. return $core.withContext(function($ctx1) {
  58292. var $1,$2,$3;
  58293. $1=(2)._bitXor_((4));
  58294. $ctx1.sendIdx["bitXor:"]=1;
  58295. $self._assert_equals_($1,(6));
  58296. $ctx1.sendIdx["assert:equals:"]=1;
  58297. $2=(7)._bitXor_((2));
  58298. $ctx1.sendIdx["bitXor:"]=2;
  58299. $self._assert_equals_($2,(5));
  58300. $ctx1.sendIdx["assert:equals:"]=2;
  58301. $3=(-1)._bitXor_((1021));
  58302. $ctx1.sendIdx["bitXor:"]=3;
  58303. $self._assert_equals_($3,(-1022));
  58304. $ctx1.sendIdx["assert:equals:"]=3;
  58305. $self._assert_equals_((91)._bitXor_((91)),(0));
  58306. return self;
  58307. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58308. },
  58309. args: [],
  58310. 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",
  58311. referencedClasses: [],
  58312. messageSends: ["assert:equals:", "bitXor:"]
  58313. }),
  58314. $globals.NumberTest);
  58315. $core.addMethod(
  58316. $core.method({
  58317. selector: "testCeiling",
  58318. protocol: "tests",
  58319. fn: function (){
  58320. var self=this,$self=this;
  58321. return $core.withContext(function($ctx1) {
  58322. var $1,$2;
  58323. $1=(1.2)._ceiling();
  58324. $ctx1.sendIdx["ceiling"]=1;
  58325. $self._assert_equals_($1,(2));
  58326. $ctx1.sendIdx["assert:equals:"]=1;
  58327. $2=(-1.2)._ceiling();
  58328. $ctx1.sendIdx["ceiling"]=2;
  58329. $self._assert_equals_($2,(-1));
  58330. $ctx1.sendIdx["assert:equals:"]=2;
  58331. $self._assert_equals_((1)._ceiling(),(1));
  58332. return self;
  58333. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58334. },
  58335. args: [],
  58336. 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.",
  58337. referencedClasses: [],
  58338. messageSends: ["assert:equals:", "ceiling"]
  58339. }),
  58340. $globals.NumberTest);
  58341. $core.addMethod(
  58342. $core.method({
  58343. selector: "testComparison",
  58344. protocol: "tests",
  58345. fn: function (){
  58346. var self=this,$self=this;
  58347. return $core.withContext(function($ctx1) {
  58348. var $1,$2,$3,$4;
  58349. $1=(3).__gt((2));
  58350. $ctx1.sendIdx[">"]=1;
  58351. $self._assert_($1);
  58352. $ctx1.sendIdx["assert:"]=1;
  58353. $2=(2).__lt((3));
  58354. $ctx1.sendIdx["<"]=1;
  58355. $self._assert_($2);
  58356. $ctx1.sendIdx["assert:"]=2;
  58357. $self._deny_((3).__lt((2)));
  58358. $ctx1.sendIdx["deny:"]=1;
  58359. $self._deny_((2).__gt((3)));
  58360. $3=(3).__gt_eq((3));
  58361. $ctx1.sendIdx[">="]=1;
  58362. $self._assert_($3);
  58363. $ctx1.sendIdx["assert:"]=3;
  58364. $self._assert_((3.1).__gt_eq((3)));
  58365. $ctx1.sendIdx["assert:"]=4;
  58366. $4=(3).__lt_eq((3));
  58367. $ctx1.sendIdx["<="]=1;
  58368. $self._assert_($4);
  58369. $ctx1.sendIdx["assert:"]=5;
  58370. $self._assert_((3).__lt_eq((3.1)));
  58371. return self;
  58372. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58373. },
  58374. args: [],
  58375. 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",
  58376. referencedClasses: [],
  58377. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58378. }),
  58379. $globals.NumberTest);
  58380. $core.addMethod(
  58381. $core.method({
  58382. selector: "testCopying",
  58383. protocol: "tests",
  58384. fn: function (){
  58385. var self=this,$self=this;
  58386. return $core.withContext(function($ctx1) {
  58387. var $1;
  58388. $1=$recv((1)._copy()).__eq_eq((1));
  58389. $ctx1.sendIdx["=="]=1;
  58390. $self._assert_($1);
  58391. $ctx1.sendIdx["assert:"]=1;
  58392. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58393. return self;
  58394. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58395. },
  58396. args: [],
  58397. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58398. referencedClasses: [],
  58399. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58400. }),
  58401. $globals.NumberTest);
  58402. $core.addMethod(
  58403. $core.method({
  58404. selector: "testDegreesToRadians",
  58405. protocol: "tests",
  58406. fn: function (){
  58407. var self=this,$self=this;
  58408. return $core.withContext(function($ctx1) {
  58409. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58410. return self;
  58411. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58412. },
  58413. args: [],
  58414. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58415. referencedClasses: ["Number"],
  58416. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58417. }),
  58418. $globals.NumberTest);
  58419. $core.addMethod(
  58420. $core.method({
  58421. selector: "testEquality",
  58422. protocol: "tests",
  58423. fn: function (){
  58424. var self=this,$self=this;
  58425. return $core.withContext(function($ctx1) {
  58426. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58427. $1=(1).__eq((1));
  58428. $ctx1.sendIdx["="]=1;
  58429. $self._assert_($1);
  58430. $ctx1.sendIdx["assert:"]=1;
  58431. $2=(0).__eq((0));
  58432. $ctx1.sendIdx["="]=2;
  58433. $self._assert_($2);
  58434. $ctx1.sendIdx["assert:"]=2;
  58435. $3=(1).__eq((0));
  58436. $ctx1.sendIdx["="]=3;
  58437. $self._deny_($3);
  58438. $ctx1.sendIdx["deny:"]=1;
  58439. $5=(1)._yourself();
  58440. $ctx1.sendIdx["yourself"]=1;
  58441. $4=$recv($5).__eq((1));
  58442. $ctx1.sendIdx["="]=4;
  58443. $self._assert_($4);
  58444. $ctx1.sendIdx["assert:"]=3;
  58445. $7=(1)._yourself();
  58446. $ctx1.sendIdx["yourself"]=2;
  58447. $6=(1).__eq($7);
  58448. $ctx1.sendIdx["="]=5;
  58449. $self._assert_($6);
  58450. $ctx1.sendIdx["assert:"]=4;
  58451. $9=(1)._yourself();
  58452. $ctx1.sendIdx["yourself"]=3;
  58453. $8=$recv($9).__eq((1)._yourself());
  58454. $ctx1.sendIdx["="]=6;
  58455. $self._assert_($8);
  58456. $10=(0).__eq(false);
  58457. $ctx1.sendIdx["="]=7;
  58458. $self._deny_($10);
  58459. $ctx1.sendIdx["deny:"]=2;
  58460. $11=false.__eq((0));
  58461. $ctx1.sendIdx["="]=8;
  58462. $self._deny_($11);
  58463. $ctx1.sendIdx["deny:"]=3;
  58464. $12="".__eq((0));
  58465. $ctx1.sendIdx["="]=9;
  58466. $self._deny_($12);
  58467. $ctx1.sendIdx["deny:"]=4;
  58468. $self._deny_((0).__eq(""));
  58469. return self;
  58470. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58471. },
  58472. args: [],
  58473. 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 = ''",
  58474. referencedClasses: [],
  58475. messageSends: ["assert:", "=", "deny:", "yourself"]
  58476. }),
  58477. $globals.NumberTest);
  58478. $core.addMethod(
  58479. $core.method({
  58480. selector: "testFloor",
  58481. protocol: "tests",
  58482. fn: function (){
  58483. var self=this,$self=this;
  58484. return $core.withContext(function($ctx1) {
  58485. var $1,$2;
  58486. $1=(1.2)._floor();
  58487. $ctx1.sendIdx["floor"]=1;
  58488. $self._assert_equals_($1,(1));
  58489. $ctx1.sendIdx["assert:equals:"]=1;
  58490. $2=(-1.2)._floor();
  58491. $ctx1.sendIdx["floor"]=2;
  58492. $self._assert_equals_($2,(-2));
  58493. $ctx1.sendIdx["assert:equals:"]=2;
  58494. $self._assert_equals_((1)._floor(),(1));
  58495. return self;
  58496. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58497. },
  58498. args: [],
  58499. 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.",
  58500. referencedClasses: [],
  58501. messageSends: ["assert:equals:", "floor"]
  58502. }),
  58503. $globals.NumberTest);
  58504. $core.addMethod(
  58505. $core.method({
  58506. selector: "testHexNumbers",
  58507. protocol: "tests",
  58508. fn: function (){
  58509. var self=this,$self=this;
  58510. return $core.withContext(function($ctx1) {
  58511. var $1,$2,$3,$4,$5;
  58512. $self._assert_equals_((9),(9));
  58513. $ctx1.sendIdx["assert:equals:"]=1;
  58514. $1=(10)._truncated();
  58515. $ctx1.sendIdx["truncated"]=1;
  58516. $self._assert_equals_($1,(10));
  58517. $ctx1.sendIdx["assert:equals:"]=2;
  58518. $2=(11)._truncated();
  58519. $ctx1.sendIdx["truncated"]=2;
  58520. $self._assert_equals_($2,(11));
  58521. $ctx1.sendIdx["assert:equals:"]=3;
  58522. $3=(12)._truncated();
  58523. $ctx1.sendIdx["truncated"]=3;
  58524. $self._assert_equals_($3,(12));
  58525. $ctx1.sendIdx["assert:equals:"]=4;
  58526. $4=(13)._truncated();
  58527. $ctx1.sendIdx["truncated"]=4;
  58528. $self._assert_equals_($4,(13));
  58529. $ctx1.sendIdx["assert:equals:"]=5;
  58530. $5=(14)._truncated();
  58531. $ctx1.sendIdx["truncated"]=5;
  58532. $self._assert_equals_($5,(14));
  58533. $ctx1.sendIdx["assert:equals:"]=6;
  58534. $self._assert_equals_((15)._truncated(),(15));
  58535. return self;
  58536. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58537. },
  58538. args: [],
  58539. 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",
  58540. referencedClasses: [],
  58541. messageSends: ["assert:equals:", "truncated"]
  58542. }),
  58543. $globals.NumberTest);
  58544. $core.addMethod(
  58545. $core.method({
  58546. selector: "testIdentity",
  58547. protocol: "tests",
  58548. fn: function (){
  58549. var self=this,$self=this;
  58550. return $core.withContext(function($ctx1) {
  58551. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58552. $1=(1).__eq_eq((1));
  58553. $ctx1.sendIdx["=="]=1;
  58554. $self._assert_($1);
  58555. $ctx1.sendIdx["assert:"]=1;
  58556. $2=(0).__eq_eq((0));
  58557. $ctx1.sendIdx["=="]=2;
  58558. $self._assert_($2);
  58559. $ctx1.sendIdx["assert:"]=2;
  58560. $3=(1).__eq_eq((0));
  58561. $ctx1.sendIdx["=="]=3;
  58562. $self._deny_($3);
  58563. $ctx1.sendIdx["deny:"]=1;
  58564. $5=(1)._yourself();
  58565. $ctx1.sendIdx["yourself"]=1;
  58566. $4=$recv($5).__eq_eq((1));
  58567. $ctx1.sendIdx["=="]=4;
  58568. $self._assert_($4);
  58569. $ctx1.sendIdx["assert:"]=3;
  58570. $7=(1)._yourself();
  58571. $ctx1.sendIdx["yourself"]=2;
  58572. $6=(1).__eq_eq($7);
  58573. $ctx1.sendIdx["=="]=5;
  58574. $self._assert_($6);
  58575. $ctx1.sendIdx["assert:"]=4;
  58576. $9=(1)._yourself();
  58577. $ctx1.sendIdx["yourself"]=3;
  58578. $8=$recv($9).__eq_eq((1)._yourself());
  58579. $ctx1.sendIdx["=="]=6;
  58580. $self._assert_($8);
  58581. $self._deny_((1).__eq_eq((2)));
  58582. return self;
  58583. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58584. },
  58585. args: [],
  58586. 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",
  58587. referencedClasses: [],
  58588. messageSends: ["assert:", "==", "deny:", "yourself"]
  58589. }),
  58590. $globals.NumberTest);
  58591. $core.addMethod(
  58592. $core.method({
  58593. selector: "testInvalidHexNumbers",
  58594. protocol: "tests",
  58595. fn: function (){
  58596. var self=this,$self=this;
  58597. return $core.withContext(function($ctx1) {
  58598. $self._should_raise_((function(){
  58599. return $core.withContext(function($ctx2) {
  58600. return (16)._rG();
  58601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58602. }),$globals.MessageNotUnderstood);
  58603. $ctx1.sendIdx["should:raise:"]=1;
  58604. $self._should_raise_((function(){
  58605. return $core.withContext(function($ctx2) {
  58606. return (16)._rg();
  58607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58608. }),$globals.MessageNotUnderstood);
  58609. $ctx1.sendIdx["should:raise:"]=2;
  58610. $self._should_raise_((function(){
  58611. return $core.withContext(function($ctx2) {
  58612. return (16)._rH();
  58613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58614. }),$globals.MessageNotUnderstood);
  58615. $ctx1.sendIdx["should:raise:"]=3;
  58616. $self._should_raise_((function(){
  58617. return $core.withContext(function($ctx2) {
  58618. return (16)._rh();
  58619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58620. }),$globals.MessageNotUnderstood);
  58621. $ctx1.sendIdx["should:raise:"]=4;
  58622. $self._should_raise_((function(){
  58623. return $core.withContext(function($ctx2) {
  58624. return (16)._rI();
  58625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58626. }),$globals.MessageNotUnderstood);
  58627. $ctx1.sendIdx["should:raise:"]=5;
  58628. $self._should_raise_((function(){
  58629. return $core.withContext(function($ctx2) {
  58630. return (16)._ri();
  58631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58632. }),$globals.MessageNotUnderstood);
  58633. $ctx1.sendIdx["should:raise:"]=6;
  58634. $self._should_raise_((function(){
  58635. return $core.withContext(function($ctx2) {
  58636. return (16)._rJ();
  58637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58638. }),$globals.MessageNotUnderstood);
  58639. $ctx1.sendIdx["should:raise:"]=7;
  58640. $self._should_raise_((function(){
  58641. return $core.withContext(function($ctx2) {
  58642. return (16)._rj();
  58643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58644. }),$globals.MessageNotUnderstood);
  58645. $ctx1.sendIdx["should:raise:"]=8;
  58646. $self._should_raise_((function(){
  58647. return $core.withContext(function($ctx2) {
  58648. return (16)._rK();
  58649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58650. }),$globals.MessageNotUnderstood);
  58651. $ctx1.sendIdx["should:raise:"]=9;
  58652. $self._should_raise_((function(){
  58653. return $core.withContext(function($ctx2) {
  58654. return (16)._rk();
  58655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58656. }),$globals.MessageNotUnderstood);
  58657. $ctx1.sendIdx["should:raise:"]=10;
  58658. $self._should_raise_((function(){
  58659. return $core.withContext(function($ctx2) {
  58660. return (16)._rL();
  58661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58662. }),$globals.MessageNotUnderstood);
  58663. $ctx1.sendIdx["should:raise:"]=11;
  58664. $self._should_raise_((function(){
  58665. return $core.withContext(function($ctx2) {
  58666. return (16)._rl();
  58667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58668. }),$globals.MessageNotUnderstood);
  58669. $ctx1.sendIdx["should:raise:"]=12;
  58670. $self._should_raise_((function(){
  58671. return $core.withContext(function($ctx2) {
  58672. return (16)._rM();
  58673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58674. }),$globals.MessageNotUnderstood);
  58675. $ctx1.sendIdx["should:raise:"]=13;
  58676. $self._should_raise_((function(){
  58677. return $core.withContext(function($ctx2) {
  58678. return (16)._rm();
  58679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58680. }),$globals.MessageNotUnderstood);
  58681. $ctx1.sendIdx["should:raise:"]=14;
  58682. $self._should_raise_((function(){
  58683. return $core.withContext(function($ctx2) {
  58684. return (16)._rN();
  58685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  58686. }),$globals.MessageNotUnderstood);
  58687. $ctx1.sendIdx["should:raise:"]=15;
  58688. $self._should_raise_((function(){
  58689. return $core.withContext(function($ctx2) {
  58690. return (16)._rn();
  58691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  58692. }),$globals.MessageNotUnderstood);
  58693. $ctx1.sendIdx["should:raise:"]=16;
  58694. $self._should_raise_((function(){
  58695. return $core.withContext(function($ctx2) {
  58696. return (16)._rO();
  58697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  58698. }),$globals.MessageNotUnderstood);
  58699. $ctx1.sendIdx["should:raise:"]=17;
  58700. $self._should_raise_((function(){
  58701. return $core.withContext(function($ctx2) {
  58702. return (16)._ro();
  58703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  58704. }),$globals.MessageNotUnderstood);
  58705. $ctx1.sendIdx["should:raise:"]=18;
  58706. $self._should_raise_((function(){
  58707. return $core.withContext(function($ctx2) {
  58708. return (16)._rP();
  58709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  58710. }),$globals.MessageNotUnderstood);
  58711. $ctx1.sendIdx["should:raise:"]=19;
  58712. $self._should_raise_((function(){
  58713. return $core.withContext(function($ctx2) {
  58714. return (16)._rp();
  58715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  58716. }),$globals.MessageNotUnderstood);
  58717. $ctx1.sendIdx["should:raise:"]=20;
  58718. $self._should_raise_((function(){
  58719. return $core.withContext(function($ctx2) {
  58720. return (16)._rQ();
  58721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  58722. }),$globals.MessageNotUnderstood);
  58723. $ctx1.sendIdx["should:raise:"]=21;
  58724. $self._should_raise_((function(){
  58725. return $core.withContext(function($ctx2) {
  58726. return (16)._rq();
  58727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  58728. }),$globals.MessageNotUnderstood);
  58729. $ctx1.sendIdx["should:raise:"]=22;
  58730. $self._should_raise_((function(){
  58731. return $core.withContext(function($ctx2) {
  58732. return (16)._rR();
  58733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  58734. }),$globals.MessageNotUnderstood);
  58735. $ctx1.sendIdx["should:raise:"]=23;
  58736. $self._should_raise_((function(){
  58737. return $core.withContext(function($ctx2) {
  58738. return (16)._rr();
  58739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  58740. }),$globals.MessageNotUnderstood);
  58741. $ctx1.sendIdx["should:raise:"]=24;
  58742. $self._should_raise_((function(){
  58743. return $core.withContext(function($ctx2) {
  58744. return (16)._rS();
  58745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  58746. }),$globals.MessageNotUnderstood);
  58747. $ctx1.sendIdx["should:raise:"]=25;
  58748. $self._should_raise_((function(){
  58749. return $core.withContext(function($ctx2) {
  58750. return (16)._rs();
  58751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  58752. }),$globals.MessageNotUnderstood);
  58753. $ctx1.sendIdx["should:raise:"]=26;
  58754. $self._should_raise_((function(){
  58755. return $core.withContext(function($ctx2) {
  58756. return (16)._rT();
  58757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  58758. }),$globals.MessageNotUnderstood);
  58759. $ctx1.sendIdx["should:raise:"]=27;
  58760. $self._should_raise_((function(){
  58761. return $core.withContext(function($ctx2) {
  58762. return (16)._rt();
  58763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  58764. }),$globals.MessageNotUnderstood);
  58765. $ctx1.sendIdx["should:raise:"]=28;
  58766. $self._should_raise_((function(){
  58767. return $core.withContext(function($ctx2) {
  58768. return (16)._rU();
  58769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  58770. }),$globals.MessageNotUnderstood);
  58771. $ctx1.sendIdx["should:raise:"]=29;
  58772. $self._should_raise_((function(){
  58773. return $core.withContext(function($ctx2) {
  58774. return (16)._ru();
  58775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  58776. }),$globals.MessageNotUnderstood);
  58777. $ctx1.sendIdx["should:raise:"]=30;
  58778. $self._should_raise_((function(){
  58779. return $core.withContext(function($ctx2) {
  58780. return (16)._rV();
  58781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  58782. }),$globals.MessageNotUnderstood);
  58783. $ctx1.sendIdx["should:raise:"]=31;
  58784. $self._should_raise_((function(){
  58785. return $core.withContext(function($ctx2) {
  58786. return (16)._rv();
  58787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  58788. }),$globals.MessageNotUnderstood);
  58789. $ctx1.sendIdx["should:raise:"]=32;
  58790. $self._should_raise_((function(){
  58791. return $core.withContext(function($ctx2) {
  58792. return (16)._rW();
  58793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  58794. }),$globals.MessageNotUnderstood);
  58795. $ctx1.sendIdx["should:raise:"]=33;
  58796. $self._should_raise_((function(){
  58797. return $core.withContext(function($ctx2) {
  58798. return (16)._rw();
  58799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  58800. }),$globals.MessageNotUnderstood);
  58801. $ctx1.sendIdx["should:raise:"]=34;
  58802. $self._should_raise_((function(){
  58803. return $core.withContext(function($ctx2) {
  58804. return (16)._rX();
  58805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  58806. }),$globals.MessageNotUnderstood);
  58807. $ctx1.sendIdx["should:raise:"]=35;
  58808. $self._should_raise_((function(){
  58809. return $core.withContext(function($ctx2) {
  58810. return (16)._rx();
  58811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  58812. }),$globals.MessageNotUnderstood);
  58813. $ctx1.sendIdx["should:raise:"]=36;
  58814. $self._should_raise_((function(){
  58815. return $core.withContext(function($ctx2) {
  58816. return (16)._rY();
  58817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  58818. }),$globals.MessageNotUnderstood);
  58819. $ctx1.sendIdx["should:raise:"]=37;
  58820. $self._should_raise_((function(){
  58821. return $core.withContext(function($ctx2) {
  58822. return (16)._ry();
  58823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  58824. }),$globals.MessageNotUnderstood);
  58825. $ctx1.sendIdx["should:raise:"]=38;
  58826. $self._should_raise_((function(){
  58827. return $core.withContext(function($ctx2) {
  58828. return (16)._rZ();
  58829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  58830. }),$globals.MessageNotUnderstood);
  58831. $ctx1.sendIdx["should:raise:"]=39;
  58832. $self._should_raise_((function(){
  58833. return $core.withContext(function($ctx2) {
  58834. return (16)._rz();
  58835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  58836. }),$globals.MessageNotUnderstood);
  58837. $ctx1.sendIdx["should:raise:"]=40;
  58838. $self._should_raise_((function(){
  58839. return $core.withContext(function($ctx2) {
  58840. return (11259375)._Z();
  58841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  58842. }),$globals.MessageNotUnderstood);
  58843. return self;
  58844. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  58845. },
  58846. args: [],
  58847. 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.",
  58848. referencedClasses: ["MessageNotUnderstood"],
  58849. 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"]
  58850. }),
  58851. $globals.NumberTest);
  58852. $core.addMethod(
  58853. $core.method({
  58854. selector: "testLog",
  58855. protocol: "tests",
  58856. fn: function (){
  58857. var self=this,$self=this;
  58858. return $core.withContext(function($ctx1) {
  58859. $self._assert_equals_((10000)._log(),(4));
  58860. $ctx1.sendIdx["assert:equals:"]=1;
  58861. $self._assert_equals_((512)._log_((2)),(9));
  58862. $ctx1.sendIdx["assert:equals:"]=2;
  58863. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  58864. return self;
  58865. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  58866. },
  58867. args: [],
  58868. 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.",
  58869. referencedClasses: ["Number"],
  58870. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  58871. }),
  58872. $globals.NumberTest);
  58873. $core.addMethod(
  58874. $core.method({
  58875. selector: "testMinMax",
  58876. protocol: "tests",
  58877. fn: function (){
  58878. var self=this,$self=this;
  58879. return $core.withContext(function($ctx1) {
  58880. var $1,$2;
  58881. $self._assert_equals_((2)._max_((5)),(5));
  58882. $ctx1.sendIdx["assert:equals:"]=1;
  58883. $self._assert_equals_((2)._min_((5)),(2));
  58884. $ctx1.sendIdx["assert:equals:"]=2;
  58885. $1=(2)._min_max_((5),(3));
  58886. $ctx1.sendIdx["min:max:"]=1;
  58887. $self._assert_equals_($1,(3));
  58888. $ctx1.sendIdx["assert:equals:"]=3;
  58889. $2=(7)._min_max_((5),(3));
  58890. $ctx1.sendIdx["min:max:"]=2;
  58891. $self._assert_equals_($2,(5));
  58892. $ctx1.sendIdx["assert:equals:"]=4;
  58893. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  58894. return self;
  58895. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  58896. },
  58897. args: [],
  58898. 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.",
  58899. referencedClasses: [],
  58900. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  58901. }),
  58902. $globals.NumberTest);
  58903. $core.addMethod(
  58904. $core.method({
  58905. selector: "testNegated",
  58906. protocol: "tests",
  58907. fn: function (){
  58908. var self=this,$self=this;
  58909. return $core.withContext(function($ctx1) {
  58910. var $1;
  58911. $1=(3)._negated();
  58912. $ctx1.sendIdx["negated"]=1;
  58913. $self._assert_equals_($1,(-3));
  58914. $ctx1.sendIdx["assert:equals:"]=1;
  58915. $self._assert_equals_((-3)._negated(),(3));
  58916. return self;
  58917. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  58918. },
  58919. args: [],
  58920. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  58921. referencedClasses: [],
  58922. messageSends: ["assert:equals:", "negated"]
  58923. }),
  58924. $globals.NumberTest);
  58925. $core.addMethod(
  58926. $core.method({
  58927. selector: "testPrintShowingDecimalPlaces",
  58928. protocol: "tests",
  58929. fn: function (){
  58930. var self=this,$self=this;
  58931. return $core.withContext(function($ctx1) {
  58932. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  58933. $1=(23)._printShowingDecimalPlaces_((2));
  58934. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  58935. $self._assert_equals_($1,"23.00");
  58936. $ctx1.sendIdx["assert:equals:"]=1;
  58937. $2=(23.5698)._printShowingDecimalPlaces_((2));
  58938. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  58939. $self._assert_equals_($2,"23.57");
  58940. $ctx1.sendIdx["assert:equals:"]=2;
  58941. $4=(234.567)._negated();
  58942. $ctx1.sendIdx["negated"]=1;
  58943. $3=$recv($4)._printShowingDecimalPlaces_((5));
  58944. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  58945. $self._assert_equals_($3,"-234.56700");
  58946. $ctx1.sendIdx["assert:equals:"]=3;
  58947. $5=(23.4567)._printShowingDecimalPlaces_((0));
  58948. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  58949. $self._assert_equals_($5,"23");
  58950. $ctx1.sendIdx["assert:equals:"]=4;
  58951. $6=(23.5567)._printShowingDecimalPlaces_((0));
  58952. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  58953. $self._assert_equals_($6,"24");
  58954. $ctx1.sendIdx["assert:equals:"]=5;
  58955. $8=(23.4567)._negated();
  58956. $ctx1.sendIdx["negated"]=2;
  58957. $7=$recv($8)._printShowingDecimalPlaces_((0));
  58958. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  58959. $self._assert_equals_($7,"-23");
  58960. $ctx1.sendIdx["assert:equals:"]=6;
  58961. $10=(23.5567)._negated();
  58962. $ctx1.sendIdx["negated"]=3;
  58963. $9=$recv($10)._printShowingDecimalPlaces_((0));
  58964. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  58965. $self._assert_equals_($9,"-24");
  58966. $ctx1.sendIdx["assert:equals:"]=7;
  58967. $11=(100000000)._printShowingDecimalPlaces_((1));
  58968. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  58969. $self._assert_equals_($11,"100000000.0");
  58970. $ctx1.sendIdx["assert:equals:"]=8;
  58971. $12=(0.98)._printShowingDecimalPlaces_((5));
  58972. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  58973. $self._assert_equals_($12,"0.98000");
  58974. $ctx1.sendIdx["assert:equals:"]=9;
  58975. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  58976. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  58977. $self._assert_equals_($13,"-0.98");
  58978. $ctx1.sendIdx["assert:equals:"]=10;
  58979. $14=(2.567)._printShowingDecimalPlaces_((2));
  58980. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  58981. $self._assert_equals_($14,"2.57");
  58982. $ctx1.sendIdx["assert:equals:"]=11;
  58983. $15=(-2.567)._printShowingDecimalPlaces_((2));
  58984. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  58985. $self._assert_equals_($15,"-2.57");
  58986. $ctx1.sendIdx["assert:equals:"]=12;
  58987. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  58988. return self;
  58989. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  58990. },
  58991. args: [],
  58992. 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'.",
  58993. referencedClasses: [],
  58994. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  58995. }),
  58996. $globals.NumberTest);
  58997. $core.addMethod(
  58998. $core.method({
  58999. selector: "testPrintStringBase",
  59000. protocol: "tests",
  59001. fn: function (){
  59002. var self=this,$self=this;
  59003. return $core.withContext(function($ctx1) {
  59004. var $1,$2,$3;
  59005. $1=(15)._printStringBase_((2));
  59006. $ctx1.sendIdx["printStringBase:"]=1;
  59007. $self._assert_equals_($1,"1111");
  59008. $ctx1.sendIdx["assert:equals:"]=1;
  59009. $2=(15)._printStringBase_((16));
  59010. $ctx1.sendIdx["printStringBase:"]=2;
  59011. $self._assert_equals_($2,"f");
  59012. $ctx1.sendIdx["assert:equals:"]=2;
  59013. $3=(256)._printStringBase_((16));
  59014. $ctx1.sendIdx["printStringBase:"]=3;
  59015. $self._assert_equals_($3,"100");
  59016. $ctx1.sendIdx["assert:equals:"]=3;
  59017. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59018. return self;
  59019. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59020. },
  59021. args: [],
  59022. 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'",
  59023. referencedClasses: [],
  59024. messageSends: ["assert:equals:", "printStringBase:"]
  59025. }),
  59026. $globals.NumberTest);
  59027. $core.addMethod(
  59028. $core.method({
  59029. selector: "testRadiansToDegrees",
  59030. protocol: "tests",
  59031. fn: function (){
  59032. var self=this,$self=this;
  59033. return $core.withContext(function($ctx1) {
  59034. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59035. return self;
  59036. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59037. },
  59038. args: [],
  59039. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59040. referencedClasses: ["Number"],
  59041. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59042. }),
  59043. $globals.NumberTest);
  59044. $core.addMethod(
  59045. $core.method({
  59046. selector: "testRaisedTo",
  59047. protocol: "tests",
  59048. fn: function (){
  59049. var self=this,$self=this;
  59050. return $core.withContext(function($ctx1) {
  59051. var $1,$2,$3;
  59052. $1=(2)._raisedTo_((4));
  59053. $ctx1.sendIdx["raisedTo:"]=1;
  59054. $self._assert_equals_($1,(16));
  59055. $ctx1.sendIdx["assert:equals:"]=1;
  59056. $2=(2)._raisedTo_((0));
  59057. $ctx1.sendIdx["raisedTo:"]=2;
  59058. $self._assert_equals_($2,(1));
  59059. $ctx1.sendIdx["assert:equals:"]=2;
  59060. $3=(2)._raisedTo_((-3));
  59061. $ctx1.sendIdx["raisedTo:"]=3;
  59062. $self._assert_equals_($3,(0.125));
  59063. $ctx1.sendIdx["assert:equals:"]=3;
  59064. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59065. $ctx1.sendIdx["assert:equals:"]=4;
  59066. $self._assert_equals_((2).__star_star((4)),(16));
  59067. return self;
  59068. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59069. },
  59070. args: [],
  59071. 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.",
  59072. referencedClasses: [],
  59073. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59074. }),
  59075. $globals.NumberTest);
  59076. $core.addMethod(
  59077. $core.method({
  59078. selector: "testRounded",
  59079. protocol: "tests",
  59080. fn: function (){
  59081. var self=this,$self=this;
  59082. return $core.withContext(function($ctx1) {
  59083. var $1,$2;
  59084. $1=(3)._rounded();
  59085. $ctx1.sendIdx["rounded"]=1;
  59086. $self._assert_equals_($1,(3));
  59087. $ctx1.sendIdx["assert:equals:"]=1;
  59088. $2=(3.212)._rounded();
  59089. $ctx1.sendIdx["rounded"]=2;
  59090. $self._assert_equals_($2,(3));
  59091. $ctx1.sendIdx["assert:equals:"]=2;
  59092. $self._assert_equals_((3.51)._rounded(),(4));
  59093. return self;
  59094. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59095. },
  59096. args: [],
  59097. 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",
  59098. referencedClasses: [],
  59099. messageSends: ["assert:equals:", "rounded"]
  59100. }),
  59101. $globals.NumberTest);
  59102. $core.addMethod(
  59103. $core.method({
  59104. selector: "testSign",
  59105. protocol: "tests",
  59106. fn: function (){
  59107. var self=this,$self=this;
  59108. return $core.withContext(function($ctx1) {
  59109. var $1,$2;
  59110. $1=(5)._sign();
  59111. $ctx1.sendIdx["sign"]=1;
  59112. $self._assert_equals_($1,(1));
  59113. $ctx1.sendIdx["assert:equals:"]=1;
  59114. $2=(0)._sign();
  59115. $ctx1.sendIdx["sign"]=2;
  59116. $self._assert_equals_($2,(0));
  59117. $ctx1.sendIdx["assert:equals:"]=2;
  59118. $self._assert_equals_((-1.4)._sign(),(-1));
  59119. return self;
  59120. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59121. },
  59122. args: [],
  59123. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59124. referencedClasses: [],
  59125. messageSends: ["assert:equals:", "sign"]
  59126. }),
  59127. $globals.NumberTest);
  59128. $core.addMethod(
  59129. $core.method({
  59130. selector: "testSqrt",
  59131. protocol: "tests",
  59132. fn: function (){
  59133. var self=this,$self=this;
  59134. return $core.withContext(function($ctx1) {
  59135. var $1;
  59136. $1=(4)._sqrt();
  59137. $ctx1.sendIdx["sqrt"]=1;
  59138. $self._assert_equals_($1,(2));
  59139. $ctx1.sendIdx["assert:equals:"]=1;
  59140. $self._assert_equals_((16)._sqrt(),(4));
  59141. return self;
  59142. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59143. },
  59144. args: [],
  59145. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59146. referencedClasses: [],
  59147. messageSends: ["assert:equals:", "sqrt"]
  59148. }),
  59149. $globals.NumberTest);
  59150. $core.addMethod(
  59151. $core.method({
  59152. selector: "testSquared",
  59153. protocol: "tests",
  59154. fn: function (){
  59155. var self=this,$self=this;
  59156. return $core.withContext(function($ctx1) {
  59157. $self._assert_equals_((4)._squared(),(16));
  59158. return self;
  59159. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59160. },
  59161. args: [],
  59162. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59163. referencedClasses: [],
  59164. messageSends: ["assert:equals:", "squared"]
  59165. }),
  59166. $globals.NumberTest);
  59167. $core.addMethod(
  59168. $core.method({
  59169. selector: "testTimesRepeat",
  59170. protocol: "tests",
  59171. fn: function (){
  59172. var self=this,$self=this;
  59173. var i;
  59174. return $core.withContext(function($ctx1) {
  59175. i=(0);
  59176. (0)._timesRepeat_((function(){
  59177. return $core.withContext(function($ctx2) {
  59178. i=$recv(i).__plus((1));
  59179. $ctx2.sendIdx["+"]=1;
  59180. return i;
  59181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59182. }));
  59183. $ctx1.sendIdx["timesRepeat:"]=1;
  59184. $self._assert_equals_(i,(0));
  59185. $ctx1.sendIdx["assert:equals:"]=1;
  59186. (5)._timesRepeat_((function(){
  59187. return $core.withContext(function($ctx2) {
  59188. i=$recv(i).__plus((1));
  59189. return i;
  59190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59191. }));
  59192. $self._assert_equals_(i,(5));
  59193. return self;
  59194. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59195. },
  59196. args: [],
  59197. 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",
  59198. referencedClasses: [],
  59199. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59200. }),
  59201. $globals.NumberTest);
  59202. $core.addMethod(
  59203. $core.method({
  59204. selector: "testTo",
  59205. protocol: "tests",
  59206. fn: function (){
  59207. var self=this,$self=this;
  59208. return $core.withContext(function($ctx1) {
  59209. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59210. return self;
  59211. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59212. },
  59213. args: [],
  59214. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59215. referencedClasses: [],
  59216. messageSends: ["assert:equals:", "to:"]
  59217. }),
  59218. $globals.NumberTest);
  59219. $core.addMethod(
  59220. $core.method({
  59221. selector: "testToBy",
  59222. protocol: "tests",
  59223. fn: function (){
  59224. var self=this,$self=this;
  59225. return $core.withContext(function($ctx1) {
  59226. var $1;
  59227. $1=(0)._to_by_((6),(2));
  59228. $ctx1.sendIdx["to:by:"]=1;
  59229. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59230. $self._should_raise_((function(){
  59231. return $core.withContext(function($ctx2) {
  59232. return (1)._to_by_((4),(0));
  59233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59234. }),$globals.Error);
  59235. return self;
  59236. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59237. },
  59238. args: [],
  59239. 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",
  59240. referencedClasses: ["Error"],
  59241. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59242. }),
  59243. $globals.NumberTest);
  59244. $core.addMethod(
  59245. $core.method({
  59246. selector: "testTrigonometry",
  59247. protocol: "tests",
  59248. fn: function (){
  59249. var self=this,$self=this;
  59250. return $core.withContext(function($ctx1) {
  59251. var $1;
  59252. $self._assert_equals_((0)._cos(),(1));
  59253. $ctx1.sendIdx["assert:equals:"]=1;
  59254. $self._assert_equals_((0)._sin(),(0));
  59255. $ctx1.sendIdx["assert:equals:"]=2;
  59256. $self._assert_equals_((0)._tan(),(0));
  59257. $ctx1.sendIdx["assert:equals:"]=3;
  59258. $self._assert_equals_((1)._arcCos(),(0));
  59259. $ctx1.sendIdx["assert:equals:"]=4;
  59260. $self._assert_equals_((0)._arcSin(),(0));
  59261. $ctx1.sendIdx["assert:equals:"]=5;
  59262. $self._assert_equals_((0)._arcTan(),(0));
  59263. $ctx1.sendIdx["assert:equals:"]=6;
  59264. $1=(0)._arcTan_((1));
  59265. $ctx1.sendIdx["arcTan:"]=1;
  59266. $self._assert_equals_($1,(0));
  59267. $ctx1.sendIdx["assert:equals:"]=7;
  59268. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59269. return self;
  59270. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59271. },
  59272. args: [],
  59273. 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)",
  59274. referencedClasses: ["Number"],
  59275. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59276. }),
  59277. $globals.NumberTest);
  59278. $core.addMethod(
  59279. $core.method({
  59280. selector: "testTruncated",
  59281. protocol: "tests",
  59282. fn: function (){
  59283. var self=this,$self=this;
  59284. return $core.withContext(function($ctx1) {
  59285. var $1,$2;
  59286. $1=(3)._truncated();
  59287. $ctx1.sendIdx["truncated"]=1;
  59288. $self._assert_equals_($1,(3));
  59289. $ctx1.sendIdx["assert:equals:"]=1;
  59290. $2=(3.212)._truncated();
  59291. $ctx1.sendIdx["truncated"]=2;
  59292. $self._assert_equals_($2,(3));
  59293. $ctx1.sendIdx["assert:equals:"]=2;
  59294. $self._assert_equals_((3.51)._truncated(),(3));
  59295. return self;
  59296. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59297. },
  59298. args: [],
  59299. 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",
  59300. referencedClasses: [],
  59301. messageSends: ["assert:equals:", "truncated"]
  59302. }),
  59303. $globals.NumberTest);
  59304. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59305. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59306. $core.addMethod(
  59307. $core.method({
  59308. selector: "foo",
  59309. protocol: "not yet classified",
  59310. fn: function (){
  59311. var self=this,$self=this;
  59312. return $self["@foo"];
  59313. },
  59314. args: [],
  59315. source: "foo\x0a\x09^ foo",
  59316. referencedClasses: [],
  59317. messageSends: []
  59318. }),
  59319. $globals.ObjectMock);
  59320. $core.addMethod(
  59321. $core.method({
  59322. selector: "foo:",
  59323. protocol: "not yet classified",
  59324. fn: function (anObject){
  59325. var self=this,$self=this;
  59326. $self["@foo"]=anObject;
  59327. return self;
  59328. },
  59329. args: ["anObject"],
  59330. source: "foo: anObject\x0a\x09foo := anObject",
  59331. referencedClasses: [],
  59332. messageSends: []
  59333. }),
  59334. $globals.ObjectMock);
  59335. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59336. $core.addMethod(
  59337. $core.method({
  59338. selector: "notDefined",
  59339. protocol: "tests",
  59340. fn: function (){
  59341. var self=this,$self=this;
  59342. return $core.withContext(function($ctx1) {
  59343. return void 0;;
  59344. return self;
  59345. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59346. },
  59347. args: [],
  59348. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59349. referencedClasses: [],
  59350. messageSends: []
  59351. }),
  59352. $globals.ObjectTest);
  59353. $core.addMethod(
  59354. $core.method({
  59355. selector: "testBasicAccess",
  59356. protocol: "tests",
  59357. fn: function (){
  59358. var self=this,$self=this;
  59359. var o;
  59360. return $core.withContext(function($ctx1) {
  59361. var $1;
  59362. o=$recv($globals.Object)._new();
  59363. $recv(o)._basicAt_put_("a",(1));
  59364. $1=$recv(o)._basicAt_("a");
  59365. $ctx1.sendIdx["basicAt:"]=1;
  59366. $self._assert_equals_($1,(1));
  59367. $ctx1.sendIdx["assert:equals:"]=1;
  59368. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59369. return self;
  59370. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59371. },
  59372. args: [],
  59373. 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",
  59374. referencedClasses: ["Object"],
  59375. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59376. }),
  59377. $globals.ObjectTest);
  59378. $core.addMethod(
  59379. $core.method({
  59380. selector: "testBasicPerform",
  59381. protocol: "tests",
  59382. fn: function (){
  59383. var self=this,$self=this;
  59384. var o;
  59385. return $core.withContext(function($ctx1) {
  59386. o=$recv($globals.Object)._new();
  59387. $recv(o)._basicAt_put_("func",(function(){
  59388. return "hello";
  59389. }));
  59390. $ctx1.sendIdx["basicAt:put:"]=1;
  59391. $recv(o)._basicAt_put_("func2",(function(a){
  59392. return $core.withContext(function($ctx2) {
  59393. return $recv(a).__plus((1));
  59394. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59395. }));
  59396. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59397. $ctx1.sendIdx["assert:equals:"]=1;
  59398. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59399. return self;
  59400. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59401. },
  59402. args: [],
  59403. 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",
  59404. referencedClasses: ["Object"],
  59405. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59406. }),
  59407. $globals.ObjectTest);
  59408. $core.addMethod(
  59409. $core.method({
  59410. selector: "testDNU",
  59411. protocol: "tests",
  59412. fn: function (){
  59413. var self=this,$self=this;
  59414. return $core.withContext(function($ctx1) {
  59415. $self._should_raise_((function(){
  59416. return $core.withContext(function($ctx2) {
  59417. return $recv($recv($globals.Object)._new())._foo();
  59418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59419. }),$globals.MessageNotUnderstood);
  59420. return self;
  59421. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59422. },
  59423. args: [],
  59424. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59425. referencedClasses: ["Object", "MessageNotUnderstood"],
  59426. messageSends: ["should:raise:", "foo", "new"]
  59427. }),
  59428. $globals.ObjectTest);
  59429. $core.addMethod(
  59430. $core.method({
  59431. selector: "testEquality",
  59432. protocol: "tests",
  59433. fn: function (){
  59434. var self=this,$self=this;
  59435. var o;
  59436. return $core.withContext(function($ctx1) {
  59437. var $1,$2,$4,$3;
  59438. o=$recv($globals.Object)._new();
  59439. $ctx1.sendIdx["new"]=1;
  59440. $1=$recv(o).__eq($recv($globals.Object)._new());
  59441. $ctx1.sendIdx["="]=1;
  59442. $self._deny_($1);
  59443. $2=$recv(o).__eq(o);
  59444. $ctx1.sendIdx["="]=2;
  59445. $self._assert_($2);
  59446. $ctx1.sendIdx["assert:"]=1;
  59447. $4=$recv(o)._yourself();
  59448. $ctx1.sendIdx["yourself"]=1;
  59449. $3=$recv($4).__eq(o);
  59450. $ctx1.sendIdx["="]=3;
  59451. $self._assert_($3);
  59452. $ctx1.sendIdx["assert:"]=2;
  59453. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59454. return self;
  59455. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59456. },
  59457. args: [],
  59458. 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)",
  59459. referencedClasses: ["Object"],
  59460. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59461. }),
  59462. $globals.ObjectTest);
  59463. $core.addMethod(
  59464. $core.method({
  59465. selector: "testHalt",
  59466. protocol: "tests",
  59467. fn: function (){
  59468. var self=this,$self=this;
  59469. return $core.withContext(function($ctx1) {
  59470. $self._should_raise_((function(){
  59471. return $core.withContext(function($ctx2) {
  59472. return $recv($recv($globals.Object)._new())._halt();
  59473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59474. }),$globals.Error);
  59475. return self;
  59476. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59477. },
  59478. args: [],
  59479. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59480. referencedClasses: ["Object", "Error"],
  59481. messageSends: ["should:raise:", "halt", "new"]
  59482. }),
  59483. $globals.ObjectTest);
  59484. $core.addMethod(
  59485. $core.method({
  59486. selector: "testIdentity",
  59487. protocol: "tests",
  59488. fn: function (){
  59489. var self=this,$self=this;
  59490. var o;
  59491. return $core.withContext(function($ctx1) {
  59492. var $1,$2,$4,$3;
  59493. o=$recv($globals.Object)._new();
  59494. $ctx1.sendIdx["new"]=1;
  59495. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59496. $ctx1.sendIdx["=="]=1;
  59497. $self._deny_($1);
  59498. $2=$recv(o).__eq_eq(o);
  59499. $ctx1.sendIdx["=="]=2;
  59500. $self._assert_($2);
  59501. $ctx1.sendIdx["assert:"]=1;
  59502. $4=$recv(o)._yourself();
  59503. $ctx1.sendIdx["yourself"]=1;
  59504. $3=$recv($4).__eq_eq(o);
  59505. $ctx1.sendIdx["=="]=3;
  59506. $self._assert_($3);
  59507. $ctx1.sendIdx["assert:"]=2;
  59508. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59509. return self;
  59510. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59511. },
  59512. args: [],
  59513. 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",
  59514. referencedClasses: ["Object"],
  59515. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59516. }),
  59517. $globals.ObjectTest);
  59518. $core.addMethod(
  59519. $core.method({
  59520. selector: "testIfNil",
  59521. protocol: "tests",
  59522. fn: function (){
  59523. var self=this,$self=this;
  59524. return $core.withContext(function($ctx1) {
  59525. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59526. $2=$recv($globals.Object)._new();
  59527. $ctx1.sendIdx["new"]=1;
  59528. $1=$recv($2)._isNil();
  59529. $self._deny_($1);
  59530. $ctx1.sendIdx["deny:"]=1;
  59531. $5=$recv($globals.Object)._new();
  59532. $ctx1.sendIdx["new"]=2;
  59533. if(($receiver = $5) == null || $receiver.a$nil){
  59534. $4=true;
  59535. } else {
  59536. $4=$5;
  59537. }
  59538. $3=$recv($4).__eq(true);
  59539. $self._deny_($3);
  59540. $7=$recv($globals.Object)._new();
  59541. $ctx1.sendIdx["new"]=3;
  59542. if(($receiver = $7) == null || $receiver.a$nil){
  59543. $6=$7;
  59544. } else {
  59545. $6=true;
  59546. }
  59547. $self._assert_equals_($6,true);
  59548. $ctx1.sendIdx["assert:equals:"]=1;
  59549. $9=$recv($globals.Object)._new();
  59550. $ctx1.sendIdx["new"]=4;
  59551. if(($receiver = $9) == null || $receiver.a$nil){
  59552. $8=false;
  59553. } else {
  59554. $8=true;
  59555. }
  59556. $self._assert_equals_($8,true);
  59557. $ctx1.sendIdx["assert:equals:"]=2;
  59558. $11=$recv($globals.Object)._new();
  59559. if(($receiver = $11) == null || $receiver.a$nil){
  59560. $10=false;
  59561. } else {
  59562. $10=true;
  59563. }
  59564. $self._assert_equals_($10,true);
  59565. return self;
  59566. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59567. },
  59568. args: [],
  59569. 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",
  59570. referencedClasses: ["Object"],
  59571. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59572. }),
  59573. $globals.ObjectTest);
  59574. $core.addMethod(
  59575. $core.method({
  59576. selector: "testInstVars",
  59577. protocol: "tests",
  59578. fn: function (){
  59579. var self=this,$self=this;
  59580. var o;
  59581. return $core.withContext(function($ctx1) {
  59582. var $1,$2;
  59583. o=$recv($globals.ObjectMock)._new();
  59584. $1=$recv(o)._instVarAt_("foo");
  59585. $ctx1.sendIdx["instVarAt:"]=1;
  59586. $self._assert_equals_($1,nil);
  59587. $ctx1.sendIdx["assert:equals:"]=1;
  59588. $recv(o)._instVarAt_put_("foo",(1));
  59589. $2=$recv(o)._instVarAt_("foo");
  59590. $ctx1.sendIdx["instVarAt:"]=2;
  59591. $self._assert_equals_($2,(1));
  59592. $ctx1.sendIdx["assert:equals:"]=2;
  59593. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59594. return self;
  59595. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59596. },
  59597. args: [],
  59598. 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",
  59599. referencedClasses: ["ObjectMock"],
  59600. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59601. }),
  59602. $globals.ObjectTest);
  59603. $core.addMethod(
  59604. $core.method({
  59605. selector: "testNilUndefined",
  59606. protocol: "tests",
  59607. fn: function (){
  59608. var self=this,$self=this;
  59609. return $core.withContext(function($ctx1) {
  59610. $self._assert_equals_($self._notDefined(),nil);
  59611. return self;
  59612. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59613. },
  59614. args: [],
  59615. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59616. referencedClasses: [],
  59617. messageSends: ["assert:equals:", "notDefined"]
  59618. }),
  59619. $globals.ObjectTest);
  59620. $core.addMethod(
  59621. $core.method({
  59622. selector: "testYourself",
  59623. protocol: "tests",
  59624. fn: function (){
  59625. var self=this,$self=this;
  59626. var o;
  59627. return $core.withContext(function($ctx1) {
  59628. o=$recv($globals.ObjectMock)._new();
  59629. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59630. return self;
  59631. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59632. },
  59633. args: [],
  59634. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59635. referencedClasses: ["ObjectMock"],
  59636. messageSends: ["new", "assert:", "==", "yourself"]
  59637. }),
  59638. $globals.ObjectTest);
  59639. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59640. $core.addMethod(
  59641. $core.method({
  59642. selector: "testAccessing",
  59643. protocol: "tests",
  59644. fn: function (){
  59645. var self=this,$self=this;
  59646. return $core.withContext(function($ctx1) {
  59647. var $2,$1,$3,$6,$5,$4;
  59648. $2=$recv($globals.Point)._x_y_((3),(4));
  59649. $ctx1.sendIdx["x:y:"]=1;
  59650. $1=$recv($2)._x();
  59651. $ctx1.sendIdx["x"]=1;
  59652. $self._assert_equals_($1,(3));
  59653. $ctx1.sendIdx["assert:equals:"]=1;
  59654. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59655. $ctx1.sendIdx["y"]=1;
  59656. $self._assert_equals_($3,(4));
  59657. $ctx1.sendIdx["assert:equals:"]=2;
  59658. $6=$recv($globals.Point)._new();
  59659. $ctx1.sendIdx["new"]=1;
  59660. $5=$recv($6)._x_((3));
  59661. $4=$recv($5)._x();
  59662. $self._assert_equals_($4,(3));
  59663. $ctx1.sendIdx["assert:equals:"]=3;
  59664. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59665. return self;
  59666. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59667. },
  59668. args: [],
  59669. 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",
  59670. referencedClasses: ["Point"],
  59671. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59672. }),
  59673. $globals.PointTest);
  59674. $core.addMethod(
  59675. $core.method({
  59676. selector: "testAngle",
  59677. protocol: "tests",
  59678. fn: function (){
  59679. var self=this,$self=this;
  59680. return $core.withContext(function($ctx1) {
  59681. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  59682. return self;
  59683. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  59684. },
  59685. args: [],
  59686. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  59687. referencedClasses: ["Number"],
  59688. messageSends: ["assert:equals:", "angle", "@", "pi"]
  59689. }),
  59690. $globals.PointTest);
  59691. $core.addMethod(
  59692. $core.method({
  59693. selector: "testArithmetic",
  59694. protocol: "tests",
  59695. fn: function (){
  59696. var self=this,$self=this;
  59697. return $core.withContext(function($ctx1) {
  59698. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  59699. $2=(3).__at((4));
  59700. $ctx1.sendIdx["@"]=1;
  59701. $3=(3).__at((4));
  59702. $ctx1.sendIdx["@"]=2;
  59703. $1=$recv($2).__star($3);
  59704. $4=$recv($globals.Point)._x_y_((9),(16));
  59705. $ctx1.sendIdx["x:y:"]=1;
  59706. $self._assert_equals_($1,$4);
  59707. $ctx1.sendIdx["assert:equals:"]=1;
  59708. $6=(3).__at((4));
  59709. $ctx1.sendIdx["@"]=3;
  59710. $7=(3).__at((4));
  59711. $ctx1.sendIdx["@"]=4;
  59712. $5=$recv($6).__plus($7);
  59713. $8=$recv($globals.Point)._x_y_((6),(8));
  59714. $ctx1.sendIdx["x:y:"]=2;
  59715. $self._assert_equals_($5,$8);
  59716. $ctx1.sendIdx["assert:equals:"]=2;
  59717. $10=(3).__at((4));
  59718. $ctx1.sendIdx["@"]=5;
  59719. $11=(3).__at((4));
  59720. $ctx1.sendIdx["@"]=6;
  59721. $9=$recv($10).__minus($11);
  59722. $12=$recv($globals.Point)._x_y_((0),(0));
  59723. $ctx1.sendIdx["x:y:"]=3;
  59724. $self._assert_equals_($9,$12);
  59725. $ctx1.sendIdx["assert:equals:"]=3;
  59726. $14=(6).__at((8));
  59727. $ctx1.sendIdx["@"]=7;
  59728. $13=$recv($14).__slash((3).__at((4)));
  59729. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  59730. return self;
  59731. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  59732. },
  59733. args: [],
  59734. 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)",
  59735. referencedClasses: ["Point"],
  59736. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  59737. }),
  59738. $globals.PointTest);
  59739. $core.addMethod(
  59740. $core.method({
  59741. selector: "testAt",
  59742. protocol: "tests",
  59743. fn: function (){
  59744. var self=this,$self=this;
  59745. return $core.withContext(function($ctx1) {
  59746. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  59747. return self;
  59748. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  59749. },
  59750. args: [],
  59751. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  59752. referencedClasses: ["Point"],
  59753. messageSends: ["assert:equals:", "@", "x:y:"]
  59754. }),
  59755. $globals.PointTest);
  59756. $core.addMethod(
  59757. $core.method({
  59758. selector: "testComparison",
  59759. protocol: "tests",
  59760. fn: function (){
  59761. var self=this,$self=this;
  59762. return $core.withContext(function($ctx1) {
  59763. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  59764. $2=(3).__at((4));
  59765. $ctx1.sendIdx["@"]=1;
  59766. $3=(4).__at((5));
  59767. $ctx1.sendIdx["@"]=2;
  59768. $1=$recv($2).__lt($3);
  59769. $ctx1.sendIdx["<"]=1;
  59770. $self._assert_($1);
  59771. $ctx1.sendIdx["assert:"]=1;
  59772. $5=(3).__at((4));
  59773. $ctx1.sendIdx["@"]=3;
  59774. $6=(4).__at((4));
  59775. $ctx1.sendIdx["@"]=4;
  59776. $4=$recv($5).__lt($6);
  59777. $self._deny_($4);
  59778. $ctx1.sendIdx["deny:"]=1;
  59779. $8=(4).__at((5));
  59780. $ctx1.sendIdx["@"]=5;
  59781. $9=(4).__at((5));
  59782. $ctx1.sendIdx["@"]=6;
  59783. $7=$recv($8).__lt_eq($9);
  59784. $ctx1.sendIdx["<="]=1;
  59785. $self._assert_($7);
  59786. $ctx1.sendIdx["assert:"]=2;
  59787. $11=(4).__at((5));
  59788. $ctx1.sendIdx["@"]=7;
  59789. $12=(3).__at((5));
  59790. $ctx1.sendIdx["@"]=8;
  59791. $10=$recv($11).__lt_eq($12);
  59792. $self._deny_($10);
  59793. $ctx1.sendIdx["deny:"]=2;
  59794. $14=(5).__at((6));
  59795. $ctx1.sendIdx["@"]=9;
  59796. $15=(4).__at((5));
  59797. $ctx1.sendIdx["@"]=10;
  59798. $13=$recv($14).__gt($15);
  59799. $ctx1.sendIdx[">"]=1;
  59800. $self._assert_($13);
  59801. $ctx1.sendIdx["assert:"]=3;
  59802. $17=(5).__at((6));
  59803. $ctx1.sendIdx["@"]=11;
  59804. $18=(6).__at((6));
  59805. $ctx1.sendIdx["@"]=12;
  59806. $16=$recv($17).__gt($18);
  59807. $self._deny_($16);
  59808. $ctx1.sendIdx["deny:"]=3;
  59809. $20=(4).__at((5));
  59810. $ctx1.sendIdx["@"]=13;
  59811. $21=(4).__at((5));
  59812. $ctx1.sendIdx["@"]=14;
  59813. $19=$recv($20).__gt_eq($21);
  59814. $ctx1.sendIdx[">="]=1;
  59815. $self._assert_($19);
  59816. $23=(4).__at((5));
  59817. $ctx1.sendIdx["@"]=15;
  59818. $22=$recv($23).__gt_eq((5).__at((5)));
  59819. $self._deny_($22);
  59820. return self;
  59821. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  59822. },
  59823. args: [],
  59824. 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)",
  59825. referencedClasses: [],
  59826. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  59827. }),
  59828. $globals.PointTest);
  59829. $core.addMethod(
  59830. $core.method({
  59831. selector: "testDotProduct",
  59832. protocol: "tests",
  59833. fn: function (){
  59834. var self=this,$self=this;
  59835. return $core.withContext(function($ctx1) {
  59836. var $2,$1;
  59837. $2=(2).__at((3));
  59838. $ctx1.sendIdx["@"]=1;
  59839. $1=$recv($2)._dotProduct_((3).__at((7)));
  59840. $self._assert_equals_($1,(27));
  59841. return self;
  59842. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  59843. },
  59844. args: [],
  59845. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  59846. referencedClasses: [],
  59847. messageSends: ["assert:equals:", "dotProduct:", "@"]
  59848. }),
  59849. $globals.PointTest);
  59850. $core.addMethod(
  59851. $core.method({
  59852. selector: "testEgality",
  59853. protocol: "tests",
  59854. fn: function (){
  59855. var self=this,$self=this;
  59856. return $core.withContext(function($ctx1) {
  59857. var $2,$3,$1,$5,$4;
  59858. $2=(3).__at((4));
  59859. $ctx1.sendIdx["@"]=1;
  59860. $3=(3).__at((4));
  59861. $ctx1.sendIdx["@"]=2;
  59862. $1=$recv($2).__eq($3);
  59863. $ctx1.sendIdx["="]=1;
  59864. $self._assert_($1);
  59865. $5=(3).__at((5));
  59866. $ctx1.sendIdx["@"]=3;
  59867. $4=$recv($5).__eq((3).__at((6)));
  59868. $self._deny_($4);
  59869. return self;
  59870. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  59871. },
  59872. args: [],
  59873. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  59874. referencedClasses: [],
  59875. messageSends: ["assert:", "=", "@", "deny:"]
  59876. }),
  59877. $globals.PointTest);
  59878. $core.addMethod(
  59879. $core.method({
  59880. selector: "testNew",
  59881. protocol: "tests",
  59882. fn: function (){
  59883. var self=this,$self=this;
  59884. return $core.withContext(function($ctx1) {
  59885. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  59886. $3=$recv($globals.Point)._new();
  59887. $ctx1.sendIdx["new"]=1;
  59888. $2=$recv($3)._x_((3));
  59889. $ctx1.sendIdx["x:"]=1;
  59890. $1=$recv($2)._y();
  59891. $ctx1.sendIdx["y"]=1;
  59892. $self._assert_equals_($1,nil);
  59893. $ctx1.sendIdx["assert:equals:"]=1;
  59894. $7=$recv($globals.Point)._new();
  59895. $ctx1.sendIdx["new"]=2;
  59896. $6=$recv($7)._x_((3));
  59897. $5=$recv($6)._x();
  59898. $ctx1.sendIdx["x"]=1;
  59899. $4=$recv($5).__eq((0));
  59900. $ctx1.sendIdx["="]=1;
  59901. $self._deny_($4);
  59902. $ctx1.sendIdx["deny:"]=1;
  59903. $10=$recv($globals.Point)._new();
  59904. $ctx1.sendIdx["new"]=3;
  59905. $9=$recv($10)._y_((4));
  59906. $ctx1.sendIdx["y:"]=1;
  59907. $8=$recv($9)._x();
  59908. $self._assert_equals_($8,nil);
  59909. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  59910. return self;
  59911. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  59912. },
  59913. args: [],
  59914. 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",
  59915. referencedClasses: ["Point"],
  59916. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  59917. }),
  59918. $globals.PointTest);
  59919. $core.addMethod(
  59920. $core.method({
  59921. selector: "testNormal",
  59922. protocol: "tests",
  59923. fn: function (){
  59924. var self=this,$self=this;
  59925. return $core.withContext(function($ctx1) {
  59926. var $2,$1;
  59927. $2=(1).__at((0));
  59928. $ctx1.sendIdx["@"]=1;
  59929. $1=$recv($2)._normal();
  59930. $self._assert_equals_($1,(0).__at((1)));
  59931. return self;
  59932. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  59933. },
  59934. args: [],
  59935. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  59936. referencedClasses: [],
  59937. messageSends: ["assert:equals:", "normal", "@"]
  59938. }),
  59939. $globals.PointTest);
  59940. $core.addMethod(
  59941. $core.method({
  59942. selector: "testNormalized",
  59943. protocol: "tests",
  59944. fn: function (){
  59945. var self=this,$self=this;
  59946. return $core.withContext(function($ctx1) {
  59947. var $2,$1,$3,$5,$4;
  59948. $2=(0).__at((2));
  59949. $ctx1.sendIdx["@"]=1;
  59950. $1=$recv($2)._normalized();
  59951. $ctx1.sendIdx["normalized"]=1;
  59952. $3=(0).__at((1));
  59953. $ctx1.sendIdx["@"]=2;
  59954. $self._assert_equals_($1,$3);
  59955. $ctx1.sendIdx["assert:equals:"]=1;
  59956. $5=(0).__at((0));
  59957. $ctx1.sendIdx["@"]=3;
  59958. $4=$recv($5)._normalized();
  59959. $self._assert_equals_($4,(0).__at((0)));
  59960. return self;
  59961. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  59962. },
  59963. args: [],
  59964. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  59965. referencedClasses: [],
  59966. messageSends: ["assert:equals:", "normalized", "@"]
  59967. }),
  59968. $globals.PointTest);
  59969. $core.addMethod(
  59970. $core.method({
  59971. selector: "testPolarCoordinates",
  59972. protocol: "tests",
  59973. fn: function (){
  59974. var self=this,$self=this;
  59975. return $core.withContext(function($ctx1) {
  59976. var $2,$1;
  59977. $2=(1).__at((0));
  59978. $ctx1.sendIdx["@"]=1;
  59979. $1=$recv($2)._r();
  59980. $ctx1.sendIdx["r"]=1;
  59981. $self._assert_equals_($1,(1));
  59982. $ctx1.sendIdx["assert:equals:"]=1;
  59983. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  59984. return self;
  59985. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  59986. },
  59987. args: [],
  59988. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  59989. referencedClasses: [],
  59990. messageSends: ["assert:equals:", "r", "@"]
  59991. }),
  59992. $globals.PointTest);
  59993. $core.addMethod(
  59994. $core.method({
  59995. selector: "testRectangleCreation",
  59996. protocol: "tests",
  59997. fn: function (){
  59998. var self=this,$self=this;
  59999. return $core.withContext(function($ctx1) {
  60000. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60001. $2=(1).__at((1));
  60002. $ctx1.sendIdx["@"]=1;
  60003. $3=(2).__at((2));
  60004. $ctx1.sendIdx["@"]=2;
  60005. $1=$recv($2)._corner_($3);
  60006. $5=(1).__at((1));
  60007. $ctx1.sendIdx["@"]=3;
  60008. $6=(2).__at((2));
  60009. $ctx1.sendIdx["@"]=4;
  60010. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60011. $self._assert_equals_($1,$4);
  60012. $ctx1.sendIdx["assert:equals:"]=1;
  60013. $8=(1).__at((1));
  60014. $ctx1.sendIdx["@"]=5;
  60015. $9=(2).__at((2));
  60016. $ctx1.sendIdx["@"]=6;
  60017. $7=$recv($8)._rectangle_($9);
  60018. $11=(1).__at((1));
  60019. $ctx1.sendIdx["@"]=7;
  60020. $12=(2).__at((2));
  60021. $ctx1.sendIdx["@"]=8;
  60022. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60023. $self._assert_equals_($7,$10);
  60024. $ctx1.sendIdx["assert:equals:"]=2;
  60025. $14=(1).__at((1));
  60026. $ctx1.sendIdx["@"]=9;
  60027. $15=(2).__at((2));
  60028. $ctx1.sendIdx["@"]=10;
  60029. $13=$recv($14)._extent_($15);
  60030. $17=(1).__at((1));
  60031. $ctx1.sendIdx["@"]=11;
  60032. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60033. $self._assert_equals_($13,$16);
  60034. return self;
  60035. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60036. },
  60037. args: [],
  60038. 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)",
  60039. referencedClasses: ["Rectangle"],
  60040. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60041. }),
  60042. $globals.PointTest);
  60043. $core.addMethod(
  60044. $core.method({
  60045. selector: "testTranslateBy",
  60046. protocol: "tests",
  60047. fn: function (){
  60048. var self=this,$self=this;
  60049. return $core.withContext(function($ctx1) {
  60050. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60051. $2=(3).__at((3));
  60052. $ctx1.sendIdx["@"]=1;
  60053. $3=(0).__at((1));
  60054. $ctx1.sendIdx["@"]=2;
  60055. $1=$recv($2)._translateBy_($3);
  60056. $ctx1.sendIdx["translateBy:"]=1;
  60057. $4=(3).__at((4));
  60058. $ctx1.sendIdx["@"]=3;
  60059. $self._assert_equals_($1,$4);
  60060. $ctx1.sendIdx["assert:equals:"]=1;
  60061. $6=(3).__at((3));
  60062. $ctx1.sendIdx["@"]=4;
  60063. $8=(1)._negated();
  60064. $ctx1.sendIdx["negated"]=1;
  60065. $7=(0).__at($8);
  60066. $ctx1.sendIdx["@"]=5;
  60067. $5=$recv($6)._translateBy_($7);
  60068. $ctx1.sendIdx["translateBy:"]=2;
  60069. $9=(3).__at((2));
  60070. $ctx1.sendIdx["@"]=6;
  60071. $self._assert_equals_($5,$9);
  60072. $ctx1.sendIdx["assert:equals:"]=2;
  60073. $11=(3).__at((3));
  60074. $ctx1.sendIdx["@"]=7;
  60075. $12=(2).__at((3));
  60076. $ctx1.sendIdx["@"]=8;
  60077. $10=$recv($11)._translateBy_($12);
  60078. $ctx1.sendIdx["translateBy:"]=3;
  60079. $13=(5).__at((6));
  60080. $ctx1.sendIdx["@"]=9;
  60081. $self._assert_equals_($10,$13);
  60082. $ctx1.sendIdx["assert:equals:"]=3;
  60083. $15=(3).__at((3));
  60084. $ctx1.sendIdx["@"]=10;
  60085. $16=$recv((3)._negated()).__at((0));
  60086. $ctx1.sendIdx["@"]=11;
  60087. $14=$recv($15)._translateBy_($16);
  60088. $self._assert_equals_($14,(0).__at((3)));
  60089. return self;
  60090. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60091. },
  60092. args: [],
  60093. 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.",
  60094. referencedClasses: [],
  60095. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60096. }),
  60097. $globals.PointTest);
  60098. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60099. $core.addMethod(
  60100. $core.method({
  60101. selector: "testNextIfAbsent",
  60102. protocol: "tests",
  60103. fn: function (){
  60104. var self=this,$self=this;
  60105. var queue;
  60106. return $core.withContext(function($ctx1) {
  60107. var $2,$1;
  60108. queue=$recv($globals.Queue)._new();
  60109. $recv(queue)._nextPut_("index1");
  60110. $2=$recv(queue)._nextIfAbsent_("empty");
  60111. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60112. $1=$recv($2).__eq("index1");
  60113. $ctx1.sendIdx["="]=1;
  60114. $self._assert_($1);
  60115. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60116. return self;
  60117. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60118. },
  60119. args: [],
  60120. 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'",
  60121. referencedClasses: ["Queue"],
  60122. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60123. }),
  60124. $globals.QueueTest);
  60125. $core.addMethod(
  60126. $core.method({
  60127. selector: "testQueueNext",
  60128. protocol: "tests",
  60129. fn: function (){
  60130. var self=this,$self=this;
  60131. var queue;
  60132. return $core.withContext(function($ctx1) {
  60133. var $1,$3,$2,$5,$4;
  60134. queue=$recv($globals.Queue)._new();
  60135. $1=queue;
  60136. $recv($1)._nextPut_("index1");
  60137. $ctx1.sendIdx["nextPut:"]=1;
  60138. $recv($1)._nextPut_("index2");
  60139. $3=$recv(queue)._next();
  60140. $ctx1.sendIdx["next"]=1;
  60141. $2=$recv($3).__eq("index1");
  60142. $ctx1.sendIdx["="]=1;
  60143. $self._assert_($2);
  60144. $5=$recv(queue)._next();
  60145. $ctx1.sendIdx["next"]=2;
  60146. $4=$recv($5).__eq("index");
  60147. $self._deny_($4);
  60148. $self._should_raise_((function(){
  60149. return $core.withContext(function($ctx2) {
  60150. return $recv(queue)._next();
  60151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60152. }),$globals.Error);
  60153. return self;
  60154. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60155. },
  60156. args: [],
  60157. 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",
  60158. referencedClasses: ["Queue", "Error"],
  60159. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60160. }),
  60161. $globals.QueueTest);
  60162. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60163. $core.addMethod(
  60164. $core.method({
  60165. selector: "testAtRandomNumber",
  60166. protocol: "tests",
  60167. fn: function (){
  60168. var self=this,$self=this;
  60169. var val;
  60170. return $core.withContext(function($ctx1) {
  60171. (100)._timesRepeat_((function(){
  60172. return $core.withContext(function($ctx2) {
  60173. val=(10)._atRandom();
  60174. val;
  60175. $self._assert_($recv(val).__gt((0)));
  60176. $ctx2.sendIdx["assert:"]=1;
  60177. return $self._assert_($recv(val).__lt((11)));
  60178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60179. }));
  60180. return self;
  60181. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60182. },
  60183. args: [],
  60184. 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]",
  60185. referencedClasses: [],
  60186. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60187. }),
  60188. $globals.RandomTest);
  60189. $core.addMethod(
  60190. $core.method({
  60191. selector: "testAtRandomSequenceableCollection",
  60192. protocol: "tests",
  60193. fn: function (){
  60194. var self=this,$self=this;
  60195. var val;
  60196. return $core.withContext(function($ctx1) {
  60197. var $3,$4,$2,$1;
  60198. (100)._timesRepeat_((function(){
  60199. return $core.withContext(function($ctx2) {
  60200. val="abc"._atRandom();
  60201. val;
  60202. $3=$recv(val).__eq("a");
  60203. $ctx2.sendIdx["="]=1;
  60204. $4=$recv(val).__eq("b");
  60205. $ctx2.sendIdx["="]=2;
  60206. $2=$recv($3).__or($4);
  60207. $1=$recv($2).__or($recv(val).__eq("c"));
  60208. $ctx2.sendIdx["|"]=1;
  60209. return $self._assert_($1);
  60210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60211. }));
  60212. return self;
  60213. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60214. },
  60215. args: [],
  60216. 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].",
  60217. referencedClasses: [],
  60218. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60219. }),
  60220. $globals.RandomTest);
  60221. $core.addMethod(
  60222. $core.method({
  60223. selector: "textNext",
  60224. protocol: "tests",
  60225. fn: function (){
  60226. var self=this,$self=this;
  60227. return $core.withContext(function($ctx1) {
  60228. var $1;
  60229. (10000)._timesRepeat_((function(){
  60230. var current,next;
  60231. return $core.withContext(function($ctx2) {
  60232. next=$recv($recv($globals.Random)._new())._next();
  60233. next;
  60234. $self._assert_($recv(next).__gt_eq((0)));
  60235. $ctx2.sendIdx["assert:"]=1;
  60236. $self._assert_($recv(next).__lt((1)));
  60237. $1=$recv(current).__eq(next);
  60238. $ctx2.sendIdx["="]=1;
  60239. $self._deny_($1);
  60240. return $recv(next).__eq(current);
  60241. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60242. }));
  60243. return self;
  60244. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60245. },
  60246. args: [],
  60247. 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 ]",
  60248. referencedClasses: ["Random"],
  60249. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60250. }),
  60251. $globals.RandomTest);
  60252. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60253. $core.addMethod(
  60254. $core.method({
  60255. selector: "testContainsPoint",
  60256. protocol: "tests",
  60257. fn: function (){
  60258. var self=this,$self=this;
  60259. var rect;
  60260. return $core.withContext(function($ctx1) {
  60261. var $1,$2,$4,$5,$3;
  60262. $1=(0).__at((0));
  60263. $ctx1.sendIdx["@"]=1;
  60264. $2=(4).__at((4));
  60265. $ctx1.sendIdx["@"]=2;
  60266. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60267. $4=rect;
  60268. $5=(1).__at((2));
  60269. $ctx1.sendIdx["@"]=3;
  60270. $3=$recv($4)._containsPoint_($5);
  60271. $ctx1.sendIdx["containsPoint:"]=1;
  60272. $self._assert_($3);
  60273. $ctx1.sendIdx["assert:"]=1;
  60274. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60275. return self;
  60276. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60277. },
  60278. args: [],
  60279. 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.",
  60280. referencedClasses: ["Rectangle"],
  60281. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60282. }),
  60283. $globals.RectangleTest);
  60284. $core.addMethod(
  60285. $core.method({
  60286. selector: "testContainsRect",
  60287. protocol: "tests",
  60288. fn: function (){
  60289. var self=this,$self=this;
  60290. return $core.withContext(function($ctx1) {
  60291. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60292. $3=(0).__at((0));
  60293. $ctx1.sendIdx["@"]=1;
  60294. $4=(6).__at((6));
  60295. $ctx1.sendIdx["@"]=2;
  60296. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60297. $ctx1.sendIdx["origin:corner:"]=1;
  60298. $6=(1).__at((1));
  60299. $ctx1.sendIdx["@"]=3;
  60300. $7=(5).__at((5));
  60301. $ctx1.sendIdx["@"]=4;
  60302. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60303. $ctx1.sendIdx["origin:corner:"]=2;
  60304. $1=$recv($2)._containsRect_($5);
  60305. $ctx1.sendIdx["containsRect:"]=1;
  60306. $self._assert_($1);
  60307. $ctx1.sendIdx["assert:"]=1;
  60308. $11=(0).__at((0));
  60309. $ctx1.sendIdx["@"]=5;
  60310. $12=(6).__at((6));
  60311. $ctx1.sendIdx["@"]=6;
  60312. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60313. $ctx1.sendIdx["origin:corner:"]=3;
  60314. $14=(1).__at((-1));
  60315. $ctx1.sendIdx["@"]=7;
  60316. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60317. $9=$recv($10)._containsRect_($13);
  60318. $8=$recv($9)._not();
  60319. $self._assert_($8);
  60320. return self;
  60321. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60322. },
  60323. args: [],
  60324. 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.",
  60325. referencedClasses: ["Rectangle"],
  60326. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60327. }),
  60328. $globals.RectangleTest);
  60329. $core.addMethod(
  60330. $core.method({
  60331. selector: "testOriginExtent",
  60332. protocol: "tests",
  60333. fn: function (){
  60334. var self=this,$self=this;
  60335. var rectangle;
  60336. return $core.withContext(function($ctx1) {
  60337. var $1,$2,$3,$4;
  60338. $1=(3).__at((4));
  60339. $ctx1.sendIdx["@"]=1;
  60340. $2=(7).__at((8));
  60341. $ctx1.sendIdx["@"]=2;
  60342. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60343. $3=$recv(rectangle)._origin();
  60344. $4=(3).__at((4));
  60345. $ctx1.sendIdx["@"]=3;
  60346. $self._assert_equals_($3,$4);
  60347. $ctx1.sendIdx["assert:equals:"]=1;
  60348. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60349. return self;
  60350. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60351. },
  60352. args: [],
  60353. 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.",
  60354. referencedClasses: ["Rectangle"],
  60355. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60356. }),
  60357. $globals.RectangleTest);
  60358. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60359. $core.addMethod(
  60360. $core.method({
  60361. selector: "collectionClass",
  60362. protocol: "accessing",
  60363. fn: function (){
  60364. var self=this,$self=this;
  60365. return $core.withContext(function($ctx1) {
  60366. return $recv($self._class())._collectionClass();
  60367. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60368. },
  60369. args: [],
  60370. source: "collectionClass\x0a\x09^ self class collectionClass",
  60371. referencedClasses: [],
  60372. messageSends: ["collectionClass", "class"]
  60373. }),
  60374. $globals.StreamTest);
  60375. $core.addMethod(
  60376. $core.method({
  60377. selector: "newCollection",
  60378. protocol: "accessing",
  60379. fn: function (){
  60380. var self=this,$self=this;
  60381. return $core.withContext(function($ctx1) {
  60382. return $recv($self._collectionClass())._new();
  60383. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60384. },
  60385. args: [],
  60386. source: "newCollection\x0a\x09^ self collectionClass new",
  60387. referencedClasses: [],
  60388. messageSends: ["new", "collectionClass"]
  60389. }),
  60390. $globals.StreamTest);
  60391. $core.addMethod(
  60392. $core.method({
  60393. selector: "newStream",
  60394. protocol: "accessing",
  60395. fn: function (){
  60396. var self=this,$self=this;
  60397. return $core.withContext(function($ctx1) {
  60398. return $recv($recv($self._collectionClass())._new())._stream();
  60399. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60400. },
  60401. args: [],
  60402. source: "newStream\x0a\x09^ self collectionClass new stream",
  60403. referencedClasses: [],
  60404. messageSends: ["stream", "new", "collectionClass"]
  60405. }),
  60406. $globals.StreamTest);
  60407. $core.addMethod(
  60408. $core.method({
  60409. selector: "testAtStartAtEnd",
  60410. protocol: "tests",
  60411. fn: function (){
  60412. var self=this,$self=this;
  60413. var stream;
  60414. return $core.withContext(function($ctx1) {
  60415. var $1,$2,$3,$4;
  60416. stream=$self._newStream();
  60417. $1=$recv(stream)._atStart();
  60418. $ctx1.sendIdx["atStart"]=1;
  60419. $self._assert_($1);
  60420. $ctx1.sendIdx["assert:"]=1;
  60421. $2=$recv(stream)._atEnd();
  60422. $ctx1.sendIdx["atEnd"]=1;
  60423. $self._assert_($2);
  60424. $ctx1.sendIdx["assert:"]=2;
  60425. $recv(stream)._nextPutAll_($self._newCollection());
  60426. $3=$recv(stream)._atEnd();
  60427. $ctx1.sendIdx["atEnd"]=2;
  60428. $self._assert_($3);
  60429. $4=$recv(stream)._atStart();
  60430. $ctx1.sendIdx["atStart"]=2;
  60431. $self._deny_($4);
  60432. $ctx1.sendIdx["deny:"]=1;
  60433. $recv(stream)._position_((1));
  60434. $self._deny_($recv(stream)._atEnd());
  60435. $ctx1.sendIdx["deny:"]=2;
  60436. $self._deny_($recv(stream)._atStart());
  60437. return self;
  60438. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60439. },
  60440. args: [],
  60441. 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",
  60442. referencedClasses: [],
  60443. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60444. }),
  60445. $globals.StreamTest);
  60446. $core.addMethod(
  60447. $core.method({
  60448. selector: "testContents",
  60449. protocol: "tests",
  60450. fn: function (){
  60451. var self=this,$self=this;
  60452. var stream;
  60453. return $core.withContext(function($ctx1) {
  60454. var $1,$2;
  60455. stream=$self._newStream();
  60456. $1=stream;
  60457. $2=$self._newCollection();
  60458. $ctx1.sendIdx["newCollection"]=1;
  60459. $recv($1)._nextPutAll_($2);
  60460. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60461. return self;
  60462. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60463. },
  60464. args: [],
  60465. 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",
  60466. referencedClasses: [],
  60467. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60468. }),
  60469. $globals.StreamTest);
  60470. $core.addMethod(
  60471. $core.method({
  60472. selector: "testIsEmpty",
  60473. protocol: "tests",
  60474. fn: function (){
  60475. var self=this,$self=this;
  60476. var stream;
  60477. return $core.withContext(function($ctx1) {
  60478. var $1;
  60479. stream=$self._newStream();
  60480. $1=$recv(stream)._isEmpty();
  60481. $ctx1.sendIdx["isEmpty"]=1;
  60482. $self._assert_($1);
  60483. $recv(stream)._nextPutAll_($self._newCollection());
  60484. $self._deny_($recv(stream)._isEmpty());
  60485. return self;
  60486. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60487. },
  60488. args: [],
  60489. 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",
  60490. referencedClasses: [],
  60491. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60492. }),
  60493. $globals.StreamTest);
  60494. $core.addMethod(
  60495. $core.method({
  60496. selector: "testPosition",
  60497. protocol: "tests",
  60498. fn: function (){
  60499. var self=this,$self=this;
  60500. var collection,stream;
  60501. return $core.withContext(function($ctx1) {
  60502. var $1,$2,$3;
  60503. collection=$self._newCollection();
  60504. stream=$self._newStream();
  60505. $recv(stream)._nextPutAll_(collection);
  60506. $1=$recv(stream)._position();
  60507. $ctx1.sendIdx["position"]=1;
  60508. $self._assert_equals_($1,$recv(collection)._size());
  60509. $ctx1.sendIdx["assert:equals:"]=1;
  60510. $recv(stream)._position_((0));
  60511. $2=$recv(stream)._position();
  60512. $ctx1.sendIdx["position"]=2;
  60513. $self._assert_equals_($2,(0));
  60514. $ctx1.sendIdx["assert:equals:"]=2;
  60515. $recv(stream)._next();
  60516. $ctx1.sendIdx["next"]=1;
  60517. $3=$recv(stream)._position();
  60518. $ctx1.sendIdx["position"]=3;
  60519. $self._assert_equals_($3,(1));
  60520. $ctx1.sendIdx["assert:equals:"]=3;
  60521. $recv(stream)._next();
  60522. $self._assert_equals_($recv(stream)._position(),(2));
  60523. return self;
  60524. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60525. },
  60526. args: [],
  60527. 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",
  60528. referencedClasses: [],
  60529. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60530. }),
  60531. $globals.StreamTest);
  60532. $core.addMethod(
  60533. $core.method({
  60534. selector: "testReading",
  60535. protocol: "tests",
  60536. fn: function (){
  60537. var self=this,$self=this;
  60538. var stream,collection;
  60539. return $core.withContext(function($ctx1) {
  60540. var $1,$2;
  60541. collection=$self._newCollection();
  60542. stream=$self._newStream();
  60543. $1=stream;
  60544. $recv($1)._nextPutAll_(collection);
  60545. $recv($1)._position_((0));
  60546. $recv(collection)._do_((function(each){
  60547. return $core.withContext(function($ctx2) {
  60548. $2=$recv(stream)._next();
  60549. $ctx2.sendIdx["next"]=1;
  60550. return $self._assert_equals_($2,each);
  60551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60552. }));
  60553. $self._assert_($recv($recv(stream)._next())._isNil());
  60554. return self;
  60555. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60556. },
  60557. args: [],
  60558. 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",
  60559. referencedClasses: [],
  60560. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60561. }),
  60562. $globals.StreamTest);
  60563. $core.addMethod(
  60564. $core.method({
  60565. selector: "testStreamContents",
  60566. protocol: "tests",
  60567. fn: function (){
  60568. var self=this,$self=this;
  60569. return self;
  60570. },
  60571. args: [],
  60572. source: "testStreamContents",
  60573. referencedClasses: [],
  60574. messageSends: []
  60575. }),
  60576. $globals.StreamTest);
  60577. $core.addMethod(
  60578. $core.method({
  60579. selector: "testWrite",
  60580. protocol: "tests",
  60581. fn: function (){
  60582. var self=this,$self=this;
  60583. var stream,collection;
  60584. return $core.withContext(function($ctx1) {
  60585. collection=$self._newCollection();
  60586. stream=$self._newStream();
  60587. $recv(collection)._do_((function(each){
  60588. return $core.withContext(function($ctx2) {
  60589. return $recv(stream).__lt_lt(each);
  60590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60591. }));
  60592. $self._assert_equals_($recv(stream)._contents(),collection);
  60593. return self;
  60594. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60595. },
  60596. args: [],
  60597. 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",
  60598. referencedClasses: [],
  60599. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60600. }),
  60601. $globals.StreamTest);
  60602. $core.addMethod(
  60603. $core.method({
  60604. selector: "testWriting",
  60605. protocol: "tests",
  60606. fn: function (){
  60607. var self=this,$self=this;
  60608. var stream,collection;
  60609. return $core.withContext(function($ctx1) {
  60610. var $1;
  60611. collection=$self._newCollection();
  60612. stream=$self._newStream();
  60613. $ctx1.sendIdx["newStream"]=1;
  60614. $recv(collection)._do_((function(each){
  60615. return $core.withContext(function($ctx2) {
  60616. return $recv(stream)._nextPut_(each);
  60617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60618. }));
  60619. $1=$recv(stream)._contents();
  60620. $ctx1.sendIdx["contents"]=1;
  60621. $self._assert_equals_($1,collection);
  60622. $ctx1.sendIdx["assert:equals:"]=1;
  60623. stream=$self._newStream();
  60624. $recv(stream)._nextPutAll_(collection);
  60625. $self._assert_equals_($recv(stream)._contents(),collection);
  60626. return self;
  60627. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60628. },
  60629. args: [],
  60630. 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",
  60631. referencedClasses: [],
  60632. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60633. }),
  60634. $globals.StreamTest);
  60635. $core.addMethod(
  60636. $core.method({
  60637. selector: "collectionClass",
  60638. protocol: "accessing",
  60639. fn: function (){
  60640. var self=this,$self=this;
  60641. return nil;
  60642. },
  60643. args: [],
  60644. source: "collectionClass\x0a\x09^ nil",
  60645. referencedClasses: [],
  60646. messageSends: []
  60647. }),
  60648. $globals.StreamTest.a$cls);
  60649. $core.addMethod(
  60650. $core.method({
  60651. selector: "isAbstract",
  60652. protocol: "testing",
  60653. fn: function (){
  60654. var self=this,$self=this;
  60655. return $core.withContext(function($ctx1) {
  60656. return $recv($self._collectionClass())._isNil();
  60657. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60658. },
  60659. args: [],
  60660. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60661. referencedClasses: [],
  60662. messageSends: ["isNil", "collectionClass"]
  60663. }),
  60664. $globals.StreamTest.a$cls);
  60665. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60666. $core.addMethod(
  60667. $core.method({
  60668. selector: "newCollection",
  60669. protocol: "accessing",
  60670. fn: function (){
  60671. var self=this,$self=this;
  60672. return $core.withContext(function($ctx1) {
  60673. return [true,(1),(3).__at((4)),"foo"];
  60674. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60675. },
  60676. args: [],
  60677. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60678. referencedClasses: [],
  60679. messageSends: ["@"]
  60680. }),
  60681. $globals.ArrayStreamTest);
  60682. $core.addMethod(
  60683. $core.method({
  60684. selector: "collectionClass",
  60685. protocol: "accessing",
  60686. fn: function (){
  60687. var self=this,$self=this;
  60688. return $globals.Array;
  60689. },
  60690. args: [],
  60691. source: "collectionClass\x0a\x09^ Array",
  60692. referencedClasses: ["Array"],
  60693. messageSends: []
  60694. }),
  60695. $globals.ArrayStreamTest.a$cls);
  60696. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60697. $core.addMethod(
  60698. $core.method({
  60699. selector: "newCollection",
  60700. protocol: "accessing",
  60701. fn: function (){
  60702. var self=this,$self=this;
  60703. return "hello world";
  60704. },
  60705. args: [],
  60706. source: "newCollection\x0a\x09^ 'hello world'",
  60707. referencedClasses: [],
  60708. messageSends: []
  60709. }),
  60710. $globals.StringStreamTest);
  60711. $core.addMethod(
  60712. $core.method({
  60713. selector: "collectionClass",
  60714. protocol: "accessing",
  60715. fn: function (){
  60716. var self=this,$self=this;
  60717. return $globals.String;
  60718. },
  60719. args: [],
  60720. source: "collectionClass\x0a\x09^ String",
  60721. referencedClasses: ["String"],
  60722. messageSends: []
  60723. }),
  60724. $globals.StringStreamTest.a$cls);
  60725. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  60726. $core.addMethod(
  60727. $core.method({
  60728. selector: "testCopying",
  60729. protocol: "tests",
  60730. fn: function (){
  60731. var self=this,$self=this;
  60732. return $core.withContext(function($ctx1) {
  60733. $self._assert_equals_(nil._copy(),nil);
  60734. return self;
  60735. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  60736. },
  60737. args: [],
  60738. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  60739. referencedClasses: [],
  60740. messageSends: ["assert:equals:", "copy"]
  60741. }),
  60742. $globals.UndefinedTest);
  60743. $core.addMethod(
  60744. $core.method({
  60745. selector: "testDeepCopy",
  60746. protocol: "tests",
  60747. fn: function (){
  60748. var self=this,$self=this;
  60749. return $core.withContext(function($ctx1) {
  60750. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  60751. return self;
  60752. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  60753. },
  60754. args: [],
  60755. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  60756. referencedClasses: [],
  60757. messageSends: ["assert:", "=", "deepCopy"]
  60758. }),
  60759. $globals.UndefinedTest);
  60760. $core.addMethod(
  60761. $core.method({
  60762. selector: "testIfNil",
  60763. protocol: "tests",
  60764. fn: function (){
  60765. var self=this,$self=this;
  60766. return $core.withContext(function($ctx1) {
  60767. var $1,$3,$2,$4,$6,$5,$receiver;
  60768. if(($receiver = nil) == null || $receiver.a$nil){
  60769. $1=true;
  60770. } else {
  60771. $1=nil;
  60772. }
  60773. $self._assert_equals_($1,true);
  60774. $ctx1.sendIdx["assert:equals:"]=1;
  60775. if(($receiver = nil) == null || $receiver.a$nil){
  60776. $3=nil;
  60777. } else {
  60778. $3=true;
  60779. }
  60780. $2=$recv($3).__eq(true);
  60781. $ctx1.sendIdx["="]=1;
  60782. $self._deny_($2);
  60783. $ctx1.sendIdx["deny:"]=1;
  60784. if(($receiver = nil) == null || $receiver.a$nil){
  60785. $4=true;
  60786. } else {
  60787. $4=false;
  60788. }
  60789. $self._assert_equals_($4,true);
  60790. if(($receiver = nil) == null || $receiver.a$nil){
  60791. $6=false;
  60792. } else {
  60793. $6=true;
  60794. }
  60795. $5=$recv($6).__eq(true);
  60796. $self._deny_($5);
  60797. return self;
  60798. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  60799. },
  60800. args: [],
  60801. 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",
  60802. referencedClasses: [],
  60803. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  60804. }),
  60805. $globals.UndefinedTest);
  60806. $core.addMethod(
  60807. $core.method({
  60808. selector: "testIsNil",
  60809. protocol: "tests",
  60810. fn: function (){
  60811. var self=this,$self=this;
  60812. return $core.withContext(function($ctx1) {
  60813. $self._assert_(nil._isNil());
  60814. $self._deny_(nil._notNil());
  60815. return self;
  60816. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  60817. },
  60818. args: [],
  60819. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  60820. referencedClasses: [],
  60821. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  60822. }),
  60823. $globals.UndefinedTest);
  60824. });
  60825. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60826. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60827. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60828. $core.addPackage("Platform-DOM-Tests");
  60829. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  60830. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60831. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  60832. $core.addMethod(
  60833. $core.method({
  60834. selector: "testEntityConversion",
  60835. protocol: "testing",
  60836. fn: function (){
  60837. var self=this,$self=this;
  60838. return $core.withContext(function($ctx1) {
  60839. var $1;
  60840. $1=$recv($globals.PlatformDom)._isFeasible();
  60841. if($core.assert($1)){
  60842. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  60843. }
  60844. return self;
  60845. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  60846. },
  60847. args: [],
  60848. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  60849. referencedClasses: ["PlatformDom"],
  60850. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  60851. }),
  60852. $globals.PlatformDomTest);
  60853. $core.addMethod(
  60854. $core.method({
  60855. selector: "testTextContentDoesNotRunScript",
  60856. protocol: "testing",
  60857. fn: function (){
  60858. var self=this,$self=this;
  60859. return $core.withContext(function($ctx1) {
  60860. var $1;
  60861. $1=$recv($globals.PlatformDom)._isFeasible();
  60862. if($core.assert($1)){
  60863. $self._shouldnt_raise_((function(){
  60864. return $core.withContext(function($ctx2) {
  60865. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  60866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60867. }),$globals.Error);
  60868. }
  60869. return self;
  60870. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  60871. },
  60872. args: [],
  60873. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  60874. referencedClasses: ["PlatformDom", "Error"],
  60875. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  60876. }),
  60877. $globals.PlatformDomTest);
  60878. });
  60879. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60880. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60881. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60882. $core.addPackage("SUnit-Tests");
  60883. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  60884. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60885. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  60886. $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.";
  60887. $core.addMethod(
  60888. $core.method({
  60889. selector: "setUp",
  60890. protocol: "running",
  60891. fn: function (){
  60892. var self=this,$self=this;
  60893. return $core.withContext(function($ctx1) {
  60894. $self["@empty"]=$recv($globals.Set)._new();
  60895. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  60896. return self;
  60897. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  60898. },
  60899. args: [],
  60900. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  60901. referencedClasses: ["Set"],
  60902. messageSends: ["new", "with:with:"]
  60903. }),
  60904. $globals.ExampleSetTest);
  60905. $core.addMethod(
  60906. $core.method({
  60907. selector: "testAdd",
  60908. protocol: "tests",
  60909. fn: function (){
  60910. var self=this,$self=this;
  60911. return $core.withContext(function($ctx1) {
  60912. $recv($self["@empty"])._add_((5));
  60913. $self._assert_($recv($self["@empty"])._includes_((5)));
  60914. return self;
  60915. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  60916. },
  60917. args: [],
  60918. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  60919. referencedClasses: [],
  60920. messageSends: ["add:", "assert:", "includes:"]
  60921. }),
  60922. $globals.ExampleSetTest);
  60923. $core.addMethod(
  60924. $core.method({
  60925. selector: "testGrow",
  60926. protocol: "tests",
  60927. fn: function (){
  60928. var self=this,$self=this;
  60929. return $core.withContext(function($ctx1) {
  60930. $recv($self["@empty"])._addAll_((1)._to_((100)));
  60931. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  60932. return self;
  60933. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  60934. },
  60935. args: [],
  60936. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  60937. referencedClasses: [],
  60938. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  60939. }),
  60940. $globals.ExampleSetTest);
  60941. $core.addMethod(
  60942. $core.method({
  60943. selector: "testIllegal",
  60944. protocol: "tests",
  60945. fn: function (){
  60946. var self=this,$self=this;
  60947. return $core.withContext(function($ctx1) {
  60948. $self._should_raise_((function(){
  60949. return $core.withContext(function($ctx2) {
  60950. return $recv($self["@empty"])._at_((5));
  60951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60952. }),$globals.Error);
  60953. $ctx1.sendIdx["should:raise:"]=1;
  60954. $self._should_raise_((function(){
  60955. return $core.withContext(function($ctx2) {
  60956. return $recv($self["@empty"])._at_put_((5),"abc");
  60957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60958. }),$globals.Error);
  60959. return self;
  60960. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  60961. },
  60962. args: [],
  60963. 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",
  60964. referencedClasses: ["Error"],
  60965. messageSends: ["should:raise:", "at:", "at:put:"]
  60966. }),
  60967. $globals.ExampleSetTest);
  60968. $core.addMethod(
  60969. $core.method({
  60970. selector: "testIncludes",
  60971. protocol: "tests",
  60972. fn: function (){
  60973. var self=this,$self=this;
  60974. return $core.withContext(function($ctx1) {
  60975. var $1;
  60976. $1=$recv($self["@full"])._includes_((5));
  60977. $ctx1.sendIdx["includes:"]=1;
  60978. $self._assert_($1);
  60979. $ctx1.sendIdx["assert:"]=1;
  60980. $self._assert_($recv($self["@full"])._includes_("abc"));
  60981. return self;
  60982. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  60983. },
  60984. args: [],
  60985. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  60986. referencedClasses: [],
  60987. messageSends: ["assert:", "includes:"]
  60988. }),
  60989. $globals.ExampleSetTest);
  60990. $core.addMethod(
  60991. $core.method({
  60992. selector: "testOccurrences",
  60993. protocol: "tests",
  60994. fn: function (){
  60995. var self=this,$self=this;
  60996. return $core.withContext(function($ctx1) {
  60997. var $1,$2;
  60998. $1=$recv($self["@empty"])._occurrencesOf_((0));
  60999. $ctx1.sendIdx["occurrencesOf:"]=1;
  61000. $self._assert_equals_($1,(0));
  61001. $ctx1.sendIdx["assert:equals:"]=1;
  61002. $2=$recv($self["@full"])._occurrencesOf_((5));
  61003. $ctx1.sendIdx["occurrencesOf:"]=2;
  61004. $self._assert_equals_($2,(1));
  61005. $ctx1.sendIdx["assert:equals:"]=2;
  61006. $recv($self["@full"])._add_((5));
  61007. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61008. return self;
  61009. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61010. },
  61011. args: [],
  61012. 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",
  61013. referencedClasses: [],
  61014. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61015. }),
  61016. $globals.ExampleSetTest);
  61017. $core.addMethod(
  61018. $core.method({
  61019. selector: "testRemove",
  61020. protocol: "tests",
  61021. fn: function (){
  61022. var self=this,$self=this;
  61023. return $core.withContext(function($ctx1) {
  61024. var $1;
  61025. $recv($self["@full"])._remove_((5));
  61026. $1=$recv($self["@full"])._includes_("abc");
  61027. $ctx1.sendIdx["includes:"]=1;
  61028. $self._assert_($1);
  61029. $self._deny_($recv($self["@full"])._includes_((5)));
  61030. return self;
  61031. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61032. },
  61033. args: [],
  61034. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61035. referencedClasses: [],
  61036. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61037. }),
  61038. $globals.ExampleSetTest);
  61039. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61040. $core.addMethod(
  61041. $core.method({
  61042. selector: "fakeError",
  61043. protocol: "helpers",
  61044. fn: function (){
  61045. var self=this,$self=this;
  61046. return $core.withContext(function($ctx1) {
  61047. $self["@flag"]="bad";
  61048. $self._timeout_((30));
  61049. $self["@flag"]=$recv($self._async_((function(){
  61050. return $core.withContext(function($ctx2) {
  61051. $self["@flag"]="ok";
  61052. $self["@flag"];
  61053. return $self._error_("Intentional");
  61054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61055. })))._valueWithTimeout_((20));
  61056. return self;
  61057. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61058. },
  61059. args: [],
  61060. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61061. referencedClasses: [],
  61062. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61063. }),
  61064. $globals.SUnitAsyncTest);
  61065. $core.addMethod(
  61066. $core.method({
  61067. selector: "fakeErrorFailingInTearDown",
  61068. protocol: "helpers",
  61069. fn: function (){
  61070. var self=this,$self=this;
  61071. return $core.withContext(function($ctx1) {
  61072. $self["@flag"]="bad";
  61073. $self._timeout_((30));
  61074. $self["@flag"]=$recv($self._async_((function(){
  61075. return $core.withContext(function($ctx2) {
  61076. return $self._error_("Intentional");
  61077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61078. })))._valueWithTimeout_((20));
  61079. return self;
  61080. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61081. },
  61082. args: [],
  61083. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61084. referencedClasses: [],
  61085. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61086. }),
  61087. $globals.SUnitAsyncTest);
  61088. $core.addMethod(
  61089. $core.method({
  61090. selector: "fakeFailure",
  61091. protocol: "helpers",
  61092. fn: function (){
  61093. var self=this,$self=this;
  61094. return $core.withContext(function($ctx1) {
  61095. $self["@flag"]="bad";
  61096. $self._timeout_((30));
  61097. $self["@flag"]=$recv($self._async_((function(){
  61098. return $core.withContext(function($ctx2) {
  61099. $self["@flag"]="ok";
  61100. $self["@flag"];
  61101. return $self._assert_(false);
  61102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61103. })))._valueWithTimeout_((20));
  61104. return self;
  61105. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61106. },
  61107. args: [],
  61108. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61109. referencedClasses: [],
  61110. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61111. }),
  61112. $globals.SUnitAsyncTest);
  61113. $core.addMethod(
  61114. $core.method({
  61115. selector: "fakeMultipleTimeoutFailing",
  61116. protocol: "helpers",
  61117. fn: function (){
  61118. var self=this,$self=this;
  61119. return $core.withContext(function($ctx1) {
  61120. var $1;
  61121. $self._timeout_((100));
  61122. $ctx1.sendIdx["timeout:"]=1;
  61123. $1=$self._async_((function(){
  61124. return $core.withContext(function($ctx2) {
  61125. $self._timeout_((20));
  61126. return $recv($self._async_((function(){
  61127. return $core.withContext(function($ctx3) {
  61128. return $self._finished();
  61129. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61130. })))._valueWithTimeout_((30));
  61131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61132. }));
  61133. $ctx1.sendIdx["async:"]=1;
  61134. $recv($1)._valueWithTimeout_((20));
  61135. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61136. return self;
  61137. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61138. },
  61139. args: [],
  61140. 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",
  61141. referencedClasses: [],
  61142. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61143. }),
  61144. $globals.SUnitAsyncTest);
  61145. $core.addMethod(
  61146. $core.method({
  61147. selector: "fakeMultipleTimeoutPassing",
  61148. protocol: "helpers",
  61149. fn: function (){
  61150. var self=this,$self=this;
  61151. return $core.withContext(function($ctx1) {
  61152. var $1;
  61153. $self._timeout_((20));
  61154. $ctx1.sendIdx["timeout:"]=1;
  61155. $1=$self._async_((function(){
  61156. return $core.withContext(function($ctx2) {
  61157. $self._timeout_((40));
  61158. return $recv($self._async_((function(){
  61159. return $core.withContext(function($ctx3) {
  61160. return $self._finished();
  61161. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61162. })))._valueWithTimeout_((20));
  61163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61164. }));
  61165. $ctx1.sendIdx["async:"]=1;
  61166. $recv($1)._valueWithTimeout_((10));
  61167. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61168. return self;
  61169. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61170. },
  61171. args: [],
  61172. 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",
  61173. referencedClasses: [],
  61174. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61175. }),
  61176. $globals.SUnitAsyncTest);
  61177. $core.addMethod(
  61178. $core.method({
  61179. selector: "fakeTimeout",
  61180. protocol: "helpers",
  61181. fn: function (){
  61182. var self=this,$self=this;
  61183. return $core.withContext(function($ctx1) {
  61184. $self._timeout_((10));
  61185. $recv($self._async_((function(){
  61186. return $core.withContext(function($ctx2) {
  61187. return $self._finished();
  61188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61189. })))._valueWithTimeout_((20));
  61190. return self;
  61191. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61192. },
  61193. args: [],
  61194. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61195. referencedClasses: [],
  61196. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61197. }),
  61198. $globals.SUnitAsyncTest);
  61199. $core.addMethod(
  61200. $core.method({
  61201. selector: "selectorSetOf:",
  61202. protocol: "private",
  61203. fn: function (aCollection){
  61204. var self=this,$self=this;
  61205. return $core.withContext(function($ctx1) {
  61206. return $recv($recv(aCollection)._collect_((function(each){
  61207. return $core.withContext(function($ctx2) {
  61208. return $recv(each)._selector();
  61209. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61210. })))._asSet();
  61211. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61212. },
  61213. args: ["aCollection"],
  61214. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61215. referencedClasses: [],
  61216. messageSends: ["asSet", "collect:", "selector"]
  61217. }),
  61218. $globals.SUnitAsyncTest);
  61219. $core.addMethod(
  61220. $core.method({
  61221. selector: "setUp",
  61222. protocol: "running",
  61223. fn: function (){
  61224. var self=this,$self=this;
  61225. $self["@flag"]="ok";
  61226. return self;
  61227. },
  61228. args: [],
  61229. source: "setUp\x0a\x09flag := 'ok'",
  61230. referencedClasses: [],
  61231. messageSends: []
  61232. }),
  61233. $globals.SUnitAsyncTest);
  61234. $core.addMethod(
  61235. $core.method({
  61236. selector: "tearDown",
  61237. protocol: "running",
  61238. fn: function (){
  61239. var self=this,$self=this;
  61240. return $core.withContext(function($ctx1) {
  61241. $self._assert_equals_("ok",$self["@flag"]);
  61242. return self;
  61243. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61244. },
  61245. args: [],
  61246. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61247. referencedClasses: [],
  61248. messageSends: ["assert:equals:"]
  61249. }),
  61250. $globals.SUnitAsyncTest);
  61251. $core.addMethod(
  61252. $core.method({
  61253. selector: "testAsyncErrorsAndFailures",
  61254. protocol: "tests",
  61255. fn: function (){
  61256. var self=this,$self=this;
  61257. var suite,runner,result,assertBlock;
  61258. return $core.withContext(function($ctx1) {
  61259. var $1,$2,$3,$4;
  61260. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61261. return $core.withContext(function($ctx2) {
  61262. return $recv($self._class())._selector_(each);
  61263. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61264. }));
  61265. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61266. $self._timeout_((200));
  61267. result=$recv(runner)._result();
  61268. $ctx1.sendIdx["result"]=1;
  61269. assertBlock=$self._async_((function(){
  61270. return $core.withContext(function($ctx2) {
  61271. $1=$self._selectorSetOf_($recv(result)._errors());
  61272. $ctx2.sendIdx["selectorSetOf:"]=1;
  61273. $2=["fakeError"]._asSet();
  61274. $ctx2.sendIdx["asSet"]=1;
  61275. $self._assert_equals_($1,$2);
  61276. $ctx2.sendIdx["assert:equals:"]=1;
  61277. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61278. return $self._finished();
  61279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61280. }));
  61281. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61282. return $core.withContext(function($ctx2) {
  61283. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61284. if($core.assert($3)){
  61285. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61286. return $recv($4)._ifTrue_(assertBlock);
  61287. }
  61288. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61289. }));
  61290. $recv(runner)._run();
  61291. return self;
  61292. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61293. },
  61294. args: [],
  61295. 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",
  61296. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61297. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61298. }),
  61299. $globals.SUnitAsyncTest);
  61300. $core.addMethod(
  61301. $core.method({
  61302. selector: "testAsyncNeedsTimeout",
  61303. protocol: "tests",
  61304. fn: function (){
  61305. var self=this,$self=this;
  61306. return $core.withContext(function($ctx1) {
  61307. $self._should_raise_((function(){
  61308. return $core.withContext(function($ctx2) {
  61309. return $self._async_((function(){
  61310. }));
  61311. $ctx2.sendIdx["async:"]=1;
  61312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61313. }),$globals.Error);
  61314. $self._timeout_((0));
  61315. $self._shouldnt_raise_((function(){
  61316. return $core.withContext(function($ctx2) {
  61317. return $self._async_((function(){
  61318. }));
  61319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61320. }),$globals.Error);
  61321. $self._finished();
  61322. return self;
  61323. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61324. },
  61325. args: [],
  61326. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61327. referencedClasses: ["Error"],
  61328. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61329. }),
  61330. $globals.SUnitAsyncTest);
  61331. $core.addMethod(
  61332. $core.method({
  61333. selector: "testFinishedNeedsTimeout",
  61334. protocol: "tests",
  61335. fn: function (){
  61336. var self=this,$self=this;
  61337. return $core.withContext(function($ctx1) {
  61338. $self._should_raise_((function(){
  61339. return $core.withContext(function($ctx2) {
  61340. return $self._finished();
  61341. $ctx2.sendIdx["finished"]=1;
  61342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61343. }),$globals.Error);
  61344. $self._timeout_((0));
  61345. $self._shouldnt_raise_((function(){
  61346. return $core.withContext(function($ctx2) {
  61347. return $self._finished();
  61348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61349. }),$globals.Error);
  61350. return self;
  61351. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61352. },
  61353. args: [],
  61354. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61355. referencedClasses: ["Error"],
  61356. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61357. }),
  61358. $globals.SUnitAsyncTest);
  61359. $core.addMethod(
  61360. $core.method({
  61361. selector: "testIsAsyncReturnsCorrectValues",
  61362. protocol: "tests",
  61363. fn: function (){
  61364. var self=this,$self=this;
  61365. return $core.withContext(function($ctx1) {
  61366. var $1,$2;
  61367. $1=$self._isAsync();
  61368. $ctx1.sendIdx["isAsync"]=1;
  61369. $self._deny_($1);
  61370. $ctx1.sendIdx["deny:"]=1;
  61371. $self._timeout_((0));
  61372. $2=$self._isAsync();
  61373. $ctx1.sendIdx["isAsync"]=2;
  61374. $self._assert_($2);
  61375. $self._finished();
  61376. $self._deny_($self._isAsync());
  61377. return self;
  61378. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61379. },
  61380. args: [],
  61381. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61382. referencedClasses: [],
  61383. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61384. }),
  61385. $globals.SUnitAsyncTest);
  61386. $core.addMethod(
  61387. $core.method({
  61388. selector: "testPass",
  61389. protocol: "tests",
  61390. fn: function (){
  61391. var self=this,$self=this;
  61392. return $core.withContext(function($ctx1) {
  61393. $self["@flag"]="bad";
  61394. $self._timeout_((10));
  61395. $self["@flag"]=$recv($self._async_((function(){
  61396. return $core.withContext(function($ctx2) {
  61397. $self._assert_(true);
  61398. $self._finished();
  61399. $self["@flag"]="ok";
  61400. return $self["@flag"];
  61401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61402. })))._valueWithTimeout_((5));
  61403. return self;
  61404. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61405. },
  61406. args: [],
  61407. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61408. referencedClasses: [],
  61409. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61410. }),
  61411. $globals.SUnitAsyncTest);
  61412. $core.addMethod(
  61413. $core.method({
  61414. selector: "testTimeouts",
  61415. protocol: "tests",
  61416. fn: function (){
  61417. var self=this,$self=this;
  61418. var suite,runner,result,assertBlock;
  61419. return $core.withContext(function($ctx1) {
  61420. var $1,$2,$3;
  61421. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61422. return $core.withContext(function($ctx2) {
  61423. return $recv($self._class())._selector_(each);
  61424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61425. }));
  61426. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61427. $self._timeout_((200));
  61428. result=$recv(runner)._result();
  61429. $ctx1.sendIdx["result"]=1;
  61430. assertBlock=$self._async_((function(){
  61431. return $core.withContext(function($ctx2) {
  61432. $1=$self._selectorSetOf_($recv(result)._errors());
  61433. $ctx2.sendIdx["selectorSetOf:"]=1;
  61434. $self._assert_equals_($1,$recv($globals.Set)._new());
  61435. $ctx2.sendIdx["assert:equals:"]=1;
  61436. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61437. return $self._finished();
  61438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61439. }));
  61440. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61441. return $core.withContext(function($ctx2) {
  61442. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61443. if($core.assert($2)){
  61444. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61445. return $recv($3)._ifTrue_(assertBlock);
  61446. }
  61447. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61448. }));
  61449. $recv(runner)._run();
  61450. return self;
  61451. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61452. },
  61453. args: [],
  61454. 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",
  61455. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61456. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61457. }),
  61458. $globals.SUnitAsyncTest);
  61459. $core.addMethod(
  61460. $core.method({
  61461. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61462. protocol: "tests",
  61463. fn: function (){
  61464. var self=this,$self=this;
  61465. var x;
  61466. return $core.withContext(function($ctx1) {
  61467. var $1;
  61468. $self["@flag"]="bad";
  61469. $self._timeout_((10));
  61470. x=(0);
  61471. $1=$self._async_((function(){
  61472. return $core.withContext(function($ctx2) {
  61473. $self._finished();
  61474. $ctx2.sendIdx["finished"]=1;
  61475. $self["@flag"]="ok";
  61476. $self["@flag"];
  61477. x=$recv(x).__plus((1));
  61478. $ctx2.sendIdx["+"]=1;
  61479. x;
  61480. return $self._assert_equals_(x,(1));
  61481. $ctx2.sendIdx["assert:equals:"]=1;
  61482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61483. }));
  61484. $ctx1.sendIdx["async:"]=1;
  61485. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61486. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61487. $self["@flag"]=$recv($self._async_((function(){
  61488. return $core.withContext(function($ctx2) {
  61489. $self._finished();
  61490. $self["@flag"]="ok";
  61491. $self["@flag"];
  61492. x=$recv(x).__plus((1));
  61493. x;
  61494. return $self._assert_equals_(x,(1));
  61495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61496. })))._valueWithTimeout_((0));
  61497. return self;
  61498. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61499. },
  61500. args: [],
  61501. 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.",
  61502. referencedClasses: [],
  61503. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61504. }),
  61505. $globals.SUnitAsyncTest);
  61506. });
  61507. define('amber/devel',[
  61508. './lang',
  61509. './brikz', // pre-fetch, dep of ./boot
  61510. './kernel-checks', // pre-fetch, dep of ./boot
  61511. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61512. './kernel-language', // pre-fetch, dep of ./boot
  61513. './boot', // pre-fetch, class loader
  61514. './deploy', // pre-fetch, dep of ./lang
  61515. // --- packages of the development only Amber begin here ---
  61516. 'amber_core/Platform-DOM',
  61517. 'amber_core/SUnit',
  61518. 'amber_core/Compiler-Tests',
  61519. 'amber_core/Kernel-Tests',
  61520. 'amber_core/Platform-DOM-Tests',
  61521. 'amber_core/SUnit-Tests'
  61522. // --- packages of the development only Amber end here ---
  61523. ], function (amber) {
  61524. return amber;
  61525. });
  61526. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61527. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61528. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61529. $core.addPackage("Platform-Node");
  61530. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61531. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61532. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61533. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61534. $core.addMethod(
  61535. $core.method({
  61536. selector: "globals",
  61537. protocol: "accessing",
  61538. fn: function (){
  61539. var self=this,$self=this;
  61540. return global;
  61541. },
  61542. args: [],
  61543. source: "globals\x0a\x09^ global",
  61544. referencedClasses: [],
  61545. messageSends: []
  61546. }),
  61547. $globals.NodePlatform);
  61548. $core.addMethod(
  61549. $core.method({
  61550. selector: "newXhr",
  61551. protocol: "accessing",
  61552. fn: function (){
  61553. var self=this,$self=this;
  61554. return $core.withContext(function($ctx1) {
  61555. var $receiver;
  61556. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61557. $self._error_("XMLHttpRequest not available.");
  61558. } else {
  61559. return $recv($globals.XMLHttpRequest)._new();
  61560. }
  61561. return self;
  61562. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61563. },
  61564. args: [],
  61565. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61566. referencedClasses: ["XMLHttpRequest"],
  61567. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61568. }),
  61569. $globals.NodePlatform);
  61570. $core.addMethod(
  61571. $core.method({
  61572. selector: "initialize",
  61573. protocol: "testing",
  61574. fn: function (){
  61575. var self=this,$self=this;
  61576. return $core.withContext(function($ctx1) {
  61577. var $1;
  61578. $1=$self._isFeasible();
  61579. if($core.assert($1)){
  61580. $recv($globals.Platform)._registerIfNone_($self._new());
  61581. }
  61582. return self;
  61583. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61584. },
  61585. args: [],
  61586. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61587. referencedClasses: ["Platform"],
  61588. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61589. }),
  61590. $globals.NodePlatform.a$cls);
  61591. $core.addMethod(
  61592. $core.method({
  61593. selector: "isFeasible",
  61594. protocol: "testing",
  61595. fn: function (){
  61596. var self=this,$self=this;
  61597. return $core.withContext(function($ctx1) {
  61598. return typeof global !== "undefined";
  61599. return self;
  61600. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61601. },
  61602. args: [],
  61603. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61604. referencedClasses: [],
  61605. messageSends: []
  61606. }),
  61607. $globals.NodePlatform.a$cls);
  61608. });
  61609. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61610. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61611. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61612. $core.addPackage("AmberCli");
  61613. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61614. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61615. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61616. $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.";
  61617. $core.addMethod(
  61618. $core.method({
  61619. selector: "commandLineSwitches",
  61620. protocol: "commandline",
  61621. fn: function (){
  61622. var self=this,$self=this;
  61623. var switches;
  61624. return $core.withContext(function($ctx1) {
  61625. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61626. return $core.withContext(function($ctx2) {
  61627. return $recv(each)._selector();
  61628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61629. }));
  61630. $ctx1.sendIdx["collect:"]=1;
  61631. switches=$recv(switches)._select_((function(each){
  61632. return $core.withContext(function($ctx2) {
  61633. return $recv(each)._match_("^[^:]*:$");
  61634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61635. }));
  61636. switches=$recv(switches)._collect_((function(each){
  61637. return $core.withContext(function($ctx2) {
  61638. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61640. }));
  61641. return switches;
  61642. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61643. },
  61644. args: [],
  61645. 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",
  61646. referencedClasses: [],
  61647. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61648. }),
  61649. $globals.AmberCli.a$cls);
  61650. $core.addMethod(
  61651. $core.method({
  61652. selector: "config:",
  61653. protocol: "commands",
  61654. fn: function (args){
  61655. var self=this,$self=this;
  61656. return $core.withContext(function($ctx1) {
  61657. $recv($recv($globals.Configurator)._new())._start();
  61658. return self;
  61659. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61660. },
  61661. args: ["args"],
  61662. source: "config: args\x0a\x09Configurator new start",
  61663. referencedClasses: ["Configurator"],
  61664. messageSends: ["start", "new"]
  61665. }),
  61666. $globals.AmberCli.a$cls);
  61667. $core.addMethod(
  61668. $core.method({
  61669. selector: "handleArguments:",
  61670. protocol: "commandline",
  61671. fn: function (args){
  61672. var self=this,$self=this;
  61673. var selector;
  61674. return $core.withContext(function($ctx1) {
  61675. var $1;
  61676. $1=$recv(args)._first();
  61677. $ctx1.sendIdx["first"]=1;
  61678. selector=$self._selectorForCommandLineSwitch_($1);
  61679. $recv(args)._remove_($recv(args)._first());
  61680. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61681. return self;
  61682. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61683. },
  61684. args: ["args"],
  61685. 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)",
  61686. referencedClasses: ["Array"],
  61687. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  61688. }),
  61689. $globals.AmberCli.a$cls);
  61690. $core.addMethod(
  61691. $core.method({
  61692. selector: "help:",
  61693. protocol: "commands",
  61694. fn: function (args){
  61695. var self=this,$self=this;
  61696. return $core.withContext(function($ctx1) {
  61697. $recv($globals.Transcript)._show_("Available commands");
  61698. $recv($self._commandLineSwitches())._do_((function(each){
  61699. return $core.withContext(function($ctx2) {
  61700. return $recv(console)._log_(each);
  61701. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61702. }));
  61703. return self;
  61704. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  61705. },
  61706. args: ["args"],
  61707. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  61708. referencedClasses: ["Transcript"],
  61709. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  61710. }),
  61711. $globals.AmberCli.a$cls);
  61712. $core.addMethod(
  61713. $core.method({
  61714. selector: "init:",
  61715. protocol: "commands",
  61716. fn: function (args){
  61717. var self=this,$self=this;
  61718. return $core.withContext(function($ctx1) {
  61719. $recv($recv($globals.Initer)._new())._start();
  61720. return self;
  61721. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  61722. },
  61723. args: ["args"],
  61724. source: "init: args\x0a\x09Initer new start",
  61725. referencedClasses: ["Initer"],
  61726. messageSends: ["start", "new"]
  61727. }),
  61728. $globals.AmberCli.a$cls);
  61729. $core.addMethod(
  61730. $core.method({
  61731. selector: "main",
  61732. protocol: "startup",
  61733. fn: function (){
  61734. var self=this,$self=this;
  61735. var args,packageJSON;
  61736. return $core.withContext(function($ctx1) {
  61737. var $7,$6,$5,$4,$3,$2,$1;
  61738. var $early={};
  61739. try {
  61740. packageJSON=$recv(require)._value_("../package.json");
  61741. $7=$recv(packageJSON)._version();
  61742. $ctx1.sendIdx["version"]=1;
  61743. $6="Welcome to Amber CLI version ".__comma($7);
  61744. $5=$recv($6).__comma(" (Amber ");
  61745. $ctx1.sendIdx[","]=5;
  61746. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  61747. $ctx1.sendIdx[","]=4;
  61748. $3=$recv($4).__comma(", NodeJS ");
  61749. $ctx1.sendIdx[","]=3;
  61750. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  61751. $ctx1.sendIdx[","]=2;
  61752. $1=$recv($2).__comma(").");
  61753. $ctx1.sendIdx[","]=1;
  61754. $recv($globals.Transcript)._show_($1);
  61755. args=$recv(process)._argv();
  61756. $recv(args)._removeFrom_to_((1),(2));
  61757. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  61758. return $core.withContext(function($ctx2) {
  61759. return $self._help_(nil);
  61760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61761. }),(function(){
  61762. return $core.withContext(function($ctx2) {
  61763. throw $early=[$self._handleArguments_(args)];
  61764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61765. }));
  61766. return self;
  61767. }
  61768. catch(e) {if(e===$early)return e[0]; throw e}
  61769. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  61770. },
  61771. args: [],
  61772. 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]",
  61773. referencedClasses: ["Transcript", "Smalltalk"],
  61774. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  61775. }),
  61776. $globals.AmberCli.a$cls);
  61777. $core.addMethod(
  61778. $core.method({
  61779. selector: "repl:",
  61780. protocol: "commands",
  61781. fn: function (args){
  61782. var self=this,$self=this;
  61783. return $core.withContext(function($ctx1) {
  61784. return $recv($recv($globals.Repl)._new())._createInterface();
  61785. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  61786. },
  61787. args: ["args"],
  61788. source: "repl: args\x0a\x09^ Repl new createInterface",
  61789. referencedClasses: ["Repl"],
  61790. messageSends: ["createInterface", "new"]
  61791. }),
  61792. $globals.AmberCli.a$cls);
  61793. $core.addMethod(
  61794. $core.method({
  61795. selector: "selectorForCommandLineSwitch:",
  61796. protocol: "commandline",
  61797. fn: function (aSwitch){
  61798. var self=this,$self=this;
  61799. var command,selector;
  61800. return $core.withContext(function($ctx1) {
  61801. var $1;
  61802. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  61803. if($core.assert($1)){
  61804. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  61805. return $core.withContext(function($ctx2) {
  61806. return $recv($recv(each)._second())._asUppercase();
  61807. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61808. }))).__comma(":");
  61809. selector;
  61810. } else {
  61811. selector="help:";
  61812. selector;
  61813. }
  61814. return selector;
  61815. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  61816. },
  61817. args: ["aSwitch"],
  61818. 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",
  61819. referencedClasses: [],
  61820. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  61821. }),
  61822. $globals.AmberCli.a$cls);
  61823. $core.addMethod(
  61824. $core.method({
  61825. selector: "serve:",
  61826. protocol: "commands",
  61827. fn: function (args){
  61828. var self=this,$self=this;
  61829. return $core.withContext(function($ctx1) {
  61830. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  61831. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  61832. },
  61833. args: ["args"],
  61834. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  61835. referencedClasses: ["FileServer"],
  61836. messageSends: ["start", "createServerWithArguments:"]
  61837. }),
  61838. $globals.AmberCli.a$cls);
  61839. $core.addMethod(
  61840. $core.method({
  61841. selector: "version:",
  61842. protocol: "commands",
  61843. fn: function (arguments_){
  61844. var self=this,$self=this;
  61845. return self;
  61846. },
  61847. args: ["arguments"],
  61848. source: "version: arguments",
  61849. referencedClasses: [],
  61850. messageSends: []
  61851. }),
  61852. $globals.AmberCli.a$cls);
  61853. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  61854. $core.addMethod(
  61855. $core.method({
  61856. selector: "dirname",
  61857. protocol: "private",
  61858. fn: function (){
  61859. var self=this,$self=this;
  61860. return $core.withContext(function($ctx1) {
  61861. return __dirname;
  61862. return self;
  61863. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  61864. },
  61865. args: [],
  61866. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  61867. referencedClasses: [],
  61868. messageSends: []
  61869. }),
  61870. $globals.BaseFileManipulator);
  61871. $core.addMethod(
  61872. $core.method({
  61873. selector: "initialize",
  61874. protocol: "initialization",
  61875. fn: function (){
  61876. var self=this,$self=this;
  61877. return $core.withContext(function($ctx1) {
  61878. (
  61879. $ctx1.supercall = true,
  61880. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61881. $ctx1.supercall = false;
  61882. $self["@path"]=$recv(require)._value_("path");
  61883. $ctx1.sendIdx["value:"]=1;
  61884. $self["@fs"]=$recv(require)._value_("fs");
  61885. return self;
  61886. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  61887. },
  61888. args: [],
  61889. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  61890. referencedClasses: [],
  61891. messageSends: ["initialize", "value:"]
  61892. }),
  61893. $globals.BaseFileManipulator);
  61894. $core.addMethod(
  61895. $core.method({
  61896. selector: "rootDirname",
  61897. protocol: "private",
  61898. fn: function (){
  61899. var self=this,$self=this;
  61900. return $core.withContext(function($ctx1) {
  61901. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  61902. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  61903. },
  61904. args: [],
  61905. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  61906. referencedClasses: [],
  61907. messageSends: ["join:with:", "dirname"]
  61908. }),
  61909. $globals.BaseFileManipulator);
  61910. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  61911. $core.addMethod(
  61912. $core.method({
  61913. selector: "initialize",
  61914. protocol: "initialization",
  61915. fn: function (){
  61916. var self=this,$self=this;
  61917. return $core.withContext(function($ctx1) {
  61918. (
  61919. $ctx1.supercall = true,
  61920. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61921. $ctx1.supercall = false;
  61922. return self;
  61923. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  61924. },
  61925. args: [],
  61926. source: "initialize\x0a\x09super initialize",
  61927. referencedClasses: [],
  61928. messageSends: ["initialize"]
  61929. }),
  61930. $globals.Configurator);
  61931. $core.addMethod(
  61932. $core.method({
  61933. selector: "start",
  61934. protocol: "action",
  61935. fn: function (){
  61936. var self=this,$self=this;
  61937. return $core.withContext(function($ctx1) {
  61938. var $receiver;
  61939. $self._writeConfigThenDo_((function(err){
  61940. return $core.withContext(function($ctx2) {
  61941. if(($receiver = err) == null || $receiver.a$nil){
  61942. return $recv(process)._exit();
  61943. } else {
  61944. return $recv(process)._exit_((111));
  61945. }
  61946. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  61947. }));
  61948. return self;
  61949. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  61950. },
  61951. args: [],
  61952. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  61953. referencedClasses: [],
  61954. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  61955. }),
  61956. $globals.Configurator);
  61957. $core.addMethod(
  61958. $core.method({
  61959. selector: "writeConfigThenDo:",
  61960. protocol: "action",
  61961. fn: function (aBlock){
  61962. var self=this,$self=this;
  61963. return $core.withContext(function($ctx1) {
  61964. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  61965. return self;
  61966. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  61967. },
  61968. args: ["aBlock"],
  61969. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  61970. referencedClasses: [],
  61971. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  61972. }),
  61973. $globals.Configurator);
  61974. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  61975. $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.";
  61976. $core.addMethod(
  61977. $core.method({
  61978. selector: "base64Decode:",
  61979. protocol: "private",
  61980. fn: function (aString){
  61981. var self=this,$self=this;
  61982. return $core.withContext(function($ctx1) {
  61983. return (new Buffer(aString, "base64").toString());
  61984. return self;
  61985. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  61986. },
  61987. args: ["aString"],
  61988. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  61989. referencedClasses: [],
  61990. messageSends: []
  61991. }),
  61992. $globals.FileServer);
  61993. $core.addMethod(
  61994. $core.method({
  61995. selector: "basePath",
  61996. protocol: "accessing",
  61997. fn: function (){
  61998. var self=this,$self=this;
  61999. return $core.withContext(function($ctx1) {
  62000. var $1,$receiver;
  62001. $1=$self["@basePath"];
  62002. if(($receiver = $1) == null || $receiver.a$nil){
  62003. return $recv($self._class())._defaultBasePath();
  62004. } else {
  62005. return $1;
  62006. }
  62007. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62008. },
  62009. args: [],
  62010. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62011. referencedClasses: [],
  62012. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62013. }),
  62014. $globals.FileServer);
  62015. $core.addMethod(
  62016. $core.method({
  62017. selector: "basePath:",
  62018. protocol: "accessing",
  62019. fn: function (aString){
  62020. var self=this,$self=this;
  62021. return $core.withContext(function($ctx1) {
  62022. $self["@basePath"]=aString;
  62023. $self._validateBasePath();
  62024. return self;
  62025. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62026. },
  62027. args: ["aString"],
  62028. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62029. referencedClasses: [],
  62030. messageSends: ["validateBasePath"]
  62031. }),
  62032. $globals.FileServer);
  62033. $core.addMethod(
  62034. $core.method({
  62035. selector: "checkDirectoryLayout",
  62036. protocol: "initialization",
  62037. fn: function (){
  62038. var self=this,$self=this;
  62039. return $core.withContext(function($ctx1) {
  62040. var $1;
  62041. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62042. if(!$core.assert($1)){
  62043. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62044. $ctx1.sendIdx["warn:"]=1;
  62045. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62046. $ctx1.sendIdx["warn:"]=2;
  62047. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62048. $ctx1.sendIdx["warn:"]=3;
  62049. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62050. }
  62051. return self;
  62052. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62053. },
  62054. args: [],
  62055. 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.'].",
  62056. referencedClasses: [],
  62057. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62058. }),
  62059. $globals.FileServer);
  62060. $core.addMethod(
  62061. $core.method({
  62062. selector: "fallbackPage",
  62063. protocol: "accessing",
  62064. fn: function (){
  62065. var self=this,$self=this;
  62066. return $self["@fallbackPage"];
  62067. },
  62068. args: [],
  62069. source: "fallbackPage\x0a\x09^ fallbackPage",
  62070. referencedClasses: [],
  62071. messageSends: []
  62072. }),
  62073. $globals.FileServer);
  62074. $core.addMethod(
  62075. $core.method({
  62076. selector: "fallbackPage:",
  62077. protocol: "accessing",
  62078. fn: function (aString){
  62079. var self=this,$self=this;
  62080. $self["@fallbackPage"]=aString;
  62081. return self;
  62082. },
  62083. args: ["aString"],
  62084. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62085. referencedClasses: [],
  62086. messageSends: []
  62087. }),
  62088. $globals.FileServer);
  62089. $core.addMethod(
  62090. $core.method({
  62091. selector: "handleGETRequest:respondTo:",
  62092. protocol: "request handling",
  62093. fn: function (aRequest,aResponse){
  62094. var self=this,$self=this;
  62095. var uri,filename;
  62096. return $core.withContext(function($ctx1) {
  62097. var $1;
  62098. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62099. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62100. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62101. return $core.withContext(function($ctx2) {
  62102. if($core.assert(aBoolean)){
  62103. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62104. if($core.assert($1)){
  62105. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62106. } else {
  62107. return $self._respondFileNamed_to_(filename,aResponse);
  62108. }
  62109. } else {
  62110. return $self._respondNotFoundTo_(aResponse);
  62111. }
  62112. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62113. }));
  62114. return self;
  62115. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62116. },
  62117. args: ["aRequest", "aResponse"],
  62118. 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]]]",
  62119. referencedClasses: [],
  62120. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62121. }),
  62122. $globals.FileServer);
  62123. $core.addMethod(
  62124. $core.method({
  62125. selector: "handleOPTIONSRequest:respondTo:",
  62126. protocol: "request handling",
  62127. fn: function (aRequest,aResponse){
  62128. var self=this,$self=this;
  62129. return $core.withContext(function($ctx1) {
  62130. $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)]));
  62131. $recv(aResponse)._end();
  62132. return self;
  62133. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62134. },
  62135. args: ["aRequest", "aResponse"],
  62136. 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",
  62137. referencedClasses: [],
  62138. messageSends: ["writeHead:options:", "end"]
  62139. }),
  62140. $globals.FileServer);
  62141. $core.addMethod(
  62142. $core.method({
  62143. selector: "handlePUTRequest:respondTo:",
  62144. protocol: "request handling",
  62145. fn: function (aRequest,aResponse){
  62146. var self=this,$self=this;
  62147. var file,stream;
  62148. return $core.withContext(function($ctx1) {
  62149. var $1,$2,$3,$4;
  62150. $1=$self._isAuthenticated_(aRequest);
  62151. if(!$core.assert($1)){
  62152. $self._respondAuthenticationRequiredTo_(aResponse);
  62153. return nil;
  62154. }
  62155. file=".".__comma($recv(aRequest)._url());
  62156. $ctx1.sendIdx[","]=1;
  62157. stream=$recv($self["@fs"])._createWriteStream_(file);
  62158. $recv(stream)._on_do_("error",(function(error){
  62159. return $core.withContext(function($ctx2) {
  62160. $2=console;
  62161. $3="Error creating WriteStream for file ".__comma(file);
  62162. $ctx2.sendIdx[","]=2;
  62163. $recv($2)._warn_($3);
  62164. $ctx2.sendIdx["warn:"]=1;
  62165. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62166. $ctx2.sendIdx["warn:"]=2;
  62167. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62168. return $self._respondNotCreatedTo_(aResponse);
  62169. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62170. }));
  62171. $ctx1.sendIdx["on:do:"]=1;
  62172. $recv(stream)._on_do_("close",(function(){
  62173. return $core.withContext(function($ctx2) {
  62174. return $self._respondCreatedTo_(aResponse);
  62175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62176. }));
  62177. $ctx1.sendIdx["on:do:"]=2;
  62178. $recv(aRequest)._setEncoding_("utf8");
  62179. $recv(aRequest)._on_do_("data",(function(data){
  62180. return $core.withContext(function($ctx2) {
  62181. return $recv(stream)._write_(data);
  62182. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62183. }));
  62184. $ctx1.sendIdx["on:do:"]=3;
  62185. $recv(aRequest)._on_do_("end",(function(){
  62186. return $core.withContext(function($ctx2) {
  62187. $4=$recv(stream)._writable();
  62188. if($core.assert($4)){
  62189. return $recv(stream)._end();
  62190. }
  62191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62192. }));
  62193. return self;
  62194. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62195. },
  62196. args: ["aRequest", "aResponse"],
  62197. 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]]",
  62198. referencedClasses: [],
  62199. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62200. }),
  62201. $globals.FileServer);
  62202. $core.addMethod(
  62203. $core.method({
  62204. selector: "handleRequest:respondTo:",
  62205. protocol: "request handling",
  62206. fn: function (aRequest,aResponse){
  62207. var self=this,$self=this;
  62208. return $core.withContext(function($ctx1) {
  62209. var $2,$1,$4,$3,$5;
  62210. $2=$recv(aRequest)._method();
  62211. $ctx1.sendIdx["method"]=1;
  62212. $1=$recv($2).__eq("PUT");
  62213. $ctx1.sendIdx["="]=1;
  62214. if($core.assert($1)){
  62215. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62216. }
  62217. $4=$recv(aRequest)._method();
  62218. $ctx1.sendIdx["method"]=2;
  62219. $3=$recv($4).__eq("GET");
  62220. $ctx1.sendIdx["="]=2;
  62221. if($core.assert($3)){
  62222. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62223. }
  62224. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62225. if($core.assert($5)){
  62226. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62227. }
  62228. return self;
  62229. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62230. },
  62231. args: ["aRequest", "aResponse"],
  62232. 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]",
  62233. referencedClasses: [],
  62234. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62235. }),
  62236. $globals.FileServer);
  62237. $core.addMethod(
  62238. $core.method({
  62239. selector: "host",
  62240. protocol: "accessing",
  62241. fn: function (){
  62242. var self=this,$self=this;
  62243. return $self["@host"];
  62244. },
  62245. args: [],
  62246. source: "host\x0a\x09^ host",
  62247. referencedClasses: [],
  62248. messageSends: []
  62249. }),
  62250. $globals.FileServer);
  62251. $core.addMethod(
  62252. $core.method({
  62253. selector: "host:",
  62254. protocol: "accessing",
  62255. fn: function (hostname){
  62256. var self=this,$self=this;
  62257. $self["@host"]=hostname;
  62258. return self;
  62259. },
  62260. args: ["hostname"],
  62261. source: "host: hostname\x0a\x09host := hostname",
  62262. referencedClasses: [],
  62263. messageSends: []
  62264. }),
  62265. $globals.FileServer);
  62266. $core.addMethod(
  62267. $core.method({
  62268. selector: "initialize",
  62269. protocol: "initialization",
  62270. fn: function (){
  62271. var self=this,$self=this;
  62272. return $core.withContext(function($ctx1) {
  62273. var $1;
  62274. (
  62275. $ctx1.supercall = true,
  62276. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62277. $ctx1.supercall = false;
  62278. $self["@http"]=$self._require_("http");
  62279. $ctx1.sendIdx["require:"]=1;
  62280. $self["@util"]=$self._require_("util");
  62281. $ctx1.sendIdx["require:"]=2;
  62282. $self["@url"]=$self._require_("url");
  62283. $1=$self._class();
  62284. $ctx1.sendIdx["class"]=1;
  62285. $self["@host"]=$recv($1)._defaultHost();
  62286. $self["@port"]=$recv($self._class())._defaultPort();
  62287. $self["@username"]=nil;
  62288. $self["@password"]=nil;
  62289. $self["@fallbackPage"]=nil;
  62290. return self;
  62291. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62292. },
  62293. args: [],
  62294. 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.",
  62295. referencedClasses: [],
  62296. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62297. }),
  62298. $globals.FileServer);
  62299. $core.addMethod(
  62300. $core.method({
  62301. selector: "isAuthenticated:",
  62302. protocol: "private",
  62303. fn: function (aRequest){
  62304. var self=this,$self=this;
  62305. var header,token,auth,parts;
  62306. return $core.withContext(function($ctx1) {
  62307. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62308. var $early={};
  62309. try {
  62310. $2=$recv($self["@username"])._isNil();
  62311. $ctx1.sendIdx["isNil"]=1;
  62312. $1=$recv($2)._and_((function(){
  62313. return $core.withContext(function($ctx2) {
  62314. return $recv($self["@password"])._isNil();
  62315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62316. }));
  62317. $ctx1.sendIdx["and:"]=1;
  62318. if($core.assert($1)){
  62319. return true;
  62320. }
  62321. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62322. $ctx1.sendIdx["at:"]=1;
  62323. if(($receiver = $3) == null || $receiver.a$nil){
  62324. header="";
  62325. } else {
  62326. header=$3;
  62327. }
  62328. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62329. throw $early=[false];
  62330. }),(function(){
  62331. return $core.withContext(function($ctx2) {
  62332. $4=$recv(header)._tokenize_(" ");
  62333. $ctx2.sendIdx["tokenize:"]=1;
  62334. if(($receiver = $4) == null || $receiver.a$nil){
  62335. token="";
  62336. } else {
  62337. token=$4;
  62338. }
  62339. token;
  62340. $5=$recv(token)._at_((2));
  62341. $ctx2.sendIdx["at:"]=2;
  62342. auth=$self._base64Decode_($5);
  62343. auth;
  62344. parts=$recv(auth)._tokenize_(":");
  62345. parts;
  62346. $8=$self["@username"];
  62347. $9=$recv(parts)._at_((1));
  62348. $ctx2.sendIdx["at:"]=3;
  62349. $7=$recv($8).__eq($9);
  62350. $ctx2.sendIdx["="]=1;
  62351. $6=$recv($7)._and_((function(){
  62352. return $core.withContext(function($ctx3) {
  62353. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62354. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62355. }));
  62356. if($core.assert($6)){
  62357. throw $early=[true];
  62358. } else {
  62359. throw $early=[false];
  62360. }
  62361. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62362. }));
  62363. return self;
  62364. }
  62365. catch(e) {if(e===$early)return e[0]; throw e}
  62366. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62367. },
  62368. args: ["aRequest"],
  62369. 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].",
  62370. referencedClasses: [],
  62371. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62372. }),
  62373. $globals.FileServer);
  62374. $core.addMethod(
  62375. $core.method({
  62376. selector: "password:",
  62377. protocol: "accessing",
  62378. fn: function (aPassword){
  62379. var self=this,$self=this;
  62380. $self["@password"]=aPassword;
  62381. return self;
  62382. },
  62383. args: ["aPassword"],
  62384. source: "password: aPassword\x0a\x09password := aPassword.",
  62385. referencedClasses: [],
  62386. messageSends: []
  62387. }),
  62388. $globals.FileServer);
  62389. $core.addMethod(
  62390. $core.method({
  62391. selector: "port",
  62392. protocol: "accessing",
  62393. fn: function (){
  62394. var self=this,$self=this;
  62395. return $self["@port"];
  62396. },
  62397. args: [],
  62398. source: "port\x0a\x09^ port",
  62399. referencedClasses: [],
  62400. messageSends: []
  62401. }),
  62402. $globals.FileServer);
  62403. $core.addMethod(
  62404. $core.method({
  62405. selector: "port:",
  62406. protocol: "accessing",
  62407. fn: function (aNumber){
  62408. var self=this,$self=this;
  62409. $self["@port"]=aNumber;
  62410. return self;
  62411. },
  62412. args: ["aNumber"],
  62413. source: "port: aNumber\x0a\x09port := aNumber",
  62414. referencedClasses: [],
  62415. messageSends: []
  62416. }),
  62417. $globals.FileServer);
  62418. $core.addMethod(
  62419. $core.method({
  62420. selector: "require:",
  62421. protocol: "private",
  62422. fn: function (aModuleString){
  62423. var self=this,$self=this;
  62424. return $core.withContext(function($ctx1) {
  62425. return $recv(require)._value_(aModuleString);
  62426. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62427. },
  62428. args: ["aModuleString"],
  62429. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62430. referencedClasses: [],
  62431. messageSends: ["value:"]
  62432. }),
  62433. $globals.FileServer);
  62434. $core.addMethod(
  62435. $core.method({
  62436. selector: "respondAuthenticationRequiredTo:",
  62437. protocol: "request handling",
  62438. fn: function (aResponse){
  62439. var self=this,$self=this;
  62440. return $core.withContext(function($ctx1) {
  62441. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62442. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62443. $recv(aResponse)._end();
  62444. return self;
  62445. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62446. },
  62447. args: ["aResponse"],
  62448. 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.",
  62449. referencedClasses: [],
  62450. messageSends: ["writeHead:options:", "write:", "end"]
  62451. }),
  62452. $globals.FileServer);
  62453. $core.addMethod(
  62454. $core.method({
  62455. selector: "respondCreatedTo:",
  62456. protocol: "request handling",
  62457. fn: function (aResponse){
  62458. var self=this,$self=this;
  62459. return $core.withContext(function($ctx1) {
  62460. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62461. $recv(aResponse)._end();
  62462. return self;
  62463. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62464. },
  62465. args: ["aResponse"],
  62466. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62467. referencedClasses: [],
  62468. messageSends: ["writeHead:options:", "end"]
  62469. }),
  62470. $globals.FileServer);
  62471. $core.addMethod(
  62472. $core.method({
  62473. selector: "respondDirectoryNamed:from:to:",
  62474. protocol: "request handling",
  62475. fn: function (aDirname,aUrl,aResponse){
  62476. var self=this,$self=this;
  62477. return $core.withContext(function($ctx1) {
  62478. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62479. $2=$recv(aUrl)._pathname();
  62480. $ctx1.sendIdx["pathname"]=1;
  62481. $1=$recv($2)._endsWith_("/");
  62482. if($core.assert($1)){
  62483. $3=$recv(aDirname).__comma("index.html");
  62484. $ctx1.sendIdx[","]=1;
  62485. $self._respondFileNamed_to_($3,aResponse);
  62486. } else {
  62487. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62488. $7=$recv(aUrl)._search();
  62489. if(($receiver = $7) == null || $receiver.a$nil){
  62490. $6="";
  62491. } else {
  62492. $6=$7;
  62493. }
  62494. $4=$recv($5).__comma($6);
  62495. $ctx1.sendIdx[","]=2;
  62496. $self._respondRedirect_to_($4,aResponse);
  62497. }
  62498. return self;
  62499. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62500. },
  62501. args: ["aDirname", "aUrl", "aResponse"],
  62502. 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]",
  62503. referencedClasses: [],
  62504. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62505. }),
  62506. $globals.FileServer);
  62507. $core.addMethod(
  62508. $core.method({
  62509. selector: "respondFileNamed:to:",
  62510. protocol: "request handling",
  62511. fn: function (aFilename,aResponse){
  62512. var self=this,$self=this;
  62513. var type,filename;
  62514. return $core.withContext(function($ctx1) {
  62515. var $1,$2,$3,$4;
  62516. filename=aFilename;
  62517. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62518. return $core.withContext(function($ctx2) {
  62519. $1=$recv(ex)._notNil();
  62520. if($core.assert($1)){
  62521. $2=console;
  62522. $3=$recv(filename).__comma(" does not exist");
  62523. $ctx2.sendIdx[","]=1;
  62524. $recv($2)._log_($3);
  62525. return $self._respondNotFoundTo_(aResponse);
  62526. } else {
  62527. type=$recv($self._class())._mimeTypeFor_(filename);
  62528. type;
  62529. $4=$recv(type).__eq("application/javascript");
  62530. if($core.assert($4)){
  62531. type=$recv(type).__comma(";charset=utf-8");
  62532. type;
  62533. }
  62534. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62535. $recv(aResponse)._write_encoding_(file,"binary");
  62536. return $recv(aResponse)._end();
  62537. }
  62538. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62539. }));
  62540. return self;
  62541. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62542. },
  62543. args: ["aFilename", "aResponse"],
  62544. 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]]",
  62545. referencedClasses: [],
  62546. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62547. }),
  62548. $globals.FileServer);
  62549. $core.addMethod(
  62550. $core.method({
  62551. selector: "respondInternalErrorTo:",
  62552. protocol: "request handling",
  62553. fn: function (aResponse){
  62554. var self=this,$self=this;
  62555. return $core.withContext(function($ctx1) {
  62556. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62557. $recv(aResponse)._write_("500 Internal server error");
  62558. $recv(aResponse)._end();
  62559. return self;
  62560. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62561. },
  62562. args: ["aResponse"],
  62563. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62564. referencedClasses: [],
  62565. messageSends: ["writeHead:options:", "write:", "end"]
  62566. }),
  62567. $globals.FileServer);
  62568. $core.addMethod(
  62569. $core.method({
  62570. selector: "respondNotCreatedTo:",
  62571. protocol: "request handling",
  62572. fn: function (aResponse){
  62573. var self=this,$self=this;
  62574. return $core.withContext(function($ctx1) {
  62575. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62576. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62577. $recv(aResponse)._end();
  62578. return self;
  62579. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62580. },
  62581. args: ["aResponse"],
  62582. 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.",
  62583. referencedClasses: [],
  62584. messageSends: ["writeHead:options:", "write:", "end"]
  62585. }),
  62586. $globals.FileServer);
  62587. $core.addMethod(
  62588. $core.method({
  62589. selector: "respondNotFoundTo:",
  62590. protocol: "request handling",
  62591. fn: function (aResponse){
  62592. var self=this,$self=this;
  62593. return $core.withContext(function($ctx1) {
  62594. var $2,$1;
  62595. $2=$self._fallbackPage();
  62596. $ctx1.sendIdx["fallbackPage"]=1;
  62597. $1=$recv($2)._isNil();
  62598. if(!$core.assert($1)){
  62599. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62600. }
  62601. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62602. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62603. $ctx1.sendIdx["write:"]=1;
  62604. $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>");
  62605. $ctx1.sendIdx["write:"]=2;
  62606. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62607. $ctx1.sendIdx["write:"]=3;
  62608. $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>");
  62609. $ctx1.sendIdx["write:"]=4;
  62610. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62611. $ctx1.sendIdx["write:"]=5;
  62612. $recv(aResponse)._write_("</ul></p></body></html>");
  62613. $recv(aResponse)._end();
  62614. return self;
  62615. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62616. },
  62617. args: ["aResponse"],
  62618. 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",
  62619. referencedClasses: [],
  62620. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62621. }),
  62622. $globals.FileServer);
  62623. $core.addMethod(
  62624. $core.method({
  62625. selector: "respondOKTo:",
  62626. protocol: "request handling",
  62627. fn: function (aResponse){
  62628. var self=this,$self=this;
  62629. return $core.withContext(function($ctx1) {
  62630. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62631. $recv(aResponse)._end();
  62632. return self;
  62633. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62634. },
  62635. args: ["aResponse"],
  62636. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62637. referencedClasses: [],
  62638. messageSends: ["writeHead:options:", "end"]
  62639. }),
  62640. $globals.FileServer);
  62641. $core.addMethod(
  62642. $core.method({
  62643. selector: "respondRedirect:to:",
  62644. protocol: "request handling",
  62645. fn: function (aString,aResponse){
  62646. var self=this,$self=this;
  62647. return $core.withContext(function($ctx1) {
  62648. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62649. $recv(aResponse)._end();
  62650. return self;
  62651. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62652. },
  62653. args: ["aString", "aResponse"],
  62654. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62655. referencedClasses: [],
  62656. messageSends: ["writeHead:options:", "end"]
  62657. }),
  62658. $globals.FileServer);
  62659. $core.addMethod(
  62660. $core.method({
  62661. selector: "start",
  62662. protocol: "starting",
  62663. fn: function (){
  62664. var self=this,$self=this;
  62665. return $core.withContext(function($ctx1) {
  62666. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62667. $self._checkDirectoryLayout();
  62668. $1=$recv($self["@http"])._createServer_((function(request,response){
  62669. return $core.withContext(function($ctx2) {
  62670. return $self._handleRequest_respondTo_(request,response);
  62671. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62672. }));
  62673. $recv($1)._on_do_("error",(function(error){
  62674. return $core.withContext(function($ctx2) {
  62675. $2=console;
  62676. $3="Error starting server: ".__comma(error);
  62677. $ctx2.sendIdx[","]=1;
  62678. return $recv($2)._log_($3);
  62679. $ctx2.sendIdx["log:"]=1;
  62680. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62681. }));
  62682. $ctx1.sendIdx["on:do:"]=1;
  62683. $recv($1)._on_do_("listening",(function(){
  62684. return $core.withContext(function($ctx2) {
  62685. $4=console;
  62686. $8=$self._host();
  62687. $ctx2.sendIdx["host"]=1;
  62688. $7="Starting file server on http://".__comma($8);
  62689. $6=$recv($7).__comma(":");
  62690. $ctx2.sendIdx[","]=3;
  62691. $10=$self._port();
  62692. $ctx2.sendIdx["port"]=1;
  62693. $9=$recv($10)._asString();
  62694. $5=$recv($6).__comma($9);
  62695. $ctx2.sendIdx[","]=2;
  62696. return $recv($4)._log_($5);
  62697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62698. }));
  62699. $recv($1)._listen_host_($self._port(),$self._host());
  62700. return self;
  62701. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  62702. },
  62703. args: [],
  62704. 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.",
  62705. referencedClasses: [],
  62706. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  62707. }),
  62708. $globals.FileServer);
  62709. $core.addMethod(
  62710. $core.method({
  62711. selector: "startOn:",
  62712. protocol: "starting",
  62713. fn: function (aPort){
  62714. var self=this,$self=this;
  62715. return $core.withContext(function($ctx1) {
  62716. $self._port_(aPort);
  62717. $self._start();
  62718. return self;
  62719. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  62720. },
  62721. args: ["aPort"],
  62722. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  62723. referencedClasses: [],
  62724. messageSends: ["port:", "start"]
  62725. }),
  62726. $globals.FileServer);
  62727. $core.addMethod(
  62728. $core.method({
  62729. selector: "username:",
  62730. protocol: "accessing",
  62731. fn: function (aUsername){
  62732. var self=this,$self=this;
  62733. $self["@username"]=aUsername;
  62734. return self;
  62735. },
  62736. args: ["aUsername"],
  62737. source: "username: aUsername\x0a\x09username := aUsername.",
  62738. referencedClasses: [],
  62739. messageSends: []
  62740. }),
  62741. $globals.FileServer);
  62742. $core.addMethod(
  62743. $core.method({
  62744. selector: "validateBasePath",
  62745. protocol: "private",
  62746. fn: function (){
  62747. var self=this,$self=this;
  62748. return $core.withContext(function($ctx1) {
  62749. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  62750. $1=$self["@fs"];
  62751. $2=$self._basePath();
  62752. $ctx1.sendIdx["basePath"]=1;
  62753. $recv($1)._stat_then_($2,(function(err,stat){
  62754. return $core.withContext(function($ctx2) {
  62755. if(($receiver = err) == null || $receiver.a$nil){
  62756. $3=$recv(stat)._isDirectory();
  62757. if(!$core.assert($3)){
  62758. $4=console;
  62759. $7=$self._basePath();
  62760. $ctx2.sendIdx["basePath"]=2;
  62761. $6="Warning: --base-path parameter ".__comma($7);
  62762. $ctx2.sendIdx[","]=2;
  62763. $5=$recv($6).__comma(" is not a directory.");
  62764. $ctx2.sendIdx[","]=1;
  62765. return $recv($4)._warn_($5);
  62766. $ctx2.sendIdx["warn:"]=1;
  62767. }
  62768. } else {
  62769. $8=console;
  62770. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  62771. $ctx2.sendIdx[","]=3;
  62772. return $recv($8)._warn_($9);
  62773. }
  62774. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  62775. }));
  62776. return self;
  62777. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  62778. },
  62779. args: [],
  62780. 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.' ]].",
  62781. referencedClasses: [],
  62782. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  62783. }),
  62784. $globals.FileServer);
  62785. $core.addMethod(
  62786. $core.method({
  62787. selector: "withBasePath:",
  62788. protocol: "private",
  62789. fn: function (aBaseRelativePath){
  62790. var self=this,$self=this;
  62791. return $core.withContext(function($ctx1) {
  62792. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  62793. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  62794. },
  62795. args: ["aBaseRelativePath"],
  62796. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  62797. referencedClasses: [],
  62798. messageSends: ["join:with:", "basePath"]
  62799. }),
  62800. $globals.FileServer);
  62801. $core.addMethod(
  62802. $core.method({
  62803. selector: "writeData:toFileNamed:",
  62804. protocol: "private",
  62805. fn: function (data,aFilename){
  62806. var self=this,$self=this;
  62807. return $core.withContext(function($ctx1) {
  62808. $recv(console)._log_(aFilename);
  62809. return self;
  62810. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  62811. },
  62812. args: ["data", "aFilename"],
  62813. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  62814. referencedClasses: [],
  62815. messageSends: ["log:"]
  62816. }),
  62817. $globals.FileServer);
  62818. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  62819. $core.addMethod(
  62820. $core.method({
  62821. selector: "commandLineSwitches",
  62822. protocol: "accessing",
  62823. fn: function (){
  62824. var self=this,$self=this;
  62825. var switches;
  62826. return $core.withContext(function($ctx1) {
  62827. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  62828. return $core.withContext(function($ctx2) {
  62829. return $recv(each)._selector();
  62830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62831. }));
  62832. $ctx1.sendIdx["collect:"]=1;
  62833. switches=$recv(switches)._select_((function(each){
  62834. return $core.withContext(function($ctx2) {
  62835. return $recv(each)._match_("^[^:]*:$");
  62836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62837. }));
  62838. switches=$recv(switches)._collect_((function(each){
  62839. return $core.withContext(function($ctx2) {
  62840. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  62841. $ctx2.sendIdx["replace:with:"]=1;
  62842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62843. }));
  62844. return switches;
  62845. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  62846. },
  62847. args: [],
  62848. 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",
  62849. referencedClasses: [],
  62850. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  62851. }),
  62852. $globals.FileServer.a$cls);
  62853. $core.addMethod(
  62854. $core.method({
  62855. selector: "createServerWithArguments:",
  62856. protocol: "initialization",
  62857. fn: function (options){
  62858. var self=this,$self=this;
  62859. var server,popFront,front,optionName,optionValue,switches;
  62860. return $core.withContext(function($ctx1) {
  62861. var $1,$2,$3,$4,$5,$6,$7,$8;
  62862. var $early={};
  62863. try {
  62864. switches=$self._commandLineSwitches();
  62865. server=$self._new();
  62866. $recv(options)._ifEmpty_((function(){
  62867. throw $early=[server];
  62868. }));
  62869. $1=$recv($recv(options)._size())._even();
  62870. if(!$core.assert($1)){
  62871. $recv(console)._log_("Using default parameters.");
  62872. $ctx1.sendIdx["log:"]=1;
  62873. $2=console;
  62874. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  62875. $ctx1.sendIdx[","]=1;
  62876. $recv($2)._log_($3);
  62877. $ctx1.sendIdx["log:"]=2;
  62878. $4=console;
  62879. $5="Use any of the following ones: ".__comma(switches);
  62880. $ctx1.sendIdx[","]=2;
  62881. $recv($4)._log_($5);
  62882. $ctx1.sendIdx["log:"]=3;
  62883. return server;
  62884. }
  62885. popFront=(function(args){
  62886. return $core.withContext(function($ctx2) {
  62887. front=$recv(args)._first();
  62888. front;
  62889. $recv(args)._remove_(front);
  62890. return front;
  62891. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  62892. });
  62893. $recv((function(){
  62894. return $core.withContext(function($ctx2) {
  62895. return $recv(options)._notEmpty();
  62896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  62897. }))._whileTrue_((function(){
  62898. return $core.withContext(function($ctx2) {
  62899. optionName=$recv(popFront)._value_(options);
  62900. $ctx2.sendIdx["value:"]=1;
  62901. optionName;
  62902. optionValue=$recv(popFront)._value_(options);
  62903. optionValue;
  62904. $6=$recv(switches)._includes_(optionName);
  62905. if($core.assert($6)){
  62906. optionName=$self._selectorForCommandLineSwitch_(optionName);
  62907. optionName;
  62908. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  62909. } else {
  62910. $7=console;
  62911. $8=$recv(optionName).__comma(" is not a valid commandline option");
  62912. $ctx2.sendIdx[","]=3;
  62913. $recv($7)._log_($8);
  62914. $ctx2.sendIdx["log:"]=4;
  62915. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  62916. }
  62917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62918. }));
  62919. return server;
  62920. }
  62921. catch(e) {if(e===$early)return e[0]; throw e}
  62922. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  62923. },
  62924. args: ["options"],
  62925. 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.",
  62926. referencedClasses: ["Array"],
  62927. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  62928. }),
  62929. $globals.FileServer.a$cls);
  62930. $core.addMethod(
  62931. $core.method({
  62932. selector: "defaultBasePath",
  62933. protocol: "accessing",
  62934. fn: function (){
  62935. var self=this,$self=this;
  62936. return "./";
  62937. },
  62938. args: [],
  62939. source: "defaultBasePath\x0a\x09^ './'",
  62940. referencedClasses: [],
  62941. messageSends: []
  62942. }),
  62943. $globals.FileServer.a$cls);
  62944. $core.addMethod(
  62945. $core.method({
  62946. selector: "defaultHost",
  62947. protocol: "accessing",
  62948. fn: function (){
  62949. var self=this,$self=this;
  62950. return "127.0.0.1";
  62951. },
  62952. args: [],
  62953. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  62954. referencedClasses: [],
  62955. messageSends: []
  62956. }),
  62957. $globals.FileServer.a$cls);
  62958. $core.addMethod(
  62959. $core.method({
  62960. selector: "defaultMimeTypes",
  62961. protocol: "accessing",
  62962. fn: function (){
  62963. var self=this,$self=this;
  62964. 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"]);
  62965. },
  62966. args: [],
  62967. 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}",
  62968. referencedClasses: [],
  62969. messageSends: []
  62970. }),
  62971. $globals.FileServer.a$cls);
  62972. $core.addMethod(
  62973. $core.method({
  62974. selector: "defaultPort",
  62975. protocol: "accessing",
  62976. fn: function (){
  62977. var self=this,$self=this;
  62978. return (4000);
  62979. },
  62980. args: [],
  62981. source: "defaultPort\x0a\x09^ 4000",
  62982. referencedClasses: [],
  62983. messageSends: []
  62984. }),
  62985. $globals.FileServer.a$cls);
  62986. $core.addMethod(
  62987. $core.method({
  62988. selector: "main",
  62989. protocol: "initialization",
  62990. fn: function (){
  62991. var self=this,$self=this;
  62992. var fileServer,args;
  62993. return $core.withContext(function($ctx1) {
  62994. var $1;
  62995. var $early={};
  62996. try {
  62997. args=$recv(process)._argv();
  62998. $recv(args)._removeFrom_to_((1),(3));
  62999. $recv(args)._detect_ifNone_((function(each){
  63000. return $core.withContext(function($ctx2) {
  63001. $1=$recv(each).__eq("--help");
  63002. if($core.assert($1)){
  63003. return $recv($globals.FileServer)._printHelp();
  63004. }
  63005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63006. }),(function(){
  63007. return $core.withContext(function($ctx2) {
  63008. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63009. fileServer;
  63010. throw $early=[$recv(fileServer)._start()];
  63011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63012. }));
  63013. return self;
  63014. }
  63015. catch(e) {if(e===$early)return e[0]; throw e}
  63016. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63017. },
  63018. args: [],
  63019. 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]",
  63020. referencedClasses: ["FileServer"],
  63021. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63022. }),
  63023. $globals.FileServer.a$cls);
  63024. $core.addMethod(
  63025. $core.method({
  63026. selector: "mimeTypeFor:",
  63027. protocol: "accessing",
  63028. fn: function (aString){
  63029. var self=this,$self=this;
  63030. return $core.withContext(function($ctx1) {
  63031. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63032. return "text/plain";
  63033. }));
  63034. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63035. },
  63036. args: ["aString"],
  63037. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63038. referencedClasses: [],
  63039. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63040. }),
  63041. $globals.FileServer.a$cls);
  63042. $core.addMethod(
  63043. $core.method({
  63044. selector: "mimeTypes",
  63045. protocol: "accessing",
  63046. fn: function (){
  63047. var self=this,$self=this;
  63048. return $core.withContext(function($ctx1) {
  63049. var $1,$receiver;
  63050. $1=$self["@mimeTypes"];
  63051. if(($receiver = $1) == null || $receiver.a$nil){
  63052. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63053. return $self["@mimeTypes"];
  63054. } else {
  63055. return $1;
  63056. }
  63057. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63058. },
  63059. args: [],
  63060. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63061. referencedClasses: [],
  63062. messageSends: ["ifNil:", "defaultMimeTypes"]
  63063. }),
  63064. $globals.FileServer.a$cls);
  63065. $core.addMethod(
  63066. $core.method({
  63067. selector: "printHelp",
  63068. protocol: "accessing",
  63069. fn: function (){
  63070. var self=this,$self=this;
  63071. return $core.withContext(function($ctx1) {
  63072. $recv(console)._log_("Available commandline options are:");
  63073. $ctx1.sendIdx["log:"]=1;
  63074. $recv(console)._log_("--help");
  63075. $ctx1.sendIdx["log:"]=2;
  63076. $recv($self._commandLineSwitches())._do_((function(each){
  63077. return $core.withContext(function($ctx2) {
  63078. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63080. }));
  63081. return self;
  63082. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63083. },
  63084. args: [],
  63085. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63086. referencedClasses: [],
  63087. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63088. }),
  63089. $globals.FileServer.a$cls);
  63090. $core.addMethod(
  63091. $core.method({
  63092. selector: "selectorForCommandLineSwitch:",
  63093. protocol: "accessing",
  63094. fn: function (aSwitch){
  63095. var self=this,$self=this;
  63096. return $core.withContext(function($ctx1) {
  63097. var $1;
  63098. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63099. return $core.withContext(function($ctx2) {
  63100. return $recv($recv(each)._second())._asUppercase();
  63101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63102. }));
  63103. $ctx1.sendIdx["replace:with:"]=1;
  63104. return $recv($1).__comma(":");
  63105. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63106. },
  63107. args: ["aSwitch"],
  63108. 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 ]), ':'",
  63109. referencedClasses: [],
  63110. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63111. }),
  63112. $globals.FileServer.a$cls);
  63113. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63114. $core.addMethod(
  63115. $core.method({
  63116. selector: "bowerInstallThenDo:",
  63117. protocol: "action",
  63118. fn: function (aBlock){
  63119. var self=this,$self=this;
  63120. var child;
  63121. return $core.withContext(function($ctx1) {
  63122. var $1,$3,$2;
  63123. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  63124. $1=child;
  63125. $recv($1)._on_do_("error",aBlock);
  63126. $ctx1.sendIdx["on:do:"]=1;
  63127. $recv($1)._on_do_("close",(function(code){
  63128. return $core.withContext(function($ctx2) {
  63129. $3=$recv(code).__eq((0));
  63130. if($core.assert($3)){
  63131. $2=nil;
  63132. } else {
  63133. $2=code;
  63134. }
  63135. return $recv(aBlock)._value_($2);
  63136. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63137. }));
  63138. return self;
  63139. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63140. },
  63141. args: ["aBlock"],
  63142. 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 ]) ]",
  63143. referencedClasses: [],
  63144. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63145. }),
  63146. $globals.Initer);
  63147. $core.addMethod(
  63148. $core.method({
  63149. selector: "finishMessage",
  63150. protocol: "action",
  63151. fn: function (){
  63152. var self=this,$self=this;
  63153. return $core.withContext(function($ctx1) {
  63154. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63155. $recv((function(){
  63156. }))._valueWithTimeout_((600));
  63157. return self;
  63158. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63159. },
  63160. args: [],
  63161. 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",
  63162. referencedClasses: ["String"],
  63163. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63164. }),
  63165. $globals.Initer);
  63166. $core.addMethod(
  63167. $core.method({
  63168. selector: "gruntInitThenDo:",
  63169. protocol: "action",
  63170. fn: function (aBlock){
  63171. var self=this,$self=this;
  63172. var child,sanitizedTemplatePath;
  63173. return $core.withContext(function($ctx1) {
  63174. var $1,$3,$2;
  63175. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63176. $ctx1.sendIdx["replace:with:"]=1;
  63177. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63178. $1=child;
  63179. $recv($1)._on_do_("error",aBlock);
  63180. $ctx1.sendIdx["on:do:"]=1;
  63181. $recv($1)._on_do_("close",(function(code){
  63182. return $core.withContext(function($ctx2) {
  63183. $3=$recv(code).__eq((0));
  63184. if($core.assert($3)){
  63185. $2=nil;
  63186. } else {
  63187. $2=code;
  63188. }
  63189. return $recv(aBlock)._value_($2);
  63190. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63191. }));
  63192. return self;
  63193. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63194. },
  63195. args: ["aBlock"],
  63196. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63197. referencedClasses: [],
  63198. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63199. }),
  63200. $globals.Initer);
  63201. $core.addMethod(
  63202. $core.method({
  63203. selector: "gruntThenDo:",
  63204. protocol: "action",
  63205. fn: function (aBlock){
  63206. var self=this,$self=this;
  63207. var child;
  63208. return $core.withContext(function($ctx1) {
  63209. var $1,$3,$2;
  63210. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  63211. $1=child;
  63212. $recv($1)._on_do_("error",aBlock);
  63213. $ctx1.sendIdx["on:do:"]=1;
  63214. $recv($1)._on_do_("close",(function(code){
  63215. return $core.withContext(function($ctx2) {
  63216. $3=$recv(code).__eq((0));
  63217. if($core.assert($3)){
  63218. $2=nil;
  63219. } else {
  63220. $2=code;
  63221. }
  63222. return $recv(aBlock)._value_($2);
  63223. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63224. }));
  63225. return self;
  63226. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63227. },
  63228. args: ["aBlock"],
  63229. 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 ]) ]",
  63230. referencedClasses: [],
  63231. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63232. }),
  63233. $globals.Initer);
  63234. $core.addMethod(
  63235. $core.method({
  63236. selector: "initialize",
  63237. protocol: "initialization",
  63238. fn: function (){
  63239. var self=this,$self=this;
  63240. return $core.withContext(function($ctx1) {
  63241. (
  63242. $ctx1.supercall = true,
  63243. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63244. $ctx1.supercall = false;
  63245. $self["@childProcess"]=$recv(require)._value_("child_process");
  63246. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63247. return self;
  63248. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63249. },
  63250. args: [],
  63251. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63252. referencedClasses: [],
  63253. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63254. }),
  63255. $globals.Initer);
  63256. $core.addMethod(
  63257. $core.method({
  63258. selector: "npmInstallThenDo:",
  63259. protocol: "action",
  63260. fn: function (aBlock){
  63261. var self=this,$self=this;
  63262. var child;
  63263. return $core.withContext(function($ctx1) {
  63264. var $1;
  63265. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  63266. $1=$recv(child)._stdout();
  63267. $ctx1.sendIdx["stdout"]=1;
  63268. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63269. return self;
  63270. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63271. },
  63272. args: ["aBlock"],
  63273. 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 }",
  63274. referencedClasses: [],
  63275. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63276. }),
  63277. $globals.Initer);
  63278. $core.addMethod(
  63279. $core.method({
  63280. selector: "npmScriptForModule:named:",
  63281. protocol: "npm",
  63282. fn: function (aString,anotherString){
  63283. var self=this,$self=this;
  63284. var modulePath,packageJson,binSection,scriptPath;
  63285. return $core.withContext(function($ctx1) {
  63286. var $1,$3,$4,$2,$5;
  63287. $1=$self["@path"];
  63288. $3=$recv($globals.JSObjectProxy)._on_(require);
  63289. $4=$recv(aString).__comma("/package.json");
  63290. $ctx1.sendIdx[","]=1;
  63291. $2=$recv($3)._resolve_($4);
  63292. modulePath=$recv($1)._dirname_($2);
  63293. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63294. binSection=$recv(packageJson)._at_("bin");
  63295. $ctx1.sendIdx["at:"]=1;
  63296. $5=$recv(binSection)._isString();
  63297. if($core.assert($5)){
  63298. scriptPath=binSection;
  63299. } else {
  63300. scriptPath=$recv(binSection)._at_(anotherString);
  63301. }
  63302. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63303. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63304. },
  63305. args: ["aString", "anotherString"],
  63306. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  63307. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  63308. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63309. }),
  63310. $globals.Initer);
  63311. $core.addMethod(
  63312. $core.method({
  63313. selector: "start",
  63314. protocol: "action",
  63315. fn: function (){
  63316. var self=this,$self=this;
  63317. return $core.withContext(function($ctx1) {
  63318. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63319. $self._gruntInitThenDo_((function(error){
  63320. return $core.withContext(function($ctx2) {
  63321. if(($receiver = error) == null || $receiver.a$nil){
  63322. return $self._bowerInstallThenDo_((function(error2){
  63323. return $core.withContext(function($ctx3) {
  63324. if(($receiver = error2) == null || $receiver.a$nil){
  63325. return $self._npmInstallThenDo_((function(error3){
  63326. return $core.withContext(function($ctx4) {
  63327. if(($receiver = error3) == null || $receiver.a$nil){
  63328. return $self._gruntThenDo_((function(error4){
  63329. return $core.withContext(function($ctx5) {
  63330. if(($receiver = error4) == null || $receiver.a$nil){
  63331. $self._finishMessage();
  63332. return $recv(process)._exit();
  63333. } else {
  63334. $7=console;
  63335. $recv($7)._log_("grunt exec error:");
  63336. $ctx5.sendIdx["log:"]=7;
  63337. $recv($7)._log_(error4);
  63338. return $recv(process)._exit_((104));
  63339. }
  63340. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63341. }));
  63342. } else {
  63343. $5=console;
  63344. $recv($5)._log_("npm install exec error:");
  63345. $ctx4.sendIdx["log:"]=5;
  63346. $6=$recv($5)._log_(error3);
  63347. $ctx4.sendIdx["log:"]=6;
  63348. $6;
  63349. return $recv(process)._exit_((103));
  63350. $ctx4.sendIdx["exit:"]=3;
  63351. }
  63352. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63353. }));
  63354. } else {
  63355. $3=console;
  63356. $recv($3)._log_("bower install exec error:");
  63357. $ctx3.sendIdx["log:"]=3;
  63358. $4=$recv($3)._log_(error2);
  63359. $ctx3.sendIdx["log:"]=4;
  63360. $4;
  63361. return $recv(process)._exit_((102));
  63362. $ctx3.sendIdx["exit:"]=2;
  63363. }
  63364. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63365. }));
  63366. } else {
  63367. $1=console;
  63368. $recv($1)._log_("grunt-init exec error:");
  63369. $ctx2.sendIdx["log:"]=1;
  63370. $2=$recv($1)._log_(error);
  63371. $ctx2.sendIdx["log:"]=2;
  63372. $2;
  63373. return $recv(process)._exit_((101));
  63374. $ctx2.sendIdx["exit:"]=1;
  63375. }
  63376. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63377. }));
  63378. return self;
  63379. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63380. },
  63381. args: [],
  63382. 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 ]]]]]]]]",
  63383. referencedClasses: [],
  63384. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63385. }),
  63386. $globals.Initer);
  63387. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63388. $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.";
  63389. $core.addMethod(
  63390. $core.method({
  63391. selector: "addVariableNamed:to:",
  63392. protocol: "private",
  63393. fn: function (aString,anObject){
  63394. var self=this,$self=this;
  63395. var newClass,newObject;
  63396. return $core.withContext(function($ctx1) {
  63397. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63398. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63399. newObject=$recv(newClass)._new();
  63400. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63401. return newObject;
  63402. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63403. },
  63404. args: ["aString", "anObject"],
  63405. 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",
  63406. referencedClasses: [],
  63407. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63408. }),
  63409. $globals.Repl);
  63410. $core.addMethod(
  63411. $core.method({
  63412. selector: "assignNewVariable:do:",
  63413. protocol: "private",
  63414. fn: function (buffer,aBlock){
  63415. var self=this,$self=this;
  63416. return $core.withContext(function($ctx1) {
  63417. var $2,$3,$1,$receiver;
  63418. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63419. var varName,value;
  63420. return $core.withContext(function($ctx2) {
  63421. if(($receiver = name) == null || $receiver.a$nil){
  63422. varName=$self._nextResultName();
  63423. } else {
  63424. varName=name;
  63425. }
  63426. varName;
  63427. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63428. $self["@session"];
  63429. $recv((function(){
  63430. return $core.withContext(function($ctx3) {
  63431. $2=$recv(varName).__comma(" := ");
  63432. if(($receiver = expr) == null || $receiver.a$nil){
  63433. $3=buffer;
  63434. } else {
  63435. $3=expr;
  63436. }
  63437. $1=$recv($2).__comma($3);
  63438. $ctx3.sendIdx[","]=1;
  63439. value=$self._eval_on_($1,$self["@session"]);
  63440. return value;
  63441. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63442. }))._on_do_($globals.Error,(function(e){
  63443. return $core.withContext(function($ctx3) {
  63444. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63445. value=nil;
  63446. return value;
  63447. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63448. }));
  63449. return $recv(aBlock)._value_value_(varName,value);
  63450. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63451. }));
  63452. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63453. },
  63454. args: ["buffer", "aBlock"],
  63455. 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]",
  63456. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63457. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63458. }),
  63459. $globals.Repl);
  63460. $core.addMethod(
  63461. $core.method({
  63462. selector: "clearScreen",
  63463. protocol: "actions",
  63464. fn: function (){
  63465. var self=this,$self=this;
  63466. var esc,cls;
  63467. return $core.withContext(function($ctx1) {
  63468. var $1;
  63469. esc=$recv($globals.String)._fromCharCode_((27));
  63470. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63471. $ctx1.sendIdx[","]=2;
  63472. cls=$recv($1).__comma("[0;0f");
  63473. $ctx1.sendIdx[","]=1;
  63474. $recv($recv(process)._stdout())._write_(cls);
  63475. $recv($self["@interface"])._prompt();
  63476. return self;
  63477. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63478. },
  63479. args: [],
  63480. 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",
  63481. referencedClasses: ["String"],
  63482. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63483. }),
  63484. $globals.Repl);
  63485. $core.addMethod(
  63486. $core.method({
  63487. selector: "close",
  63488. protocol: "actions",
  63489. fn: function (){
  63490. var self=this,$self=this;
  63491. return $core.withContext(function($ctx1) {
  63492. $recv($recv(process)._stdin())._destroy();
  63493. return self;
  63494. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63495. },
  63496. args: [],
  63497. source: "close\x0a\x09process stdin destroy",
  63498. referencedClasses: [],
  63499. messageSends: ["destroy", "stdin"]
  63500. }),
  63501. $globals.Repl);
  63502. $core.addMethod(
  63503. $core.method({
  63504. selector: "commands",
  63505. protocol: "accessing",
  63506. fn: function (){
  63507. var self=this,$self=this;
  63508. return $self["@commands"];
  63509. },
  63510. args: [],
  63511. source: "commands\x0a\x09^ commands",
  63512. referencedClasses: [],
  63513. messageSends: []
  63514. }),
  63515. $globals.Repl);
  63516. $core.addMethod(
  63517. $core.method({
  63518. selector: "createInterface",
  63519. protocol: "actions",
  63520. fn: function (){
  63521. var self=this,$self=this;
  63522. return $core.withContext(function($ctx1) {
  63523. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63524. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63525. return $core.withContext(function($ctx2) {
  63526. return $self._processLine_(buffer);
  63527. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63528. }));
  63529. $ctx1.sendIdx["on:do:"]=1;
  63530. $recv($self["@interface"])._on_do_("close",(function(){
  63531. return $core.withContext(function($ctx2) {
  63532. return $self._close();
  63533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63534. }));
  63535. $self._printWelcome();
  63536. $self._setupHotkeys();
  63537. $self._setPrompt();
  63538. $recv($self["@interface"])._prompt();
  63539. return self;
  63540. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63541. },
  63542. args: [],
  63543. 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",
  63544. referencedClasses: [],
  63545. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63546. }),
  63547. $globals.Repl);
  63548. $core.addMethod(
  63549. $core.method({
  63550. selector: "encapsulateVariable:withValue:in:",
  63551. protocol: "private",
  63552. fn: function (aString,anObject,aClass){
  63553. var self=this,$self=this;
  63554. var compiler;
  63555. return $core.withContext(function($ctx1) {
  63556. var $1,$4,$3,$2,$5,$6;
  63557. compiler=$recv($globals.Compiler)._new();
  63558. $1=compiler;
  63559. $4=$recv(aString).__comma(": anObject ^ ");
  63560. $ctx1.sendIdx[","]=3;
  63561. $3=$recv($4).__comma(aString);
  63562. $ctx1.sendIdx[","]=2;
  63563. $2=$recv($3).__comma(" := anObject");
  63564. $ctx1.sendIdx[","]=1;
  63565. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63566. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63567. $5=compiler;
  63568. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63569. $ctx1.sendIdx[","]=4;
  63570. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63571. return self;
  63572. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63573. },
  63574. args: ["aString", "anObject", "aClass"],
  63575. 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'.",
  63576. referencedClasses: ["Compiler"],
  63577. messageSends: ["new", "install:forClass:protocol:", ","]
  63578. }),
  63579. $globals.Repl);
  63580. $core.addMethod(
  63581. $core.method({
  63582. selector: "eval:",
  63583. protocol: "actions",
  63584. fn: function (buffer){
  63585. var self=this,$self=this;
  63586. return $core.withContext(function($ctx1) {
  63587. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63588. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63589. },
  63590. args: ["buffer"],
  63591. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63592. referencedClasses: ["DoIt"],
  63593. messageSends: ["eval:on:", "new"]
  63594. }),
  63595. $globals.Repl);
  63596. $core.addMethod(
  63597. $core.method({
  63598. selector: "eval:on:",
  63599. protocol: "actions",
  63600. fn: function (buffer,anObject){
  63601. var self=this,$self=this;
  63602. var result;
  63603. return $core.withContext(function($ctx1) {
  63604. var $1;
  63605. $recv(buffer)._ifNotEmpty_((function(){
  63606. return $core.withContext(function($ctx2) {
  63607. return $recv((function(){
  63608. return $core.withContext(function($ctx3) {
  63609. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63610. return result;
  63611. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63612. }))._tryCatch_((function(e){
  63613. return $core.withContext(function($ctx3) {
  63614. $1=$recv(e)._isSmalltalkError();
  63615. if($core.assert($1)){
  63616. return $recv(e)._resignal();
  63617. } else {
  63618. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63619. }
  63620. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63621. }));
  63622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63623. }));
  63624. return result;
  63625. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63626. },
  63627. args: ["buffer", "anObject"],
  63628. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63629. referencedClasses: ["Compiler"],
  63630. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  63631. }),
  63632. $globals.Repl);
  63633. $core.addMethod(
  63634. $core.method({
  63635. selector: "executeCommand:",
  63636. protocol: "private",
  63637. fn: function (aString){
  63638. var self=this,$self=this;
  63639. return $core.withContext(function($ctx1) {
  63640. var $1;
  63641. var $early={};
  63642. try {
  63643. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63644. return $core.withContext(function($ctx2) {
  63645. $1=$recv(names)._includes_(aString);
  63646. if($core.assert($1)){
  63647. $recv(cmd)._value();
  63648. throw $early=[true];
  63649. }
  63650. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63651. }));
  63652. return false;
  63653. }
  63654. catch(e) {if(e===$early)return e[0]; throw e}
  63655. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63656. },
  63657. args: ["aString"],
  63658. 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",
  63659. referencedClasses: [],
  63660. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63661. }),
  63662. $globals.Repl);
  63663. $core.addMethod(
  63664. $core.method({
  63665. selector: "initialize",
  63666. protocol: "initialization",
  63667. fn: function (){
  63668. var self=this,$self=this;
  63669. return $core.withContext(function($ctx1) {
  63670. (
  63671. $ctx1.supercall = true,
  63672. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63673. $ctx1.supercall = false;
  63674. $self["@session"]=$recv($globals.DoIt)._new();
  63675. $self["@readline"]=$recv(require)._value_("readline");
  63676. $ctx1.sendIdx["value:"]=1;
  63677. $self["@util"]=$recv(require)._value_("util");
  63678. $self._setupCommands();
  63679. return self;
  63680. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63681. },
  63682. args: [],
  63683. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63684. referencedClasses: ["DoIt"],
  63685. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63686. }),
  63687. $globals.Repl);
  63688. $core.addMethod(
  63689. $core.method({
  63690. selector: "instanceVariableNamesFor:",
  63691. protocol: "private",
  63692. fn: function (aClass){
  63693. var self=this,$self=this;
  63694. return $core.withContext(function($ctx1) {
  63695. var $1,$2,$receiver;
  63696. $1=$recv(aClass)._superclass();
  63697. $ctx1.sendIdx["superclass"]=1;
  63698. if(($receiver = $1) == null || $receiver.a$nil){
  63699. return $recv(aClass)._instanceVariableNames();
  63700. } else {
  63701. $2=$recv(aClass)._instanceVariableNames();
  63702. $ctx1.sendIdx["instanceVariableNames"]=1;
  63703. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63704. }
  63705. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63706. },
  63707. args: ["aClass"],
  63708. 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]",
  63709. referencedClasses: [],
  63710. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63711. }),
  63712. $globals.Repl);
  63713. $core.addMethod(
  63714. $core.method({
  63715. selector: "isIdentifier:",
  63716. protocol: "private",
  63717. fn: function (aString){
  63718. var self=this,$self=this;
  63719. return $core.withContext(function($ctx1) {
  63720. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63721. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63722. },
  63723. args: ["aString"],
  63724. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63725. referencedClasses: [],
  63726. messageSends: ["match:", "asRegexp"]
  63727. }),
  63728. $globals.Repl);
  63729. $core.addMethod(
  63730. $core.method({
  63731. selector: "isVariableDefined:",
  63732. protocol: "private",
  63733. fn: function (aString){
  63734. var self=this,$self=this;
  63735. return $core.withContext(function($ctx1) {
  63736. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63737. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63738. },
  63739. args: ["aString"],
  63740. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63741. referencedClasses: [],
  63742. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63743. }),
  63744. $globals.Repl);
  63745. $core.addMethod(
  63746. $core.method({
  63747. selector: "nextResultName",
  63748. protocol: "private",
  63749. fn: function (){
  63750. var self=this,$self=this;
  63751. return $core.withContext(function($ctx1) {
  63752. var $1,$receiver;
  63753. $1=$self["@resultCount"];
  63754. if(($receiver = $1) == null || $receiver.a$nil){
  63755. $self["@resultCount"]=(1);
  63756. } else {
  63757. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63758. }
  63759. return "res".__comma($recv($self["@resultCount"])._asString());
  63760. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63761. },
  63762. args: [],
  63763. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  63764. referencedClasses: [],
  63765. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  63766. }),
  63767. $globals.Repl);
  63768. $core.addMethod(
  63769. $core.method({
  63770. selector: "onKeyPress:",
  63771. protocol: "private",
  63772. fn: function (key){
  63773. var self=this,$self=this;
  63774. return $core.withContext(function($ctx1) {
  63775. var $1;
  63776. $1=$recv($recv(key)._ctrl())._and_((function(){
  63777. return $core.withContext(function($ctx2) {
  63778. return $recv($recv(key)._name()).__eq("l");
  63779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63780. }));
  63781. if($core.assert($1)){
  63782. $self._clearScreen();
  63783. }
  63784. return self;
  63785. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  63786. },
  63787. args: ["key"],
  63788. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  63789. referencedClasses: [],
  63790. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  63791. }),
  63792. $globals.Repl);
  63793. $core.addMethod(
  63794. $core.method({
  63795. selector: "parseAssignment:do:",
  63796. protocol: "private",
  63797. fn: function (aString,aBlock){
  63798. var self=this,$self=this;
  63799. var assignment;
  63800. return $core.withContext(function($ctx1) {
  63801. var $2,$1;
  63802. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  63803. return $core.withContext(function($ctx2) {
  63804. return $recv(s)._trimBoth();
  63805. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  63806. }));
  63807. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  63808. return $core.withContext(function($ctx2) {
  63809. $2=$recv(assignment)._first();
  63810. $ctx2.sendIdx["first"]=1;
  63811. return $self._isIdentifier_($2);
  63812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63813. }));
  63814. if($core.assert($1)){
  63815. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  63816. $ctx1.sendIdx["value:value:"]=1;
  63817. } else {
  63818. return $recv(aBlock)._value_value_(nil,nil);
  63819. }
  63820. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  63821. },
  63822. args: ["aString", "aBlock"],
  63823. 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 ]",
  63824. referencedClasses: [],
  63825. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  63826. }),
  63827. $globals.Repl);
  63828. $core.addMethod(
  63829. $core.method({
  63830. selector: "presentResultNamed:withValue:",
  63831. protocol: "private",
  63832. fn: function (varName,value){
  63833. var self=this,$self=this;
  63834. return $core.withContext(function($ctx1) {
  63835. var $3,$2,$1;
  63836. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  63837. $ctx1.sendIdx[","]=3;
  63838. $2=$recv($3).__comma(" = ");
  63839. $ctx1.sendIdx[","]=2;
  63840. $1=$recv($2).__comma($recv(value)._asString());
  63841. $ctx1.sendIdx[","]=1;
  63842. $recv($globals.Transcript)._show_($1);
  63843. $recv($globals.Transcript)._cr();
  63844. $recv($self["@interface"])._prompt();
  63845. return self;
  63846. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  63847. },
  63848. args: ["varName", "value"],
  63849. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  63850. referencedClasses: ["Transcript"],
  63851. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  63852. }),
  63853. $globals.Repl);
  63854. $core.addMethod(
  63855. $core.method({
  63856. selector: "printWelcome",
  63857. protocol: "actions",
  63858. fn: function (){
  63859. var self=this,$self=this;
  63860. return $core.withContext(function($ctx1) {
  63861. $recv($globals.Transcript)._show_("Type :q to exit.");
  63862. $recv($globals.Transcript)._cr();
  63863. return self;
  63864. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  63865. },
  63866. args: [],
  63867. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  63868. referencedClasses: ["Transcript"],
  63869. messageSends: ["show:", "cr"]
  63870. }),
  63871. $globals.Repl);
  63872. $core.addMethod(
  63873. $core.method({
  63874. selector: "processLine:",
  63875. protocol: "private",
  63876. fn: function (buffer){
  63877. var self=this,$self=this;
  63878. var show;
  63879. return $core.withContext(function($ctx1) {
  63880. var $1,$2;
  63881. show=(function(varName,value){
  63882. return $core.withContext(function($ctx2) {
  63883. return $self._presentResultNamed_withValue_(varName,value);
  63884. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  63885. });
  63886. $1=$self._executeCommand_(buffer);
  63887. if(!$core.assert($1)){
  63888. $2=$self._isVariableDefined_(buffer);
  63889. if($core.assert($2)){
  63890. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  63891. } else {
  63892. $self._assignNewVariable_do_(buffer,show);
  63893. }
  63894. }
  63895. return self;
  63896. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  63897. },
  63898. args: ["buffer"],
  63899. 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]]",
  63900. referencedClasses: [],
  63901. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  63902. }),
  63903. $globals.Repl);
  63904. $core.addMethod(
  63905. $core.method({
  63906. selector: "prompt",
  63907. protocol: "accessing",
  63908. fn: function (){
  63909. var self=this,$self=this;
  63910. return "amber >> ";
  63911. },
  63912. args: [],
  63913. source: "prompt\x0a\x09^ 'amber >> '",
  63914. referencedClasses: [],
  63915. messageSends: []
  63916. }),
  63917. $globals.Repl);
  63918. $core.addMethod(
  63919. $core.method({
  63920. selector: "setPreviousVariablesFor:from:",
  63921. protocol: "private",
  63922. fn: function (newObject,oldObject){
  63923. var self=this,$self=this;
  63924. return $core.withContext(function($ctx1) {
  63925. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  63926. return $core.withContext(function($ctx2) {
  63927. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  63928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63929. }));
  63930. return self;
  63931. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  63932. },
  63933. args: ["newObject", "oldObject"],
  63934. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  63935. referencedClasses: [],
  63936. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  63937. }),
  63938. $globals.Repl);
  63939. $core.addMethod(
  63940. $core.method({
  63941. selector: "setPrompt",
  63942. protocol: "actions",
  63943. fn: function (){
  63944. var self=this,$self=this;
  63945. return $core.withContext(function($ctx1) {
  63946. $recv($self["@interface"])._setPrompt_($self._prompt());
  63947. return self;
  63948. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  63949. },
  63950. args: [],
  63951. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  63952. referencedClasses: [],
  63953. messageSends: ["setPrompt:", "prompt"]
  63954. }),
  63955. $globals.Repl);
  63956. $core.addMethod(
  63957. $core.method({
  63958. selector: "setupCommands",
  63959. protocol: "initialization",
  63960. fn: function (){
  63961. var self=this,$self=this;
  63962. return $core.withContext(function($ctx1) {
  63963. var $2,$1;
  63964. $2=$recv([":q"]).__minus_gt((function(){
  63965. return $core.withContext(function($ctx2) {
  63966. return $recv(process)._exit();
  63967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63968. }));
  63969. $ctx1.sendIdx["->"]=1;
  63970. $1=[$2,$recv([""]).__minus_gt((function(){
  63971. return $core.withContext(function($ctx2) {
  63972. return $recv($self["@interface"])._prompt();
  63973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63974. }))];
  63975. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  63976. return self;
  63977. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  63978. },
  63979. args: [],
  63980. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  63981. referencedClasses: ["Dictionary"],
  63982. messageSends: ["from:", "->", "exit", "prompt"]
  63983. }),
  63984. $globals.Repl);
  63985. $core.addMethod(
  63986. $core.method({
  63987. selector: "setupHotkeys",
  63988. protocol: "initialization",
  63989. fn: function (){
  63990. var self=this,$self=this;
  63991. return $core.withContext(function($ctx1) {
  63992. var $receiver;
  63993. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  63994. return $core.withContext(function($ctx2) {
  63995. if(($receiver = key) == null || $receiver.a$nil){
  63996. return key;
  63997. } else {
  63998. return $self._onKeyPress_(key);
  63999. }
  64000. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64001. }));
  64002. return self;
  64003. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64004. },
  64005. args: [],
  64006. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64007. referencedClasses: [],
  64008. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64009. }),
  64010. $globals.Repl);
  64011. $core.addMethod(
  64012. $core.method({
  64013. selector: "subclass:withVariable:",
  64014. protocol: "private",
  64015. fn: function (aClass,varName){
  64016. var self=this,$self=this;
  64017. return $core.withContext(function($ctx1) {
  64018. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64019. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64020. },
  64021. args: ["aClass", "varName"],
  64022. 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'",
  64023. referencedClasses: ["ClassBuilder"],
  64024. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64025. }),
  64026. $globals.Repl);
  64027. $core.addMethod(
  64028. $core.method({
  64029. selector: "subclassNameFor:",
  64030. protocol: "private",
  64031. fn: function (aClass){
  64032. var self=this,$self=this;
  64033. return $core.withContext(function($ctx1) {
  64034. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64035. $2=$recv(aClass)._name();
  64036. $ctx1.sendIdx["name"]=1;
  64037. $1=$recv($2)._matchesOf_("\x5cd+$");
  64038. $ctx1.sendIdx["matchesOf:"]=1;
  64039. if(($receiver = $1) == null || $receiver.a$nil){
  64040. return $recv($recv(aClass)._name()).__comma("2");
  64041. } else {
  64042. var counter;
  64043. $6=$recv(aClass)._name();
  64044. $ctx1.sendIdx["name"]=2;
  64045. $5=$recv($6)._matchesOf_("\x5cd+$");
  64046. $4=$recv($5)._first();
  64047. $3=$recv($4)._asNumber();
  64048. counter=$recv($3).__plus((1));
  64049. counter;
  64050. $7=$recv(aClass)._name();
  64051. $ctx1.sendIdx["name"]=3;
  64052. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64053. }
  64054. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64055. },
  64056. args: ["aClass"],
  64057. 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'].",
  64058. referencedClasses: [],
  64059. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64060. }),
  64061. $globals.Repl);
  64062. $core.addMethod(
  64063. $core.method({
  64064. selector: "main",
  64065. protocol: "initialization",
  64066. fn: function (){
  64067. var self=this,$self=this;
  64068. return $core.withContext(function($ctx1) {
  64069. $recv($self._new())._createInterface();
  64070. return self;
  64071. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64072. },
  64073. args: [],
  64074. source: "main\x0a\x09self new createInterface",
  64075. referencedClasses: [],
  64076. messageSends: ["createInterface", "new"]
  64077. }),
  64078. $globals.Repl.a$cls);
  64079. });
  64080. (function () {
  64081. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64082. amber.initialize().then(function () {
  64083. amber.globals.AmberCli._main();
  64084. });
  64085. });
  64086. }());
  64087. require(["app"]);
  64088. });
  64089. define.require('__wrap__');
  64090. }((function amdefine(module, requireFn) {
  64091. 'use strict';
  64092. var defineCache = {},
  64093. loaderCache = {},
  64094. alreadyCalled = false,
  64095. path = require('path'),
  64096. makeRequire, stringRequire;
  64097. /**
  64098. * Trims the . and .. from an array of path segments.
  64099. * It will keep a leading path segment if a .. will become
  64100. * the first path segment, to help with module name lookups,
  64101. * which act like paths, but can be remapped. But the end result,
  64102. * all paths that use this function should look normalized.
  64103. * NOTE: this method MODIFIES the input array.
  64104. * @param {Array} ary the array of path segments.
  64105. */
  64106. function trimDots(ary) {
  64107. var i, part;
  64108. for (i = 0; ary[i]; i+= 1) {
  64109. part = ary[i];
  64110. if (part === '.') {
  64111. ary.splice(i, 1);
  64112. i -= 1;
  64113. } else if (part === '..') {
  64114. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64115. //End of the line. Keep at least one non-dot
  64116. //path segment at the front so it can be mapped
  64117. //correctly to disk. Otherwise, there is likely
  64118. //no path mapping for a path starting with '..'.
  64119. //This can still fail, but catches the most reasonable
  64120. //uses of ..
  64121. break;
  64122. } else if (i > 0) {
  64123. ary.splice(i - 1, 2);
  64124. i -= 2;
  64125. }
  64126. }
  64127. }
  64128. }
  64129. function normalize(name, baseName) {
  64130. var baseParts;
  64131. //Adjust any relative paths.
  64132. if (name && name.charAt(0) === '.') {
  64133. //If have a base name, try to normalize against it,
  64134. //otherwise, assume it is a top-level require that will
  64135. //be relative to baseUrl in the end.
  64136. if (baseName) {
  64137. baseParts = baseName.split('/');
  64138. baseParts = baseParts.slice(0, baseParts.length - 1);
  64139. baseParts = baseParts.concat(name.split('/'));
  64140. trimDots(baseParts);
  64141. name = baseParts.join('/');
  64142. }
  64143. }
  64144. return name;
  64145. }
  64146. /**
  64147. * Create the normalize() function passed to a loader plugin's
  64148. * normalize method.
  64149. */
  64150. function makeNormalize(relName) {
  64151. return function (name) {
  64152. return normalize(name, relName);
  64153. };
  64154. }
  64155. function makeLoad(id) {
  64156. function load(value) {
  64157. loaderCache[id] = value;
  64158. }
  64159. load.fromText = function (id, text) {
  64160. //This one is difficult because the text can/probably uses
  64161. //define, and any relative paths and requires should be relative
  64162. //to that id was it would be found on disk. But this would require
  64163. //bootstrapping a module/require fairly deeply from node core.
  64164. //Not sure how best to go about that yet.
  64165. throw new Error('amdefine does not implement load.fromText');
  64166. };
  64167. return load;
  64168. }
  64169. makeRequire = function (systemRequire, exports, module, relId) {
  64170. function amdRequire(deps, callback) {
  64171. if (typeof deps === 'string') {
  64172. //Synchronous, single module require('')
  64173. return stringRequire(systemRequire, exports, module, deps, relId);
  64174. } else {
  64175. //Array of dependencies with a callback.
  64176. //Convert the dependencies to modules.
  64177. deps = deps.map(function (depName) {
  64178. return stringRequire(systemRequire, exports, module, depName, relId);
  64179. });
  64180. //Wait for next tick to call back the require call.
  64181. if (callback) {
  64182. process.nextTick(function () {
  64183. callback.apply(null, deps);
  64184. });
  64185. }
  64186. }
  64187. }
  64188. amdRequire.toUrl = function (filePath) {
  64189. if (filePath.indexOf('.') === 0) {
  64190. return normalize(filePath, path.dirname(module.filename));
  64191. } else {
  64192. return filePath;
  64193. }
  64194. };
  64195. return amdRequire;
  64196. };
  64197. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64198. requireFn = requireFn || function req() {
  64199. return module.require.apply(module, arguments);
  64200. };
  64201. function runFactory(id, deps, factory) {
  64202. var r, e, m, result;
  64203. if (id) {
  64204. e = loaderCache[id] = {};
  64205. m = {
  64206. id: id,
  64207. uri: __filename,
  64208. exports: e
  64209. };
  64210. r = makeRequire(requireFn, e, m, id);
  64211. } else {
  64212. //Only support one define call per file
  64213. if (alreadyCalled) {
  64214. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64215. }
  64216. alreadyCalled = true;
  64217. //Use the real variables from node
  64218. //Use module.exports for exports, since
  64219. //the exports in here is amdefine exports.
  64220. e = module.exports;
  64221. m = module;
  64222. r = makeRequire(requireFn, e, m, module.id);
  64223. }
  64224. //If there are dependencies, they are strings, so need
  64225. //to convert them to dependency values.
  64226. if (deps) {
  64227. deps = deps.map(function (depName) {
  64228. return r(depName);
  64229. });
  64230. }
  64231. //Call the factory with the right dependencies.
  64232. if (typeof factory === 'function') {
  64233. result = factory.apply(m.exports, deps);
  64234. } else {
  64235. result = factory;
  64236. }
  64237. if (result !== undefined) {
  64238. m.exports = result;
  64239. if (id) {
  64240. loaderCache[id] = m.exports;
  64241. }
  64242. }
  64243. }
  64244. stringRequire = function (systemRequire, exports, module, id, relId) {
  64245. //Split the ID by a ! so that
  64246. var index = id.indexOf('!'),
  64247. originalId = id,
  64248. prefix, plugin;
  64249. if (index === -1) {
  64250. id = normalize(id, relId);
  64251. //Straight module lookup. If it is one of the special dependencies,
  64252. //deal with it, otherwise, delegate to node.
  64253. if (id === 'require') {
  64254. return makeRequire(systemRequire, exports, module, relId);
  64255. } else if (id === 'exports') {
  64256. return exports;
  64257. } else if (id === 'module') {
  64258. return module;
  64259. } else if (loaderCache.hasOwnProperty(id)) {
  64260. return loaderCache[id];
  64261. } else if (defineCache[id]) {
  64262. runFactory.apply(null, defineCache[id]);
  64263. return loaderCache[id];
  64264. } else {
  64265. if(systemRequire) {
  64266. return systemRequire(originalId);
  64267. } else {
  64268. throw new Error('No module with ID: ' + id);
  64269. }
  64270. }
  64271. } else {
  64272. //There is a plugin in play.
  64273. prefix = id.substring(0, index);
  64274. id = id.substring(index + 1, id.length);
  64275. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64276. if (plugin.normalize) {
  64277. id = plugin.normalize(id, makeNormalize(relId));
  64278. } else {
  64279. //Normalize the ID normally.
  64280. id = normalize(id, relId);
  64281. }
  64282. if (loaderCache[id]) {
  64283. return loaderCache[id];
  64284. } else {
  64285. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64286. return loaderCache[id];
  64287. }
  64288. }
  64289. };
  64290. //Create a define function specific to the module asking for amdefine.
  64291. function define(id, deps, factory) {
  64292. if (Array.isArray(id)) {
  64293. factory = deps;
  64294. deps = id;
  64295. id = undefined;
  64296. } else if (typeof id !== 'string') {
  64297. factory = id;
  64298. id = deps = undefined;
  64299. }
  64300. if (deps && !Array.isArray(deps)) {
  64301. factory = deps;
  64302. deps = undefined;
  64303. }
  64304. if (!deps) {
  64305. deps = ['require', 'exports', 'module'];
  64306. }
  64307. //Set up properties for this module. If an ID, then use
  64308. //internal cache. If no ID, then use the external variables
  64309. //for this node module.
  64310. if (id) {
  64311. //Put the module in deep freeze until there is a
  64312. //require call for it.
  64313. defineCache[id] = [id, deps, factory];
  64314. } else {
  64315. runFactory(id, deps, factory);
  64316. }
  64317. }
  64318. //define.require, which has access to all the values in the
  64319. //cache. Useful for AMD modules that all have IDs in the file,
  64320. //but need to finally export a value to node based on one of those
  64321. //IDs.
  64322. define.require = function (id) {
  64323. if (loaderCache[id]) {
  64324. return loaderCache[id];
  64325. }
  64326. if (defineCache[id]) {
  64327. runFactory.apply(null, defineCache[id]);
  64328. return loaderCache[id];
  64329. }
  64330. };
  64331. define.amd = {};
  64332. return define;
  64333. }(module)), require));