amber-cli.js 2.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708
  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 v4.2.4+314e4831
  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. var type = typeof x;
  21. return x !== null && (type === 'object' || type === 'function');
  22. }
  23. function isFunction(x) {
  24. return typeof x === 'function';
  25. }
  26. var _isArray = void 0;
  27. if (Array.isArray) {
  28. _isArray = Array.isArray;
  29. } else {
  30. _isArray = function (x) {
  31. return Object.prototype.toString.call(x) === '[object Array]';
  32. };
  33. }
  34. var isArray = _isArray;
  35. var len = 0;
  36. var vertxNext = void 0;
  37. var customSchedulerFn = void 0;
  38. var asap = function asap(callback, arg) {
  39. queue[len] = callback;
  40. queue[len + 1] = arg;
  41. len += 2;
  42. if (len === 2) {
  43. // If len is 2, that means that we need to schedule an async flush.
  44. // If additional callbacks are queued before the queue is flushed, they
  45. // will be processed by this flush that we are scheduling.
  46. if (customSchedulerFn) {
  47. customSchedulerFn(flush);
  48. } else {
  49. scheduleFlush();
  50. }
  51. }
  52. };
  53. function setScheduler(scheduleFn) {
  54. customSchedulerFn = scheduleFn;
  55. }
  56. function setAsap(asapFn) {
  57. asap = asapFn;
  58. }
  59. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  60. var browserGlobal = browserWindow || {};
  61. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  62. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  63. // test for web worker but not in IE10
  64. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  65. // node
  66. function useNextTick() {
  67. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  68. // see https://github.com/cujojs/when/issues/410 for details
  69. return function () {
  70. return process.nextTick(flush);
  71. };
  72. }
  73. // vertx
  74. function useVertxTimer() {
  75. if (typeof vertxNext !== 'undefined') {
  76. return function () {
  77. vertxNext(flush);
  78. };
  79. }
  80. return useSetTimeout();
  81. }
  82. function useMutationObserver() {
  83. var iterations = 0;
  84. var observer = new BrowserMutationObserver(flush);
  85. var node = document.createTextNode('');
  86. observer.observe(node, { characterData: true });
  87. return function () {
  88. node.data = iterations = ++iterations % 2;
  89. };
  90. }
  91. // web worker
  92. function useMessageChannel() {
  93. var channel = new MessageChannel();
  94. channel.port1.onmessage = flush;
  95. return function () {
  96. return channel.port2.postMessage(0);
  97. };
  98. }
  99. function useSetTimeout() {
  100. // Store setTimeout reference so es6-promise will be unaffected by
  101. // other code modifying setTimeout (like sinon.useFakeTimers())
  102. var globalSetTimeout = setTimeout;
  103. return function () {
  104. return globalSetTimeout(flush, 1);
  105. };
  106. }
  107. var queue = new Array(1000);
  108. function flush() {
  109. for (var i = 0; i < len; i += 2) {
  110. var callback = queue[i];
  111. var arg = queue[i + 1];
  112. callback(arg);
  113. queue[i] = undefined;
  114. queue[i + 1] = undefined;
  115. }
  116. len = 0;
  117. }
  118. function attemptVertx() {
  119. try {
  120. var vertx = Function('return this')().require('vertx');
  121. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  122. return useVertxTimer();
  123. } catch (e) {
  124. return useSetTimeout();
  125. }
  126. }
  127. var scheduleFlush = void 0;
  128. // Decide what async method to use to triggering processing of queued callbacks:
  129. if (isNode) {
  130. scheduleFlush = useNextTick();
  131. } else if (BrowserMutationObserver) {
  132. scheduleFlush = useMutationObserver();
  133. } else if (isWorker) {
  134. scheduleFlush = useMessageChannel();
  135. } else if (browserWindow === undefined && typeof require === 'function') {
  136. scheduleFlush = attemptVertx();
  137. } else {
  138. scheduleFlush = useSetTimeout();
  139. }
  140. function then(onFulfillment, onRejection) {
  141. var parent = this;
  142. var child = new this.constructor(noop);
  143. if (child[PROMISE_ID] === undefined) {
  144. makePromise(child);
  145. }
  146. var _state = parent._state;
  147. if (_state) {
  148. var callback = arguments[_state - 1];
  149. asap(function () {
  150. return invokeCallback(_state, child, callback, parent._result);
  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$1(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(2);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var TRY_CATCH_ERROR = { error: null };
  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. TRY_CATCH_ERROR.error = error;
  209. return TRY_CATCH_ERROR;
  210. }
  211. }
  212. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then$$1) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then$$1, 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$$1) {
  259. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$1 === TRY_CATCH_ERROR) {
  263. reject(promise, TRY_CATCH_ERROR.error);
  264. TRY_CATCH_ERROR.error = null;
  265. } else if (then$$1 === undefined) {
  266. fulfill(promise, maybeThenable);
  267. } else if (isFunction(then$$1)) {
  268. handleForeignThenable(promise, maybeThenable, then$$1);
  269. } else {
  270. fulfill(promise, maybeThenable);
  271. }
  272. }
  273. }
  274. function resolve(promise, value) {
  275. if (promise === value) {
  276. reject(promise, selfFulfillment());
  277. } else if (objectOrFunction(value)) {
  278. handleMaybeThenable(promise, value, getThen(value));
  279. } else {
  280. fulfill(promise, value);
  281. }
  282. }
  283. function publishRejection(promise) {
  284. if (promise._onerror) {
  285. promise._onerror(promise._result);
  286. }
  287. publish(promise);
  288. }
  289. function fulfill(promise, value) {
  290. if (promise._state !== PENDING) {
  291. return;
  292. }
  293. promise._result = value;
  294. promise._state = FULFILLED;
  295. if (promise._subscribers.length !== 0) {
  296. asap(publish, promise);
  297. }
  298. }
  299. function reject(promise, reason) {
  300. if (promise._state !== PENDING) {
  301. return;
  302. }
  303. promise._state = REJECTED;
  304. promise._result = reason;
  305. asap(publishRejection, promise);
  306. }
  307. function subscribe(parent, child, onFulfillment, onRejection) {
  308. var _subscribers = parent._subscribers;
  309. var length = _subscribers.length;
  310. parent._onerror = null;
  311. _subscribers[length] = child;
  312. _subscribers[length + FULFILLED] = onFulfillment;
  313. _subscribers[length + REJECTED] = onRejection;
  314. if (length === 0 && parent._state) {
  315. asap(publish, parent);
  316. }
  317. }
  318. function publish(promise) {
  319. var subscribers = promise._subscribers;
  320. var settled = promise._state;
  321. if (subscribers.length === 0) {
  322. return;
  323. }
  324. var child = void 0,
  325. callback = void 0,
  326. detail = promise._result;
  327. for (var i = 0; i < subscribers.length; i += 3) {
  328. child = subscribers[i];
  329. callback = subscribers[i + settled];
  330. if (child) {
  331. invokeCallback(settled, child, callback, detail);
  332. } else {
  333. callback(detail);
  334. }
  335. }
  336. promise._subscribers.length = 0;
  337. }
  338. function tryCatch(callback, detail) {
  339. try {
  340. return callback(detail);
  341. } catch (e) {
  342. TRY_CATCH_ERROR.error = e;
  343. return TRY_CATCH_ERROR;
  344. }
  345. }
  346. function invokeCallback(settled, promise, callback, detail) {
  347. var hasCallback = isFunction(callback),
  348. value = void 0,
  349. error = void 0,
  350. succeeded = void 0,
  351. failed = void 0;
  352. if (hasCallback) {
  353. value = tryCatch(callback, detail);
  354. if (value === TRY_CATCH_ERROR) {
  355. failed = true;
  356. error = value.error;
  357. value.error = null;
  358. } else {
  359. succeeded = true;
  360. }
  361. if (promise === value) {
  362. reject(promise, cannotReturnOwn());
  363. return;
  364. }
  365. } else {
  366. value = detail;
  367. succeeded = true;
  368. }
  369. if (promise._state !== PENDING) {
  370. // noop
  371. } else if (hasCallback && succeeded) {
  372. resolve(promise, value);
  373. } else if (failed) {
  374. reject(promise, error);
  375. } else if (settled === FULFILLED) {
  376. fulfill(promise, value);
  377. } else if (settled === REJECTED) {
  378. reject(promise, value);
  379. }
  380. }
  381. function initializePromise(promise, resolver) {
  382. try {
  383. resolver(function resolvePromise(value) {
  384. resolve(promise, value);
  385. }, function rejectPromise(reason) {
  386. reject(promise, reason);
  387. });
  388. } catch (e) {
  389. reject(promise, e);
  390. }
  391. }
  392. var id = 0;
  393. function nextId() {
  394. return id++;
  395. }
  396. function makePromise(promise) {
  397. promise[PROMISE_ID] = id++;
  398. promise._state = undefined;
  399. promise._result = undefined;
  400. promise._subscribers = [];
  401. }
  402. function validationError() {
  403. return new Error('Array Methods must be provided an Array');
  404. }
  405. var Enumerator = function () {
  406. function Enumerator(Constructor, input) {
  407. this._instanceConstructor = Constructor;
  408. this.promise = new Constructor(noop);
  409. if (!this.promise[PROMISE_ID]) {
  410. makePromise(this.promise);
  411. }
  412. if (isArray(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(input);
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. reject(this.promise, validationError());
  427. }
  428. }
  429. Enumerator.prototype._enumerate = function _enumerate(input) {
  430. for (var i = 0; this._state === PENDING && i < input.length; i++) {
  431. this._eachEntry(input[i], i);
  432. }
  433. };
  434. Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
  435. var c = this._instanceConstructor;
  436. var resolve$$1 = c.resolve;
  437. if (resolve$$1 === resolve$1) {
  438. var _then = getThen(entry);
  439. if (_then === then && entry._state !== PENDING) {
  440. this._settledAt(entry._state, i, entry._result);
  441. } else if (typeof _then !== 'function') {
  442. this._remaining--;
  443. this._result[i] = entry;
  444. } else if (c === Promise$1) {
  445. var promise = new c(noop);
  446. handleMaybeThenable(promise, entry, _then);
  447. this._willSettleAt(promise, i);
  448. } else {
  449. this._willSettleAt(new c(function (resolve$$1) {
  450. return resolve$$1(entry);
  451. }), i);
  452. }
  453. } else {
  454. this._willSettleAt(resolve$$1(entry), i);
  455. }
  456. };
  457. Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
  458. var promise = this.promise;
  459. if (promise._state === PENDING) {
  460. this._remaining--;
  461. if (state === REJECTED) {
  462. reject(promise, value);
  463. } else {
  464. this._result[i] = value;
  465. }
  466. }
  467. if (this._remaining === 0) {
  468. fulfill(promise, this._result);
  469. }
  470. };
  471. Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
  472. var enumerator = this;
  473. subscribe(promise, undefined, function (value) {
  474. return enumerator._settledAt(FULFILLED, i, value);
  475. }, function (reason) {
  476. return enumerator._settledAt(REJECTED, i, reason);
  477. });
  478. };
  479. return Enumerator;
  480. }();
  481. /**
  482. `Promise.all` accepts an array of promises, and returns a new promise which
  483. is fulfilled with an array of fulfillment values for the passed promises, or
  484. rejected with the reason of the first passed promise to be rejected. It casts all
  485. elements of the passed iterable to promises as it runs this algorithm.
  486. Example:
  487. ```javascript
  488. let promise1 = resolve(1);
  489. let promise2 = resolve(2);
  490. let promise3 = resolve(3);
  491. let promises = [ promise1, promise2, promise3 ];
  492. Promise.all(promises).then(function(array){
  493. // The array here would be [ 1, 2, 3 ];
  494. });
  495. ```
  496. If any of the `promises` given to `all` are rejected, the first promise
  497. that is rejected will be given as an argument to the returned promises's
  498. rejection handler. For example:
  499. Example:
  500. ```javascript
  501. let promise1 = resolve(1);
  502. let promise2 = reject(new Error("2"));
  503. let promise3 = reject(new Error("3"));
  504. let promises = [ promise1, promise2, promise3 ];
  505. Promise.all(promises).then(function(array){
  506. // Code here never runs because there are rejected promises!
  507. }, function(error) {
  508. // error.message === "2"
  509. });
  510. ```
  511. @method all
  512. @static
  513. @param {Array} entries array of promises
  514. @param {String} label optional string for labeling the promise.
  515. Useful for tooling.
  516. @return {Promise} promise that is fulfilled when all `promises` have been
  517. fulfilled, or rejected if any of them become rejected.
  518. @static
  519. */
  520. function all(entries) {
  521. return new Enumerator(this, entries).promise;
  522. }
  523. /**
  524. `Promise.race` returns a new promise which is settled in the same way as the
  525. first passed promise to settle.
  526. Example:
  527. ```javascript
  528. let promise1 = new Promise(function(resolve, reject){
  529. setTimeout(function(){
  530. resolve('promise 1');
  531. }, 200);
  532. });
  533. let promise2 = new Promise(function(resolve, reject){
  534. setTimeout(function(){
  535. resolve('promise 2');
  536. }, 100);
  537. });
  538. Promise.race([promise1, promise2]).then(function(result){
  539. // result === 'promise 2' because it was resolved before promise1
  540. // was resolved.
  541. });
  542. ```
  543. `Promise.race` is deterministic in that only the state of the first
  544. settled promise matters. For example, even if other promises given to the
  545. `promises` array argument are resolved, but the first settled promise has
  546. become rejected before the other promises became fulfilled, the returned
  547. promise will become rejected:
  548. ```javascript
  549. let promise1 = new Promise(function(resolve, reject){
  550. setTimeout(function(){
  551. resolve('promise 1');
  552. }, 200);
  553. });
  554. let promise2 = new Promise(function(resolve, reject){
  555. setTimeout(function(){
  556. reject(new Error('promise 2'));
  557. }, 100);
  558. });
  559. Promise.race([promise1, promise2]).then(function(result){
  560. // Code here never runs
  561. }, function(reason){
  562. // reason.message === 'promise 2' because promise 2 became rejected before
  563. // promise 1 became fulfilled
  564. });
  565. ```
  566. An example real-world use case is implementing timeouts:
  567. ```javascript
  568. Promise.race([ajax('foo.json'), timeout(5000)])
  569. ```
  570. @method race
  571. @static
  572. @param {Array} promises array of promises to observe
  573. Useful for tooling.
  574. @return {Promise} a promise which settles in the same way as the first passed
  575. promise to settle.
  576. */
  577. function race(entries) {
  578. /*jshint validthis:true */
  579. var Constructor = this;
  580. if (!isArray(entries)) {
  581. return new Constructor(function (_, reject) {
  582. return reject(new TypeError('You must pass an array to race.'));
  583. });
  584. } else {
  585. return new Constructor(function (resolve, reject) {
  586. var length = entries.length;
  587. for (var i = 0; i < length; i++) {
  588. Constructor.resolve(entries[i]).then(resolve, reject);
  589. }
  590. });
  591. }
  592. }
  593. /**
  594. `Promise.reject` returns a promise rejected with the passed `reason`.
  595. It is shorthand for the following:
  596. ```javascript
  597. let promise = new Promise(function(resolve, reject){
  598. reject(new Error('WHOOPS'));
  599. });
  600. promise.then(function(value){
  601. // Code here doesn't run because the promise is rejected!
  602. }, function(reason){
  603. // reason.message === 'WHOOPS'
  604. });
  605. ```
  606. Instead of writing the above, your code now simply becomes the following:
  607. ```javascript
  608. let promise = Promise.reject(new Error('WHOOPS'));
  609. promise.then(function(value){
  610. // Code here doesn't run because the promise is rejected!
  611. }, function(reason){
  612. // reason.message === 'WHOOPS'
  613. });
  614. ```
  615. @method reject
  616. @static
  617. @param {Any} reason value that the returned promise will be rejected with.
  618. Useful for tooling.
  619. @return {Promise} a promise rejected with the given `reason`.
  620. */
  621. function reject$1(reason) {
  622. /*jshint validthis:true */
  623. var Constructor = this;
  624. var promise = new Constructor(noop);
  625. reject(promise, reason);
  626. return promise;
  627. }
  628. function needsResolver() {
  629. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  630. }
  631. function needsNew() {
  632. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  633. }
  634. /**
  635. Promise objects represent the eventual result of an asynchronous operation. The
  636. primary way of interacting with a promise is through its `then` method, which
  637. registers callbacks to receive either a promise's eventual value or the reason
  638. why the promise cannot be fulfilled.
  639. Terminology
  640. -----------
  641. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  642. - `thenable` is an object or function that defines a `then` method.
  643. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  644. - `exception` is a value that is thrown using the throw statement.
  645. - `reason` is a value that indicates why a promise was rejected.
  646. - `settled` the final resting state of a promise, fulfilled or rejected.
  647. A promise can be in one of three states: pending, fulfilled, or rejected.
  648. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  649. state. Promises that are rejected have a rejection reason and are in the
  650. rejected state. A fulfillment value is never a thenable.
  651. Promises can also be said to *resolve* a value. If this value is also a
  652. promise, then the original promise's settled state will match the value's
  653. settled state. So a promise that *resolves* a promise that rejects will
  654. itself reject, and a promise that *resolves* a promise that fulfills will
  655. itself fulfill.
  656. Basic Usage:
  657. ------------
  658. ```js
  659. let promise = new Promise(function(resolve, reject) {
  660. // on success
  661. resolve(value);
  662. // on failure
  663. reject(reason);
  664. });
  665. promise.then(function(value) {
  666. // on fulfillment
  667. }, function(reason) {
  668. // on rejection
  669. });
  670. ```
  671. Advanced Usage:
  672. ---------------
  673. Promises shine when abstracting away asynchronous interactions such as
  674. `XMLHttpRequest`s.
  675. ```js
  676. function getJSON(url) {
  677. return new Promise(function(resolve, reject){
  678. let xhr = new XMLHttpRequest();
  679. xhr.open('GET', url);
  680. xhr.onreadystatechange = handler;
  681. xhr.responseType = 'json';
  682. xhr.setRequestHeader('Accept', 'application/json');
  683. xhr.send();
  684. function handler() {
  685. if (this.readyState === this.DONE) {
  686. if (this.status === 200) {
  687. resolve(this.response);
  688. } else {
  689. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  690. }
  691. }
  692. };
  693. });
  694. }
  695. getJSON('/posts.json').then(function(json) {
  696. // on fulfillment
  697. }, function(reason) {
  698. // on rejection
  699. });
  700. ```
  701. Unlike callbacks, promises are great composable primitives.
  702. ```js
  703. Promise.all([
  704. getJSON('/posts'),
  705. getJSON('/comments')
  706. ]).then(function(values){
  707. values[0] // => postsJSON
  708. values[1] // => commentsJSON
  709. return values;
  710. });
  711. ```
  712. @class Promise
  713. @param {Function} resolver
  714. Useful for tooling.
  715. @constructor
  716. */
  717. var Promise$1 = function () {
  718. function Promise(resolver) {
  719. this[PROMISE_ID] = nextId();
  720. this._result = this._state = undefined;
  721. this._subscribers = [];
  722. if (noop !== resolver) {
  723. typeof resolver !== 'function' && needsResolver();
  724. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  725. }
  726. }
  727. /**
  728. The primary way of interacting with a promise is through its `then` method,
  729. which registers callbacks to receive either a promise's eventual value or the
  730. reason why the promise cannot be fulfilled.
  731. ```js
  732. findUser().then(function(user){
  733. // user is available
  734. }, function(reason){
  735. // user is unavailable, and you are given the reason why
  736. });
  737. ```
  738. Chaining
  739. --------
  740. The return value of `then` is itself a promise. This second, 'downstream'
  741. promise is resolved with the return value of the first promise's fulfillment
  742. or rejection handler, or rejected if the handler throws an exception.
  743. ```js
  744. findUser().then(function (user) {
  745. return user.name;
  746. }, function (reason) {
  747. return 'default name';
  748. }).then(function (userName) {
  749. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  750. // will be `'default name'`
  751. });
  752. findUser().then(function (user) {
  753. throw new Error('Found user, but still unhappy');
  754. }, function (reason) {
  755. throw new Error('`findUser` rejected and we're unhappy');
  756. }).then(function (value) {
  757. // never reached
  758. }, function (reason) {
  759. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  760. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  761. });
  762. ```
  763. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  764. ```js
  765. findUser().then(function (user) {
  766. throw new PedagogicalException('Upstream error');
  767. }).then(function (value) {
  768. // never reached
  769. }).then(function (value) {
  770. // never reached
  771. }, function (reason) {
  772. // The `PedgagocialException` is propagated all the way down to here
  773. });
  774. ```
  775. Assimilation
  776. ------------
  777. Sometimes the value you want to propagate to a downstream promise can only be
  778. retrieved asynchronously. This can be achieved by returning a promise in the
  779. fulfillment or rejection handler. The downstream promise will then be pending
  780. until the returned promise is settled. This is called *assimilation*.
  781. ```js
  782. findUser().then(function (user) {
  783. return findCommentsByAuthor(user);
  784. }).then(function (comments) {
  785. // The user's comments are now available
  786. });
  787. ```
  788. If the assimliated promise rejects, then the downstream promise will also reject.
  789. ```js
  790. findUser().then(function (user) {
  791. return findCommentsByAuthor(user);
  792. }).then(function (comments) {
  793. // If `findCommentsByAuthor` fulfills, we'll have the value here
  794. }, function (reason) {
  795. // If `findCommentsByAuthor` rejects, we'll have the reason here
  796. });
  797. ```
  798. Simple Example
  799. --------------
  800. Synchronous Example
  801. ```javascript
  802. let result;
  803. try {
  804. result = findResult();
  805. // success
  806. } catch(reason) {
  807. // failure
  808. }
  809. ```
  810. Errback Example
  811. ```js
  812. findResult(function(result, err){
  813. if (err) {
  814. // failure
  815. } else {
  816. // success
  817. }
  818. });
  819. ```
  820. Promise Example;
  821. ```javascript
  822. findResult().then(function(result){
  823. // success
  824. }, function(reason){
  825. // failure
  826. });
  827. ```
  828. Advanced Example
  829. --------------
  830. Synchronous Example
  831. ```javascript
  832. let author, books;
  833. try {
  834. author = findAuthor();
  835. books = findBooksByAuthor(author);
  836. // success
  837. } catch(reason) {
  838. // failure
  839. }
  840. ```
  841. Errback Example
  842. ```js
  843. function foundBooks(books) {
  844. }
  845. function failure(reason) {
  846. }
  847. findAuthor(function(author, err){
  848. if (err) {
  849. failure(err);
  850. // failure
  851. } else {
  852. try {
  853. findBoooksByAuthor(author, function(books, err) {
  854. if (err) {
  855. failure(err);
  856. } else {
  857. try {
  858. foundBooks(books);
  859. } catch(reason) {
  860. failure(reason);
  861. }
  862. }
  863. });
  864. } catch(error) {
  865. failure(err);
  866. }
  867. // success
  868. }
  869. });
  870. ```
  871. Promise Example;
  872. ```javascript
  873. findAuthor().
  874. then(findBooksByAuthor).
  875. then(function(books){
  876. // found books
  877. }).catch(function(reason){
  878. // something went wrong
  879. });
  880. ```
  881. @method then
  882. @param {Function} onFulfilled
  883. @param {Function} onRejected
  884. Useful for tooling.
  885. @return {Promise}
  886. */
  887. /**
  888. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  889. as the catch block of a try/catch statement.
  890. ```js
  891. function findAuthor(){
  892. throw new Error('couldn't find that author');
  893. }
  894. // synchronous
  895. try {
  896. findAuthor();
  897. } catch(reason) {
  898. // something went wrong
  899. }
  900. // async with promises
  901. findAuthor().catch(function(reason){
  902. // something went wrong
  903. });
  904. ```
  905. @method catch
  906. @param {Function} onRejection
  907. Useful for tooling.
  908. @return {Promise}
  909. */
  910. Promise.prototype.catch = function _catch(onRejection) {
  911. return this.then(null, onRejection);
  912. };
  913. /**
  914. `finally` will be invoked regardless of the promise's fate just as native
  915. try/catch/finally behaves
  916. Synchronous example:
  917. ```js
  918. findAuthor() {
  919. if (Math.random() > 0.5) {
  920. throw new Error();
  921. }
  922. return new Author();
  923. }
  924. try {
  925. return findAuthor(); // succeed or fail
  926. } catch(error) {
  927. return findOtherAuther();
  928. } finally {
  929. // always runs
  930. // doesn't affect the return value
  931. }
  932. ```
  933. Asynchronous example:
  934. ```js
  935. findAuthor().catch(function(reason){
  936. return findOtherAuther();
  937. }).finally(function(){
  938. // author was either found, or not
  939. });
  940. ```
  941. @method finally
  942. @param {Function} callback
  943. @return {Promise}
  944. */
  945. Promise.prototype.finally = function _finally(callback) {
  946. var promise = this;
  947. var constructor = promise.constructor;
  948. return promise.then(function (value) {
  949. return constructor.resolve(callback()).then(function () {
  950. return value;
  951. });
  952. }, function (reason) {
  953. return constructor.resolve(callback()).then(function () {
  954. throw reason;
  955. });
  956. });
  957. };
  958. return Promise;
  959. }();
  960. Promise$1.prototype.then = then;
  961. Promise$1.all = all;
  962. Promise$1.race = race;
  963. Promise$1.resolve = resolve$1;
  964. Promise$1.reject = reject$1;
  965. Promise$1._setScheduler = setScheduler;
  966. Promise$1._setAsap = setAsap;
  967. Promise$1._asap = asap;
  968. /*global self*/
  969. function polyfill() {
  970. var local = void 0;
  971. if (typeof global !== 'undefined') {
  972. local = global;
  973. } else if (typeof self !== 'undefined') {
  974. local = self;
  975. } else {
  976. try {
  977. local = Function('return this')();
  978. } catch (e) {
  979. throw new Error('polyfill failed because global object is unavailable in this environment');
  980. }
  981. }
  982. var P = local.Promise;
  983. if (P) {
  984. var promiseToString = null;
  985. try {
  986. promiseToString = Object.prototype.toString.call(P.resolve());
  987. } catch (e) {
  988. // silently ignored
  989. }
  990. if (promiseToString === '[object Promise]' && !P.cast) {
  991. return;
  992. }
  993. }
  994. local.Promise = Promise$1;
  995. }
  996. // Strange compat..
  997. Promise$1.polyfill = polyfill;
  998. Promise$1.Promise = Promise$1;
  999. return Promise$1;
  1000. })));
  1001. //# sourceMappingURL=es6-promise.map
  1002. ;
  1003. (function () {
  1004. define('app',["require", "amber/es6-promise"], function (require, promiseLib) {
  1005. promiseLib.polyfill();
  1006. return new Promise(function (resolve, reject) {
  1007. require(["__app__"], resolve, reject);
  1008. });
  1009. });
  1010. }());
  1011. //jshint eqnull:true
  1012. define('amber/kernel-runtime',[],function () {
  1013. "use strict";
  1014. function defineMethod (klass, name, method) {
  1015. Object.defineProperty(klass.prototype, name, {
  1016. value: method,
  1017. enumerable: false, configurable: true, writable: true
  1018. });
  1019. }
  1020. function installJSMethod (obj, jsSelector, fn) {
  1021. Object.defineProperty(obj, jsSelector, {
  1022. value: fn,
  1023. enumerable: false, configurable: true, writable: true
  1024. });
  1025. }
  1026. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  1027. function RuntimeSelectorsBrik (brikz, st) {
  1028. var selectors = brikz.selectors.selectors;
  1029. var globals = brikz.smalltalkGlobals.globals;
  1030. var nilAsClass = brikz.classes.nilAsClass;
  1031. var st2js = brikz.selectorConversion.st2js;
  1032. var jsSelectors = this.jsSelectors = [];
  1033. /* Method not implemented handlers */
  1034. function installNewSelectors (newSelectors, targetClasses) {
  1035. newSelectors.forEach(function (selector) {
  1036. var jsSelector = st2js(selector);
  1037. jsSelectors.push(jsSelector);
  1038. var fn = createDnuHandler(selector);
  1039. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  1040. targetClasses.forEach(function (target) {
  1041. installJSMethod(target.fn.prototype, jsSelector, fn);
  1042. });
  1043. });
  1044. }
  1045. this.installNewSelectors = installNewSelectors;
  1046. /* Dnu handler method */
  1047. function createDnuHandler (stSelector) {
  1048. return function () {
  1049. return globals.Message._selector_arguments_notUnderstoodBy_(
  1050. stSelector, [].slice.call(arguments), this
  1051. );
  1052. };
  1053. }
  1054. installNewSelectors(selectors, []);
  1055. }
  1056. RuntimeClassesBrik.deps = ["event", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1057. function RuntimeClassesBrik (brikz, st) {
  1058. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1059. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1060. var installMethod = brikz.runtimeMethods.installMethod;
  1061. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1062. var wireKlass = brikz.classes.wireKlass;
  1063. var emit = brikz.event.emit;
  1064. var detachedRootClasses = [];
  1065. function markClassDetachedRoot (klass) {
  1066. klass.detachedRoot = true;
  1067. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1068. return klass.detachedRoot;
  1069. });
  1070. }
  1071. emit.selectorsAdded = function (newSelectors) {
  1072. installNewSelectors(newSelectors, detachedRootClasses);
  1073. };
  1074. /* Initialize a class in its class hierarchy. Handle both classes and
  1075. metaclasses. */
  1076. function initClassAndMetaclass (klass) {
  1077. initClass(klass);
  1078. if (klass.a$cls && !klass.meta) {
  1079. initClass(klass.a$cls);
  1080. }
  1081. }
  1082. traitsOrClasses.forEach(function (traitOrClass) {
  1083. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1084. });
  1085. emit.classAdded = function (klass) {
  1086. initClassAndMetaclass(klass);
  1087. klass._enterOrganization();
  1088. };
  1089. emit.traitAdded = function (trait) {
  1090. trait._enterOrganization();
  1091. };
  1092. emit.classRemoved = function (klass) {
  1093. klass._leaveOrganization();
  1094. };
  1095. emit.traitRemoved = function (trait) {
  1096. trait._leaveOrganization();
  1097. };
  1098. function initClass (klass) {
  1099. wireKlass(klass);
  1100. if (klass.detachedRoot) {
  1101. copySuperclass(klass);
  1102. }
  1103. installMethods(klass);
  1104. }
  1105. function copySuperclass (klass) {
  1106. var myproto = klass.fn.prototype,
  1107. superproto = klass.superclass.fn.prototype;
  1108. jsSelectors.forEach(function (jsSelector) {
  1109. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1110. });
  1111. }
  1112. function installMethods (klass) {
  1113. var methods = klass.methods;
  1114. Object.keys(methods).forEach(function (selector) {
  1115. installMethod(methods[selector], klass);
  1116. });
  1117. }
  1118. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1119. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1120. markClassDetachedRoot(klass);
  1121. klass.fn = constructor;
  1122. initClass(klass);
  1123. };
  1124. }
  1125. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1126. function FrameBindingBrik (brikz, st) {
  1127. var globals = brikz.smalltalkGlobals.globals;
  1128. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1129. setClassConstructor(globals.Number, Number);
  1130. setClassConstructor(globals.BlockClosure, Function);
  1131. setClassConstructor(globals.Boolean, Boolean);
  1132. setClassConstructor(globals.Date, Date);
  1133. setClassConstructor(globals.String, String);
  1134. setClassConstructor(globals.Array, Array);
  1135. setClassConstructor(globals.RegularExpression, RegExp);
  1136. setClassConstructor(globals.Error, Error);
  1137. setClassConstructor(globals.Promise, Promise);
  1138. this.__init__ = function () {
  1139. st.alias(globals.Array, "OrderedCollection");
  1140. st.alias(globals.Date, "Time");
  1141. }
  1142. }
  1143. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1144. function RuntimeMethodsBrik (brikz, st) {
  1145. var st2js = brikz.selectorConversion.st2js;
  1146. var emit = brikz.event.emit;
  1147. function installMethod (method, klass) {
  1148. var jsSelector = method.jsSelector;
  1149. if (!jsSelector) {
  1150. jsSelector = method.jsSelector = st2js(method.selector);
  1151. }
  1152. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1153. }
  1154. this.installMethod = installMethod;
  1155. emit.behaviorMethodAdded = function (method, klass) {
  1156. installMethod(method, klass);
  1157. propagateMethodChange(klass, method, klass);
  1158. };
  1159. emit.behaviorMethodRemoved = function (method, klass) {
  1160. delete klass.fn.prototype[method.jsSelector];
  1161. propagateMethodChange(klass, method, null);
  1162. };
  1163. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1164. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1165. };
  1166. function propagateMethodChange (klass, method, exclude) {
  1167. var selector = method.selector;
  1168. var jsSelector = method.jsSelector;
  1169. st.traverseClassTree(klass, function (subclass, sentinel) {
  1170. if (subclass === exclude) return;
  1171. if (subclass.methods[selector]) return sentinel;
  1172. if (subclass.detachedRoot) {
  1173. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1174. }
  1175. });
  1176. }
  1177. }
  1178. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1179. function PrimitivesBrik (brikz, st) {
  1180. var globals = brikz.smalltalkGlobals.globals;
  1181. /* Converts a JavaScript object to valid Smalltalk Object */
  1182. st.readJSObject = function (js) {
  1183. if (js == null) return null;
  1184. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1185. else if (js.constructor !== Object) return js;
  1186. var pairs = [];
  1187. for (var i in js) {
  1188. pairs.push(i, st.readJSObject(js[i]));
  1189. }
  1190. return globals.Dictionary._newFromPairs_(pairs);
  1191. };
  1192. /* Boolean assertion */
  1193. st.assert = function (shouldBeBoolean) {
  1194. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1195. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1196. shouldBeBoolean = shouldBeBoolean.valueOf();
  1197. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1198. }
  1199. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1200. };
  1201. }
  1202. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1203. function RuntimeBrik (brikz, st) {
  1204. var globals = brikz.smalltalkGlobals.globals;
  1205. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1206. function SmalltalkMethodContext (home, setup) {
  1207. // TODO lazy fill of .sendIdx
  1208. this.sendIdx = {};
  1209. // TODO very likely .senderContext, not .homeContext here
  1210. this.homeContext = home;
  1211. this.setup = setup;
  1212. }
  1213. // Fallbacks
  1214. SmalltalkMethodContext.prototype.supercall = false;
  1215. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1216. SmalltalkMethodContext.prototype.receiver = null;
  1217. SmalltalkMethodContext.prototype.selector = null;
  1218. SmalltalkMethodContext.prototype.lookupClass = null;
  1219. SmalltalkMethodContext.prototype.outerContext = null;
  1220. SmalltalkMethodContext.prototype.index = 0;
  1221. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1222. this.receiver = receiver;
  1223. this.selector = selector;
  1224. if (locals != null) this.locals = locals;
  1225. this.lookupClass = lookupClass;
  1226. if (this.homeContext) {
  1227. this.homeContext.evaluatedSelector = selector;
  1228. }
  1229. });
  1230. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1231. if (locals != null) this.locals = locals;
  1232. this.outerContext = ctx;
  1233. if (index) this.index = index;
  1234. });
  1235. defineMethod(SmalltalkMethodContext, "method", function () {
  1236. var method;
  1237. var lookup = this.lookupClass || this.receiver.a$cls;
  1238. while (!method && lookup) {
  1239. method = lookup.methods[st.js2st(this.selector)];
  1240. lookup = lookup.superclass;
  1241. }
  1242. return method;
  1243. });
  1244. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1245. /* This is the current call context object.
  1246. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1247. In JS code, use api.getThisContext() (see below).
  1248. */
  1249. var thisContext = null;
  1250. /*
  1251. Runs worker function so that error handler is not set up
  1252. if there isn't one. This is accomplished by unconditional
  1253. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1254. which then stops error handler setup (see st.withContext above).
  1255. The effect is, $core.seamless(fn)'s exceptions are not
  1256. handed into ST error handler and caller should process them.
  1257. */
  1258. st.seamless = function (worker) {
  1259. var oldContext = thisContext;
  1260. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1261. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1262. });
  1263. var result = worker(thisContext);
  1264. thisContext = oldContext;
  1265. return result;
  1266. };
  1267. function resultWithErrorHandling (worker) {
  1268. try {
  1269. return worker(thisContext);
  1270. } catch (error) {
  1271. globals.ErrorHandler._handleError_(error);
  1272. thisContext = null;
  1273. // Rethrow the error in any case.
  1274. throw error;
  1275. }
  1276. }
  1277. /*
  1278. Standard way to run within context.
  1279. Sets up error handler if entering first ST context in a stack.
  1280. */
  1281. st.withContext = function (worker, setup) {
  1282. var oldContext = thisContext;
  1283. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1284. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1285. thisContext = oldContext;
  1286. return result;
  1287. };
  1288. /* Handle thisContext pseudo variable */
  1289. st.getThisContext = function () {
  1290. if (!thisContext) return null;
  1291. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1292. frame.setup(frame);
  1293. }
  1294. return thisContext;
  1295. };
  1296. }
  1297. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1298. function MessageSendBrik (brikz, st) {
  1299. var globals = brikz.smalltalkGlobals.globals;
  1300. var nilAsReceiver = brikz.root.nilAsReceiver;
  1301. /* Send message programmatically. Used to implement #perform: & Co. */
  1302. st.send2 = function (self, selector, args, klass) {
  1303. if (self == null) {
  1304. self = nilAsReceiver;
  1305. }
  1306. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1307. return method != null ?
  1308. method.apply(self, args || []) :
  1309. globals.Message._selector_arguments_notUnderstoodBy_(
  1310. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1311. );
  1312. };
  1313. function wrapJavaScript (o) {
  1314. return globals.JSObjectProxy._on_(o);
  1315. }
  1316. st.wrapJavaScript = wrapJavaScript;
  1317. /* If the object property is a function, then call it, except if it starts with
  1318. an uppercase character (we probably want to answer the function itself in this
  1319. case and send it #new from Amber).
  1320. */
  1321. st.accessJavaScript = function (self, propertyName, args) {
  1322. var propertyValue = self[propertyName];
  1323. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1324. return propertyValue.apply(self, args || []);
  1325. } else if (args.length === 0) {
  1326. return propertyValue;
  1327. } else {
  1328. self[propertyName] = args[0];
  1329. return self;
  1330. }
  1331. };
  1332. }
  1333. function SelectorConversionBrik (brikz, st) {
  1334. /* Convert a Smalltalk selector into a JS selector */
  1335. st.st2js = this.st2js = function (string) {
  1336. return '_' + string
  1337. .replace(/:/g, '_')
  1338. .replace(/[\&]/g, '_and')
  1339. .replace(/[\|]/g, '_or')
  1340. .replace(/[+]/g, '_plus')
  1341. .replace(/-/g, '_minus')
  1342. .replace(/[*]/g, '_star')
  1343. .replace(/[\/]/g, '_slash')
  1344. .replace(/[\\]/g, '_backslash')
  1345. .replace(/[\~]/g, '_tild')
  1346. .replace(/%/g, '_percent')
  1347. .replace(/>/g, '_gt')
  1348. .replace(/</g, '_lt')
  1349. .replace(/=/g, '_eq')
  1350. .replace(/,/g, '_comma')
  1351. .replace(/[@]/g, '_at');
  1352. };
  1353. /* Convert a string to a valid smalltalk selector.
  1354. if you modify the following functions, also change st2js
  1355. accordingly */
  1356. st.js2st = function (selector) {
  1357. if (selector.match(/^__/)) {
  1358. return binaryJsToSt(selector);
  1359. } else {
  1360. return keywordJsToSt(selector);
  1361. }
  1362. };
  1363. function keywordJsToSt (selector) {
  1364. return selector.replace(/^_/, '').replace(/_/g, ':');
  1365. }
  1366. function binaryJsToSt (selector) {
  1367. return selector
  1368. .replace(/^_/, '')
  1369. .replace(/_and/g, '&')
  1370. .replace(/_or/g, '|')
  1371. .replace(/_plus/g, '+')
  1372. .replace(/_minus/g, '-')
  1373. .replace(/_star/g, '*')
  1374. .replace(/_slash/g, '/')
  1375. .replace(/_backslash/g, '\\')
  1376. .replace(/_tild/g, '~')
  1377. .replace(/_percent/g, '%')
  1378. .replace(/_gt/g, '>')
  1379. .replace(/_lt/g, '<')
  1380. .replace(/_eq/g, '=')
  1381. .replace(/_comma/g, ',')
  1382. .replace(/_at/g, '@');
  1383. }
  1384. st.st2prop = function (stSelector) {
  1385. var colonPosition = stSelector.indexOf(':');
  1386. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1387. };
  1388. }
  1389. StartImageBrik.deps = ["smalltalkGlobals"];
  1390. function StartImageBrik (brikz, st) {
  1391. var globals = brikz.smalltalkGlobals.globals;
  1392. this.run = function () {
  1393. globals.AmberBootstrapInitialization._run();
  1394. };
  1395. }
  1396. /* Making smalltalk that can run */
  1397. function configureWithRuntime (brikz) {
  1398. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  1399. brikz.runtimeClasses = RuntimeClassesBrik;
  1400. brikz.frameBinding = FrameBindingBrik;
  1401. brikz.runtimeMethods = RuntimeMethodsBrik;
  1402. brikz.messageSend = MessageSendBrik;
  1403. brikz.runtime = RuntimeBrik;
  1404. brikz.primitives = PrimitivesBrik;
  1405. brikz.selectorConversion = SelectorConversionBrik;
  1406. brikz.startImage = StartImageBrik;
  1407. brikz.rebuild();
  1408. }
  1409. return configureWithRuntime;
  1410. });
  1411. // Depend on each module that is loaded lazily.
  1412. // Add to packager tasks as dependency,
  1413. // so the lazy-loaded modules are included.
  1414. define('amber/lazypack',['./kernel-runtime'], {});
  1415. //jshint eqnull:true
  1416. define('amber/kernel-checks',[],function () {
  1417. "use strict";
  1418. function assert (fn) {
  1419. try {
  1420. if (fn()) return;
  1421. } catch (ex) {
  1422. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1423. }
  1424. throw new Error("Assertion failed:\n" + fn);
  1425. }
  1426. assert(function () {
  1427. return !("hasOwnProperty" in Object.create(null));
  1428. });
  1429. assert(function () {
  1430. return Object.getPrototypeOf(Object.create(null)) === null;
  1431. });
  1432. assert(function () {
  1433. var p = {};
  1434. return Object.getPrototypeOf(Object.create(p)) === p;
  1435. });
  1436. // assert(function () {
  1437. // return new Function("return this")().Object === Object;
  1438. // });
  1439. // assert(function () {
  1440. // return Object.create(new Function("return this")()).Object === Object;
  1441. // });
  1442. assert(function () {
  1443. return typeof global !== "undefined";
  1444. });
  1445. assert(function () {
  1446. return global.Object === Object;
  1447. });
  1448. assert(function () {
  1449. return Object.create(global).Object === Object;
  1450. });
  1451. assert(function () {
  1452. return (function () {
  1453. return this;
  1454. }).apply(void 0) === void 0;
  1455. });
  1456. assert(function () {
  1457. return (function () {
  1458. return this;
  1459. }).apply(null) === null;
  1460. });
  1461. assert(function () {
  1462. return (function () {
  1463. return this;
  1464. }).apply(3) === 3;
  1465. });
  1466. assert(function () {
  1467. return (function () {
  1468. return this;
  1469. }).apply("foo") === "foo";
  1470. });
  1471. assert(function () {
  1472. return (function () {
  1473. return this;
  1474. }).apply(true) === true;
  1475. });
  1476. assert(function () {
  1477. var o = Object.freeze({});
  1478. try {
  1479. o.foo = "bar";
  1480. } catch (ex) {
  1481. }
  1482. return o.foo == null;
  1483. });
  1484. assert(function () {
  1485. return typeof Promise === "function";
  1486. });
  1487. assert(function () {
  1488. return typeof Promise.resolve === "function";
  1489. });
  1490. assert(function () {
  1491. return typeof Promise.reject === "function";
  1492. });
  1493. assert(function () {
  1494. return typeof new Promise(function () {
  1495. }).then === "function";
  1496. });
  1497. });
  1498. define('amber/brikz',[], function () {
  1499. return function Brikz(api, apiKey, initKey) {
  1500. "use strict";
  1501. //jshint eqnull:true
  1502. var brikz = this,
  1503. backup = {};
  1504. apiKey = apiKey || 'exports';
  1505. initKey = initKey || '__init__';
  1506. function mixin(src, target, what) {
  1507. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1508. if (src == null) {
  1509. target[keys[i]] = undefined;
  1510. } else {
  1511. var value = src[keys[i]];
  1512. if (typeof value !== "undefined") {
  1513. target[keys[i]] = value;
  1514. }
  1515. }
  1516. }
  1517. return target;
  1518. }
  1519. Object.defineProperties(this, {
  1520. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1521. });
  1522. var exclude = mixin(this, {});
  1523. this.rebuild = function () {
  1524. Object.keys(backup).forEach(function (key) {
  1525. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1526. });
  1527. var oapi = mixin(api, {}),
  1528. order = [],
  1529. chk = {};
  1530. function ensure(key) {
  1531. if (key in exclude) {
  1532. return null;
  1533. }
  1534. var b = brikz[key],
  1535. bak = backup[key];
  1536. mixin(null, api, api);
  1537. while (typeof b === "function") {
  1538. (b.deps || []).forEach(ensure);
  1539. b = new b(brikz, api, bak);
  1540. }
  1541. brikz[key] = b;
  1542. if (b && !chk[key]) {
  1543. chk[key] = true;
  1544. order.push(b);
  1545. }
  1546. if (b && !b[apiKey]) {
  1547. b[apiKey] = mixin(api, {});
  1548. }
  1549. }
  1550. Object.keys(brikz).forEach(ensure);
  1551. mixin(oapi, mixin(null, api, api));
  1552. order.forEach(function (brik) {
  1553. mixin(brik[apiKey] || {}, api);
  1554. });
  1555. order.forEach(function (brik) {
  1556. if (brik[initKey]) {
  1557. brik[initKey]();
  1558. if (brik[initKey].once) {
  1559. delete brik[initKey];
  1560. }
  1561. }
  1562. });
  1563. backup = mixin(brikz, {});
  1564. };
  1565. };
  1566. });
  1567. /* ====================================================================
  1568. |
  1569. | Amber Smalltalk
  1570. | http://amber-lang.net
  1571. |
  1572. ======================================================================
  1573. ======================================================================
  1574. |
  1575. | Copyright (c) 2010-2014
  1576. | Nicolas Petton <petton.nicolas@gmail.com>
  1577. |
  1578. | Copyright (c) 2012-2017
  1579. | The Amber team https://lolg.it/org/amber/members
  1580. | Amber contributors (see /CONTRIBUTORS)
  1581. |
  1582. | Amber is released under the MIT license
  1583. |
  1584. | Permission is hereby granted, free of charge, to any person obtaining
  1585. | a copy of this software and associated documentation files (the
  1586. | 'Software'), to deal in the Software without restriction, including
  1587. | without limitation the rights to use, copy, modify, merge, publish,
  1588. | distribute, sublicense, and/or sell copies of the Software, and to
  1589. | permit persons to whom the Software is furnished to do so, subject to
  1590. | the following conditions:
  1591. |
  1592. | The above copyright notice and this permission notice shall be
  1593. | included in all copies or substantial portions of the Software.
  1594. |
  1595. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1596. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1597. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1598. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1599. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1600. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1601. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1602. |
  1603. ==================================================================== */
  1604. //jshint eqnull:true
  1605. define('amber/kernel-fundamentals',[],function () {
  1606. "use strict";
  1607. function inherits (child, parent) {
  1608. child.prototype = Object.create(parent.prototype, {
  1609. constructor: {
  1610. value: child,
  1611. enumerable: false, configurable: true, writable: true
  1612. }
  1613. });
  1614. return child;
  1615. }
  1616. function SmalltalkGlobalsBrik (brikz, st) {
  1617. var globals = Object.create(global);
  1618. globals.SmalltalkSettings = {};
  1619. this.globals = globals;
  1620. }
  1621. function EventBrik (brikz, st) {
  1622. var emit = {};
  1623. this.emit = emit;
  1624. this.declareEvent = function (event) {
  1625. if (!emit[event]) emit[event] = function () {
  1626. };
  1627. }
  1628. }
  1629. function RootBrik (brikz, st) {
  1630. /* Smalltalk foundational objects */
  1631. var coreFns = this.coreFns = {};
  1632. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1633. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1634. Detached roots (eg. wrapped JS classes like Number or Date)
  1635. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1636. function SmalltalkRoot () {
  1637. }
  1638. function SmalltalkProtoObject () {
  1639. }
  1640. function SmalltalkObject () {
  1641. }
  1642. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1643. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1644. this.Root = SmalltalkRoot;
  1645. this.Object = SmalltalkObject;
  1646. }
  1647. function SelectorsBrik (brikz, st) {
  1648. var selectorSet = Object.create(null);
  1649. var selectors = this.selectors = [];
  1650. this.registerSelector = function (stSelector) {
  1651. if (selectorSet[stSelector]) return false;
  1652. selectors.push(stSelector);
  1653. return selectorSet[stSelector] = true;
  1654. };
  1655. st.allSelectors = function () {
  1656. return selectors;
  1657. };
  1658. }
  1659. function PackagesBrik (brikz, st) {
  1660. st.packages = st.packageDescriptors = {};
  1661. /* Add a package load descriptor to the system */
  1662. st.addPackage = function (name, properties) {
  1663. if (!name) return null;
  1664. return st.packageDescriptors[name] = {properties: properties};
  1665. };
  1666. }
  1667. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1668. function BehaviorsBrik (brikz, st) {
  1669. var globals = brikz.smalltalkGlobals.globals;
  1670. var addElement = brikz.arraySet.addElement;
  1671. var removeElement = brikz.arraySet.removeElement;
  1672. /* Smalltalk classes and traits */
  1673. var traitsOrClasses = [];
  1674. this.buildTraitOrClass = function (category, builder) {
  1675. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1676. if (traitOrClass) {
  1677. builder.updateExisting(traitOrClass);
  1678. } else {
  1679. traitOrClass = builder.make();
  1680. traitOrClass.category = category;
  1681. addTraitOrClass(traitOrClass);
  1682. }
  1683. return traitOrClass;
  1684. };
  1685. function addTraitOrClass (traitOrClass) {
  1686. globals[traitOrClass.name] = traitOrClass;
  1687. addElement(traitsOrClasses, traitOrClass);
  1688. traitOrClass.added();
  1689. }
  1690. function removeTraitOrClass (traitOrClass) {
  1691. traitOrClass.removed();
  1692. removeElement(traitsOrClasses, traitOrClass);
  1693. delete globals[traitOrClass.name];
  1694. }
  1695. this.removeTraitOrClass = removeTraitOrClass;
  1696. /* Create an alias for an existing class */
  1697. st.alias = function (traitOrClass, alias) {
  1698. globals[alias] = traitOrClass;
  1699. };
  1700. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1701. }
  1702. MethodsBrik.deps = ["event", "selectors", "root"];
  1703. function MethodsBrik (brikz, st) {
  1704. var registerSelector = brikz.selectors.registerSelector;
  1705. var SmalltalkObject = brikz.root.Object;
  1706. var coreFns = brikz.root.coreFns;
  1707. var emit = brikz.event.emit;
  1708. var declareEvent = brikz.event.declareEvent;
  1709. function SmalltalkMethod () {
  1710. }
  1711. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1712. /* Smalltalk method object. To add a method to a class,
  1713. use api.addMethod() */
  1714. st.method = function (spec) {
  1715. var that = new SmalltalkMethod();
  1716. var selector = spec.selector;
  1717. that.selector = selector;
  1718. that.args = spec.args || {};
  1719. that.protocol = spec.protocol;
  1720. that.source = spec.source;
  1721. that.messageSends = spec.messageSends || [];
  1722. // TODO remove .referencedClasses, have .referencedGlobals
  1723. that.referencedClasses = spec.referencedClasses || [];
  1724. that.fn = spec.fn;
  1725. return that;
  1726. };
  1727. /* Add/remove a method to/from a class */
  1728. st.addMethod = function (method, traitOrBehavior) {
  1729. if (method.owner != null) {
  1730. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1731. }
  1732. method.owner = traitOrBehavior;
  1733. // TODO deprecation helper; remove
  1734. Object.defineProperty(method, "methodClass", {
  1735. get: function () {
  1736. console.warn("Use of .methodClass deprecated, use .owner");
  1737. return method.owner;
  1738. },
  1739. set: function (v) {
  1740. console.warn("Use of .methodClass= deprecated, use .owner=");
  1741. method.owner = v;
  1742. }
  1743. });
  1744. registerNewSelectors(method);
  1745. traitOrBehavior.localMethods[method.selector] = method;
  1746. updateMethod(method.selector, traitOrBehavior);
  1747. };
  1748. declareEvent("selectorsAdded");
  1749. function registerNewSelectors (method) {
  1750. var newSelectors = [];
  1751. function selectorInUse (stSelector) {
  1752. if (registerSelector(stSelector)) {
  1753. newSelectors.push(stSelector);
  1754. }
  1755. }
  1756. selectorInUse(method.selector);
  1757. method.messageSends.forEach(selectorInUse);
  1758. emit.selectorsAdded(newSelectors);
  1759. }
  1760. st.removeMethod = function (method, traitOrBehavior) {
  1761. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1762. delete traitOrBehavior.localMethods[method.selector];
  1763. updateMethod(method.selector, traitOrBehavior);
  1764. };
  1765. this.setupMethods = function (traitOrBehavior) {
  1766. traitOrBehavior.localMethods = Object.create(null);
  1767. traitOrBehavior.methods = Object.create(null);
  1768. };
  1769. declareEvent("methodReplaced");
  1770. function updateMethod (selector, traitOrBehavior) {
  1771. var oldMethod = traitOrBehavior.methods[selector],
  1772. newMethod = traitOrBehavior.localMethods[selector];
  1773. if (oldMethod == null && newMethod == null) {
  1774. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1775. return;
  1776. }
  1777. if (newMethod === oldMethod) return;
  1778. if (newMethod != null) {
  1779. traitOrBehavior.methods[selector] = newMethod;
  1780. traitOrBehavior.methodAdded(newMethod);
  1781. } else {
  1782. delete traitOrBehavior.methods[selector];
  1783. traitOrBehavior.methodRemoved(oldMethod);
  1784. }
  1785. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1786. }
  1787. this.updateMethod = updateMethod;
  1788. }
  1789. function ArraySetBrik (brikz, st) {
  1790. st.addElement = this.addElement = function (array, el) {
  1791. if (typeof el === 'undefined') {
  1792. return;
  1793. }
  1794. if (array.indexOf(el) === -1) {
  1795. array.push(el);
  1796. }
  1797. };
  1798. st.removeElement = this.removeElement = function (array, el) {
  1799. var i = array.indexOf(el);
  1800. if (i !== -1) {
  1801. array.splice(i, 1);
  1802. }
  1803. };
  1804. }
  1805. NilBrik.deps = ["root"];
  1806. function NilBrik (brikz, st) {
  1807. var SmalltalkObject = brikz.root.Object;
  1808. var coreFns = brikz.root.coreFns;
  1809. function SmalltalkNil () {
  1810. }
  1811. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1812. this.nilAsReceiver = new SmalltalkNil();
  1813. this.nilAsValue = this.nilAsReceiver; // TODO null
  1814. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1815. // nil objects from one environment to another, doing
  1816. // `anObject == nil` (in JavaScript) does not always answer
  1817. // true as the referenced nil object might come from the other
  1818. // environment.
  1819. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1820. value: true,
  1821. enumerable: false, configurable: false, writable: false
  1822. });
  1823. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1824. value: true,
  1825. enumerable: false, configurable: false, writable: false
  1826. });
  1827. }
  1828. /* Making smalltalk that has basic building blocks */
  1829. function configureWithFundamentals (brikz) {
  1830. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1831. brikz.root = RootBrik;
  1832. brikz.nil = NilBrik;
  1833. brikz.event = EventBrik;
  1834. brikz.arraySet = ArraySetBrik;
  1835. brikz.selectors = SelectorsBrik;
  1836. brikz.packages = PackagesBrik;
  1837. brikz.behaviors = BehaviorsBrik;
  1838. brikz.methods = MethodsBrik;
  1839. brikz.rebuild();
  1840. }
  1841. return configureWithFundamentals;
  1842. });
  1843. /* ====================================================================
  1844. |
  1845. | Amber Smalltalk
  1846. | http://amber-lang.net
  1847. |
  1848. ======================================================================
  1849. ======================================================================
  1850. |
  1851. | Copyright (c) 2010-2014
  1852. | Nicolas Petton <petton.nicolas@gmail.com>
  1853. |
  1854. | Copyright (c) 2012-2017
  1855. | The Amber team https://lolg.it/org/amber/members
  1856. | Amber contributors (see /CONTRIBUTORS)
  1857. |
  1858. | Amber is released under the MIT license
  1859. |
  1860. | Permission is hereby granted, free of charge, to any person obtaining
  1861. | a copy of this software and associated documentation files (the
  1862. | 'Software'), to deal in the Software without restriction, including
  1863. | without limitation the rights to use, copy, modify, merge, publish,
  1864. | distribute, sublicense, and/or sell copies of the Software, and to
  1865. | permit persons to whom the Software is furnished to do so, subject to
  1866. | the following conditions:
  1867. |
  1868. | The above copyright notice and this permission notice shall be
  1869. | included in all copies or substantial portions of the Software.
  1870. |
  1871. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1872. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1873. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1874. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1875. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1876. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1877. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1878. |
  1879. ==================================================================== */
  1880. //jshint eqnull:true
  1881. define('amber/kernel-language',[],function () {
  1882. "use strict";
  1883. function inherits (child, parent) {
  1884. child.prototype = Object.create(parent.prototype, {
  1885. constructor: {
  1886. value: child,
  1887. enumerable: false, configurable: true, writable: true
  1888. }
  1889. });
  1890. return child;
  1891. }
  1892. function defineMethod (klass, name, method) {
  1893. Object.defineProperty(klass.prototype, name, {
  1894. value: method,
  1895. enumerable: false, configurable: true, writable: true
  1896. });
  1897. }
  1898. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1899. function TraitsBrik (brikz, st) {
  1900. var coreFns = brikz.root.coreFns;
  1901. var SmalltalkObject = brikz.root.Object;
  1902. var setupMethods = brikz.methods.setupMethods;
  1903. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1904. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1905. var emit = brikz.event.emit;
  1906. var declareEvent = brikz.event.declareEvent;
  1907. function SmalltalkTrait () {
  1908. }
  1909. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1910. SmalltalkTrait.prototype.trait = true;
  1911. defineMethod(SmalltalkTrait, "toString", function () {
  1912. return 'Smalltalk Trait ' + this.name;
  1913. });
  1914. declareEvent("traitAdded");
  1915. defineMethod(SmalltalkTrait, "added", function () {
  1916. emit.traitAdded(this);
  1917. });
  1918. declareEvent("traitRemoved");
  1919. defineMethod(SmalltalkTrait, "removed", function () {
  1920. emit.traitRemoved(this);
  1921. });
  1922. declareEvent("traitMethodAdded");
  1923. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1924. var self = this;
  1925. this.traitUsers.forEach(function (each) {
  1926. traitMethodChanged(method.selector, method, self, each);
  1927. });
  1928. emit.traitMethodAdded(method, this);
  1929. });
  1930. declareEvent("traitMethodRemoved");
  1931. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1932. var self = this;
  1933. this.traitUsers.forEach(function (each) {
  1934. traitMethodChanged(method.selector, null, self, each);
  1935. });
  1936. emit.traitMethodRemoved(method, this);
  1937. });
  1938. function traitBuilder (traitName) {
  1939. return {
  1940. name: traitName,
  1941. make: function () {
  1942. var that = new SmalltalkTrait();
  1943. // TODO deprecation helper; remove
  1944. Object.defineProperty(that, "className", {
  1945. get: function () {
  1946. console.warn("Use of .className deprecated, use .name");
  1947. return that.name;
  1948. },
  1949. set: function (v) {
  1950. console.warn("Use of .className= deprecated, use .name=");
  1951. that.name = v;
  1952. }
  1953. });
  1954. that.name = traitName;
  1955. that.traitUsers = [];
  1956. setupMethods(that);
  1957. return that;
  1958. },
  1959. updateExisting: function (trait) {
  1960. }
  1961. };
  1962. }
  1963. st.addTrait = function (className, category) {
  1964. return buildTraitOrClass(category, traitBuilder(className));
  1965. };
  1966. }
  1967. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1968. function MethodCompositionBrik (brikz, st) {
  1969. var updateMethod = brikz.methods.updateMethod;
  1970. var addElement = brikz.arraySet.addElement;
  1971. var removeElement = brikz.arraySet.removeElement;
  1972. function aliased (selector, method) {
  1973. if (method.selector === selector) return method;
  1974. var result = st.method({
  1975. selector: selector,
  1976. args: method.args,
  1977. protocol: method.protocol,
  1978. source: '"Aliased as ' + selector + '"\n' + method.source,
  1979. messageSends: method.messageSends,
  1980. referencesClasses: method.referencedClasses,
  1981. fn: method.fn
  1982. });
  1983. result.owner = method.owner;
  1984. return result;
  1985. }
  1986. function deleteKeysFrom (keys, obj) {
  1987. keys.forEach(function (each) {
  1988. delete obj[each];
  1989. });
  1990. }
  1991. function fillTraitTransformation (traitTransformation, obj) {
  1992. // assert(Object.getOwnProperties(obj).length === 0)
  1993. var traitMethods = traitTransformation.trait.methods;
  1994. Object.keys(traitMethods).forEach(function (selector) {
  1995. obj[selector] = traitMethods[selector];
  1996. });
  1997. var traitAliases = traitTransformation.aliases;
  1998. if (traitAliases) {
  1999. Object.keys(traitAliases).forEach(function (aliasSelector) {
  2000. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  2001. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  2002. // else delete obj[aliasSelector]; // semantically correct; optimized away
  2003. });
  2004. }
  2005. var traitExclusions = traitTransformation.exclusions;
  2006. if (traitExclusions) {
  2007. deleteKeysFrom(traitExclusions, obj);
  2008. }
  2009. return obj;
  2010. }
  2011. function buildCompositionChain (traitComposition) {
  2012. return traitComposition.reduce(function (soFar, each) {
  2013. return fillTraitTransformation(each, Object.create(soFar));
  2014. }, null);
  2015. }
  2016. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  2017. var oldLocalMethods = traitOrBehavior.localMethods,
  2018. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  2019. Object.keys(oldLocalMethods).forEach(function (selector) {
  2020. newLocalMethods[selector] = oldLocalMethods[selector];
  2021. });
  2022. var selector;
  2023. traitOrBehavior.localMethods = newLocalMethods;
  2024. for (selector in newLocalMethods) {
  2025. updateMethod(selector, traitOrBehavior);
  2026. }
  2027. for (selector in oldLocalMethods) {
  2028. updateMethod(selector, traitOrBehavior);
  2029. }
  2030. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2031. removeElement(each.trait.traitUsers, traitOrBehavior);
  2032. });
  2033. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2034. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2035. addElement(each.trait.traitUsers, traitOrBehavior);
  2036. });
  2037. };
  2038. function aliasesOfSelector (selector, traitAliases) {
  2039. if (!traitAliases) return [selector];
  2040. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2041. return traitAliases[aliasSelector] === selector
  2042. });
  2043. if (!traitAliases[selector]) result.push(selector);
  2044. return result;
  2045. }
  2046. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2047. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2048. changes.forEach(function (aliasSelector) {
  2049. obj[aliasSelector] = aliased(aliasSelector, method);
  2050. });
  2051. var traitExclusions = traitTransformation.exclusions;
  2052. if (traitExclusions) {
  2053. deleteKeysFrom(traitExclusions, obj);
  2054. }
  2055. return changes;
  2056. }
  2057. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2058. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2059. deleteKeysFrom(changes, obj);
  2060. return changes;
  2061. }
  2062. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2063. var traitComposition = traitOrBehavior.traitComposition,
  2064. chain = traitOrBehavior.localMethods,
  2065. changes = [];
  2066. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2067. chain = Object.getPrototypeOf(chain);
  2068. var traitTransformation = traitComposition[i];
  2069. if (traitTransformation.trait !== trait) continue;
  2070. changes.push.apply(changes, method ?
  2071. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2072. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2073. }
  2074. // assert(chain === null);
  2075. changes.forEach(function (each) {
  2076. updateMethod(each, traitOrBehavior);
  2077. });
  2078. }
  2079. this.traitMethodChanged = traitMethodChanged;
  2080. }
  2081. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2082. function ClassesBrik (brikz, st) {
  2083. var SmalltalkRoot = brikz.root.Root;
  2084. var coreFns = brikz.root.coreFns;
  2085. var globals = brikz.smalltalkGlobals.globals;
  2086. var SmalltalkObject = brikz.root.Object;
  2087. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2088. var setupMethods = brikz.methods.setupMethods;
  2089. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2090. var addElement = brikz.arraySet.addElement;
  2091. var removeElement = brikz.arraySet.removeElement;
  2092. var emit = brikz.event.emit;
  2093. var declareEvent = brikz.event.declareEvent;
  2094. function SmalltalkBehavior () {
  2095. }
  2096. function SmalltalkClass () {
  2097. }
  2098. function SmalltalkMetaclass () {
  2099. }
  2100. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2101. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2102. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2103. // Fake root class of the system.
  2104. // Effective superclass of all classes created with `nil subclass: ...`.
  2105. var nilAsClass = this.nilAsClass = {
  2106. fn: SmalltalkRoot,
  2107. a$cls: {fn: SmalltalkClass},
  2108. klass: {fn: SmalltalkClass}
  2109. };
  2110. SmalltalkMetaclass.prototype.meta = true;
  2111. defineMethod(SmalltalkClass, "toString", function () {
  2112. return 'Smalltalk ' + this.name;
  2113. });
  2114. defineMethod(SmalltalkMetaclass, "toString", function () {
  2115. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2116. });
  2117. declareEvent("classAdded");
  2118. defineMethod(SmalltalkClass, "added", function () {
  2119. addSubclass(this);
  2120. emit.classAdded(this);
  2121. });
  2122. declareEvent("classRemoved");
  2123. defineMethod(SmalltalkClass, "removed", function () {
  2124. emit.classRemoved(this);
  2125. removeSubclass(this);
  2126. });
  2127. declareEvent("behaviorMethodAdded");
  2128. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2129. emit.behaviorMethodAdded(method, this);
  2130. });
  2131. declareEvent("behaviorMethodRemove");
  2132. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2133. emit.behaviorMethodRemoved(method, this);
  2134. });
  2135. this.bootstrapHierarchy = function () {
  2136. var nilSubclasses = [globals.ProtoObject];
  2137. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2138. nilSubclasses.forEach(function (each) {
  2139. each.a$cls.superclass = globals.Class;
  2140. addSubclass(each.a$cls);
  2141. });
  2142. };
  2143. /* Smalltalk class creation. A class is an instance of an automatically
  2144. created metaclass object. Newly created classes (not their metaclass)
  2145. should be added to the system, see smalltalk.addClass().
  2146. Superclass linking is *not* handled here, see api.initialize() */
  2147. function classBuilder (className, superclass, iVarNames, fn) {
  2148. var logicalSuperclass = superclass;
  2149. if (superclass == null || superclass.a$nil) {
  2150. superclass = nilAsClass;
  2151. logicalSuperclass = null;
  2152. }
  2153. function klass () {
  2154. var that = metaclass().instanceClass;
  2155. that.superclass = logicalSuperclass;
  2156. that.fn = fn || inherits(function () {
  2157. }, superclass.fn);
  2158. that.iVarNames = iVarNames || [];
  2159. // TODO deprecation helper; remove
  2160. Object.defineProperty(that, "className", {
  2161. get: function () {
  2162. console.warn("Use of .className deprecated, use .name");
  2163. return that.name;
  2164. },
  2165. set: function (v) {
  2166. console.warn("Use of .className= deprecated, use .name=");
  2167. that.name = v;
  2168. }
  2169. });
  2170. that.name = className;
  2171. that.subclasses = [];
  2172. setupMethods(that);
  2173. return that;
  2174. }
  2175. function metaclass () {
  2176. var that = new SmalltalkMetaclass();
  2177. that.superclass = superclass.a$cls;
  2178. that.fn = inherits(function () {
  2179. }, that.superclass.fn);
  2180. that.iVarNames = [];
  2181. that.instanceClass = new that.fn();
  2182. wireKlass(that);
  2183. setupMethods(that);
  2184. return that;
  2185. }
  2186. return {
  2187. name: className,
  2188. make: klass,
  2189. updateExisting: function (klass) {
  2190. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2191. if (iVarNames) klass.iVarNames = iVarNames;
  2192. } else throw new Error("Incompatible change of class: " + klass.name);
  2193. }
  2194. };
  2195. }
  2196. function wireKlass (klass) {
  2197. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2198. value: klass,
  2199. enumerable: false, configurable: true, writable: true
  2200. });
  2201. Object.defineProperty(klass.fn.prototype, "klass", {
  2202. value: klass,
  2203. enumerable: false, configurable: true, writable: true
  2204. });
  2205. }
  2206. this.wireKlass = wireKlass;
  2207. /* Add a class to the system, creating a new one if needed.
  2208. A Package is lazily created if one with given name does not exist. */
  2209. st.addClass = function (className, superclass, iVarNames, category) {
  2210. // While subclassing nil is allowed, it might be an error, so
  2211. // warn about it.
  2212. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2213. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2214. }
  2215. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2216. };
  2217. st.removeClass = removeTraitOrClass;
  2218. function addSubclass (klass) {
  2219. if (klass.superclass) {
  2220. addElement(klass.superclass.subclasses, klass);
  2221. }
  2222. }
  2223. function removeSubclass (klass) {
  2224. if (klass.superclass) {
  2225. removeElement(klass.superclass.subclasses, klass);
  2226. }
  2227. }
  2228. function metaSubclasses (metaclass) {
  2229. return metaclass.instanceClass.subclasses
  2230. .filter(function (each) {
  2231. return !each.meta;
  2232. })
  2233. .map(function (each) {
  2234. return each.a$cls;
  2235. });
  2236. }
  2237. st.metaSubclasses = metaSubclasses;
  2238. st.traverseClassTree = function (klass, fn) {
  2239. var queue = [klass], sentinel = {};
  2240. for (var i = 0; i < queue.length; ++i) {
  2241. var item = queue[i];
  2242. if (fn(item, sentinel) === sentinel) continue;
  2243. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2244. queue.push.apply(queue, subclasses);
  2245. }
  2246. };
  2247. }
  2248. /* Making smalltalk that can load */
  2249. function configureWithHierarchy (brikz) {
  2250. brikz.traits = TraitsBrik;
  2251. brikz.composition = MethodCompositionBrik;
  2252. brikz.classes = ClassesBrik;
  2253. brikz.rebuild();
  2254. }
  2255. return configureWithHierarchy;
  2256. });
  2257. /* ====================================================================
  2258. |
  2259. | Amber Smalltalk
  2260. | http://amber-lang.net
  2261. |
  2262. ======================================================================
  2263. ======================================================================
  2264. |
  2265. | Copyright (c) 2010-2014
  2266. | Nicolas Petton <petton.nicolas@gmail.com>
  2267. |
  2268. | Copyright (c) 2012-2017
  2269. | The Amber team https://lolg.it/org/amber/members
  2270. | Amber contributors (see /CONTRIBUTORS)
  2271. |
  2272. | Amber is released under the MIT license
  2273. |
  2274. | Permission is hereby granted, free of charge, to any person obtaining
  2275. | a copy of this software and associated documentation files (the
  2276. | 'Software'), to deal in the Software without restriction, including
  2277. | without limitation the rights to use, copy, modify, merge, publish,
  2278. | distribute, sublicense, and/or sell copies of the Software, and to
  2279. | permit persons to whom the Software is furnished to do so, subject to
  2280. | the following conditions:
  2281. |
  2282. | The above copyright notice and this permission notice shall be
  2283. | included in all copies or substantial portions of the Software.
  2284. |
  2285. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2286. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2287. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2288. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2289. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2290. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2291. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2292. |
  2293. ==================================================================== */
  2294. //jshint eqnull:true
  2295. define('amber/boot',[
  2296. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2297. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2298. "use strict";
  2299. require(['./kernel-runtime']); // preload
  2300. function SmalltalkInitBrik (brikz, st) {
  2301. var initialized = false;
  2302. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2303. require(['./kernel-runtime'], resolve, reject);
  2304. });
  2305. /* Smalltalk initialization. Called on page load */
  2306. st.initialize = function () {
  2307. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2308. if (initialized) return;
  2309. brikz.classes.bootstrapHierarchy();
  2310. configureWithRuntime(brikz);
  2311. // TODO deprecation helper; remove
  2312. Object.defineProperty(st, "packages", {
  2313. get: function () {
  2314. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2315. return st.packageDescriptors;
  2316. },
  2317. set: function (v) {
  2318. console.trace();
  2319. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2320. }
  2321. });
  2322. brikz.startImage.run();
  2323. initialized = true;
  2324. });
  2325. };
  2326. }
  2327. /* Adds AMD and requirejs related methods to the api */
  2328. function AMDBrik (brikz, st) {
  2329. st.amdRequire = require;
  2330. st.defaultTransportType = st.defaultTransportType || "amd";
  2331. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2332. }
  2333. /* Defines asReceiver to be present at load time */
  2334. /* (logically it belongs more to PrimitiveBrik) */
  2335. AsReceiverBrik.deps = ["nil"];
  2336. function AsReceiverBrik (brikz, st) {
  2337. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2338. /**
  2339. * This function is used all over the compiled amber code.
  2340. * It takes any value (JavaScript or Smalltalk)
  2341. * and returns a proper Amber Smalltalk receiver.
  2342. *
  2343. * null or undefined -> nilAsReceiver,
  2344. * object having Smalltalk signature -> unchanged,
  2345. * otherwise wrapped foreign (JS) object
  2346. */
  2347. this.asReceiver = function (o) {
  2348. if (o == null) return nilAsReceiver;
  2349. else if (o.a$cls != null) return o;
  2350. else return st.wrapJavaScript(o);
  2351. };
  2352. }
  2353. var api = {};
  2354. var brikz = new Brikz(api);
  2355. configureWithFundamentals(brikz);
  2356. configureWithHierarchy(brikz);
  2357. brikz.asReceiver = AsReceiverBrik;
  2358. brikz.stInit = SmalltalkInitBrik;
  2359. brikz.amd = AMDBrik;
  2360. brikz.rebuild();
  2361. return {
  2362. api: api,
  2363. nilAsReceiver: brikz.nil.nilAsReceiver,
  2364. nilAsValue: brikz.nil.nilAsValue,
  2365. nilAsClass: brikz.classes.nilAsClass,
  2366. globals: brikz.smalltalkGlobals.globals,
  2367. asReceiver: brikz.asReceiver.asReceiver
  2368. };
  2369. });
  2370. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2371. var globals = boot.globals,
  2372. exports = {},
  2373. api = boot.api,
  2374. nil = boot.nilAsReceiver;
  2375. // API
  2376. exports.popupHelios = function () {
  2377. require(['helios/index'], function (helios) {
  2378. helios.popup();
  2379. }, function (err) {
  2380. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2381. });
  2382. };
  2383. Object.defineProperty(exports, "api", {
  2384. value: api,
  2385. enumerable: true, configurable: true, writable: false
  2386. });
  2387. Object.defineProperty(exports, "globals", {
  2388. value: globals,
  2389. enumerable: true, configurable: true, writable: false
  2390. });
  2391. Object.defineProperty(exports, "nil", {
  2392. value: nil,
  2393. enumerable: true, configurable: true, writable: false
  2394. });
  2395. function mixinToSettings (source) {
  2396. var settings = globals.SmalltalkSettings;
  2397. Object.keys(source).forEach(function (key) {
  2398. settings[key] = source[key];
  2399. });
  2400. }
  2401. function settingsInLocalStorage () {
  2402. //jshint evil:true
  2403. var storage = 'localStorage' in global && global.localStorage;
  2404. if (storage) {
  2405. var fromStorage;
  2406. try {
  2407. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2408. } catch (ex) {
  2409. // pass
  2410. }
  2411. mixinToSettings(fromStorage || {});
  2412. // TODO find less hackish way to store settings back to storage.
  2413. if (typeof window !== "undefined") {
  2414. requirejs(['jquery'], function ($) {
  2415. $(window).on('beforeunload', function () {
  2416. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2417. });
  2418. });
  2419. }
  2420. }
  2421. }
  2422. exports.initialize = function (options) {
  2423. return Promise.resolve()
  2424. .then(function () {
  2425. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2426. })
  2427. .then(settingsInLocalStorage)
  2428. .then(function () {
  2429. return options || {};
  2430. })
  2431. .then(mixinToSettings)
  2432. .then(function () {
  2433. return api.initialize();
  2434. });
  2435. };
  2436. // Exports
  2437. return exports;
  2438. });
  2439. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2440. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2441. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2442. $core.addPackage("Kernel-Helpers");
  2443. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2444. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2445. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2446. $core.addMethod(
  2447. $core.method({
  2448. selector: "subclass:",
  2449. protocol: "class creation",
  2450. fn: function (aString){
  2451. var self=this,$self=this;
  2452. return $core.withContext(function($ctx1) {
  2453. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2454. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2455. },
  2456. args: ["aString"],
  2457. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2458. referencedClasses: [],
  2459. messageSends: ["subclass:instanceVariableNames:package:"]
  2460. }),
  2461. $globals.TSubclassable);
  2462. $core.addMethod(
  2463. $core.method({
  2464. selector: "subclass:instanceVariableNames:",
  2465. protocol: "class creation",
  2466. fn: function (aString,anotherString){
  2467. var self=this,$self=this;
  2468. return $core.withContext(function($ctx1) {
  2469. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2470. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2471. },
  2472. args: ["aString", "anotherString"],
  2473. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2474. referencedClasses: [],
  2475. messageSends: ["subclass:instanceVariableNames:package:"]
  2476. }),
  2477. $globals.TSubclassable);
  2478. $core.addMethod(
  2479. $core.method({
  2480. selector: "subclass:instanceVariableNames:category:",
  2481. protocol: "class creation",
  2482. fn: function (aString,aString2,aString3){
  2483. var self=this,$self=this;
  2484. return $core.withContext(function($ctx1) {
  2485. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2486. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2487. },
  2488. args: ["aString", "aString2", "aString3"],
  2489. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2490. referencedClasses: [],
  2491. messageSends: ["subclass:instanceVariableNames:package:"]
  2492. }),
  2493. $globals.TSubclassable);
  2494. $core.addMethod(
  2495. $core.method({
  2496. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2497. protocol: "class creation",
  2498. fn: function (aString,aString2,classVars,pools,aString3){
  2499. var self=this,$self=this;
  2500. return $core.withContext(function($ctx1) {
  2501. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2502. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2503. },
  2504. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2505. 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",
  2506. referencedClasses: [],
  2507. messageSends: ["subclass:instanceVariableNames:package:"]
  2508. }),
  2509. $globals.TSubclassable);
  2510. $core.addMethod(
  2511. $core.method({
  2512. selector: "subclass:instanceVariableNames:package:",
  2513. protocol: "class creation",
  2514. fn: function (aString,aString2,aString3){
  2515. var self=this,$self=this;
  2516. return $core.withContext(function($ctx1) {
  2517. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2518. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2519. },
  2520. args: ["aString", "aString2", "aString3"],
  2521. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2522. referencedClasses: ["ClassBuilder"],
  2523. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2524. }),
  2525. $globals.TSubclassable);
  2526. $core.addMethod(
  2527. $core.method({
  2528. selector: "subclass:uses:",
  2529. protocol: "class creation",
  2530. fn: function (aString,aTraitCompositionDescription){
  2531. var self=this,$self=this;
  2532. return $core.withContext(function($ctx1) {
  2533. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2534. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2535. },
  2536. args: ["aString", "aTraitCompositionDescription"],
  2537. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2538. referencedClasses: [],
  2539. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2540. }),
  2541. $globals.TSubclassable);
  2542. $core.addMethod(
  2543. $core.method({
  2544. selector: "subclass:uses:instanceVariableNames:",
  2545. protocol: "class creation",
  2546. fn: function (aString,aTraitCompositionDescription,anotherString){
  2547. var self=this,$self=this;
  2548. return $core.withContext(function($ctx1) {
  2549. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2550. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2551. },
  2552. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2553. 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",
  2554. referencedClasses: [],
  2555. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2556. }),
  2557. $globals.TSubclassable);
  2558. $core.addMethod(
  2559. $core.method({
  2560. selector: "subclass:uses:instanceVariableNames:category:",
  2561. protocol: "class creation",
  2562. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2563. var self=this,$self=this;
  2564. return $core.withContext(function($ctx1) {
  2565. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2566. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2567. },
  2568. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2569. 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",
  2570. referencedClasses: [],
  2571. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2572. }),
  2573. $globals.TSubclassable);
  2574. $core.addMethod(
  2575. $core.method({
  2576. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2577. protocol: "class creation",
  2578. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2579. var self=this,$self=this;
  2580. return $core.withContext(function($ctx1) {
  2581. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2582. }, 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)});
  2583. },
  2584. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2585. 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",
  2586. referencedClasses: [],
  2587. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2588. }),
  2589. $globals.TSubclassable);
  2590. $core.addMethod(
  2591. $core.method({
  2592. selector: "subclass:uses:instanceVariableNames:package:",
  2593. protocol: "class creation",
  2594. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2595. var self=this,$self=this;
  2596. var cls;
  2597. return $core.withContext(function($ctx1) {
  2598. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2599. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2600. return cls;
  2601. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2602. },
  2603. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2604. 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",
  2605. referencedClasses: [],
  2606. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2607. }),
  2608. $globals.TSubclassable);
  2609. });
  2610. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2611. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2612. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2613. $core.addPackage("Kernel-Objects");
  2614. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2615. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2616. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2617. $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.";
  2618. $core.addMethod(
  2619. $core.method({
  2620. selector: "=",
  2621. protocol: "comparing",
  2622. fn: function (anObject){
  2623. var self=this,$self=this;
  2624. return $core.withContext(function($ctx1) {
  2625. return $self.__eq_eq(anObject);
  2626. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2627. },
  2628. args: ["anObject"],
  2629. source: "= anObject\x0a\x09^ self == anObject",
  2630. referencedClasses: [],
  2631. messageSends: ["=="]
  2632. }),
  2633. $globals.ProtoObject);
  2634. $core.addMethod(
  2635. $core.method({
  2636. selector: "==",
  2637. protocol: "comparing",
  2638. fn: function (anObject){
  2639. var self=this,$self=this;
  2640. return $core.withContext(function($ctx1) {
  2641. return self === anObject;
  2642. return self;
  2643. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2644. },
  2645. args: ["anObject"],
  2646. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2647. referencedClasses: [],
  2648. messageSends: []
  2649. }),
  2650. $globals.ProtoObject);
  2651. $core.addMethod(
  2652. $core.method({
  2653. selector: "asString",
  2654. protocol: "converting",
  2655. fn: function (){
  2656. var self=this,$self=this;
  2657. return $core.withContext(function($ctx1) {
  2658. return $self._printString();
  2659. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2660. },
  2661. args: [],
  2662. source: "asString\x0a\x09^ self printString",
  2663. referencedClasses: [],
  2664. messageSends: ["printString"]
  2665. }),
  2666. $globals.ProtoObject);
  2667. $core.addMethod(
  2668. $core.method({
  2669. selector: "class",
  2670. protocol: "accessing",
  2671. fn: function (){
  2672. var self=this,$self=this;
  2673. return $core.withContext(function($ctx1) {
  2674. return $self.a$cls;
  2675. return self;
  2676. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2677. },
  2678. args: [],
  2679. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2680. referencedClasses: [],
  2681. messageSends: []
  2682. }),
  2683. $globals.ProtoObject);
  2684. $core.addMethod(
  2685. $core.method({
  2686. selector: "doesNotUnderstand:",
  2687. protocol: "error handling",
  2688. fn: function (aMessage){
  2689. var self=this,$self=this;
  2690. return $core.withContext(function($ctx1) {
  2691. var $1;
  2692. $1=$recv($globals.MessageNotUnderstood)._new();
  2693. $recv($1)._receiver_(self);
  2694. $recv($1)._message_(aMessage);
  2695. $recv($1)._signal();
  2696. return self;
  2697. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2698. },
  2699. args: ["aMessage"],
  2700. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2701. referencedClasses: ["MessageNotUnderstood"],
  2702. messageSends: ["receiver:", "new", "message:", "signal"]
  2703. }),
  2704. $globals.ProtoObject);
  2705. $core.addMethod(
  2706. $core.method({
  2707. selector: "evaluate:on:",
  2708. protocol: "evaluating",
  2709. fn: function (aString,anEvaluator){
  2710. var self=this,$self=this;
  2711. return $core.withContext(function($ctx1) {
  2712. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2713. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2714. },
  2715. args: ["aString", "anEvaluator"],
  2716. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2717. referencedClasses: [],
  2718. messageSends: ["evaluate:receiver:"]
  2719. }),
  2720. $globals.ProtoObject);
  2721. $core.addMethod(
  2722. $core.method({
  2723. selector: "identityHash",
  2724. protocol: "accessing",
  2725. fn: function (){
  2726. var self=this,$self=this;
  2727. return $core.withContext(function($ctx1) {
  2728. self._deprecatedAPI();
  2729. var hash=self.identityHash;
  2730. if (hash) return hash;
  2731. hash=$core.nextId();
  2732. Object.defineProperty(self, 'identityHash', {value:hash});
  2733. return hash;
  2734. ;
  2735. return self;
  2736. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2737. },
  2738. args: [],
  2739. 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'>",
  2740. referencedClasses: [],
  2741. messageSends: []
  2742. }),
  2743. $globals.ProtoObject);
  2744. $core.addMethod(
  2745. $core.method({
  2746. selector: "ifNil:",
  2747. protocol: "testing",
  2748. fn: function (aBlock){
  2749. var self=this,$self=this;
  2750. return self;
  2751. },
  2752. args: ["aBlock"],
  2753. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2754. referencedClasses: [],
  2755. messageSends: []
  2756. }),
  2757. $globals.ProtoObject);
  2758. $core.addMethod(
  2759. $core.method({
  2760. selector: "ifNil:ifNotNil:",
  2761. protocol: "testing",
  2762. fn: function (aBlock,anotherBlock){
  2763. var self=this,$self=this;
  2764. return $core.withContext(function($ctx1) {
  2765. return $recv(anotherBlock)._value_(self);
  2766. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2767. },
  2768. args: ["aBlock", "anotherBlock"],
  2769. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2770. referencedClasses: [],
  2771. messageSends: ["value:"]
  2772. }),
  2773. $globals.ProtoObject);
  2774. $core.addMethod(
  2775. $core.method({
  2776. selector: "ifNotNil:",
  2777. protocol: "testing",
  2778. fn: function (aBlock){
  2779. var self=this,$self=this;
  2780. return $core.withContext(function($ctx1) {
  2781. return $recv(aBlock)._value_(self);
  2782. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2783. },
  2784. args: ["aBlock"],
  2785. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2786. referencedClasses: [],
  2787. messageSends: ["value:"]
  2788. }),
  2789. $globals.ProtoObject);
  2790. $core.addMethod(
  2791. $core.method({
  2792. selector: "ifNotNil:ifNil:",
  2793. protocol: "testing",
  2794. fn: function (aBlock,anotherBlock){
  2795. var self=this,$self=this;
  2796. return $core.withContext(function($ctx1) {
  2797. return $recv(aBlock)._value_(self);
  2798. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2799. },
  2800. args: ["aBlock", "anotherBlock"],
  2801. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2802. referencedClasses: [],
  2803. messageSends: ["value:"]
  2804. }),
  2805. $globals.ProtoObject);
  2806. $core.addMethod(
  2807. $core.method({
  2808. selector: "initialize",
  2809. protocol: "initialization",
  2810. fn: function (){
  2811. var self=this,$self=this;
  2812. return self;
  2813. },
  2814. args: [],
  2815. source: "initialize",
  2816. referencedClasses: [],
  2817. messageSends: []
  2818. }),
  2819. $globals.ProtoObject);
  2820. $core.addMethod(
  2821. $core.method({
  2822. selector: "inspect",
  2823. protocol: "inspecting",
  2824. fn: function (){
  2825. var self=this,$self=this;
  2826. return $core.withContext(function($ctx1) {
  2827. $recv($globals.Inspector)._inspect_(self);
  2828. return self;
  2829. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2830. },
  2831. args: [],
  2832. source: "inspect\x0a\x09Inspector inspect: self",
  2833. referencedClasses: ["Inspector"],
  2834. messageSends: ["inspect:"]
  2835. }),
  2836. $globals.ProtoObject);
  2837. $core.addMethod(
  2838. $core.method({
  2839. selector: "inspectOn:",
  2840. protocol: "inspecting",
  2841. fn: function (anInspector){
  2842. var self=this,$self=this;
  2843. return self;
  2844. },
  2845. args: ["anInspector"],
  2846. source: "inspectOn: anInspector",
  2847. referencedClasses: [],
  2848. messageSends: []
  2849. }),
  2850. $globals.ProtoObject);
  2851. $core.addMethod(
  2852. $core.method({
  2853. selector: "instVarAt:",
  2854. protocol: "accessing",
  2855. fn: function (aString){
  2856. var self=this,$self=this;
  2857. return $core.withContext(function($ctx1) {
  2858. return $self['@'+aString];
  2859. return self;
  2860. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2861. },
  2862. args: ["aString"],
  2863. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2864. referencedClasses: [],
  2865. messageSends: []
  2866. }),
  2867. $globals.ProtoObject);
  2868. $core.addMethod(
  2869. $core.method({
  2870. selector: "instVarAt:put:",
  2871. protocol: "accessing",
  2872. fn: function (aString,anObject){
  2873. var self=this,$self=this;
  2874. return $core.withContext(function($ctx1) {
  2875. $self['@' + aString] = anObject;
  2876. return self;
  2877. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2878. },
  2879. args: ["aString", "anObject"],
  2880. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2881. referencedClasses: [],
  2882. messageSends: []
  2883. }),
  2884. $globals.ProtoObject);
  2885. $core.addMethod(
  2886. $core.method({
  2887. selector: "isKindOf:",
  2888. protocol: "testing",
  2889. fn: function (aClass){
  2890. var self=this,$self=this;
  2891. return $core.withContext(function($ctx1) {
  2892. var $1;
  2893. $1=$self._isMemberOf_(aClass);
  2894. if($core.assert($1)){
  2895. return true;
  2896. } else {
  2897. return $recv($self._class())._inheritsFrom_(aClass);
  2898. }
  2899. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2900. },
  2901. args: ["aClass"],
  2902. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2903. referencedClasses: [],
  2904. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2905. }),
  2906. $globals.ProtoObject);
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "isNil",
  2910. protocol: "testing",
  2911. fn: function (){
  2912. var self=this,$self=this;
  2913. return false;
  2914. },
  2915. args: [],
  2916. source: "isNil\x0a\x09^ false",
  2917. referencedClasses: [],
  2918. messageSends: []
  2919. }),
  2920. $globals.ProtoObject);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "notNil",
  2924. protocol: "testing",
  2925. fn: function (){
  2926. var self=this,$self=this;
  2927. return $core.withContext(function($ctx1) {
  2928. return $recv($self._isNil())._not();
  2929. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2930. },
  2931. args: [],
  2932. source: "notNil\x0a\x09^ self isNil not",
  2933. referencedClasses: [],
  2934. messageSends: ["not", "isNil"]
  2935. }),
  2936. $globals.ProtoObject);
  2937. $core.addMethod(
  2938. $core.method({
  2939. selector: "perform:",
  2940. protocol: "message handling",
  2941. fn: function (aString){
  2942. var self=this,$self=this;
  2943. return $core.withContext(function($ctx1) {
  2944. return $self._perform_withArguments_(aString,[]);
  2945. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2946. },
  2947. args: ["aString"],
  2948. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2949. referencedClasses: [],
  2950. messageSends: ["perform:withArguments:"]
  2951. }),
  2952. $globals.ProtoObject);
  2953. $core.addMethod(
  2954. $core.method({
  2955. selector: "perform:withArguments:",
  2956. protocol: "message handling",
  2957. fn: function (aString,aCollection){
  2958. var self=this,$self=this;
  2959. return $core.withContext(function($ctx1) {
  2960. return $core.send2(self, aString, aCollection);
  2961. return self;
  2962. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2963. },
  2964. args: ["aString", "aCollection"],
  2965. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2966. referencedClasses: [],
  2967. messageSends: []
  2968. }),
  2969. $globals.ProtoObject);
  2970. $core.addMethod(
  2971. $core.method({
  2972. selector: "printOn:",
  2973. protocol: "printing",
  2974. fn: function (aStream){
  2975. var self=this,$self=this;
  2976. return $core.withContext(function($ctx1) {
  2977. var $5,$4,$3,$2,$1;
  2978. $5=$self._class();
  2979. $ctx1.sendIdx["class"]=1;
  2980. $4=$recv($5)._name();
  2981. $ctx1.sendIdx["name"]=1;
  2982. $3=$recv($4)._first();
  2983. $2=$recv($3)._isVowel();
  2984. if($core.assert($2)){
  2985. $1="an ";
  2986. } else {
  2987. $1="a ";
  2988. }
  2989. $recv(aStream)._nextPutAll_($1);
  2990. $ctx1.sendIdx["nextPutAll:"]=1;
  2991. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  2992. return self;
  2993. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2994. },
  2995. args: ["aStream"],
  2996. 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",
  2997. referencedClasses: [],
  2998. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2999. }),
  3000. $globals.ProtoObject);
  3001. $core.addMethod(
  3002. $core.method({
  3003. selector: "printString",
  3004. protocol: "printing",
  3005. fn: function (){
  3006. var self=this,$self=this;
  3007. return $core.withContext(function($ctx1) {
  3008. return $recv($globals.String)._streamContents_((function(str){
  3009. return $core.withContext(function($ctx2) {
  3010. return $self._printOn_(str);
  3011. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3012. }));
  3013. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3014. },
  3015. args: [],
  3016. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3017. referencedClasses: ["String"],
  3018. messageSends: ["streamContents:", "printOn:"]
  3019. }),
  3020. $globals.ProtoObject);
  3021. $core.addMethod(
  3022. $core.method({
  3023. selector: "yourself",
  3024. protocol: "accessing",
  3025. fn: function (){
  3026. var self=this,$self=this;
  3027. return self;
  3028. },
  3029. args: [],
  3030. source: "yourself\x0a\x09^ self",
  3031. referencedClasses: [],
  3032. messageSends: []
  3033. }),
  3034. $globals.ProtoObject);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "~=",
  3038. protocol: "comparing",
  3039. fn: function (anObject){
  3040. var self=this,$self=this;
  3041. return $core.withContext(function($ctx1) {
  3042. var $1;
  3043. $1=$recv($self.__eq(anObject)).__eq(false);
  3044. $ctx1.sendIdx["="]=1;
  3045. return $1;
  3046. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3047. },
  3048. args: ["anObject"],
  3049. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3050. referencedClasses: [],
  3051. messageSends: ["="]
  3052. }),
  3053. $globals.ProtoObject);
  3054. $core.addMethod(
  3055. $core.method({
  3056. selector: "~~",
  3057. protocol: "comparing",
  3058. fn: function (anObject){
  3059. var self=this,$self=this;
  3060. return $core.withContext(function($ctx1) {
  3061. return $recv($self.__eq_eq(anObject)).__eq(false);
  3062. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3063. },
  3064. args: ["anObject"],
  3065. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3066. referencedClasses: [],
  3067. messageSends: ["=", "=="]
  3068. }),
  3069. $globals.ProtoObject);
  3070. $core.addMethod(
  3071. $core.method({
  3072. selector: "initialize",
  3073. protocol: "initialization",
  3074. fn: function (){
  3075. var self=this,$self=this;
  3076. return self;
  3077. },
  3078. args: [],
  3079. source: "initialize",
  3080. referencedClasses: [],
  3081. messageSends: []
  3082. }),
  3083. $globals.ProtoObject.a$cls);
  3084. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3085. $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.";
  3086. $core.addMethod(
  3087. $core.method({
  3088. selector: "->",
  3089. protocol: "converting",
  3090. fn: function (anObject){
  3091. var self=this,$self=this;
  3092. return $core.withContext(function($ctx1) {
  3093. return $recv($globals.Association)._key_value_(self,anObject);
  3094. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3095. },
  3096. args: ["anObject"],
  3097. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3098. referencedClasses: ["Association"],
  3099. messageSends: ["key:value:"]
  3100. }),
  3101. $globals.Object);
  3102. $core.addMethod(
  3103. $core.method({
  3104. selector: "asJSONString",
  3105. protocol: "converting",
  3106. fn: function (){
  3107. var self=this,$self=this;
  3108. return $core.withContext(function($ctx1) {
  3109. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3110. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3111. },
  3112. args: [],
  3113. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3114. referencedClasses: ["JSON"],
  3115. messageSends: ["stringify:", "asJavaScriptObject"]
  3116. }),
  3117. $globals.Object);
  3118. $core.addMethod(
  3119. $core.method({
  3120. selector: "asJavaScriptObject",
  3121. protocol: "converting",
  3122. fn: function (){
  3123. var self=this,$self=this;
  3124. var variables;
  3125. return $core.withContext(function($ctx1) {
  3126. variables=$recv($globals.HashedCollection)._new();
  3127. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3128. return $core.withContext(function($ctx2) {
  3129. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3131. }));
  3132. return variables;
  3133. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3134. },
  3135. args: [],
  3136. 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",
  3137. referencedClasses: ["HashedCollection"],
  3138. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3139. }),
  3140. $globals.Object);
  3141. $core.addMethod(
  3142. $core.method({
  3143. selector: "asJavaScriptSource",
  3144. protocol: "converting",
  3145. fn: function (){
  3146. var self=this,$self=this;
  3147. return $core.withContext(function($ctx1) {
  3148. return $self._asString();
  3149. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3150. },
  3151. args: [],
  3152. source: "asJavaScriptSource\x0a\x09^ self asString",
  3153. referencedClasses: [],
  3154. messageSends: ["asString"]
  3155. }),
  3156. $globals.Object);
  3157. $core.addMethod(
  3158. $core.method({
  3159. selector: "basicAt:",
  3160. protocol: "accessing",
  3161. fn: function (aString){
  3162. var self=this,$self=this;
  3163. return $core.withContext(function($ctx1) {
  3164. return self[aString];
  3165. return self;
  3166. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3167. },
  3168. args: ["aString"],
  3169. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3170. referencedClasses: [],
  3171. messageSends: []
  3172. }),
  3173. $globals.Object);
  3174. $core.addMethod(
  3175. $core.method({
  3176. selector: "basicAt:put:",
  3177. protocol: "accessing",
  3178. fn: function (aString,anObject){
  3179. var self=this,$self=this;
  3180. return $core.withContext(function($ctx1) {
  3181. return self[aString] = anObject;
  3182. return self;
  3183. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3184. },
  3185. args: ["aString", "anObject"],
  3186. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3187. referencedClasses: [],
  3188. messageSends: []
  3189. }),
  3190. $globals.Object);
  3191. $core.addMethod(
  3192. $core.method({
  3193. selector: "basicDelete:",
  3194. protocol: "accessing",
  3195. fn: function (aString){
  3196. var self=this,$self=this;
  3197. return $core.withContext(function($ctx1) {
  3198. delete self[aString]; return aString;
  3199. return self;
  3200. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3201. },
  3202. args: ["aString"],
  3203. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3204. referencedClasses: [],
  3205. messageSends: []
  3206. }),
  3207. $globals.Object);
  3208. $core.addMethod(
  3209. $core.method({
  3210. selector: "basicPerform:",
  3211. protocol: "message handling",
  3212. fn: function (aString){
  3213. var self=this,$self=this;
  3214. return $core.withContext(function($ctx1) {
  3215. return $self._basicPerform_withArguments_(aString,[]);
  3216. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3217. },
  3218. args: ["aString"],
  3219. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3220. referencedClasses: [],
  3221. messageSends: ["basicPerform:withArguments:"]
  3222. }),
  3223. $globals.Object);
  3224. $core.addMethod(
  3225. $core.method({
  3226. selector: "basicPerform:withArguments:",
  3227. protocol: "message handling",
  3228. fn: function (aString,aCollection){
  3229. var self=this,$self=this;
  3230. return $core.withContext(function($ctx1) {
  3231. return self[aString].apply(self, aCollection);;
  3232. return self;
  3233. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3234. },
  3235. args: ["aString", "aCollection"],
  3236. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3237. referencedClasses: [],
  3238. messageSends: []
  3239. }),
  3240. $globals.Object);
  3241. $core.addMethod(
  3242. $core.method({
  3243. selector: "browse",
  3244. protocol: "browsing",
  3245. fn: function (){
  3246. var self=this,$self=this;
  3247. return $core.withContext(function($ctx1) {
  3248. $recv($globals.Finder)._findClass_($self._class());
  3249. return self;
  3250. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3251. },
  3252. args: [],
  3253. source: "browse\x0a\x09Finder findClass: self class",
  3254. referencedClasses: ["Finder"],
  3255. messageSends: ["findClass:", "class"]
  3256. }),
  3257. $globals.Object);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "copy",
  3261. protocol: "copying",
  3262. fn: function (){
  3263. var self=this,$self=this;
  3264. return $core.withContext(function($ctx1) {
  3265. return $recv($self._shallowCopy())._postCopy();
  3266. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3267. },
  3268. args: [],
  3269. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3270. referencedClasses: [],
  3271. messageSends: ["postCopy", "shallowCopy"]
  3272. }),
  3273. $globals.Object);
  3274. $core.addMethod(
  3275. $core.method({
  3276. selector: "deepCopy",
  3277. protocol: "copying",
  3278. fn: function (){
  3279. var self=this,$self=this;
  3280. return $core.withContext(function($ctx1) {
  3281. var copy = self.a$cls._new();
  3282. Object.keys(self).forEach(function (i) {
  3283. if(/^@.+/.test(i)) {
  3284. copy[i] = $recv(self[i])._deepCopy();
  3285. }
  3286. });
  3287. return copy;
  3288. ;
  3289. return self;
  3290. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3291. },
  3292. args: [],
  3293. 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'>",
  3294. referencedClasses: [],
  3295. messageSends: []
  3296. }),
  3297. $globals.Object);
  3298. $core.addMethod(
  3299. $core.method({
  3300. selector: "deprecatedAPI",
  3301. protocol: "error handling",
  3302. fn: function (){
  3303. var self=this,$self=this;
  3304. return $core.withContext(function($ctx1) {
  3305. var $1,$6,$5,$4,$8,$7,$3,$2;
  3306. $1=console;
  3307. $6=$core.getThisContext()._home();
  3308. $ctx1.sendIdx["home"]=1;
  3309. $5=$recv($6)._asString();
  3310. $ctx1.sendIdx["asString"]=1;
  3311. $4=$recv($5).__comma(" is deprecated! (in ");
  3312. $8=$recv($core.getThisContext()._home())._home();
  3313. $ctx1.sendIdx["home"]=2;
  3314. $7=$recv($8)._asString();
  3315. $3=$recv($4).__comma($7);
  3316. $ctx1.sendIdx[","]=2;
  3317. $2=$recv($3).__comma(")");
  3318. $ctx1.sendIdx[","]=1;
  3319. $recv($1)._warn_($2);
  3320. return self;
  3321. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3322. },
  3323. args: [],
  3324. 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, ')'.",
  3325. referencedClasses: [],
  3326. messageSends: ["warn:", ",", "asString", "home"]
  3327. }),
  3328. $globals.Object);
  3329. $core.addMethod(
  3330. $core.method({
  3331. selector: "deprecatedAPI:",
  3332. protocol: "error handling",
  3333. fn: function (aString){
  3334. var self=this,$self=this;
  3335. return $core.withContext(function($ctx1) {
  3336. var $1,$6,$5,$4,$8,$7,$3,$2;
  3337. $1=console;
  3338. $6=$core.getThisContext()._home();
  3339. $ctx1.sendIdx["home"]=1;
  3340. $5=$recv($6)._asString();
  3341. $ctx1.sendIdx["asString"]=1;
  3342. $4=$recv($5).__comma(" is deprecated! (in ");
  3343. $8=$recv($core.getThisContext()._home())._home();
  3344. $ctx1.sendIdx["home"]=2;
  3345. $7=$recv($8)._asString();
  3346. $3=$recv($4).__comma($7);
  3347. $ctx1.sendIdx[","]=2;
  3348. $2=$recv($3).__comma(")");
  3349. $ctx1.sendIdx[","]=1;
  3350. $recv($1)._warn_($2);
  3351. $ctx1.sendIdx["warn:"]=1;
  3352. $recv(console)._warn_(aString);
  3353. return self;
  3354. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3355. },
  3356. args: ["aString"],
  3357. 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",
  3358. referencedClasses: [],
  3359. messageSends: ["warn:", ",", "asString", "home"]
  3360. }),
  3361. $globals.Object);
  3362. $core.addMethod(
  3363. $core.method({
  3364. selector: "error:",
  3365. protocol: "error handling",
  3366. fn: function (aString){
  3367. var self=this,$self=this;
  3368. return $core.withContext(function($ctx1) {
  3369. $recv($globals.Error)._signal_(aString);
  3370. return self;
  3371. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3372. },
  3373. args: ["aString"],
  3374. source: "error: aString\x0a\x09Error signal: aString",
  3375. referencedClasses: ["Error"],
  3376. messageSends: ["signal:"]
  3377. }),
  3378. $globals.Object);
  3379. $core.addMethod(
  3380. $core.method({
  3381. selector: "halt",
  3382. protocol: "error handling",
  3383. fn: function (){
  3384. var self=this,$self=this;
  3385. return $core.withContext(function($ctx1) {
  3386. $recv($globals.Halt)._signal();
  3387. return self;
  3388. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3389. },
  3390. args: [],
  3391. source: "halt\x0a\x09Halt signal",
  3392. referencedClasses: ["Halt"],
  3393. messageSends: ["signal"]
  3394. }),
  3395. $globals.Object);
  3396. $core.addMethod(
  3397. $core.method({
  3398. selector: "in:",
  3399. protocol: "evaluating",
  3400. fn: function (aValuable){
  3401. var self=this,$self=this;
  3402. return $core.withContext(function($ctx1) {
  3403. return $recv(aValuable)._value_(self);
  3404. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3405. },
  3406. args: ["aValuable"],
  3407. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3408. referencedClasses: [],
  3409. messageSends: ["value:"]
  3410. }),
  3411. $globals.Object);
  3412. $core.addMethod(
  3413. $core.method({
  3414. selector: "isBehavior",
  3415. protocol: "testing",
  3416. fn: function (){
  3417. var self=this,$self=this;
  3418. return false;
  3419. },
  3420. args: [],
  3421. source: "isBehavior\x0a\x09^ false",
  3422. referencedClasses: [],
  3423. messageSends: []
  3424. }),
  3425. $globals.Object);
  3426. $core.addMethod(
  3427. $core.method({
  3428. selector: "isBoolean",
  3429. protocol: "testing",
  3430. fn: function (){
  3431. var self=this,$self=this;
  3432. return false;
  3433. },
  3434. args: [],
  3435. source: "isBoolean\x0a\x09^ false",
  3436. referencedClasses: [],
  3437. messageSends: []
  3438. }),
  3439. $globals.Object);
  3440. $core.addMethod(
  3441. $core.method({
  3442. selector: "isClass",
  3443. protocol: "testing",
  3444. fn: function (){
  3445. var self=this,$self=this;
  3446. return false;
  3447. },
  3448. args: [],
  3449. source: "isClass\x0a\x09^ false",
  3450. referencedClasses: [],
  3451. messageSends: []
  3452. }),
  3453. $globals.Object);
  3454. $core.addMethod(
  3455. $core.method({
  3456. selector: "isCompiledMethod",
  3457. protocol: "testing",
  3458. fn: function (){
  3459. var self=this,$self=this;
  3460. return false;
  3461. },
  3462. args: [],
  3463. source: "isCompiledMethod\x0a\x09^ false",
  3464. referencedClasses: [],
  3465. messageSends: []
  3466. }),
  3467. $globals.Object);
  3468. $core.addMethod(
  3469. $core.method({
  3470. selector: "isImmutable",
  3471. protocol: "testing",
  3472. fn: function (){
  3473. var self=this,$self=this;
  3474. return false;
  3475. },
  3476. args: [],
  3477. source: "isImmutable\x0a\x09^ false",
  3478. referencedClasses: [],
  3479. messageSends: []
  3480. }),
  3481. $globals.Object);
  3482. $core.addMethod(
  3483. $core.method({
  3484. selector: "isMemberOf:",
  3485. protocol: "testing",
  3486. fn: function (aClass){
  3487. var self=this,$self=this;
  3488. return $core.withContext(function($ctx1) {
  3489. return $recv($self._class()).__eq(aClass);
  3490. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3491. },
  3492. args: ["aClass"],
  3493. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3494. referencedClasses: [],
  3495. messageSends: ["=", "class"]
  3496. }),
  3497. $globals.Object);
  3498. $core.addMethod(
  3499. $core.method({
  3500. selector: "isMetaclass",
  3501. protocol: "testing",
  3502. fn: function (){
  3503. var self=this,$self=this;
  3504. return false;
  3505. },
  3506. args: [],
  3507. source: "isMetaclass\x0a\x09^ false",
  3508. referencedClasses: [],
  3509. messageSends: []
  3510. }),
  3511. $globals.Object);
  3512. $core.addMethod(
  3513. $core.method({
  3514. selector: "isNumber",
  3515. protocol: "testing",
  3516. fn: function (){
  3517. var self=this,$self=this;
  3518. return false;
  3519. },
  3520. args: [],
  3521. source: "isNumber\x0a\x09^ false",
  3522. referencedClasses: [],
  3523. messageSends: []
  3524. }),
  3525. $globals.Object);
  3526. $core.addMethod(
  3527. $core.method({
  3528. selector: "isPackage",
  3529. protocol: "testing",
  3530. fn: function (){
  3531. var self=this,$self=this;
  3532. return false;
  3533. },
  3534. args: [],
  3535. source: "isPackage\x0a\x09^ false",
  3536. referencedClasses: [],
  3537. messageSends: []
  3538. }),
  3539. $globals.Object);
  3540. $core.addMethod(
  3541. $core.method({
  3542. selector: "isParseFailure",
  3543. protocol: "testing",
  3544. fn: function (){
  3545. var self=this,$self=this;
  3546. return false;
  3547. },
  3548. args: [],
  3549. source: "isParseFailure\x0a\x09^ false",
  3550. referencedClasses: [],
  3551. messageSends: []
  3552. }),
  3553. $globals.Object);
  3554. $core.addMethod(
  3555. $core.method({
  3556. selector: "isString",
  3557. protocol: "testing",
  3558. fn: function (){
  3559. var self=this,$self=this;
  3560. return false;
  3561. },
  3562. args: [],
  3563. source: "isString\x0a\x09^ false",
  3564. referencedClasses: [],
  3565. messageSends: []
  3566. }),
  3567. $globals.Object);
  3568. $core.addMethod(
  3569. $core.method({
  3570. selector: "isSymbol",
  3571. protocol: "testing",
  3572. fn: function (){
  3573. var self=this,$self=this;
  3574. return false;
  3575. },
  3576. args: [],
  3577. source: "isSymbol\x0a\x09^ false",
  3578. referencedClasses: [],
  3579. messageSends: []
  3580. }),
  3581. $globals.Object);
  3582. $core.addMethod(
  3583. $core.method({
  3584. selector: "postCopy",
  3585. protocol: "copying",
  3586. fn: function (){
  3587. var self=this,$self=this;
  3588. return self;
  3589. },
  3590. args: [],
  3591. source: "postCopy",
  3592. referencedClasses: [],
  3593. messageSends: []
  3594. }),
  3595. $globals.Object);
  3596. $core.addMethod(
  3597. $core.method({
  3598. selector: "putOn:",
  3599. protocol: "streaming",
  3600. fn: function (aStream){
  3601. var self=this,$self=this;
  3602. return $core.withContext(function($ctx1) {
  3603. $recv(aStream)._nextPut_(self);
  3604. return self;
  3605. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3606. },
  3607. args: ["aStream"],
  3608. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3609. referencedClasses: [],
  3610. messageSends: ["nextPut:"]
  3611. }),
  3612. $globals.Object);
  3613. $core.addMethod(
  3614. $core.method({
  3615. selector: "respondsTo:",
  3616. protocol: "testing",
  3617. fn: function (aSelector){
  3618. var self=this,$self=this;
  3619. return $core.withContext(function($ctx1) {
  3620. return $recv($self._class())._canUnderstand_(aSelector);
  3621. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3622. },
  3623. args: ["aSelector"],
  3624. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3625. referencedClasses: [],
  3626. messageSends: ["canUnderstand:", "class"]
  3627. }),
  3628. $globals.Object);
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "shallowCopy",
  3632. protocol: "copying",
  3633. fn: function (){
  3634. var self=this,$self=this;
  3635. return $core.withContext(function($ctx1) {
  3636. var copy = self.a$cls._new();
  3637. Object.keys(self).forEach(function(i) {
  3638. if(/^@.+/.test(i)) {
  3639. copy[i] = self[i];
  3640. }
  3641. });
  3642. return copy;
  3643. ;
  3644. return self;
  3645. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3646. },
  3647. args: [],
  3648. 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'>",
  3649. referencedClasses: [],
  3650. messageSends: []
  3651. }),
  3652. $globals.Object);
  3653. $core.addMethod(
  3654. $core.method({
  3655. selector: "shouldNotImplement",
  3656. protocol: "error handling",
  3657. fn: function (){
  3658. var self=this,$self=this;
  3659. return $core.withContext(function($ctx1) {
  3660. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3661. return self;
  3662. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3663. },
  3664. args: [],
  3665. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3666. referencedClasses: [],
  3667. messageSends: ["error:", ",", "name", "class"]
  3668. }),
  3669. $globals.Object);
  3670. $core.addMethod(
  3671. $core.method({
  3672. selector: "size",
  3673. protocol: "accessing",
  3674. fn: function (){
  3675. var self=this,$self=this;
  3676. return $core.withContext(function($ctx1) {
  3677. $self._error_("Object not indexable");
  3678. return self;
  3679. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3680. },
  3681. args: [],
  3682. source: "size\x0a\x09self error: 'Object not indexable'",
  3683. referencedClasses: [],
  3684. messageSends: ["error:"]
  3685. }),
  3686. $globals.Object);
  3687. $core.addMethod(
  3688. $core.method({
  3689. selector: "subclassResponsibility",
  3690. protocol: "error handling",
  3691. fn: function (){
  3692. var self=this,$self=this;
  3693. return $core.withContext(function($ctx1) {
  3694. $self._error_("This method is a responsibility of a subclass");
  3695. return self;
  3696. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3697. },
  3698. args: [],
  3699. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3700. referencedClasses: [],
  3701. messageSends: ["error:"]
  3702. }),
  3703. $globals.Object);
  3704. $core.addMethod(
  3705. $core.method({
  3706. selector: "value",
  3707. protocol: "evaluating",
  3708. fn: function (){
  3709. var self=this,$self=this;
  3710. return $core.withContext(function($ctx1) {
  3711. return self.valueOf();
  3712. return self;
  3713. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3714. },
  3715. args: [],
  3716. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3717. referencedClasses: [],
  3718. messageSends: []
  3719. }),
  3720. $globals.Object);
  3721. $core.addMethod(
  3722. $core.method({
  3723. selector: "accessorProtocolWith:",
  3724. protocol: "helios",
  3725. fn: function (aGenerator){
  3726. var self=this,$self=this;
  3727. return $core.withContext(function($ctx1) {
  3728. $recv(aGenerator)._accessorProtocolForObject();
  3729. return self;
  3730. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3731. },
  3732. args: ["aGenerator"],
  3733. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3734. referencedClasses: [],
  3735. messageSends: ["accessorProtocolForObject"]
  3736. }),
  3737. $globals.Object.a$cls);
  3738. $core.addMethod(
  3739. $core.method({
  3740. selector: "accessorsSourceCodesWith:",
  3741. protocol: "helios",
  3742. fn: function (aGenerator){
  3743. var self=this,$self=this;
  3744. return $core.withContext(function($ctx1) {
  3745. $recv(aGenerator)._accessorsForObject();
  3746. return self;
  3747. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3748. },
  3749. args: ["aGenerator"],
  3750. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3751. referencedClasses: [],
  3752. messageSends: ["accessorsForObject"]
  3753. }),
  3754. $globals.Object.a$cls);
  3755. $core.addMethod(
  3756. $core.method({
  3757. selector: "initialize",
  3758. protocol: "initialization",
  3759. fn: function (){
  3760. var self=this,$self=this;
  3761. return self;
  3762. },
  3763. args: [],
  3764. source: "initialize\x0a\x09\x22no op\x22",
  3765. referencedClasses: [],
  3766. messageSends: []
  3767. }),
  3768. $globals.Object.a$cls);
  3769. $core.addMethod(
  3770. $core.method({
  3771. selector: "initializeProtocolWith:",
  3772. protocol: "helios",
  3773. fn: function (aGenerator){
  3774. var self=this,$self=this;
  3775. return $core.withContext(function($ctx1) {
  3776. $recv(aGenerator)._initializeProtocolForObject();
  3777. return self;
  3778. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3779. },
  3780. args: ["aGenerator"],
  3781. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3782. referencedClasses: [],
  3783. messageSends: ["initializeProtocolForObject"]
  3784. }),
  3785. $globals.Object.a$cls);
  3786. $core.addMethod(
  3787. $core.method({
  3788. selector: "initializeSourceCodesWith:",
  3789. protocol: "helios",
  3790. fn: function (aGenerator){
  3791. var self=this,$self=this;
  3792. return $core.withContext(function($ctx1) {
  3793. $recv(aGenerator)._initializeForObject();
  3794. return self;
  3795. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3796. },
  3797. args: ["aGenerator"],
  3798. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3799. referencedClasses: [],
  3800. messageSends: ["initializeForObject"]
  3801. }),
  3802. $globals.Object.a$cls);
  3803. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3804. $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: [ ... ]";
  3805. $core.addMethod(
  3806. $core.method({
  3807. selector: "&",
  3808. protocol: "controlling",
  3809. fn: function (aBoolean){
  3810. var self=this,$self=this;
  3811. return $core.withContext(function($ctx1) {
  3812. if(self == true) {
  3813. return aBoolean;
  3814. } else {
  3815. return false;
  3816. }
  3817. ;
  3818. return self;
  3819. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3820. },
  3821. args: ["aBoolean"],
  3822. 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'>",
  3823. referencedClasses: [],
  3824. messageSends: []
  3825. }),
  3826. $globals.Boolean);
  3827. $core.addMethod(
  3828. $core.method({
  3829. selector: "==",
  3830. protocol: "comparing",
  3831. fn: function (aBoolean){
  3832. var self=this,$self=this;
  3833. return $core.withContext(function($ctx1) {
  3834. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3835. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3836. else return false;;
  3837. return self;
  3838. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3839. },
  3840. args: ["aBoolean"],
  3841. 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'>",
  3842. referencedClasses: [],
  3843. messageSends: []
  3844. }),
  3845. $globals.Boolean);
  3846. $core.addMethod(
  3847. $core.method({
  3848. selector: "and:",
  3849. protocol: "controlling",
  3850. fn: function (aBlock){
  3851. var self=this,$self=this;
  3852. return $core.withContext(function($ctx1) {
  3853. if($core.assert(self)){
  3854. return $recv(aBlock)._value();
  3855. } else {
  3856. return false;
  3857. }
  3858. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3859. },
  3860. args: ["aBlock"],
  3861. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3862. referencedClasses: [],
  3863. messageSends: ["ifTrue:ifFalse:", "value"]
  3864. }),
  3865. $globals.Boolean);
  3866. $core.addMethod(
  3867. $core.method({
  3868. selector: "asBit",
  3869. protocol: "converting",
  3870. fn: function (){
  3871. var self=this,$self=this;
  3872. return $core.withContext(function($ctx1) {
  3873. if($core.assert(self)){
  3874. return (1);
  3875. } else {
  3876. return (0);
  3877. }
  3878. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3879. },
  3880. args: [],
  3881. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3882. referencedClasses: [],
  3883. messageSends: ["ifTrue:ifFalse:"]
  3884. }),
  3885. $globals.Boolean);
  3886. $core.addMethod(
  3887. $core.method({
  3888. selector: "asJavaScriptObject",
  3889. protocol: "converting",
  3890. fn: function (){
  3891. var self=this,$self=this;
  3892. return self;
  3893. },
  3894. args: [],
  3895. source: "asJavaScriptObject\x0a\x09^ self",
  3896. referencedClasses: [],
  3897. messageSends: []
  3898. }),
  3899. $globals.Boolean);
  3900. $core.addMethod(
  3901. $core.method({
  3902. selector: "asString",
  3903. protocol: "converting",
  3904. fn: function (){
  3905. var self=this,$self=this;
  3906. return $core.withContext(function($ctx1) {
  3907. return self.toString();
  3908. return self;
  3909. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3910. },
  3911. args: [],
  3912. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3913. referencedClasses: [],
  3914. messageSends: []
  3915. }),
  3916. $globals.Boolean);
  3917. $core.addMethod(
  3918. $core.method({
  3919. selector: "deepCopy",
  3920. protocol: "copying",
  3921. fn: function (){
  3922. var self=this,$self=this;
  3923. return self;
  3924. },
  3925. args: [],
  3926. source: "deepCopy\x0a\x09^ self",
  3927. referencedClasses: [],
  3928. messageSends: []
  3929. }),
  3930. $globals.Boolean);
  3931. $core.addMethod(
  3932. $core.method({
  3933. selector: "ifFalse:",
  3934. protocol: "controlling",
  3935. fn: function (aBlock){
  3936. var self=this,$self=this;
  3937. return $core.withContext(function($ctx1) {
  3938. return $self._ifTrue_ifFalse_((function(){
  3939. }),aBlock);
  3940. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3941. },
  3942. args: ["aBlock"],
  3943. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3944. referencedClasses: [],
  3945. messageSends: ["ifTrue:ifFalse:"]
  3946. }),
  3947. $globals.Boolean);
  3948. $core.addMethod(
  3949. $core.method({
  3950. selector: "ifFalse:ifTrue:",
  3951. protocol: "controlling",
  3952. fn: function (aBlock,anotherBlock){
  3953. var self=this,$self=this;
  3954. return $core.withContext(function($ctx1) {
  3955. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3956. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3957. },
  3958. args: ["aBlock", "anotherBlock"],
  3959. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3960. referencedClasses: [],
  3961. messageSends: ["ifTrue:ifFalse:"]
  3962. }),
  3963. $globals.Boolean);
  3964. $core.addMethod(
  3965. $core.method({
  3966. selector: "ifTrue:",
  3967. protocol: "controlling",
  3968. fn: function (aBlock){
  3969. var self=this,$self=this;
  3970. return $core.withContext(function($ctx1) {
  3971. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3972. }));
  3973. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3974. },
  3975. args: ["aBlock"],
  3976. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3977. referencedClasses: [],
  3978. messageSends: ["ifTrue:ifFalse:"]
  3979. }),
  3980. $globals.Boolean);
  3981. $core.addMethod(
  3982. $core.method({
  3983. selector: "ifTrue:ifFalse:",
  3984. protocol: "controlling",
  3985. fn: function (aBlock,anotherBlock){
  3986. var self=this,$self=this;
  3987. return $core.withContext(function($ctx1) {
  3988. if(self == true) {
  3989. return aBlock._value();
  3990. } else {
  3991. return anotherBlock._value();
  3992. }
  3993. ;
  3994. return self;
  3995. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3996. },
  3997. args: ["aBlock", "anotherBlock"],
  3998. 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'>",
  3999. referencedClasses: [],
  4000. messageSends: []
  4001. }),
  4002. $globals.Boolean);
  4003. $core.addMethod(
  4004. $core.method({
  4005. selector: "isBoolean",
  4006. protocol: "testing",
  4007. fn: function (){
  4008. var self=this,$self=this;
  4009. return true;
  4010. },
  4011. args: [],
  4012. source: "isBoolean\x0a\x09^ true",
  4013. referencedClasses: [],
  4014. messageSends: []
  4015. }),
  4016. $globals.Boolean);
  4017. $core.addMethod(
  4018. $core.method({
  4019. selector: "isImmutable",
  4020. protocol: "testing",
  4021. fn: function (){
  4022. var self=this,$self=this;
  4023. return true;
  4024. },
  4025. args: [],
  4026. source: "isImmutable\x0a\x09^ true",
  4027. referencedClasses: [],
  4028. messageSends: []
  4029. }),
  4030. $globals.Boolean);
  4031. $core.addMethod(
  4032. $core.method({
  4033. selector: "not",
  4034. protocol: "controlling",
  4035. fn: function (){
  4036. var self=this,$self=this;
  4037. return $core.withContext(function($ctx1) {
  4038. return $self.__eq(false);
  4039. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4040. },
  4041. args: [],
  4042. source: "not\x0a\x09^ self = false",
  4043. referencedClasses: [],
  4044. messageSends: ["="]
  4045. }),
  4046. $globals.Boolean);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "or:",
  4050. protocol: "controlling",
  4051. fn: function (aBlock){
  4052. var self=this,$self=this;
  4053. return $core.withContext(function($ctx1) {
  4054. if($core.assert(self)){
  4055. return true;
  4056. } else {
  4057. return $recv(aBlock)._value();
  4058. }
  4059. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4060. },
  4061. args: ["aBlock"],
  4062. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4063. referencedClasses: [],
  4064. messageSends: ["ifTrue:ifFalse:", "value"]
  4065. }),
  4066. $globals.Boolean);
  4067. $core.addMethod(
  4068. $core.method({
  4069. selector: "printOn:",
  4070. protocol: "printing",
  4071. fn: function (aStream){
  4072. var self=this,$self=this;
  4073. return $core.withContext(function($ctx1) {
  4074. $recv(aStream)._nextPutAll_($self._asString());
  4075. return self;
  4076. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4077. },
  4078. args: ["aStream"],
  4079. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4080. referencedClasses: [],
  4081. messageSends: ["nextPutAll:", "asString"]
  4082. }),
  4083. $globals.Boolean);
  4084. $core.addMethod(
  4085. $core.method({
  4086. selector: "shallowCopy",
  4087. protocol: "copying",
  4088. fn: function (){
  4089. var self=this,$self=this;
  4090. return self;
  4091. },
  4092. args: [],
  4093. source: "shallowCopy\x0a\x09^ self",
  4094. referencedClasses: [],
  4095. messageSends: []
  4096. }),
  4097. $globals.Boolean);
  4098. $core.addMethod(
  4099. $core.method({
  4100. selector: "|",
  4101. protocol: "controlling",
  4102. fn: function (aBoolean){
  4103. var self=this,$self=this;
  4104. return $core.withContext(function($ctx1) {
  4105. if(self == true) {
  4106. return true;
  4107. } else {
  4108. return aBoolean;
  4109. }
  4110. ;
  4111. return self;
  4112. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4113. },
  4114. args: ["aBoolean"],
  4115. 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'>",
  4116. referencedClasses: [],
  4117. messageSends: []
  4118. }),
  4119. $globals.Boolean);
  4120. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4121. $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.).";
  4122. $core.addMethod(
  4123. $core.method({
  4124. selector: "+",
  4125. protocol: "arithmetic",
  4126. fn: function (aDate){
  4127. var self=this,$self=this;
  4128. return $core.withContext(function($ctx1) {
  4129. return self + aDate;
  4130. return self;
  4131. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4132. },
  4133. args: ["aDate"],
  4134. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4135. referencedClasses: [],
  4136. messageSends: []
  4137. }),
  4138. $globals.Date);
  4139. $core.addMethod(
  4140. $core.method({
  4141. selector: "-",
  4142. protocol: "arithmetic",
  4143. fn: function (aDate){
  4144. var self=this,$self=this;
  4145. return $core.withContext(function($ctx1) {
  4146. return self - aDate;
  4147. return self;
  4148. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4149. },
  4150. args: ["aDate"],
  4151. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4152. referencedClasses: [],
  4153. messageSends: []
  4154. }),
  4155. $globals.Date);
  4156. $core.addMethod(
  4157. $core.method({
  4158. selector: "<",
  4159. protocol: "comparing",
  4160. fn: function (aDate){
  4161. var self=this,$self=this;
  4162. return $core.withContext(function($ctx1) {
  4163. return self < aDate;
  4164. return self;
  4165. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4166. },
  4167. args: ["aDate"],
  4168. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4169. referencedClasses: [],
  4170. messageSends: []
  4171. }),
  4172. $globals.Date);
  4173. $core.addMethod(
  4174. $core.method({
  4175. selector: "<=",
  4176. protocol: "comparing",
  4177. fn: function (aDate){
  4178. var self=this,$self=this;
  4179. return $core.withContext(function($ctx1) {
  4180. return self <= aDate;
  4181. return self;
  4182. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4183. },
  4184. args: ["aDate"],
  4185. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4186. referencedClasses: [],
  4187. messageSends: []
  4188. }),
  4189. $globals.Date);
  4190. $core.addMethod(
  4191. $core.method({
  4192. selector: "=",
  4193. protocol: "comparing",
  4194. fn: function (aDate){
  4195. var self=this,$self=this;
  4196. return $core.withContext(function($ctx1) {
  4197. var $2,$1,$3;
  4198. $2=$recv(aDate)._class();
  4199. $ctx1.sendIdx["class"]=1;
  4200. $1=$recv($2).__eq_eq($self._class());
  4201. $ctx1.sendIdx["=="]=1;
  4202. return $recv($1)._and_((function(){
  4203. return $core.withContext(function($ctx2) {
  4204. $3=$self._asMilliseconds();
  4205. $ctx2.sendIdx["asMilliseconds"]=1;
  4206. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4208. }));
  4209. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4210. },
  4211. args: ["aDate"],
  4212. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4213. referencedClasses: [],
  4214. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4215. }),
  4216. $globals.Date);
  4217. $core.addMethod(
  4218. $core.method({
  4219. selector: ">",
  4220. protocol: "comparing",
  4221. fn: function (aDate){
  4222. var self=this,$self=this;
  4223. return $core.withContext(function($ctx1) {
  4224. return self > aDate;
  4225. return self;
  4226. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4227. },
  4228. args: ["aDate"],
  4229. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4230. referencedClasses: [],
  4231. messageSends: []
  4232. }),
  4233. $globals.Date);
  4234. $core.addMethod(
  4235. $core.method({
  4236. selector: ">=",
  4237. protocol: "comparing",
  4238. fn: function (aDate){
  4239. var self=this,$self=this;
  4240. return $core.withContext(function($ctx1) {
  4241. return self >= aDate;
  4242. return self;
  4243. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4244. },
  4245. args: ["aDate"],
  4246. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4247. referencedClasses: [],
  4248. messageSends: []
  4249. }),
  4250. $globals.Date);
  4251. $core.addMethod(
  4252. $core.method({
  4253. selector: "asDateString",
  4254. protocol: "converting",
  4255. fn: function (){
  4256. var self=this,$self=this;
  4257. return $core.withContext(function($ctx1) {
  4258. return self.toDateString();
  4259. return self;
  4260. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4261. },
  4262. args: [],
  4263. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4264. referencedClasses: [],
  4265. messageSends: []
  4266. }),
  4267. $globals.Date);
  4268. $core.addMethod(
  4269. $core.method({
  4270. selector: "asLocaleString",
  4271. protocol: "converting",
  4272. fn: function (){
  4273. var self=this,$self=this;
  4274. return $core.withContext(function($ctx1) {
  4275. return self.toLocaleString();
  4276. return self;
  4277. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4278. },
  4279. args: [],
  4280. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4281. referencedClasses: [],
  4282. messageSends: []
  4283. }),
  4284. $globals.Date);
  4285. $core.addMethod(
  4286. $core.method({
  4287. selector: "asMilliseconds",
  4288. protocol: "converting",
  4289. fn: function (){
  4290. var self=this,$self=this;
  4291. return $core.withContext(function($ctx1) {
  4292. return $self._time();
  4293. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4294. },
  4295. args: [],
  4296. source: "asMilliseconds\x0a\x09^ self time",
  4297. referencedClasses: [],
  4298. messageSends: ["time"]
  4299. }),
  4300. $globals.Date);
  4301. $core.addMethod(
  4302. $core.method({
  4303. selector: "asNumber",
  4304. protocol: "converting",
  4305. fn: function (){
  4306. var self=this,$self=this;
  4307. return $core.withContext(function($ctx1) {
  4308. return $self._asMilliseconds();
  4309. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4310. },
  4311. args: [],
  4312. source: "asNumber\x0a\x09^ self asMilliseconds",
  4313. referencedClasses: [],
  4314. messageSends: ["asMilliseconds"]
  4315. }),
  4316. $globals.Date);
  4317. $core.addMethod(
  4318. $core.method({
  4319. selector: "asString",
  4320. protocol: "converting",
  4321. fn: function (){
  4322. var self=this,$self=this;
  4323. return $core.withContext(function($ctx1) {
  4324. return self.toString();
  4325. return self;
  4326. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4327. },
  4328. args: [],
  4329. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4330. referencedClasses: [],
  4331. messageSends: []
  4332. }),
  4333. $globals.Date);
  4334. $core.addMethod(
  4335. $core.method({
  4336. selector: "asTimeString",
  4337. protocol: "converting",
  4338. fn: function (){
  4339. var self=this,$self=this;
  4340. return $core.withContext(function($ctx1) {
  4341. return self.toTimeString();
  4342. return self;
  4343. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4344. },
  4345. args: [],
  4346. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4347. referencedClasses: [],
  4348. messageSends: []
  4349. }),
  4350. $globals.Date);
  4351. $core.addMethod(
  4352. $core.method({
  4353. selector: "day",
  4354. protocol: "accessing",
  4355. fn: function (){
  4356. var self=this,$self=this;
  4357. return $core.withContext(function($ctx1) {
  4358. return $self._dayOfWeek();
  4359. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4360. },
  4361. args: [],
  4362. source: "day\x0a\x09^ self dayOfWeek",
  4363. referencedClasses: [],
  4364. messageSends: ["dayOfWeek"]
  4365. }),
  4366. $globals.Date);
  4367. $core.addMethod(
  4368. $core.method({
  4369. selector: "day:",
  4370. protocol: "accessing",
  4371. fn: function (aNumber){
  4372. var self=this,$self=this;
  4373. return $core.withContext(function($ctx1) {
  4374. $self._dayOfWeek_(aNumber);
  4375. return self;
  4376. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4377. },
  4378. args: ["aNumber"],
  4379. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4380. referencedClasses: [],
  4381. messageSends: ["dayOfWeek:"]
  4382. }),
  4383. $globals.Date);
  4384. $core.addMethod(
  4385. $core.method({
  4386. selector: "dayOfMonth",
  4387. protocol: "accessing",
  4388. fn: function (){
  4389. var self=this,$self=this;
  4390. return $core.withContext(function($ctx1) {
  4391. return self.getDate();
  4392. return self;
  4393. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4394. },
  4395. args: [],
  4396. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4397. referencedClasses: [],
  4398. messageSends: []
  4399. }),
  4400. $globals.Date);
  4401. $core.addMethod(
  4402. $core.method({
  4403. selector: "dayOfMonth:",
  4404. protocol: "accessing",
  4405. fn: function (aNumber){
  4406. var self=this,$self=this;
  4407. return $core.withContext(function($ctx1) {
  4408. self.setDate(aNumber);
  4409. return self;
  4410. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4411. },
  4412. args: ["aNumber"],
  4413. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4414. referencedClasses: [],
  4415. messageSends: []
  4416. }),
  4417. $globals.Date);
  4418. $core.addMethod(
  4419. $core.method({
  4420. selector: "dayOfWeek",
  4421. protocol: "accessing",
  4422. fn: function (){
  4423. var self=this,$self=this;
  4424. return $core.withContext(function($ctx1) {
  4425. return self.getDay() + 1;
  4426. return self;
  4427. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4428. },
  4429. args: [],
  4430. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4431. referencedClasses: [],
  4432. messageSends: []
  4433. }),
  4434. $globals.Date);
  4435. $core.addMethod(
  4436. $core.method({
  4437. selector: "dayOfWeek:",
  4438. protocol: "accessing",
  4439. fn: function (aNumber){
  4440. var self=this,$self=this;
  4441. return $core.withContext(function($ctx1) {
  4442. return self.setDay(aNumber - 1);
  4443. return self;
  4444. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4445. },
  4446. args: ["aNumber"],
  4447. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4448. referencedClasses: [],
  4449. messageSends: []
  4450. }),
  4451. $globals.Date);
  4452. $core.addMethod(
  4453. $core.method({
  4454. selector: "hours",
  4455. protocol: "accessing",
  4456. fn: function (){
  4457. var self=this,$self=this;
  4458. return $core.withContext(function($ctx1) {
  4459. return self.getHours();
  4460. return self;
  4461. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4462. },
  4463. args: [],
  4464. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4465. referencedClasses: [],
  4466. messageSends: []
  4467. }),
  4468. $globals.Date);
  4469. $core.addMethod(
  4470. $core.method({
  4471. selector: "hours:",
  4472. protocol: "accessing",
  4473. fn: function (aNumber){
  4474. var self=this,$self=this;
  4475. return $core.withContext(function($ctx1) {
  4476. self.setHours(aNumber);
  4477. return self;
  4478. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4479. },
  4480. args: ["aNumber"],
  4481. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4482. referencedClasses: [],
  4483. messageSends: []
  4484. }),
  4485. $globals.Date);
  4486. $core.addMethod(
  4487. $core.method({
  4488. selector: "milliseconds",
  4489. protocol: "accessing",
  4490. fn: function (){
  4491. var self=this,$self=this;
  4492. return $core.withContext(function($ctx1) {
  4493. return self.getMilliseconds();
  4494. return self;
  4495. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4496. },
  4497. args: [],
  4498. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4499. referencedClasses: [],
  4500. messageSends: []
  4501. }),
  4502. $globals.Date);
  4503. $core.addMethod(
  4504. $core.method({
  4505. selector: "milliseconds:",
  4506. protocol: "accessing",
  4507. fn: function (aNumber){
  4508. var self=this,$self=this;
  4509. return $core.withContext(function($ctx1) {
  4510. self.setMilliseconds(aNumber);
  4511. return self;
  4512. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4513. },
  4514. args: ["aNumber"],
  4515. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4516. referencedClasses: [],
  4517. messageSends: []
  4518. }),
  4519. $globals.Date);
  4520. $core.addMethod(
  4521. $core.method({
  4522. selector: "minutes",
  4523. protocol: "accessing",
  4524. fn: function (){
  4525. var self=this,$self=this;
  4526. return $core.withContext(function($ctx1) {
  4527. return self.getMinutes();
  4528. return self;
  4529. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4530. },
  4531. args: [],
  4532. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4533. referencedClasses: [],
  4534. messageSends: []
  4535. }),
  4536. $globals.Date);
  4537. $core.addMethod(
  4538. $core.method({
  4539. selector: "minutes:",
  4540. protocol: "accessing",
  4541. fn: function (aNumber){
  4542. var self=this,$self=this;
  4543. return $core.withContext(function($ctx1) {
  4544. self.setMinutes(aNumber);
  4545. return self;
  4546. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4547. },
  4548. args: ["aNumber"],
  4549. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4550. referencedClasses: [],
  4551. messageSends: []
  4552. }),
  4553. $globals.Date);
  4554. $core.addMethod(
  4555. $core.method({
  4556. selector: "month",
  4557. protocol: "accessing",
  4558. fn: function (){
  4559. var self=this,$self=this;
  4560. return $core.withContext(function($ctx1) {
  4561. return self.getMonth() + 1;
  4562. return self;
  4563. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4564. },
  4565. args: [],
  4566. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4567. referencedClasses: [],
  4568. messageSends: []
  4569. }),
  4570. $globals.Date);
  4571. $core.addMethod(
  4572. $core.method({
  4573. selector: "month:",
  4574. protocol: "accessing",
  4575. fn: function (aNumber){
  4576. var self=this,$self=this;
  4577. return $core.withContext(function($ctx1) {
  4578. self.setMonth(aNumber - 1);
  4579. return self;
  4580. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4581. },
  4582. args: ["aNumber"],
  4583. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4584. referencedClasses: [],
  4585. messageSends: []
  4586. }),
  4587. $globals.Date);
  4588. $core.addMethod(
  4589. $core.method({
  4590. selector: "printOn:",
  4591. protocol: "printing",
  4592. fn: function (aStream){
  4593. var self=this,$self=this;
  4594. return $core.withContext(function($ctx1) {
  4595. $recv(aStream)._nextPutAll_($self._asString());
  4596. return self;
  4597. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4598. },
  4599. args: ["aStream"],
  4600. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4601. referencedClasses: [],
  4602. messageSends: ["nextPutAll:", "asString"]
  4603. }),
  4604. $globals.Date);
  4605. $core.addMethod(
  4606. $core.method({
  4607. selector: "seconds",
  4608. protocol: "accessing",
  4609. fn: function (){
  4610. var self=this,$self=this;
  4611. return $core.withContext(function($ctx1) {
  4612. return self.getSeconds();
  4613. return self;
  4614. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4615. },
  4616. args: [],
  4617. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4618. referencedClasses: [],
  4619. messageSends: []
  4620. }),
  4621. $globals.Date);
  4622. $core.addMethod(
  4623. $core.method({
  4624. selector: "seconds:",
  4625. protocol: "accessing",
  4626. fn: function (aNumber){
  4627. var self=this,$self=this;
  4628. return $core.withContext(function($ctx1) {
  4629. self.setSeconds(aNumber);
  4630. return self;
  4631. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4632. },
  4633. args: ["aNumber"],
  4634. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4635. referencedClasses: [],
  4636. messageSends: []
  4637. }),
  4638. $globals.Date);
  4639. $core.addMethod(
  4640. $core.method({
  4641. selector: "time",
  4642. protocol: "accessing",
  4643. fn: function (){
  4644. var self=this,$self=this;
  4645. return $core.withContext(function($ctx1) {
  4646. return self.getTime();
  4647. return self;
  4648. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4649. },
  4650. args: [],
  4651. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4652. referencedClasses: [],
  4653. messageSends: []
  4654. }),
  4655. $globals.Date);
  4656. $core.addMethod(
  4657. $core.method({
  4658. selector: "time:",
  4659. protocol: "accessing",
  4660. fn: function (aNumber){
  4661. var self=this,$self=this;
  4662. return $core.withContext(function($ctx1) {
  4663. self.setTime(aNumber);
  4664. return self;
  4665. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4666. },
  4667. args: ["aNumber"],
  4668. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4669. referencedClasses: [],
  4670. messageSends: []
  4671. }),
  4672. $globals.Date);
  4673. $core.addMethod(
  4674. $core.method({
  4675. selector: "year",
  4676. protocol: "accessing",
  4677. fn: function (){
  4678. var self=this,$self=this;
  4679. return $core.withContext(function($ctx1) {
  4680. return self.getFullYear();
  4681. return self;
  4682. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4683. },
  4684. args: [],
  4685. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4686. referencedClasses: [],
  4687. messageSends: []
  4688. }),
  4689. $globals.Date);
  4690. $core.addMethod(
  4691. $core.method({
  4692. selector: "year:",
  4693. protocol: "accessing",
  4694. fn: function (aNumber){
  4695. var self=this,$self=this;
  4696. return $core.withContext(function($ctx1) {
  4697. self.setFullYear(aNumber);
  4698. return self;
  4699. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4700. },
  4701. args: ["aNumber"],
  4702. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4703. referencedClasses: [],
  4704. messageSends: []
  4705. }),
  4706. $globals.Date);
  4707. $core.addMethod(
  4708. $core.method({
  4709. selector: "classTag",
  4710. protocol: "accessing",
  4711. fn: function (){
  4712. var self=this,$self=this;
  4713. return "magnitude";
  4714. },
  4715. args: [],
  4716. 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'",
  4717. referencedClasses: [],
  4718. messageSends: []
  4719. }),
  4720. $globals.Date.a$cls);
  4721. $core.addMethod(
  4722. $core.method({
  4723. selector: "fromMilliseconds:",
  4724. protocol: "instance creation",
  4725. fn: function (aNumber){
  4726. var self=this,$self=this;
  4727. return $core.withContext(function($ctx1) {
  4728. return $self._new_(aNumber);
  4729. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4730. },
  4731. args: ["aNumber"],
  4732. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4733. referencedClasses: [],
  4734. messageSends: ["new:"]
  4735. }),
  4736. $globals.Date.a$cls);
  4737. $core.addMethod(
  4738. $core.method({
  4739. selector: "fromSeconds:",
  4740. protocol: "instance creation",
  4741. fn: function (aNumber){
  4742. var self=this,$self=this;
  4743. return $core.withContext(function($ctx1) {
  4744. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4745. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4746. },
  4747. args: ["aNumber"],
  4748. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4749. referencedClasses: [],
  4750. messageSends: ["fromMilliseconds:", "*"]
  4751. }),
  4752. $globals.Date.a$cls);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "fromString:",
  4756. protocol: "instance creation",
  4757. fn: function (aString){
  4758. var self=this,$self=this;
  4759. return $core.withContext(function($ctx1) {
  4760. return $self._new_(aString);
  4761. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4762. },
  4763. args: ["aString"],
  4764. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4765. referencedClasses: [],
  4766. messageSends: ["new:"]
  4767. }),
  4768. $globals.Date.a$cls);
  4769. $core.addMethod(
  4770. $core.method({
  4771. selector: "millisecondsToRun:",
  4772. protocol: "instance creation",
  4773. fn: function (aBlock){
  4774. var self=this,$self=this;
  4775. var t;
  4776. return $core.withContext(function($ctx1) {
  4777. t=$recv($globals.Date)._now();
  4778. $ctx1.sendIdx["now"]=1;
  4779. $recv(aBlock)._value();
  4780. return $recv($recv($globals.Date)._now()).__minus(t);
  4781. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4782. },
  4783. args: ["aBlock"],
  4784. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4785. referencedClasses: ["Date"],
  4786. messageSends: ["now", "value", "-"]
  4787. }),
  4788. $globals.Date.a$cls);
  4789. $core.addMethod(
  4790. $core.method({
  4791. selector: "new:",
  4792. protocol: "instance creation",
  4793. fn: function (anObject){
  4794. var self=this,$self=this;
  4795. return $core.withContext(function($ctx1) {
  4796. return new Date(anObject);
  4797. return self;
  4798. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4799. },
  4800. args: ["anObject"],
  4801. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4802. referencedClasses: [],
  4803. messageSends: []
  4804. }),
  4805. $globals.Date.a$cls);
  4806. $core.addMethod(
  4807. $core.method({
  4808. selector: "now",
  4809. protocol: "instance creation",
  4810. fn: function (){
  4811. var self=this,$self=this;
  4812. return $core.withContext(function($ctx1) {
  4813. return $self._today();
  4814. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4815. },
  4816. args: [],
  4817. source: "now\x0a\x09^ self today",
  4818. referencedClasses: [],
  4819. messageSends: ["today"]
  4820. }),
  4821. $globals.Date.a$cls);
  4822. $core.addMethod(
  4823. $core.method({
  4824. selector: "today",
  4825. protocol: "instance creation",
  4826. fn: function (){
  4827. var self=this,$self=this;
  4828. return $core.withContext(function($ctx1) {
  4829. return $self._new();
  4830. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4831. },
  4832. args: [],
  4833. source: "today\x0a\x09^ self new",
  4834. referencedClasses: [],
  4835. messageSends: ["new"]
  4836. }),
  4837. $globals.Date.a$cls);
  4838. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4839. $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 ].";
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "&",
  4843. protocol: "converting",
  4844. fn: function (aNumber){
  4845. var self=this,$self=this;
  4846. return $core.withContext(function($ctx1) {
  4847. return self & aNumber;
  4848. return self;
  4849. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4850. },
  4851. args: ["aNumber"],
  4852. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4853. referencedClasses: [],
  4854. messageSends: []
  4855. }),
  4856. $globals.Number);
  4857. $core.addMethod(
  4858. $core.method({
  4859. selector: "*",
  4860. protocol: "arithmetic",
  4861. fn: function (aNumber){
  4862. var self=this,$self=this;
  4863. return $core.withContext(function($ctx1) {
  4864. return self * aNumber;
  4865. return self;
  4866. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4867. },
  4868. args: ["aNumber"],
  4869. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4870. referencedClasses: [],
  4871. messageSends: []
  4872. }),
  4873. $globals.Number);
  4874. $core.addMethod(
  4875. $core.method({
  4876. selector: "**",
  4877. protocol: "mathematical functions",
  4878. fn: function (exponent){
  4879. var self=this,$self=this;
  4880. return $core.withContext(function($ctx1) {
  4881. return $self._raisedTo_(exponent);
  4882. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4883. },
  4884. args: ["exponent"],
  4885. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4886. referencedClasses: [],
  4887. messageSends: ["raisedTo:"]
  4888. }),
  4889. $globals.Number);
  4890. $core.addMethod(
  4891. $core.method({
  4892. selector: "+",
  4893. protocol: "arithmetic",
  4894. fn: function (aNumber){
  4895. var self=this,$self=this;
  4896. return $core.withContext(function($ctx1) {
  4897. return self + aNumber;
  4898. return self;
  4899. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4900. },
  4901. args: ["aNumber"],
  4902. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4903. referencedClasses: [],
  4904. messageSends: []
  4905. }),
  4906. $globals.Number);
  4907. $core.addMethod(
  4908. $core.method({
  4909. selector: "-",
  4910. protocol: "arithmetic",
  4911. fn: function (aNumber){
  4912. var self=this,$self=this;
  4913. return $core.withContext(function($ctx1) {
  4914. return self - aNumber;
  4915. return self;
  4916. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4917. },
  4918. args: ["aNumber"],
  4919. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4920. referencedClasses: [],
  4921. messageSends: []
  4922. }),
  4923. $globals.Number);
  4924. $core.addMethod(
  4925. $core.method({
  4926. selector: "/",
  4927. protocol: "arithmetic",
  4928. fn: function (aNumber){
  4929. var self=this,$self=this;
  4930. return $core.withContext(function($ctx1) {
  4931. return self / aNumber;
  4932. return self;
  4933. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4934. },
  4935. args: ["aNumber"],
  4936. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4937. referencedClasses: [],
  4938. messageSends: []
  4939. }),
  4940. $globals.Number);
  4941. $core.addMethod(
  4942. $core.method({
  4943. selector: "//",
  4944. protocol: "arithmetic",
  4945. fn: function (aNumber){
  4946. var self=this,$self=this;
  4947. return $core.withContext(function($ctx1) {
  4948. return $recv($self.__slash(aNumber))._floor();
  4949. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4950. },
  4951. args: ["aNumber"],
  4952. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4953. referencedClasses: [],
  4954. messageSends: ["floor", "/"]
  4955. }),
  4956. $globals.Number);
  4957. $core.addMethod(
  4958. $core.method({
  4959. selector: "<",
  4960. protocol: "comparing",
  4961. fn: function (aNumber){
  4962. var self=this,$self=this;
  4963. return $core.withContext(function($ctx1) {
  4964. return self < aNumber;
  4965. return self;
  4966. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4967. },
  4968. args: ["aNumber"],
  4969. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4970. referencedClasses: [],
  4971. messageSends: []
  4972. }),
  4973. $globals.Number);
  4974. $core.addMethod(
  4975. $core.method({
  4976. selector: "<=",
  4977. protocol: "comparing",
  4978. fn: function (aNumber){
  4979. var self=this,$self=this;
  4980. return $core.withContext(function($ctx1) {
  4981. return self <= aNumber;
  4982. return self;
  4983. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4984. },
  4985. args: ["aNumber"],
  4986. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4987. referencedClasses: [],
  4988. messageSends: []
  4989. }),
  4990. $globals.Number);
  4991. $core.addMethod(
  4992. $core.method({
  4993. selector: "==",
  4994. protocol: "comparing",
  4995. fn: function (aNumber){
  4996. var self=this,$self=this;
  4997. return $core.withContext(function($ctx1) {
  4998. if (typeof aNumber === "number") return Number(self) === aNumber;
  4999. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5000. else return false;;
  5001. return self;
  5002. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5003. },
  5004. args: ["aNumber"],
  5005. 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'>",
  5006. referencedClasses: [],
  5007. messageSends: []
  5008. }),
  5009. $globals.Number);
  5010. $core.addMethod(
  5011. $core.method({
  5012. selector: ">",
  5013. protocol: "comparing",
  5014. fn: function (aNumber){
  5015. var self=this,$self=this;
  5016. return $core.withContext(function($ctx1) {
  5017. return self > aNumber;
  5018. return self;
  5019. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5020. },
  5021. args: ["aNumber"],
  5022. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5023. referencedClasses: [],
  5024. messageSends: []
  5025. }),
  5026. $globals.Number);
  5027. $core.addMethod(
  5028. $core.method({
  5029. selector: ">=",
  5030. protocol: "comparing",
  5031. fn: function (aNumber){
  5032. var self=this,$self=this;
  5033. return $core.withContext(function($ctx1) {
  5034. return self >= aNumber;
  5035. return self;
  5036. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5037. },
  5038. args: ["aNumber"],
  5039. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5040. referencedClasses: [],
  5041. messageSends: []
  5042. }),
  5043. $globals.Number);
  5044. $core.addMethod(
  5045. $core.method({
  5046. selector: "@",
  5047. protocol: "converting",
  5048. fn: function (aNumber){
  5049. var self=this,$self=this;
  5050. return $core.withContext(function($ctx1) {
  5051. return $recv($globals.Point)._x_y_(self,aNumber);
  5052. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5053. },
  5054. args: ["aNumber"],
  5055. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5056. referencedClasses: ["Point"],
  5057. messageSends: ["x:y:"]
  5058. }),
  5059. $globals.Number);
  5060. $core.addMethod(
  5061. $core.method({
  5062. selector: "\x5c\x5c",
  5063. protocol: "arithmetic",
  5064. fn: function (aNumber){
  5065. var self=this,$self=this;
  5066. return $core.withContext(function($ctx1) {
  5067. return self % aNumber;
  5068. return self;
  5069. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5070. },
  5071. args: ["aNumber"],
  5072. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5073. referencedClasses: [],
  5074. messageSends: []
  5075. }),
  5076. $globals.Number);
  5077. $core.addMethod(
  5078. $core.method({
  5079. selector: "abs",
  5080. protocol: "arithmetic",
  5081. fn: function (){
  5082. var self=this,$self=this;
  5083. return $core.withContext(function($ctx1) {
  5084. return Math.abs(self);;
  5085. return self;
  5086. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5087. },
  5088. args: [],
  5089. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5090. referencedClasses: [],
  5091. messageSends: []
  5092. }),
  5093. $globals.Number);
  5094. $core.addMethod(
  5095. $core.method({
  5096. selector: "arcCos",
  5097. protocol: "mathematical functions",
  5098. fn: function (){
  5099. var self=this,$self=this;
  5100. return $core.withContext(function($ctx1) {
  5101. return Math.acos(self);;
  5102. return self;
  5103. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5104. },
  5105. args: [],
  5106. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5107. referencedClasses: [],
  5108. messageSends: []
  5109. }),
  5110. $globals.Number);
  5111. $core.addMethod(
  5112. $core.method({
  5113. selector: "arcSin",
  5114. protocol: "mathematical functions",
  5115. fn: function (){
  5116. var self=this,$self=this;
  5117. return $core.withContext(function($ctx1) {
  5118. return Math.asin(self);;
  5119. return self;
  5120. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5121. },
  5122. args: [],
  5123. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5124. referencedClasses: [],
  5125. messageSends: []
  5126. }),
  5127. $globals.Number);
  5128. $core.addMethod(
  5129. $core.method({
  5130. selector: "arcTan",
  5131. protocol: "mathematical functions",
  5132. fn: function (){
  5133. var self=this,$self=this;
  5134. return $core.withContext(function($ctx1) {
  5135. return Math.atan(self);;
  5136. return self;
  5137. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5138. },
  5139. args: [],
  5140. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5141. referencedClasses: [],
  5142. messageSends: []
  5143. }),
  5144. $globals.Number);
  5145. $core.addMethod(
  5146. $core.method({
  5147. selector: "arcTan:",
  5148. protocol: "mathematical functions",
  5149. fn: function (aNumber){
  5150. var self=this,$self=this;
  5151. return $core.withContext(function($ctx1) {
  5152. return Math.atan2(self, aNumber);;
  5153. return self;
  5154. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5155. },
  5156. args: ["aNumber"],
  5157. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5158. referencedClasses: [],
  5159. messageSends: []
  5160. }),
  5161. $globals.Number);
  5162. $core.addMethod(
  5163. $core.method({
  5164. selector: "asJavaScriptObject",
  5165. protocol: "converting",
  5166. fn: function (){
  5167. var self=this,$self=this;
  5168. return self;
  5169. },
  5170. args: [],
  5171. source: "asJavaScriptObject\x0a\x09^ self",
  5172. referencedClasses: [],
  5173. messageSends: []
  5174. }),
  5175. $globals.Number);
  5176. $core.addMethod(
  5177. $core.method({
  5178. selector: "asJavaScriptSource",
  5179. protocol: "converting",
  5180. fn: function (){
  5181. var self=this,$self=this;
  5182. return $core.withContext(function($ctx1) {
  5183. var $1;
  5184. $1=$recv("(".__comma($self._printString())).__comma(")");
  5185. $ctx1.sendIdx[","]=1;
  5186. return $1;
  5187. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5188. },
  5189. args: [],
  5190. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5191. referencedClasses: [],
  5192. messageSends: [",", "printString"]
  5193. }),
  5194. $globals.Number);
  5195. $core.addMethod(
  5196. $core.method({
  5197. selector: "asNumber",
  5198. protocol: "converting",
  5199. fn: function (){
  5200. var self=this,$self=this;
  5201. return self;
  5202. },
  5203. args: [],
  5204. source: "asNumber\x0a\x09^ self",
  5205. referencedClasses: [],
  5206. messageSends: []
  5207. }),
  5208. $globals.Number);
  5209. $core.addMethod(
  5210. $core.method({
  5211. selector: "asPoint",
  5212. protocol: "converting",
  5213. fn: function (){
  5214. var self=this,$self=this;
  5215. return $core.withContext(function($ctx1) {
  5216. return $recv($globals.Point)._x_y_(self,self);
  5217. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5218. },
  5219. args: [],
  5220. source: "asPoint\x0a\x09^ Point x: self y: self",
  5221. referencedClasses: ["Point"],
  5222. messageSends: ["x:y:"]
  5223. }),
  5224. $globals.Number);
  5225. $core.addMethod(
  5226. $core.method({
  5227. selector: "asString",
  5228. protocol: "converting",
  5229. fn: function (){
  5230. var self=this,$self=this;
  5231. return $core.withContext(function($ctx1) {
  5232. return String(self);
  5233. return self;
  5234. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5235. },
  5236. args: [],
  5237. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5238. referencedClasses: [],
  5239. messageSends: []
  5240. }),
  5241. $globals.Number);
  5242. $core.addMethod(
  5243. $core.method({
  5244. selector: "atRandom",
  5245. protocol: "converting",
  5246. fn: function (){
  5247. var self=this,$self=this;
  5248. return $core.withContext(function($ctx1) {
  5249. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5250. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5251. },
  5252. args: [],
  5253. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5254. referencedClasses: ["Random"],
  5255. messageSends: ["+", "truncated", "*", "next", "new"]
  5256. }),
  5257. $globals.Number);
  5258. $core.addMethod(
  5259. $core.method({
  5260. selector: "between:and:",
  5261. protocol: "testing",
  5262. fn: function (min,max){
  5263. var self=this,$self=this;
  5264. return $core.withContext(function($ctx1) {
  5265. return $recv($self.__gt_eq(min))._and_((function(){
  5266. return $core.withContext(function($ctx2) {
  5267. return $self.__lt_eq(max);
  5268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5269. }));
  5270. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5271. },
  5272. args: ["min", "max"],
  5273. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5274. referencedClasses: [],
  5275. messageSends: ["and:", ">=", "<="]
  5276. }),
  5277. $globals.Number);
  5278. $core.addMethod(
  5279. $core.method({
  5280. selector: "bitAnd:",
  5281. protocol: "converting",
  5282. fn: function (aNumber){
  5283. var self=this,$self=this;
  5284. return $core.withContext(function($ctx1) {
  5285. return self & aNumber;
  5286. return self;
  5287. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5288. },
  5289. args: ["aNumber"],
  5290. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5291. referencedClasses: [],
  5292. messageSends: []
  5293. }),
  5294. $globals.Number);
  5295. $core.addMethod(
  5296. $core.method({
  5297. selector: "bitNot",
  5298. protocol: "converting",
  5299. fn: function (){
  5300. var self=this,$self=this;
  5301. return $core.withContext(function($ctx1) {
  5302. return ~self;
  5303. return self;
  5304. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5305. },
  5306. args: [],
  5307. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5308. referencedClasses: [],
  5309. messageSends: []
  5310. }),
  5311. $globals.Number);
  5312. $core.addMethod(
  5313. $core.method({
  5314. selector: "bitOr:",
  5315. protocol: "converting",
  5316. fn: function (aNumber){
  5317. var self=this,$self=this;
  5318. return $core.withContext(function($ctx1) {
  5319. return self | aNumber;
  5320. return self;
  5321. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5322. },
  5323. args: ["aNumber"],
  5324. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5325. referencedClasses: [],
  5326. messageSends: []
  5327. }),
  5328. $globals.Number);
  5329. $core.addMethod(
  5330. $core.method({
  5331. selector: "bitXor:",
  5332. protocol: "converting",
  5333. fn: function (aNumber){
  5334. var self=this,$self=this;
  5335. return $core.withContext(function($ctx1) {
  5336. return self ^ aNumber;
  5337. return self;
  5338. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5339. },
  5340. args: ["aNumber"],
  5341. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5342. referencedClasses: [],
  5343. messageSends: []
  5344. }),
  5345. $globals.Number);
  5346. $core.addMethod(
  5347. $core.method({
  5348. selector: "ceiling",
  5349. protocol: "converting",
  5350. fn: function (){
  5351. var self=this,$self=this;
  5352. return $core.withContext(function($ctx1) {
  5353. return Math.ceil(self);;
  5354. return self;
  5355. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5356. },
  5357. args: [],
  5358. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5359. referencedClasses: [],
  5360. messageSends: []
  5361. }),
  5362. $globals.Number);
  5363. $core.addMethod(
  5364. $core.method({
  5365. selector: "copy",
  5366. protocol: "copying",
  5367. fn: function (){
  5368. var self=this,$self=this;
  5369. return self;
  5370. },
  5371. args: [],
  5372. source: "copy\x0a\x09^ self",
  5373. referencedClasses: [],
  5374. messageSends: []
  5375. }),
  5376. $globals.Number);
  5377. $core.addMethod(
  5378. $core.method({
  5379. selector: "cos",
  5380. protocol: "mathematical functions",
  5381. fn: function (){
  5382. var self=this,$self=this;
  5383. return $core.withContext(function($ctx1) {
  5384. return Math.cos(self);;
  5385. return self;
  5386. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5387. },
  5388. args: [],
  5389. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5390. referencedClasses: [],
  5391. messageSends: []
  5392. }),
  5393. $globals.Number);
  5394. $core.addMethod(
  5395. $core.method({
  5396. selector: "deepCopy",
  5397. protocol: "copying",
  5398. fn: function (){
  5399. var self=this,$self=this;
  5400. return $core.withContext(function($ctx1) {
  5401. return $self._copy();
  5402. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5403. },
  5404. args: [],
  5405. source: "deepCopy\x0a\x09^ self copy",
  5406. referencedClasses: [],
  5407. messageSends: ["copy"]
  5408. }),
  5409. $globals.Number);
  5410. $core.addMethod(
  5411. $core.method({
  5412. selector: "degreesToRadians",
  5413. protocol: "converting",
  5414. fn: function (){
  5415. var self=this,$self=this;
  5416. return $core.withContext(function($ctx1) {
  5417. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5418. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5419. },
  5420. args: [],
  5421. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5422. referencedClasses: ["Number"],
  5423. messageSends: ["*", "radiansPerDegree"]
  5424. }),
  5425. $globals.Number);
  5426. $core.addMethod(
  5427. $core.method({
  5428. selector: "even",
  5429. protocol: "testing",
  5430. fn: function (){
  5431. var self=this,$self=this;
  5432. return $core.withContext(function($ctx1) {
  5433. return (0).__eq($self.__backslash_backslash((2)));
  5434. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5435. },
  5436. args: [],
  5437. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5438. referencedClasses: [],
  5439. messageSends: ["=", "\x5c\x5c"]
  5440. }),
  5441. $globals.Number);
  5442. $core.addMethod(
  5443. $core.method({
  5444. selector: "floor",
  5445. protocol: "converting",
  5446. fn: function (){
  5447. var self=this,$self=this;
  5448. return $core.withContext(function($ctx1) {
  5449. return Math.floor(self);;
  5450. return self;
  5451. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5452. },
  5453. args: [],
  5454. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5455. referencedClasses: [],
  5456. messageSends: []
  5457. }),
  5458. $globals.Number);
  5459. $core.addMethod(
  5460. $core.method({
  5461. selector: "isImmutable",
  5462. protocol: "testing",
  5463. fn: function (){
  5464. var self=this,$self=this;
  5465. return true;
  5466. },
  5467. args: [],
  5468. source: "isImmutable\x0a\x09^ true",
  5469. referencedClasses: [],
  5470. messageSends: []
  5471. }),
  5472. $globals.Number);
  5473. $core.addMethod(
  5474. $core.method({
  5475. selector: "isNumber",
  5476. protocol: "testing",
  5477. fn: function (){
  5478. var self=this,$self=this;
  5479. return true;
  5480. },
  5481. args: [],
  5482. source: "isNumber\x0a\x09^ true",
  5483. referencedClasses: [],
  5484. messageSends: []
  5485. }),
  5486. $globals.Number);
  5487. $core.addMethod(
  5488. $core.method({
  5489. selector: "isZero",
  5490. protocol: "testing",
  5491. fn: function (){
  5492. var self=this,$self=this;
  5493. return $core.withContext(function($ctx1) {
  5494. return $self.__eq((0));
  5495. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5496. },
  5497. args: [],
  5498. source: "isZero\x0a\x09^ self = 0",
  5499. referencedClasses: [],
  5500. messageSends: ["="]
  5501. }),
  5502. $globals.Number);
  5503. $core.addMethod(
  5504. $core.method({
  5505. selector: "ln",
  5506. protocol: "mathematical functions",
  5507. fn: function (){
  5508. var self=this,$self=this;
  5509. return $core.withContext(function($ctx1) {
  5510. return Math.log(self);;
  5511. return self;
  5512. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5513. },
  5514. args: [],
  5515. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5516. referencedClasses: [],
  5517. messageSends: []
  5518. }),
  5519. $globals.Number);
  5520. $core.addMethod(
  5521. $core.method({
  5522. selector: "ln1p",
  5523. protocol: "mathematical functions",
  5524. fn: function (){
  5525. var self=this,$self=this;
  5526. return $core.withContext(function($ctx1) {
  5527. return Math.log1p(self);;
  5528. return self;
  5529. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5530. },
  5531. args: [],
  5532. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5533. referencedClasses: [],
  5534. messageSends: []
  5535. }),
  5536. $globals.Number);
  5537. $core.addMethod(
  5538. $core.method({
  5539. selector: "log",
  5540. protocol: "mathematical functions",
  5541. fn: function (){
  5542. var self=this,$self=this;
  5543. return $core.withContext(function($ctx1) {
  5544. return Math.log(self) / Math.LN10;;
  5545. return self;
  5546. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5547. },
  5548. args: [],
  5549. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5550. referencedClasses: [],
  5551. messageSends: []
  5552. }),
  5553. $globals.Number);
  5554. $core.addMethod(
  5555. $core.method({
  5556. selector: "log:",
  5557. protocol: "mathematical functions",
  5558. fn: function (aNumber){
  5559. var self=this,$self=this;
  5560. return $core.withContext(function($ctx1) {
  5561. return Math.log(self) / Math.log(aNumber);;
  5562. return self;
  5563. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5564. },
  5565. args: ["aNumber"],
  5566. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5567. referencedClasses: [],
  5568. messageSends: []
  5569. }),
  5570. $globals.Number);
  5571. $core.addMethod(
  5572. $core.method({
  5573. selector: "max:",
  5574. protocol: "arithmetic",
  5575. fn: function (aNumber){
  5576. var self=this,$self=this;
  5577. return $core.withContext(function($ctx1) {
  5578. return Math.max(self, aNumber);;
  5579. return self;
  5580. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5581. },
  5582. args: ["aNumber"],
  5583. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5584. referencedClasses: [],
  5585. messageSends: []
  5586. }),
  5587. $globals.Number);
  5588. $core.addMethod(
  5589. $core.method({
  5590. selector: "min:",
  5591. protocol: "arithmetic",
  5592. fn: function (aNumber){
  5593. var self=this,$self=this;
  5594. return $core.withContext(function($ctx1) {
  5595. return Math.min(self, aNumber);;
  5596. return self;
  5597. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5598. },
  5599. args: ["aNumber"],
  5600. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5601. referencedClasses: [],
  5602. messageSends: []
  5603. }),
  5604. $globals.Number);
  5605. $core.addMethod(
  5606. $core.method({
  5607. selector: "min:max:",
  5608. protocol: "arithmetic",
  5609. fn: function (aMin,aMax){
  5610. var self=this,$self=this;
  5611. return $core.withContext(function($ctx1) {
  5612. return $recv($self._min_(aMin))._max_(aMax);
  5613. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5614. },
  5615. args: ["aMin", "aMax"],
  5616. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5617. referencedClasses: [],
  5618. messageSends: ["max:", "min:"]
  5619. }),
  5620. $globals.Number);
  5621. $core.addMethod(
  5622. $core.method({
  5623. selector: "negated",
  5624. protocol: "arithmetic",
  5625. fn: function (){
  5626. var self=this,$self=this;
  5627. return $core.withContext(function($ctx1) {
  5628. return (0).__minus(self);
  5629. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5630. },
  5631. args: [],
  5632. source: "negated\x0a\x09^ 0 - self",
  5633. referencedClasses: [],
  5634. messageSends: ["-"]
  5635. }),
  5636. $globals.Number);
  5637. $core.addMethod(
  5638. $core.method({
  5639. selector: "negative",
  5640. protocol: "testing",
  5641. fn: function (){
  5642. var self=this,$self=this;
  5643. return $core.withContext(function($ctx1) {
  5644. return $self.__lt((0));
  5645. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5646. },
  5647. args: [],
  5648. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5649. referencedClasses: [],
  5650. messageSends: ["<"]
  5651. }),
  5652. $globals.Number);
  5653. $core.addMethod(
  5654. $core.method({
  5655. selector: "odd",
  5656. protocol: "testing",
  5657. fn: function (){
  5658. var self=this,$self=this;
  5659. return $core.withContext(function($ctx1) {
  5660. return $recv($self._even())._not();
  5661. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5662. },
  5663. args: [],
  5664. source: "odd\x0a\x09^ self even not",
  5665. referencedClasses: [],
  5666. messageSends: ["not", "even"]
  5667. }),
  5668. $globals.Number);
  5669. $core.addMethod(
  5670. $core.method({
  5671. selector: "positive",
  5672. protocol: "testing",
  5673. fn: function (){
  5674. var self=this,$self=this;
  5675. return $core.withContext(function($ctx1) {
  5676. return $self.__gt_eq((0));
  5677. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5678. },
  5679. args: [],
  5680. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5681. referencedClasses: [],
  5682. messageSends: [">="]
  5683. }),
  5684. $globals.Number);
  5685. $core.addMethod(
  5686. $core.method({
  5687. selector: "printOn:",
  5688. protocol: "printing",
  5689. fn: function (aStream){
  5690. var self=this,$self=this;
  5691. return $core.withContext(function($ctx1) {
  5692. $recv(aStream)._nextPutAll_($self._asString());
  5693. return self;
  5694. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5695. },
  5696. args: ["aStream"],
  5697. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5698. referencedClasses: [],
  5699. messageSends: ["nextPutAll:", "asString"]
  5700. }),
  5701. $globals.Number);
  5702. $core.addMethod(
  5703. $core.method({
  5704. selector: "printShowingDecimalPlaces:",
  5705. protocol: "printing",
  5706. fn: function (placesDesired){
  5707. var self=this,$self=this;
  5708. return $core.withContext(function($ctx1) {
  5709. return self.toFixed(placesDesired);
  5710. return self;
  5711. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5712. },
  5713. args: ["placesDesired"],
  5714. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5715. referencedClasses: [],
  5716. messageSends: []
  5717. }),
  5718. $globals.Number);
  5719. $core.addMethod(
  5720. $core.method({
  5721. selector: "printStringBase:",
  5722. protocol: "converting",
  5723. fn: function (aBase){
  5724. var self=this,$self=this;
  5725. return $core.withContext(function($ctx1) {
  5726. return self.toString(aBase);
  5727. return self;
  5728. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5729. },
  5730. args: ["aBase"],
  5731. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5732. referencedClasses: [],
  5733. messageSends: []
  5734. }),
  5735. $globals.Number);
  5736. $core.addMethod(
  5737. $core.method({
  5738. selector: "radiansToDegrees",
  5739. protocol: "converting",
  5740. fn: function (){
  5741. var self=this,$self=this;
  5742. return $core.withContext(function($ctx1) {
  5743. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5744. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5745. },
  5746. args: [],
  5747. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5748. referencedClasses: ["Number"],
  5749. messageSends: ["/", "radiansPerDegree"]
  5750. }),
  5751. $globals.Number);
  5752. $core.addMethod(
  5753. $core.method({
  5754. selector: "raisedTo:",
  5755. protocol: "mathematical functions",
  5756. fn: function (exponent){
  5757. var self=this,$self=this;
  5758. return $core.withContext(function($ctx1) {
  5759. return Math.pow(self, exponent);;
  5760. return self;
  5761. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5762. },
  5763. args: ["exponent"],
  5764. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5765. referencedClasses: [],
  5766. messageSends: []
  5767. }),
  5768. $globals.Number);
  5769. $core.addMethod(
  5770. $core.method({
  5771. selector: "rounded",
  5772. protocol: "converting",
  5773. fn: function (){
  5774. var self=this,$self=this;
  5775. return $core.withContext(function($ctx1) {
  5776. return Math.round(self);;
  5777. return self;
  5778. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5779. },
  5780. args: [],
  5781. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5782. referencedClasses: [],
  5783. messageSends: []
  5784. }),
  5785. $globals.Number);
  5786. $core.addMethod(
  5787. $core.method({
  5788. selector: "sign",
  5789. protocol: "mathematical functions",
  5790. fn: function (){
  5791. var self=this,$self=this;
  5792. return $core.withContext(function($ctx1) {
  5793. var $1,$2;
  5794. $1=$self._isZero();
  5795. if($core.assert($1)){
  5796. return (0);
  5797. }
  5798. $2=$self._positive();
  5799. if($core.assert($2)){
  5800. return (1);
  5801. } else {
  5802. return (-1);
  5803. }
  5804. return self;
  5805. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5806. },
  5807. args: [],
  5808. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5809. referencedClasses: [],
  5810. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5811. }),
  5812. $globals.Number);
  5813. $core.addMethod(
  5814. $core.method({
  5815. selector: "sin",
  5816. protocol: "mathematical functions",
  5817. fn: function (){
  5818. var self=this,$self=this;
  5819. return $core.withContext(function($ctx1) {
  5820. return Math.sin(self);;
  5821. return self;
  5822. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5823. },
  5824. args: [],
  5825. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5826. referencedClasses: [],
  5827. messageSends: []
  5828. }),
  5829. $globals.Number);
  5830. $core.addMethod(
  5831. $core.method({
  5832. selector: "sqrt",
  5833. protocol: "mathematical functions",
  5834. fn: function (){
  5835. var self=this,$self=this;
  5836. return $core.withContext(function($ctx1) {
  5837. return Math.sqrt(self);
  5838. return self;
  5839. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5840. },
  5841. args: [],
  5842. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5843. referencedClasses: [],
  5844. messageSends: []
  5845. }),
  5846. $globals.Number);
  5847. $core.addMethod(
  5848. $core.method({
  5849. selector: "squared",
  5850. protocol: "mathematical functions",
  5851. fn: function (){
  5852. var self=this,$self=this;
  5853. return $core.withContext(function($ctx1) {
  5854. return $self.__star(self);
  5855. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5856. },
  5857. args: [],
  5858. source: "squared\x0a\x09^ self * self",
  5859. referencedClasses: [],
  5860. messageSends: ["*"]
  5861. }),
  5862. $globals.Number);
  5863. $core.addMethod(
  5864. $core.method({
  5865. selector: "tan",
  5866. protocol: "mathematical functions",
  5867. fn: function (){
  5868. var self=this,$self=this;
  5869. return $core.withContext(function($ctx1) {
  5870. return Math.tan(self);;
  5871. return self;
  5872. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5873. },
  5874. args: [],
  5875. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5876. referencedClasses: [],
  5877. messageSends: []
  5878. }),
  5879. $globals.Number);
  5880. $core.addMethod(
  5881. $core.method({
  5882. selector: "timesRepeat:",
  5883. protocol: "enumerating",
  5884. fn: function (aBlock){
  5885. var self=this,$self=this;
  5886. var count;
  5887. return $core.withContext(function($ctx1) {
  5888. count=(1);
  5889. $recv((function(){
  5890. return $core.withContext(function($ctx2) {
  5891. return $recv(count).__gt(self);
  5892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5893. }))._whileFalse_((function(){
  5894. return $core.withContext(function($ctx2) {
  5895. $recv(aBlock)._value();
  5896. count=$recv(count).__plus((1));
  5897. return count;
  5898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5899. }));
  5900. return self;
  5901. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5902. },
  5903. args: ["aBlock"],
  5904. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5905. referencedClasses: [],
  5906. messageSends: ["whileFalse:", ">", "value", "+"]
  5907. }),
  5908. $globals.Number);
  5909. $core.addMethod(
  5910. $core.method({
  5911. selector: "to:",
  5912. protocol: "converting",
  5913. fn: function (aNumber){
  5914. var self=this,$self=this;
  5915. var array,first,last,count;
  5916. return $core.withContext(function($ctx1) {
  5917. first=$self._truncated();
  5918. $ctx1.sendIdx["truncated"]=1;
  5919. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5920. $ctx1.sendIdx["+"]=1;
  5921. count=(1);
  5922. array=$recv($globals.Array)._new();
  5923. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5924. return $core.withContext(function($ctx2) {
  5925. $recv(array)._at_put_(count,first);
  5926. count=$recv(count).__plus((1));
  5927. $ctx2.sendIdx["+"]=2;
  5928. first=$recv(first).__plus((1));
  5929. return first;
  5930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5931. }));
  5932. return array;
  5933. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5934. },
  5935. args: ["aNumber"],
  5936. 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",
  5937. referencedClasses: ["Array"],
  5938. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5939. }),
  5940. $globals.Number);
  5941. $core.addMethod(
  5942. $core.method({
  5943. selector: "to:by:",
  5944. protocol: "converting",
  5945. fn: function (stop,step){
  5946. var self=this,$self=this;
  5947. var array,value,pos;
  5948. return $core.withContext(function($ctx1) {
  5949. var $1,$2;
  5950. value=self;
  5951. array=$recv($globals.Array)._new();
  5952. pos=(1);
  5953. $1=$recv(step).__eq((0));
  5954. if($core.assert($1)){
  5955. $self._error_("step must be non-zero");
  5956. }
  5957. $2=$recv(step).__lt((0));
  5958. if($core.assert($2)){
  5959. $recv((function(){
  5960. return $core.withContext(function($ctx2) {
  5961. return $recv(value).__gt_eq(stop);
  5962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5963. }))._whileTrue_((function(){
  5964. return $core.withContext(function($ctx2) {
  5965. $recv(array)._at_put_(pos,value);
  5966. $ctx2.sendIdx["at:put:"]=1;
  5967. pos=$recv(pos).__plus((1));
  5968. $ctx2.sendIdx["+"]=1;
  5969. value=$recv(value).__plus(step);
  5970. $ctx2.sendIdx["+"]=2;
  5971. return value;
  5972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5973. }));
  5974. $ctx1.sendIdx["whileTrue:"]=1;
  5975. } else {
  5976. $recv((function(){
  5977. return $core.withContext(function($ctx2) {
  5978. return $recv(value).__lt_eq(stop);
  5979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5980. }))._whileTrue_((function(){
  5981. return $core.withContext(function($ctx2) {
  5982. $recv(array)._at_put_(pos,value);
  5983. pos=$recv(pos).__plus((1));
  5984. $ctx2.sendIdx["+"]=3;
  5985. value=$recv(value).__plus(step);
  5986. return value;
  5987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5988. }));
  5989. }
  5990. return array;
  5991. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5992. },
  5993. args: ["stop", "step"],
  5994. 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",
  5995. referencedClasses: ["Array"],
  5996. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5997. }),
  5998. $globals.Number);
  5999. $core.addMethod(
  6000. $core.method({
  6001. selector: "to:by:do:",
  6002. protocol: "enumerating",
  6003. fn: function (stop,step,aBlock){
  6004. var self=this,$self=this;
  6005. var value;
  6006. return $core.withContext(function($ctx1) {
  6007. var $1,$2;
  6008. value=self;
  6009. $1=$recv(step).__eq((0));
  6010. if($core.assert($1)){
  6011. $self._error_("step must be non-zero");
  6012. }
  6013. $2=$recv(step).__lt((0));
  6014. if($core.assert($2)){
  6015. $recv((function(){
  6016. return $core.withContext(function($ctx2) {
  6017. return $recv(value).__gt_eq(stop);
  6018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6019. }))._whileTrue_((function(){
  6020. return $core.withContext(function($ctx2) {
  6021. $recv(aBlock)._value_(value);
  6022. $ctx2.sendIdx["value:"]=1;
  6023. value=$recv(value).__plus(step);
  6024. $ctx2.sendIdx["+"]=1;
  6025. return value;
  6026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6027. }));
  6028. $ctx1.sendIdx["whileTrue:"]=1;
  6029. } else {
  6030. $recv((function(){
  6031. return $core.withContext(function($ctx2) {
  6032. return $recv(value).__lt_eq(stop);
  6033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6034. }))._whileTrue_((function(){
  6035. return $core.withContext(function($ctx2) {
  6036. $recv(aBlock)._value_(value);
  6037. value=$recv(value).__plus(step);
  6038. return value;
  6039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6040. }));
  6041. }
  6042. return self;
  6043. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6044. },
  6045. args: ["stop", "step", "aBlock"],
  6046. 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 ]]",
  6047. referencedClasses: [],
  6048. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6049. }),
  6050. $globals.Number);
  6051. $core.addMethod(
  6052. $core.method({
  6053. selector: "to:do:",
  6054. protocol: "enumerating",
  6055. fn: function (stop,aBlock){
  6056. var self=this,$self=this;
  6057. var nextValue;
  6058. return $core.withContext(function($ctx1) {
  6059. nextValue=self;
  6060. $recv((function(){
  6061. return $core.withContext(function($ctx2) {
  6062. return $recv(nextValue).__lt_eq(stop);
  6063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6064. }))._whileTrue_((function(){
  6065. return $core.withContext(function($ctx2) {
  6066. $recv(aBlock)._value_(nextValue);
  6067. nextValue=$recv(nextValue).__plus((1));
  6068. return nextValue;
  6069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6070. }));
  6071. return self;
  6072. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6073. },
  6074. args: ["stop", "aBlock"],
  6075. 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 ]",
  6076. referencedClasses: [],
  6077. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6078. }),
  6079. $globals.Number);
  6080. $core.addMethod(
  6081. $core.method({
  6082. selector: "truncated",
  6083. protocol: "converting",
  6084. fn: function (){
  6085. var self=this,$self=this;
  6086. return $core.withContext(function($ctx1) {
  6087. if(self >= 0) {
  6088. return Math.floor(self);
  6089. } else {
  6090. return Math.floor(self * (-1)) * (-1);
  6091. };
  6092. ;
  6093. return self;
  6094. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6095. },
  6096. args: [],
  6097. 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'>",
  6098. referencedClasses: [],
  6099. messageSends: []
  6100. }),
  6101. $globals.Number);
  6102. $core.addMethod(
  6103. $core.method({
  6104. selector: "|",
  6105. protocol: "converting",
  6106. fn: function (aNumber){
  6107. var self=this,$self=this;
  6108. return $core.withContext(function($ctx1) {
  6109. return self | aNumber;
  6110. return self;
  6111. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6112. },
  6113. args: ["aNumber"],
  6114. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6115. referencedClasses: [],
  6116. messageSends: []
  6117. }),
  6118. $globals.Number);
  6119. $core.addMethod(
  6120. $core.method({
  6121. selector: "classTag",
  6122. protocol: "accessing",
  6123. fn: function (){
  6124. var self=this,$self=this;
  6125. return "magnitude";
  6126. },
  6127. args: [],
  6128. 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'",
  6129. referencedClasses: [],
  6130. messageSends: []
  6131. }),
  6132. $globals.Number.a$cls);
  6133. $core.addMethod(
  6134. $core.method({
  6135. selector: "e",
  6136. protocol: "instance creation",
  6137. fn: function (){
  6138. var self=this,$self=this;
  6139. return $core.withContext(function($ctx1) {
  6140. return Math.E;;
  6141. return self;
  6142. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6143. },
  6144. args: [],
  6145. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6146. referencedClasses: [],
  6147. messageSends: []
  6148. }),
  6149. $globals.Number.a$cls);
  6150. $core.addMethod(
  6151. $core.method({
  6152. selector: "pi",
  6153. protocol: "instance creation",
  6154. fn: function (){
  6155. var self=this,$self=this;
  6156. return $core.withContext(function($ctx1) {
  6157. return Math.PI;
  6158. return self;
  6159. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6160. },
  6161. args: [],
  6162. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6163. referencedClasses: [],
  6164. messageSends: []
  6165. }),
  6166. $globals.Number.a$cls);
  6167. $core.addMethod(
  6168. $core.method({
  6169. selector: "radiansPerDegree",
  6170. protocol: "instance creation",
  6171. fn: function (){
  6172. var self=this,$self=this;
  6173. return $core.withContext(function($ctx1) {
  6174. return $recv($self._pi()).__slash((180));
  6175. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6176. },
  6177. args: [],
  6178. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6179. referencedClasses: [],
  6180. messageSends: ["/", "pi"]
  6181. }),
  6182. $globals.Number.a$cls);
  6183. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6184. $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";
  6185. $core.addMethod(
  6186. $core.method({
  6187. selector: "*",
  6188. protocol: "arithmetic",
  6189. fn: function (aPoint){
  6190. var self=this,$self=this;
  6191. return $core.withContext(function($ctx1) {
  6192. var $2,$4,$3,$1,$6,$5;
  6193. $2=$self._x();
  6194. $ctx1.sendIdx["x"]=1;
  6195. $4=$recv(aPoint)._asPoint();
  6196. $ctx1.sendIdx["asPoint"]=1;
  6197. $3=$recv($4)._x();
  6198. $1=$recv($2).__star($3);
  6199. $ctx1.sendIdx["*"]=1;
  6200. $6=$self._y();
  6201. $ctx1.sendIdx["y"]=1;
  6202. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6203. return $recv($globals.Point)._x_y_($1,$5);
  6204. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6205. },
  6206. args: ["aPoint"],
  6207. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6208. referencedClasses: ["Point"],
  6209. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6210. }),
  6211. $globals.Point);
  6212. $core.addMethod(
  6213. $core.method({
  6214. selector: "+",
  6215. protocol: "arithmetic",
  6216. fn: function (aPoint){
  6217. var self=this,$self=this;
  6218. return $core.withContext(function($ctx1) {
  6219. var $2,$4,$3,$1,$6,$5;
  6220. $2=$self._x();
  6221. $ctx1.sendIdx["x"]=1;
  6222. $4=$recv(aPoint)._asPoint();
  6223. $ctx1.sendIdx["asPoint"]=1;
  6224. $3=$recv($4)._x();
  6225. $1=$recv($2).__plus($3);
  6226. $ctx1.sendIdx["+"]=1;
  6227. $6=$self._y();
  6228. $ctx1.sendIdx["y"]=1;
  6229. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6230. return $recv($globals.Point)._x_y_($1,$5);
  6231. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6232. },
  6233. args: ["aPoint"],
  6234. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6235. referencedClasses: ["Point"],
  6236. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6237. }),
  6238. $globals.Point);
  6239. $core.addMethod(
  6240. $core.method({
  6241. selector: "-",
  6242. protocol: "arithmetic",
  6243. fn: function (aPoint){
  6244. var self=this,$self=this;
  6245. return $core.withContext(function($ctx1) {
  6246. var $2,$4,$3,$1,$6,$5;
  6247. $2=$self._x();
  6248. $ctx1.sendIdx["x"]=1;
  6249. $4=$recv(aPoint)._asPoint();
  6250. $ctx1.sendIdx["asPoint"]=1;
  6251. $3=$recv($4)._x();
  6252. $1=$recv($2).__minus($3);
  6253. $ctx1.sendIdx["-"]=1;
  6254. $6=$self._y();
  6255. $ctx1.sendIdx["y"]=1;
  6256. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6257. return $recv($globals.Point)._x_y_($1,$5);
  6258. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6259. },
  6260. args: ["aPoint"],
  6261. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6262. referencedClasses: ["Point"],
  6263. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6264. }),
  6265. $globals.Point);
  6266. $core.addMethod(
  6267. $core.method({
  6268. selector: "/",
  6269. protocol: "arithmetic",
  6270. fn: function (aPoint){
  6271. var self=this,$self=this;
  6272. return $core.withContext(function($ctx1) {
  6273. var $2,$4,$3,$1,$6,$5;
  6274. $2=$self._x();
  6275. $ctx1.sendIdx["x"]=1;
  6276. $4=$recv(aPoint)._asPoint();
  6277. $ctx1.sendIdx["asPoint"]=1;
  6278. $3=$recv($4)._x();
  6279. $1=$recv($2).__slash($3);
  6280. $ctx1.sendIdx["/"]=1;
  6281. $6=$self._y();
  6282. $ctx1.sendIdx["y"]=1;
  6283. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6284. return $recv($globals.Point)._x_y_($1,$5);
  6285. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6286. },
  6287. args: ["aPoint"],
  6288. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6289. referencedClasses: ["Point"],
  6290. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6291. }),
  6292. $globals.Point);
  6293. $core.addMethod(
  6294. $core.method({
  6295. selector: "<",
  6296. protocol: "comparing",
  6297. fn: function (aPoint){
  6298. var self=this,$self=this;
  6299. return $core.withContext(function($ctx1) {
  6300. var $2,$1,$3;
  6301. $2=$self._x();
  6302. $ctx1.sendIdx["x"]=1;
  6303. $1=$recv($2).__lt($recv(aPoint)._x());
  6304. $ctx1.sendIdx["<"]=1;
  6305. return $recv($1)._and_((function(){
  6306. return $core.withContext(function($ctx2) {
  6307. $3=$self._y();
  6308. $ctx2.sendIdx["y"]=1;
  6309. return $recv($3).__lt($recv(aPoint)._y());
  6310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6311. }));
  6312. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6313. },
  6314. args: ["aPoint"],
  6315. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6316. referencedClasses: [],
  6317. messageSends: ["and:", "<", "x", "y"]
  6318. }),
  6319. $globals.Point);
  6320. $core.addMethod(
  6321. $core.method({
  6322. selector: "<=",
  6323. protocol: "comparing",
  6324. fn: function (aPoint){
  6325. var self=this,$self=this;
  6326. return $core.withContext(function($ctx1) {
  6327. var $2,$1,$3;
  6328. $2=$self._x();
  6329. $ctx1.sendIdx["x"]=1;
  6330. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6331. $ctx1.sendIdx["<="]=1;
  6332. return $recv($1)._and_((function(){
  6333. return $core.withContext(function($ctx2) {
  6334. $3=$self._y();
  6335. $ctx2.sendIdx["y"]=1;
  6336. return $recv($3).__lt_eq($recv(aPoint)._y());
  6337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6338. }));
  6339. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6340. },
  6341. args: ["aPoint"],
  6342. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6343. referencedClasses: [],
  6344. messageSends: ["and:", "<=", "x", "y"]
  6345. }),
  6346. $globals.Point);
  6347. $core.addMethod(
  6348. $core.method({
  6349. selector: "=",
  6350. protocol: "comparing",
  6351. fn: function (aPoint){
  6352. var self=this,$self=this;
  6353. return $core.withContext(function($ctx1) {
  6354. var $2,$1,$4,$3,$6,$5;
  6355. $2=$recv(aPoint)._class();
  6356. $ctx1.sendIdx["class"]=1;
  6357. $1=$recv($2).__eq($self._class());
  6358. $ctx1.sendIdx["="]=1;
  6359. return $recv($1)._and_((function(){
  6360. return $core.withContext(function($ctx2) {
  6361. $4=$recv(aPoint)._x();
  6362. $ctx2.sendIdx["x"]=1;
  6363. $3=$recv($4).__eq($self._x());
  6364. $ctx2.sendIdx["="]=2;
  6365. $6=$recv(aPoint)._y();
  6366. $ctx2.sendIdx["y"]=1;
  6367. $5=$recv($6).__eq($self._y());
  6368. return $recv($3).__and($5);
  6369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6370. }));
  6371. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6372. },
  6373. args: ["aPoint"],
  6374. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6375. referencedClasses: [],
  6376. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6377. }),
  6378. $globals.Point);
  6379. $core.addMethod(
  6380. $core.method({
  6381. selector: ">",
  6382. protocol: "comparing",
  6383. fn: function (aPoint){
  6384. var self=this,$self=this;
  6385. return $core.withContext(function($ctx1) {
  6386. var $2,$1,$3;
  6387. $2=$self._x();
  6388. $ctx1.sendIdx["x"]=1;
  6389. $1=$recv($2).__gt($recv(aPoint)._x());
  6390. $ctx1.sendIdx[">"]=1;
  6391. return $recv($1)._and_((function(){
  6392. return $core.withContext(function($ctx2) {
  6393. $3=$self._y();
  6394. $ctx2.sendIdx["y"]=1;
  6395. return $recv($3).__gt($recv(aPoint)._y());
  6396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6397. }));
  6398. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6399. },
  6400. args: ["aPoint"],
  6401. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6402. referencedClasses: [],
  6403. messageSends: ["and:", ">", "x", "y"]
  6404. }),
  6405. $globals.Point);
  6406. $core.addMethod(
  6407. $core.method({
  6408. selector: ">=",
  6409. protocol: "comparing",
  6410. fn: function (aPoint){
  6411. var self=this,$self=this;
  6412. return $core.withContext(function($ctx1) {
  6413. var $2,$1,$3;
  6414. $2=$self._x();
  6415. $ctx1.sendIdx["x"]=1;
  6416. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6417. $ctx1.sendIdx[">="]=1;
  6418. return $recv($1)._and_((function(){
  6419. return $core.withContext(function($ctx2) {
  6420. $3=$self._y();
  6421. $ctx2.sendIdx["y"]=1;
  6422. return $recv($3).__gt_eq($recv(aPoint)._y());
  6423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6424. }));
  6425. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6426. },
  6427. args: ["aPoint"],
  6428. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6429. referencedClasses: [],
  6430. messageSends: ["and:", ">=", "x", "y"]
  6431. }),
  6432. $globals.Point);
  6433. $core.addMethod(
  6434. $core.method({
  6435. selector: "angle",
  6436. protocol: "geometry",
  6437. fn: function (){
  6438. var self=this,$self=this;
  6439. return $core.withContext(function($ctx1) {
  6440. return $recv($self._y())._arcTan_($self._x());
  6441. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6442. },
  6443. args: [],
  6444. source: "angle\x0a\x09^ self y arcTan: self x",
  6445. referencedClasses: [],
  6446. messageSends: ["arcTan:", "y", "x"]
  6447. }),
  6448. $globals.Point);
  6449. $core.addMethod(
  6450. $core.method({
  6451. selector: "asPoint",
  6452. protocol: "converting",
  6453. fn: function (){
  6454. var self=this,$self=this;
  6455. return self;
  6456. },
  6457. args: [],
  6458. source: "asPoint\x0a\x09^ self",
  6459. referencedClasses: [],
  6460. messageSends: []
  6461. }),
  6462. $globals.Point);
  6463. $core.addMethod(
  6464. $core.method({
  6465. selector: "corner:",
  6466. protocol: "rectangle creation",
  6467. fn: function (aPoint){
  6468. var self=this,$self=this;
  6469. return $core.withContext(function($ctx1) {
  6470. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6471. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6472. },
  6473. args: ["aPoint"],
  6474. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6475. referencedClasses: ["Rectangle"],
  6476. messageSends: ["origin:corner:"]
  6477. }),
  6478. $globals.Point);
  6479. $core.addMethod(
  6480. $core.method({
  6481. selector: "dist:",
  6482. protocol: "transforming",
  6483. fn: function (aPoint){
  6484. var self=this,$self=this;
  6485. var dx,dy;
  6486. return $core.withContext(function($ctx1) {
  6487. var $2,$1;
  6488. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6489. $ctx1.sendIdx["-"]=1;
  6490. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6491. $2=$recv(dx).__star(dx);
  6492. $ctx1.sendIdx["*"]=1;
  6493. $1=$recv($2).__plus($recv(dy).__star(dy));
  6494. return $recv($1)._sqrt();
  6495. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6496. },
  6497. args: ["aPoint"],
  6498. 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",
  6499. referencedClasses: [],
  6500. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6501. }),
  6502. $globals.Point);
  6503. $core.addMethod(
  6504. $core.method({
  6505. selector: "dotProduct:",
  6506. protocol: "point functions",
  6507. fn: function (aPoint){
  6508. var self=this,$self=this;
  6509. return $core.withContext(function($ctx1) {
  6510. var $1;
  6511. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6512. $ctx1.sendIdx["*"]=1;
  6513. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6514. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6515. },
  6516. args: ["aPoint"],
  6517. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6518. referencedClasses: [],
  6519. messageSends: ["+", "*", "x", "y"]
  6520. }),
  6521. $globals.Point);
  6522. $core.addMethod(
  6523. $core.method({
  6524. selector: "extent:",
  6525. protocol: "rectangle creation",
  6526. fn: function (aPoint){
  6527. var self=this,$self=this;
  6528. return $core.withContext(function($ctx1) {
  6529. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6530. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6531. },
  6532. args: ["aPoint"],
  6533. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6534. referencedClasses: ["Rectangle"],
  6535. messageSends: ["origin:extent:"]
  6536. }),
  6537. $globals.Point);
  6538. $core.addMethod(
  6539. $core.method({
  6540. selector: "normal",
  6541. protocol: "point functions",
  6542. fn: function (){
  6543. var self=this,$self=this;
  6544. var n,d;
  6545. return $core.withContext(function($ctx1) {
  6546. var $4,$3,$6,$5,$2,$1;
  6547. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6548. $ctx1.sendIdx["@"]=1;
  6549. $4=$recv(n)._x();
  6550. $ctx1.sendIdx["x"]=1;
  6551. $3=$recv($4).__star($recv(n)._x());
  6552. $ctx1.sendIdx["*"]=1;
  6553. $6=$recv(n)._y();
  6554. $ctx1.sendIdx["y"]=1;
  6555. $5=$recv($6).__star($recv(n)._y());
  6556. d=$recv($3).__plus($5);
  6557. $2=d;
  6558. $1=$recv($2).__eq((0));
  6559. if($core.assert($1)){
  6560. return (-1).__at((0));
  6561. }
  6562. return $recv(n).__slash($recv(d)._sqrt());
  6563. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6564. },
  6565. args: [],
  6566. 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",
  6567. referencedClasses: [],
  6568. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6569. }),
  6570. $globals.Point);
  6571. $core.addMethod(
  6572. $core.method({
  6573. selector: "normalized",
  6574. protocol: "point functions",
  6575. fn: function (){
  6576. var self=this,$self=this;
  6577. var r;
  6578. return $core.withContext(function($ctx1) {
  6579. var $1,$2,$3;
  6580. r=$self._r();
  6581. $1=$recv(r).__eq((0));
  6582. if($core.assert($1)){
  6583. $2=$recv($globals.Point)._x_y_((0),(0));
  6584. $ctx1.sendIdx["x:y:"]=1;
  6585. return $2;
  6586. } else {
  6587. $3=$recv($self["@x"]).__slash(r);
  6588. $ctx1.sendIdx["/"]=1;
  6589. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6590. }
  6591. return self;
  6592. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6593. },
  6594. args: [],
  6595. 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 ]",
  6596. referencedClasses: ["Point"],
  6597. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6598. }),
  6599. $globals.Point);
  6600. $core.addMethod(
  6601. $core.method({
  6602. selector: "printOn:",
  6603. protocol: "printing",
  6604. fn: function (aStream){
  6605. var self=this,$self=this;
  6606. return $core.withContext(function($ctx1) {
  6607. var $1;
  6608. $recv($self["@x"])._printOn_(aStream);
  6609. $ctx1.sendIdx["printOn:"]=1;
  6610. $recv(aStream)._nextPutAll_("@");
  6611. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6612. return $core.withContext(function($ctx2) {
  6613. return $recv($self["@y"])._negative();
  6614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6615. }));
  6616. if($core.assert($1)){
  6617. $recv(aStream)._space();
  6618. }
  6619. $recv($self["@y"])._printOn_(aStream);
  6620. return self;
  6621. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6622. },
  6623. args: ["aStream"],
  6624. 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",
  6625. referencedClasses: [],
  6626. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6627. }),
  6628. $globals.Point);
  6629. $core.addMethod(
  6630. $core.method({
  6631. selector: "r",
  6632. protocol: "polar coordinates",
  6633. fn: function (){
  6634. var self=this,$self=this;
  6635. return $core.withContext(function($ctx1) {
  6636. var $2,$1;
  6637. $2=$recv($self["@x"]).__star($self["@x"]);
  6638. $ctx1.sendIdx["*"]=1;
  6639. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6640. return $recv($1)._sqrt();
  6641. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6642. },
  6643. args: [],
  6644. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6645. referencedClasses: [],
  6646. messageSends: ["sqrt", "+", "*"]
  6647. }),
  6648. $globals.Point);
  6649. $core.addMethod(
  6650. $core.method({
  6651. selector: "rectangle:",
  6652. protocol: "rectangle creation",
  6653. fn: function (aPoint){
  6654. var self=this,$self=this;
  6655. return $core.withContext(function($ctx1) {
  6656. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6657. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6658. },
  6659. args: ["aPoint"],
  6660. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6661. referencedClasses: ["Rectangle"],
  6662. messageSends: ["point:point:"]
  6663. }),
  6664. $globals.Point);
  6665. $core.addMethod(
  6666. $core.method({
  6667. selector: "translateBy:",
  6668. protocol: "transforming",
  6669. fn: function (delta){
  6670. var self=this,$self=this;
  6671. return $core.withContext(function($ctx1) {
  6672. var $1;
  6673. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6674. $ctx1.sendIdx["+"]=1;
  6675. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6676. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6677. },
  6678. args: ["delta"],
  6679. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6680. referencedClasses: [],
  6681. messageSends: ["@", "+", "x", "y"]
  6682. }),
  6683. $globals.Point);
  6684. $core.addMethod(
  6685. $core.method({
  6686. selector: "x",
  6687. protocol: "accessing",
  6688. fn: function (){
  6689. var self=this,$self=this;
  6690. return $self["@x"];
  6691. },
  6692. args: [],
  6693. source: "x\x0a\x09^ x",
  6694. referencedClasses: [],
  6695. messageSends: []
  6696. }),
  6697. $globals.Point);
  6698. $core.addMethod(
  6699. $core.method({
  6700. selector: "x:",
  6701. protocol: "accessing",
  6702. fn: function (aNumber){
  6703. var self=this,$self=this;
  6704. $self["@x"]=aNumber;
  6705. return self;
  6706. },
  6707. args: ["aNumber"],
  6708. source: "x: aNumber\x0a\x09x := aNumber",
  6709. referencedClasses: [],
  6710. messageSends: []
  6711. }),
  6712. $globals.Point);
  6713. $core.addMethod(
  6714. $core.method({
  6715. selector: "y",
  6716. protocol: "accessing",
  6717. fn: function (){
  6718. var self=this,$self=this;
  6719. return $self["@y"];
  6720. },
  6721. args: [],
  6722. source: "y\x0a\x09^ y",
  6723. referencedClasses: [],
  6724. messageSends: []
  6725. }),
  6726. $globals.Point);
  6727. $core.addMethod(
  6728. $core.method({
  6729. selector: "y:",
  6730. protocol: "accessing",
  6731. fn: function (aNumber){
  6732. var self=this,$self=this;
  6733. $self["@y"]=aNumber;
  6734. return self;
  6735. },
  6736. args: ["aNumber"],
  6737. source: "y: aNumber\x0a\x09y := aNumber",
  6738. referencedClasses: [],
  6739. messageSends: []
  6740. }),
  6741. $globals.Point);
  6742. $core.addMethod(
  6743. $core.method({
  6744. selector: "classTag",
  6745. protocol: "accessing",
  6746. fn: function (){
  6747. var self=this,$self=this;
  6748. return "magnitude";
  6749. },
  6750. args: [],
  6751. 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'",
  6752. referencedClasses: [],
  6753. messageSends: []
  6754. }),
  6755. $globals.Point.a$cls);
  6756. $core.addMethod(
  6757. $core.method({
  6758. selector: "x:y:",
  6759. protocol: "instance creation",
  6760. fn: function (aNumber,anotherNumber){
  6761. var self=this,$self=this;
  6762. return $core.withContext(function($ctx1) {
  6763. var $1;
  6764. $1=$self._new();
  6765. $recv($1)._x_(aNumber);
  6766. $recv($1)._y_(anotherNumber);
  6767. return $recv($1)._yourself();
  6768. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6769. },
  6770. args: ["aNumber", "anotherNumber"],
  6771. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6772. referencedClasses: [],
  6773. messageSends: ["x:", "new", "y:", "yourself"]
  6774. }),
  6775. $globals.Point.a$cls);
  6776. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6777. $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'`.";
  6778. $core.addMethod(
  6779. $core.method({
  6780. selector: "next",
  6781. protocol: "accessing",
  6782. fn: function (){
  6783. var self=this,$self=this;
  6784. return $core.withContext(function($ctx1) {
  6785. return Math.random();
  6786. return self;
  6787. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6788. },
  6789. args: [],
  6790. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6791. referencedClasses: [],
  6792. messageSends: []
  6793. }),
  6794. $globals.Random);
  6795. $core.addMethod(
  6796. $core.method({
  6797. selector: "next:",
  6798. protocol: "accessing",
  6799. fn: function (anInteger){
  6800. var self=this,$self=this;
  6801. return $core.withContext(function($ctx1) {
  6802. return $recv((1)._to_(anInteger))._collect_((function(each){
  6803. return $core.withContext(function($ctx2) {
  6804. return $self._next();
  6805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6806. }));
  6807. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6808. },
  6809. args: ["anInteger"],
  6810. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6811. referencedClasses: [],
  6812. messageSends: ["collect:", "to:", "next"]
  6813. }),
  6814. $globals.Random);
  6815. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6816. $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.";
  6817. $core.addMethod(
  6818. $core.method({
  6819. selector: "=",
  6820. protocol: "testing",
  6821. fn: function (aRectangle){
  6822. var self=this,$self=this;
  6823. return $core.withContext(function($ctx1) {
  6824. var $1;
  6825. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6826. $ctx1.sendIdx["="]=1;
  6827. return $recv($1)._and_((function(){
  6828. return $core.withContext(function($ctx2) {
  6829. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6831. }));
  6832. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6833. },
  6834. args: ["aRectangle"],
  6835. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6836. referencedClasses: [],
  6837. messageSends: ["and:", "=", "origin", "corner"]
  6838. }),
  6839. $globals.Rectangle);
  6840. $core.addMethod(
  6841. $core.method({
  6842. selector: "containsPoint:",
  6843. protocol: "testing",
  6844. fn: function (aPoint){
  6845. var self=this,$self=this;
  6846. return $core.withContext(function($ctx1) {
  6847. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6848. return $core.withContext(function($ctx2) {
  6849. return $recv($self["@corner"]).__gt_eq(aPoint);
  6850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6851. }));
  6852. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6853. },
  6854. args: ["aPoint"],
  6855. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6856. referencedClasses: [],
  6857. messageSends: ["and:", "<=", ">="]
  6858. }),
  6859. $globals.Rectangle);
  6860. $core.addMethod(
  6861. $core.method({
  6862. selector: "containsRect:",
  6863. protocol: "testing",
  6864. fn: function (aRect){
  6865. var self=this,$self=this;
  6866. return $core.withContext(function($ctx1) {
  6867. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6868. return $core.withContext(function($ctx2) {
  6869. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6871. }));
  6872. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6873. },
  6874. args: ["aRect"],
  6875. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6876. referencedClasses: [],
  6877. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6878. }),
  6879. $globals.Rectangle);
  6880. $core.addMethod(
  6881. $core.method({
  6882. selector: "corner",
  6883. protocol: "accessing",
  6884. fn: function (){
  6885. var self=this,$self=this;
  6886. return $self["@corner"];
  6887. },
  6888. args: [],
  6889. source: "corner\x0a\x09^ corner",
  6890. referencedClasses: [],
  6891. messageSends: []
  6892. }),
  6893. $globals.Rectangle);
  6894. $core.addMethod(
  6895. $core.method({
  6896. selector: "origin",
  6897. protocol: "accessing",
  6898. fn: function (){
  6899. var self=this,$self=this;
  6900. return $self["@origin"];
  6901. },
  6902. args: [],
  6903. source: "origin\x0a\x09^ origin",
  6904. referencedClasses: [],
  6905. messageSends: []
  6906. }),
  6907. $globals.Rectangle);
  6908. $core.addMethod(
  6909. $core.method({
  6910. selector: "printOn:",
  6911. protocol: "testing",
  6912. fn: function (aStream){
  6913. var self=this,$self=this;
  6914. return $core.withContext(function($ctx1) {
  6915. $recv($self["@origin"])._printOn_(aStream);
  6916. $ctx1.sendIdx["printOn:"]=1;
  6917. $recv(aStream)._nextPutAll_(" corner: ");
  6918. $recv($self["@corner"])._printOn_(aStream);
  6919. return self;
  6920. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6921. },
  6922. args: ["aStream"],
  6923. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6924. referencedClasses: [],
  6925. messageSends: ["printOn:", "nextPutAll:"]
  6926. }),
  6927. $globals.Rectangle);
  6928. $core.addMethod(
  6929. $core.method({
  6930. selector: "setPoint:point:",
  6931. protocol: "private",
  6932. fn: function (pt1,pt2){
  6933. var self=this,$self=this;
  6934. return $core.withContext(function($ctx1) {
  6935. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6936. $2=$recv(pt1)._x();
  6937. $ctx1.sendIdx["x"]=1;
  6938. $3=$recv(pt2)._x();
  6939. $ctx1.sendIdx["x"]=2;
  6940. $1=$recv($2)._min_($3);
  6941. $ctx1.sendIdx["min:"]=1;
  6942. $5=$recv(pt1)._y();
  6943. $ctx1.sendIdx["y"]=1;
  6944. $6=$recv(pt2)._y();
  6945. $ctx1.sendIdx["y"]=2;
  6946. $4=$recv($5)._min_($6);
  6947. $self["@origin"]=$recv($1).__at($4);
  6948. $ctx1.sendIdx["@"]=1;
  6949. $8=$recv(pt1)._x();
  6950. $ctx1.sendIdx["x"]=3;
  6951. $7=$recv($8)._max_($recv(pt2)._x());
  6952. $ctx1.sendIdx["max:"]=1;
  6953. $10=$recv(pt1)._y();
  6954. $ctx1.sendIdx["y"]=3;
  6955. $9=$recv($10)._max_($recv(pt2)._y());
  6956. $self["@corner"]=$recv($7).__at($9);
  6957. return self;
  6958. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6959. },
  6960. args: ["pt1", "pt2"],
  6961. 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).",
  6962. referencedClasses: [],
  6963. messageSends: ["@", "min:", "x", "y", "max:"]
  6964. }),
  6965. $globals.Rectangle);
  6966. $core.addMethod(
  6967. $core.method({
  6968. selector: "origin:corner:",
  6969. protocol: "instance creation",
  6970. fn: function (anOrigin,aCorner){
  6971. var self=this,$self=this;
  6972. return $core.withContext(function($ctx1) {
  6973. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6974. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6975. },
  6976. args: ["anOrigin", "aCorner"],
  6977. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6978. referencedClasses: [],
  6979. messageSends: ["setPoint:point:", "basicNew"]
  6980. }),
  6981. $globals.Rectangle.a$cls);
  6982. $core.addMethod(
  6983. $core.method({
  6984. selector: "origin:extent:",
  6985. protocol: "instance creation",
  6986. fn: function (anOrigin,anExtent){
  6987. var self=this,$self=this;
  6988. return $core.withContext(function($ctx1) {
  6989. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  6990. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  6991. },
  6992. args: ["anOrigin", "anExtent"],
  6993. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  6994. referencedClasses: [],
  6995. messageSends: ["setPoint:point:", "basicNew", "+"]
  6996. }),
  6997. $globals.Rectangle.a$cls);
  6998. $core.addMethod(
  6999. $core.method({
  7000. selector: "point:point:",
  7001. protocol: "instance creation",
  7002. fn: function (anOrigin,aCorner){
  7003. var self=this,$self=this;
  7004. return $core.withContext(function($ctx1) {
  7005. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  7006. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  7007. },
  7008. args: ["anOrigin", "aCorner"],
  7009. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7010. referencedClasses: [],
  7011. messageSends: ["setPoint:point:", "basicNew"]
  7012. }),
  7013. $globals.Rectangle.a$cls);
  7014. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7015. $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`.";
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "==",
  7019. protocol: "testing",
  7020. fn: function (anObject){
  7021. var self=this,$self=this;
  7022. return $core.withContext(function($ctx1) {
  7023. return $recv(anObject)._isNil();
  7024. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7025. },
  7026. args: ["anObject"],
  7027. source: "== anObject\x0a\x09^ anObject isNil",
  7028. referencedClasses: [],
  7029. messageSends: ["isNil"]
  7030. }),
  7031. $globals.UndefinedObject);
  7032. $core.addMethod(
  7033. $core.method({
  7034. selector: "asJavaScriptObject",
  7035. protocol: "converting",
  7036. fn: function (){
  7037. var self=this,$self=this;
  7038. return null;
  7039. },
  7040. args: [],
  7041. source: "asJavaScriptObject\x0a\x09^ null",
  7042. referencedClasses: [],
  7043. messageSends: []
  7044. }),
  7045. $globals.UndefinedObject);
  7046. $core.addMethod(
  7047. $core.method({
  7048. selector: "deepCopy",
  7049. protocol: "copying",
  7050. fn: function (){
  7051. var self=this,$self=this;
  7052. return self;
  7053. },
  7054. args: [],
  7055. source: "deepCopy\x0a\x09^ self",
  7056. referencedClasses: [],
  7057. messageSends: []
  7058. }),
  7059. $globals.UndefinedObject);
  7060. $core.addMethod(
  7061. $core.method({
  7062. selector: "identityHash",
  7063. protocol: "accessing",
  7064. fn: function (){
  7065. var self=this,$self=this;
  7066. return "NIL";
  7067. },
  7068. args: [],
  7069. source: "identityHash\x0a\x09^ 'NIL'",
  7070. referencedClasses: [],
  7071. messageSends: []
  7072. }),
  7073. $globals.UndefinedObject);
  7074. $core.addMethod(
  7075. $core.method({
  7076. selector: "ifNil:",
  7077. protocol: "testing",
  7078. fn: function (aBlock){
  7079. var self=this,$self=this;
  7080. return $core.withContext(function($ctx1) {
  7081. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7082. }));
  7083. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7084. },
  7085. args: ["aBlock"],
  7086. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7087. referencedClasses: [],
  7088. messageSends: ["ifNil:ifNotNil:"]
  7089. }),
  7090. $globals.UndefinedObject);
  7091. $core.addMethod(
  7092. $core.method({
  7093. selector: "ifNil:ifNotNil:",
  7094. protocol: "testing",
  7095. fn: function (aBlock,anotherBlock){
  7096. var self=this,$self=this;
  7097. return $core.withContext(function($ctx1) {
  7098. return $recv(aBlock)._value();
  7099. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7100. },
  7101. args: ["aBlock", "anotherBlock"],
  7102. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7103. referencedClasses: [],
  7104. messageSends: ["value"]
  7105. }),
  7106. $globals.UndefinedObject);
  7107. $core.addMethod(
  7108. $core.method({
  7109. selector: "ifNotNil:",
  7110. protocol: "testing",
  7111. fn: function (aBlock){
  7112. var self=this,$self=this;
  7113. return self;
  7114. },
  7115. args: ["aBlock"],
  7116. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7117. referencedClasses: [],
  7118. messageSends: []
  7119. }),
  7120. $globals.UndefinedObject);
  7121. $core.addMethod(
  7122. $core.method({
  7123. selector: "ifNotNil:ifNil:",
  7124. protocol: "testing",
  7125. fn: function (aBlock,anotherBlock){
  7126. var self=this,$self=this;
  7127. return $core.withContext(function($ctx1) {
  7128. return $recv(anotherBlock)._value();
  7129. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7130. },
  7131. args: ["aBlock", "anotherBlock"],
  7132. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7133. referencedClasses: [],
  7134. messageSends: ["value"]
  7135. }),
  7136. $globals.UndefinedObject);
  7137. $core.addMethod(
  7138. $core.method({
  7139. selector: "isImmutable",
  7140. protocol: "testing",
  7141. fn: function (){
  7142. var self=this,$self=this;
  7143. return true;
  7144. },
  7145. args: [],
  7146. source: "isImmutable\x0a\x09^ true",
  7147. referencedClasses: [],
  7148. messageSends: []
  7149. }),
  7150. $globals.UndefinedObject);
  7151. $core.addMethod(
  7152. $core.method({
  7153. selector: "isNil",
  7154. protocol: "testing",
  7155. fn: function (){
  7156. var self=this,$self=this;
  7157. return true;
  7158. },
  7159. args: [],
  7160. source: "isNil\x0a\x09^ true",
  7161. referencedClasses: [],
  7162. messageSends: []
  7163. }),
  7164. $globals.UndefinedObject);
  7165. $core.addMethod(
  7166. $core.method({
  7167. selector: "notNil",
  7168. protocol: "testing",
  7169. fn: function (){
  7170. var self=this,$self=this;
  7171. return false;
  7172. },
  7173. args: [],
  7174. source: "notNil\x0a\x09^ false",
  7175. referencedClasses: [],
  7176. messageSends: []
  7177. }),
  7178. $globals.UndefinedObject);
  7179. $core.addMethod(
  7180. $core.method({
  7181. selector: "printOn:",
  7182. protocol: "printing",
  7183. fn: function (aStream){
  7184. var self=this,$self=this;
  7185. return $core.withContext(function($ctx1) {
  7186. $recv(aStream)._nextPutAll_("nil");
  7187. return self;
  7188. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7189. },
  7190. args: ["aStream"],
  7191. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7192. referencedClasses: [],
  7193. messageSends: ["nextPutAll:"]
  7194. }),
  7195. $globals.UndefinedObject);
  7196. $core.addMethod(
  7197. $core.method({
  7198. selector: "shallowCopy",
  7199. protocol: "copying",
  7200. fn: function (){
  7201. var self=this,$self=this;
  7202. return self;
  7203. },
  7204. args: [],
  7205. source: "shallowCopy\x0a\x09^ self",
  7206. referencedClasses: [],
  7207. messageSends: []
  7208. }),
  7209. $globals.UndefinedObject);
  7210. $core.addMethod(
  7211. $core.method({
  7212. selector: "value",
  7213. protocol: "evaluating",
  7214. fn: function (){
  7215. var self=this,$self=this;
  7216. return $core.withContext(function($ctx1) {
  7217. return null;
  7218. return self;
  7219. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7220. },
  7221. args: [],
  7222. source: "value\x0a\x09<inlineJS: 'return null'>",
  7223. referencedClasses: [],
  7224. messageSends: []
  7225. }),
  7226. $globals.UndefinedObject);
  7227. $core.addMethod(
  7228. $core.method({
  7229. selector: "new",
  7230. protocol: "instance creation",
  7231. fn: function (){
  7232. var self=this,$self=this;
  7233. return $core.withContext(function($ctx1) {
  7234. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7235. return self;
  7236. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7237. },
  7238. args: [],
  7239. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7240. referencedClasses: [],
  7241. messageSends: ["error:"]
  7242. }),
  7243. $globals.UndefinedObject.a$cls);
  7244. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7245. });
  7246. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7247. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7248. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7249. $core.addPackage("Kernel-Collections");
  7250. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7251. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7252. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7253. $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:`";
  7254. $core.addMethod(
  7255. $core.method({
  7256. selector: "=",
  7257. protocol: "comparing",
  7258. fn: function (anAssociation){
  7259. var self=this,$self=this;
  7260. return $core.withContext(function($ctx1) {
  7261. var $3,$2,$5,$4,$6,$1;
  7262. $3=$self._class();
  7263. $ctx1.sendIdx["class"]=1;
  7264. $2=$recv($3).__eq($recv(anAssociation)._class());
  7265. $ctx1.sendIdx["="]=1;
  7266. $1=$recv($2)._and_((function(){
  7267. return $core.withContext(function($ctx2) {
  7268. $5=$self._key();
  7269. $ctx2.sendIdx["key"]=1;
  7270. $4=$recv($5).__eq($recv(anAssociation)._key());
  7271. $ctx2.sendIdx["="]=2;
  7272. return $recv($4)._and_((function(){
  7273. return $core.withContext(function($ctx3) {
  7274. $6=$self._value();
  7275. $ctx3.sendIdx["value"]=1;
  7276. return $recv($6).__eq($recv(anAssociation)._value());
  7277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7278. }));
  7279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7280. }));
  7281. $ctx1.sendIdx["and:"]=1;
  7282. return $1;
  7283. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7284. },
  7285. args: ["anAssociation"],
  7286. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7287. referencedClasses: [],
  7288. messageSends: ["and:", "=", "class", "key", "value"]
  7289. }),
  7290. $globals.Association);
  7291. $core.addMethod(
  7292. $core.method({
  7293. selector: "key",
  7294. protocol: "accessing",
  7295. fn: function (){
  7296. var self=this,$self=this;
  7297. return $self["@key"];
  7298. },
  7299. args: [],
  7300. source: "key\x0a\x09^ key",
  7301. referencedClasses: [],
  7302. messageSends: []
  7303. }),
  7304. $globals.Association);
  7305. $core.addMethod(
  7306. $core.method({
  7307. selector: "key:",
  7308. protocol: "accessing",
  7309. fn: function (aKey){
  7310. var self=this,$self=this;
  7311. $self["@key"]=aKey;
  7312. return self;
  7313. },
  7314. args: ["aKey"],
  7315. source: "key: aKey\x0a\x09key := aKey",
  7316. referencedClasses: [],
  7317. messageSends: []
  7318. }),
  7319. $globals.Association);
  7320. $core.addMethod(
  7321. $core.method({
  7322. selector: "printOn:",
  7323. protocol: "printing",
  7324. fn: function (aStream){
  7325. var self=this,$self=this;
  7326. return $core.withContext(function($ctx1) {
  7327. $recv($self._key())._printOn_(aStream);
  7328. $ctx1.sendIdx["printOn:"]=1;
  7329. $recv(aStream)._nextPutAll_(" -> ");
  7330. $recv($self._value())._printOn_(aStream);
  7331. return self;
  7332. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7333. },
  7334. args: ["aStream"],
  7335. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7336. referencedClasses: [],
  7337. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7338. }),
  7339. $globals.Association);
  7340. $core.addMethod(
  7341. $core.method({
  7342. selector: "value",
  7343. protocol: "accessing",
  7344. fn: function (){
  7345. var self=this,$self=this;
  7346. return $self["@value"];
  7347. },
  7348. args: [],
  7349. source: "value\x0a\x09^ value",
  7350. referencedClasses: [],
  7351. messageSends: []
  7352. }),
  7353. $globals.Association);
  7354. $core.addMethod(
  7355. $core.method({
  7356. selector: "value:",
  7357. protocol: "accessing",
  7358. fn: function (aValue){
  7359. var self=this,$self=this;
  7360. $self["@value"]=aValue;
  7361. return self;
  7362. },
  7363. args: ["aValue"],
  7364. source: "value: aValue\x0a\x09value := aValue",
  7365. referencedClasses: [],
  7366. messageSends: []
  7367. }),
  7368. $globals.Association);
  7369. $core.addMethod(
  7370. $core.method({
  7371. selector: "key:value:",
  7372. protocol: "instance creation",
  7373. fn: function (aKey,aValue){
  7374. var self=this,$self=this;
  7375. return $core.withContext(function($ctx1) {
  7376. var $1;
  7377. $1=$self._new();
  7378. $recv($1)._key_(aKey);
  7379. $recv($1)._value_(aValue);
  7380. return $recv($1)._yourself();
  7381. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7382. },
  7383. args: ["aKey", "aValue"],
  7384. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7385. referencedClasses: [],
  7386. messageSends: ["key:", "new", "value:", "yourself"]
  7387. }),
  7388. $globals.Association.a$cls);
  7389. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7390. $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`.";
  7391. $core.addMethod(
  7392. $core.method({
  7393. selector: "bucketOfElement:",
  7394. protocol: "accessing",
  7395. fn: function (anObject){
  7396. var self=this,$self=this;
  7397. return $core.withContext(function($ctx1) {
  7398. var hash = $self['@hashBlock'](anObject);
  7399. if (!hash) return null;
  7400. var buckets = $self['@buckets'],
  7401. bucket = buckets[hash];
  7402. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7403. return bucket;
  7404. ;
  7405. return self;
  7406. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7407. },
  7408. args: ["anObject"],
  7409. 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'>",
  7410. referencedClasses: [],
  7411. messageSends: []
  7412. }),
  7413. $globals.BucketStore);
  7414. $core.addMethod(
  7415. $core.method({
  7416. selector: "do:",
  7417. protocol: "enumerating",
  7418. fn: function (aBlock){
  7419. var self=this,$self=this;
  7420. return $core.withContext(function($ctx1) {
  7421. var buckets = $self['@buckets'];
  7422. var keys = Object.keys(buckets);
  7423. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7424. ;
  7425. return self;
  7426. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7427. },
  7428. args: ["aBlock"],
  7429. 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'>",
  7430. referencedClasses: [],
  7431. messageSends: []
  7432. }),
  7433. $globals.BucketStore);
  7434. $core.addMethod(
  7435. $core.method({
  7436. selector: "hashBlock:",
  7437. protocol: "accessing",
  7438. fn: function (aBlock){
  7439. var self=this,$self=this;
  7440. $self["@hashBlock"]=aBlock;
  7441. return self;
  7442. },
  7443. args: ["aBlock"],
  7444. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7445. referencedClasses: [],
  7446. messageSends: []
  7447. }),
  7448. $globals.BucketStore);
  7449. $core.addMethod(
  7450. $core.method({
  7451. selector: "initialize",
  7452. protocol: "initialization",
  7453. fn: function (){
  7454. var self=this,$self=this;
  7455. return $core.withContext(function($ctx1) {
  7456. (
  7457. $ctx1.supercall = true,
  7458. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7459. $ctx1.supercall = false;
  7460. $self._removeAll();
  7461. return self;
  7462. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7463. },
  7464. args: [],
  7465. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7466. referencedClasses: [],
  7467. messageSends: ["initialize", "removeAll"]
  7468. }),
  7469. $globals.BucketStore);
  7470. $core.addMethod(
  7471. $core.method({
  7472. selector: "newBucket",
  7473. protocol: "private",
  7474. fn: function (){
  7475. var self=this,$self=this;
  7476. return $core.withContext(function($ctx1) {
  7477. $self._subclassResponsibility();
  7478. return self;
  7479. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7480. },
  7481. args: [],
  7482. source: "newBucket\x0a\x09self subclassResponsibility",
  7483. referencedClasses: [],
  7484. messageSends: ["subclassResponsibility"]
  7485. }),
  7486. $globals.BucketStore);
  7487. $core.addMethod(
  7488. $core.method({
  7489. selector: "removeAll",
  7490. protocol: "adding/removing",
  7491. fn: function (){
  7492. var self=this,$self=this;
  7493. return $core.withContext(function($ctx1) {
  7494. $self['@buckets'] = Object.create(null);;
  7495. return self;
  7496. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7497. },
  7498. args: [],
  7499. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7500. referencedClasses: [],
  7501. messageSends: []
  7502. }),
  7503. $globals.BucketStore);
  7504. $core.addMethod(
  7505. $core.method({
  7506. selector: "hashBlock:",
  7507. protocol: "instance creation",
  7508. fn: function (aBlock){
  7509. var self=this,$self=this;
  7510. return $core.withContext(function($ctx1) {
  7511. var $1;
  7512. $1=$self._new();
  7513. $recv($1)._hashBlock_(aBlock);
  7514. return $recv($1)._yourself();
  7515. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7516. },
  7517. args: ["aBlock"],
  7518. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7519. referencedClasses: [],
  7520. messageSends: ["hashBlock:", "new", "yourself"]
  7521. }),
  7522. $globals.BucketStore.a$cls);
  7523. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7524. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7525. $core.addMethod(
  7526. $core.method({
  7527. selector: "newBucket",
  7528. protocol: "private",
  7529. fn: function (){
  7530. var self=this,$self=this;
  7531. return [];
  7532. },
  7533. args: [],
  7534. source: "newBucket\x0a\x09^ #()",
  7535. referencedClasses: [],
  7536. messageSends: []
  7537. }),
  7538. $globals.ArrayBucketStore);
  7539. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7540. $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.";
  7541. $core.addMethod(
  7542. $core.method({
  7543. selector: ",",
  7544. protocol: "copying",
  7545. fn: function (aCollection){
  7546. var self=this,$self=this;
  7547. return $core.withContext(function($ctx1) {
  7548. var $1;
  7549. $1=$self._copy();
  7550. $recv($1)._addAll_(aCollection);
  7551. return $recv($1)._yourself();
  7552. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7553. },
  7554. args: ["aCollection"],
  7555. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7556. referencedClasses: [],
  7557. messageSends: ["addAll:", "copy", "yourself"]
  7558. }),
  7559. $globals.Collection);
  7560. $core.addMethod(
  7561. $core.method({
  7562. selector: "add:",
  7563. protocol: "adding/removing",
  7564. fn: function (anObject){
  7565. var self=this,$self=this;
  7566. return $core.withContext(function($ctx1) {
  7567. $self._subclassResponsibility();
  7568. return self;
  7569. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7570. },
  7571. args: ["anObject"],
  7572. source: "add: anObject\x0a\x09self subclassResponsibility",
  7573. referencedClasses: [],
  7574. messageSends: ["subclassResponsibility"]
  7575. }),
  7576. $globals.Collection);
  7577. $core.addMethod(
  7578. $core.method({
  7579. selector: "addAll:",
  7580. protocol: "adding/removing",
  7581. fn: function (aCollection){
  7582. var self=this,$self=this;
  7583. return $core.withContext(function($ctx1) {
  7584. $recv(aCollection)._do_((function(each){
  7585. return $core.withContext(function($ctx2) {
  7586. return $self._add_(each);
  7587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7588. }));
  7589. return aCollection;
  7590. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7591. },
  7592. args: ["aCollection"],
  7593. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7594. referencedClasses: [],
  7595. messageSends: ["do:", "add:"]
  7596. }),
  7597. $globals.Collection);
  7598. $core.addMethod(
  7599. $core.method({
  7600. selector: "allSatisfy:",
  7601. protocol: "enumerating",
  7602. fn: function (aBlock){
  7603. var self=this,$self=this;
  7604. return $core.withContext(function($ctx1) {
  7605. var $1;
  7606. var $early={};
  7607. try {
  7608. $self._do_((function(each){
  7609. return $core.withContext(function($ctx2) {
  7610. $1=$recv(aBlock)._value_(each);
  7611. if(!$core.assert($1)){
  7612. throw $early=[false];
  7613. }
  7614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7615. }));
  7616. return true;
  7617. }
  7618. catch(e) {if(e===$early)return e[0]; throw e}
  7619. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7620. },
  7621. args: ["aBlock"],
  7622. 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",
  7623. referencedClasses: [],
  7624. messageSends: ["do:", "ifFalse:", "value:"]
  7625. }),
  7626. $globals.Collection);
  7627. $core.addMethod(
  7628. $core.method({
  7629. selector: "anyOne",
  7630. protocol: "accessing",
  7631. fn: function (){
  7632. var self=this,$self=this;
  7633. return $core.withContext(function($ctx1) {
  7634. var $early={};
  7635. try {
  7636. $self._ifEmpty_((function(){
  7637. return $core.withContext(function($ctx2) {
  7638. return $self._error_("Collection is empty");
  7639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7640. }));
  7641. $self._do_((function(each){
  7642. throw $early=[each];
  7643. }));
  7644. return self;
  7645. }
  7646. catch(e) {if(e===$early)return e[0]; throw e}
  7647. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7648. },
  7649. args: [],
  7650. 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 ]",
  7651. referencedClasses: [],
  7652. messageSends: ["ifEmpty:", "error:", "do:"]
  7653. }),
  7654. $globals.Collection);
  7655. $core.addMethod(
  7656. $core.method({
  7657. selector: "anySatisfy:",
  7658. protocol: "enumerating",
  7659. fn: function (aBlock){
  7660. var self=this,$self=this;
  7661. return $core.withContext(function($ctx1) {
  7662. var $1;
  7663. var $early={};
  7664. try {
  7665. $self._do_((function(each){
  7666. return $core.withContext(function($ctx2) {
  7667. $1=$recv(aBlock)._value_(each);
  7668. if($core.assert($1)){
  7669. throw $early=[true];
  7670. }
  7671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7672. }));
  7673. return false;
  7674. }
  7675. catch(e) {if(e===$early)return e[0]; throw e}
  7676. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7677. },
  7678. args: ["aBlock"],
  7679. 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",
  7680. referencedClasses: [],
  7681. messageSends: ["do:", "ifTrue:", "value:"]
  7682. }),
  7683. $globals.Collection);
  7684. $core.addMethod(
  7685. $core.method({
  7686. selector: "asArray",
  7687. protocol: "converting",
  7688. fn: function (){
  7689. var self=this,$self=this;
  7690. return $core.withContext(function($ctx1) {
  7691. return $recv($globals.Array)._withAll_(self);
  7692. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7693. },
  7694. args: [],
  7695. source: "asArray\x0a\x09^ Array withAll: self",
  7696. referencedClasses: ["Array"],
  7697. messageSends: ["withAll:"]
  7698. }),
  7699. $globals.Collection);
  7700. $core.addMethod(
  7701. $core.method({
  7702. selector: "asJavaScriptObject",
  7703. protocol: "converting",
  7704. fn: function (){
  7705. var self=this,$self=this;
  7706. return $core.withContext(function($ctx1) {
  7707. return $recv($self._asArray())._collect_((function(each){
  7708. return $core.withContext(function($ctx2) {
  7709. return $recv(each)._asJavaScriptObject();
  7710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7711. }));
  7712. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7713. },
  7714. args: [],
  7715. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7716. referencedClasses: [],
  7717. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7718. }),
  7719. $globals.Collection);
  7720. $core.addMethod(
  7721. $core.method({
  7722. selector: "asOrderedCollection",
  7723. protocol: "converting",
  7724. fn: function (){
  7725. var self=this,$self=this;
  7726. return $core.withContext(function($ctx1) {
  7727. return $self._asArray();
  7728. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7729. },
  7730. args: [],
  7731. source: "asOrderedCollection\x0a\x09^ self asArray",
  7732. referencedClasses: [],
  7733. messageSends: ["asArray"]
  7734. }),
  7735. $globals.Collection);
  7736. $core.addMethod(
  7737. $core.method({
  7738. selector: "asSet",
  7739. protocol: "converting",
  7740. fn: function (){
  7741. var self=this,$self=this;
  7742. return $core.withContext(function($ctx1) {
  7743. return $recv($globals.Set)._withAll_(self);
  7744. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7745. },
  7746. args: [],
  7747. source: "asSet\x0a\x09^ Set withAll: self",
  7748. referencedClasses: ["Set"],
  7749. messageSends: ["withAll:"]
  7750. }),
  7751. $globals.Collection);
  7752. $core.addMethod(
  7753. $core.method({
  7754. selector: "collect:",
  7755. protocol: "enumerating",
  7756. fn: function (aBlock){
  7757. var self=this,$self=this;
  7758. var stream;
  7759. return $core.withContext(function($ctx1) {
  7760. stream=$recv($recv($self._class())._new())._writeStream();
  7761. $self._do_((function(each){
  7762. return $core.withContext(function($ctx2) {
  7763. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7765. }));
  7766. return $recv(stream)._contents();
  7767. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7768. },
  7769. args: ["aBlock"],
  7770. 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",
  7771. referencedClasses: [],
  7772. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7773. }),
  7774. $globals.Collection);
  7775. $core.addMethod(
  7776. $core.method({
  7777. selector: "copyWith:",
  7778. protocol: "copying",
  7779. fn: function (anObject){
  7780. var self=this,$self=this;
  7781. return $core.withContext(function($ctx1) {
  7782. var $1;
  7783. $1=$self._copy();
  7784. $recv($1)._add_(anObject);
  7785. return $recv($1)._yourself();
  7786. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7787. },
  7788. args: ["anObject"],
  7789. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7790. referencedClasses: [],
  7791. messageSends: ["add:", "copy", "yourself"]
  7792. }),
  7793. $globals.Collection);
  7794. $core.addMethod(
  7795. $core.method({
  7796. selector: "copyWithAll:",
  7797. protocol: "copying",
  7798. fn: function (aCollection){
  7799. var self=this,$self=this;
  7800. return $core.withContext(function($ctx1) {
  7801. var $1;
  7802. $1=$self._copy();
  7803. $recv($1)._addAll_(aCollection);
  7804. return $recv($1)._yourself();
  7805. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7806. },
  7807. args: ["aCollection"],
  7808. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  7809. referencedClasses: [],
  7810. messageSends: ["addAll:", "copy", "yourself"]
  7811. }),
  7812. $globals.Collection);
  7813. $core.addMethod(
  7814. $core.method({
  7815. selector: "copyWithout:",
  7816. protocol: "copying",
  7817. fn: function (anObject){
  7818. var self=this,$self=this;
  7819. return $core.withContext(function($ctx1) {
  7820. return $self._reject_((function(each){
  7821. return $core.withContext(function($ctx2) {
  7822. return $recv(each).__eq(anObject);
  7823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7824. }));
  7825. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7826. },
  7827. args: ["anObject"],
  7828. 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 ]",
  7829. referencedClasses: [],
  7830. messageSends: ["reject:", "="]
  7831. }),
  7832. $globals.Collection);
  7833. $core.addMethod(
  7834. $core.method({
  7835. selector: "copyWithoutAll:",
  7836. protocol: "copying",
  7837. fn: function (aCollection){
  7838. var self=this,$self=this;
  7839. return $core.withContext(function($ctx1) {
  7840. return $self._reject_((function(each){
  7841. return $core.withContext(function($ctx2) {
  7842. return $recv(aCollection)._includes_(each);
  7843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7844. }));
  7845. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7846. },
  7847. args: ["aCollection"],
  7848. 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 ]",
  7849. referencedClasses: [],
  7850. messageSends: ["reject:", "includes:"]
  7851. }),
  7852. $globals.Collection);
  7853. $core.addMethod(
  7854. $core.method({
  7855. selector: "deepCopy",
  7856. protocol: "copying",
  7857. fn: function (){
  7858. var self=this,$self=this;
  7859. return $core.withContext(function($ctx1) {
  7860. return $self._collect_((function(each){
  7861. return $core.withContext(function($ctx2) {
  7862. return $recv(each)._deepCopy();
  7863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7864. }));
  7865. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7866. },
  7867. args: [],
  7868. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7869. referencedClasses: [],
  7870. messageSends: ["collect:", "deepCopy"]
  7871. }),
  7872. $globals.Collection);
  7873. $core.addMethod(
  7874. $core.method({
  7875. selector: "detect:",
  7876. protocol: "enumerating",
  7877. fn: function (aBlock){
  7878. var self=this,$self=this;
  7879. return $core.withContext(function($ctx1) {
  7880. return $self._detect_ifNone_(aBlock,(function(){
  7881. return $core.withContext(function($ctx2) {
  7882. return $self._errorNotFound();
  7883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7884. }));
  7885. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7886. },
  7887. args: ["aBlock"],
  7888. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7889. referencedClasses: [],
  7890. messageSends: ["detect:ifNone:", "errorNotFound"]
  7891. }),
  7892. $globals.Collection);
  7893. $core.addMethod(
  7894. $core.method({
  7895. selector: "detect:ifNone:",
  7896. protocol: "enumerating",
  7897. fn: function (aBlock,anotherBlock){
  7898. var self=this,$self=this;
  7899. return $core.withContext(function($ctx1) {
  7900. $self._subclassResponsibility();
  7901. return self;
  7902. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7903. },
  7904. args: ["aBlock", "anotherBlock"],
  7905. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  7906. referencedClasses: [],
  7907. messageSends: ["subclassResponsibility"]
  7908. }),
  7909. $globals.Collection);
  7910. $core.addMethod(
  7911. $core.method({
  7912. selector: "do:",
  7913. protocol: "enumerating",
  7914. fn: function (aBlock){
  7915. var self=this,$self=this;
  7916. return $core.withContext(function($ctx1) {
  7917. $self._subclassResponsibility();
  7918. return self;
  7919. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7920. },
  7921. args: ["aBlock"],
  7922. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7923. referencedClasses: [],
  7924. messageSends: ["subclassResponsibility"]
  7925. }),
  7926. $globals.Collection);
  7927. $core.addMethod(
  7928. $core.method({
  7929. selector: "do:separatedBy:",
  7930. protocol: "enumerating",
  7931. fn: function (aBlock,anotherBlock){
  7932. var self=this,$self=this;
  7933. var actionBeforeElement;
  7934. return $core.withContext(function($ctx1) {
  7935. actionBeforeElement=(function(){
  7936. actionBeforeElement=anotherBlock;
  7937. return actionBeforeElement;
  7938. });
  7939. $self._do_((function(each){
  7940. return $core.withContext(function($ctx2) {
  7941. $recv(actionBeforeElement)._value();
  7942. return $recv(aBlock)._value_(each);
  7943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7944. }));
  7945. return self;
  7946. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7947. },
  7948. args: ["aBlock", "anotherBlock"],
  7949. 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 ]",
  7950. referencedClasses: [],
  7951. messageSends: ["do:", "value", "value:"]
  7952. }),
  7953. $globals.Collection);
  7954. $core.addMethod(
  7955. $core.method({
  7956. selector: "errorNotFound",
  7957. protocol: "error handling",
  7958. fn: function (){
  7959. var self=this,$self=this;
  7960. return $core.withContext(function($ctx1) {
  7961. $self._error_("Object is not in the collection");
  7962. return self;
  7963. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7964. },
  7965. args: [],
  7966. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7967. referencedClasses: [],
  7968. messageSends: ["error:"]
  7969. }),
  7970. $globals.Collection);
  7971. $core.addMethod(
  7972. $core.method({
  7973. selector: "ifEmpty:",
  7974. protocol: "testing",
  7975. fn: function (aBlock){
  7976. var self=this,$self=this;
  7977. return $core.withContext(function($ctx1) {
  7978. var $1;
  7979. $1=$self._isEmpty();
  7980. if($core.assert($1)){
  7981. return $recv(aBlock)._value();
  7982. } else {
  7983. return self;
  7984. }
  7985. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7986. },
  7987. args: ["aBlock"],
  7988. 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 ]",
  7989. referencedClasses: [],
  7990. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7991. }),
  7992. $globals.Collection);
  7993. $core.addMethod(
  7994. $core.method({
  7995. selector: "ifEmpty:ifNotEmpty:",
  7996. protocol: "testing",
  7997. fn: function (aBlock,anotherBlock){
  7998. var self=this,$self=this;
  7999. return $core.withContext(function($ctx1) {
  8000. var $1;
  8001. $1=$self._isEmpty();
  8002. if($core.assert($1)){
  8003. return $recv(aBlock)._value();
  8004. } else {
  8005. return $recv(anotherBlock)._value_(self);
  8006. }
  8007. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8008. },
  8009. args: ["aBlock", "anotherBlock"],
  8010. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8011. referencedClasses: [],
  8012. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8013. }),
  8014. $globals.Collection);
  8015. $core.addMethod(
  8016. $core.method({
  8017. selector: "ifNotEmpty:",
  8018. protocol: "testing",
  8019. fn: function (aBlock){
  8020. var self=this,$self=this;
  8021. return $core.withContext(function($ctx1) {
  8022. var $1;
  8023. $1=$self._notEmpty();
  8024. if($core.assert($1)){
  8025. return $recv(aBlock)._value_(self);
  8026. } else {
  8027. return self;
  8028. }
  8029. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8030. },
  8031. args: ["aBlock"],
  8032. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8033. referencedClasses: [],
  8034. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8035. }),
  8036. $globals.Collection);
  8037. $core.addMethod(
  8038. $core.method({
  8039. selector: "ifNotEmpty:ifEmpty:",
  8040. protocol: "testing",
  8041. fn: function (aBlock,anotherBlock){
  8042. var self=this,$self=this;
  8043. return $core.withContext(function($ctx1) {
  8044. var $1;
  8045. $1=$self._notEmpty();
  8046. if($core.assert($1)){
  8047. return $recv(aBlock)._value_(self);
  8048. } else {
  8049. return $recv(anotherBlock)._value();
  8050. }
  8051. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8052. },
  8053. args: ["aBlock", "anotherBlock"],
  8054. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8055. referencedClasses: [],
  8056. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8057. }),
  8058. $globals.Collection);
  8059. $core.addMethod(
  8060. $core.method({
  8061. selector: "includes:",
  8062. protocol: "testing",
  8063. fn: function (anObject){
  8064. var self=this,$self=this;
  8065. return $core.withContext(function($ctx1) {
  8066. return $self._anySatisfy_((function(each){
  8067. return $core.withContext(function($ctx2) {
  8068. return $recv(each).__eq(anObject);
  8069. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8070. }));
  8071. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8072. },
  8073. args: ["anObject"],
  8074. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8075. referencedClasses: [],
  8076. messageSends: ["anySatisfy:", "="]
  8077. }),
  8078. $globals.Collection);
  8079. $core.addMethod(
  8080. $core.method({
  8081. selector: "inject:into:",
  8082. protocol: "enumerating",
  8083. fn: function (anObject,aBlock){
  8084. var self=this,$self=this;
  8085. var result;
  8086. return $core.withContext(function($ctx1) {
  8087. result=anObject;
  8088. $self._do_((function(each){
  8089. return $core.withContext(function($ctx2) {
  8090. result=$recv(aBlock)._value_value_(result,each);
  8091. return result;
  8092. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8093. }));
  8094. return result;
  8095. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8096. },
  8097. args: ["anObject", "aBlock"],
  8098. 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",
  8099. referencedClasses: [],
  8100. messageSends: ["do:", "value:value:"]
  8101. }),
  8102. $globals.Collection);
  8103. $core.addMethod(
  8104. $core.method({
  8105. selector: "intersection:",
  8106. protocol: "enumerating",
  8107. fn: function (aCollection){
  8108. var self=this,$self=this;
  8109. var set,outputSet;
  8110. return $core.withContext(function($ctx1) {
  8111. var $2,$1;
  8112. set=$self._asSet();
  8113. outputSet=$recv($globals.Set)._new();
  8114. $recv(aCollection)._do_((function(each){
  8115. return $core.withContext(function($ctx2) {
  8116. $2=$recv(set)._includes_(each);
  8117. $ctx2.sendIdx["includes:"]=1;
  8118. $1=$recv($2)._and_((function(){
  8119. return $core.withContext(function($ctx3) {
  8120. return $recv($recv(outputSet)._includes_(each))._not();
  8121. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8122. }));
  8123. if($core.assert($1)){
  8124. return $recv(outputSet)._add_(each);
  8125. }
  8126. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8127. }));
  8128. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8129. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8130. },
  8131. args: ["aCollection"],
  8132. 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",
  8133. referencedClasses: ["Set"],
  8134. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8135. }),
  8136. $globals.Collection);
  8137. $core.addMethod(
  8138. $core.method({
  8139. selector: "isEmpty",
  8140. protocol: "testing",
  8141. fn: function (){
  8142. var self=this,$self=this;
  8143. return $core.withContext(function($ctx1) {
  8144. return $recv($self._size()).__eq((0));
  8145. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8146. },
  8147. args: [],
  8148. source: "isEmpty\x0a\x09^ self size = 0",
  8149. referencedClasses: [],
  8150. messageSends: ["=", "size"]
  8151. }),
  8152. $globals.Collection);
  8153. $core.addMethod(
  8154. $core.method({
  8155. selector: "noneSatisfy:",
  8156. protocol: "enumerating",
  8157. fn: function (aBlock){
  8158. var self=this,$self=this;
  8159. return $core.withContext(function($ctx1) {
  8160. var $1;
  8161. var $early={};
  8162. try {
  8163. $self._do_((function(item){
  8164. return $core.withContext(function($ctx2) {
  8165. $1=$recv(aBlock)._value_(item);
  8166. if($core.assert($1)){
  8167. throw $early=[false];
  8168. }
  8169. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8170. }));
  8171. return true;
  8172. }
  8173. catch(e) {if(e===$early)return e[0]; throw e}
  8174. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8175. },
  8176. args: ["aBlock"],
  8177. 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",
  8178. referencedClasses: [],
  8179. messageSends: ["do:", "ifTrue:", "value:"]
  8180. }),
  8181. $globals.Collection);
  8182. $core.addMethod(
  8183. $core.method({
  8184. selector: "notEmpty",
  8185. protocol: "testing",
  8186. fn: function (){
  8187. var self=this,$self=this;
  8188. return $core.withContext(function($ctx1) {
  8189. return $recv($self._isEmpty())._not();
  8190. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8191. },
  8192. args: [],
  8193. source: "notEmpty\x0a\x09^ self isEmpty not",
  8194. referencedClasses: [],
  8195. messageSends: ["not", "isEmpty"]
  8196. }),
  8197. $globals.Collection);
  8198. $core.addMethod(
  8199. $core.method({
  8200. selector: "occurrencesOf:",
  8201. protocol: "accessing",
  8202. fn: function (anObject){
  8203. var self=this,$self=this;
  8204. var tally;
  8205. return $core.withContext(function($ctx1) {
  8206. var $1;
  8207. tally=(0);
  8208. $self._do_((function(each){
  8209. return $core.withContext(function($ctx2) {
  8210. $1=$recv(anObject).__eq(each);
  8211. if($core.assert($1)){
  8212. tally=$recv(tally).__plus((1));
  8213. return tally;
  8214. }
  8215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8216. }));
  8217. return tally;
  8218. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8219. },
  8220. args: ["anObject"],
  8221. 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",
  8222. referencedClasses: [],
  8223. messageSends: ["do:", "ifTrue:", "=", "+"]
  8224. }),
  8225. $globals.Collection);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "putOn:",
  8229. protocol: "streaming",
  8230. fn: function (aStream){
  8231. var self=this,$self=this;
  8232. return $core.withContext(function($ctx1) {
  8233. $self._do_((function(each){
  8234. return $core.withContext(function($ctx2) {
  8235. return $recv(each)._putOn_(aStream);
  8236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8237. }));
  8238. return self;
  8239. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8240. },
  8241. args: ["aStream"],
  8242. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8243. referencedClasses: [],
  8244. messageSends: ["do:", "putOn:"]
  8245. }),
  8246. $globals.Collection);
  8247. $core.addMethod(
  8248. $core.method({
  8249. selector: "reject:",
  8250. protocol: "enumerating",
  8251. fn: function (aBlock){
  8252. var self=this,$self=this;
  8253. return $core.withContext(function($ctx1) {
  8254. return $self._select_((function(each){
  8255. return $core.withContext(function($ctx2) {
  8256. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8258. }));
  8259. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8260. },
  8261. args: ["aBlock"],
  8262. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8263. referencedClasses: [],
  8264. messageSends: ["select:", "=", "value:"]
  8265. }),
  8266. $globals.Collection);
  8267. $core.addMethod(
  8268. $core.method({
  8269. selector: "remove:",
  8270. protocol: "adding/removing",
  8271. fn: function (anObject){
  8272. var self=this,$self=this;
  8273. return $core.withContext(function($ctx1) {
  8274. return $self._remove_ifAbsent_(anObject,(function(){
  8275. return $core.withContext(function($ctx2) {
  8276. return $self._errorNotFound();
  8277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8278. }));
  8279. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8280. },
  8281. args: ["anObject"],
  8282. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8283. referencedClasses: [],
  8284. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8285. }),
  8286. $globals.Collection);
  8287. $core.addMethod(
  8288. $core.method({
  8289. selector: "remove:ifAbsent:",
  8290. protocol: "adding/removing",
  8291. fn: function (anObject,aBlock){
  8292. var self=this,$self=this;
  8293. return $core.withContext(function($ctx1) {
  8294. $self._subclassResponsibility();
  8295. return self;
  8296. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8297. },
  8298. args: ["anObject", "aBlock"],
  8299. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8300. referencedClasses: [],
  8301. messageSends: ["subclassResponsibility"]
  8302. }),
  8303. $globals.Collection);
  8304. $core.addMethod(
  8305. $core.method({
  8306. selector: "removeAll",
  8307. protocol: "adding/removing",
  8308. fn: function (){
  8309. var self=this,$self=this;
  8310. return $core.withContext(function($ctx1) {
  8311. $self._subclassResponsibility();
  8312. return self;
  8313. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8314. },
  8315. args: [],
  8316. source: "removeAll\x0a\x09self subclassResponsibility",
  8317. referencedClasses: [],
  8318. messageSends: ["subclassResponsibility"]
  8319. }),
  8320. $globals.Collection);
  8321. $core.addMethod(
  8322. $core.method({
  8323. selector: "select:",
  8324. protocol: "enumerating",
  8325. fn: function (aBlock){
  8326. var self=this,$self=this;
  8327. var stream;
  8328. return $core.withContext(function($ctx1) {
  8329. var $1;
  8330. stream=$recv($recv($self._class())._new())._writeStream();
  8331. $self._do_((function(each){
  8332. return $core.withContext(function($ctx2) {
  8333. $1=$recv(aBlock)._value_(each);
  8334. if($core.assert($1)){
  8335. return $recv(stream)._nextPut_(each);
  8336. }
  8337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8338. }));
  8339. return $recv(stream)._contents();
  8340. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8341. },
  8342. args: ["aBlock"],
  8343. 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",
  8344. referencedClasses: [],
  8345. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8346. }),
  8347. $globals.Collection);
  8348. $core.addMethod(
  8349. $core.method({
  8350. selector: "select:thenCollect:",
  8351. protocol: "enumerating",
  8352. fn: function (selectBlock,collectBlock){
  8353. var self=this,$self=this;
  8354. var stream;
  8355. return $core.withContext(function($ctx1) {
  8356. var $1;
  8357. stream=$recv($recv($self._class())._new())._writeStream();
  8358. $self._do_((function(each){
  8359. return $core.withContext(function($ctx2) {
  8360. $1=$recv(selectBlock)._value_(each);
  8361. $ctx2.sendIdx["value:"]=1;
  8362. if($core.assert($1)){
  8363. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8364. }
  8365. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8366. }));
  8367. return $recv(stream)._contents();
  8368. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8369. },
  8370. args: ["selectBlock", "collectBlock"],
  8371. 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",
  8372. referencedClasses: [],
  8373. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8374. }),
  8375. $globals.Collection);
  8376. $core.addMethod(
  8377. $core.method({
  8378. selector: "shallowCopy",
  8379. protocol: "copying",
  8380. fn: function (){
  8381. var self=this,$self=this;
  8382. return $core.withContext(function($ctx1) {
  8383. return $self._collect_((function(each){
  8384. return each;
  8385. }));
  8386. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8387. },
  8388. args: [],
  8389. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8390. referencedClasses: [],
  8391. messageSends: ["collect:"]
  8392. }),
  8393. $globals.Collection);
  8394. $core.addMethod(
  8395. $core.method({
  8396. selector: "single",
  8397. protocol: "accessing",
  8398. fn: function (){
  8399. var self=this,$self=this;
  8400. return $core.withContext(function($ctx1) {
  8401. var $1;
  8402. $self._ifEmpty_((function(){
  8403. return $core.withContext(function($ctx2) {
  8404. return $self._error_("Collection is empty");
  8405. $ctx2.sendIdx["error:"]=1;
  8406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8407. }));
  8408. $1=$recv($self._size()).__gt((1));
  8409. if($core.assert($1)){
  8410. $self._error_("Collection holds more than one element");
  8411. }
  8412. return $self._anyOne();
  8413. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8414. },
  8415. args: [],
  8416. 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",
  8417. referencedClasses: [],
  8418. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8419. }),
  8420. $globals.Collection);
  8421. $core.addMethod(
  8422. $core.method({
  8423. selector: "size",
  8424. protocol: "accessing",
  8425. fn: function (){
  8426. var self=this,$self=this;
  8427. return $core.withContext(function($ctx1) {
  8428. $self._subclassResponsibility();
  8429. return self;
  8430. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8431. },
  8432. args: [],
  8433. source: "size\x0a\x09self subclassResponsibility",
  8434. referencedClasses: [],
  8435. messageSends: ["subclassResponsibility"]
  8436. }),
  8437. $globals.Collection);
  8438. $core.addMethod(
  8439. $core.method({
  8440. selector: "classTag",
  8441. protocol: "accessing",
  8442. fn: function (){
  8443. var self=this,$self=this;
  8444. return "collection";
  8445. },
  8446. args: [],
  8447. 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'",
  8448. referencedClasses: [],
  8449. messageSends: []
  8450. }),
  8451. $globals.Collection.a$cls);
  8452. $core.addMethod(
  8453. $core.method({
  8454. selector: "new:",
  8455. protocol: "instance creation",
  8456. fn: function (anInteger){
  8457. var self=this,$self=this;
  8458. return $core.withContext(function($ctx1) {
  8459. return $self._new();
  8460. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8461. },
  8462. args: ["anInteger"],
  8463. source: "new: anInteger\x0a\x09^ self new",
  8464. referencedClasses: [],
  8465. messageSends: ["new"]
  8466. }),
  8467. $globals.Collection.a$cls);
  8468. $core.addMethod(
  8469. $core.method({
  8470. selector: "with:",
  8471. protocol: "instance creation",
  8472. fn: function (anObject){
  8473. var self=this,$self=this;
  8474. return $core.withContext(function($ctx1) {
  8475. var $1;
  8476. $1=$self._new();
  8477. $recv($1)._add_(anObject);
  8478. return $recv($1)._yourself();
  8479. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8480. },
  8481. args: ["anObject"],
  8482. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8483. referencedClasses: [],
  8484. messageSends: ["add:", "new", "yourself"]
  8485. }),
  8486. $globals.Collection.a$cls);
  8487. $core.addMethod(
  8488. $core.method({
  8489. selector: "with:with:",
  8490. protocol: "instance creation",
  8491. fn: function (anObject,anotherObject){
  8492. var self=this,$self=this;
  8493. return $core.withContext(function($ctx1) {
  8494. var $1;
  8495. $1=$self._new();
  8496. $recv($1)._add_(anObject);
  8497. $ctx1.sendIdx["add:"]=1;
  8498. $recv($1)._add_(anotherObject);
  8499. return $recv($1)._yourself();
  8500. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8501. },
  8502. args: ["anObject", "anotherObject"],
  8503. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8504. referencedClasses: [],
  8505. messageSends: ["add:", "new", "yourself"]
  8506. }),
  8507. $globals.Collection.a$cls);
  8508. $core.addMethod(
  8509. $core.method({
  8510. selector: "with:with:with:",
  8511. protocol: "instance creation",
  8512. fn: function (firstObject,secondObject,thirdObject){
  8513. var self=this,$self=this;
  8514. return $core.withContext(function($ctx1) {
  8515. var $1;
  8516. $1=$self._new();
  8517. $recv($1)._add_(firstObject);
  8518. $ctx1.sendIdx["add:"]=1;
  8519. $recv($1)._add_(secondObject);
  8520. $ctx1.sendIdx["add:"]=2;
  8521. $recv($1)._add_(thirdObject);
  8522. return $recv($1)._yourself();
  8523. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8524. },
  8525. args: ["firstObject", "secondObject", "thirdObject"],
  8526. 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",
  8527. referencedClasses: [],
  8528. messageSends: ["add:", "new", "yourself"]
  8529. }),
  8530. $globals.Collection.a$cls);
  8531. $core.addMethod(
  8532. $core.method({
  8533. selector: "withAll:",
  8534. protocol: "instance creation",
  8535. fn: function (aCollection){
  8536. var self=this,$self=this;
  8537. return $core.withContext(function($ctx1) {
  8538. var $1;
  8539. $1=$self._new();
  8540. $recv($1)._addAll_(aCollection);
  8541. return $recv($1)._yourself();
  8542. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8543. },
  8544. args: ["aCollection"],
  8545. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8546. referencedClasses: [],
  8547. messageSends: ["addAll:", "new", "yourself"]
  8548. }),
  8549. $globals.Collection.a$cls);
  8550. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  8551. $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.";
  8552. $core.addMethod(
  8553. $core.method({
  8554. selector: "at:",
  8555. protocol: "accessing",
  8556. fn: function (anIndex){
  8557. var self=this,$self=this;
  8558. return $core.withContext(function($ctx1) {
  8559. return $self._at_ifAbsent_(anIndex,(function(){
  8560. return $core.withContext(function($ctx2) {
  8561. return $self._errorNotFound();
  8562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8563. }));
  8564. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  8565. },
  8566. args: ["anIndex"],
  8567. 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 ]",
  8568. referencedClasses: [],
  8569. messageSends: ["at:ifAbsent:", "errorNotFound"]
  8570. }),
  8571. $globals.IndexableCollection);
  8572. $core.addMethod(
  8573. $core.method({
  8574. selector: "at:ifAbsent:",
  8575. protocol: "accessing",
  8576. fn: function (anIndex,aBlock){
  8577. var self=this,$self=this;
  8578. return $core.withContext(function($ctx1) {
  8579. $self._subclassResponsibility();
  8580. return self;
  8581. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8582. },
  8583. args: ["anIndex", "aBlock"],
  8584. 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",
  8585. referencedClasses: [],
  8586. messageSends: ["subclassResponsibility"]
  8587. }),
  8588. $globals.IndexableCollection);
  8589. $core.addMethod(
  8590. $core.method({
  8591. selector: "at:ifAbsentPut:",
  8592. protocol: "accessing",
  8593. fn: function (aKey,aBlock){
  8594. var self=this,$self=this;
  8595. return $core.withContext(function($ctx1) {
  8596. return $self._at_ifAbsent_(aKey,(function(){
  8597. return $core.withContext(function($ctx2) {
  8598. return $self._at_put_(aKey,$recv(aBlock)._value());
  8599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8600. }));
  8601. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  8602. },
  8603. args: ["aKey", "aBlock"],
  8604. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  8605. referencedClasses: [],
  8606. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  8607. }),
  8608. $globals.IndexableCollection);
  8609. $core.addMethod(
  8610. $core.method({
  8611. selector: "at:ifPresent:",
  8612. protocol: "accessing",
  8613. fn: function (anIndex,aBlock){
  8614. var self=this,$self=this;
  8615. return $core.withContext(function($ctx1) {
  8616. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  8617. return nil;
  8618. }));
  8619. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8620. },
  8621. args: ["anIndex", "aBlock"],
  8622. 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 ]",
  8623. referencedClasses: [],
  8624. messageSends: ["at:ifPresent:ifAbsent:"]
  8625. }),
  8626. $globals.IndexableCollection);
  8627. $core.addMethod(
  8628. $core.method({
  8629. selector: "at:ifPresent:ifAbsent:",
  8630. protocol: "accessing",
  8631. fn: function (anIndex,aBlock,anotherBlock){
  8632. var self=this,$self=this;
  8633. return $core.withContext(function($ctx1) {
  8634. $self._subclassResponsibility();
  8635. return self;
  8636. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  8637. },
  8638. args: ["anIndex", "aBlock", "anotherBlock"],
  8639. 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",
  8640. referencedClasses: [],
  8641. messageSends: ["subclassResponsibility"]
  8642. }),
  8643. $globals.IndexableCollection);
  8644. $core.addMethod(
  8645. $core.method({
  8646. selector: "at:put:",
  8647. protocol: "accessing",
  8648. fn: function (anIndex,anObject){
  8649. var self=this,$self=this;
  8650. return $core.withContext(function($ctx1) {
  8651. $self._subclassResponsibility();
  8652. return self;
  8653. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  8654. },
  8655. args: ["anIndex", "anObject"],
  8656. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  8657. referencedClasses: [],
  8658. messageSends: ["subclassResponsibility"]
  8659. }),
  8660. $globals.IndexableCollection);
  8661. $core.addMethod(
  8662. $core.method({
  8663. selector: "indexOf:",
  8664. protocol: "accessing",
  8665. fn: function (anObject){
  8666. var self=this,$self=this;
  8667. return $core.withContext(function($ctx1) {
  8668. return $self._indexOf_ifAbsent_(anObject,(function(){
  8669. return $core.withContext(function($ctx2) {
  8670. return $self._errorNotFound();
  8671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8672. }));
  8673. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  8674. },
  8675. args: ["anObject"],
  8676. 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 ]",
  8677. referencedClasses: [],
  8678. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  8679. }),
  8680. $globals.IndexableCollection);
  8681. $core.addMethod(
  8682. $core.method({
  8683. selector: "indexOf:ifAbsent:",
  8684. protocol: "accessing",
  8685. fn: function (anObject,aBlock){
  8686. var self=this,$self=this;
  8687. return $core.withContext(function($ctx1) {
  8688. $self._subclassResponsibility();
  8689. return self;
  8690. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  8691. },
  8692. args: ["anObject", "aBlock"],
  8693. 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",
  8694. referencedClasses: [],
  8695. messageSends: ["subclassResponsibility"]
  8696. }),
  8697. $globals.IndexableCollection);
  8698. $core.addMethod(
  8699. $core.method({
  8700. selector: "with:do:",
  8701. protocol: "enumerating",
  8702. fn: function (anotherCollection,aBlock){
  8703. var self=this,$self=this;
  8704. return $core.withContext(function($ctx1) {
  8705. $self._withIndexDo_((function(each,index){
  8706. return $core.withContext(function($ctx2) {
  8707. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  8708. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  8709. }));
  8710. return self;
  8711. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  8712. },
  8713. args: ["anotherCollection", "aBlock"],
  8714. 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) ]",
  8715. referencedClasses: [],
  8716. messageSends: ["withIndexDo:", "value:value:", "at:"]
  8717. }),
  8718. $globals.IndexableCollection);
  8719. $core.addMethod(
  8720. $core.method({
  8721. selector: "withIndexDo:",
  8722. protocol: "enumerating",
  8723. fn: function (aBlock){
  8724. var self=this,$self=this;
  8725. return $core.withContext(function($ctx1) {
  8726. $self._subclassResponsibility();
  8727. return self;
  8728. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  8729. },
  8730. args: ["aBlock"],
  8731. 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",
  8732. referencedClasses: [],
  8733. messageSends: ["subclassResponsibility"]
  8734. }),
  8735. $globals.IndexableCollection);
  8736. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8737. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8738. $core.addMethod(
  8739. $core.method({
  8740. selector: "=",
  8741. protocol: "comparing",
  8742. fn: function (anAssocitativeCollection){
  8743. var self=this,$self=this;
  8744. return $core.withContext(function($ctx1) {
  8745. var $2,$1,$4,$3,$5;
  8746. $2=$self._class();
  8747. $ctx1.sendIdx["class"]=1;
  8748. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8749. $ctx1.sendIdx["="]=1;
  8750. if(!$core.assert($1)){
  8751. return false;
  8752. }
  8753. $4=$self._size();
  8754. $ctx1.sendIdx["size"]=1;
  8755. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8756. $ctx1.sendIdx["="]=2;
  8757. if(!$core.assert($3)){
  8758. return false;
  8759. }
  8760. $5=$self._associations();
  8761. $ctx1.sendIdx["associations"]=1;
  8762. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8763. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8764. },
  8765. args: ["anAssocitativeCollection"],
  8766. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8767. referencedClasses: [],
  8768. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8769. }),
  8770. $globals.AssociativeCollection);
  8771. $core.addMethod(
  8772. $core.method({
  8773. selector: "add:",
  8774. protocol: "adding/removing",
  8775. fn: function (anAssociation){
  8776. var self=this,$self=this;
  8777. return $core.withContext(function($ctx1) {
  8778. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8779. return self;
  8780. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8781. },
  8782. args: ["anAssociation"],
  8783. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8784. referencedClasses: [],
  8785. messageSends: ["at:put:", "key", "value"]
  8786. }),
  8787. $globals.AssociativeCollection);
  8788. $core.addMethod(
  8789. $core.method({
  8790. selector: "addAll:",
  8791. protocol: "adding/removing",
  8792. fn: function (anAssociativeCollection){
  8793. var self=this,$self=this;
  8794. return $core.withContext(function($ctx1) {
  8795. (
  8796. $ctx1.supercall = true,
  8797. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8798. $ctx1.supercall = false;
  8799. return anAssociativeCollection;
  8800. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8801. },
  8802. args: ["anAssociativeCollection"],
  8803. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8804. referencedClasses: [],
  8805. messageSends: ["addAll:", "associations"]
  8806. }),
  8807. $globals.AssociativeCollection);
  8808. $core.addMethod(
  8809. $core.method({
  8810. selector: "asDictionary",
  8811. protocol: "converting",
  8812. fn: function (){
  8813. var self=this,$self=this;
  8814. return $core.withContext(function($ctx1) {
  8815. return $recv($globals.Dictionary)._from_($self._associations());
  8816. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8817. },
  8818. args: [],
  8819. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8820. referencedClasses: ["Dictionary"],
  8821. messageSends: ["from:", "associations"]
  8822. }),
  8823. $globals.AssociativeCollection);
  8824. $core.addMethod(
  8825. $core.method({
  8826. selector: "asHashedCollection",
  8827. protocol: "converting",
  8828. fn: function (){
  8829. var self=this,$self=this;
  8830. return $core.withContext(function($ctx1) {
  8831. return $recv($globals.HashedCollection)._from_($self._associations());
  8832. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8833. },
  8834. args: [],
  8835. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8836. referencedClasses: ["HashedCollection"],
  8837. messageSends: ["from:", "associations"]
  8838. }),
  8839. $globals.AssociativeCollection);
  8840. $core.addMethod(
  8841. $core.method({
  8842. selector: "asJavaScriptObject",
  8843. protocol: "converting",
  8844. fn: function (){
  8845. var self=this,$self=this;
  8846. var hash;
  8847. return $core.withContext(function($ctx1) {
  8848. hash=$recv($globals.HashedCollection)._new();
  8849. $self._keysAndValuesDo_((function(key,value){
  8850. return $core.withContext(function($ctx2) {
  8851. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8852. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8853. }));
  8854. return hash;
  8855. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8856. },
  8857. args: [],
  8858. 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",
  8859. referencedClasses: ["HashedCollection"],
  8860. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8861. }),
  8862. $globals.AssociativeCollection);
  8863. $core.addMethod(
  8864. $core.method({
  8865. selector: "associations",
  8866. protocol: "accessing",
  8867. fn: function (){
  8868. var self=this,$self=this;
  8869. var associations;
  8870. return $core.withContext(function($ctx1) {
  8871. associations=[];
  8872. $self._associationsDo_((function(each){
  8873. return $core.withContext(function($ctx2) {
  8874. return $recv(associations)._add_(each);
  8875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8876. }));
  8877. return associations;
  8878. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8879. },
  8880. args: [],
  8881. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8882. referencedClasses: [],
  8883. messageSends: ["associationsDo:", "add:"]
  8884. }),
  8885. $globals.AssociativeCollection);
  8886. $core.addMethod(
  8887. $core.method({
  8888. selector: "associationsDo:",
  8889. protocol: "enumerating",
  8890. fn: function (aBlock){
  8891. var self=this,$self=this;
  8892. return $core.withContext(function($ctx1) {
  8893. $self._keysAndValuesDo_((function(key,value){
  8894. return $core.withContext(function($ctx2) {
  8895. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8896. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8897. }));
  8898. return self;
  8899. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8900. },
  8901. args: ["aBlock"],
  8902. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8903. referencedClasses: ["Association"],
  8904. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8905. }),
  8906. $globals.AssociativeCollection);
  8907. $core.addMethod(
  8908. $core.method({
  8909. selector: "at:ifPresent:ifAbsent:",
  8910. protocol: "accessing",
  8911. fn: function (aKey,aBlock,anotherBlock){
  8912. var self=this,$self=this;
  8913. return $core.withContext(function($ctx1) {
  8914. var $1;
  8915. $1=$self._includesKey_(aKey);
  8916. if($core.assert($1)){
  8917. return $recv(aBlock)._value_($self._at_(aKey));
  8918. } else {
  8919. return $recv(anotherBlock)._value();
  8920. }
  8921. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8922. },
  8923. args: ["aKey", "aBlock", "anotherBlock"],
  8924. 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 ]",
  8925. referencedClasses: [],
  8926. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8927. }),
  8928. $globals.AssociativeCollection);
  8929. $core.addMethod(
  8930. $core.method({
  8931. selector: "collect:",
  8932. protocol: "enumerating",
  8933. fn: function (aBlock){
  8934. var self=this,$self=this;
  8935. var newDict;
  8936. return $core.withContext(function($ctx1) {
  8937. newDict=$recv($self._class())._new();
  8938. $self._keysAndValuesDo_((function(key,value){
  8939. return $core.withContext(function($ctx2) {
  8940. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8941. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8942. }));
  8943. return newDict;
  8944. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8945. },
  8946. args: ["aBlock"],
  8947. 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",
  8948. referencedClasses: [],
  8949. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8950. }),
  8951. $globals.AssociativeCollection);
  8952. $core.addMethod(
  8953. $core.method({
  8954. selector: "deepCopy",
  8955. protocol: "copying",
  8956. fn: function (){
  8957. var self=this,$self=this;
  8958. var copy;
  8959. return $core.withContext(function($ctx1) {
  8960. copy=$recv($self._class())._new();
  8961. $self._keysAndValuesDo_((function(key,value){
  8962. return $core.withContext(function($ctx2) {
  8963. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8964. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8965. }));
  8966. return copy;
  8967. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8968. },
  8969. args: [],
  8970. 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",
  8971. referencedClasses: [],
  8972. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8973. }),
  8974. $globals.AssociativeCollection);
  8975. $core.addMethod(
  8976. $core.method({
  8977. selector: "detect:ifNone:",
  8978. protocol: "enumerating",
  8979. fn: function (aBlock,anotherBlock){
  8980. var self=this,$self=this;
  8981. return $core.withContext(function($ctx1) {
  8982. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8983. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8984. },
  8985. args: ["aBlock", "anotherBlock"],
  8986. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8987. referencedClasses: [],
  8988. messageSends: ["detect:ifNone:", "values"]
  8989. }),
  8990. $globals.AssociativeCollection);
  8991. $core.addMethod(
  8992. $core.method({
  8993. selector: "do:",
  8994. protocol: "enumerating",
  8995. fn: function (aBlock){
  8996. var self=this,$self=this;
  8997. return $core.withContext(function($ctx1) {
  8998. $self._valuesDo_(aBlock);
  8999. return self;
  9000. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9001. },
  9002. args: ["aBlock"],
  9003. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  9004. referencedClasses: [],
  9005. messageSends: ["valuesDo:"]
  9006. }),
  9007. $globals.AssociativeCollection);
  9008. $core.addMethod(
  9009. $core.method({
  9010. selector: "includes:",
  9011. protocol: "enumerating",
  9012. fn: function (anObject){
  9013. var self=this,$self=this;
  9014. return $core.withContext(function($ctx1) {
  9015. return $recv($self._values())._includes_(anObject);
  9016. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  9017. },
  9018. args: ["anObject"],
  9019. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  9020. referencedClasses: [],
  9021. messageSends: ["includes:", "values"]
  9022. }),
  9023. $globals.AssociativeCollection);
  9024. $core.addMethod(
  9025. $core.method({
  9026. selector: "includesKey:",
  9027. protocol: "testing",
  9028. fn: function (aKey){
  9029. var self=this,$self=this;
  9030. return $core.withContext(function($ctx1) {
  9031. $self._subclassResponsibility();
  9032. return self;
  9033. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9034. },
  9035. args: ["aKey"],
  9036. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  9037. referencedClasses: [],
  9038. messageSends: ["subclassResponsibility"]
  9039. }),
  9040. $globals.AssociativeCollection);
  9041. $core.addMethod(
  9042. $core.method({
  9043. selector: "indexOf:ifAbsent:",
  9044. protocol: "accessing",
  9045. fn: function (anObject,aBlock){
  9046. var self=this,$self=this;
  9047. return $core.withContext(function($ctx1) {
  9048. return $recv($self._keys())._detect_ifNone_((function(each){
  9049. return $core.withContext(function($ctx2) {
  9050. return $recv($self._at_(each)).__eq(anObject);
  9051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9052. }),aBlock);
  9053. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9054. },
  9055. args: ["anObject", "aBlock"],
  9056. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  9057. referencedClasses: [],
  9058. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  9059. }),
  9060. $globals.AssociativeCollection);
  9061. $core.addMethod(
  9062. $core.method({
  9063. selector: "keyAtValue:",
  9064. protocol: "accessing",
  9065. fn: function (anObject){
  9066. var self=this,$self=this;
  9067. return $core.withContext(function($ctx1) {
  9068. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  9069. return $core.withContext(function($ctx2) {
  9070. return $self._errorNotFound();
  9071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9072. }));
  9073. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  9074. },
  9075. args: ["anObject"],
  9076. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9077. referencedClasses: [],
  9078. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  9079. }),
  9080. $globals.AssociativeCollection);
  9081. $core.addMethod(
  9082. $core.method({
  9083. selector: "keyAtValue:ifAbsent:",
  9084. protocol: "accessing",
  9085. fn: function (anObject,aBlock){
  9086. var self=this,$self=this;
  9087. return $core.withContext(function($ctx1) {
  9088. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9089. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9090. },
  9091. args: ["anObject", "aBlock"],
  9092. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9093. referencedClasses: [],
  9094. messageSends: ["indexOf:ifAbsent:"]
  9095. }),
  9096. $globals.AssociativeCollection);
  9097. $core.addMethod(
  9098. $core.method({
  9099. selector: "keys",
  9100. protocol: "accessing",
  9101. fn: function (){
  9102. var self=this,$self=this;
  9103. return $core.withContext(function($ctx1) {
  9104. $self._subclassResponsibility();
  9105. return self;
  9106. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  9107. },
  9108. args: [],
  9109. source: "keys\x0a\x09self subclassResponsibility",
  9110. referencedClasses: [],
  9111. messageSends: ["subclassResponsibility"]
  9112. }),
  9113. $globals.AssociativeCollection);
  9114. $core.addMethod(
  9115. $core.method({
  9116. selector: "keysAndValuesDo:",
  9117. protocol: "enumerating",
  9118. fn: function (aBlock){
  9119. var self=this,$self=this;
  9120. return $core.withContext(function($ctx1) {
  9121. $self._keysDo_((function(each){
  9122. return $core.withContext(function($ctx2) {
  9123. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9125. }));
  9126. return self;
  9127. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9128. },
  9129. args: ["aBlock"],
  9130. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9131. referencedClasses: [],
  9132. messageSends: ["keysDo:", "value:value:", "at:"]
  9133. }),
  9134. $globals.AssociativeCollection);
  9135. $core.addMethod(
  9136. $core.method({
  9137. selector: "keysDo:",
  9138. protocol: "enumerating",
  9139. fn: function (aBlock){
  9140. var self=this,$self=this;
  9141. return $core.withContext(function($ctx1) {
  9142. $self._subclassResponsibility();
  9143. return self;
  9144. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9145. },
  9146. args: ["aBlock"],
  9147. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9148. referencedClasses: [],
  9149. messageSends: ["subclassResponsibility"]
  9150. }),
  9151. $globals.AssociativeCollection);
  9152. $core.addMethod(
  9153. $core.method({
  9154. selector: "printOn:",
  9155. protocol: "printing",
  9156. fn: function (aStream){
  9157. var self=this,$self=this;
  9158. return $core.withContext(function($ctx1) {
  9159. (
  9160. $ctx1.supercall = true,
  9161. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9162. $ctx1.supercall = false;
  9163. $ctx1.sendIdx["printOn:"]=1;
  9164. $recv(aStream)._nextPutAll_(" (");
  9165. $ctx1.sendIdx["nextPutAll:"]=1;
  9166. $recv($self._associations())._do_separatedBy_((function(each){
  9167. return $core.withContext(function($ctx2) {
  9168. return $recv(each)._printOn_(aStream);
  9169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9170. }),(function(){
  9171. return $core.withContext(function($ctx2) {
  9172. return $recv(aStream)._nextPutAll_(" , ");
  9173. $ctx2.sendIdx["nextPutAll:"]=2;
  9174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9175. }));
  9176. $recv(aStream)._nextPutAll_(")");
  9177. return self;
  9178. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9179. },
  9180. args: ["aStream"],
  9181. 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: ')'",
  9182. referencedClasses: [],
  9183. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9184. }),
  9185. $globals.AssociativeCollection);
  9186. $core.addMethod(
  9187. $core.method({
  9188. selector: "remove:ifAbsent:",
  9189. protocol: "adding/removing",
  9190. fn: function (aKey,aBlock){
  9191. var self=this,$self=this;
  9192. return $core.withContext(function($ctx1) {
  9193. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9194. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9195. },
  9196. args: ["aKey", "aBlock"],
  9197. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9198. referencedClasses: [],
  9199. messageSends: ["removeKey:ifAbsent:"]
  9200. }),
  9201. $globals.AssociativeCollection);
  9202. $core.addMethod(
  9203. $core.method({
  9204. selector: "removeAll",
  9205. protocol: "adding/removing",
  9206. fn: function (){
  9207. var self=this,$self=this;
  9208. return $core.withContext(function($ctx1) {
  9209. return $recv($self._keys())._do_((function(each){
  9210. return $core.withContext(function($ctx2) {
  9211. return $self._removeKey_(each);
  9212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9213. }));
  9214. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9215. },
  9216. args: [],
  9217. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9218. referencedClasses: [],
  9219. messageSends: ["do:", "keys", "removeKey:"]
  9220. }),
  9221. $globals.AssociativeCollection);
  9222. $core.addMethod(
  9223. $core.method({
  9224. selector: "removeKey:",
  9225. protocol: "adding/removing",
  9226. fn: function (aKey){
  9227. var self=this,$self=this;
  9228. return $core.withContext(function($ctx1) {
  9229. return $self._remove_(aKey);
  9230. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9231. },
  9232. args: ["aKey"],
  9233. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9234. referencedClasses: [],
  9235. messageSends: ["remove:"]
  9236. }),
  9237. $globals.AssociativeCollection);
  9238. $core.addMethod(
  9239. $core.method({
  9240. selector: "removeKey:ifAbsent:",
  9241. protocol: "adding/removing",
  9242. fn: function (aKey,aBlock){
  9243. var self=this,$self=this;
  9244. return $core.withContext(function($ctx1) {
  9245. $self._subclassResponsibility();
  9246. return self;
  9247. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9248. },
  9249. args: ["aKey", "aBlock"],
  9250. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9251. referencedClasses: [],
  9252. messageSends: ["subclassResponsibility"]
  9253. }),
  9254. $globals.AssociativeCollection);
  9255. $core.addMethod(
  9256. $core.method({
  9257. selector: "select:",
  9258. protocol: "enumerating",
  9259. fn: function (aBlock){
  9260. var self=this,$self=this;
  9261. var newDict;
  9262. return $core.withContext(function($ctx1) {
  9263. var $1;
  9264. newDict=$recv($self._class())._new();
  9265. $self._keysAndValuesDo_((function(key,value){
  9266. return $core.withContext(function($ctx2) {
  9267. $1=$recv(aBlock)._value_(value);
  9268. if($core.assert($1)){
  9269. return $recv(newDict)._at_put_(key,value);
  9270. }
  9271. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9272. }));
  9273. return newDict;
  9274. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9275. },
  9276. args: ["aBlock"],
  9277. 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",
  9278. referencedClasses: [],
  9279. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9280. }),
  9281. $globals.AssociativeCollection);
  9282. $core.addMethod(
  9283. $core.method({
  9284. selector: "select:thenCollect:",
  9285. protocol: "enumerating",
  9286. fn: function (selectBlock,collectBlock){
  9287. var self=this,$self=this;
  9288. var newDict;
  9289. return $core.withContext(function($ctx1) {
  9290. var $1;
  9291. newDict=$recv($self._class())._new();
  9292. $self._keysAndValuesDo_((function(key,value){
  9293. return $core.withContext(function($ctx2) {
  9294. $1=$recv(selectBlock)._value_(value);
  9295. $ctx2.sendIdx["value:"]=1;
  9296. if($core.assert($1)){
  9297. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9298. }
  9299. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9300. }));
  9301. return newDict;
  9302. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9303. },
  9304. args: ["selectBlock", "collectBlock"],
  9305. 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",
  9306. referencedClasses: [],
  9307. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9308. }),
  9309. $globals.AssociativeCollection);
  9310. $core.addMethod(
  9311. $core.method({
  9312. selector: "shallowCopy",
  9313. protocol: "copying",
  9314. fn: function (){
  9315. var self=this,$self=this;
  9316. var copy;
  9317. return $core.withContext(function($ctx1) {
  9318. copy=$recv($self._class())._new();
  9319. $self._keysAndValuesDo_((function(key,value){
  9320. return $core.withContext(function($ctx2) {
  9321. return $recv(copy)._at_put_(key,value);
  9322. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9323. }));
  9324. return copy;
  9325. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9326. },
  9327. args: [],
  9328. 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",
  9329. referencedClasses: [],
  9330. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9331. }),
  9332. $globals.AssociativeCollection);
  9333. $core.addMethod(
  9334. $core.method({
  9335. selector: "size",
  9336. protocol: "accessing",
  9337. fn: function (){
  9338. var self=this,$self=this;
  9339. return $core.withContext(function($ctx1) {
  9340. return $recv($self._keys())._size();
  9341. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9342. },
  9343. args: [],
  9344. source: "size\x0a\x09^ self keys size",
  9345. referencedClasses: [],
  9346. messageSends: ["size", "keys"]
  9347. }),
  9348. $globals.AssociativeCollection);
  9349. $core.addMethod(
  9350. $core.method({
  9351. selector: "values",
  9352. protocol: "accessing",
  9353. fn: function (){
  9354. var self=this,$self=this;
  9355. return $core.withContext(function($ctx1) {
  9356. $self._subclassResponsibility();
  9357. return self;
  9358. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9359. },
  9360. args: [],
  9361. source: "values\x0a\x09self subclassResponsibility",
  9362. referencedClasses: [],
  9363. messageSends: ["subclassResponsibility"]
  9364. }),
  9365. $globals.AssociativeCollection);
  9366. $core.addMethod(
  9367. $core.method({
  9368. selector: "valuesDo:",
  9369. protocol: "enumerating",
  9370. fn: function (aBlock){
  9371. var self=this,$self=this;
  9372. return $core.withContext(function($ctx1) {
  9373. $self._subclassResponsibility();
  9374. return self;
  9375. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9376. },
  9377. args: ["aBlock"],
  9378. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9379. referencedClasses: [],
  9380. messageSends: ["subclassResponsibility"]
  9381. }),
  9382. $globals.AssociativeCollection);
  9383. $core.addMethod(
  9384. $core.method({
  9385. selector: "withIndexDo:",
  9386. protocol: "enumerating",
  9387. fn: function (aBlock){
  9388. var self=this,$self=this;
  9389. return $core.withContext(function($ctx1) {
  9390. $self._keysAndValuesDo_((function(key,value){
  9391. return $core.withContext(function($ctx2) {
  9392. return $recv(aBlock)._value_value_(value,key);
  9393. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9394. }));
  9395. return self;
  9396. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9397. },
  9398. args: ["aBlock"],
  9399. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9400. referencedClasses: [],
  9401. messageSends: ["keysAndValuesDo:", "value:value:"]
  9402. }),
  9403. $globals.AssociativeCollection);
  9404. $core.addMethod(
  9405. $core.method({
  9406. selector: "from:",
  9407. protocol: "instance creation",
  9408. fn: function (aCollection){
  9409. var self=this,$self=this;
  9410. var newCollection;
  9411. return $core.withContext(function($ctx1) {
  9412. newCollection=$self._new();
  9413. $recv(aCollection)._do_((function(each){
  9414. return $core.withContext(function($ctx2) {
  9415. return $recv(newCollection)._add_(each);
  9416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9417. }));
  9418. return newCollection;
  9419. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9420. },
  9421. args: ["aCollection"],
  9422. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9423. referencedClasses: [],
  9424. messageSends: ["new", "do:", "add:"]
  9425. }),
  9426. $globals.AssociativeCollection.a$cls);
  9427. $core.addMethod(
  9428. $core.method({
  9429. selector: "fromPairs:",
  9430. protocol: "instance creation",
  9431. fn: function (aCollection){
  9432. var self=this,$self=this;
  9433. return $core.withContext(function($ctx1) {
  9434. return $self._from_(aCollection);
  9435. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9436. },
  9437. args: ["aCollection"],
  9438. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9439. referencedClasses: [],
  9440. messageSends: ["from:"]
  9441. }),
  9442. $globals.AssociativeCollection.a$cls);
  9443. $core.addMethod(
  9444. $core.method({
  9445. selector: "newFromPairs:",
  9446. protocol: "instance creation",
  9447. fn: function (aCollection){
  9448. var self=this,$self=this;
  9449. var newCollection;
  9450. return $core.withContext(function($ctx1) {
  9451. var $2,$1,$3,$4;
  9452. $2=$recv(aCollection)._size();
  9453. $ctx1.sendIdx["size"]=1;
  9454. $1=$recv($2)._even();
  9455. if(!$core.assert($1)){
  9456. $self._error_("#newFromPairs only accepts arrays of an even length");
  9457. }
  9458. newCollection=$self._new();
  9459. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9460. return $core.withContext(function($ctx2) {
  9461. $3=newCollection;
  9462. $4=$recv(aCollection)._at_(each);
  9463. $ctx2.sendIdx["at:"]=1;
  9464. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9466. }));
  9467. return newCollection;
  9468. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9469. },
  9470. args: ["aCollection"],
  9471. 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",
  9472. referencedClasses: [],
  9473. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9474. }),
  9475. $globals.AssociativeCollection.a$cls);
  9476. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9477. $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.";
  9478. $core.addMethod(
  9479. $core.method({
  9480. selector: "at:ifAbsent:",
  9481. protocol: "accessing",
  9482. fn: function (aKey,aBlock){
  9483. var self=this,$self=this;
  9484. return $core.withContext(function($ctx1) {
  9485. var index = $self._positionOfKey_(aKey);
  9486. return index >=0 ? $self['@values'][index] : aBlock._value();
  9487. ;
  9488. return self;
  9489. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9490. },
  9491. args: ["aKey", "aBlock"],
  9492. 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'>",
  9493. referencedClasses: [],
  9494. messageSends: []
  9495. }),
  9496. $globals.Dictionary);
  9497. $core.addMethod(
  9498. $core.method({
  9499. selector: "at:put:",
  9500. protocol: "accessing",
  9501. fn: function (aKey,aValue){
  9502. var self=this,$self=this;
  9503. return $core.withContext(function($ctx1) {
  9504. var index = $self._positionOfKey_(aKey);
  9505. if(index === -1) {
  9506. var keys = $self['@keys'];
  9507. index = keys.length;
  9508. keys.push(aKey);
  9509. }
  9510. return $self['@values'][index] = aValue;
  9511. ;
  9512. return self;
  9513. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9514. },
  9515. args: ["aKey", "aValue"],
  9516. 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'>",
  9517. referencedClasses: [],
  9518. messageSends: []
  9519. }),
  9520. $globals.Dictionary);
  9521. $core.addMethod(
  9522. $core.method({
  9523. selector: "includesKey:",
  9524. protocol: "testing",
  9525. fn: function (aKey){
  9526. var self=this,$self=this;
  9527. return $core.withContext(function($ctx1) {
  9528. return $self._positionOfKey_(aKey) >= 0;;
  9529. return self;
  9530. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9531. },
  9532. args: ["aKey"],
  9533. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9534. referencedClasses: [],
  9535. messageSends: []
  9536. }),
  9537. $globals.Dictionary);
  9538. $core.addMethod(
  9539. $core.method({
  9540. selector: "indexOf:ifAbsent:",
  9541. protocol: "accessing",
  9542. fn: function (anObject,aBlock){
  9543. var self=this,$self=this;
  9544. var index;
  9545. return $core.withContext(function($ctx1) {
  9546. var $1;
  9547. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9548. return (0);
  9549. }));
  9550. $1=$recv(index).__eq((0));
  9551. if($core.assert($1)){
  9552. return $recv(aBlock)._value();
  9553. } else {
  9554. return $recv($self["@keys"])._at_(index);
  9555. }
  9556. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9557. },
  9558. args: ["anObject", "aBlock"],
  9559. 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 ]",
  9560. referencedClasses: [],
  9561. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9562. }),
  9563. $globals.Dictionary);
  9564. $core.addMethod(
  9565. $core.method({
  9566. selector: "initialize",
  9567. protocol: "initialization",
  9568. fn: function (){
  9569. var self=this,$self=this;
  9570. return $core.withContext(function($ctx1) {
  9571. (
  9572. $ctx1.supercall = true,
  9573. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9574. $ctx1.supercall = false;
  9575. $self["@keys"]=[];
  9576. $self["@values"]=[];
  9577. return self;
  9578. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9579. },
  9580. args: [],
  9581. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9582. referencedClasses: [],
  9583. messageSends: ["initialize"]
  9584. }),
  9585. $globals.Dictionary);
  9586. $core.addMethod(
  9587. $core.method({
  9588. selector: "keys",
  9589. protocol: "accessing",
  9590. fn: function (){
  9591. var self=this,$self=this;
  9592. return $core.withContext(function($ctx1) {
  9593. return $recv($self["@keys"])._copy();
  9594. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9595. },
  9596. args: [],
  9597. source: "keys\x0a\x09^ keys copy",
  9598. referencedClasses: [],
  9599. messageSends: ["copy"]
  9600. }),
  9601. $globals.Dictionary);
  9602. $core.addMethod(
  9603. $core.method({
  9604. selector: "keysAndValuesDo:",
  9605. protocol: "enumerating",
  9606. fn: function (aBlock){
  9607. var self=this,$self=this;
  9608. return $core.withContext(function($ctx1) {
  9609. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9610. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9611. },
  9612. args: ["aBlock"],
  9613. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9614. referencedClasses: [],
  9615. messageSends: ["with:do:"]
  9616. }),
  9617. $globals.Dictionary);
  9618. $core.addMethod(
  9619. $core.method({
  9620. selector: "keysDo:",
  9621. protocol: "enumerating",
  9622. fn: function (aBlock){
  9623. var self=this,$self=this;
  9624. return $core.withContext(function($ctx1) {
  9625. return $recv($self["@keys"])._do_(aBlock);
  9626. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9627. },
  9628. args: ["aBlock"],
  9629. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9630. referencedClasses: [],
  9631. messageSends: ["do:"]
  9632. }),
  9633. $globals.Dictionary);
  9634. $core.addMethod(
  9635. $core.method({
  9636. selector: "positionOfKey:",
  9637. protocol: "private",
  9638. fn: function (anObject){
  9639. var self=this,$self=this;
  9640. return $core.withContext(function($ctx1) {
  9641. var keys = $self['@keys'];
  9642. for(var i=0;i<keys.length;i++){
  9643. if(keys[i].__eq(anObject)) { return i;}
  9644. }
  9645. return -1;
  9646. ;
  9647. return self;
  9648. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9649. },
  9650. args: ["anObject"],
  9651. 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'>",
  9652. referencedClasses: [],
  9653. messageSends: []
  9654. }),
  9655. $globals.Dictionary);
  9656. $core.addMethod(
  9657. $core.method({
  9658. selector: "removeAll",
  9659. protocol: "adding/removing",
  9660. fn: function (){
  9661. var self=this,$self=this;
  9662. return $core.withContext(function($ctx1) {
  9663. $recv($self["@keys"])._removeAll();
  9664. $ctx1.sendIdx["removeAll"]=1;
  9665. $recv($self["@values"])._removeAll();
  9666. return self;
  9667. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9668. },
  9669. args: [],
  9670. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9671. referencedClasses: [],
  9672. messageSends: ["removeAll"]
  9673. }),
  9674. $globals.Dictionary);
  9675. $core.addMethod(
  9676. $core.method({
  9677. selector: "removeKey:ifAbsent:",
  9678. protocol: "adding/removing",
  9679. fn: function (aKey,aBlock){
  9680. var self=this,$self=this;
  9681. return $core.withContext(function($ctx1) {
  9682. var index = $self._positionOfKey_(aKey);
  9683. if(index === -1) {
  9684. return aBlock._value()
  9685. } else {
  9686. var keys = $self['@keys'], values = $self['@values'];
  9687. var value = values[index], l = keys.length;
  9688. keys[index] = keys[l-1];
  9689. keys.pop();
  9690. values[index] = values[l-1];
  9691. values.pop();
  9692. return value;
  9693. }
  9694. ;
  9695. return self;
  9696. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9697. },
  9698. args: ["aKey", "aBlock"],
  9699. 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'>",
  9700. referencedClasses: [],
  9701. messageSends: []
  9702. }),
  9703. $globals.Dictionary);
  9704. $core.addMethod(
  9705. $core.method({
  9706. selector: "values",
  9707. protocol: "accessing",
  9708. fn: function (){
  9709. var self=this,$self=this;
  9710. return $self["@values"];
  9711. },
  9712. args: [],
  9713. source: "values\x0a\x09^ values",
  9714. referencedClasses: [],
  9715. messageSends: []
  9716. }),
  9717. $globals.Dictionary);
  9718. $core.addMethod(
  9719. $core.method({
  9720. selector: "valuesDo:",
  9721. protocol: "enumerating",
  9722. fn: function (aBlock){
  9723. var self=this,$self=this;
  9724. return $core.withContext(function($ctx1) {
  9725. return $recv($self["@values"])._do_(aBlock);
  9726. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9727. },
  9728. args: ["aBlock"],
  9729. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9730. referencedClasses: [],
  9731. messageSends: ["do:"]
  9732. }),
  9733. $globals.Dictionary);
  9734. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9735. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9736. $core.addMethod(
  9737. $core.method({
  9738. selector: "at:ifAbsent:",
  9739. protocol: "accessing",
  9740. fn: function (aKey,aBlock){
  9741. var self=this,$self=this;
  9742. return $core.withContext(function($ctx1) {
  9743. var $1;
  9744. $1=$self._includesKey_(aKey);
  9745. if($core.assert($1)){
  9746. return $self._basicAt_(aKey);
  9747. } else {
  9748. return $recv(aBlock)._value();
  9749. }
  9750. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9751. },
  9752. args: ["aKey", "aBlock"],
  9753. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9754. referencedClasses: [],
  9755. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9756. }),
  9757. $globals.HashedCollection);
  9758. $core.addMethod(
  9759. $core.method({
  9760. selector: "at:put:",
  9761. protocol: "accessing",
  9762. fn: function (aKey,aValue){
  9763. var self=this,$self=this;
  9764. return $core.withContext(function($ctx1) {
  9765. return $self._basicAt_put_(aKey,aValue);
  9766. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9767. },
  9768. args: ["aKey", "aValue"],
  9769. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9770. referencedClasses: [],
  9771. messageSends: ["basicAt:put:"]
  9772. }),
  9773. $globals.HashedCollection);
  9774. $core.addMethod(
  9775. $core.method({
  9776. selector: "includesKey:",
  9777. protocol: "testing",
  9778. fn: function (aKey){
  9779. var self=this,$self=this;
  9780. return $core.withContext(function($ctx1) {
  9781. return self.hasOwnProperty(aKey);
  9782. return self;
  9783. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9784. },
  9785. args: ["aKey"],
  9786. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9787. referencedClasses: [],
  9788. messageSends: []
  9789. }),
  9790. $globals.HashedCollection);
  9791. $core.addMethod(
  9792. $core.method({
  9793. selector: "keys",
  9794. protocol: "accessing",
  9795. fn: function (){
  9796. var self=this,$self=this;
  9797. return $core.withContext(function($ctx1) {
  9798. return Object.keys(self);
  9799. return self;
  9800. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9801. },
  9802. args: [],
  9803. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9804. referencedClasses: [],
  9805. messageSends: []
  9806. }),
  9807. $globals.HashedCollection);
  9808. $core.addMethod(
  9809. $core.method({
  9810. selector: "keysDo:",
  9811. protocol: "enumerating",
  9812. fn: function (aBlock){
  9813. var self=this,$self=this;
  9814. return $core.withContext(function($ctx1) {
  9815. $recv($self._keys())._do_(aBlock);
  9816. return self;
  9817. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9818. },
  9819. args: ["aBlock"],
  9820. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9821. referencedClasses: [],
  9822. messageSends: ["do:", "keys"]
  9823. }),
  9824. $globals.HashedCollection);
  9825. $core.addMethod(
  9826. $core.method({
  9827. selector: "removeKey:ifAbsent:",
  9828. protocol: "adding/removing",
  9829. fn: function (aKey,aBlock){
  9830. var self=this,$self=this;
  9831. return $core.withContext(function($ctx1) {
  9832. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9833. return $core.withContext(function($ctx2) {
  9834. $self._basicDelete_(aKey);
  9835. return removed;
  9836. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9837. }),(function(){
  9838. return $core.withContext(function($ctx2) {
  9839. return $recv(aBlock)._value();
  9840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9841. }));
  9842. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9843. },
  9844. args: ["aKey", "aBlock"],
  9845. 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 ]",
  9846. referencedClasses: [],
  9847. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9848. }),
  9849. $globals.HashedCollection);
  9850. $core.addMethod(
  9851. $core.method({
  9852. selector: "values",
  9853. protocol: "accessing",
  9854. fn: function (){
  9855. var self=this,$self=this;
  9856. return $core.withContext(function($ctx1) {
  9857. return $self._keys().map(function(key){
  9858. return $self._at_(key);
  9859. });
  9860. ;
  9861. return self;
  9862. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9863. },
  9864. args: [],
  9865. 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'>",
  9866. referencedClasses: [],
  9867. messageSends: []
  9868. }),
  9869. $globals.HashedCollection);
  9870. $core.addMethod(
  9871. $core.method({
  9872. selector: "valuesDo:",
  9873. protocol: "enumerating",
  9874. fn: function (aBlock){
  9875. var self=this,$self=this;
  9876. return $core.withContext(function($ctx1) {
  9877. $recv($self._values())._do_(aBlock);
  9878. return self;
  9879. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9880. },
  9881. args: ["aBlock"],
  9882. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9883. referencedClasses: [],
  9884. messageSends: ["do:", "values"]
  9885. }),
  9886. $globals.HashedCollection);
  9887. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  9888. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9889. $core.addMethod(
  9890. $core.method({
  9891. selector: "=",
  9892. protocol: "comparing",
  9893. fn: function (aCollection){
  9894. var self=this,$self=this;
  9895. return $core.withContext(function($ctx1) {
  9896. var $3,$2,$4,$1,$5;
  9897. var $early={};
  9898. try {
  9899. $3=$self._class();
  9900. $ctx1.sendIdx["class"]=1;
  9901. $2=$recv($3).__eq($recv(aCollection)._class());
  9902. $ctx1.sendIdx["="]=1;
  9903. $1=$recv($2)._and_((function(){
  9904. return $core.withContext(function($ctx2) {
  9905. $4=$self._size();
  9906. $ctx2.sendIdx["size"]=1;
  9907. return $recv($4).__eq($recv(aCollection)._size());
  9908. $ctx2.sendIdx["="]=2;
  9909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9910. }));
  9911. if(!$core.assert($1)){
  9912. return false;
  9913. }
  9914. $self._withIndexDo_((function(each,i){
  9915. return $core.withContext(function($ctx2) {
  9916. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9917. if(!$core.assert($5)){
  9918. throw $early=[false];
  9919. }
  9920. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9921. }));
  9922. return true;
  9923. }
  9924. catch(e) {if(e===$early)return e[0]; throw e}
  9925. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9926. },
  9927. args: ["aCollection"],
  9928. 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",
  9929. referencedClasses: [],
  9930. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9931. }),
  9932. $globals.SequenceableCollection);
  9933. $core.addMethod(
  9934. $core.method({
  9935. selector: "addLast:",
  9936. protocol: "adding/removing",
  9937. fn: function (anObject){
  9938. var self=this,$self=this;
  9939. return $core.withContext(function($ctx1) {
  9940. $self._add_(anObject);
  9941. return self;
  9942. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9943. },
  9944. args: ["anObject"],
  9945. source: "addLast: anObject\x0a\x09self add: anObject",
  9946. referencedClasses: [],
  9947. messageSends: ["add:"]
  9948. }),
  9949. $globals.SequenceableCollection);
  9950. $core.addMethod(
  9951. $core.method({
  9952. selector: "allButFirst",
  9953. protocol: "accessing",
  9954. fn: function (){
  9955. var self=this,$self=this;
  9956. return $core.withContext(function($ctx1) {
  9957. return $self._copyFrom_to_((2),$self._size());
  9958. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9959. },
  9960. args: [],
  9961. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9962. referencedClasses: [],
  9963. messageSends: ["copyFrom:to:", "size"]
  9964. }),
  9965. $globals.SequenceableCollection);
  9966. $core.addMethod(
  9967. $core.method({
  9968. selector: "allButLast",
  9969. protocol: "accessing",
  9970. fn: function (){
  9971. var self=this,$self=this;
  9972. return $core.withContext(function($ctx1) {
  9973. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9974. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9975. },
  9976. args: [],
  9977. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9978. referencedClasses: [],
  9979. messageSends: ["copyFrom:to:", "-", "size"]
  9980. }),
  9981. $globals.SequenceableCollection);
  9982. $core.addMethod(
  9983. $core.method({
  9984. selector: "anyOne",
  9985. protocol: "accessing",
  9986. fn: function (){
  9987. var self=this,$self=this;
  9988. return $core.withContext(function($ctx1) {
  9989. return $self._at_((1));
  9990. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9991. },
  9992. args: [],
  9993. source: "anyOne\x0a\x09^ self at: 1",
  9994. referencedClasses: [],
  9995. messageSends: ["at:"]
  9996. }),
  9997. $globals.SequenceableCollection);
  9998. $core.addMethod(
  9999. $core.method({
  10000. selector: "atRandom",
  10001. protocol: "accessing",
  10002. fn: function (){
  10003. var self=this,$self=this;
  10004. return $core.withContext(function($ctx1) {
  10005. return $self._at_($recv($self._size())._atRandom());
  10006. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  10007. },
  10008. args: [],
  10009. source: "atRandom\x0a\x09^ self at: self size atRandom",
  10010. referencedClasses: [],
  10011. messageSends: ["at:", "atRandom", "size"]
  10012. }),
  10013. $globals.SequenceableCollection);
  10014. $core.addMethod(
  10015. $core.method({
  10016. selector: "beginsWith:",
  10017. protocol: "testing",
  10018. fn: function (prefix){
  10019. var self=this,$self=this;
  10020. return $core.withContext(function($ctx1) {
  10021. var $2,$3,$1;
  10022. $2=$self._size();
  10023. $ctx1.sendIdx["size"]=1;
  10024. $3=$recv(prefix)._size();
  10025. $ctx1.sendIdx["size"]=2;
  10026. $1=$recv($2).__lt($3);
  10027. if($core.assert($1)){
  10028. return false;
  10029. }
  10030. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  10031. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  10032. },
  10033. args: ["prefix"],
  10034. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  10035. referencedClasses: [],
  10036. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  10037. }),
  10038. $globals.SequenceableCollection);
  10039. $core.addMethod(
  10040. $core.method({
  10041. selector: "copyFrom:to:",
  10042. protocol: "copying",
  10043. fn: function (anIndex,anotherIndex){
  10044. var self=this,$self=this;
  10045. return $core.withContext(function($ctx1) {
  10046. $self._subclassResponsibility();
  10047. return self;
  10048. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  10049. },
  10050. args: ["anIndex", "anotherIndex"],
  10051. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  10052. referencedClasses: [],
  10053. messageSends: ["subclassResponsibility"]
  10054. }),
  10055. $globals.SequenceableCollection);
  10056. $core.addMethod(
  10057. $core.method({
  10058. selector: "detect:ifNone:",
  10059. protocol: "enumerating",
  10060. fn: function (aBlock,anotherBlock){
  10061. var self=this,$self=this;
  10062. return $core.withContext(function($ctx1) {
  10063. var nself = $self._numericallyIndexable();
  10064. for(var i = 0; i < nself.length; i++)
  10065. if(aBlock._value_(nself[i]))
  10066. return nself[i];
  10067. return anotherBlock._value();
  10068. ;
  10069. return self;
  10070. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  10071. },
  10072. args: ["aBlock", "anotherBlock"],
  10073. 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'>",
  10074. referencedClasses: [],
  10075. messageSends: []
  10076. }),
  10077. $globals.SequenceableCollection);
  10078. $core.addMethod(
  10079. $core.method({
  10080. selector: "do:",
  10081. protocol: "enumerating",
  10082. fn: function (aBlock){
  10083. var self=this,$self=this;
  10084. return $core.withContext(function($ctx1) {
  10085. var nself = $self._numericallyIndexable();
  10086. for(var i=0; i < nself.length; i++) {
  10087. aBlock._value_(nself[i]);
  10088. }
  10089. ;
  10090. return self;
  10091. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10092. },
  10093. args: ["aBlock"],
  10094. 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'>",
  10095. referencedClasses: [],
  10096. messageSends: []
  10097. }),
  10098. $globals.SequenceableCollection);
  10099. $core.addMethod(
  10100. $core.method({
  10101. selector: "endsWith:",
  10102. protocol: "testing",
  10103. fn: function (suffix){
  10104. var self=this,$self=this;
  10105. return $core.withContext(function($ctx1) {
  10106. var $2,$3,$1;
  10107. $2=$self._size();
  10108. $ctx1.sendIdx["size"]=1;
  10109. $3=$recv(suffix)._size();
  10110. $ctx1.sendIdx["size"]=2;
  10111. $1=$recv($2).__lt($3);
  10112. if($core.assert($1)){
  10113. return false;
  10114. }
  10115. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10116. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  10117. },
  10118. args: ["suffix"],
  10119. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10120. referencedClasses: [],
  10121. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10122. }),
  10123. $globals.SequenceableCollection);
  10124. $core.addMethod(
  10125. $core.method({
  10126. selector: "first",
  10127. protocol: "accessing",
  10128. fn: function (){
  10129. var self=this,$self=this;
  10130. return $core.withContext(function($ctx1) {
  10131. return $self._at_((1));
  10132. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10133. },
  10134. args: [],
  10135. source: "first\x0a\x09^ self at: 1",
  10136. referencedClasses: [],
  10137. messageSends: ["at:"]
  10138. }),
  10139. $globals.SequenceableCollection);
  10140. $core.addMethod(
  10141. $core.method({
  10142. selector: "first:",
  10143. protocol: "accessing",
  10144. fn: function (aNumber){
  10145. var self=this,$self=this;
  10146. return $core.withContext(function($ctx1) {
  10147. var $1;
  10148. $1=$recv($self._size()).__lt(aNumber);
  10149. if($core.assert($1)){
  10150. $self._error_("Invalid number of elements");
  10151. }
  10152. return $self._copyFrom_to_((1),aNumber);
  10153. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10154. },
  10155. args: ["aNumber"],
  10156. 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",
  10157. referencedClasses: [],
  10158. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10159. }),
  10160. $globals.SequenceableCollection);
  10161. $core.addMethod(
  10162. $core.method({
  10163. selector: "fourth",
  10164. protocol: "accessing",
  10165. fn: function (){
  10166. var self=this,$self=this;
  10167. return $core.withContext(function($ctx1) {
  10168. return $self._at_((4));
  10169. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10170. },
  10171. args: [],
  10172. source: "fourth\x0a\x09^ self at: 4",
  10173. referencedClasses: [],
  10174. messageSends: ["at:"]
  10175. }),
  10176. $globals.SequenceableCollection);
  10177. $core.addMethod(
  10178. $core.method({
  10179. selector: "includes:",
  10180. protocol: "testing",
  10181. fn: function (anObject){
  10182. var self=this,$self=this;
  10183. return $core.withContext(function($ctx1) {
  10184. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10185. return nil;
  10186. })))._notNil();
  10187. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10188. },
  10189. args: ["anObject"],
  10190. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10191. referencedClasses: [],
  10192. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10193. }),
  10194. $globals.SequenceableCollection);
  10195. $core.addMethod(
  10196. $core.method({
  10197. selector: "indexOf:ifAbsent:",
  10198. protocol: "accessing",
  10199. fn: function (anObject,aBlock){
  10200. var self=this,$self=this;
  10201. return $core.withContext(function($ctx1) {
  10202. var nself = $self._numericallyIndexable();
  10203. for(var i=0; i < nself.length; i++) {
  10204. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10205. };
  10206. return aBlock._value();
  10207. ;
  10208. return self;
  10209. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  10210. },
  10211. args: ["anObject", "aBlock"],
  10212. 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'>",
  10213. referencedClasses: [],
  10214. messageSends: []
  10215. }),
  10216. $globals.SequenceableCollection);
  10217. $core.addMethod(
  10218. $core.method({
  10219. selector: "indexOf:startingAt:",
  10220. protocol: "accessing",
  10221. fn: function (anObject,start){
  10222. var self=this,$self=this;
  10223. return $core.withContext(function($ctx1) {
  10224. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10225. return (0);
  10226. }));
  10227. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10228. },
  10229. args: ["anObject", "start"],
  10230. 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 ]",
  10231. referencedClasses: [],
  10232. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10233. }),
  10234. $globals.SequenceableCollection);
  10235. $core.addMethod(
  10236. $core.method({
  10237. selector: "indexOf:startingAt:ifAbsent:",
  10238. protocol: "accessing",
  10239. fn: function (anObject,start,aBlock){
  10240. var self=this,$self=this;
  10241. return $core.withContext(function($ctx1) {
  10242. var nself = $self._numericallyIndexable();
  10243. for(var i=start - 1; i < nself.length; i++){
  10244. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10245. }
  10246. return aBlock._value();
  10247. ;
  10248. return self;
  10249. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10250. },
  10251. args: ["anObject", "start", "aBlock"],
  10252. 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'>",
  10253. referencedClasses: [],
  10254. messageSends: []
  10255. }),
  10256. $globals.SequenceableCollection);
  10257. $core.addMethod(
  10258. $core.method({
  10259. selector: "last",
  10260. protocol: "accessing",
  10261. fn: function (){
  10262. var self=this,$self=this;
  10263. return $core.withContext(function($ctx1) {
  10264. return $self._at_($self._size());
  10265. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10266. },
  10267. args: [],
  10268. source: "last\x0a\x09^ self at: self size",
  10269. referencedClasses: [],
  10270. messageSends: ["at:", "size"]
  10271. }),
  10272. $globals.SequenceableCollection);
  10273. $core.addMethod(
  10274. $core.method({
  10275. selector: "last:",
  10276. protocol: "accessing",
  10277. fn: function (aNumber){
  10278. var self=this,$self=this;
  10279. return $core.withContext(function($ctx1) {
  10280. var $2,$1,$5,$4,$3;
  10281. $2=$self._size();
  10282. $ctx1.sendIdx["size"]=1;
  10283. $1=$recv($2).__lt(aNumber);
  10284. if($core.assert($1)){
  10285. $self._error_("Invalid number of elements");
  10286. }
  10287. $5=$self._size();
  10288. $ctx1.sendIdx["size"]=2;
  10289. $4=$recv($5).__minus(aNumber);
  10290. $3=$recv($4).__plus((1));
  10291. return $self._copyFrom_to_($3,$self._size());
  10292. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10293. },
  10294. args: ["aNumber"],
  10295. 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",
  10296. referencedClasses: [],
  10297. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10298. }),
  10299. $globals.SequenceableCollection);
  10300. $core.addMethod(
  10301. $core.method({
  10302. selector: "newStream",
  10303. protocol: "streaming",
  10304. fn: function (){
  10305. var self=this,$self=this;
  10306. return $core.withContext(function($ctx1) {
  10307. return $recv($self._streamClass())._on_(self);
  10308. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10309. },
  10310. args: [],
  10311. source: "newStream\x0a\x09^ self streamClass on: self",
  10312. referencedClasses: [],
  10313. messageSends: ["on:", "streamClass"]
  10314. }),
  10315. $globals.SequenceableCollection);
  10316. $core.addMethod(
  10317. $core.method({
  10318. selector: "numericallyIndexable",
  10319. protocol: "private",
  10320. fn: function (){
  10321. var self=this,$self=this;
  10322. return $core.withContext(function($ctx1) {
  10323. $self._subclassResponsibility();
  10324. return self;
  10325. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  10326. },
  10327. args: [],
  10328. 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",
  10329. referencedClasses: [],
  10330. messageSends: ["subclassResponsibility"]
  10331. }),
  10332. $globals.SequenceableCollection);
  10333. $core.addMethod(
  10334. $core.method({
  10335. selector: "readStream",
  10336. protocol: "streaming",
  10337. fn: function (){
  10338. var self=this,$self=this;
  10339. return $core.withContext(function($ctx1) {
  10340. return $self._stream();
  10341. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10342. },
  10343. args: [],
  10344. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10345. referencedClasses: [],
  10346. messageSends: ["stream"]
  10347. }),
  10348. $globals.SequenceableCollection);
  10349. $core.addMethod(
  10350. $core.method({
  10351. selector: "removeLast",
  10352. protocol: "adding/removing",
  10353. fn: function (){
  10354. var self=this,$self=this;
  10355. return $core.withContext(function($ctx1) {
  10356. return $self._remove_($self._last());
  10357. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10358. },
  10359. args: [],
  10360. source: "removeLast\x0a\x09^ self remove: self last",
  10361. referencedClasses: [],
  10362. messageSends: ["remove:", "last"]
  10363. }),
  10364. $globals.SequenceableCollection);
  10365. $core.addMethod(
  10366. $core.method({
  10367. selector: "reverseDo:",
  10368. protocol: "enumerating",
  10369. fn: function (aBlock){
  10370. var self=this,$self=this;
  10371. return $core.withContext(function($ctx1) {
  10372. $recv($self._reversed())._do_(aBlock);
  10373. return self;
  10374. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10375. },
  10376. args: ["aBlock"],
  10377. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10378. referencedClasses: [],
  10379. messageSends: ["do:", "reversed"]
  10380. }),
  10381. $globals.SequenceableCollection);
  10382. $core.addMethod(
  10383. $core.method({
  10384. selector: "reversed",
  10385. protocol: "converting",
  10386. fn: function (){
  10387. var self=this,$self=this;
  10388. return $core.withContext(function($ctx1) {
  10389. $self._subclassResponsibility();
  10390. return self;
  10391. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10392. },
  10393. args: [],
  10394. source: "reversed\x0a\x09self subclassResponsibility",
  10395. referencedClasses: [],
  10396. messageSends: ["subclassResponsibility"]
  10397. }),
  10398. $globals.SequenceableCollection);
  10399. $core.addMethod(
  10400. $core.method({
  10401. selector: "second",
  10402. protocol: "accessing",
  10403. fn: function (){
  10404. var self=this,$self=this;
  10405. return $core.withContext(function($ctx1) {
  10406. return $self._at_((2));
  10407. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10408. },
  10409. args: [],
  10410. source: "second\x0a\x09^ self at: 2",
  10411. referencedClasses: [],
  10412. messageSends: ["at:"]
  10413. }),
  10414. $globals.SequenceableCollection);
  10415. $core.addMethod(
  10416. $core.method({
  10417. selector: "single",
  10418. protocol: "accessing",
  10419. fn: function (){
  10420. var self=this,$self=this;
  10421. return $core.withContext(function($ctx1) {
  10422. if (self.length == 0) throw new Error("Collection is empty");
  10423. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10424. return $self._numericallyIndexable()[0];;
  10425. return self;
  10426. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  10427. },
  10428. args: [],
  10429. 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'>",
  10430. referencedClasses: [],
  10431. messageSends: []
  10432. }),
  10433. $globals.SequenceableCollection);
  10434. $core.addMethod(
  10435. $core.method({
  10436. selector: "stream",
  10437. protocol: "streaming",
  10438. fn: function (){
  10439. var self=this,$self=this;
  10440. return $core.withContext(function($ctx1) {
  10441. return $self._newStream();
  10442. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10443. },
  10444. args: [],
  10445. source: "stream\x0a\x09^ self newStream",
  10446. referencedClasses: [],
  10447. messageSends: ["newStream"]
  10448. }),
  10449. $globals.SequenceableCollection);
  10450. $core.addMethod(
  10451. $core.method({
  10452. selector: "streamClass",
  10453. protocol: "streaming",
  10454. fn: function (){
  10455. var self=this,$self=this;
  10456. return $core.withContext(function($ctx1) {
  10457. return $recv($self._class())._streamClass();
  10458. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10459. },
  10460. args: [],
  10461. source: "streamClass\x0a\x09^ self class streamClass",
  10462. referencedClasses: [],
  10463. messageSends: ["streamClass", "class"]
  10464. }),
  10465. $globals.SequenceableCollection);
  10466. $core.addMethod(
  10467. $core.method({
  10468. selector: "third",
  10469. protocol: "accessing",
  10470. fn: function (){
  10471. var self=this,$self=this;
  10472. return $core.withContext(function($ctx1) {
  10473. return $self._at_((3));
  10474. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10475. },
  10476. args: [],
  10477. source: "third\x0a\x09^ self at: 3",
  10478. referencedClasses: [],
  10479. messageSends: ["at:"]
  10480. }),
  10481. $globals.SequenceableCollection);
  10482. $core.addMethod(
  10483. $core.method({
  10484. selector: "with:do:",
  10485. protocol: "enumerating",
  10486. fn: function (anotherCollection,aBlock){
  10487. var self=this,$self=this;
  10488. return $core.withContext(function($ctx1) {
  10489. var nself = $self._numericallyIndexable();
  10490. anotherCollection = anotherCollection._numericallyIndexable();
  10491. for(var i=0; i<nself.length; i++) {
  10492. aBlock._value_value_(nself[i], anotherCollection[i]);
  10493. }
  10494. ;
  10495. return self;
  10496. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  10497. },
  10498. args: ["anotherCollection", "aBlock"],
  10499. 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'>",
  10500. referencedClasses: [],
  10501. messageSends: []
  10502. }),
  10503. $globals.SequenceableCollection);
  10504. $core.addMethod(
  10505. $core.method({
  10506. selector: "withIndexDo:",
  10507. protocol: "enumerating",
  10508. fn: function (aBlock){
  10509. var self=this,$self=this;
  10510. return $core.withContext(function($ctx1) {
  10511. var nself = $self._numericallyIndexable();
  10512. for(var i=0; i < nself.length; i++) {
  10513. aBlock._value_value_(nself[i], i+1);
  10514. }
  10515. ;
  10516. return self;
  10517. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10518. },
  10519. args: ["aBlock"],
  10520. 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'>",
  10521. referencedClasses: [],
  10522. messageSends: []
  10523. }),
  10524. $globals.SequenceableCollection);
  10525. $core.addMethod(
  10526. $core.method({
  10527. selector: "writeStream",
  10528. protocol: "streaming",
  10529. fn: function (){
  10530. var self=this,$self=this;
  10531. return $core.withContext(function($ctx1) {
  10532. return $self._stream();
  10533. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10534. },
  10535. args: [],
  10536. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10537. referencedClasses: [],
  10538. messageSends: ["stream"]
  10539. }),
  10540. $globals.SequenceableCollection);
  10541. $core.addMethod(
  10542. $core.method({
  10543. selector: "streamClass",
  10544. protocol: "accessing",
  10545. fn: function (){
  10546. var self=this,$self=this;
  10547. return $globals.Stream;
  10548. },
  10549. args: [],
  10550. source: "streamClass\x0a\x09\x09^ Stream",
  10551. referencedClasses: ["Stream"],
  10552. messageSends: []
  10553. }),
  10554. $globals.SequenceableCollection.a$cls);
  10555. $core.addMethod(
  10556. $core.method({
  10557. selector: "streamContents:",
  10558. protocol: "streaming",
  10559. fn: function (aBlock){
  10560. var self=this,$self=this;
  10561. var stream;
  10562. return $core.withContext(function($ctx1) {
  10563. stream=$recv($self._streamClass())._on_($self._new());
  10564. $recv(aBlock)._value_(stream);
  10565. return $recv(stream)._contents();
  10566. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10567. },
  10568. args: ["aBlock"],
  10569. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10570. referencedClasses: [],
  10571. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10572. }),
  10573. $globals.SequenceableCollection.a$cls);
  10574. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10575. $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`.";
  10576. $core.addMethod(
  10577. $core.method({
  10578. selector: "add:",
  10579. protocol: "adding/removing",
  10580. fn: function (anObject){
  10581. var self=this,$self=this;
  10582. return $core.withContext(function($ctx1) {
  10583. self.push(anObject); return anObject;;
  10584. return self;
  10585. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10586. },
  10587. args: ["anObject"],
  10588. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10589. referencedClasses: [],
  10590. messageSends: []
  10591. }),
  10592. $globals.Array);
  10593. $core.addMethod(
  10594. $core.method({
  10595. selector: "addAll:",
  10596. protocol: "adding/removing",
  10597. fn: function (aCollection){
  10598. var self=this,$self=this;
  10599. return $core.withContext(function($ctx1) {
  10600. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10601. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10602. return aCollection;;
  10603. return self;
  10604. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10605. },
  10606. args: ["aCollection"],
  10607. 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'>",
  10608. referencedClasses: [],
  10609. messageSends: []
  10610. }),
  10611. $globals.Array);
  10612. $core.addMethod(
  10613. $core.method({
  10614. selector: "addFirst:",
  10615. protocol: "adding/removing",
  10616. fn: function (anObject){
  10617. var self=this,$self=this;
  10618. return $core.withContext(function($ctx1) {
  10619. self.unshift(anObject); return anObject;;
  10620. return self;
  10621. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10622. },
  10623. args: ["anObject"],
  10624. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10625. referencedClasses: [],
  10626. messageSends: []
  10627. }),
  10628. $globals.Array);
  10629. $core.addMethod(
  10630. $core.method({
  10631. selector: "asJavaScriptSource",
  10632. protocol: "converting",
  10633. fn: function (){
  10634. var self=this,$self=this;
  10635. return $core.withContext(function($ctx1) {
  10636. var $1;
  10637. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10638. return $core.withContext(function($ctx2) {
  10639. return $recv(each)._asJavaScriptSource();
  10640. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10641. })))._join_(", "))).__comma("]");
  10642. $ctx1.sendIdx[","]=1;
  10643. return $1;
  10644. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10645. },
  10646. args: [],
  10647. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10648. referencedClasses: [],
  10649. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10650. }),
  10651. $globals.Array);
  10652. $core.addMethod(
  10653. $core.method({
  10654. selector: "at:ifAbsent:",
  10655. protocol: "accessing",
  10656. fn: function (anIndex,aBlock){
  10657. var self=this,$self=this;
  10658. return $core.withContext(function($ctx1) {
  10659. return anIndex >= 1 && anIndex <= self.length
  10660. ? self[anIndex - 1]
  10661. : aBlock._value()
  10662. ;
  10663. return self;
  10664. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  10665. },
  10666. args: ["anIndex", "aBlock"],
  10667. 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'>",
  10668. referencedClasses: [],
  10669. messageSends: []
  10670. }),
  10671. $globals.Array);
  10672. $core.addMethod(
  10673. $core.method({
  10674. selector: "at:ifPresent:ifAbsent:",
  10675. protocol: "accessing",
  10676. fn: function (anIndex,aBlock,anotherBlock){
  10677. var self=this,$self=this;
  10678. return $core.withContext(function($ctx1) {
  10679. return anIndex >= 1 && anIndex <= self.length
  10680. ? aBlock._value_(self[anIndex - 1])
  10681. : anotherBlock._value()
  10682. ;
  10683. return self;
  10684. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  10685. },
  10686. args: ["anIndex", "aBlock", "anotherBlock"],
  10687. 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'>",
  10688. referencedClasses: [],
  10689. messageSends: []
  10690. }),
  10691. $globals.Array);
  10692. $core.addMethod(
  10693. $core.method({
  10694. selector: "at:put:",
  10695. protocol: "accessing",
  10696. fn: function (anIndex,anObject){
  10697. var self=this,$self=this;
  10698. return $core.withContext(function($ctx1) {
  10699. return self[anIndex - 1] = anObject;
  10700. return self;
  10701. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10702. },
  10703. args: ["anIndex", "anObject"],
  10704. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10705. referencedClasses: [],
  10706. messageSends: []
  10707. }),
  10708. $globals.Array);
  10709. $core.addMethod(
  10710. $core.method({
  10711. selector: "collect:",
  10712. protocol: "enumerating",
  10713. fn: function (aBlock){
  10714. var self=this,$self=this;
  10715. return $core.withContext(function($ctx1) {
  10716. return self.map(function(each) {return aBlock._value_(each)});
  10717. return self;
  10718. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10719. },
  10720. args: ["aBlock"],
  10721. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10722. referencedClasses: [],
  10723. messageSends: []
  10724. }),
  10725. $globals.Array);
  10726. $core.addMethod(
  10727. $core.method({
  10728. selector: "copyFrom:to:",
  10729. protocol: "copying",
  10730. fn: function (anIndex,anotherIndex){
  10731. var self=this,$self=this;
  10732. return $core.withContext(function($ctx1) {
  10733. if (anIndex >= 1 && anotherIndex <= self.length) {
  10734. return self.slice(anIndex - 1, anotherIndex);
  10735. } else {
  10736. self._at_(anIndex);
  10737. self._at_(self.length + 1);
  10738. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10739. };
  10740. return self;
  10741. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10742. },
  10743. args: ["anIndex", "anotherIndex"],
  10744. 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'>",
  10745. referencedClasses: [],
  10746. messageSends: []
  10747. }),
  10748. $globals.Array);
  10749. $core.addMethod(
  10750. $core.method({
  10751. selector: "join:",
  10752. protocol: "enumerating",
  10753. fn: function (aString){
  10754. var self=this,$self=this;
  10755. return $core.withContext(function($ctx1) {
  10756. return self.join(aString);
  10757. return self;
  10758. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10759. },
  10760. args: ["aString"],
  10761. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10762. referencedClasses: [],
  10763. messageSends: []
  10764. }),
  10765. $globals.Array);
  10766. $core.addMethod(
  10767. $core.method({
  10768. selector: "numericallyIndexable",
  10769. protocol: "private",
  10770. fn: function (){
  10771. var self=this,$self=this;
  10772. return self;
  10773. },
  10774. args: [],
  10775. source: "numericallyIndexable\x0a\x09^ self",
  10776. referencedClasses: [],
  10777. messageSends: []
  10778. }),
  10779. $globals.Array);
  10780. $core.addMethod(
  10781. $core.method({
  10782. selector: "printOn:",
  10783. protocol: "printing",
  10784. fn: function (aStream){
  10785. var self=this,$self=this;
  10786. return $core.withContext(function($ctx1) {
  10787. (
  10788. $ctx1.supercall = true,
  10789. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10790. $ctx1.supercall = false;
  10791. $ctx1.sendIdx["printOn:"]=1;
  10792. $recv(aStream)._nextPutAll_(" (");
  10793. $ctx1.sendIdx["nextPutAll:"]=1;
  10794. $self._do_separatedBy_((function(each){
  10795. return $core.withContext(function($ctx2) {
  10796. return $recv(each)._printOn_(aStream);
  10797. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10798. }),(function(){
  10799. return $core.withContext(function($ctx2) {
  10800. return $recv(aStream)._nextPutAll_(" ");
  10801. $ctx2.sendIdx["nextPutAll:"]=2;
  10802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10803. }));
  10804. $recv(aStream)._nextPutAll_(")");
  10805. return self;
  10806. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10807. },
  10808. args: ["aStream"],
  10809. 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: ')'",
  10810. referencedClasses: [],
  10811. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10812. }),
  10813. $globals.Array);
  10814. $core.addMethod(
  10815. $core.method({
  10816. selector: "remove:ifAbsent:",
  10817. protocol: "adding/removing",
  10818. fn: function (anObject,aBlock){
  10819. var self=this,$self=this;
  10820. var index;
  10821. return $core.withContext(function($ctx1) {
  10822. var $1;
  10823. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10824. return (0);
  10825. }));
  10826. $1=$recv(index).__eq((0));
  10827. if($core.assert($1)){
  10828. return $recv(aBlock)._value();
  10829. } else {
  10830. $self._removeIndex_(index);
  10831. return anObject;
  10832. }
  10833. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10834. },
  10835. args: ["anObject", "aBlock"],
  10836. 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 ]",
  10837. referencedClasses: [],
  10838. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10839. }),
  10840. $globals.Array);
  10841. $core.addMethod(
  10842. $core.method({
  10843. selector: "removeAll",
  10844. protocol: "adding/removing",
  10845. fn: function (){
  10846. var self=this,$self=this;
  10847. return $core.withContext(function($ctx1) {
  10848. self.length = 0;
  10849. return self;
  10850. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10851. },
  10852. args: [],
  10853. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10854. referencedClasses: [],
  10855. messageSends: []
  10856. }),
  10857. $globals.Array);
  10858. $core.addMethod(
  10859. $core.method({
  10860. selector: "removeFrom:to:",
  10861. protocol: "adding/removing",
  10862. fn: function (aNumber,anotherNumber){
  10863. var self=this,$self=this;
  10864. return $core.withContext(function($ctx1) {
  10865. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10866. return self;
  10867. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10868. },
  10869. args: ["aNumber", "anotherNumber"],
  10870. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10871. referencedClasses: [],
  10872. messageSends: []
  10873. }),
  10874. $globals.Array);
  10875. $core.addMethod(
  10876. $core.method({
  10877. selector: "removeIndex:",
  10878. protocol: "adding/removing",
  10879. fn: function (anInteger){
  10880. var self=this,$self=this;
  10881. return $core.withContext(function($ctx1) {
  10882. self.splice(anInteger - 1, 1);
  10883. return self;
  10884. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10885. },
  10886. args: ["anInteger"],
  10887. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10888. referencedClasses: [],
  10889. messageSends: []
  10890. }),
  10891. $globals.Array);
  10892. $core.addMethod(
  10893. $core.method({
  10894. selector: "removeLast",
  10895. protocol: "adding/removing",
  10896. fn: function (){
  10897. var self=this,$self=this;
  10898. return $core.withContext(function($ctx1) {
  10899. return self.pop();;
  10900. return self;
  10901. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10902. },
  10903. args: [],
  10904. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10905. referencedClasses: [],
  10906. messageSends: []
  10907. }),
  10908. $globals.Array);
  10909. $core.addMethod(
  10910. $core.method({
  10911. selector: "reversed",
  10912. protocol: "converting",
  10913. fn: function (){
  10914. var self=this,$self=this;
  10915. return $core.withContext(function($ctx1) {
  10916. return self.slice().reverse();
  10917. return self;
  10918. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10919. },
  10920. args: [],
  10921. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10922. referencedClasses: [],
  10923. messageSends: []
  10924. }),
  10925. $globals.Array);
  10926. $core.addMethod(
  10927. $core.method({
  10928. selector: "select:",
  10929. protocol: "enumerating",
  10930. fn: function (aBlock){
  10931. var self=this,$self=this;
  10932. return $core.withContext(function($ctx1) {
  10933. return self.filter(function(each) {return aBlock._value_(each)});
  10934. return self;
  10935. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10936. },
  10937. args: ["aBlock"],
  10938. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10939. referencedClasses: [],
  10940. messageSends: []
  10941. }),
  10942. $globals.Array);
  10943. $core.addMethod(
  10944. $core.method({
  10945. selector: "shallowCopy",
  10946. protocol: "copying",
  10947. fn: function (){
  10948. var self=this,$self=this;
  10949. return $core.withContext(function($ctx1) {
  10950. return self.slice();
  10951. return self;
  10952. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10953. },
  10954. args: [],
  10955. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10956. referencedClasses: [],
  10957. messageSends: []
  10958. }),
  10959. $globals.Array);
  10960. $core.addMethod(
  10961. $core.method({
  10962. selector: "size",
  10963. protocol: "accessing",
  10964. fn: function (){
  10965. var self=this,$self=this;
  10966. return $core.withContext(function($ctx1) {
  10967. return self.length;
  10968. return self;
  10969. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10970. },
  10971. args: [],
  10972. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10973. referencedClasses: [],
  10974. messageSends: []
  10975. }),
  10976. $globals.Array);
  10977. $core.addMethod(
  10978. $core.method({
  10979. selector: "sort",
  10980. protocol: "enumerating",
  10981. fn: function (){
  10982. var self=this,$self=this;
  10983. return $core.withContext(function($ctx1) {
  10984. return $self._sort_((function(a,b){
  10985. return $core.withContext(function($ctx2) {
  10986. return $recv(a).__lt(b);
  10987. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10988. }));
  10989. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10990. },
  10991. args: [],
  10992. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10993. referencedClasses: [],
  10994. messageSends: ["sort:", "<"]
  10995. }),
  10996. $globals.Array);
  10997. $core.addMethod(
  10998. $core.method({
  10999. selector: "sort:",
  11000. protocol: "enumerating",
  11001. fn: function (aBlock){
  11002. var self=this,$self=this;
  11003. return $core.withContext(function($ctx1) {
  11004. return self.sort(function(a, b) {
  11005. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  11006. })
  11007. ;
  11008. return self;
  11009. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  11010. },
  11011. args: ["aBlock"],
  11012. 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'>",
  11013. referencedClasses: [],
  11014. messageSends: []
  11015. }),
  11016. $globals.Array);
  11017. $core.addMethod(
  11018. $core.method({
  11019. selector: "sorted",
  11020. protocol: "enumerating",
  11021. fn: function (){
  11022. var self=this,$self=this;
  11023. return $core.withContext(function($ctx1) {
  11024. return $recv($self._copy())._sort();
  11025. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  11026. },
  11027. args: [],
  11028. source: "sorted\x0a\x09^ self copy sort",
  11029. referencedClasses: [],
  11030. messageSends: ["sort", "copy"]
  11031. }),
  11032. $globals.Array);
  11033. $core.addMethod(
  11034. $core.method({
  11035. selector: "sorted:",
  11036. protocol: "enumerating",
  11037. fn: function (aBlock){
  11038. var self=this,$self=this;
  11039. return $core.withContext(function($ctx1) {
  11040. return $recv($self._copy())._sort_(aBlock);
  11041. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  11042. },
  11043. args: ["aBlock"],
  11044. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  11045. referencedClasses: [],
  11046. messageSends: ["sort:", "copy"]
  11047. }),
  11048. $globals.Array);
  11049. $core.addMethod(
  11050. $core.method({
  11051. selector: "new:",
  11052. protocol: "instance creation",
  11053. fn: function (anInteger){
  11054. var self=this,$self=this;
  11055. return $core.withContext(function($ctx1) {
  11056. return new Array(anInteger);
  11057. return self;
  11058. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  11059. },
  11060. args: ["anInteger"],
  11061. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  11062. referencedClasses: [],
  11063. messageSends: []
  11064. }),
  11065. $globals.Array.a$cls);
  11066. $core.addMethod(
  11067. $core.method({
  11068. selector: "with:",
  11069. protocol: "instance creation",
  11070. fn: function (anObject){
  11071. var self=this,$self=this;
  11072. return $core.withContext(function($ctx1) {
  11073. var $1;
  11074. $1=$self._new_((1));
  11075. $recv($1)._at_put_((1),anObject);
  11076. return $recv($1)._yourself();
  11077. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  11078. },
  11079. args: ["anObject"],
  11080. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11081. referencedClasses: [],
  11082. messageSends: ["at:put:", "new:", "yourself"]
  11083. }),
  11084. $globals.Array.a$cls);
  11085. $core.addMethod(
  11086. $core.method({
  11087. selector: "with:with:",
  11088. protocol: "instance creation",
  11089. fn: function (anObject,anObject2){
  11090. var self=this,$self=this;
  11091. return $core.withContext(function($ctx1) {
  11092. var $1;
  11093. $1=$self._new_((2));
  11094. $recv($1)._at_put_((1),anObject);
  11095. $ctx1.sendIdx["at:put:"]=1;
  11096. $recv($1)._at_put_((2),anObject2);
  11097. return $recv($1)._yourself();
  11098. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  11099. },
  11100. args: ["anObject", "anObject2"],
  11101. 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",
  11102. referencedClasses: [],
  11103. messageSends: ["at:put:", "new:", "yourself"]
  11104. }),
  11105. $globals.Array.a$cls);
  11106. $core.addMethod(
  11107. $core.method({
  11108. selector: "with:with:with:",
  11109. protocol: "instance creation",
  11110. fn: function (anObject,anObject2,anObject3){
  11111. var self=this,$self=this;
  11112. return $core.withContext(function($ctx1) {
  11113. var $1;
  11114. $1=$self._new_((3));
  11115. $recv($1)._at_put_((1),anObject);
  11116. $ctx1.sendIdx["at:put:"]=1;
  11117. $recv($1)._at_put_((2),anObject2);
  11118. $ctx1.sendIdx["at:put:"]=2;
  11119. $recv($1)._at_put_((3),anObject3);
  11120. return $recv($1)._yourself();
  11121. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  11122. },
  11123. args: ["anObject", "anObject2", "anObject3"],
  11124. 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",
  11125. referencedClasses: [],
  11126. messageSends: ["at:put:", "new:", "yourself"]
  11127. }),
  11128. $globals.Array.a$cls);
  11129. $core.addMethod(
  11130. $core.method({
  11131. selector: "withAll:",
  11132. protocol: "instance creation",
  11133. fn: function (aCollection){
  11134. var self=this,$self=this;
  11135. var instance,index;
  11136. return $core.withContext(function($ctx1) {
  11137. index=(1);
  11138. instance=$self._new_($recv(aCollection)._size());
  11139. $recv(aCollection)._do_((function(each){
  11140. return $core.withContext(function($ctx2) {
  11141. $recv(instance)._at_put_(index,each);
  11142. index=$recv(index).__plus((1));
  11143. return index;
  11144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11145. }));
  11146. return instance;
  11147. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  11148. },
  11149. args: ["aCollection"],
  11150. 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",
  11151. referencedClasses: [],
  11152. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11153. }),
  11154. $globals.Array.a$cls);
  11155. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  11156. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11157. $core.addMethod(
  11158. $core.method({
  11159. selector: ",",
  11160. protocol: "copying",
  11161. fn: function (aString){
  11162. var self=this,$self=this;
  11163. return $core.withContext(function($ctx1) {
  11164. var $1;
  11165. $1=$self._asString();
  11166. $ctx1.sendIdx["asString"]=1;
  11167. return $recv($1).__comma($recv(aString)._asString());
  11168. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  11169. },
  11170. args: ["aString"],
  11171. source: ", aString\x0a\x09^ self asString, aString asString",
  11172. referencedClasses: [],
  11173. messageSends: [",", "asString"]
  11174. }),
  11175. $globals.CharacterArray);
  11176. $core.addMethod(
  11177. $core.method({
  11178. selector: "add:",
  11179. protocol: "adding/removing",
  11180. fn: function (anObject){
  11181. var self=this,$self=this;
  11182. return $core.withContext(function($ctx1) {
  11183. $self._errorReadOnly();
  11184. return self;
  11185. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  11186. },
  11187. args: ["anObject"],
  11188. source: "add: anObject\x0a\x09self errorReadOnly",
  11189. referencedClasses: [],
  11190. messageSends: ["errorReadOnly"]
  11191. }),
  11192. $globals.CharacterArray);
  11193. $core.addMethod(
  11194. $core.method({
  11195. selector: "asLowercase",
  11196. protocol: "converting",
  11197. fn: function (){
  11198. var self=this,$self=this;
  11199. return $core.withContext(function($ctx1) {
  11200. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  11201. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  11202. },
  11203. args: [],
  11204. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  11205. referencedClasses: [],
  11206. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  11207. }),
  11208. $globals.CharacterArray);
  11209. $core.addMethod(
  11210. $core.method({
  11211. selector: "asNumber",
  11212. protocol: "converting",
  11213. fn: function (){
  11214. var self=this,$self=this;
  11215. return $core.withContext(function($ctx1) {
  11216. return $recv($self._asString())._asNumber();
  11217. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  11218. },
  11219. args: [],
  11220. source: "asNumber\x0a\x09^ self asString asNumber",
  11221. referencedClasses: [],
  11222. messageSends: ["asNumber", "asString"]
  11223. }),
  11224. $globals.CharacterArray);
  11225. $core.addMethod(
  11226. $core.method({
  11227. selector: "asString",
  11228. protocol: "converting",
  11229. fn: function (){
  11230. var self=this,$self=this;
  11231. return $core.withContext(function($ctx1) {
  11232. return $self._subclassResponsibility();
  11233. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  11234. },
  11235. args: [],
  11236. source: "asString\x0a\x09^ self subclassResponsibility",
  11237. referencedClasses: [],
  11238. messageSends: ["subclassResponsibility"]
  11239. }),
  11240. $globals.CharacterArray);
  11241. $core.addMethod(
  11242. $core.method({
  11243. selector: "asSymbol",
  11244. protocol: "converting",
  11245. fn: function (){
  11246. var self=this,$self=this;
  11247. return $core.withContext(function($ctx1) {
  11248. return $self._asString();
  11249. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  11250. },
  11251. args: [],
  11252. source: "asSymbol\x0a\x09^ self asString",
  11253. referencedClasses: [],
  11254. messageSends: ["asString"]
  11255. }),
  11256. $globals.CharacterArray);
  11257. $core.addMethod(
  11258. $core.method({
  11259. selector: "asSymbolPrintOn:",
  11260. protocol: "printing",
  11261. fn: function (aStream){
  11262. var self=this,$self=this;
  11263. return $core.withContext(function($ctx1) {
  11264. var $1;
  11265. $recv(aStream)._nextPutAll_("#");
  11266. $1=$recv($self._asString())._isSelector();
  11267. if($core.assert($1)){
  11268. $recv(aStream)._nextPut_(self);
  11269. } else {
  11270. $self._printOn_(aStream);
  11271. }
  11272. return self;
  11273. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  11274. },
  11275. args: ["aStream"],
  11276. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11277. referencedClasses: [],
  11278. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11279. }),
  11280. $globals.CharacterArray);
  11281. $core.addMethod(
  11282. $core.method({
  11283. selector: "asUppercase",
  11284. protocol: "converting",
  11285. fn: function (){
  11286. var self=this,$self=this;
  11287. return $core.withContext(function($ctx1) {
  11288. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  11289. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  11290. },
  11291. args: [],
  11292. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  11293. referencedClasses: [],
  11294. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  11295. }),
  11296. $globals.CharacterArray);
  11297. $core.addMethod(
  11298. $core.method({
  11299. selector: "at:put:",
  11300. protocol: "accessing",
  11301. fn: function (anIndex,anObject){
  11302. var self=this,$self=this;
  11303. return $core.withContext(function($ctx1) {
  11304. $self._errorReadOnly();
  11305. return self;
  11306. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  11307. },
  11308. args: ["anIndex", "anObject"],
  11309. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11310. referencedClasses: [],
  11311. messageSends: ["errorReadOnly"]
  11312. }),
  11313. $globals.CharacterArray);
  11314. $core.addMethod(
  11315. $core.method({
  11316. selector: "errorReadOnly",
  11317. protocol: "error handling",
  11318. fn: function (){
  11319. var self=this,$self=this;
  11320. return $core.withContext(function($ctx1) {
  11321. $self._error_("Object is read-only");
  11322. return self;
  11323. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  11324. },
  11325. args: [],
  11326. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11327. referencedClasses: [],
  11328. messageSends: ["error:"]
  11329. }),
  11330. $globals.CharacterArray);
  11331. $core.addMethod(
  11332. $core.method({
  11333. selector: "printOn:",
  11334. protocol: "printing",
  11335. fn: function (aStream){
  11336. var self=this,$self=this;
  11337. return $core.withContext(function($ctx1) {
  11338. $recv($self._asString())._printOn_(aStream);
  11339. return self;
  11340. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  11341. },
  11342. args: ["aStream"],
  11343. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11344. referencedClasses: [],
  11345. messageSends: ["printOn:", "asString"]
  11346. }),
  11347. $globals.CharacterArray);
  11348. $core.addMethod(
  11349. $core.method({
  11350. selector: "putOn:",
  11351. protocol: "streaming",
  11352. fn: function (aStream){
  11353. var self=this,$self=this;
  11354. return $core.withContext(function($ctx1) {
  11355. $recv(aStream)._nextPutString_(self);
  11356. return self;
  11357. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  11358. },
  11359. args: ["aStream"],
  11360. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11361. referencedClasses: [],
  11362. messageSends: ["nextPutString:"]
  11363. }),
  11364. $globals.CharacterArray);
  11365. $core.addMethod(
  11366. $core.method({
  11367. selector: "remove:",
  11368. protocol: "adding/removing",
  11369. fn: function (anObject){
  11370. var self=this,$self=this;
  11371. return $core.withContext(function($ctx1) {
  11372. $self._errorReadOnly();
  11373. return self;
  11374. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  11375. },
  11376. args: ["anObject"],
  11377. source: "remove: anObject\x0a\x09self errorReadOnly",
  11378. referencedClasses: [],
  11379. messageSends: ["errorReadOnly"]
  11380. }),
  11381. $globals.CharacterArray);
  11382. $core.addMethod(
  11383. $core.method({
  11384. selector: "remove:ifAbsent:",
  11385. protocol: "adding/removing",
  11386. fn: function (anObject,aBlock){
  11387. var self=this,$self=this;
  11388. return $core.withContext(function($ctx1) {
  11389. $self._errorReadOnly();
  11390. return self;
  11391. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  11392. },
  11393. args: ["anObject", "aBlock"],
  11394. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11395. referencedClasses: [],
  11396. messageSends: ["errorReadOnly"]
  11397. }),
  11398. $globals.CharacterArray);
  11399. $core.addMethod(
  11400. $core.method({
  11401. selector: "symbolPrintString",
  11402. protocol: "printing",
  11403. fn: function (){
  11404. var self=this,$self=this;
  11405. return $core.withContext(function($ctx1) {
  11406. return $recv($globals.String)._streamContents_((function(str){
  11407. return $core.withContext(function($ctx2) {
  11408. return $self._asSymbolPrintOn_(str);
  11409. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11410. }));
  11411. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  11412. },
  11413. args: [],
  11414. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11415. referencedClasses: ["String"],
  11416. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11417. }),
  11418. $globals.CharacterArray);
  11419. $core.addMethod(
  11420. $core.method({
  11421. selector: "fromString:",
  11422. protocol: "instance creation",
  11423. fn: function (aString){
  11424. var self=this,$self=this;
  11425. return $core.withContext(function($ctx1) {
  11426. $self._subclassResponsibility();
  11427. return self;
  11428. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  11429. },
  11430. args: ["aString"],
  11431. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11432. referencedClasses: [],
  11433. messageSends: ["subclassResponsibility"]
  11434. }),
  11435. $globals.CharacterArray.a$cls);
  11436. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  11437. $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 >> #,`";
  11438. $core.addMethod(
  11439. $core.method({
  11440. selector: ",",
  11441. protocol: "copying",
  11442. fn: function (aString){
  11443. var self=this,$self=this;
  11444. return $core.withContext(function($ctx1) {
  11445. return String(self) + aString;
  11446. return self;
  11447. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  11448. },
  11449. args: ["aString"],
  11450. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11451. referencedClasses: [],
  11452. messageSends: []
  11453. }),
  11454. $globals.String);
  11455. $core.addMethod(
  11456. $core.method({
  11457. selector: "<",
  11458. protocol: "comparing",
  11459. fn: function (aString){
  11460. var self=this,$self=this;
  11461. return $core.withContext(function($ctx1) {
  11462. return String(self) < aString._asString();
  11463. return self;
  11464. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  11465. },
  11466. args: ["aString"],
  11467. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11468. referencedClasses: [],
  11469. messageSends: []
  11470. }),
  11471. $globals.String);
  11472. $core.addMethod(
  11473. $core.method({
  11474. selector: "<=",
  11475. protocol: "comparing",
  11476. fn: function (aString){
  11477. var self=this,$self=this;
  11478. return $core.withContext(function($ctx1) {
  11479. return String(self) <= aString._asString();
  11480. return self;
  11481. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  11482. },
  11483. args: ["aString"],
  11484. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11485. referencedClasses: [],
  11486. messageSends: []
  11487. }),
  11488. $globals.String);
  11489. $core.addMethod(
  11490. $core.method({
  11491. selector: "=",
  11492. protocol: "comparing",
  11493. fn: function (aString){
  11494. var self=this,$self=this;
  11495. return $core.withContext(function($ctx1) {
  11496. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11497. return self;
  11498. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  11499. },
  11500. args: ["aString"],
  11501. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11502. referencedClasses: [],
  11503. messageSends: []
  11504. }),
  11505. $globals.String);
  11506. $core.addMethod(
  11507. $core.method({
  11508. selector: "==",
  11509. protocol: "comparing",
  11510. fn: function (aString){
  11511. var self=this,$self=this;
  11512. return $core.withContext(function($ctx1) {
  11513. if (typeof aString === "string") return String(self) === aString;
  11514. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11515. else return false;;
  11516. return self;
  11517. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  11518. },
  11519. args: ["aString"],
  11520. 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'>",
  11521. referencedClasses: [],
  11522. messageSends: []
  11523. }),
  11524. $globals.String);
  11525. $core.addMethod(
  11526. $core.method({
  11527. selector: ">",
  11528. protocol: "comparing",
  11529. fn: function (aString){
  11530. var self=this,$self=this;
  11531. return $core.withContext(function($ctx1) {
  11532. return String(self) > aString._asString();
  11533. return self;
  11534. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  11535. },
  11536. args: ["aString"],
  11537. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11538. referencedClasses: [],
  11539. messageSends: []
  11540. }),
  11541. $globals.String);
  11542. $core.addMethod(
  11543. $core.method({
  11544. selector: ">=",
  11545. protocol: "comparing",
  11546. fn: function (aString){
  11547. var self=this,$self=this;
  11548. return $core.withContext(function($ctx1) {
  11549. return String(self) >= aString._asString();
  11550. return self;
  11551. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  11552. },
  11553. args: ["aString"],
  11554. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11555. referencedClasses: [],
  11556. messageSends: []
  11557. }),
  11558. $globals.String);
  11559. $core.addMethod(
  11560. $core.method({
  11561. selector: "asJavaScriptMethodName",
  11562. protocol: "converting",
  11563. fn: function (){
  11564. var self=this,$self=this;
  11565. return $core.withContext(function($ctx1) {
  11566. return $core.st2js(self);
  11567. return self;
  11568. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11569. },
  11570. args: [],
  11571. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11572. referencedClasses: [],
  11573. messageSends: []
  11574. }),
  11575. $globals.String);
  11576. $core.addMethod(
  11577. $core.method({
  11578. selector: "asJavaScriptObject",
  11579. protocol: "converting",
  11580. fn: function (){
  11581. var self=this,$self=this;
  11582. return self;
  11583. },
  11584. args: [],
  11585. source: "asJavaScriptObject\x0a\x09^ self",
  11586. referencedClasses: [],
  11587. messageSends: []
  11588. }),
  11589. $globals.String);
  11590. $core.addMethod(
  11591. $core.method({
  11592. selector: "asJavaScriptSource",
  11593. protocol: "converting",
  11594. fn: function (){
  11595. var self=this,$self=this;
  11596. return $core.withContext(function($ctx1) {
  11597. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11598. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11599. else
  11600. return "\"" + self + "\"";
  11601. ;
  11602. return self;
  11603. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11604. },
  11605. args: [],
  11606. 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'>",
  11607. referencedClasses: [],
  11608. messageSends: []
  11609. }),
  11610. $globals.String);
  11611. $core.addMethod(
  11612. $core.method({
  11613. selector: "asLowercase",
  11614. protocol: "converting",
  11615. fn: function (){
  11616. var self=this,$self=this;
  11617. return $core.withContext(function($ctx1) {
  11618. return self.toLowerCase();
  11619. return self;
  11620. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11621. },
  11622. args: [],
  11623. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11624. referencedClasses: [],
  11625. messageSends: []
  11626. }),
  11627. $globals.String);
  11628. $core.addMethod(
  11629. $core.method({
  11630. selector: "asMutator",
  11631. protocol: "converting",
  11632. fn: function (){
  11633. var self=this,$self=this;
  11634. return $core.withContext(function($ctx1) {
  11635. var $1;
  11636. $1=$recv($self._last()).__eq(":");
  11637. if(!$core.assert($1)){
  11638. return $self.__comma(":");
  11639. }
  11640. return self;
  11641. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11642. },
  11643. args: [],
  11644. 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",
  11645. referencedClasses: [],
  11646. messageSends: ["ifFalse:", "=", "last", ","]
  11647. }),
  11648. $globals.String);
  11649. $core.addMethod(
  11650. $core.method({
  11651. selector: "asNumber",
  11652. protocol: "converting",
  11653. fn: function (){
  11654. var self=this,$self=this;
  11655. return $core.withContext(function($ctx1) {
  11656. return Number(self);
  11657. return self;
  11658. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11659. },
  11660. args: [],
  11661. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11662. referencedClasses: [],
  11663. messageSends: []
  11664. }),
  11665. $globals.String);
  11666. $core.addMethod(
  11667. $core.method({
  11668. selector: "asRegexp",
  11669. protocol: "converting",
  11670. fn: function (){
  11671. var self=this,$self=this;
  11672. return $core.withContext(function($ctx1) {
  11673. return $recv($globals.RegularExpression)._fromString_(self);
  11674. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11675. },
  11676. args: [],
  11677. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11678. referencedClasses: ["RegularExpression"],
  11679. messageSends: ["fromString:"]
  11680. }),
  11681. $globals.String);
  11682. $core.addMethod(
  11683. $core.method({
  11684. selector: "asString",
  11685. protocol: "converting",
  11686. fn: function (){
  11687. var self=this,$self=this;
  11688. return self;
  11689. },
  11690. args: [],
  11691. source: "asString\x0a\x09^ self",
  11692. referencedClasses: [],
  11693. messageSends: []
  11694. }),
  11695. $globals.String);
  11696. $core.addMethod(
  11697. $core.method({
  11698. selector: "asSymbol",
  11699. protocol: "converting",
  11700. fn: function (){
  11701. var self=this,$self=this;
  11702. return self;
  11703. },
  11704. args: [],
  11705. source: "asSymbol\x0a\x09^ self",
  11706. referencedClasses: [],
  11707. messageSends: []
  11708. }),
  11709. $globals.String);
  11710. $core.addMethod(
  11711. $core.method({
  11712. selector: "asUppercase",
  11713. protocol: "converting",
  11714. fn: function (){
  11715. var self=this,$self=this;
  11716. return $core.withContext(function($ctx1) {
  11717. return self.toUpperCase();
  11718. return self;
  11719. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11720. },
  11721. args: [],
  11722. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11723. referencedClasses: [],
  11724. messageSends: []
  11725. }),
  11726. $globals.String);
  11727. $core.addMethod(
  11728. $core.method({
  11729. selector: "asciiValue",
  11730. protocol: "accessing",
  11731. fn: function (){
  11732. var self=this,$self=this;
  11733. return $core.withContext(function($ctx1) {
  11734. return self.charCodeAt(0);;
  11735. return self;
  11736. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11737. },
  11738. args: [],
  11739. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11740. referencedClasses: [],
  11741. messageSends: []
  11742. }),
  11743. $globals.String);
  11744. $core.addMethod(
  11745. $core.method({
  11746. selector: "at:ifAbsent:",
  11747. protocol: "accessing",
  11748. fn: function (anIndex,aBlock){
  11749. var self=this,$self=this;
  11750. return $core.withContext(function($ctx1) {
  11751. return String(self)[anIndex - 1] || aBlock._value();
  11752. return self;
  11753. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11754. },
  11755. args: ["anIndex", "aBlock"],
  11756. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11757. referencedClasses: [],
  11758. messageSends: []
  11759. }),
  11760. $globals.String);
  11761. $core.addMethod(
  11762. $core.method({
  11763. selector: "at:ifPresent:ifAbsent:",
  11764. protocol: "accessing",
  11765. fn: function (anIndex,aBlock,anotherBlock){
  11766. var self=this,$self=this;
  11767. return $core.withContext(function($ctx1) {
  11768. var result = String(self)[anIndex - 1];
  11769. return result ? aBlock._value_(result) : anotherBlock._value();
  11770. ;
  11771. return self;
  11772. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11773. },
  11774. args: ["anIndex", "aBlock", "anotherBlock"],
  11775. 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'>",
  11776. referencedClasses: [],
  11777. messageSends: []
  11778. }),
  11779. $globals.String);
  11780. $core.addMethod(
  11781. $core.method({
  11782. selector: "capitalized",
  11783. protocol: "converting",
  11784. fn: function (){
  11785. var self=this,$self=this;
  11786. return $core.withContext(function($ctx1) {
  11787. return $self._ifNotEmpty_((function(){
  11788. return $core.withContext(function($ctx2) {
  11789. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11791. }));
  11792. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11793. },
  11794. args: [],
  11795. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11796. referencedClasses: [],
  11797. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11798. }),
  11799. $globals.String);
  11800. $core.addMethod(
  11801. $core.method({
  11802. selector: "charCodeAt:",
  11803. protocol: "accessing",
  11804. fn: function (anInteger){
  11805. var self=this,$self=this;
  11806. return $core.withContext(function($ctx1) {
  11807. return self.charCodeAt(anInteger - 1);
  11808. return self;
  11809. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11810. },
  11811. args: ["anInteger"],
  11812. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11813. referencedClasses: [],
  11814. messageSends: []
  11815. }),
  11816. $globals.String);
  11817. $core.addMethod(
  11818. $core.method({
  11819. selector: "copyFrom:to:",
  11820. protocol: "copying",
  11821. fn: function (anIndex,anotherIndex){
  11822. var self=this,$self=this;
  11823. return $core.withContext(function($ctx1) {
  11824. return self.substring(anIndex - 1, anotherIndex);
  11825. return self;
  11826. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11827. },
  11828. args: ["anIndex", "anotherIndex"],
  11829. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11830. referencedClasses: [],
  11831. messageSends: []
  11832. }),
  11833. $globals.String);
  11834. $core.addMethod(
  11835. $core.method({
  11836. selector: "crlfSanitized",
  11837. protocol: "converting",
  11838. fn: function (){
  11839. var self=this,$self=this;
  11840. return $core.withContext(function($ctx1) {
  11841. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11842. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11843. },
  11844. args: [],
  11845. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11846. referencedClasses: ["String"],
  11847. messageSends: ["join:", "lines", "lf"]
  11848. }),
  11849. $globals.String);
  11850. $core.addMethod(
  11851. $core.method({
  11852. selector: "deepCopy",
  11853. protocol: "copying",
  11854. fn: function (){
  11855. var self=this,$self=this;
  11856. return $core.withContext(function($ctx1) {
  11857. return $self._shallowCopy();
  11858. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11859. },
  11860. args: [],
  11861. source: "deepCopy\x0a\x09^ self shallowCopy",
  11862. referencedClasses: [],
  11863. messageSends: ["shallowCopy"]
  11864. }),
  11865. $globals.String);
  11866. $core.addMethod(
  11867. $core.method({
  11868. selector: "escaped",
  11869. protocol: "converting",
  11870. fn: function (){
  11871. var self=this,$self=this;
  11872. return $core.withContext(function($ctx1) {
  11873. return escape(self);
  11874. return self;
  11875. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11876. },
  11877. args: [],
  11878. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11879. referencedClasses: [],
  11880. messageSends: []
  11881. }),
  11882. $globals.String);
  11883. $core.addMethod(
  11884. $core.method({
  11885. selector: "includesSubString:",
  11886. protocol: "testing",
  11887. fn: function (subString){
  11888. var self=this,$self=this;
  11889. return $core.withContext(function($ctx1) {
  11890. return self.indexOf(subString) != -1;
  11891. return self;
  11892. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11893. },
  11894. args: ["subString"],
  11895. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11896. referencedClasses: [],
  11897. messageSends: []
  11898. }),
  11899. $globals.String);
  11900. $core.addMethod(
  11901. $core.method({
  11902. selector: "isCapitalized",
  11903. protocol: "testing",
  11904. fn: function (){
  11905. var self=this,$self=this;
  11906. return $core.withContext(function($ctx1) {
  11907. var $2,$1;
  11908. $2=$self._first();
  11909. $ctx1.sendIdx["first"]=1;
  11910. $1=$recv($2)._asUppercase();
  11911. return $recv($1).__eq_eq($self._first());
  11912. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11913. },
  11914. args: [],
  11915. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11916. referencedClasses: [],
  11917. messageSends: ["==", "asUppercase", "first"]
  11918. }),
  11919. $globals.String);
  11920. $core.addMethod(
  11921. $core.method({
  11922. selector: "isImmutable",
  11923. protocol: "testing",
  11924. fn: function (){
  11925. var self=this,$self=this;
  11926. return true;
  11927. },
  11928. args: [],
  11929. source: "isImmutable\x0a\x09^ true",
  11930. referencedClasses: [],
  11931. messageSends: []
  11932. }),
  11933. $globals.String);
  11934. $core.addMethod(
  11935. $core.method({
  11936. selector: "isSelector",
  11937. protocol: "testing",
  11938. fn: function (){
  11939. var self=this,$self=this;
  11940. return $core.withContext(function($ctx1) {
  11941. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11942. return self;
  11943. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11944. },
  11945. args: [],
  11946. 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>",
  11947. referencedClasses: [],
  11948. messageSends: []
  11949. }),
  11950. $globals.String);
  11951. $core.addMethod(
  11952. $core.method({
  11953. selector: "isString",
  11954. protocol: "testing",
  11955. fn: function (){
  11956. var self=this,$self=this;
  11957. return true;
  11958. },
  11959. args: [],
  11960. source: "isString\x0a\x09^ true",
  11961. referencedClasses: [],
  11962. messageSends: []
  11963. }),
  11964. $globals.String);
  11965. $core.addMethod(
  11966. $core.method({
  11967. selector: "isVowel",
  11968. protocol: "testing",
  11969. fn: function (){
  11970. var self=this,$self=this;
  11971. return $core.withContext(function($ctx1) {
  11972. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11973. return $core.withContext(function($ctx2) {
  11974. return "aeiou"._includes_($self._asLowercase());
  11975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11976. }));
  11977. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11978. },
  11979. args: [],
  11980. 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 ]",
  11981. referencedClasses: [],
  11982. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11983. }),
  11984. $globals.String);
  11985. $core.addMethod(
  11986. $core.method({
  11987. selector: "join:",
  11988. protocol: "split join",
  11989. fn: function (aCollection){
  11990. var self=this,$self=this;
  11991. return $core.withContext(function($ctx1) {
  11992. return $recv($globals.String)._streamContents_((function(stream){
  11993. return $core.withContext(function($ctx2) {
  11994. return $recv(aCollection)._do_separatedBy_((function(each){
  11995. return $core.withContext(function($ctx3) {
  11996. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11997. $ctx3.sendIdx["nextPutAll:"]=1;
  11998. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11999. }),(function(){
  12000. return $core.withContext(function($ctx3) {
  12001. return $recv(stream)._nextPutAll_(self);
  12002. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  12003. }));
  12004. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  12005. }));
  12006. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  12007. },
  12008. args: ["aCollection"],
  12009. 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 ]]",
  12010. referencedClasses: ["String"],
  12011. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  12012. }),
  12013. $globals.String);
  12014. $core.addMethod(
  12015. $core.method({
  12016. selector: "lineIndicesDo:",
  12017. protocol: "split join",
  12018. fn: function (aBlock){
  12019. var self=this,$self=this;
  12020. var cr,lf,start,sz,nextLF,nextCR;
  12021. return $core.withContext(function($ctx1) {
  12022. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  12023. var $early={};
  12024. try {
  12025. start=(1);
  12026. sz=$self._size();
  12027. cr=$recv($globals.String)._cr();
  12028. nextCR=$self._indexOf_startingAt_(cr,(1));
  12029. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  12030. lf=$recv($globals.String)._lf();
  12031. nextLF=$self._indexOf_startingAt_(lf,(1));
  12032. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  12033. $recv((function(){
  12034. return $core.withContext(function($ctx2) {
  12035. return $recv(start).__lt_eq(sz);
  12036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12037. }))._whileTrue_((function(){
  12038. return $core.withContext(function($ctx2) {
  12039. $2=$recv(nextLF).__eq((0));
  12040. $ctx2.sendIdx["="]=1;
  12041. $1=$recv($2)._and_((function(){
  12042. return $core.withContext(function($ctx3) {
  12043. return $recv(nextCR).__eq((0));
  12044. $ctx3.sendIdx["="]=2;
  12045. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  12046. }));
  12047. $ctx2.sendIdx["and:"]=1;
  12048. if($core.assert($1)){
  12049. $recv(aBlock)._value_value_value_(start,sz,sz);
  12050. $ctx2.sendIdx["value:value:value:"]=1;
  12051. throw $early=[self];
  12052. }
  12053. $4=$recv(nextCR).__eq((0));
  12054. $ctx2.sendIdx["="]=3;
  12055. $3=$recv($4)._or_((function(){
  12056. return $core.withContext(function($ctx3) {
  12057. $5=(0).__lt(nextLF);
  12058. $ctx3.sendIdx["<"]=1;
  12059. return $recv($5)._and_((function(){
  12060. return $core.withContext(function($ctx4) {
  12061. return $recv(nextLF).__lt(nextCR);
  12062. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  12063. }));
  12064. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  12065. }));
  12066. if($core.assert($3)){
  12067. $6=start;
  12068. $7=$recv(nextLF).__minus((1));
  12069. $ctx2.sendIdx["-"]=1;
  12070. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  12071. $ctx2.sendIdx["value:value:value:"]=2;
  12072. start=(1).__plus(nextLF);
  12073. $ctx2.sendIdx["+"]=1;
  12074. nextLF=$self._indexOf_startingAt_(lf,start);
  12075. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  12076. return nextLF;
  12077. } else {
  12078. $9=(1).__plus(nextCR);
  12079. $ctx2.sendIdx["+"]=2;
  12080. $8=$recv($9).__eq(nextLF);
  12081. if($core.assert($8)){
  12082. $10=start;
  12083. $11=$recv(nextCR).__minus((1));
  12084. $ctx2.sendIdx["-"]=2;
  12085. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  12086. $ctx2.sendIdx["value:value:value:"]=3;
  12087. start=(1).__plus(nextLF);
  12088. $ctx2.sendIdx["+"]=3;
  12089. nextCR=$self._indexOf_startingAt_(cr,start);
  12090. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  12091. nextLF=$self._indexOf_startingAt_(lf,start);
  12092. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  12093. return nextLF;
  12094. } else {
  12095. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12096. start=(1).__plus(nextCR);
  12097. nextCR=$self._indexOf_startingAt_(cr,start);
  12098. return nextCR;
  12099. }
  12100. }
  12101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12102. }));
  12103. return self;
  12104. }
  12105. catch(e) {if(e===$early)return e[0]; throw e}
  12106. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  12107. },
  12108. args: ["aBlock"],
  12109. 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 ] ]]",
  12110. referencedClasses: ["String"],
  12111. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12112. }),
  12113. $globals.String);
  12114. $core.addMethod(
  12115. $core.method({
  12116. selector: "lineNumber:",
  12117. protocol: "split join",
  12118. fn: function (anIndex){
  12119. var self=this,$self=this;
  12120. var lineCount;
  12121. return $core.withContext(function($ctx1) {
  12122. var $2,$1;
  12123. var $early={};
  12124. try {
  12125. lineCount=(0);
  12126. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12127. return $core.withContext(function($ctx2) {
  12128. lineCount=$recv(lineCount).__plus((1));
  12129. $2=lineCount;
  12130. $1=$recv($2).__eq(anIndex);
  12131. if($core.assert($1)){
  12132. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12133. }
  12134. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12135. }));
  12136. return nil;
  12137. }
  12138. catch(e) {if(e===$early)return e[0]; throw e}
  12139. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  12140. },
  12141. args: ["anIndex"],
  12142. 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",
  12143. referencedClasses: [],
  12144. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12145. }),
  12146. $globals.String);
  12147. $core.addMethod(
  12148. $core.method({
  12149. selector: "lines",
  12150. protocol: "split join",
  12151. fn: function (){
  12152. var self=this,$self=this;
  12153. return $core.withContext(function($ctx1) {
  12154. var result = self.split(/\r\n|\r|\n/);
  12155. if (!result[result.length-1]) result.pop();
  12156. return result;;
  12157. return self;
  12158. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  12159. },
  12160. args: [],
  12161. 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'>",
  12162. referencedClasses: [],
  12163. messageSends: []
  12164. }),
  12165. $globals.String);
  12166. $core.addMethod(
  12167. $core.method({
  12168. selector: "linesDo:",
  12169. protocol: "split join",
  12170. fn: function (aBlock){
  12171. var self=this,$self=this;
  12172. return $core.withContext(function($ctx1) {
  12173. $recv($self._lines())._do_(aBlock);
  12174. return self;
  12175. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  12176. },
  12177. args: ["aBlock"],
  12178. 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",
  12179. referencedClasses: [],
  12180. messageSends: ["do:", "lines"]
  12181. }),
  12182. $globals.String);
  12183. $core.addMethod(
  12184. $core.method({
  12185. selector: "match:",
  12186. protocol: "regular expressions",
  12187. fn: function (aRegexp){
  12188. var self=this,$self=this;
  12189. return $core.withContext(function($ctx1) {
  12190. return self.search(aRegexp) != -1;
  12191. return self;
  12192. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  12193. },
  12194. args: ["aRegexp"],
  12195. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12196. referencedClasses: [],
  12197. messageSends: []
  12198. }),
  12199. $globals.String);
  12200. $core.addMethod(
  12201. $core.method({
  12202. selector: "matchesOf:",
  12203. protocol: "regular expressions",
  12204. fn: function (aRegularExpression){
  12205. var self=this,$self=this;
  12206. return $core.withContext(function($ctx1) {
  12207. return self.match(aRegularExpression);
  12208. return self;
  12209. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  12210. },
  12211. args: ["aRegularExpression"],
  12212. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12213. referencedClasses: [],
  12214. messageSends: []
  12215. }),
  12216. $globals.String);
  12217. $core.addMethod(
  12218. $core.method({
  12219. selector: "numericallyIndexable",
  12220. protocol: "private",
  12221. fn: function (){
  12222. var self=this,$self=this;
  12223. return $core.withContext(function($ctx1) {
  12224. return String(self);
  12225. return self;
  12226. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  12227. },
  12228. args: [],
  12229. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  12230. referencedClasses: [],
  12231. messageSends: []
  12232. }),
  12233. $globals.String);
  12234. $core.addMethod(
  12235. $core.method({
  12236. selector: "printNl",
  12237. protocol: "printing",
  12238. fn: function (){
  12239. var self=this,$self=this;
  12240. return $core.withContext(function($ctx1) {
  12241. console.log(self);
  12242. return self;
  12243. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  12244. },
  12245. args: [],
  12246. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12247. referencedClasses: [],
  12248. messageSends: []
  12249. }),
  12250. $globals.String);
  12251. $core.addMethod(
  12252. $core.method({
  12253. selector: "printOn:",
  12254. protocol: "printing",
  12255. fn: function (aStream){
  12256. var self=this,$self=this;
  12257. return $core.withContext(function($ctx1) {
  12258. $recv(aStream)._nextPutAll_("'");
  12259. $ctx1.sendIdx["nextPutAll:"]=1;
  12260. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12261. $ctx1.sendIdx["nextPutAll:"]=2;
  12262. $recv(aStream)._nextPutAll_("'");
  12263. return self;
  12264. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  12265. },
  12266. args: ["aStream"],
  12267. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12268. referencedClasses: [],
  12269. messageSends: ["nextPutAll:", "replace:with:"]
  12270. }),
  12271. $globals.String);
  12272. $core.addMethod(
  12273. $core.method({
  12274. selector: "replace:with:",
  12275. protocol: "regular expressions",
  12276. fn: function (aString,anotherString){
  12277. var self=this,$self=this;
  12278. return $core.withContext(function($ctx1) {
  12279. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12280. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  12281. },
  12282. args: ["aString", "anotherString"],
  12283. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12284. referencedClasses: ["RegularExpression"],
  12285. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12286. }),
  12287. $globals.String);
  12288. $core.addMethod(
  12289. $core.method({
  12290. selector: "replaceRegexp:with:",
  12291. protocol: "regular expressions",
  12292. fn: function (aRegexp,aString){
  12293. var self=this,$self=this;
  12294. return $core.withContext(function($ctx1) {
  12295. return self.replace(aRegexp, aString);
  12296. return self;
  12297. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  12298. },
  12299. args: ["aRegexp", "aString"],
  12300. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12301. referencedClasses: [],
  12302. messageSends: []
  12303. }),
  12304. $globals.String);
  12305. $core.addMethod(
  12306. $core.method({
  12307. selector: "reversed",
  12308. protocol: "converting",
  12309. fn: function (){
  12310. var self=this,$self=this;
  12311. return $core.withContext(function($ctx1) {
  12312. return self.split("").reverse().join("");
  12313. return self;
  12314. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  12315. },
  12316. args: [],
  12317. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12318. referencedClasses: [],
  12319. messageSends: []
  12320. }),
  12321. $globals.String);
  12322. $core.addMethod(
  12323. $core.method({
  12324. selector: "shallowCopy",
  12325. protocol: "copying",
  12326. fn: function (){
  12327. var self=this,$self=this;
  12328. return self;
  12329. },
  12330. args: [],
  12331. source: "shallowCopy\x0a\x09^ self",
  12332. referencedClasses: [],
  12333. messageSends: []
  12334. }),
  12335. $globals.String);
  12336. $core.addMethod(
  12337. $core.method({
  12338. selector: "size",
  12339. protocol: "accessing",
  12340. fn: function (){
  12341. var self=this,$self=this;
  12342. return $core.withContext(function($ctx1) {
  12343. return self.length;
  12344. return self;
  12345. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  12346. },
  12347. args: [],
  12348. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  12349. referencedClasses: [],
  12350. messageSends: []
  12351. }),
  12352. $globals.String);
  12353. $core.addMethod(
  12354. $core.method({
  12355. selector: "subStrings:",
  12356. protocol: "split join",
  12357. fn: function (aString){
  12358. var self=this,$self=this;
  12359. return $core.withContext(function($ctx1) {
  12360. return $self._tokenize_(aString);
  12361. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  12362. },
  12363. args: ["aString"],
  12364. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12365. referencedClasses: [],
  12366. messageSends: ["tokenize:"]
  12367. }),
  12368. $globals.String);
  12369. $core.addMethod(
  12370. $core.method({
  12371. selector: "tokenize:",
  12372. protocol: "split join",
  12373. fn: function (aString){
  12374. var self=this,$self=this;
  12375. return $core.withContext(function($ctx1) {
  12376. return self.split(aString);
  12377. return self;
  12378. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  12379. },
  12380. args: ["aString"],
  12381. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12382. referencedClasses: [],
  12383. messageSends: []
  12384. }),
  12385. $globals.String);
  12386. $core.addMethod(
  12387. $core.method({
  12388. selector: "trimBoth",
  12389. protocol: "regular expressions",
  12390. fn: function (){
  12391. var self=this,$self=this;
  12392. return $core.withContext(function($ctx1) {
  12393. return $self._trimBoth_("\x5cs");
  12394. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  12395. },
  12396. args: [],
  12397. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12398. referencedClasses: [],
  12399. messageSends: ["trimBoth:"]
  12400. }),
  12401. $globals.String);
  12402. $core.addMethod(
  12403. $core.method({
  12404. selector: "trimBoth:",
  12405. protocol: "regular expressions",
  12406. fn: function (separators){
  12407. var self=this,$self=this;
  12408. return $core.withContext(function($ctx1) {
  12409. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12410. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  12411. },
  12412. args: ["separators"],
  12413. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12414. referencedClasses: [],
  12415. messageSends: ["trimRight:", "trimLeft:"]
  12416. }),
  12417. $globals.String);
  12418. $core.addMethod(
  12419. $core.method({
  12420. selector: "trimLeft",
  12421. protocol: "regular expressions",
  12422. fn: function (){
  12423. var self=this,$self=this;
  12424. return $core.withContext(function($ctx1) {
  12425. return $self._trimLeft_("\x5cs");
  12426. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  12427. },
  12428. args: [],
  12429. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12430. referencedClasses: [],
  12431. messageSends: ["trimLeft:"]
  12432. }),
  12433. $globals.String);
  12434. $core.addMethod(
  12435. $core.method({
  12436. selector: "trimLeft:",
  12437. protocol: "regular expressions",
  12438. fn: function (separators){
  12439. var self=this,$self=this;
  12440. return $core.withContext(function($ctx1) {
  12441. var $2,$1;
  12442. $2=$recv("^[".__comma(separators)).__comma("]+");
  12443. $ctx1.sendIdx[","]=1;
  12444. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12445. return $self._replaceRegexp_with_($1,"");
  12446. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  12447. },
  12448. args: ["separators"],
  12449. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12450. referencedClasses: ["RegularExpression"],
  12451. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12452. }),
  12453. $globals.String);
  12454. $core.addMethod(
  12455. $core.method({
  12456. selector: "trimRight",
  12457. protocol: "regular expressions",
  12458. fn: function (){
  12459. var self=this,$self=this;
  12460. return $core.withContext(function($ctx1) {
  12461. return $self._trimRight_("\x5cs");
  12462. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  12463. },
  12464. args: [],
  12465. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12466. referencedClasses: [],
  12467. messageSends: ["trimRight:"]
  12468. }),
  12469. $globals.String);
  12470. $core.addMethod(
  12471. $core.method({
  12472. selector: "trimRight:",
  12473. protocol: "regular expressions",
  12474. fn: function (separators){
  12475. var self=this,$self=this;
  12476. return $core.withContext(function($ctx1) {
  12477. var $2,$1;
  12478. $2=$recv("[".__comma(separators)).__comma("]+$");
  12479. $ctx1.sendIdx[","]=1;
  12480. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12481. return $self._replaceRegexp_with_($1,"");
  12482. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12483. },
  12484. args: ["separators"],
  12485. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12486. referencedClasses: ["RegularExpression"],
  12487. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12488. }),
  12489. $globals.String);
  12490. $core.addMethod(
  12491. $core.method({
  12492. selector: "unescaped",
  12493. protocol: "converting",
  12494. fn: function (){
  12495. var self=this,$self=this;
  12496. return $core.withContext(function($ctx1) {
  12497. return unescape(self);
  12498. return self;
  12499. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12500. },
  12501. args: [],
  12502. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12503. referencedClasses: [],
  12504. messageSends: []
  12505. }),
  12506. $globals.String);
  12507. $core.addMethod(
  12508. $core.method({
  12509. selector: "uriComponentDecoded",
  12510. protocol: "converting",
  12511. fn: function (){
  12512. var self=this,$self=this;
  12513. return $core.withContext(function($ctx1) {
  12514. return decodeURIComponent(self);
  12515. return self;
  12516. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12517. },
  12518. args: [],
  12519. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12520. referencedClasses: [],
  12521. messageSends: []
  12522. }),
  12523. $globals.String);
  12524. $core.addMethod(
  12525. $core.method({
  12526. selector: "uriComponentEncoded",
  12527. protocol: "converting",
  12528. fn: function (){
  12529. var self=this,$self=this;
  12530. return $core.withContext(function($ctx1) {
  12531. return encodeURIComponent(self);
  12532. return self;
  12533. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12534. },
  12535. args: [],
  12536. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12537. referencedClasses: [],
  12538. messageSends: []
  12539. }),
  12540. $globals.String);
  12541. $core.addMethod(
  12542. $core.method({
  12543. selector: "uriDecoded",
  12544. protocol: "converting",
  12545. fn: function (){
  12546. var self=this,$self=this;
  12547. return $core.withContext(function($ctx1) {
  12548. return decodeURI(self);
  12549. return self;
  12550. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12551. },
  12552. args: [],
  12553. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12554. referencedClasses: [],
  12555. messageSends: []
  12556. }),
  12557. $globals.String);
  12558. $core.addMethod(
  12559. $core.method({
  12560. selector: "uriEncoded",
  12561. protocol: "converting",
  12562. fn: function (){
  12563. var self=this,$self=this;
  12564. return $core.withContext(function($ctx1) {
  12565. return encodeURI(self);
  12566. return self;
  12567. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12568. },
  12569. args: [],
  12570. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12571. referencedClasses: [],
  12572. messageSends: []
  12573. }),
  12574. $globals.String);
  12575. $core.addMethod(
  12576. $core.method({
  12577. selector: "value:",
  12578. protocol: "evaluating",
  12579. fn: function (anObject){
  12580. var self=this,$self=this;
  12581. return $core.withContext(function($ctx1) {
  12582. return $recv(anObject)._perform_(self);
  12583. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12584. },
  12585. args: ["anObject"],
  12586. source: "value: anObject \x0a\x09^ anObject perform: self",
  12587. referencedClasses: [],
  12588. messageSends: ["perform:"]
  12589. }),
  12590. $globals.String);
  12591. $core.addMethod(
  12592. $core.method({
  12593. selector: "cr",
  12594. protocol: "accessing",
  12595. fn: function (){
  12596. var self=this,$self=this;
  12597. return $core.withContext(function($ctx1) {
  12598. return "\r";
  12599. return self;
  12600. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12601. },
  12602. args: [],
  12603. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12604. referencedClasses: [],
  12605. messageSends: []
  12606. }),
  12607. $globals.String.a$cls);
  12608. $core.addMethod(
  12609. $core.method({
  12610. selector: "crlf",
  12611. protocol: "accessing",
  12612. fn: function (){
  12613. var self=this,$self=this;
  12614. return $core.withContext(function($ctx1) {
  12615. return "\r\n";
  12616. return self;
  12617. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12618. },
  12619. args: [],
  12620. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12621. referencedClasses: [],
  12622. messageSends: []
  12623. }),
  12624. $globals.String.a$cls);
  12625. $core.addMethod(
  12626. $core.method({
  12627. selector: "esc",
  12628. protocol: "accessing",
  12629. fn: function (){
  12630. var self=this,$self=this;
  12631. return $core.withContext(function($ctx1) {
  12632. return $self._fromCharCode_((27));
  12633. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12634. },
  12635. args: [],
  12636. source: "esc\x0a\x09^ self fromCharCode: 27",
  12637. referencedClasses: [],
  12638. messageSends: ["fromCharCode:"]
  12639. }),
  12640. $globals.String.a$cls);
  12641. $core.addMethod(
  12642. $core.method({
  12643. selector: "fromCharCode:",
  12644. protocol: "instance creation",
  12645. fn: function (anInteger){
  12646. var self=this,$self=this;
  12647. return $core.withContext(function($ctx1) {
  12648. return String.fromCharCode(anInteger);
  12649. return self;
  12650. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12651. },
  12652. args: ["anInteger"],
  12653. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12654. referencedClasses: [],
  12655. messageSends: []
  12656. }),
  12657. $globals.String.a$cls);
  12658. $core.addMethod(
  12659. $core.method({
  12660. selector: "fromString:",
  12661. protocol: "instance creation",
  12662. fn: function (aString){
  12663. var self=this,$self=this;
  12664. return $core.withContext(function($ctx1) {
  12665. return String(aString);
  12666. return self;
  12667. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12668. },
  12669. args: ["aString"],
  12670. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12671. referencedClasses: [],
  12672. messageSends: []
  12673. }),
  12674. $globals.String.a$cls);
  12675. $core.addMethod(
  12676. $core.method({
  12677. selector: "lf",
  12678. protocol: "accessing",
  12679. fn: function (){
  12680. var self=this,$self=this;
  12681. return $core.withContext(function($ctx1) {
  12682. return "\n";
  12683. return self;
  12684. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12685. },
  12686. args: [],
  12687. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12688. referencedClasses: [],
  12689. messageSends: []
  12690. }),
  12691. $globals.String.a$cls);
  12692. $core.addMethod(
  12693. $core.method({
  12694. selector: "random",
  12695. protocol: "random",
  12696. fn: function (){
  12697. var self=this,$self=this;
  12698. return $core.withContext(function($ctx1) {
  12699. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12700. return self;
  12701. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12702. },
  12703. args: [],
  12704. 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);'>",
  12705. referencedClasses: [],
  12706. messageSends: []
  12707. }),
  12708. $globals.String.a$cls);
  12709. $core.addMethod(
  12710. $core.method({
  12711. selector: "randomNotIn:",
  12712. protocol: "random",
  12713. fn: function (aString){
  12714. var self=this,$self=this;
  12715. var result;
  12716. return $core.withContext(function($ctx1) {
  12717. $recv((function(){
  12718. return $core.withContext(function($ctx2) {
  12719. result=$self._random();
  12720. return $recv(aString)._includesSubString_(result);
  12721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12722. }))._whileTrue();
  12723. return result;
  12724. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12725. },
  12726. args: ["aString"],
  12727. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12728. referencedClasses: [],
  12729. messageSends: ["whileTrue", "random", "includesSubString:"]
  12730. }),
  12731. $globals.String.a$cls);
  12732. $core.addMethod(
  12733. $core.method({
  12734. selector: "space",
  12735. protocol: "accessing",
  12736. fn: function (){
  12737. var self=this,$self=this;
  12738. return $core.withContext(function($ctx1) {
  12739. return " ";
  12740. return self;
  12741. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12742. },
  12743. args: [],
  12744. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12745. referencedClasses: [],
  12746. messageSends: []
  12747. }),
  12748. $globals.String.a$cls);
  12749. $core.addMethod(
  12750. $core.method({
  12751. selector: "streamClass",
  12752. protocol: "accessing",
  12753. fn: function (){
  12754. var self=this,$self=this;
  12755. return $globals.StringStream;
  12756. },
  12757. args: [],
  12758. source: "streamClass\x0a\x09\x09^ StringStream",
  12759. referencedClasses: ["StringStream"],
  12760. messageSends: []
  12761. }),
  12762. $globals.String.a$cls);
  12763. $core.addMethod(
  12764. $core.method({
  12765. selector: "tab",
  12766. protocol: "accessing",
  12767. fn: function (){
  12768. var self=this,$self=this;
  12769. return $core.withContext(function($ctx1) {
  12770. return "\t";
  12771. return self;
  12772. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12773. },
  12774. args: [],
  12775. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12776. referencedClasses: [],
  12777. messageSends: []
  12778. }),
  12779. $globals.String.a$cls);
  12780. $core.addMethod(
  12781. $core.method({
  12782. selector: "value:",
  12783. protocol: "instance creation",
  12784. fn: function (aUTFCharCode){
  12785. var self=this,$self=this;
  12786. return $core.withContext(function($ctx1) {
  12787. return String.fromCharCode(aUTFCharCode);;
  12788. return self;
  12789. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12790. },
  12791. args: ["aUTFCharCode"],
  12792. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12793. referencedClasses: [],
  12794. messageSends: []
  12795. }),
  12796. $globals.String.a$cls);
  12797. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12798. $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`.";
  12799. $core.addMethod(
  12800. $core.method({
  12801. selector: "=",
  12802. protocol: "comparing",
  12803. fn: function (aCollection){
  12804. var self=this,$self=this;
  12805. return $core.withContext(function($ctx1) {
  12806. var $2,$1,$4,$3,$5;
  12807. var $early={};
  12808. try {
  12809. $2=$self._class();
  12810. $ctx1.sendIdx["class"]=1;
  12811. $1=$recv($2).__eq($recv(aCollection)._class());
  12812. $ctx1.sendIdx["="]=1;
  12813. if(!$core.assert($1)){
  12814. return false;
  12815. }
  12816. $4=$self._size();
  12817. $ctx1.sendIdx["size"]=1;
  12818. $3=$recv($4).__eq($recv(aCollection)._size());
  12819. if(!$core.assert($3)){
  12820. return false;
  12821. }
  12822. $self._do_((function(each){
  12823. return $core.withContext(function($ctx2) {
  12824. $5=$recv(aCollection)._includes_(each);
  12825. if(!$core.assert($5)){
  12826. throw $early=[false];
  12827. }
  12828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12829. }));
  12830. return true;
  12831. }
  12832. catch(e) {if(e===$early)return e[0]; throw e}
  12833. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12834. },
  12835. args: ["aCollection"],
  12836. 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",
  12837. referencedClasses: [],
  12838. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12839. }),
  12840. $globals.Set);
  12841. $core.addMethod(
  12842. $core.method({
  12843. selector: "add:",
  12844. protocol: "adding/removing",
  12845. fn: function (anObject){
  12846. var self=this,$self=this;
  12847. var bucket;
  12848. return $core.withContext(function($ctx1) {
  12849. var $1,$receiver;
  12850. bucket=$self._bucketsOfElement_(anObject);
  12851. $1=$recv(bucket)._second();
  12852. if(($receiver = $1) == null || $receiver.a$nil){
  12853. var object,slowBucket;
  12854. object=$recv(bucket)._first();
  12855. $ctx1.sendIdx["first"]=1;
  12856. slowBucket=$recv(bucket)._third();
  12857. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12858. return $core.withContext(function($ctx2) {
  12859. $recv(slowBucket)._add_(object);
  12860. $self["@size"]=$recv($self["@size"]).__plus((1));
  12861. return $self["@size"];
  12862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12863. }));
  12864. return object;
  12865. } else {
  12866. var primitiveBucket;
  12867. primitiveBucket=$receiver;
  12868. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12869. }
  12870. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12871. },
  12872. args: ["anObject"],
  12873. 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 ]",
  12874. referencedClasses: [],
  12875. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12876. }),
  12877. $globals.Set);
  12878. $core.addMethod(
  12879. $core.method({
  12880. selector: "add:in:",
  12881. protocol: "private",
  12882. fn: function (anObject,anotherObject){
  12883. var self=this,$self=this;
  12884. return $core.withContext(function($ctx1) {
  12885. if (anObject in anotherObject.store) { return false; }
  12886. $self['@size']++;
  12887. anotherObject.store[anObject] = true;
  12888. return anObject;
  12889. ;
  12890. return self;
  12891. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12892. },
  12893. args: ["anObject", "anotherObject"],
  12894. 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'>",
  12895. referencedClasses: [],
  12896. messageSends: []
  12897. }),
  12898. $globals.Set);
  12899. $core.addMethod(
  12900. $core.method({
  12901. selector: "bucketsOfElement:",
  12902. protocol: "private",
  12903. fn: function (anObject){
  12904. var self=this,$self=this;
  12905. return $core.withContext(function($ctx1) {
  12906. // include nil to well-known objects under "boolean" fastBucket
  12907. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12908. var prim = anObject.valueOf();
  12909. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12910. var bucket = null;
  12911. $self['@slowBucketStores'].some(function (store) {
  12912. return bucket = store._bucketOfElement_(anObject);
  12913. });
  12914. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12915. }
  12916. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12917. ;
  12918. return self;
  12919. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12920. },
  12921. args: ["anObject"],
  12922. 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'>",
  12923. referencedClasses: [],
  12924. messageSends: []
  12925. }),
  12926. $globals.Set);
  12927. $core.addMethod(
  12928. $core.method({
  12929. selector: "classNameOf:",
  12930. protocol: "private",
  12931. fn: function (anObject){
  12932. var self=this,$self=this;
  12933. return $core.withContext(function($ctx1) {
  12934. return anObject.a$cls != null && anObject.a$cls.name;
  12935. return self;
  12936. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12937. },
  12938. args: ["anObject"],
  12939. 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'>",
  12940. referencedClasses: [],
  12941. messageSends: []
  12942. }),
  12943. $globals.Set);
  12944. $core.addMethod(
  12945. $core.method({
  12946. selector: "collect:",
  12947. protocol: "enumerating",
  12948. fn: function (aBlock){
  12949. var self=this,$self=this;
  12950. var collection;
  12951. return $core.withContext(function($ctx1) {
  12952. collection=$recv($self._class())._new();
  12953. $self._do_((function(each){
  12954. return $core.withContext(function($ctx2) {
  12955. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12956. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12957. }));
  12958. return collection;
  12959. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12960. },
  12961. args: ["aBlock"],
  12962. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12963. referencedClasses: [],
  12964. messageSends: ["new", "class", "do:", "add:", "value:"]
  12965. }),
  12966. $globals.Set);
  12967. $core.addMethod(
  12968. $core.method({
  12969. selector: "detect:ifNone:",
  12970. protocol: "enumerating",
  12971. fn: function (aBlock,anotherBlock){
  12972. var self=this,$self=this;
  12973. return $core.withContext(function($ctx1) {
  12974. var $1;
  12975. var $early={};
  12976. try {
  12977. $self._do_((function(each){
  12978. return $core.withContext(function($ctx2) {
  12979. $1=$recv(aBlock)._value_(each);
  12980. if($core.assert($1)){
  12981. throw $early=[each];
  12982. }
  12983. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12984. }));
  12985. return $recv(anotherBlock)._value();
  12986. }
  12987. catch(e) {if(e===$early)return e[0]; throw e}
  12988. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12989. },
  12990. args: ["aBlock", "anotherBlock"],
  12991. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12992. referencedClasses: [],
  12993. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12994. }),
  12995. $globals.Set);
  12996. $core.addMethod(
  12997. $core.method({
  12998. selector: "do:",
  12999. protocol: "enumerating",
  13000. fn: function (aBlock){
  13001. var self=this,$self=this;
  13002. return $core.withContext(function($ctx1) {
  13003. var el, keys, i;
  13004. el = $self['@fastBuckets'];
  13005. keys = Object.keys(el);
  13006. for (i = 0; i < keys.length; ++i) {
  13007. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  13008. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  13009. else { store._do_(aBlock); }
  13010. }
  13011. el = $self['@slowBucketStores'];
  13012. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  13013. $self['@defaultBucket']._do_(aBlock);
  13014. ;
  13015. return self;
  13016. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  13017. },
  13018. args: ["aBlock"],
  13019. 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'>",
  13020. referencedClasses: [],
  13021. messageSends: []
  13022. }),
  13023. $globals.Set);
  13024. $core.addMethod(
  13025. $core.method({
  13026. selector: "includes:",
  13027. protocol: "testing",
  13028. fn: function (anObject){
  13029. var self=this,$self=this;
  13030. var bucket;
  13031. return $core.withContext(function($ctx1) {
  13032. var $1,$2,$3,$receiver;
  13033. bucket=$self._bucketsOfElement_(anObject);
  13034. $1=$recv(bucket)._second();
  13035. if(($receiver = $1) == null || $receiver.a$nil){
  13036. $2=$recv(bucket)._third();
  13037. $3=$recv(bucket)._first();
  13038. $ctx1.sendIdx["first"]=1;
  13039. return $recv($2)._includes_($3);
  13040. } else {
  13041. var primitiveBucket;
  13042. primitiveBucket=$receiver;
  13043. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  13044. }
  13045. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  13046. },
  13047. args: ["anObject"],
  13048. 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 ]",
  13049. referencedClasses: [],
  13050. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  13051. }),
  13052. $globals.Set);
  13053. $core.addMethod(
  13054. $core.method({
  13055. selector: "includes:in:",
  13056. protocol: "private",
  13057. fn: function (anObject,anotherObject){
  13058. var self=this,$self=this;
  13059. return $core.withContext(function($ctx1) {
  13060. return anObject in anotherObject.store;
  13061. return self;
  13062. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13063. },
  13064. args: ["anObject", "anotherObject"],
  13065. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  13066. referencedClasses: [],
  13067. messageSends: []
  13068. }),
  13069. $globals.Set);
  13070. $core.addMethod(
  13071. $core.method({
  13072. selector: "initialize",
  13073. protocol: "initialization",
  13074. fn: function (){
  13075. var self=this,$self=this;
  13076. return $core.withContext(function($ctx1) {
  13077. (
  13078. $ctx1.supercall = true,
  13079. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13080. $ctx1.supercall = false;
  13081. $self["@defaultBucket"]=[];
  13082. $self._initializeSlowBucketStores();
  13083. $self._removeAll();
  13084. return self;
  13085. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  13086. },
  13087. args: [],
  13088. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  13089. referencedClasses: [],
  13090. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  13091. }),
  13092. $globals.Set);
  13093. $core.addMethod(
  13094. $core.method({
  13095. selector: "initializeSlowBucketStores",
  13096. protocol: "initialization",
  13097. fn: function (){
  13098. var self=this,$self=this;
  13099. return $core.withContext(function($ctx1) {
  13100. var $1;
  13101. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13102. return $core.withContext(function($ctx2) {
  13103. return $self._classNameOf_(x);
  13104. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13105. }));
  13106. $ctx1.sendIdx["hashBlock:"]=1;
  13107. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13108. return $core.withContext(function($ctx2) {
  13109. return $self._jsConstructorNameOf_(x);
  13110. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13111. }))];
  13112. return self;
  13113. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  13114. },
  13115. args: [],
  13116. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13117. referencedClasses: ["ArrayBucketStore"],
  13118. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13119. }),
  13120. $globals.Set);
  13121. $core.addMethod(
  13122. $core.method({
  13123. selector: "jsConstructorNameOf:",
  13124. protocol: "private",
  13125. fn: function (anObject){
  13126. var self=this,$self=this;
  13127. return $core.withContext(function($ctx1) {
  13128. return anObject.constructor && anObject.constructor.name;
  13129. return self;
  13130. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  13131. },
  13132. args: ["anObject"],
  13133. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13134. referencedClasses: [],
  13135. messageSends: []
  13136. }),
  13137. $globals.Set);
  13138. $core.addMethod(
  13139. $core.method({
  13140. selector: "printOn:",
  13141. protocol: "printing",
  13142. fn: function (aStream){
  13143. var self=this,$self=this;
  13144. return $core.withContext(function($ctx1) {
  13145. (
  13146. $ctx1.supercall = true,
  13147. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13148. $ctx1.supercall = false;
  13149. $ctx1.sendIdx["printOn:"]=1;
  13150. $recv(aStream)._nextPutAll_(" (");
  13151. $ctx1.sendIdx["nextPutAll:"]=1;
  13152. $self._do_separatedBy_((function(each){
  13153. return $core.withContext(function($ctx2) {
  13154. return $recv(each)._printOn_(aStream);
  13155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13156. }),(function(){
  13157. return $core.withContext(function($ctx2) {
  13158. return $recv(aStream)._nextPutAll_(" ");
  13159. $ctx2.sendIdx["nextPutAll:"]=2;
  13160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13161. }));
  13162. $recv(aStream)._nextPutAll_(")");
  13163. return self;
  13164. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  13165. },
  13166. args: ["aStream"],
  13167. 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: ')'",
  13168. referencedClasses: [],
  13169. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13170. }),
  13171. $globals.Set);
  13172. $core.addMethod(
  13173. $core.method({
  13174. selector: "remove:ifAbsent:",
  13175. protocol: "adding/removing",
  13176. fn: function (anObject,aBlock){
  13177. var self=this,$self=this;
  13178. var bucket;
  13179. return $core.withContext(function($ctx1) {
  13180. var $1,$2,$3,$receiver;
  13181. var $early={};
  13182. try {
  13183. bucket=$self._bucketsOfElement_(anObject);
  13184. $1=$recv(bucket)._second();
  13185. if(($receiver = $1) == null || $receiver.a$nil){
  13186. $2=$recv(bucket)._third();
  13187. $3=$recv(bucket)._first();
  13188. $ctx1.sendIdx["first"]=1;
  13189. $recv($2)._remove_ifAbsent_($3,(function(){
  13190. return $core.withContext(function($ctx2) {
  13191. throw $early=[$recv(aBlock)._value()];
  13192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13193. }));
  13194. $self["@size"]=$recv($self["@size"]).__minus((1));
  13195. return $self["@size"];
  13196. } else {
  13197. var primitiveBucket;
  13198. primitiveBucket=$receiver;
  13199. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  13200. }
  13201. }
  13202. catch(e) {if(e===$early)return e[0]; throw e}
  13203. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  13204. },
  13205. args: ["anObject", "aBlock"],
  13206. 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 ]",
  13207. referencedClasses: [],
  13208. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  13209. }),
  13210. $globals.Set);
  13211. $core.addMethod(
  13212. $core.method({
  13213. selector: "remove:in:",
  13214. protocol: "private",
  13215. fn: function (anObject,anotherObject){
  13216. var self=this,$self=this;
  13217. return $core.withContext(function($ctx1) {
  13218. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  13219. return self;
  13220. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13221. },
  13222. args: ["anObject", "anotherObject"],
  13223. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  13224. referencedClasses: [],
  13225. messageSends: []
  13226. }),
  13227. $globals.Set);
  13228. $core.addMethod(
  13229. $core.method({
  13230. selector: "removeAll",
  13231. protocol: "adding/removing",
  13232. fn: function (){
  13233. var self=this,$self=this;
  13234. return $core.withContext(function($ctx1) {
  13235. $self['@fastBuckets'] = {
  13236. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13237. "number": { store: Object.create(null), fn: Number },
  13238. "string": { store: Object.create(null) }
  13239. };
  13240. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  13241. $self['@defaultBucket']._removeAll();
  13242. $self['@size'] = 0;
  13243. ;
  13244. return self;
  13245. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  13246. },
  13247. args: [],
  13248. 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'>",
  13249. referencedClasses: [],
  13250. messageSends: []
  13251. }),
  13252. $globals.Set);
  13253. $core.addMethod(
  13254. $core.method({
  13255. selector: "select:",
  13256. protocol: "enumerating",
  13257. fn: function (aBlock){
  13258. var self=this,$self=this;
  13259. var collection;
  13260. return $core.withContext(function($ctx1) {
  13261. var $1;
  13262. collection=$recv($self._class())._new();
  13263. $self._do_((function(each){
  13264. return $core.withContext(function($ctx2) {
  13265. $1=$recv(aBlock)._value_(each);
  13266. if($core.assert($1)){
  13267. return $recv(collection)._add_(each);
  13268. }
  13269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13270. }));
  13271. return collection;
  13272. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  13273. },
  13274. args: ["aBlock"],
  13275. 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",
  13276. referencedClasses: [],
  13277. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13278. }),
  13279. $globals.Set);
  13280. $core.addMethod(
  13281. $core.method({
  13282. selector: "select:thenCollect:",
  13283. protocol: "enumerating",
  13284. fn: function (selectBlock,collectBlock){
  13285. var self=this,$self=this;
  13286. var collection;
  13287. return $core.withContext(function($ctx1) {
  13288. var $1;
  13289. collection=$recv($self._class())._new();
  13290. $self._do_((function(each){
  13291. return $core.withContext(function($ctx2) {
  13292. $1=$recv(selectBlock)._value_(each);
  13293. $ctx2.sendIdx["value:"]=1;
  13294. if($core.assert($1)){
  13295. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13296. }
  13297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13298. }));
  13299. return collection;
  13300. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  13301. },
  13302. args: ["selectBlock", "collectBlock"],
  13303. 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",
  13304. referencedClasses: [],
  13305. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13306. }),
  13307. $globals.Set);
  13308. $core.addMethod(
  13309. $core.method({
  13310. selector: "size",
  13311. protocol: "accessing",
  13312. fn: function (){
  13313. var self=this,$self=this;
  13314. return $self["@size"];
  13315. },
  13316. args: [],
  13317. source: "size\x0a\x09^ size",
  13318. referencedClasses: [],
  13319. messageSends: []
  13320. }),
  13321. $globals.Set);
  13322. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13323. $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.";
  13324. $core.addMethod(
  13325. $core.method({
  13326. selector: "<<",
  13327. protocol: "writing",
  13328. fn: function (anObject){
  13329. var self=this,$self=this;
  13330. return $core.withContext(function($ctx1) {
  13331. $self._write_(anObject);
  13332. return self;
  13333. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  13334. },
  13335. args: ["anObject"],
  13336. source: "<< anObject\x0a\x09self write: anObject",
  13337. referencedClasses: [],
  13338. messageSends: ["write:"]
  13339. }),
  13340. $globals.ProtoStream);
  13341. $core.addMethod(
  13342. $core.method({
  13343. selector: "atEnd",
  13344. protocol: "testing",
  13345. fn: function (){
  13346. var self=this,$self=this;
  13347. return $core.withContext(function($ctx1) {
  13348. $self._subclassResponsibility();
  13349. return self;
  13350. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  13351. },
  13352. args: [],
  13353. source: "atEnd\x0a\x09self subclassResponsibility",
  13354. referencedClasses: [],
  13355. messageSends: ["subclassResponsibility"]
  13356. }),
  13357. $globals.ProtoStream);
  13358. $core.addMethod(
  13359. $core.method({
  13360. selector: "atStart",
  13361. protocol: "testing",
  13362. fn: function (){
  13363. var self=this,$self=this;
  13364. return $core.withContext(function($ctx1) {
  13365. $self._subclassResponsibility();
  13366. return self;
  13367. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  13368. },
  13369. args: [],
  13370. source: "atStart\x0a\x09self subclassResponsibility",
  13371. referencedClasses: [],
  13372. messageSends: ["subclassResponsibility"]
  13373. }),
  13374. $globals.ProtoStream);
  13375. $core.addMethod(
  13376. $core.method({
  13377. selector: "contents",
  13378. protocol: "accessing",
  13379. fn: function (){
  13380. var self=this,$self=this;
  13381. return $core.withContext(function($ctx1) {
  13382. $self._subclassResponsibility();
  13383. return self;
  13384. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  13385. },
  13386. args: [],
  13387. source: "contents\x0a\x09self subclassResponsibility",
  13388. referencedClasses: [],
  13389. messageSends: ["subclassResponsibility"]
  13390. }),
  13391. $globals.ProtoStream);
  13392. $core.addMethod(
  13393. $core.method({
  13394. selector: "do:",
  13395. protocol: "enumerating",
  13396. fn: function (aBlock){
  13397. var self=this,$self=this;
  13398. return $core.withContext(function($ctx1) {
  13399. $recv((function(){
  13400. return $core.withContext(function($ctx2) {
  13401. return $self._atEnd();
  13402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13403. }))._whileFalse_((function(){
  13404. return $core.withContext(function($ctx2) {
  13405. return $recv(aBlock)._value_($self._next());
  13406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13407. }));
  13408. return self;
  13409. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  13410. },
  13411. args: ["aBlock"],
  13412. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13413. referencedClasses: [],
  13414. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13415. }),
  13416. $globals.ProtoStream);
  13417. $core.addMethod(
  13418. $core.method({
  13419. selector: "isEmpty",
  13420. protocol: "testing",
  13421. fn: function (){
  13422. var self=this,$self=this;
  13423. return $core.withContext(function($ctx1) {
  13424. return $recv($self._atStart())._and_((function(){
  13425. return $core.withContext(function($ctx2) {
  13426. return $self._atEnd();
  13427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13428. }));
  13429. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  13430. },
  13431. args: [],
  13432. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13433. referencedClasses: [],
  13434. messageSends: ["and:", "atStart", "atEnd"]
  13435. }),
  13436. $globals.ProtoStream);
  13437. $core.addMethod(
  13438. $core.method({
  13439. selector: "next",
  13440. protocol: "reading",
  13441. fn: function (){
  13442. var self=this,$self=this;
  13443. return $core.withContext(function($ctx1) {
  13444. var $1;
  13445. $1=$self._atEnd();
  13446. if($core.assert($1)){
  13447. return nil;
  13448. } else {
  13449. return $self._subclassResponsibility();
  13450. }
  13451. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  13452. },
  13453. args: [],
  13454. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13455. referencedClasses: [],
  13456. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13457. }),
  13458. $globals.ProtoStream);
  13459. $core.addMethod(
  13460. $core.method({
  13461. selector: "nextPut:",
  13462. protocol: "writing",
  13463. fn: function (anObject){
  13464. var self=this,$self=this;
  13465. return $core.withContext(function($ctx1) {
  13466. $self._subclassResponsibility();
  13467. return self;
  13468. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  13469. },
  13470. args: ["anObject"],
  13471. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13472. referencedClasses: [],
  13473. messageSends: ["subclassResponsibility"]
  13474. }),
  13475. $globals.ProtoStream);
  13476. $core.addMethod(
  13477. $core.method({
  13478. selector: "nextPutAll:",
  13479. protocol: "writing",
  13480. fn: function (aCollection){
  13481. var self=this,$self=this;
  13482. return $core.withContext(function($ctx1) {
  13483. $recv(aCollection)._do_((function(each){
  13484. return $core.withContext(function($ctx2) {
  13485. return $self._nextPut_(each);
  13486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13487. }));
  13488. return self;
  13489. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  13490. },
  13491. args: ["aCollection"],
  13492. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13493. referencedClasses: [],
  13494. messageSends: ["do:", "nextPut:"]
  13495. }),
  13496. $globals.ProtoStream);
  13497. $core.addMethod(
  13498. $core.method({
  13499. selector: "nextPutString:",
  13500. protocol: "writing",
  13501. fn: function (aString){
  13502. var self=this,$self=this;
  13503. return $core.withContext(function($ctx1) {
  13504. $self._nextPut_(aString);
  13505. return self;
  13506. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13507. },
  13508. args: ["aString"],
  13509. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13510. referencedClasses: [],
  13511. messageSends: ["nextPut:"]
  13512. }),
  13513. $globals.ProtoStream);
  13514. $core.addMethod(
  13515. $core.method({
  13516. selector: "peek",
  13517. protocol: "reading",
  13518. fn: function (){
  13519. var self=this,$self=this;
  13520. return $core.withContext(function($ctx1) {
  13521. var $1;
  13522. $1=$self._atEnd();
  13523. if($core.assert($1)){
  13524. return nil;
  13525. } else {
  13526. return $self._subclassResponsibility();
  13527. }
  13528. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13529. },
  13530. args: [],
  13531. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13532. referencedClasses: [],
  13533. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13534. }),
  13535. $globals.ProtoStream);
  13536. $core.addMethod(
  13537. $core.method({
  13538. selector: "reset",
  13539. protocol: "actions",
  13540. fn: function (){
  13541. var self=this,$self=this;
  13542. return $core.withContext(function($ctx1) {
  13543. $self._subclassResponsibility();
  13544. return self;
  13545. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  13546. },
  13547. args: [],
  13548. source: "reset\x0a\x09self subclassResponsibility",
  13549. referencedClasses: [],
  13550. messageSends: ["subclassResponsibility"]
  13551. }),
  13552. $globals.ProtoStream);
  13553. $core.addMethod(
  13554. $core.method({
  13555. selector: "resetContents",
  13556. protocol: "actions",
  13557. fn: function (){
  13558. var self=this,$self=this;
  13559. return $core.withContext(function($ctx1) {
  13560. $self._subclassResponsibility();
  13561. return self;
  13562. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13563. },
  13564. args: [],
  13565. source: "resetContents\x0a\x09self subclassResponsibility",
  13566. referencedClasses: [],
  13567. messageSends: ["subclassResponsibility"]
  13568. }),
  13569. $globals.ProtoStream);
  13570. $core.addMethod(
  13571. $core.method({
  13572. selector: "setToEnd",
  13573. protocol: "positioning",
  13574. fn: function (){
  13575. var self=this,$self=this;
  13576. return $core.withContext(function($ctx1) {
  13577. $self._subclassResponsibility();
  13578. return self;
  13579. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13580. },
  13581. args: [],
  13582. source: "setToEnd\x0a\x09self subclassResponsibility",
  13583. referencedClasses: [],
  13584. messageSends: ["subclassResponsibility"]
  13585. }),
  13586. $globals.ProtoStream);
  13587. $core.addMethod(
  13588. $core.method({
  13589. selector: "setToStart",
  13590. protocol: "positioning",
  13591. fn: function (){
  13592. var self=this,$self=this;
  13593. return $core.withContext(function($ctx1) {
  13594. $self._reset();
  13595. return self;
  13596. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13597. },
  13598. args: [],
  13599. source: "setToStart\x0a\x09self reset",
  13600. referencedClasses: [],
  13601. messageSends: ["reset"]
  13602. }),
  13603. $globals.ProtoStream);
  13604. $core.addMethod(
  13605. $core.method({
  13606. selector: "write:",
  13607. protocol: "writing",
  13608. fn: function (anObject){
  13609. var self=this,$self=this;
  13610. return $core.withContext(function($ctx1) {
  13611. $recv(anObject)._putOn_(self);
  13612. return self;
  13613. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13614. },
  13615. args: ["anObject"],
  13616. source: "write: anObject\x0a\x09anObject putOn: self",
  13617. referencedClasses: [],
  13618. messageSends: ["putOn:"]
  13619. }),
  13620. $globals.ProtoStream);
  13621. $core.addMethod(
  13622. $core.method({
  13623. selector: "on:",
  13624. protocol: "instance creation",
  13625. fn: function (aCollection){
  13626. var self=this,$self=this;
  13627. return $core.withContext(function($ctx1) {
  13628. var $1;
  13629. $1=$self._new();
  13630. $recv($1)._setCollection_(aCollection);
  13631. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13632. return $recv($1)._yourself();
  13633. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13634. },
  13635. args: ["aCollection"],
  13636. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13637. referencedClasses: [],
  13638. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13639. }),
  13640. $globals.ProtoStream.a$cls);
  13641. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13642. $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.";
  13643. $core.addMethod(
  13644. $core.method({
  13645. selector: "atEnd",
  13646. protocol: "testing",
  13647. fn: function (){
  13648. var self=this,$self=this;
  13649. return $core.withContext(function($ctx1) {
  13650. return $recv($self._position()).__eq($self._size());
  13651. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13652. },
  13653. args: [],
  13654. source: "atEnd\x0a\x09^ self position = self size",
  13655. referencedClasses: [],
  13656. messageSends: ["=", "position", "size"]
  13657. }),
  13658. $globals.Stream);
  13659. $core.addMethod(
  13660. $core.method({
  13661. selector: "atStart",
  13662. protocol: "testing",
  13663. fn: function (){
  13664. var self=this,$self=this;
  13665. return $core.withContext(function($ctx1) {
  13666. return $recv($self._position()).__eq((0));
  13667. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13668. },
  13669. args: [],
  13670. source: "atStart\x0a\x09^ self position = 0",
  13671. referencedClasses: [],
  13672. messageSends: ["=", "position"]
  13673. }),
  13674. $globals.Stream);
  13675. $core.addMethod(
  13676. $core.method({
  13677. selector: "close",
  13678. protocol: "actions",
  13679. fn: function (){
  13680. var self=this,$self=this;
  13681. return self;
  13682. },
  13683. args: [],
  13684. source: "close",
  13685. referencedClasses: [],
  13686. messageSends: []
  13687. }),
  13688. $globals.Stream);
  13689. $core.addMethod(
  13690. $core.method({
  13691. selector: "collection",
  13692. protocol: "accessing",
  13693. fn: function (){
  13694. var self=this,$self=this;
  13695. return $self["@collection"];
  13696. },
  13697. args: [],
  13698. source: "collection\x0a\x09^ collection",
  13699. referencedClasses: [],
  13700. messageSends: []
  13701. }),
  13702. $globals.Stream);
  13703. $core.addMethod(
  13704. $core.method({
  13705. selector: "contents",
  13706. protocol: "accessing",
  13707. fn: function (){
  13708. var self=this,$self=this;
  13709. return $core.withContext(function($ctx1) {
  13710. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13711. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13712. },
  13713. args: [],
  13714. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13715. referencedClasses: [],
  13716. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13717. }),
  13718. $globals.Stream);
  13719. $core.addMethod(
  13720. $core.method({
  13721. selector: "flush",
  13722. protocol: "actions",
  13723. fn: function (){
  13724. var self=this,$self=this;
  13725. return self;
  13726. },
  13727. args: [],
  13728. source: "flush",
  13729. referencedClasses: [],
  13730. messageSends: []
  13731. }),
  13732. $globals.Stream);
  13733. $core.addMethod(
  13734. $core.method({
  13735. selector: "isEmpty",
  13736. protocol: "testing",
  13737. fn: function (){
  13738. var self=this,$self=this;
  13739. return $core.withContext(function($ctx1) {
  13740. return $recv($self._size()).__eq((0));
  13741. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13742. },
  13743. args: [],
  13744. source: "isEmpty\x0a\x09^ self size = 0",
  13745. referencedClasses: [],
  13746. messageSends: ["=", "size"]
  13747. }),
  13748. $globals.Stream);
  13749. $core.addMethod(
  13750. $core.method({
  13751. selector: "next",
  13752. protocol: "reading",
  13753. fn: function (){
  13754. var self=this,$self=this;
  13755. return $core.withContext(function($ctx1) {
  13756. var $1,$3,$2;
  13757. $1=$self._atEnd();
  13758. if($core.assert($1)){
  13759. return nil;
  13760. } else {
  13761. $3=$self._position();
  13762. $ctx1.sendIdx["position"]=1;
  13763. $2=$recv($3).__plus((1));
  13764. $self._position_($2);
  13765. return $recv($self["@collection"])._at_($self._position());
  13766. }
  13767. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13768. },
  13769. args: [],
  13770. 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 ]",
  13771. referencedClasses: [],
  13772. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13773. }),
  13774. $globals.Stream);
  13775. $core.addMethod(
  13776. $core.method({
  13777. selector: "next:",
  13778. protocol: "reading",
  13779. fn: function (anInteger){
  13780. var self=this,$self=this;
  13781. var tempCollection;
  13782. return $core.withContext(function($ctx1) {
  13783. var $1;
  13784. tempCollection=$recv($recv($self._collection())._class())._new();
  13785. $recv(anInteger)._timesRepeat_((function(){
  13786. return $core.withContext(function($ctx2) {
  13787. $1=$self._atEnd();
  13788. if(!$core.assert($1)){
  13789. return $recv(tempCollection)._add_($self._next());
  13790. }
  13791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13792. }));
  13793. return tempCollection;
  13794. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13795. },
  13796. args: ["anInteger"],
  13797. 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",
  13798. referencedClasses: [],
  13799. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13800. }),
  13801. $globals.Stream);
  13802. $core.addMethod(
  13803. $core.method({
  13804. selector: "nextPut:",
  13805. protocol: "writing",
  13806. fn: function (anObject){
  13807. var self=this,$self=this;
  13808. return $core.withContext(function($ctx1) {
  13809. var $2,$1,$3,$4;
  13810. $2=$self._position();
  13811. $ctx1.sendIdx["position"]=1;
  13812. $1=$recv($2).__plus((1));
  13813. $self._position_($1);
  13814. $3=$self._collection();
  13815. $4=$self._position();
  13816. $ctx1.sendIdx["position"]=2;
  13817. $recv($3)._at_put_($4,anObject);
  13818. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13819. return self;
  13820. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13821. },
  13822. args: ["anObject"],
  13823. 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)",
  13824. referencedClasses: [],
  13825. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13826. }),
  13827. $globals.Stream);
  13828. $core.addMethod(
  13829. $core.method({
  13830. selector: "peek",
  13831. protocol: "reading",
  13832. fn: function (){
  13833. var self=this,$self=this;
  13834. return $core.withContext(function($ctx1) {
  13835. var $1;
  13836. $1=$self._atEnd();
  13837. if(!$core.assert($1)){
  13838. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13839. }
  13840. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13841. },
  13842. args: [],
  13843. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13844. referencedClasses: [],
  13845. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13846. }),
  13847. $globals.Stream);
  13848. $core.addMethod(
  13849. $core.method({
  13850. selector: "position",
  13851. protocol: "accessing",
  13852. fn: function (){
  13853. var self=this,$self=this;
  13854. return $core.withContext(function($ctx1) {
  13855. var $1,$receiver;
  13856. $1=$self["@position"];
  13857. if(($receiver = $1) == null || $receiver.a$nil){
  13858. $self["@position"]=(0);
  13859. return $self["@position"];
  13860. } else {
  13861. return $1;
  13862. }
  13863. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13864. },
  13865. args: [],
  13866. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13867. referencedClasses: [],
  13868. messageSends: ["ifNil:"]
  13869. }),
  13870. $globals.Stream);
  13871. $core.addMethod(
  13872. $core.method({
  13873. selector: "position:",
  13874. protocol: "accessing",
  13875. fn: function (anInteger){
  13876. var self=this,$self=this;
  13877. $self["@position"]=anInteger;
  13878. return self;
  13879. },
  13880. args: ["anInteger"],
  13881. source: "position: anInteger\x0a\x09position := anInteger",
  13882. referencedClasses: [],
  13883. messageSends: []
  13884. }),
  13885. $globals.Stream);
  13886. $core.addMethod(
  13887. $core.method({
  13888. selector: "reset",
  13889. protocol: "actions",
  13890. fn: function (){
  13891. var self=this,$self=this;
  13892. return $core.withContext(function($ctx1) {
  13893. $self._position_((0));
  13894. return self;
  13895. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13896. },
  13897. args: [],
  13898. source: "reset\x0a\x09self position: 0",
  13899. referencedClasses: [],
  13900. messageSends: ["position:"]
  13901. }),
  13902. $globals.Stream);
  13903. $core.addMethod(
  13904. $core.method({
  13905. selector: "resetContents",
  13906. protocol: "actions",
  13907. fn: function (){
  13908. var self=this,$self=this;
  13909. return $core.withContext(function($ctx1) {
  13910. $self._reset();
  13911. $self._setStreamSize_((0));
  13912. return self;
  13913. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13914. },
  13915. args: [],
  13916. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13917. referencedClasses: [],
  13918. messageSends: ["reset", "setStreamSize:"]
  13919. }),
  13920. $globals.Stream);
  13921. $core.addMethod(
  13922. $core.method({
  13923. selector: "setCollection:",
  13924. protocol: "accessing",
  13925. fn: function (aCollection){
  13926. var self=this,$self=this;
  13927. $self["@collection"]=aCollection;
  13928. return self;
  13929. },
  13930. args: ["aCollection"],
  13931. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13932. referencedClasses: [],
  13933. messageSends: []
  13934. }),
  13935. $globals.Stream);
  13936. $core.addMethod(
  13937. $core.method({
  13938. selector: "setStreamSize:",
  13939. protocol: "accessing",
  13940. fn: function (anInteger){
  13941. var self=this,$self=this;
  13942. $self["@streamSize"]=anInteger;
  13943. return self;
  13944. },
  13945. args: ["anInteger"],
  13946. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13947. referencedClasses: [],
  13948. messageSends: []
  13949. }),
  13950. $globals.Stream);
  13951. $core.addMethod(
  13952. $core.method({
  13953. selector: "setToEnd",
  13954. protocol: "positioning",
  13955. fn: function (){
  13956. var self=this,$self=this;
  13957. return $core.withContext(function($ctx1) {
  13958. $self._position_($self._size());
  13959. return self;
  13960. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13961. },
  13962. args: [],
  13963. source: "setToEnd\x0a\x09self position: self size",
  13964. referencedClasses: [],
  13965. messageSends: ["position:", "size"]
  13966. }),
  13967. $globals.Stream);
  13968. $core.addMethod(
  13969. $core.method({
  13970. selector: "size",
  13971. protocol: "accessing",
  13972. fn: function (){
  13973. var self=this,$self=this;
  13974. return $core.withContext(function($ctx1) {
  13975. return $self._streamSize();
  13976. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13977. },
  13978. args: [],
  13979. source: "size\x0a\x09^ self streamSize",
  13980. referencedClasses: [],
  13981. messageSends: ["streamSize"]
  13982. }),
  13983. $globals.Stream);
  13984. $core.addMethod(
  13985. $core.method({
  13986. selector: "skip:",
  13987. protocol: "positioning",
  13988. fn: function (anInteger){
  13989. var self=this,$self=this;
  13990. return $core.withContext(function($ctx1) {
  13991. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13992. return self;
  13993. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13994. },
  13995. args: ["anInteger"],
  13996. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13997. referencedClasses: [],
  13998. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13999. }),
  14000. $globals.Stream);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "streamSize",
  14004. protocol: "accessing",
  14005. fn: function (){
  14006. var self=this,$self=this;
  14007. return $self["@streamSize"];
  14008. },
  14009. args: [],
  14010. source: "streamSize\x0a\x09^ streamSize",
  14011. referencedClasses: [],
  14012. messageSends: []
  14013. }),
  14014. $globals.Stream);
  14015. $core.addMethod(
  14016. $core.method({
  14017. selector: "on:",
  14018. protocol: "instance creation",
  14019. fn: function (aCollection){
  14020. var self=this,$self=this;
  14021. return $core.withContext(function($ctx1) {
  14022. var $1;
  14023. $1=$self._new();
  14024. $recv($1)._setCollection_(aCollection);
  14025. $recv($1)._setStreamSize_($recv(aCollection)._size());
  14026. return $recv($1)._yourself();
  14027. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  14028. },
  14029. args: ["aCollection"],
  14030. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  14031. referencedClasses: [],
  14032. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  14033. }),
  14034. $globals.Stream.a$cls);
  14035. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  14036. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  14037. $core.addMethod(
  14038. $core.method({
  14039. selector: "cr",
  14040. protocol: "writing",
  14041. fn: function (){
  14042. var self=this,$self=this;
  14043. return $core.withContext(function($ctx1) {
  14044. return $self._nextPutAll_($recv($globals.String)._cr());
  14045. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  14046. },
  14047. args: [],
  14048. source: "cr\x0a\x09^ self nextPutAll: String cr",
  14049. referencedClasses: ["String"],
  14050. messageSends: ["nextPutAll:", "cr"]
  14051. }),
  14052. $globals.StringStream);
  14053. $core.addMethod(
  14054. $core.method({
  14055. selector: "crlf",
  14056. protocol: "writing",
  14057. fn: function (){
  14058. var self=this,$self=this;
  14059. return $core.withContext(function($ctx1) {
  14060. return $self._nextPutAll_($recv($globals.String)._crlf());
  14061. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  14062. },
  14063. args: [],
  14064. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  14065. referencedClasses: ["String"],
  14066. messageSends: ["nextPutAll:", "crlf"]
  14067. }),
  14068. $globals.StringStream);
  14069. $core.addMethod(
  14070. $core.method({
  14071. selector: "lf",
  14072. protocol: "writing",
  14073. fn: function (){
  14074. var self=this,$self=this;
  14075. return $core.withContext(function($ctx1) {
  14076. return $self._nextPutAll_($recv($globals.String)._lf());
  14077. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  14078. },
  14079. args: [],
  14080. source: "lf\x0a\x09^ self nextPutAll: String lf",
  14081. referencedClasses: ["String"],
  14082. messageSends: ["nextPutAll:", "lf"]
  14083. }),
  14084. $globals.StringStream);
  14085. $core.addMethod(
  14086. $core.method({
  14087. selector: "next:",
  14088. protocol: "reading",
  14089. fn: function (anInteger){
  14090. var self=this,$self=this;
  14091. var tempCollection;
  14092. return $core.withContext(function($ctx1) {
  14093. var $1;
  14094. tempCollection=$recv($recv($self._collection())._class())._new();
  14095. $recv(anInteger)._timesRepeat_((function(){
  14096. return $core.withContext(function($ctx2) {
  14097. $1=$self._atEnd();
  14098. if(!$core.assert($1)){
  14099. tempCollection=$recv(tempCollection).__comma($self._next());
  14100. return tempCollection;
  14101. }
  14102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14103. }));
  14104. return tempCollection;
  14105. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  14106. },
  14107. args: ["anInteger"],
  14108. 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",
  14109. referencedClasses: [],
  14110. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14111. }),
  14112. $globals.StringStream);
  14113. $core.addMethod(
  14114. $core.method({
  14115. selector: "nextPut:",
  14116. protocol: "writing",
  14117. fn: function (aString){
  14118. var self=this,$self=this;
  14119. return $core.withContext(function($ctx1) {
  14120. $self._nextPutAll_(aString);
  14121. return self;
  14122. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  14123. },
  14124. args: ["aString"],
  14125. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14126. referencedClasses: [],
  14127. messageSends: ["nextPutAll:"]
  14128. }),
  14129. $globals.StringStream);
  14130. $core.addMethod(
  14131. $core.method({
  14132. selector: "nextPutAll:",
  14133. protocol: "writing",
  14134. fn: function (aString){
  14135. var self=this,$self=this;
  14136. var pre,post;
  14137. return $core.withContext(function($ctx1) {
  14138. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  14139. $1=$self._atEnd();
  14140. if($core.assert($1)){
  14141. $3=$self._collection();
  14142. $ctx1.sendIdx["collection"]=1;
  14143. $2=$recv($3).__comma(aString);
  14144. $ctx1.sendIdx[","]=1;
  14145. $self._setCollection_($2);
  14146. $ctx1.sendIdx["setCollection:"]=1;
  14147. } else {
  14148. $4=$self._collection();
  14149. $ctx1.sendIdx["collection"]=2;
  14150. $5=$self._position();
  14151. $ctx1.sendIdx["position"]=1;
  14152. pre=$recv($4)._copyFrom_to_((1),$5);
  14153. $ctx1.sendIdx["copyFrom:to:"]=1;
  14154. $6=$self._collection();
  14155. $ctx1.sendIdx["collection"]=3;
  14156. $9=$self._position();
  14157. $ctx1.sendIdx["position"]=2;
  14158. $8=$recv($9).__plus((1));
  14159. $ctx1.sendIdx["+"]=2;
  14160. $10=$recv(aString)._size();
  14161. $ctx1.sendIdx["size"]=1;
  14162. $7=$recv($8).__plus($10);
  14163. $ctx1.sendIdx["+"]=1;
  14164. $11=$recv($self._collection())._size();
  14165. $ctx1.sendIdx["size"]=2;
  14166. post=$recv($6)._copyFrom_to_($7,$11);
  14167. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  14168. $ctx1.sendIdx[","]=2;
  14169. $self._setCollection_($12);
  14170. }
  14171. $14=$self._position();
  14172. $ctx1.sendIdx["position"]=3;
  14173. $13=$recv($14).__plus($recv(aString)._size());
  14174. $self._position_($13);
  14175. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14176. return self;
  14177. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  14178. },
  14179. args: ["aString"],
  14180. 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)",
  14181. referencedClasses: [],
  14182. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  14183. }),
  14184. $globals.StringStream);
  14185. $core.addMethod(
  14186. $core.method({
  14187. selector: "nextPutString:",
  14188. protocol: "writing",
  14189. fn: function (aString){
  14190. var self=this,$self=this;
  14191. return $core.withContext(function($ctx1) {
  14192. $self._nextPutAll_(aString);
  14193. return self;
  14194. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  14195. },
  14196. args: ["aString"],
  14197. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14198. referencedClasses: [],
  14199. messageSends: ["nextPutAll:"]
  14200. }),
  14201. $globals.StringStream);
  14202. $core.addMethod(
  14203. $core.method({
  14204. selector: "print:",
  14205. protocol: "writing",
  14206. fn: function (anObject){
  14207. var self=this,$self=this;
  14208. return $core.withContext(function($ctx1) {
  14209. $recv(anObject)._printOn_(self);
  14210. return self;
  14211. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  14212. },
  14213. args: ["anObject"],
  14214. source: "print: anObject\x0a\x09anObject printOn: self",
  14215. referencedClasses: [],
  14216. messageSends: ["printOn:"]
  14217. }),
  14218. $globals.StringStream);
  14219. $core.addMethod(
  14220. $core.method({
  14221. selector: "printSymbol:",
  14222. protocol: "writing",
  14223. fn: function (anObject){
  14224. var self=this,$self=this;
  14225. return $core.withContext(function($ctx1) {
  14226. $recv(anObject)._asSymbolPrintOn_(self);
  14227. return self;
  14228. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  14229. },
  14230. args: ["anObject"],
  14231. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14232. referencedClasses: [],
  14233. messageSends: ["asSymbolPrintOn:"]
  14234. }),
  14235. $globals.StringStream);
  14236. $core.addMethod(
  14237. $core.method({
  14238. selector: "space",
  14239. protocol: "writing",
  14240. fn: function (){
  14241. var self=this,$self=this;
  14242. return $core.withContext(function($ctx1) {
  14243. $self._nextPut_(" ");
  14244. return self;
  14245. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  14246. },
  14247. args: [],
  14248. source: "space\x0a\x09self nextPut: ' '",
  14249. referencedClasses: [],
  14250. messageSends: ["nextPut:"]
  14251. }),
  14252. $globals.StringStream);
  14253. $core.addMethod(
  14254. $core.method({
  14255. selector: "tab",
  14256. protocol: "writing",
  14257. fn: function (){
  14258. var self=this,$self=this;
  14259. return $core.withContext(function($ctx1) {
  14260. return $self._nextPutAll_($recv($globals.String)._tab());
  14261. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  14262. },
  14263. args: [],
  14264. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14265. referencedClasses: ["String"],
  14266. messageSends: ["nextPutAll:", "tab"]
  14267. }),
  14268. $globals.StringStream);
  14269. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14270. $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.";
  14271. $core.addMethod(
  14272. $core.method({
  14273. selector: "initialize",
  14274. protocol: "initialization",
  14275. fn: function (){
  14276. var self=this,$self=this;
  14277. return $core.withContext(function($ctx1) {
  14278. (
  14279. $ctx1.supercall = true,
  14280. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14281. $ctx1.supercall = false;
  14282. $self["@read"]=$recv($globals.OrderedCollection)._new();
  14283. $ctx1.sendIdx["new"]=1;
  14284. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14285. $self["@readIndex"]=(1);
  14286. return self;
  14287. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  14288. },
  14289. args: [],
  14290. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14291. referencedClasses: ["OrderedCollection"],
  14292. messageSends: ["initialize", "new"]
  14293. }),
  14294. $globals.Queue);
  14295. $core.addMethod(
  14296. $core.method({
  14297. selector: "next",
  14298. protocol: "accessing",
  14299. fn: function (){
  14300. var self=this,$self=this;
  14301. return $core.withContext(function($ctx1) {
  14302. return $self._nextIfAbsent_((function(){
  14303. return $core.withContext(function($ctx2) {
  14304. return $self._error_("Cannot read from empty Queue.");
  14305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14306. }));
  14307. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  14308. },
  14309. args: [],
  14310. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14311. referencedClasses: [],
  14312. messageSends: ["nextIfAbsent:", "error:"]
  14313. }),
  14314. $globals.Queue);
  14315. $core.addMethod(
  14316. $core.method({
  14317. selector: "nextIfAbsent:",
  14318. protocol: "accessing",
  14319. fn: function (aBlock){
  14320. var self=this,$self=this;
  14321. var result;
  14322. return $core.withContext(function($ctx1) {
  14323. var $1;
  14324. var $early={};
  14325. try {
  14326. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  14327. return $core.withContext(function($ctx2) {
  14328. $recv($self["@write"])._ifEmpty_((function(){
  14329. return $core.withContext(function($ctx3) {
  14330. $1=$recv($self["@readIndex"]).__gt((1));
  14331. if($core.assert($1)){
  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["@readIndex"]=(1);
  14341. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14342. return $recv($self["@read"])._first();
  14343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14344. }));
  14345. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  14346. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  14347. return result;
  14348. }
  14349. catch(e) {if(e===$early)return e[0]; throw e}
  14350. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  14351. },
  14352. args: ["aBlock"],
  14353. 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",
  14354. referencedClasses: ["OrderedCollection"],
  14355. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14356. }),
  14357. $globals.Queue);
  14358. $core.addMethod(
  14359. $core.method({
  14360. selector: "nextPut:",
  14361. protocol: "accessing",
  14362. fn: function (anObject){
  14363. var self=this,$self=this;
  14364. return $core.withContext(function($ctx1) {
  14365. $recv($self["@write"])._add_(anObject);
  14366. return self;
  14367. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  14368. },
  14369. args: ["anObject"],
  14370. source: "nextPut: anObject\x0a\x09write add: anObject",
  14371. referencedClasses: [],
  14372. messageSends: ["add:"]
  14373. }),
  14374. $globals.Queue);
  14375. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14376. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14377. $core.addMethod(
  14378. $core.method({
  14379. selector: "compile:",
  14380. protocol: "evaluating",
  14381. fn: function (aString){
  14382. var self=this,$self=this;
  14383. return $core.withContext(function($ctx1) {
  14384. return self.compile(aString);
  14385. return self;
  14386. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  14387. },
  14388. args: ["aString"],
  14389. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14390. referencedClasses: [],
  14391. messageSends: []
  14392. }),
  14393. $globals.RegularExpression);
  14394. $core.addMethod(
  14395. $core.method({
  14396. selector: "exec:",
  14397. protocol: "evaluating",
  14398. fn: function (aString){
  14399. var self=this,$self=this;
  14400. return $core.withContext(function($ctx1) {
  14401. return self.exec(aString) || nil;
  14402. return self;
  14403. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  14404. },
  14405. args: ["aString"],
  14406. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14407. referencedClasses: [],
  14408. messageSends: []
  14409. }),
  14410. $globals.RegularExpression);
  14411. $core.addMethod(
  14412. $core.method({
  14413. selector: "test:",
  14414. protocol: "evaluating",
  14415. fn: function (aString){
  14416. var self=this,$self=this;
  14417. return $core.withContext(function($ctx1) {
  14418. return self.test(aString);
  14419. return self;
  14420. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  14421. },
  14422. args: ["aString"],
  14423. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14424. referencedClasses: [],
  14425. messageSends: []
  14426. }),
  14427. $globals.RegularExpression);
  14428. $core.addMethod(
  14429. $core.method({
  14430. selector: "fromString:",
  14431. protocol: "instance creation",
  14432. fn: function (aString){
  14433. var self=this,$self=this;
  14434. return $core.withContext(function($ctx1) {
  14435. return $self._fromString_flag_(aString,"");
  14436. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  14437. },
  14438. args: ["aString"],
  14439. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14440. referencedClasses: [],
  14441. messageSends: ["fromString:flag:"]
  14442. }),
  14443. $globals.RegularExpression.a$cls);
  14444. $core.addMethod(
  14445. $core.method({
  14446. selector: "fromString:flag:",
  14447. protocol: "instance creation",
  14448. fn: function (aString,anotherString){
  14449. var self=this,$self=this;
  14450. return $core.withContext(function($ctx1) {
  14451. return new RegExp(aString, anotherString);
  14452. return self;
  14453. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  14454. },
  14455. args: ["aString", "anotherString"],
  14456. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14457. referencedClasses: [],
  14458. messageSends: []
  14459. }),
  14460. $globals.RegularExpression.a$cls);
  14461. });
  14462. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14463. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14464. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14465. $core.addPackage("Kernel-Classes");
  14466. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14467. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14468. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14469. $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.";
  14470. $core.addMethod(
  14471. $core.method({
  14472. selector: "allInstanceVariableNames",
  14473. protocol: "accessing",
  14474. fn: function (){
  14475. var self=this,$self=this;
  14476. var result;
  14477. return $core.withContext(function($ctx1) {
  14478. var $1,$receiver;
  14479. result=$recv($self._instanceVariableNames())._copy();
  14480. $1=$self._superclass();
  14481. $ctx1.sendIdx["superclass"]=1;
  14482. if(($receiver = $1) == null || $receiver.a$nil){
  14483. $1;
  14484. } else {
  14485. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14486. }
  14487. return result;
  14488. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14489. },
  14490. args: [],
  14491. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14492. referencedClasses: [],
  14493. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14494. }),
  14495. $globals.Behavior);
  14496. $core.addMethod(
  14497. $core.method({
  14498. selector: "allSelectors",
  14499. protocol: "accessing",
  14500. fn: function (){
  14501. var self=this,$self=this;
  14502. return $core.withContext(function($ctx1) {
  14503. var $1,$2;
  14504. $1=$self._allSuperclasses();
  14505. $2=$self._selectors();
  14506. $ctx1.sendIdx["selectors"]=1;
  14507. return $recv($1)._inject_into_($2,(function(acc,each){
  14508. return $core.withContext(function($ctx2) {
  14509. $recv(acc)._addAll_($recv(each)._selectors());
  14510. return $recv(acc)._yourself();
  14511. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14512. }));
  14513. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14514. },
  14515. args: [],
  14516. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14517. referencedClasses: [],
  14518. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14519. }),
  14520. $globals.Behavior);
  14521. $core.addMethod(
  14522. $core.method({
  14523. selector: "allSubclasses",
  14524. protocol: "accessing",
  14525. fn: function (){
  14526. var self=this,$self=this;
  14527. return $core.withContext(function($ctx1) {
  14528. return $recv($globals.Array)._streamContents_((function(str){
  14529. return $core.withContext(function($ctx2) {
  14530. return $self._allSubclassesDo_((function(each){
  14531. return $core.withContext(function($ctx3) {
  14532. return $recv(str)._nextPut_(each);
  14533. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14534. }));
  14535. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14536. }));
  14537. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14538. },
  14539. args: [],
  14540. 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 ] ]",
  14541. referencedClasses: ["Array"],
  14542. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14543. }),
  14544. $globals.Behavior);
  14545. $core.addMethod(
  14546. $core.method({
  14547. selector: "allSubclassesDo:",
  14548. protocol: "enumerating",
  14549. fn: function (aBlock){
  14550. var self=this,$self=this;
  14551. return $core.withContext(function($ctx1) {
  14552. $core.traverseClassTree(self, function(subclass) {
  14553. if (subclass !== self) aBlock._value_(subclass);
  14554. });
  14555. return self;
  14556. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14557. },
  14558. args: ["aBlock"],
  14559. 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})'>",
  14560. referencedClasses: [],
  14561. messageSends: []
  14562. }),
  14563. $globals.Behavior);
  14564. $core.addMethod(
  14565. $core.method({
  14566. selector: "allSuperclasses",
  14567. protocol: "accessing",
  14568. fn: function (){
  14569. var self=this,$self=this;
  14570. return $core.withContext(function($ctx1) {
  14571. var $1,$3,$2,$receiver;
  14572. $1=$self._superclass();
  14573. $ctx1.sendIdx["superclass"]=1;
  14574. if(($receiver = $1) == null || $receiver.a$nil){
  14575. return [];
  14576. } else {
  14577. $1;
  14578. }
  14579. $3=$self._superclass();
  14580. $ctx1.sendIdx["superclass"]=2;
  14581. $2=$recv($globals.OrderedCollection)._with_($3);
  14582. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14583. return $recv($2)._yourself();
  14584. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14585. },
  14586. args: [],
  14587. 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",
  14588. referencedClasses: ["OrderedCollection"],
  14589. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14590. }),
  14591. $globals.Behavior);
  14592. $core.addMethod(
  14593. $core.method({
  14594. selector: "basicNew",
  14595. protocol: "instance creation",
  14596. fn: function (){
  14597. var self=this,$self=this;
  14598. return $core.withContext(function($ctx1) {
  14599. return new self.fn();
  14600. return self;
  14601. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14602. },
  14603. args: [],
  14604. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14605. referencedClasses: [],
  14606. messageSends: []
  14607. }),
  14608. $globals.Behavior);
  14609. $core.addMethod(
  14610. $core.method({
  14611. selector: "basicOrganization",
  14612. protocol: "accessing",
  14613. fn: function (){
  14614. var self=this,$self=this;
  14615. return $self["@organization"];
  14616. },
  14617. args: [],
  14618. source: "basicOrganization\x0a\x09^ organization",
  14619. referencedClasses: [],
  14620. messageSends: []
  14621. }),
  14622. $globals.Behavior);
  14623. $core.addMethod(
  14624. $core.method({
  14625. selector: "basicOrganization:",
  14626. protocol: "accessing",
  14627. fn: function (aClassOrganizer){
  14628. var self=this,$self=this;
  14629. $self["@organization"]=aClassOrganizer;
  14630. return self;
  14631. },
  14632. args: ["aClassOrganizer"],
  14633. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14634. referencedClasses: [],
  14635. messageSends: []
  14636. }),
  14637. $globals.Behavior);
  14638. $core.addMethod(
  14639. $core.method({
  14640. selector: "canUnderstand:",
  14641. protocol: "testing",
  14642. fn: function (aSelector){
  14643. var self=this,$self=this;
  14644. return $core.withContext(function($ctx1) {
  14645. var $2,$1;
  14646. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14647. return $core.withContext(function($ctx2) {
  14648. $2=$self._superclass();
  14649. $ctx2.sendIdx["superclass"]=1;
  14650. $1=$recv($2)._notNil();
  14651. return $recv($1)._and_((function(){
  14652. return $core.withContext(function($ctx3) {
  14653. return $recv($self._superclass())._canUnderstand_(aSelector);
  14654. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14655. }));
  14656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14657. }));
  14658. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14659. },
  14660. args: ["aSelector"],
  14661. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14662. referencedClasses: [],
  14663. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14664. }),
  14665. $globals.Behavior);
  14666. $core.addMethod(
  14667. $core.method({
  14668. selector: "includesBehavior:",
  14669. protocol: "testing",
  14670. fn: function (aClass){
  14671. var self=this,$self=this;
  14672. return $core.withContext(function($ctx1) {
  14673. return $recv($self.__eq_eq(aClass))._or_((function(){
  14674. return $core.withContext(function($ctx2) {
  14675. return $self._inheritsFrom_(aClass);
  14676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14677. }));
  14678. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14679. },
  14680. args: ["aClass"],
  14681. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14682. referencedClasses: [],
  14683. messageSends: ["or:", "==", "inheritsFrom:"]
  14684. }),
  14685. $globals.Behavior);
  14686. $core.addMethod(
  14687. $core.method({
  14688. selector: "inheritsFrom:",
  14689. protocol: "testing",
  14690. fn: function (aClass){
  14691. var self=this,$self=this;
  14692. return $core.withContext(function($ctx1) {
  14693. var $1,$3,$2,$receiver;
  14694. $1=$self._superclass();
  14695. $ctx1.sendIdx["superclass"]=1;
  14696. if(($receiver = $1) == null || $receiver.a$nil){
  14697. return false;
  14698. } else {
  14699. $1;
  14700. }
  14701. $3=$self._superclass();
  14702. $ctx1.sendIdx["superclass"]=2;
  14703. $2=$recv(aClass).__eq_eq($3);
  14704. return $recv($2)._or_((function(){
  14705. return $core.withContext(function($ctx2) {
  14706. return $recv($self._superclass())._inheritsFrom_(aClass);
  14707. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14708. }));
  14709. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14710. },
  14711. args: ["aClass"],
  14712. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14713. referencedClasses: [],
  14714. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14715. }),
  14716. $globals.Behavior);
  14717. $core.addMethod(
  14718. $core.method({
  14719. selector: "instanceVariableNames",
  14720. protocol: "accessing",
  14721. fn: function (){
  14722. var self=this,$self=this;
  14723. return $core.withContext(function($ctx1) {
  14724. return self.iVarNames;
  14725. return self;
  14726. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14727. },
  14728. args: [],
  14729. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14730. referencedClasses: [],
  14731. messageSends: []
  14732. }),
  14733. $globals.Behavior);
  14734. $core.addMethod(
  14735. $core.method({
  14736. selector: "isBehavior",
  14737. protocol: "testing",
  14738. fn: function (){
  14739. var self=this,$self=this;
  14740. return true;
  14741. },
  14742. args: [],
  14743. source: "isBehavior\x0a\x09^ true",
  14744. referencedClasses: [],
  14745. messageSends: []
  14746. }),
  14747. $globals.Behavior);
  14748. $core.addMethod(
  14749. $core.method({
  14750. selector: "javascriptConstructor",
  14751. protocol: "accessing",
  14752. fn: function (){
  14753. var self=this,$self=this;
  14754. return $core.withContext(function($ctx1) {
  14755. return self.fn;
  14756. return self;
  14757. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14758. },
  14759. args: [],
  14760. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14761. referencedClasses: [],
  14762. messageSends: []
  14763. }),
  14764. $globals.Behavior);
  14765. $core.addMethod(
  14766. $core.method({
  14767. selector: "javascriptConstructor:",
  14768. protocol: "accessing",
  14769. fn: function (aJavaScriptFunction){
  14770. var self=this,$self=this;
  14771. return $core.withContext(function($ctx1) {
  14772. $core.setClassConstructor(self, aJavaScriptFunction);;
  14773. return self;
  14774. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14775. },
  14776. args: ["aJavaScriptFunction"],
  14777. 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);'>",
  14778. referencedClasses: [],
  14779. messageSends: []
  14780. }),
  14781. $globals.Behavior);
  14782. $core.addMethod(
  14783. $core.method({
  14784. selector: "lookupSelector:",
  14785. protocol: "accessing",
  14786. fn: function (selector){
  14787. var self=this,$self=this;
  14788. var lookupClass;
  14789. return $core.withContext(function($ctx1) {
  14790. var $1;
  14791. var $early={};
  14792. try {
  14793. lookupClass=self;
  14794. $recv((function(){
  14795. return $core.withContext(function($ctx2) {
  14796. return $recv(lookupClass).__eq(nil);
  14797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14798. }))._whileFalse_((function(){
  14799. return $core.withContext(function($ctx2) {
  14800. $1=$recv(lookupClass)._includesSelector_(selector);
  14801. if($core.assert($1)){
  14802. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14803. }
  14804. lookupClass=$recv(lookupClass)._superclass();
  14805. return lookupClass;
  14806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14807. }));
  14808. return nil;
  14809. }
  14810. catch(e) {if(e===$early)return e[0]; throw e}
  14811. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14812. },
  14813. args: ["selector"],
  14814. 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",
  14815. referencedClasses: [],
  14816. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14817. }),
  14818. $globals.Behavior);
  14819. $core.addMethod(
  14820. $core.method({
  14821. selector: "new",
  14822. protocol: "instance creation",
  14823. fn: function (){
  14824. var self=this,$self=this;
  14825. return $core.withContext(function($ctx1) {
  14826. return $recv($self._basicNew())._initialize();
  14827. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14828. },
  14829. args: [],
  14830. source: "new\x0a\x09^ self basicNew initialize",
  14831. referencedClasses: [],
  14832. messageSends: ["initialize", "basicNew"]
  14833. }),
  14834. $globals.Behavior);
  14835. $core.addMethod(
  14836. $core.method({
  14837. selector: "prototype",
  14838. protocol: "accessing",
  14839. fn: function (){
  14840. var self=this,$self=this;
  14841. return $core.withContext(function($ctx1) {
  14842. return self.fn.prototype;
  14843. return self;
  14844. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14845. },
  14846. args: [],
  14847. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14848. referencedClasses: [],
  14849. messageSends: []
  14850. }),
  14851. $globals.Behavior);
  14852. $core.addMethod(
  14853. $core.method({
  14854. selector: "subclasses",
  14855. protocol: "accessing",
  14856. fn: function (){
  14857. var self=this,$self=this;
  14858. return $core.withContext(function($ctx1) {
  14859. $self._subclassResponsibility();
  14860. return self;
  14861. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14862. },
  14863. args: [],
  14864. source: "subclasses\x0a\x09self subclassResponsibility",
  14865. referencedClasses: [],
  14866. messageSends: ["subclassResponsibility"]
  14867. }),
  14868. $globals.Behavior);
  14869. $core.addMethod(
  14870. $core.method({
  14871. selector: "superclass",
  14872. protocol: "accessing",
  14873. fn: function (){
  14874. var self=this,$self=this;
  14875. return $core.withContext(function($ctx1) {
  14876. return self.superclass;
  14877. return self;
  14878. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14879. },
  14880. args: [],
  14881. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14882. referencedClasses: [],
  14883. messageSends: []
  14884. }),
  14885. $globals.Behavior);
  14886. $core.addMethod(
  14887. $core.method({
  14888. selector: "theMetaClass",
  14889. protocol: "accessing",
  14890. fn: function (){
  14891. var self=this,$self=this;
  14892. return $core.withContext(function($ctx1) {
  14893. $self._subclassResponsibility();
  14894. return self;
  14895. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14896. },
  14897. args: [],
  14898. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14899. referencedClasses: [],
  14900. messageSends: ["subclassResponsibility"]
  14901. }),
  14902. $globals.Behavior);
  14903. $core.addMethod(
  14904. $core.method({
  14905. selector: "theNonMetaClass",
  14906. protocol: "accessing",
  14907. fn: function (){
  14908. var self=this,$self=this;
  14909. return $core.withContext(function($ctx1) {
  14910. $self._subclassResponsibility();
  14911. return self;
  14912. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14913. },
  14914. args: [],
  14915. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14916. referencedClasses: [],
  14917. messageSends: ["subclassResponsibility"]
  14918. }),
  14919. $globals.Behavior);
  14920. $core.addMethod(
  14921. $core.method({
  14922. selector: "withAllSubclasses",
  14923. protocol: "accessing",
  14924. fn: function (){
  14925. var self=this,$self=this;
  14926. return $core.withContext(function($ctx1) {
  14927. var $1;
  14928. $1=$recv($globals.Array)._with_(self);
  14929. $recv($1)._addAll_($self._allSubclasses());
  14930. return $recv($1)._yourself();
  14931. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14932. },
  14933. args: [],
  14934. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14935. referencedClasses: ["Array"],
  14936. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14937. }),
  14938. $globals.Behavior);
  14939. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14940. $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.";
  14941. $core.addMethod(
  14942. $core.method({
  14943. selector: "basicPackage:",
  14944. protocol: "accessing",
  14945. fn: function (aPackage){
  14946. var self=this,$self=this;
  14947. $self["@package"]=aPackage;
  14948. return self;
  14949. },
  14950. args: ["aPackage"],
  14951. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14952. referencedClasses: [],
  14953. messageSends: []
  14954. }),
  14955. $globals.Class);
  14956. $core.addMethod(
  14957. $core.method({
  14958. selector: "classTag",
  14959. protocol: "accessing",
  14960. fn: function (){
  14961. var self=this,$self=this;
  14962. return "class";
  14963. },
  14964. args: [],
  14965. 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'",
  14966. referencedClasses: [],
  14967. messageSends: []
  14968. }),
  14969. $globals.Class);
  14970. $core.addMethod(
  14971. $core.method({
  14972. selector: "definition",
  14973. protocol: "accessing",
  14974. fn: function (){
  14975. var self=this,$self=this;
  14976. return $core.withContext(function($ctx1) {
  14977. var $1,$2;
  14978. return $recv($globals.String)._streamContents_((function(stream){
  14979. return $core.withContext(function($ctx2) {
  14980. $recv(stream)._print_($self._superclass());
  14981. $ctx2.sendIdx["print:"]=1;
  14982. $recv(stream)._write_(" subclass: ");
  14983. $ctx2.sendIdx["write:"]=1;
  14984. $recv(stream)._printSymbol_($self._name());
  14985. $recv(stream)._lf();
  14986. $ctx2.sendIdx["lf"]=1;
  14987. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14988. return $core.withContext(function($ctx3) {
  14989. $1=$recv($globals.String)._tab();
  14990. $ctx3.sendIdx["tab"]=1;
  14991. $2=$recv($globals.String)._lf();
  14992. $ctx3.sendIdx["lf"]=2;
  14993. return [$1,"uses: ",tcd,$2];
  14994. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14995. })));
  14996. $ctx2.sendIdx["write:"]=2;
  14997. $recv(stream)._tab();
  14998. $ctx2.sendIdx["tab"]=2;
  14999. $recv(stream)._write_("instanceVariableNames: ");
  15000. $ctx2.sendIdx["write:"]=3;
  15001. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15002. $ctx2.sendIdx["print:"]=2;
  15003. $recv(stream)._lf();
  15004. $recv(stream)._tab();
  15005. $recv(stream)._write_("package: ");
  15006. return $recv(stream)._print_($self._category());
  15007. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15008. }));
  15009. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  15010. },
  15011. args: [],
  15012. 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 ]",
  15013. referencedClasses: ["String"],
  15014. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  15015. }),
  15016. $globals.Class);
  15017. $core.addMethod(
  15018. $core.method({
  15019. selector: "isClass",
  15020. protocol: "testing",
  15021. fn: function (){
  15022. var self=this,$self=this;
  15023. return true;
  15024. },
  15025. args: [],
  15026. source: "isClass\x0a\x09^ true",
  15027. referencedClasses: [],
  15028. messageSends: []
  15029. }),
  15030. $globals.Class);
  15031. $core.addMethod(
  15032. $core.method({
  15033. selector: "package",
  15034. protocol: "accessing",
  15035. fn: function (){
  15036. var self=this,$self=this;
  15037. return $self["@package"];
  15038. },
  15039. args: [],
  15040. source: "package\x0a\x09^ package",
  15041. referencedClasses: [],
  15042. messageSends: []
  15043. }),
  15044. $globals.Class);
  15045. $core.addMethod(
  15046. $core.method({
  15047. selector: "provided",
  15048. protocol: "converting",
  15049. fn: function (){
  15050. var self=this,$self=this;
  15051. return $core.withContext(function($ctx1) {
  15052. return $recv($self._javascriptConstructor())._provided();
  15053. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.Class)});
  15054. },
  15055. args: [],
  15056. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javascriptConstructor provided",
  15057. referencedClasses: [],
  15058. messageSends: ["provided", "javascriptConstructor"]
  15059. }),
  15060. $globals.Class);
  15061. $core.addMethod(
  15062. $core.method({
  15063. selector: "rename:",
  15064. protocol: "accessing",
  15065. fn: function (aString){
  15066. var self=this,$self=this;
  15067. return $core.withContext(function($ctx1) {
  15068. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15069. return self;
  15070. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  15071. },
  15072. args: ["aString"],
  15073. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15074. referencedClasses: ["ClassBuilder"],
  15075. messageSends: ["renameClass:to:", "new"]
  15076. }),
  15077. $globals.Class);
  15078. $core.addMethod(
  15079. $core.method({
  15080. selector: "subclasses",
  15081. protocol: "accessing",
  15082. fn: function (){
  15083. var self=this,$self=this;
  15084. return $core.withContext(function($ctx1) {
  15085. return self.subclasses._copy();
  15086. return self;
  15087. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  15088. },
  15089. args: [],
  15090. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  15091. referencedClasses: [],
  15092. messageSends: []
  15093. }),
  15094. $globals.Class);
  15095. $core.addMethod(
  15096. $core.method({
  15097. selector: "theMetaClass",
  15098. protocol: "accessing",
  15099. fn: function (){
  15100. var self=this,$self=this;
  15101. return $core.withContext(function($ctx1) {
  15102. return $self._class();
  15103. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  15104. },
  15105. args: [],
  15106. source: "theMetaClass\x0a\x09^ self class",
  15107. referencedClasses: [],
  15108. messageSends: ["class"]
  15109. }),
  15110. $globals.Class);
  15111. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  15112. $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.";
  15113. $core.addMethod(
  15114. $core.method({
  15115. selector: "asJavaScriptSource",
  15116. protocol: "converting",
  15117. fn: function (){
  15118. var self=this,$self=this;
  15119. return $core.withContext(function($ctx1) {
  15120. var $1;
  15121. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15122. $ctx1.sendIdx[","]=1;
  15123. return $1;
  15124. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15125. },
  15126. args: [],
  15127. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15128. referencedClasses: [],
  15129. messageSends: [",", "name", "instanceClass"]
  15130. }),
  15131. $globals.Metaclass);
  15132. $core.addMethod(
  15133. $core.method({
  15134. selector: "definition",
  15135. protocol: "accessing",
  15136. fn: function (){
  15137. var self=this,$self=this;
  15138. return $core.withContext(function($ctx1) {
  15139. var $1,$2;
  15140. return $recv($globals.String)._streamContents_((function(stream){
  15141. return $core.withContext(function($ctx2) {
  15142. $recv(stream)._print_(self);
  15143. $ctx2.sendIdx["print:"]=1;
  15144. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15145. return " ";
  15146. }),(function(tcd){
  15147. return $core.withContext(function($ctx3) {
  15148. $1=$recv($globals.String)._lf();
  15149. $ctx3.sendIdx["lf"]=1;
  15150. $2=$recv($globals.String)._tab();
  15151. $ctx3.sendIdx["tab"]=1;
  15152. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15153. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15154. })));
  15155. $ctx2.sendIdx["write:"]=1;
  15156. $recv(stream)._write_("instanceVariableNames: ");
  15157. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15158. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15159. }));
  15160. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15161. },
  15162. args: [],
  15163. 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) ]",
  15164. referencedClasses: ["String"],
  15165. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15166. }),
  15167. $globals.Metaclass);
  15168. $core.addMethod(
  15169. $core.method({
  15170. selector: "instanceClass",
  15171. protocol: "accessing",
  15172. fn: function (){
  15173. var self=this,$self=this;
  15174. return $core.withContext(function($ctx1) {
  15175. return self.instanceClass;
  15176. return self;
  15177. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15178. },
  15179. args: [],
  15180. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15181. referencedClasses: [],
  15182. messageSends: []
  15183. }),
  15184. $globals.Metaclass);
  15185. $core.addMethod(
  15186. $core.method({
  15187. selector: "instanceVariableNames:",
  15188. protocol: "accessing",
  15189. fn: function (aCollection){
  15190. var self=this,$self=this;
  15191. return $core.withContext(function($ctx1) {
  15192. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15193. return self;
  15194. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15195. },
  15196. args: ["aCollection"],
  15197. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15198. referencedClasses: ["ClassBuilder"],
  15199. messageSends: ["class:instanceVariableNames:", "new"]
  15200. }),
  15201. $globals.Metaclass);
  15202. $core.addMethod(
  15203. $core.method({
  15204. selector: "isMetaclass",
  15205. protocol: "testing",
  15206. fn: function (){
  15207. var self=this,$self=this;
  15208. return true;
  15209. },
  15210. args: [],
  15211. source: "isMetaclass\x0a\x09^ true",
  15212. referencedClasses: [],
  15213. messageSends: []
  15214. }),
  15215. $globals.Metaclass);
  15216. $core.addMethod(
  15217. $core.method({
  15218. selector: "name",
  15219. protocol: "accessing",
  15220. fn: function (){
  15221. var self=this,$self=this;
  15222. return $core.withContext(function($ctx1) {
  15223. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15224. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15225. },
  15226. args: [],
  15227. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15228. referencedClasses: [],
  15229. messageSends: [",", "name", "instanceClass"]
  15230. }),
  15231. $globals.Metaclass);
  15232. $core.addMethod(
  15233. $core.method({
  15234. selector: "package",
  15235. protocol: "accessing",
  15236. fn: function (){
  15237. var self=this,$self=this;
  15238. return $core.withContext(function($ctx1) {
  15239. return $recv($self._instanceClass())._package();
  15240. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15241. },
  15242. args: [],
  15243. source: "package\x0a\x09^ self instanceClass package",
  15244. referencedClasses: [],
  15245. messageSends: ["package", "instanceClass"]
  15246. }),
  15247. $globals.Metaclass);
  15248. $core.addMethod(
  15249. $core.method({
  15250. selector: "subclasses",
  15251. protocol: "accessing",
  15252. fn: function (){
  15253. var self=this,$self=this;
  15254. return $core.withContext(function($ctx1) {
  15255. return $core.metaSubclasses(self);
  15256. return self;
  15257. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15258. },
  15259. args: [],
  15260. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15261. referencedClasses: [],
  15262. messageSends: []
  15263. }),
  15264. $globals.Metaclass);
  15265. $core.addMethod(
  15266. $core.method({
  15267. selector: "theMetaClass",
  15268. protocol: "accessing",
  15269. fn: function (){
  15270. var self=this,$self=this;
  15271. return self;
  15272. },
  15273. args: [],
  15274. source: "theMetaClass\x0a\x09^ self",
  15275. referencedClasses: [],
  15276. messageSends: []
  15277. }),
  15278. $globals.Metaclass);
  15279. $core.addMethod(
  15280. $core.method({
  15281. selector: "theNonMetaClass",
  15282. protocol: "accessing",
  15283. fn: function (){
  15284. var self=this,$self=this;
  15285. return $core.withContext(function($ctx1) {
  15286. return $self._instanceClass();
  15287. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15288. },
  15289. args: [],
  15290. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15291. referencedClasses: [],
  15292. messageSends: ["instanceClass"]
  15293. }),
  15294. $globals.Metaclass);
  15295. $core.addMethod(
  15296. $core.method({
  15297. selector: "uses:instanceVariableNames:",
  15298. protocol: "accessing",
  15299. fn: function (aTraitCompositionDescription,aCollection){
  15300. var self=this,$self=this;
  15301. var metaclass;
  15302. return $core.withContext(function($ctx1) {
  15303. metaclass=$self._instanceVariableNames_(aCollection);
  15304. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15305. return metaclass;
  15306. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15307. },
  15308. args: ["aTraitCompositionDescription", "aCollection"],
  15309. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15310. referencedClasses: [],
  15311. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15312. }),
  15313. $globals.Metaclass);
  15314. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15315. $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:`.";
  15316. $core.addMethod(
  15317. $core.method({
  15318. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15319. protocol: "class definition",
  15320. fn: function (aClass,className,aCollection,packageName){
  15321. var self=this,$self=this;
  15322. var theClass,thePackage;
  15323. return $core.withContext(function($ctx1) {
  15324. var $1,$2,$3,$receiver;
  15325. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15326. thePackage=$recv($globals.Package)._named_(packageName);
  15327. $1=theClass;
  15328. if(($receiver = $1) == null || $receiver.a$nil){
  15329. $1;
  15330. } else {
  15331. $recv(theClass)._package_(thePackage);
  15332. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15333. if(!$core.assert($2)){
  15334. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15335. }
  15336. }
  15337. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15338. $recv($3)._recompile();
  15339. return $recv($3)._yourself();
  15340. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15341. },
  15342. args: ["aClass", "className", "aCollection", "packageName"],
  15343. 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",
  15344. referencedClasses: ["Smalltalk", "Package"],
  15345. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15346. }),
  15347. $globals.ClassBuilder);
  15348. $core.addMethod(
  15349. $core.method({
  15350. selector: "addTraitNamed:package:",
  15351. protocol: "class definition",
  15352. fn: function (traitName,packageName){
  15353. var self=this,$self=this;
  15354. var theTrait,thePackage;
  15355. return $core.withContext(function($ctx1) {
  15356. var $1,$2,$receiver;
  15357. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15358. thePackage=$recv($globals.Package)._named_(packageName);
  15359. $1=theTrait;
  15360. if(($receiver = $1) == null || $receiver.a$nil){
  15361. $1;
  15362. } else {
  15363. $2=theTrait;
  15364. $recv($2)._package_(thePackage);
  15365. $recv($2)._recompile();
  15366. return $recv($2)._yourself();
  15367. }
  15368. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15369. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15370. },
  15371. args: ["traitName", "packageName"],
  15372. 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",
  15373. referencedClasses: ["Smalltalk", "Package"],
  15374. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15375. }),
  15376. $globals.ClassBuilder);
  15377. $core.addMethod(
  15378. $core.method({
  15379. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15380. protocol: "private",
  15381. fn: function (aClass,aString,aCollection,packageName){
  15382. var self=this,$self=this;
  15383. return $core.withContext(function($ctx1) {
  15384. return $core.addClass(aString, aClass, aCollection, packageName);
  15385. ;
  15386. return self;
  15387. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15388. },
  15389. args: ["aClass", "aString", "aCollection", "packageName"],
  15390. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15391. referencedClasses: [],
  15392. messageSends: []
  15393. }),
  15394. $globals.ClassBuilder);
  15395. $core.addMethod(
  15396. $core.method({
  15397. selector: "basicAddTraitNamed:package:",
  15398. protocol: "private",
  15399. fn: function (aString,anotherString){
  15400. var self=this,$self=this;
  15401. return $core.withContext(function($ctx1) {
  15402. return $core.addTrait(aString, anotherString);
  15403. return self;
  15404. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15405. },
  15406. args: ["aString", "anotherString"],
  15407. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15408. referencedClasses: [],
  15409. messageSends: []
  15410. }),
  15411. $globals.ClassBuilder);
  15412. $core.addMethod(
  15413. $core.method({
  15414. selector: "basicClass:instanceVariables:",
  15415. protocol: "private",
  15416. fn: function (aClass,aCollection){
  15417. var self=this,$self=this;
  15418. return $core.withContext(function($ctx1) {
  15419. var $1;
  15420. $1=$recv(aClass)._isMetaclass();
  15421. if(!$core.assert($1)){
  15422. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15423. }
  15424. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15425. return self;
  15426. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15427. },
  15428. args: ["aClass", "aCollection"],
  15429. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15430. referencedClasses: [],
  15431. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15432. }),
  15433. $globals.ClassBuilder);
  15434. $core.addMethod(
  15435. $core.method({
  15436. selector: "basicRemoveClass:",
  15437. protocol: "private",
  15438. fn: function (aClass){
  15439. var self=this,$self=this;
  15440. return $core.withContext(function($ctx1) {
  15441. $core.removeClass(aClass);
  15442. return self;
  15443. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15444. },
  15445. args: ["aClass"],
  15446. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15447. referencedClasses: [],
  15448. messageSends: []
  15449. }),
  15450. $globals.ClassBuilder);
  15451. $core.addMethod(
  15452. $core.method({
  15453. selector: "basicRenameClass:to:",
  15454. protocol: "private",
  15455. fn: function (aClass,aString){
  15456. var self=this,$self=this;
  15457. return $core.withContext(function($ctx1) {
  15458. $globals[aString] = aClass;
  15459. delete $globals[aClass.name];
  15460. aClass.name = aString;
  15461. ;
  15462. return self;
  15463. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15464. },
  15465. args: ["aClass", "aString"],
  15466. 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'>",
  15467. referencedClasses: [],
  15468. messageSends: []
  15469. }),
  15470. $globals.ClassBuilder);
  15471. $core.addMethod(
  15472. $core.method({
  15473. selector: "basicSwapClassNames:with:",
  15474. protocol: "private",
  15475. fn: function (aClass,anotherClass){
  15476. var self=this,$self=this;
  15477. return $core.withContext(function($ctx1) {
  15478. var tmp = aClass.name;
  15479. aClass.name = anotherClass.name;
  15480. anotherClass.name = tmp;
  15481. ;
  15482. return self;
  15483. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15484. },
  15485. args: ["aClass", "anotherClass"],
  15486. 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'>",
  15487. referencedClasses: [],
  15488. messageSends: []
  15489. }),
  15490. $globals.ClassBuilder);
  15491. $core.addMethod(
  15492. $core.method({
  15493. selector: "class:instanceVariableNames:",
  15494. protocol: "class definition",
  15495. fn: function (aClass,ivarNames){
  15496. var self=this,$self=this;
  15497. return $core.withContext(function($ctx1) {
  15498. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15499. return self;
  15500. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15501. },
  15502. args: ["aClass", "ivarNames"],
  15503. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15504. referencedClasses: [],
  15505. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15506. }),
  15507. $globals.ClassBuilder);
  15508. $core.addMethod(
  15509. $core.method({
  15510. selector: "class:instanceVariables:",
  15511. protocol: "class definition",
  15512. fn: function (aClass,aCollection){
  15513. var self=this,$self=this;
  15514. return $core.withContext(function($ctx1) {
  15515. var $1,$3,$2;
  15516. $self._basicClass_instanceVariables_(aClass,aCollection);
  15517. $1=$recv($globals.SystemAnnouncer)._current();
  15518. $3=$recv($globals.ClassDefinitionChanged)._new();
  15519. $recv($3)._theClass_(aClass);
  15520. $2=$recv($3)._yourself();
  15521. $recv($1)._announce_($2);
  15522. return self;
  15523. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15524. },
  15525. args: ["aClass", "aCollection"],
  15526. 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)",
  15527. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15528. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15529. }),
  15530. $globals.ClassBuilder);
  15531. $core.addMethod(
  15532. $core.method({
  15533. selector: "copyClass:named:",
  15534. protocol: "copying",
  15535. fn: function (aClass,className){
  15536. var self=this,$self=this;
  15537. var newClass;
  15538. return $core.withContext(function($ctx1) {
  15539. var $1,$3,$2;
  15540. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15541. $self._copyClass_to_(aClass,newClass);
  15542. $1=$recv($globals.SystemAnnouncer)._current();
  15543. $3=$recv($globals.ClassAdded)._new();
  15544. $recv($3)._theClass_(newClass);
  15545. $2=$recv($3)._yourself();
  15546. $recv($1)._announce_($2);
  15547. return newClass;
  15548. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15549. },
  15550. args: ["aClass", "className"],
  15551. 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",
  15552. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15553. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15554. }),
  15555. $globals.ClassBuilder);
  15556. $core.addMethod(
  15557. $core.method({
  15558. selector: "copyClass:to:",
  15559. protocol: "copying",
  15560. fn: function (aClass,anotherClass){
  15561. var self=this,$self=this;
  15562. return $core.withContext(function($ctx1) {
  15563. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15564. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15565. $1=$recv(aClass)._methodDictionary();
  15566. $ctx1.sendIdx["methodDictionary"]=1;
  15567. $recv($1)._valuesDo_((function(each){
  15568. return $core.withContext(function($ctx2) {
  15569. $3=$recv(each)._methodClass();
  15570. $ctx2.sendIdx["methodClass"]=1;
  15571. $2=$recv($3).__eq(aClass);
  15572. $ctx2.sendIdx["="]=1;
  15573. if($core.assert($2)){
  15574. $4=$recv($globals.Compiler)._new();
  15575. $ctx2.sendIdx["new"]=1;
  15576. $5=$recv(each)._source();
  15577. $ctx2.sendIdx["source"]=1;
  15578. $6=$recv(each)._protocol();
  15579. $ctx2.sendIdx["protocol"]=1;
  15580. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15581. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15582. }
  15583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15584. }));
  15585. $ctx1.sendIdx["valuesDo:"]=1;
  15586. $7=$recv(aClass)._traitComposition();
  15587. $ctx1.sendIdx["traitComposition"]=1;
  15588. $recv(anotherClass)._setTraitComposition_($7);
  15589. $ctx1.sendIdx["setTraitComposition:"]=1;
  15590. $8=$recv(anotherClass)._class();
  15591. $ctx1.sendIdx["class"]=1;
  15592. $10=$recv(aClass)._class();
  15593. $ctx1.sendIdx["class"]=2;
  15594. $9=$recv($10)._instanceVariableNames();
  15595. $self._basicClass_instanceVariables_($8,$9);
  15596. $12=$recv(aClass)._class();
  15597. $ctx1.sendIdx["class"]=3;
  15598. $11=$recv($12)._methodDictionary();
  15599. $recv($11)._valuesDo_((function(each){
  15600. return $core.withContext(function($ctx2) {
  15601. $14=$recv(each)._methodClass();
  15602. $15=$recv(aClass)._class();
  15603. $ctx2.sendIdx["class"]=4;
  15604. $13=$recv($14).__eq($15);
  15605. if($core.assert($13)){
  15606. $16=$recv($globals.Compiler)._new();
  15607. $17=$recv(each)._source();
  15608. $18=$recv(anotherClass)._class();
  15609. $ctx2.sendIdx["class"]=5;
  15610. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15611. }
  15612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15613. }));
  15614. $19=$recv(anotherClass)._class();
  15615. $ctx1.sendIdx["class"]=6;
  15616. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15617. return self;
  15618. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15619. },
  15620. args: ["aClass", "anotherClass"],
  15621. 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",
  15622. referencedClasses: ["Compiler"],
  15623. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15624. }),
  15625. $globals.ClassBuilder);
  15626. $core.addMethod(
  15627. $core.method({
  15628. selector: "installMethod:forClass:protocol:",
  15629. protocol: "method definition",
  15630. fn: function (aCompiledMethod,aBehavior,aString){
  15631. var self=this,$self=this;
  15632. return $core.withContext(function($ctx1) {
  15633. $recv(aCompiledMethod)._protocol_(aString);
  15634. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15635. return aCompiledMethod;
  15636. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15637. },
  15638. args: ["aCompiledMethod", "aBehavior", "aString"],
  15639. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15640. referencedClasses: [],
  15641. messageSends: ["protocol:", "addCompiledMethod:"]
  15642. }),
  15643. $globals.ClassBuilder);
  15644. $core.addMethod(
  15645. $core.method({
  15646. selector: "instanceVariableNamesFor:",
  15647. protocol: "accessing",
  15648. fn: function (aString){
  15649. var self=this,$self=this;
  15650. return $core.withContext(function($ctx1) {
  15651. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15652. return $core.withContext(function($ctx2) {
  15653. return $recv(each)._isEmpty();
  15654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15655. }));
  15656. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15657. },
  15658. args: ["aString"],
  15659. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15660. referencedClasses: [],
  15661. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15662. }),
  15663. $globals.ClassBuilder);
  15664. $core.addMethod(
  15665. $core.method({
  15666. selector: "migrateClass:superclass:",
  15667. protocol: "class migration",
  15668. fn: function (aClass,anotherClass){
  15669. var self=this,$self=this;
  15670. return $core.withContext(function($ctx1) {
  15671. var $1;
  15672. $1=$recv(aClass)._name();
  15673. $ctx1.sendIdx["name"]=1;
  15674. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15675. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15676. },
  15677. args: ["aClass", "anotherClass"],
  15678. 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",
  15679. referencedClasses: [],
  15680. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15681. }),
  15682. $globals.ClassBuilder);
  15683. $core.addMethod(
  15684. $core.method({
  15685. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15686. protocol: "class migration",
  15687. fn: function (className,aClass,aCollection,packageName){
  15688. var self=this,$self=this;
  15689. var oldClass,newClass,tmp;
  15690. return $core.withContext(function($ctx1) {
  15691. var $1,$2,$4,$3;
  15692. tmp="new*".__comma(className);
  15693. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15694. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15695. $self._basicSwapClassNames_with_(oldClass,newClass);
  15696. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15697. $recv((function(){
  15698. return $core.withContext(function($ctx2) {
  15699. return $self._copyClass_to_(oldClass,newClass);
  15700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15701. }))._on_do_($globals.Error,(function(exception){
  15702. return $core.withContext(function($ctx2) {
  15703. $self._basicSwapClassNames_with_(oldClass,newClass);
  15704. $1=$self._basicRemoveClass_(newClass);
  15705. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15706. return $recv(exception)._pass();
  15707. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15708. }));
  15709. $self._rawRenameClass_to_(oldClass,tmp);
  15710. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15711. $self._rawRenameClass_to_(newClass,className);
  15712. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15713. return $core.withContext(function($ctx2) {
  15714. return $self._migrateClass_superclass_(each,newClass);
  15715. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15716. }));
  15717. $self._basicRemoveClass_(oldClass);
  15718. $2=$recv($globals.SystemAnnouncer)._current();
  15719. $4=$recv($globals.ClassMigrated)._new();
  15720. $recv($4)._theClass_(newClass);
  15721. $recv($4)._oldClass_(oldClass);
  15722. $3=$recv($4)._yourself();
  15723. $recv($2)._announce_($3);
  15724. return newClass;
  15725. }, 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)});
  15726. },
  15727. args: ["className", "aClass", "aCollection", "packageName"],
  15728. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception pass ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15729. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15730. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15731. }),
  15732. $globals.ClassBuilder);
  15733. $core.addMethod(
  15734. $core.method({
  15735. selector: "rawRenameClass:to:",
  15736. protocol: "private",
  15737. fn: function (aClass,aString){
  15738. var self=this,$self=this;
  15739. return $core.withContext(function($ctx1) {
  15740. $globals[aString] = aClass;
  15741. ;
  15742. return self;
  15743. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15744. },
  15745. args: ["aClass", "aString"],
  15746. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15747. referencedClasses: [],
  15748. messageSends: []
  15749. }),
  15750. $globals.ClassBuilder);
  15751. $core.addMethod(
  15752. $core.method({
  15753. selector: "renameClass:to:",
  15754. protocol: "class migration",
  15755. fn: function (aClass,className){
  15756. var self=this,$self=this;
  15757. return $core.withContext(function($ctx1) {
  15758. var $1,$3,$2;
  15759. $self._basicRenameClass_to_(aClass,className);
  15760. $recv(aClass)._recompile();
  15761. $1=$recv($globals.SystemAnnouncer)._current();
  15762. $3=$recv($globals.ClassRenamed)._new();
  15763. $recv($3)._theClass_(aClass);
  15764. $2=$recv($3)._yourself();
  15765. $recv($1)._announce_($2);
  15766. return self;
  15767. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15768. },
  15769. args: ["aClass", "className"],
  15770. 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)",
  15771. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15772. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15773. }),
  15774. $globals.ClassBuilder);
  15775. $core.addMethod(
  15776. $core.method({
  15777. selector: "superclass:subclass:",
  15778. protocol: "class definition",
  15779. fn: function (aClass,className){
  15780. var self=this,$self=this;
  15781. return $core.withContext(function($ctx1) {
  15782. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15783. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15784. },
  15785. args: ["aClass", "className"],
  15786. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15787. referencedClasses: [],
  15788. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15789. }),
  15790. $globals.ClassBuilder);
  15791. $core.addMethod(
  15792. $core.method({
  15793. selector: "superclass:subclass:instanceVariableNames:package:",
  15794. protocol: "class definition",
  15795. fn: function (aClass,className,ivarNames,packageName){
  15796. var self=this,$self=this;
  15797. var newClass;
  15798. return $core.withContext(function($ctx1) {
  15799. var $1,$2,$3,$5,$4,$receiver;
  15800. $1=$self._instanceVariableNamesFor_(ivarNames);
  15801. if(($receiver = packageName) == null || $receiver.a$nil){
  15802. $2="unclassified";
  15803. } else {
  15804. $2=packageName;
  15805. }
  15806. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15807. $3=$recv($globals.SystemAnnouncer)._current();
  15808. $5=$recv($globals.ClassAdded)._new();
  15809. $recv($5)._theClass_(newClass);
  15810. $4=$recv($5)._yourself();
  15811. $recv($3)._announce_($4);
  15812. return newClass;
  15813. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15814. },
  15815. args: ["aClass", "className", "ivarNames", "packageName"],
  15816. 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",
  15817. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15818. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15819. }),
  15820. $globals.ClassBuilder);
  15821. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15822. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15823. $core.addMethod(
  15824. $core.method({
  15825. selector: "getNodesFrom:",
  15826. protocol: "accessing",
  15827. fn: function (aCollection){
  15828. var self=this,$self=this;
  15829. var children,others;
  15830. return $core.withContext(function($ctx1) {
  15831. var $1;
  15832. children=[];
  15833. others=[];
  15834. $recv(aCollection)._do_((function(each){
  15835. return $core.withContext(function($ctx2) {
  15836. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15837. if($core.assert($1)){
  15838. return $recv(children)._add_(each);
  15839. $ctx2.sendIdx["add:"]=1;
  15840. } else {
  15841. return $recv(others)._add_(each);
  15842. }
  15843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15844. }));
  15845. $self["@nodes"]=$recv(children)._collect_((function(each){
  15846. return $core.withContext(function($ctx2) {
  15847. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15848. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15849. }));
  15850. return self;
  15851. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15852. },
  15853. args: ["aCollection"],
  15854. 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 ]",
  15855. referencedClasses: ["ClassSorterNode"],
  15856. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15857. }),
  15858. $globals.ClassSorterNode);
  15859. $core.addMethod(
  15860. $core.method({
  15861. selector: "level",
  15862. protocol: "accessing",
  15863. fn: function (){
  15864. var self=this,$self=this;
  15865. return $self["@level"];
  15866. },
  15867. args: [],
  15868. source: "level\x0a\x09^ level",
  15869. referencedClasses: [],
  15870. messageSends: []
  15871. }),
  15872. $globals.ClassSorterNode);
  15873. $core.addMethod(
  15874. $core.method({
  15875. selector: "level:",
  15876. protocol: "accessing",
  15877. fn: function (anInteger){
  15878. var self=this,$self=this;
  15879. $self["@level"]=anInteger;
  15880. return self;
  15881. },
  15882. args: ["anInteger"],
  15883. source: "level: anInteger\x0a\x09level := anInteger",
  15884. referencedClasses: [],
  15885. messageSends: []
  15886. }),
  15887. $globals.ClassSorterNode);
  15888. $core.addMethod(
  15889. $core.method({
  15890. selector: "nodes",
  15891. protocol: "accessing",
  15892. fn: function (){
  15893. var self=this,$self=this;
  15894. return $self["@nodes"];
  15895. },
  15896. args: [],
  15897. source: "nodes\x0a\x09^ nodes",
  15898. referencedClasses: [],
  15899. messageSends: []
  15900. }),
  15901. $globals.ClassSorterNode);
  15902. $core.addMethod(
  15903. $core.method({
  15904. selector: "theClass",
  15905. protocol: "accessing",
  15906. fn: function (){
  15907. var self=this,$self=this;
  15908. return $self["@theClass"];
  15909. },
  15910. args: [],
  15911. source: "theClass\x0a\x09^ theClass",
  15912. referencedClasses: [],
  15913. messageSends: []
  15914. }),
  15915. $globals.ClassSorterNode);
  15916. $core.addMethod(
  15917. $core.method({
  15918. selector: "theClass:",
  15919. protocol: "accessing",
  15920. fn: function (aClass){
  15921. var self=this,$self=this;
  15922. $self["@theClass"]=aClass;
  15923. return self;
  15924. },
  15925. args: ["aClass"],
  15926. source: "theClass: aClass\x0a\x09theClass := aClass",
  15927. referencedClasses: [],
  15928. messageSends: []
  15929. }),
  15930. $globals.ClassSorterNode);
  15931. $core.addMethod(
  15932. $core.method({
  15933. selector: "traverseClassesWith:",
  15934. protocol: "visiting",
  15935. fn: function (aCollection){
  15936. var self=this,$self=this;
  15937. return $core.withContext(function($ctx1) {
  15938. var $1,$3,$2;
  15939. $1=$self._theClass();
  15940. $ctx1.sendIdx["theClass"]=1;
  15941. $recv(aCollection)._add_($1);
  15942. $recv($recv($self._nodes())._sorted_((function(a,b){
  15943. return $core.withContext(function($ctx2) {
  15944. $3=$recv(a)._theClass();
  15945. $ctx2.sendIdx["theClass"]=2;
  15946. $2=$recv($3)._name();
  15947. $ctx2.sendIdx["name"]=1;
  15948. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15949. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15950. })))._do_((function(aNode){
  15951. return $core.withContext(function($ctx2) {
  15952. return $recv(aNode)._traverseClassesWith_(aCollection);
  15953. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15954. }));
  15955. return self;
  15956. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15957. },
  15958. args: ["aCollection"],
  15959. 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 ].",
  15960. referencedClasses: [],
  15961. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15962. }),
  15963. $globals.ClassSorterNode);
  15964. $core.addMethod(
  15965. $core.method({
  15966. selector: "on:classes:level:",
  15967. protocol: "instance creation",
  15968. fn: function (aClass,aCollection,anInteger){
  15969. var self=this,$self=this;
  15970. return $core.withContext(function($ctx1) {
  15971. var $1;
  15972. $1=$self._new();
  15973. $recv($1)._theClass_(aClass);
  15974. $recv($1)._level_(anInteger);
  15975. $recv($1)._getNodesFrom_(aCollection);
  15976. return $recv($1)._yourself();
  15977. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15978. },
  15979. args: ["aClass", "aCollection", "anInteger"],
  15980. 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",
  15981. referencedClasses: [],
  15982. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15983. }),
  15984. $globals.ClassSorterNode.a$cls);
  15985. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15986. $core.addMethod(
  15987. $core.method({
  15988. selector: "allInstanceVariableNames",
  15989. protocol: "accessing",
  15990. fn: function (){
  15991. var self=this,$self=this;
  15992. return [];
  15993. },
  15994. args: [],
  15995. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15996. referencedClasses: [],
  15997. messageSends: []
  15998. }),
  15999. $globals.TBehaviorDefaults);
  16000. $core.addMethod(
  16001. $core.method({
  16002. selector: "allSubclassesDo:",
  16003. protocol: "enumerating",
  16004. fn: function (aBlock){
  16005. var self=this,$self=this;
  16006. return self;
  16007. },
  16008. args: ["aBlock"],
  16009. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  16010. referencedClasses: [],
  16011. messageSends: []
  16012. }),
  16013. $globals.TBehaviorDefaults);
  16014. $core.addMethod(
  16015. $core.method({
  16016. selector: "name",
  16017. protocol: "accessing",
  16018. fn: function (){
  16019. var self=this,$self=this;
  16020. return nil;
  16021. },
  16022. args: [],
  16023. source: "name\x0a\x09^ nil",
  16024. referencedClasses: [],
  16025. messageSends: []
  16026. }),
  16027. $globals.TBehaviorDefaults);
  16028. $core.addMethod(
  16029. $core.method({
  16030. selector: "printOn:",
  16031. protocol: "printing",
  16032. fn: function (aStream){
  16033. var self=this,$self=this;
  16034. return $core.withContext(function($ctx1) {
  16035. var $1,$receiver;
  16036. $1=$self._name();
  16037. if(($receiver = $1) == null || $receiver.a$nil){
  16038. (
  16039. $ctx1.supercall = true,
  16040. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  16041. $ctx1.supercall = false;
  16042. } else {
  16043. var name;
  16044. name=$receiver;
  16045. $recv(aStream)._nextPutAll_(name);
  16046. }
  16047. return self;
  16048. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  16049. },
  16050. args: ["aStream"],
  16051. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  16052. referencedClasses: [],
  16053. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16054. }),
  16055. $globals.TBehaviorDefaults);
  16056. $core.addMethod(
  16057. $core.method({
  16058. selector: "superclass",
  16059. protocol: "accessing",
  16060. fn: function (){
  16061. var self=this,$self=this;
  16062. return nil;
  16063. },
  16064. args: [],
  16065. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16066. referencedClasses: [],
  16067. messageSends: []
  16068. }),
  16069. $globals.TBehaviorDefaults);
  16070. $core.addMethod(
  16071. $core.method({
  16072. selector: "traitUsers",
  16073. protocol: "accessing",
  16074. fn: function (){
  16075. var self=this,$self=this;
  16076. return [];
  16077. },
  16078. args: [],
  16079. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16080. referencedClasses: [],
  16081. messageSends: []
  16082. }),
  16083. $globals.TBehaviorDefaults);
  16084. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16085. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16086. $core.addMethod(
  16087. $core.method({
  16088. selector: ">>",
  16089. protocol: "accessing",
  16090. fn: function (aString){
  16091. var self=this,$self=this;
  16092. return $core.withContext(function($ctx1) {
  16093. return $self._methodAt_(aString);
  16094. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  16095. },
  16096. args: ["aString"],
  16097. source: ">> aString\x0a\x09^ self methodAt: aString",
  16098. referencedClasses: [],
  16099. messageSends: ["methodAt:"]
  16100. }),
  16101. $globals.TBehaviorProvider);
  16102. $core.addMethod(
  16103. $core.method({
  16104. selector: "addCompiledMethod:",
  16105. protocol: "compiling",
  16106. fn: function (aMethod){
  16107. var self=this,$self=this;
  16108. var oldMethod,announcement;
  16109. return $core.withContext(function($ctx1) {
  16110. var $1,$2,$3,$4,$receiver;
  16111. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16112. return nil;
  16113. }));
  16114. $self._basicAddCompiledMethod_(aMethod);
  16115. $1=oldMethod;
  16116. if(($receiver = $1) == null || $receiver.a$nil){
  16117. $2=$recv($globals.MethodAdded)._new();
  16118. $ctx1.sendIdx["new"]=1;
  16119. $recv($2)._method_(aMethod);
  16120. $ctx1.sendIdx["method:"]=1;
  16121. $3=$recv($2)._yourself();
  16122. $ctx1.sendIdx["yourself"]=1;
  16123. announcement=$3;
  16124. } else {
  16125. $4=$recv($globals.MethodModified)._new();
  16126. $recv($4)._oldMethod_(oldMethod);
  16127. $recv($4)._method_(aMethod);
  16128. announcement=$recv($4)._yourself();
  16129. }
  16130. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16131. return self;
  16132. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16133. },
  16134. args: ["aMethod"],
  16135. 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",
  16136. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16137. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16138. }),
  16139. $globals.TBehaviorProvider);
  16140. $core.addMethod(
  16141. $core.method({
  16142. selector: "basicAddCompiledMethod:",
  16143. protocol: "private",
  16144. fn: function (aMethod){
  16145. var self=this,$self=this;
  16146. return $core.withContext(function($ctx1) {
  16147. $core.addMethod(aMethod, self);
  16148. return self;
  16149. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16150. },
  16151. args: ["aMethod"],
  16152. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16153. referencedClasses: [],
  16154. messageSends: []
  16155. }),
  16156. $globals.TBehaviorProvider);
  16157. $core.addMethod(
  16158. $core.method({
  16159. selector: "basicRemoveCompiledMethod:",
  16160. protocol: "private",
  16161. fn: function (aMethod){
  16162. var self=this,$self=this;
  16163. return $core.withContext(function($ctx1) {
  16164. $core.removeMethod(aMethod,self);
  16165. return self;
  16166. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16167. },
  16168. args: ["aMethod"],
  16169. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16170. referencedClasses: [],
  16171. messageSends: []
  16172. }),
  16173. $globals.TBehaviorProvider);
  16174. $core.addMethod(
  16175. $core.method({
  16176. selector: "compile:protocol:",
  16177. protocol: "compiling",
  16178. fn: function (aString,anotherString){
  16179. var self=this,$self=this;
  16180. return $core.withContext(function($ctx1) {
  16181. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16182. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16183. },
  16184. args: ["aString", "anotherString"],
  16185. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16186. referencedClasses: ["Compiler"],
  16187. messageSends: ["install:forClass:protocol:", "new"]
  16188. }),
  16189. $globals.TBehaviorProvider);
  16190. $core.addMethod(
  16191. $core.method({
  16192. selector: "includesSelector:",
  16193. protocol: "testing",
  16194. fn: function (aString){
  16195. var self=this,$self=this;
  16196. return $core.withContext(function($ctx1) {
  16197. return $recv($self._methodDictionary())._includesKey_(aString);
  16198. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16199. },
  16200. args: ["aString"],
  16201. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16202. referencedClasses: [],
  16203. messageSends: ["includesKey:", "methodDictionary"]
  16204. }),
  16205. $globals.TBehaviorProvider);
  16206. $core.addMethod(
  16207. $core.method({
  16208. selector: "methodAt:",
  16209. protocol: "accessing",
  16210. fn: function (aString){
  16211. var self=this,$self=this;
  16212. return $core.withContext(function($ctx1) {
  16213. return $recv($self._methodDictionary())._at_(aString);
  16214. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16215. },
  16216. args: ["aString"],
  16217. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16218. referencedClasses: [],
  16219. messageSends: ["at:", "methodDictionary"]
  16220. }),
  16221. $globals.TBehaviorProvider);
  16222. $core.addMethod(
  16223. $core.method({
  16224. selector: "methodDictionary",
  16225. protocol: "accessing",
  16226. fn: function (){
  16227. var self=this,$self=this;
  16228. return $core.withContext(function($ctx1) {
  16229. var dict = $globals.HashedCollection._new();
  16230. var methods = self.methods;
  16231. Object.keys(methods).forEach(function(i) {
  16232. if(methods[i].selector) {
  16233. dict._at_put_(methods[i].selector, methods[i]);
  16234. }
  16235. });
  16236. return dict;
  16237. return self;
  16238. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16239. },
  16240. args: [],
  16241. 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'>",
  16242. referencedClasses: [],
  16243. messageSends: []
  16244. }),
  16245. $globals.TBehaviorProvider);
  16246. $core.addMethod(
  16247. $core.method({
  16248. selector: "methodOrganizationEnter:andLeave:",
  16249. protocol: "accessing",
  16250. fn: function (aMethod,oldMethod){
  16251. var self=this,$self=this;
  16252. return $core.withContext(function($ctx1) {
  16253. var $1,$2,$receiver;
  16254. if(($receiver = aMethod) == null || $receiver.a$nil){
  16255. aMethod;
  16256. } else {
  16257. $1=$self._organization();
  16258. $2=$recv(aMethod)._protocol();
  16259. $ctx1.sendIdx["protocol"]=1;
  16260. $recv($1)._addElement_($2);
  16261. }
  16262. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16263. oldMethod;
  16264. } else {
  16265. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16266. }
  16267. return self;
  16268. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16269. },
  16270. args: ["aMethod", "oldMethod"],
  16271. 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 ]",
  16272. referencedClasses: [],
  16273. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16274. }),
  16275. $globals.TBehaviorProvider);
  16276. $core.addMethod(
  16277. $core.method({
  16278. selector: "methodTemplate",
  16279. protocol: "accessing",
  16280. fn: function (){
  16281. var self=this,$self=this;
  16282. return $core.withContext(function($ctx1) {
  16283. return $recv($globals.String)._streamContents_((function(stream){
  16284. return $core.withContext(function($ctx2) {
  16285. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16286. $ctx2.sendIdx["write:"]=1;
  16287. $recv(stream)._lf();
  16288. $ctx2.sendIdx["lf"]=1;
  16289. $recv(stream)._tab();
  16290. $ctx2.sendIdx["tab"]=1;
  16291. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16292. $ctx2.sendIdx["write:"]=2;
  16293. $recv(stream)._lf();
  16294. $ctx2.sendIdx["lf"]=2;
  16295. $recv(stream)._lf();
  16296. $ctx2.sendIdx["lf"]=3;
  16297. $recv(stream)._tab();
  16298. $ctx2.sendIdx["tab"]=2;
  16299. $recv(stream)._write_("| temporary variable names |");
  16300. $ctx2.sendIdx["write:"]=3;
  16301. $recv(stream)._lf();
  16302. $recv(stream)._tab();
  16303. return $recv(stream)._write_("statements");
  16304. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16305. }));
  16306. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16307. },
  16308. args: [],
  16309. 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' ]",
  16310. referencedClasses: ["String"],
  16311. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16312. }),
  16313. $globals.TBehaviorProvider);
  16314. $core.addMethod(
  16315. $core.method({
  16316. selector: "methods",
  16317. protocol: "accessing",
  16318. fn: function (){
  16319. var self=this,$self=this;
  16320. return $core.withContext(function($ctx1) {
  16321. return $recv($self._methodDictionary())._values();
  16322. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16323. },
  16324. args: [],
  16325. source: "methods\x0a\x09^ self methodDictionary values",
  16326. referencedClasses: [],
  16327. messageSends: ["values", "methodDictionary"]
  16328. }),
  16329. $globals.TBehaviorProvider);
  16330. $core.addMethod(
  16331. $core.method({
  16332. selector: "methodsInProtocol:",
  16333. protocol: "accessing",
  16334. fn: function (aString){
  16335. var self=this,$self=this;
  16336. return $core.withContext(function($ctx1) {
  16337. return $recv($self._methods())._select_((function(each){
  16338. return $core.withContext(function($ctx2) {
  16339. return $recv($recv(each)._protocol()).__eq(aString);
  16340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16341. }));
  16342. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16343. },
  16344. args: ["aString"],
  16345. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16346. referencedClasses: [],
  16347. messageSends: ["select:", "methods", "=", "protocol"]
  16348. }),
  16349. $globals.TBehaviorProvider);
  16350. $core.addMethod(
  16351. $core.method({
  16352. selector: "organization",
  16353. protocol: "accessing",
  16354. fn: function (){
  16355. var self=this,$self=this;
  16356. return $core.withContext(function($ctx1) {
  16357. var $1,$receiver;
  16358. $1=$self._basicOrganization();
  16359. $ctx1.sendIdx["basicOrganization"]=1;
  16360. if(($receiver = $1) == null || $receiver.a$nil){
  16361. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16362. return $self._basicOrganization();
  16363. } else {
  16364. return $1;
  16365. }
  16366. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16367. },
  16368. args: [],
  16369. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16370. referencedClasses: ["ClassOrganizer"],
  16371. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16372. }),
  16373. $globals.TBehaviorProvider);
  16374. $core.addMethod(
  16375. $core.method({
  16376. selector: "ownMethods",
  16377. protocol: "accessing",
  16378. fn: function (){
  16379. var self=this,$self=this;
  16380. return $core.withContext(function($ctx1) {
  16381. var $1;
  16382. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16383. return $core.withContext(function($ctx2) {
  16384. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16385. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16386. })))._sorted_((function(a,b){
  16387. return $core.withContext(function($ctx2) {
  16388. $1=$recv(a)._selector();
  16389. $ctx2.sendIdx["selector"]=1;
  16390. return $recv($1).__lt_eq($recv(b)._selector());
  16391. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16392. }));
  16393. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16394. },
  16395. args: [],
  16396. 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 ]",
  16397. referencedClasses: ["OrderedCollection"],
  16398. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16399. }),
  16400. $globals.TBehaviorProvider);
  16401. $core.addMethod(
  16402. $core.method({
  16403. selector: "ownMethodsInProtocol:",
  16404. protocol: "accessing",
  16405. fn: function (aString){
  16406. var self=this,$self=this;
  16407. return $core.withContext(function($ctx1) {
  16408. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16409. return $core.withContext(function($ctx2) {
  16410. return $recv($recv(each)._methodClass()).__eq(self);
  16411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16412. }));
  16413. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16414. },
  16415. args: ["aString"],
  16416. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16417. referencedClasses: [],
  16418. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16419. }),
  16420. $globals.TBehaviorProvider);
  16421. $core.addMethod(
  16422. $core.method({
  16423. selector: "ownProtocols",
  16424. protocol: "accessing",
  16425. fn: function (){
  16426. var self=this,$self=this;
  16427. return $core.withContext(function($ctx1) {
  16428. return $recv($self._protocols())._reject_((function(each){
  16429. return $core.withContext(function($ctx2) {
  16430. return $recv(each)._match_("^\x5c*");
  16431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16432. }));
  16433. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16434. },
  16435. args: [],
  16436. 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*' ]",
  16437. referencedClasses: [],
  16438. messageSends: ["reject:", "protocols", "match:"]
  16439. }),
  16440. $globals.TBehaviorProvider);
  16441. $core.addMethod(
  16442. $core.method({
  16443. selector: "packageOfProtocol:",
  16444. protocol: "accessing",
  16445. fn: function (aString){
  16446. var self=this,$self=this;
  16447. return $core.withContext(function($ctx1) {
  16448. var $1;
  16449. $1=$recv(aString)._beginsWith_("*");
  16450. if(!$core.assert($1)){
  16451. return $self._package();
  16452. }
  16453. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16454. return nil;
  16455. }));
  16456. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16457. },
  16458. args: ["aString"],
  16459. 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 ]",
  16460. referencedClasses: ["Package"],
  16461. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16462. }),
  16463. $globals.TBehaviorProvider);
  16464. $core.addMethod(
  16465. $core.method({
  16466. selector: "protocols",
  16467. protocol: "accessing",
  16468. fn: function (){
  16469. var self=this,$self=this;
  16470. return $core.withContext(function($ctx1) {
  16471. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16472. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16473. },
  16474. args: [],
  16475. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16476. referencedClasses: [],
  16477. messageSends: ["sorted", "asArray", "elements", "organization"]
  16478. }),
  16479. $globals.TBehaviorProvider);
  16480. $core.addMethod(
  16481. $core.method({
  16482. selector: "protocolsDo:",
  16483. protocol: "enumerating",
  16484. fn: function (aBlock){
  16485. var self=this,$self=this;
  16486. var methodsByProtocol;
  16487. return $core.withContext(function($ctx1) {
  16488. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16489. $ctx1.sendIdx["new"]=1;
  16490. $recv($self._methodDictionary())._valuesDo_((function(m){
  16491. return $core.withContext(function($ctx2) {
  16492. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16493. return $core.withContext(function($ctx3) {
  16494. return $recv($globals.Array)._new();
  16495. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16496. })))._add_(m);
  16497. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16498. }));
  16499. $recv($self._protocols())._do_((function(protocol){
  16500. return $core.withContext(function($ctx2) {
  16501. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16502. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16503. }));
  16504. return self;
  16505. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16506. },
  16507. args: ["aBlock"],
  16508. 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) ]",
  16509. referencedClasses: ["HashedCollection", "Array"],
  16510. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16511. }),
  16512. $globals.TBehaviorProvider);
  16513. $core.addMethod(
  16514. $core.method({
  16515. selector: "recompile",
  16516. protocol: "compiling",
  16517. fn: function (){
  16518. var self=this,$self=this;
  16519. return $core.withContext(function($ctx1) {
  16520. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16521. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16522. },
  16523. args: [],
  16524. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16525. referencedClasses: ["Compiler"],
  16526. messageSends: ["recompile:", "new"]
  16527. }),
  16528. $globals.TBehaviorProvider);
  16529. $core.addMethod(
  16530. $core.method({
  16531. selector: "removeCompiledMethod:",
  16532. protocol: "compiling",
  16533. fn: function (aMethod){
  16534. var self=this,$self=this;
  16535. return $core.withContext(function($ctx1) {
  16536. var $1,$3,$2;
  16537. $self._basicRemoveCompiledMethod_(aMethod);
  16538. $1=$recv($globals.SystemAnnouncer)._current();
  16539. $3=$recv($globals.MethodRemoved)._new();
  16540. $recv($3)._method_(aMethod);
  16541. $2=$recv($3)._yourself();
  16542. $recv($1)._announce_($2);
  16543. return self;
  16544. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16545. },
  16546. args: ["aMethod"],
  16547. 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)",
  16548. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16549. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16550. }),
  16551. $globals.TBehaviorProvider);
  16552. $core.addMethod(
  16553. $core.method({
  16554. selector: "removeProtocolIfEmpty:",
  16555. protocol: "accessing",
  16556. fn: function (aString){
  16557. var self=this,$self=this;
  16558. return $core.withContext(function($ctx1) {
  16559. $recv($self._methods())._detect_ifNone_((function(each){
  16560. return $core.withContext(function($ctx2) {
  16561. return $recv($recv(each)._protocol()).__eq(aString);
  16562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16563. }),(function(){
  16564. return $core.withContext(function($ctx2) {
  16565. return $recv($self._organization())._removeElement_(aString);
  16566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16567. }));
  16568. return self;
  16569. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16570. },
  16571. args: ["aString"],
  16572. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16573. referencedClasses: [],
  16574. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16575. }),
  16576. $globals.TBehaviorProvider);
  16577. $core.addMethod(
  16578. $core.method({
  16579. selector: "selectors",
  16580. protocol: "accessing",
  16581. fn: function (){
  16582. var self=this,$self=this;
  16583. return $core.withContext(function($ctx1) {
  16584. return $recv($self._methodDictionary())._keys();
  16585. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16586. },
  16587. args: [],
  16588. source: "selectors\x0a\x09^ self methodDictionary keys",
  16589. referencedClasses: [],
  16590. messageSends: ["keys", "methodDictionary"]
  16591. }),
  16592. $globals.TBehaviorProvider);
  16593. $core.addMethod(
  16594. $core.method({
  16595. selector: "setTraitComposition:",
  16596. protocol: "compiling",
  16597. fn: function (aTraitComposition){
  16598. var self=this,$self=this;
  16599. return $core.withContext(function($ctx1) {
  16600. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16601. return self;
  16602. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16603. },
  16604. args: ["aTraitComposition"],
  16605. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16606. referencedClasses: [],
  16607. messageSends: []
  16608. }),
  16609. $globals.TBehaviorProvider);
  16610. $core.addMethod(
  16611. $core.method({
  16612. selector: "traitComposition",
  16613. protocol: "accessing",
  16614. fn: function (){
  16615. var self=this,$self=this;
  16616. return $core.withContext(function($ctx1) {
  16617. var $1,$receiver;
  16618. $1=$self._basicAt_("traitComposition");
  16619. if(($receiver = $1) == null || $receiver.a$nil){
  16620. return [];
  16621. } else {
  16622. var aCollection;
  16623. aCollection=$receiver;
  16624. return $recv(aCollection)._collect_((function(each){
  16625. return $core.withContext(function($ctx2) {
  16626. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16628. }));
  16629. }
  16630. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16631. },
  16632. args: [],
  16633. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16634. referencedClasses: ["TraitTransformation"],
  16635. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16636. }),
  16637. $globals.TBehaviorProvider);
  16638. $core.addMethod(
  16639. $core.method({
  16640. selector: "traitCompositionDefinition",
  16641. protocol: "accessing",
  16642. fn: function (){
  16643. var self=this,$self=this;
  16644. return $core.withContext(function($ctx1) {
  16645. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16646. return $core.withContext(function($ctx2) {
  16647. return $recv($globals.String)._streamContents_((function(str){
  16648. return $core.withContext(function($ctx3) {
  16649. $recv(str)._write_("{");
  16650. $ctx3.sendIdx["write:"]=1;
  16651. $recv(traitComposition)._do_separatedBy_((function(each){
  16652. return $core.withContext(function($ctx4) {
  16653. return $recv(str)._write_($recv(each)._definition());
  16654. $ctx4.sendIdx["write:"]=2;
  16655. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16656. }),(function(){
  16657. return $core.withContext(function($ctx4) {
  16658. return $recv(str)._write_(". ");
  16659. $ctx4.sendIdx["write:"]=3;
  16660. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16661. }));
  16662. return $recv(str)._write_("}");
  16663. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16664. }));
  16665. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16666. }));
  16667. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16668. },
  16669. args: [],
  16670. 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: '}' ] ]",
  16671. referencedClasses: ["String"],
  16672. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16673. }),
  16674. $globals.TBehaviorProvider);
  16675. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16676. $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.";
  16677. $core.addMethod(
  16678. $core.method({
  16679. selector: "asJavaScriptSource",
  16680. protocol: "converting",
  16681. fn: function (){
  16682. var self=this,$self=this;
  16683. return $core.withContext(function($ctx1) {
  16684. return "$globals.".__comma($self._name());
  16685. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16686. },
  16687. args: [],
  16688. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16689. referencedClasses: [],
  16690. messageSends: [",", "name"]
  16691. }),
  16692. $globals.TMasterBehavior);
  16693. $core.addMethod(
  16694. $core.method({
  16695. selector: "browse",
  16696. protocol: "browsing",
  16697. fn: function (){
  16698. var self=this,$self=this;
  16699. return $core.withContext(function($ctx1) {
  16700. $recv($globals.Finder)._findClass_(self);
  16701. return self;
  16702. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16703. },
  16704. args: [],
  16705. source: "browse\x0a\x09Finder findClass: self",
  16706. referencedClasses: ["Finder"],
  16707. messageSends: ["findClass:"]
  16708. }),
  16709. $globals.TMasterBehavior);
  16710. $core.addMethod(
  16711. $core.method({
  16712. selector: "category",
  16713. protocol: "accessing",
  16714. fn: function (){
  16715. var self=this,$self=this;
  16716. return $core.withContext(function($ctx1) {
  16717. var $1,$receiver;
  16718. $1=$self._package();
  16719. $ctx1.sendIdx["package"]=1;
  16720. if(($receiver = $1) == null || $receiver.a$nil){
  16721. return "Unclassified";
  16722. } else {
  16723. return $recv($self._package())._name();
  16724. }
  16725. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16726. },
  16727. args: [],
  16728. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16729. referencedClasses: [],
  16730. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16731. }),
  16732. $globals.TMasterBehavior);
  16733. $core.addMethod(
  16734. $core.method({
  16735. selector: "classTag",
  16736. protocol: "accessing",
  16737. fn: function (){
  16738. var self=this,$self=this;
  16739. return $core.withContext(function($ctx1) {
  16740. return $self._subclassResponsibility();
  16741. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16742. },
  16743. args: [],
  16744. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16745. referencedClasses: [],
  16746. messageSends: ["subclassResponsibility"]
  16747. }),
  16748. $globals.TMasterBehavior);
  16749. $core.addMethod(
  16750. $core.method({
  16751. selector: "comment",
  16752. protocol: "accessing",
  16753. fn: function (){
  16754. var self=this,$self=this;
  16755. return $core.withContext(function($ctx1) {
  16756. var $1,$receiver;
  16757. $1=$self._basicAt_("comment");
  16758. if(($receiver = $1) == null || $receiver.a$nil){
  16759. return "";
  16760. } else {
  16761. return $1;
  16762. }
  16763. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16764. },
  16765. args: [],
  16766. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16767. referencedClasses: [],
  16768. messageSends: ["ifNil:", "basicAt:"]
  16769. }),
  16770. $globals.TMasterBehavior);
  16771. $core.addMethod(
  16772. $core.method({
  16773. selector: "comment:",
  16774. protocol: "accessing",
  16775. fn: function (aString){
  16776. var self=this,$self=this;
  16777. return $core.withContext(function($ctx1) {
  16778. var $1,$3,$2;
  16779. $self._basicAt_put_("comment",aString);
  16780. $1=$recv($globals.SystemAnnouncer)._current();
  16781. $3=$recv($globals.ClassCommentChanged)._new();
  16782. $recv($3)._theClass_(self);
  16783. $2=$recv($3)._yourself();
  16784. $recv($1)._announce_($2);
  16785. return self;
  16786. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16787. },
  16788. args: ["aString"],
  16789. 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)",
  16790. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16791. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16792. }),
  16793. $globals.TMasterBehavior);
  16794. $core.addMethod(
  16795. $core.method({
  16796. selector: "definedMethods",
  16797. protocol: "accessing",
  16798. fn: function (){
  16799. var self=this,$self=this;
  16800. var methods;
  16801. return $core.withContext(function($ctx1) {
  16802. var $1,$receiver;
  16803. methods=$self._methods();
  16804. $ctx1.sendIdx["methods"]=1;
  16805. $1=$self._theMetaClass();
  16806. if(($receiver = $1) == null || $receiver.a$nil){
  16807. return methods;
  16808. } else {
  16809. var meta;
  16810. meta=$receiver;
  16811. return $recv(methods).__comma($recv(meta)._methods());
  16812. }
  16813. return self;
  16814. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16815. },
  16816. args: [],
  16817. 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 ]",
  16818. referencedClasses: [],
  16819. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16820. }),
  16821. $globals.TMasterBehavior);
  16822. $core.addMethod(
  16823. $core.method({
  16824. selector: "enterOrganization",
  16825. protocol: "accessing",
  16826. fn: function (){
  16827. var self=this,$self=this;
  16828. return $core.withContext(function($ctx1) {
  16829. var $1,$receiver;
  16830. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16831. $globals.Smalltalk;
  16832. } else {
  16833. $1=$self._basicAt_("category");
  16834. if(($receiver = $1) == null || $receiver.a$nil){
  16835. $self._basicPackage_(nil);
  16836. $ctx1.sendIdx["basicPackage:"]=1;
  16837. } else {
  16838. var category;
  16839. category=$receiver;
  16840. $self._basicPackage_($recv($globals.Package)._named_(category));
  16841. $recv($recv($self._package())._organization())._addElement_(self);
  16842. }
  16843. }
  16844. return self;
  16845. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16846. },
  16847. args: [],
  16848. 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 ] ]",
  16849. referencedClasses: ["Smalltalk", "Package"],
  16850. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16851. }),
  16852. $globals.TMasterBehavior);
  16853. $core.addMethod(
  16854. $core.method({
  16855. selector: "leaveOrganization",
  16856. protocol: "accessing",
  16857. fn: function (){
  16858. var self=this,$self=this;
  16859. return $core.withContext(function($ctx1) {
  16860. var $receiver;
  16861. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16862. $globals.Smalltalk;
  16863. } else {
  16864. $recv($recv($self._package())._organization())._removeElement_(self);
  16865. }
  16866. return self;
  16867. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16868. },
  16869. args: [],
  16870. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16871. referencedClasses: ["Smalltalk"],
  16872. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16873. }),
  16874. $globals.TMasterBehavior);
  16875. $core.addMethod(
  16876. $core.method({
  16877. selector: "name",
  16878. protocol: "accessing",
  16879. fn: function (){
  16880. var self=this,$self=this;
  16881. return $core.withContext(function($ctx1) {
  16882. return self.name;
  16883. return self;
  16884. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16885. },
  16886. args: [],
  16887. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16888. referencedClasses: [],
  16889. messageSends: []
  16890. }),
  16891. $globals.TMasterBehavior);
  16892. $core.addMethod(
  16893. $core.method({
  16894. selector: "package:",
  16895. protocol: "accessing",
  16896. fn: function (aPackage){
  16897. var self=this,$self=this;
  16898. var oldPackage;
  16899. return $core.withContext(function($ctx1) {
  16900. var $2,$1,$3,$5,$4;
  16901. $2=$self._package();
  16902. $ctx1.sendIdx["package"]=1;
  16903. $1=$recv($2).__eq(aPackage);
  16904. if($core.assert($1)){
  16905. return self;
  16906. }
  16907. oldPackage=$self._package();
  16908. $self._leaveOrganization();
  16909. $self._basicAt_put_("category",$recv(aPackage)._name());
  16910. $self._enterOrganization();
  16911. $3=$recv($globals.SystemAnnouncer)._current();
  16912. $5=$recv($globals.ClassMoved)._new();
  16913. $recv($5)._theClass_(self);
  16914. $recv($5)._oldPackage_(oldPackage);
  16915. $4=$recv($5)._yourself();
  16916. $recv($3)._announce_($4);
  16917. return self;
  16918. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16919. },
  16920. args: ["aPackage"],
  16921. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16922. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16923. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16924. }),
  16925. $globals.TMasterBehavior);
  16926. $core.addMethod(
  16927. $core.method({
  16928. selector: "theNonMetaClass",
  16929. protocol: "accessing",
  16930. fn: function (){
  16931. var self=this,$self=this;
  16932. return self;
  16933. },
  16934. args: [],
  16935. source: "theNonMetaClass\x0a\x09^ self",
  16936. referencedClasses: [],
  16937. messageSends: []
  16938. }),
  16939. $globals.TMasterBehavior);
  16940. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16941. $core.addMethod(
  16942. $core.method({
  16943. selector: "-",
  16944. protocol: "composition",
  16945. fn: function (anArray){
  16946. var self=this,$self=this;
  16947. return $core.withContext(function($ctx1) {
  16948. return $recv($self._asTraitTransformation()).__minus(anArray);
  16949. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16950. },
  16951. args: ["anArray"],
  16952. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16953. referencedClasses: [],
  16954. messageSends: ["-", "asTraitTransformation"]
  16955. }),
  16956. $globals.Trait);
  16957. $core.addMethod(
  16958. $core.method({
  16959. selector: "@",
  16960. protocol: "composition",
  16961. fn: function (anArrayOfAssociations){
  16962. var self=this,$self=this;
  16963. return $core.withContext(function($ctx1) {
  16964. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16965. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16966. },
  16967. args: ["anArrayOfAssociations"],
  16968. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16969. referencedClasses: [],
  16970. messageSends: ["@", "asTraitTransformation"]
  16971. }),
  16972. $globals.Trait);
  16973. $core.addMethod(
  16974. $core.method({
  16975. selector: "asTraitComposition",
  16976. protocol: "converting",
  16977. fn: function (){
  16978. var self=this,$self=this;
  16979. return $core.withContext(function($ctx1) {
  16980. return $recv($self._asTraitTransformation())._asTraitComposition();
  16981. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16982. },
  16983. args: [],
  16984. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16985. referencedClasses: [],
  16986. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16987. }),
  16988. $globals.Trait);
  16989. $core.addMethod(
  16990. $core.method({
  16991. selector: "asTraitTransformation",
  16992. protocol: "converting",
  16993. fn: function (){
  16994. var self=this,$self=this;
  16995. return $core.withContext(function($ctx1) {
  16996. return $recv($globals.TraitTransformation)._on_(self);
  16997. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16998. },
  16999. args: [],
  17000. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  17001. referencedClasses: ["TraitTransformation"],
  17002. messageSends: ["on:"]
  17003. }),
  17004. $globals.Trait);
  17005. $core.addMethod(
  17006. $core.method({
  17007. selector: "basicOrganization",
  17008. protocol: "accessing",
  17009. fn: function (){
  17010. var self=this,$self=this;
  17011. return $self["@organization"];
  17012. },
  17013. args: [],
  17014. source: "basicOrganization\x0a\x09^ organization",
  17015. referencedClasses: [],
  17016. messageSends: []
  17017. }),
  17018. $globals.Trait);
  17019. $core.addMethod(
  17020. $core.method({
  17021. selector: "basicOrganization:",
  17022. protocol: "accessing",
  17023. fn: function (aClassOrganizer){
  17024. var self=this,$self=this;
  17025. $self["@organization"]=aClassOrganizer;
  17026. return self;
  17027. },
  17028. args: ["aClassOrganizer"],
  17029. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  17030. referencedClasses: [],
  17031. messageSends: []
  17032. }),
  17033. $globals.Trait);
  17034. $core.addMethod(
  17035. $core.method({
  17036. selector: "basicPackage:",
  17037. protocol: "accessing",
  17038. fn: function (aPackage){
  17039. var self=this,$self=this;
  17040. $self["@package"]=aPackage;
  17041. return self;
  17042. },
  17043. args: ["aPackage"],
  17044. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  17045. referencedClasses: [],
  17046. messageSends: []
  17047. }),
  17048. $globals.Trait);
  17049. $core.addMethod(
  17050. $core.method({
  17051. selector: "classTag",
  17052. protocol: "accessing",
  17053. fn: function (){
  17054. var self=this,$self=this;
  17055. return "trait";
  17056. },
  17057. args: [],
  17058. source: "classTag\x0a\x09^ 'trait'",
  17059. referencedClasses: [],
  17060. messageSends: []
  17061. }),
  17062. $globals.Trait);
  17063. $core.addMethod(
  17064. $core.method({
  17065. selector: "definition",
  17066. protocol: "accessing",
  17067. fn: function (){
  17068. var self=this,$self=this;
  17069. return $core.withContext(function($ctx1) {
  17070. var $1;
  17071. return $recv($globals.String)._streamContents_((function(stream){
  17072. return $core.withContext(function($ctx2) {
  17073. $recv(stream)._write_("Trait named: ");
  17074. $ctx2.sendIdx["write:"]=1;
  17075. $recv(stream)._printSymbol_($self._name());
  17076. $recv(stream)._lf();
  17077. $ctx2.sendIdx["lf"]=1;
  17078. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17079. return $core.withContext(function($ctx3) {
  17080. $1=$recv($globals.String)._tab();
  17081. $ctx3.sendIdx["tab"]=1;
  17082. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17083. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17084. })));
  17085. $ctx2.sendIdx["write:"]=2;
  17086. $recv(stream)._tab();
  17087. $recv(stream)._write_("package: ");
  17088. return $recv(stream)._print_($self._category());
  17089. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17090. }));
  17091. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  17092. },
  17093. args: [],
  17094. 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 ]",
  17095. referencedClasses: ["String"],
  17096. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17097. }),
  17098. $globals.Trait);
  17099. $core.addMethod(
  17100. $core.method({
  17101. selector: "package",
  17102. protocol: "accessing",
  17103. fn: function (){
  17104. var self=this,$self=this;
  17105. return $self["@package"];
  17106. },
  17107. args: [],
  17108. source: "package\x0a\x09^ package",
  17109. referencedClasses: [],
  17110. messageSends: []
  17111. }),
  17112. $globals.Trait);
  17113. $core.addMethod(
  17114. $core.method({
  17115. selector: "theMetaClass",
  17116. protocol: "accessing",
  17117. fn: function (){
  17118. var self=this,$self=this;
  17119. return nil;
  17120. },
  17121. args: [],
  17122. source: "theMetaClass\x0a\x09^ nil",
  17123. referencedClasses: [],
  17124. messageSends: []
  17125. }),
  17126. $globals.Trait);
  17127. $core.addMethod(
  17128. $core.method({
  17129. selector: "traitUsers",
  17130. protocol: "accessing",
  17131. fn: function (){
  17132. var self=this,$self=this;
  17133. return $core.withContext(function($ctx1) {
  17134. return $recv($self._basicAt_("traitUsers"))._copy();
  17135. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17136. },
  17137. args: [],
  17138. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  17139. referencedClasses: [],
  17140. messageSends: ["copy", "basicAt:"]
  17141. }),
  17142. $globals.Trait);
  17143. $core.addMethod(
  17144. $core.method({
  17145. selector: "named:package:",
  17146. protocol: "instance creation",
  17147. fn: function (aString,anotherString){
  17148. var self=this,$self=this;
  17149. return $core.withContext(function($ctx1) {
  17150. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17151. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17152. },
  17153. args: ["aString", "anotherString"],
  17154. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17155. referencedClasses: ["ClassBuilder"],
  17156. messageSends: ["addTraitNamed:package:", "new"]
  17157. }),
  17158. $globals.Trait.a$cls);
  17159. $core.addMethod(
  17160. $core.method({
  17161. selector: "named:uses:package:",
  17162. protocol: "instance creation",
  17163. fn: function (aString,aTraitCompositionDescription,anotherString){
  17164. var self=this,$self=this;
  17165. var trait;
  17166. return $core.withContext(function($ctx1) {
  17167. trait=$self._named_package_(aString,anotherString);
  17168. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17169. return trait;
  17170. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17171. },
  17172. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17173. 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",
  17174. referencedClasses: [],
  17175. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17176. }),
  17177. $globals.Trait.a$cls);
  17178. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17179. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17180. $core.addMethod(
  17181. $core.method({
  17182. selector: "-",
  17183. protocol: "composition",
  17184. fn: function (anArray){
  17185. var self=this,$self=this;
  17186. return $core.withContext(function($ctx1) {
  17187. var $1;
  17188. $1=$self._copy();
  17189. $recv($1)._addExclusions_(anArray);
  17190. return $recv($1)._yourself();
  17191. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17192. },
  17193. args: ["anArray"],
  17194. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17195. referencedClasses: [],
  17196. messageSends: ["addExclusions:", "copy", "yourself"]
  17197. }),
  17198. $globals.TraitTransformation);
  17199. $core.addMethod(
  17200. $core.method({
  17201. selector: "@",
  17202. protocol: "composition",
  17203. fn: function (anArrayOfAssociations){
  17204. var self=this,$self=this;
  17205. return $core.withContext(function($ctx1) {
  17206. var $1;
  17207. $1=$self._copy();
  17208. $recv($1)._addAliases_(anArrayOfAssociations);
  17209. return $recv($1)._yourself();
  17210. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17211. },
  17212. args: ["anArrayOfAssociations"],
  17213. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17214. referencedClasses: [],
  17215. messageSends: ["addAliases:", "copy", "yourself"]
  17216. }),
  17217. $globals.TraitTransformation);
  17218. $core.addMethod(
  17219. $core.method({
  17220. selector: "addAliases:",
  17221. protocol: "accessing",
  17222. fn: function (anArrayOfAssociations){
  17223. var self=this,$self=this;
  17224. return $core.withContext(function($ctx1) {
  17225. $recv(anArrayOfAssociations)._do_((function(each){
  17226. var key;
  17227. return $core.withContext(function($ctx2) {
  17228. key=$recv(each)._key();
  17229. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17230. return $core.withContext(function($ctx3) {
  17231. return $self._error_("Cannot use same alias name twice.");
  17232. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17233. }),(function(){
  17234. return $core.withContext(function($ctx3) {
  17235. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17236. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17237. }));
  17238. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17239. }));
  17240. return anArrayOfAssociations;
  17241. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17242. },
  17243. args: ["anArrayOfAssociations"],
  17244. 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",
  17245. referencedClasses: [],
  17246. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17247. }),
  17248. $globals.TraitTransformation);
  17249. $core.addMethod(
  17250. $core.method({
  17251. selector: "addExclusions:",
  17252. protocol: "accessing",
  17253. fn: function (anArray){
  17254. var self=this,$self=this;
  17255. return $core.withContext(function($ctx1) {
  17256. $recv($self["@exclusions"])._addAll_(anArray);
  17257. return anArray;
  17258. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17259. },
  17260. args: ["anArray"],
  17261. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17262. referencedClasses: [],
  17263. messageSends: ["addAll:"]
  17264. }),
  17265. $globals.TraitTransformation);
  17266. $core.addMethod(
  17267. $core.method({
  17268. selector: "aliases",
  17269. protocol: "accessing",
  17270. fn: function (){
  17271. var self=this,$self=this;
  17272. return $self["@aliases"];
  17273. },
  17274. args: [],
  17275. source: "aliases\x0a\x09^ aliases",
  17276. referencedClasses: [],
  17277. messageSends: []
  17278. }),
  17279. $globals.TraitTransformation);
  17280. $core.addMethod(
  17281. $core.method({
  17282. selector: "asJavaScriptObject",
  17283. protocol: "converting",
  17284. fn: function (){
  17285. var self=this,$self=this;
  17286. return $core.withContext(function($ctx1) {
  17287. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17288. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17289. },
  17290. args: [],
  17291. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17292. referencedClasses: [],
  17293. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17294. }),
  17295. $globals.TraitTransformation);
  17296. $core.addMethod(
  17297. $core.method({
  17298. selector: "asJavaScriptSource",
  17299. protocol: "converting",
  17300. fn: function (){
  17301. var self=this,$self=this;
  17302. return $core.withContext(function($ctx1) {
  17303. var $2,$3,$1;
  17304. return $recv($globals.String)._streamContents_((function(str){
  17305. return $core.withContext(function($ctx2) {
  17306. $2=$recv($self._trait())._asJavaScriptSource();
  17307. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17308. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17309. return $core.withContext(function($ctx3) {
  17310. return [", aliases: ",$recv(al)._asJSONString()];
  17311. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17312. }));
  17313. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17314. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17315. return $core.withContext(function($ctx3) {
  17316. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17317. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17318. })),"}"];
  17319. return $recv(str)._write_($1);
  17320. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17321. }));
  17322. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17323. },
  17324. args: [],
  17325. 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'}' } ]",
  17326. referencedClasses: ["String"],
  17327. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17328. }),
  17329. $globals.TraitTransformation);
  17330. $core.addMethod(
  17331. $core.method({
  17332. selector: "asTraitComposition",
  17333. protocol: "converting",
  17334. fn: function (){
  17335. var self=this,$self=this;
  17336. return [self];
  17337. },
  17338. args: [],
  17339. source: "asTraitComposition\x0a\x09^ { self }",
  17340. referencedClasses: [],
  17341. messageSends: []
  17342. }),
  17343. $globals.TraitTransformation);
  17344. $core.addMethod(
  17345. $core.method({
  17346. selector: "asTraitTransformation",
  17347. protocol: "converting",
  17348. fn: function (){
  17349. var self=this,$self=this;
  17350. return self;
  17351. },
  17352. args: [],
  17353. source: "asTraitTransformation\x0a\x09^ self",
  17354. referencedClasses: [],
  17355. messageSends: []
  17356. }),
  17357. $globals.TraitTransformation);
  17358. $core.addMethod(
  17359. $core.method({
  17360. selector: "definition",
  17361. protocol: "accessing",
  17362. fn: function (){
  17363. var self=this,$self=this;
  17364. return $core.withContext(function($ctx1) {
  17365. return $recv($globals.String)._streamContents_((function(str){
  17366. return $core.withContext(function($ctx2) {
  17367. $recv(str)._print_($self._trait());
  17368. $recv($self._aliases())._ifNotEmpty_((function(al){
  17369. return $core.withContext(function($ctx3) {
  17370. $recv(str)._write_(" @ {");
  17371. $ctx3.sendIdx["write:"]=1;
  17372. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17373. return $core.withContext(function($ctx4) {
  17374. $recv(str)._printSymbol_($recv(each)._key());
  17375. $ctx4.sendIdx["printSymbol:"]=1;
  17376. $recv(str)._write_(" -> ");
  17377. $ctx4.sendIdx["write:"]=2;
  17378. return $recv(str)._printSymbol_($recv(each)._value());
  17379. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17380. }),(function(){
  17381. return $core.withContext(function($ctx4) {
  17382. return $recv(str)._write_(". ");
  17383. $ctx4.sendIdx["write:"]=3;
  17384. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17385. }));
  17386. $ctx3.sendIdx["do:separatedBy:"]=1;
  17387. return $recv(str)._write_("}");
  17388. $ctx3.sendIdx["write:"]=4;
  17389. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17390. }));
  17391. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17392. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17393. return $core.withContext(function($ctx3) {
  17394. $recv(str)._write_(" - #(");
  17395. $ctx3.sendIdx["write:"]=5;
  17396. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17397. return $core.withContext(function($ctx4) {
  17398. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17399. $ctx4.sendIdx["write:"]=6;
  17400. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17401. }),(function(){
  17402. return $core.withContext(function($ctx4) {
  17403. return $recv(str)._space();
  17404. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17405. }));
  17406. return $recv(str)._write_(")");
  17407. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17408. }));
  17409. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17410. }));
  17411. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17412. },
  17413. args: [],
  17414. 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: ')' ] ]",
  17415. referencedClasses: ["String"],
  17416. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17417. }),
  17418. $globals.TraitTransformation);
  17419. $core.addMethod(
  17420. $core.method({
  17421. selector: "exclusions",
  17422. protocol: "accessing",
  17423. fn: function (){
  17424. var self=this,$self=this;
  17425. return $self["@exclusions"];
  17426. },
  17427. args: [],
  17428. source: "exclusions\x0a\x09^ exclusions",
  17429. referencedClasses: [],
  17430. messageSends: []
  17431. }),
  17432. $globals.TraitTransformation);
  17433. $core.addMethod(
  17434. $core.method({
  17435. selector: "initialize",
  17436. protocol: "initialization",
  17437. fn: function (){
  17438. var self=this,$self=this;
  17439. return $core.withContext(function($ctx1) {
  17440. (
  17441. $ctx1.supercall = true,
  17442. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17443. $ctx1.supercall = false;
  17444. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17445. $self["@exclusions"]=$recv($globals.Set)._new();
  17446. $self["@trait"]=nil;
  17447. return self;
  17448. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17449. },
  17450. args: [],
  17451. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17452. referencedClasses: ["Set"],
  17453. messageSends: ["initialize", "new"]
  17454. }),
  17455. $globals.TraitTransformation);
  17456. $core.addMethod(
  17457. $core.method({
  17458. selector: "postCopy",
  17459. protocol: "copying",
  17460. fn: function (){
  17461. var self=this,$self=this;
  17462. return $core.withContext(function($ctx1) {
  17463. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17464. $ctx1.sendIdx["copy"]=1;
  17465. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17466. return self;
  17467. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17468. },
  17469. args: [],
  17470. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17471. referencedClasses: [],
  17472. messageSends: ["copy"]
  17473. }),
  17474. $globals.TraitTransformation);
  17475. $core.addMethod(
  17476. $core.method({
  17477. selector: "trait",
  17478. protocol: "accessing",
  17479. fn: function (){
  17480. var self=this,$self=this;
  17481. return $self["@trait"];
  17482. },
  17483. args: [],
  17484. source: "trait\x0a\x09^ trait",
  17485. referencedClasses: [],
  17486. messageSends: []
  17487. }),
  17488. $globals.TraitTransformation);
  17489. $core.addMethod(
  17490. $core.method({
  17491. selector: "trait:",
  17492. protocol: "accessing",
  17493. fn: function (anObject){
  17494. var self=this,$self=this;
  17495. $self["@trait"]=anObject;
  17496. return self;
  17497. },
  17498. args: ["anObject"],
  17499. source: "trait: anObject\x0a\x09trait := anObject",
  17500. referencedClasses: [],
  17501. messageSends: []
  17502. }),
  17503. $globals.TraitTransformation);
  17504. $core.addMethod(
  17505. $core.method({
  17506. selector: "fromJSON:",
  17507. protocol: "instance creation",
  17508. fn: function (aJSObject){
  17509. var self=this,$self=this;
  17510. return $core.withContext(function($ctx1) {
  17511. var $1,$4,$3,$2;
  17512. $1=(
  17513. $ctx1.supercall = true,
  17514. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17515. $ctx1.supercall = false;
  17516. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17517. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17518. return $globals.HashedCollection._newFromPairs_([]);
  17519. }));
  17520. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17521. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17522. $2=$recv($3)._associations();
  17523. $recv($1)._addAliases_($2);
  17524. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17525. return [];
  17526. })));
  17527. return $recv($1)._yourself();
  17528. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17529. },
  17530. args: ["aJSObject"],
  17531. 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",
  17532. referencedClasses: ["Smalltalk"],
  17533. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17534. }),
  17535. $globals.TraitTransformation.a$cls);
  17536. $core.addMethod(
  17537. $core.method({
  17538. selector: "on:",
  17539. protocol: "instance creation",
  17540. fn: function (aTrait){
  17541. var self=this,$self=this;
  17542. return $core.withContext(function($ctx1) {
  17543. var $1;
  17544. $1=(
  17545. $ctx1.supercall = true,
  17546. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17547. $ctx1.supercall = false;
  17548. $recv($1)._trait_(aTrait);
  17549. return $recv($1)._yourself();
  17550. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17551. },
  17552. args: ["aTrait"],
  17553. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17554. referencedClasses: [],
  17555. messageSends: ["trait:", "new", "yourself"]
  17556. }),
  17557. $globals.TraitTransformation.a$cls);
  17558. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17559. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17560. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17561. $core.addMethod(
  17562. $core.method({
  17563. selector: "asTraitComposition",
  17564. protocol: "*Kernel-Classes",
  17565. fn: function (){
  17566. var self=this,$self=this;
  17567. return $core.withContext(function($ctx1) {
  17568. return $self._collect_((function(each){
  17569. return $core.withContext(function($ctx2) {
  17570. return $recv(each)._asTraitTransformation();
  17571. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17572. }));
  17573. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17574. },
  17575. args: [],
  17576. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17577. referencedClasses: [],
  17578. messageSends: ["collect:", "asTraitTransformation"]
  17579. }),
  17580. $globals.Array);
  17581. });
  17582. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17583. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17584. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17585. $core.addPackage("Kernel-Methods");
  17586. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17587. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17588. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17589. $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 | ... ] `";
  17590. $core.addMethod(
  17591. $core.method({
  17592. selector: "applyTo:arguments:",
  17593. protocol: "evaluating",
  17594. fn: function (anObject,aCollection){
  17595. var self=this,$self=this;
  17596. return $core.withContext(function($ctx1) {
  17597. return self.apply(anObject, aCollection);
  17598. return self;
  17599. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17600. },
  17601. args: ["anObject", "aCollection"],
  17602. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17603. referencedClasses: [],
  17604. messageSends: []
  17605. }),
  17606. $globals.BlockClosure);
  17607. $core.addMethod(
  17608. $core.method({
  17609. selector: "asCompiledMethod:",
  17610. protocol: "converting",
  17611. fn: function (aString){
  17612. var self=this,$self=this;
  17613. return $core.withContext(function($ctx1) {
  17614. return $core.method({selector:aString, fn:self});;
  17615. return self;
  17616. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17617. },
  17618. args: ["aString"],
  17619. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17620. referencedClasses: [],
  17621. messageSends: []
  17622. }),
  17623. $globals.BlockClosure);
  17624. $core.addMethod(
  17625. $core.method({
  17626. selector: "compiledSource",
  17627. protocol: "accessing",
  17628. fn: function (){
  17629. var self=this,$self=this;
  17630. return $core.withContext(function($ctx1) {
  17631. return self.toString();
  17632. return self;
  17633. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17634. },
  17635. args: [],
  17636. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17637. referencedClasses: [],
  17638. messageSends: []
  17639. }),
  17640. $globals.BlockClosure);
  17641. $core.addMethod(
  17642. $core.method({
  17643. selector: "currySelf",
  17644. protocol: "converting",
  17645. fn: function (){
  17646. var self=this,$self=this;
  17647. return $core.withContext(function($ctx1) {
  17648. return function () {
  17649. var args = [ this ];
  17650. args.push.apply(args, arguments);
  17651. return self.apply(null, args);
  17652. }
  17653. ;
  17654. return self;
  17655. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17656. },
  17657. args: [],
  17658. 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'>",
  17659. referencedClasses: [],
  17660. messageSends: []
  17661. }),
  17662. $globals.BlockClosure);
  17663. $core.addMethod(
  17664. $core.method({
  17665. selector: "ensure:",
  17666. protocol: "evaluating",
  17667. fn: function (aBlock){
  17668. var self=this,$self=this;
  17669. return $core.withContext(function($ctx1) {
  17670. try{return $self._value()}finally{aBlock._value()};
  17671. return self;
  17672. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17673. },
  17674. args: ["aBlock"],
  17675. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17676. referencedClasses: [],
  17677. messageSends: []
  17678. }),
  17679. $globals.BlockClosure);
  17680. $core.addMethod(
  17681. $core.method({
  17682. selector: "fork",
  17683. protocol: "timeout/interval",
  17684. fn: function (){
  17685. var self=this,$self=this;
  17686. return $core.withContext(function($ctx1) {
  17687. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17688. return self;
  17689. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17690. },
  17691. args: [],
  17692. source: "fork\x0a\x09ForkPool default fork: self",
  17693. referencedClasses: ["ForkPool"],
  17694. messageSends: ["fork:", "default"]
  17695. }),
  17696. $globals.BlockClosure);
  17697. $core.addMethod(
  17698. $core.method({
  17699. selector: "new",
  17700. protocol: "evaluating",
  17701. fn: function (){
  17702. var self=this,$self=this;
  17703. return $core.withContext(function($ctx1) {
  17704. return new self();
  17705. return self;
  17706. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17707. },
  17708. args: [],
  17709. 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()'>",
  17710. referencedClasses: [],
  17711. messageSends: []
  17712. }),
  17713. $globals.BlockClosure);
  17714. $core.addMethod(
  17715. $core.method({
  17716. selector: "newValue:",
  17717. protocol: "evaluating",
  17718. fn: function (anObject){
  17719. var self=this,$self=this;
  17720. return $core.withContext(function($ctx1) {
  17721. return $self._newWithValues_([anObject]);
  17722. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17723. },
  17724. args: ["anObject"],
  17725. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17726. referencedClasses: [],
  17727. messageSends: ["newWithValues:"]
  17728. }),
  17729. $globals.BlockClosure);
  17730. $core.addMethod(
  17731. $core.method({
  17732. selector: "newValue:value:",
  17733. protocol: "evaluating",
  17734. fn: function (anObject,anObject2){
  17735. var self=this,$self=this;
  17736. return $core.withContext(function($ctx1) {
  17737. return $self._newWithValues_([anObject,anObject2]);
  17738. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17739. },
  17740. args: ["anObject", "anObject2"],
  17741. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17742. referencedClasses: [],
  17743. messageSends: ["newWithValues:"]
  17744. }),
  17745. $globals.BlockClosure);
  17746. $core.addMethod(
  17747. $core.method({
  17748. selector: "newValue:value:value:",
  17749. protocol: "evaluating",
  17750. fn: function (anObject,anObject2,anObject3){
  17751. var self=this,$self=this;
  17752. return $core.withContext(function($ctx1) {
  17753. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17754. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17755. },
  17756. args: ["anObject", "anObject2", "anObject3"],
  17757. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17758. referencedClasses: [],
  17759. messageSends: ["newWithValues:"]
  17760. }),
  17761. $globals.BlockClosure);
  17762. $core.addMethod(
  17763. $core.method({
  17764. selector: "newWithValues:",
  17765. protocol: "evaluating",
  17766. fn: function (aCollection){
  17767. var self=this,$self=this;
  17768. return $core.withContext(function($ctx1) {
  17769. var object = Object.create(self.prototype);
  17770. var result = self.apply(object, aCollection);
  17771. return typeof result === "object" ? result : object;
  17772. ;
  17773. return self;
  17774. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17775. },
  17776. args: ["aCollection"],
  17777. 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'>",
  17778. referencedClasses: [],
  17779. messageSends: []
  17780. }),
  17781. $globals.BlockClosure);
  17782. $core.addMethod(
  17783. $core.method({
  17784. selector: "numArgs",
  17785. protocol: "accessing",
  17786. fn: function (){
  17787. var self=this,$self=this;
  17788. return $core.withContext(function($ctx1) {
  17789. return self.length;
  17790. return self;
  17791. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17792. },
  17793. args: [],
  17794. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17795. referencedClasses: [],
  17796. messageSends: []
  17797. }),
  17798. $globals.BlockClosure);
  17799. $core.addMethod(
  17800. $core.method({
  17801. selector: "on:do:",
  17802. protocol: "error handling",
  17803. fn: function (anErrorClass,aBlock){
  17804. var self=this,$self=this;
  17805. return $core.withContext(function($ctx1) {
  17806. var $1;
  17807. return $self._tryCatch_((function(error){
  17808. var smalltalkError;
  17809. return $core.withContext(function($ctx2) {
  17810. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17811. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17812. if($core.assert($1)){
  17813. return $recv(aBlock)._value_(smalltalkError);
  17814. } else {
  17815. return $recv(smalltalkError)._pass();
  17816. }
  17817. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17818. }));
  17819. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17820. },
  17821. args: ["anErrorClass", "aBlock"],
  17822. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError pass ] ]",
  17823. referencedClasses: ["Smalltalk"],
  17824. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17825. }),
  17826. $globals.BlockClosure);
  17827. $core.addMethod(
  17828. $core.method({
  17829. selector: "provided",
  17830. protocol: "converting",
  17831. fn: function (){
  17832. var self=this,$self=this;
  17833. return $core.withContext(function($ctx1) {
  17834. return $recv($globals.JSObjectProxy)._on_(self);
  17835. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.BlockClosure)});
  17836. },
  17837. args: [],
  17838. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17839. referencedClasses: ["JSObjectProxy"],
  17840. messageSends: ["on:"]
  17841. }),
  17842. $globals.BlockClosure);
  17843. $core.addMethod(
  17844. $core.method({
  17845. selector: "receiver",
  17846. protocol: "accessing",
  17847. fn: function (){
  17848. var self=this,$self=this;
  17849. return nil;
  17850. },
  17851. args: [],
  17852. source: "receiver\x0a\x09^ nil",
  17853. referencedClasses: [],
  17854. messageSends: []
  17855. }),
  17856. $globals.BlockClosure);
  17857. $core.addMethod(
  17858. $core.method({
  17859. selector: "timeToRun",
  17860. protocol: "evaluating",
  17861. fn: function (){
  17862. var self=this,$self=this;
  17863. return $core.withContext(function($ctx1) {
  17864. return $recv($globals.Date)._millisecondsToRun_(self);
  17865. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17866. },
  17867. args: [],
  17868. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17869. referencedClasses: ["Date"],
  17870. messageSends: ["millisecondsToRun:"]
  17871. }),
  17872. $globals.BlockClosure);
  17873. $core.addMethod(
  17874. $core.method({
  17875. selector: "tryCatch:",
  17876. protocol: "error handling",
  17877. fn: function (aBlock){
  17878. var self=this,$self=this;
  17879. return $core.withContext(function($ctx1) {
  17880. try {
  17881. return $self._value();
  17882. } catch(error) {
  17883. // pass non-local returns undetected
  17884. if (Array.isArray(error) && error.length === 1) throw error;
  17885. return aBlock._value_(error);
  17886. }
  17887. ;
  17888. return self;
  17889. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17890. },
  17891. args: ["aBlock"],
  17892. 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'>",
  17893. referencedClasses: [],
  17894. messageSends: []
  17895. }),
  17896. $globals.BlockClosure);
  17897. $core.addMethod(
  17898. $core.method({
  17899. selector: "value",
  17900. protocol: "evaluating",
  17901. fn: function (){
  17902. var self=this,$self=this;
  17903. return $core.withContext(function($ctx1) {
  17904. return self();;
  17905. return self;
  17906. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17907. },
  17908. args: [],
  17909. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17910. referencedClasses: [],
  17911. messageSends: []
  17912. }),
  17913. $globals.BlockClosure);
  17914. $core.addMethod(
  17915. $core.method({
  17916. selector: "value:",
  17917. protocol: "evaluating",
  17918. fn: function (anArg){
  17919. var self=this,$self=this;
  17920. return $core.withContext(function($ctx1) {
  17921. return self(anArg);;
  17922. return self;
  17923. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17924. },
  17925. args: ["anArg"],
  17926. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17927. referencedClasses: [],
  17928. messageSends: []
  17929. }),
  17930. $globals.BlockClosure);
  17931. $core.addMethod(
  17932. $core.method({
  17933. selector: "value:value:",
  17934. protocol: "evaluating",
  17935. fn: function (firstArg,secondArg){
  17936. var self=this,$self=this;
  17937. return $core.withContext(function($ctx1) {
  17938. return self(firstArg, secondArg);;
  17939. return self;
  17940. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17941. },
  17942. args: ["firstArg", "secondArg"],
  17943. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17944. referencedClasses: [],
  17945. messageSends: []
  17946. }),
  17947. $globals.BlockClosure);
  17948. $core.addMethod(
  17949. $core.method({
  17950. selector: "value:value:value:",
  17951. protocol: "evaluating",
  17952. fn: function (firstArg,secondArg,thirdArg){
  17953. var self=this,$self=this;
  17954. return $core.withContext(function($ctx1) {
  17955. return self(firstArg, secondArg, thirdArg);;
  17956. return self;
  17957. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17958. },
  17959. args: ["firstArg", "secondArg", "thirdArg"],
  17960. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17961. referencedClasses: [],
  17962. messageSends: []
  17963. }),
  17964. $globals.BlockClosure);
  17965. $core.addMethod(
  17966. $core.method({
  17967. selector: "valueWithInterval:",
  17968. protocol: "timeout/interval",
  17969. fn: function (aNumber){
  17970. var self=this,$self=this;
  17971. return $core.withContext(function($ctx1) {
  17972. var interval = setInterval(self, aNumber);
  17973. return $globals.Timeout._on_(interval);
  17974. ;
  17975. return self;
  17976. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17977. },
  17978. args: ["aNumber"],
  17979. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17980. referencedClasses: [],
  17981. messageSends: []
  17982. }),
  17983. $globals.BlockClosure);
  17984. $core.addMethod(
  17985. $core.method({
  17986. selector: "valueWithPossibleArguments:",
  17987. protocol: "evaluating",
  17988. fn: function (aCollection){
  17989. var self=this,$self=this;
  17990. return $core.withContext(function($ctx1) {
  17991. return self.apply(null, aCollection);;
  17992. return self;
  17993. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17994. },
  17995. args: ["aCollection"],
  17996. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17997. referencedClasses: [],
  17998. messageSends: []
  17999. }),
  18000. $globals.BlockClosure);
  18001. $core.addMethod(
  18002. $core.method({
  18003. selector: "valueWithTimeout:",
  18004. protocol: "timeout/interval",
  18005. fn: function (aNumber){
  18006. var self=this,$self=this;
  18007. return $core.withContext(function($ctx1) {
  18008. var timeout = setTimeout(self, aNumber);
  18009. return $globals.Timeout._on_(timeout);
  18010. ;
  18011. return self;
  18012. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  18013. },
  18014. args: ["aNumber"],
  18015. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  18016. referencedClasses: [],
  18017. messageSends: []
  18018. }),
  18019. $globals.BlockClosure);
  18020. $core.addMethod(
  18021. $core.method({
  18022. selector: "whileFalse",
  18023. protocol: "controlling",
  18024. fn: function (){
  18025. var self=this,$self=this;
  18026. return $core.withContext(function($ctx1) {
  18027. $self._whileFalse_((function(){
  18028. }));
  18029. return self;
  18030. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  18031. },
  18032. args: [],
  18033. source: "whileFalse\x0a\x09self whileFalse: []",
  18034. referencedClasses: [],
  18035. messageSends: ["whileFalse:"]
  18036. }),
  18037. $globals.BlockClosure);
  18038. $core.addMethod(
  18039. $core.method({
  18040. selector: "whileFalse:",
  18041. protocol: "controlling",
  18042. fn: function (aBlock){
  18043. var self=this,$self=this;
  18044. return $core.withContext(function($ctx1) {
  18045. while(!$core.assert($self._value())) {aBlock._value()};
  18046. return self;
  18047. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  18048. },
  18049. args: ["aBlock"],
  18050. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  18051. referencedClasses: [],
  18052. messageSends: []
  18053. }),
  18054. $globals.BlockClosure);
  18055. $core.addMethod(
  18056. $core.method({
  18057. selector: "whileTrue",
  18058. protocol: "controlling",
  18059. fn: function (){
  18060. var self=this,$self=this;
  18061. return $core.withContext(function($ctx1) {
  18062. $self._whileTrue_((function(){
  18063. }));
  18064. return self;
  18065. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  18066. },
  18067. args: [],
  18068. source: "whileTrue\x0a\x09self whileTrue: []",
  18069. referencedClasses: [],
  18070. messageSends: ["whileTrue:"]
  18071. }),
  18072. $globals.BlockClosure);
  18073. $core.addMethod(
  18074. $core.method({
  18075. selector: "whileTrue:",
  18076. protocol: "controlling",
  18077. fn: function (aBlock){
  18078. var self=this,$self=this;
  18079. return $core.withContext(function($ctx1) {
  18080. while($core.assert($self._value())) {aBlock._value()};
  18081. return self;
  18082. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  18083. },
  18084. args: ["aBlock"],
  18085. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18086. referencedClasses: [],
  18087. messageSends: []
  18088. }),
  18089. $globals.BlockClosure);
  18090. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  18091. $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";
  18092. $core.addMethod(
  18093. $core.method({
  18094. selector: "arguments",
  18095. protocol: "accessing",
  18096. fn: function (){
  18097. var self=this,$self=this;
  18098. return $core.withContext(function($ctx1) {
  18099. return self.args || [];
  18100. return self;
  18101. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18102. },
  18103. args: [],
  18104. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  18105. referencedClasses: [],
  18106. messageSends: []
  18107. }),
  18108. $globals.CompiledMethod);
  18109. $core.addMethod(
  18110. $core.method({
  18111. selector: "browse",
  18112. protocol: "browsing",
  18113. fn: function (){
  18114. var self=this,$self=this;
  18115. return $core.withContext(function($ctx1) {
  18116. $recv($globals.Finder)._findMethod_(self);
  18117. return self;
  18118. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18119. },
  18120. args: [],
  18121. source: "browse\x0a\x09Finder findMethod: self",
  18122. referencedClasses: ["Finder"],
  18123. messageSends: ["findMethod:"]
  18124. }),
  18125. $globals.CompiledMethod);
  18126. $core.addMethod(
  18127. $core.method({
  18128. selector: "category",
  18129. protocol: "accessing",
  18130. fn: function (){
  18131. var self=this,$self=this;
  18132. return $core.withContext(function($ctx1) {
  18133. return $self._protocol();
  18134. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18135. },
  18136. args: [],
  18137. source: "category\x0a\x09^ self protocol",
  18138. referencedClasses: [],
  18139. messageSends: ["protocol"]
  18140. }),
  18141. $globals.CompiledMethod);
  18142. $core.addMethod(
  18143. $core.method({
  18144. selector: "defaultProtocol",
  18145. protocol: "defaults",
  18146. fn: function (){
  18147. var self=this,$self=this;
  18148. return "as yet unclassified";
  18149. },
  18150. args: [],
  18151. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18152. referencedClasses: [],
  18153. messageSends: []
  18154. }),
  18155. $globals.CompiledMethod);
  18156. $core.addMethod(
  18157. $core.method({
  18158. selector: "fn",
  18159. protocol: "accessing",
  18160. fn: function (){
  18161. var self=this,$self=this;
  18162. return $core.withContext(function($ctx1) {
  18163. return $self._basicAt_("fn");
  18164. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18165. },
  18166. args: [],
  18167. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18168. referencedClasses: [],
  18169. messageSends: ["basicAt:"]
  18170. }),
  18171. $globals.CompiledMethod);
  18172. $core.addMethod(
  18173. $core.method({
  18174. selector: "fn:",
  18175. protocol: "accessing",
  18176. fn: function (aBlock){
  18177. var self=this,$self=this;
  18178. return $core.withContext(function($ctx1) {
  18179. $self._basicAt_put_("fn",aBlock);
  18180. return self;
  18181. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18182. },
  18183. args: ["aBlock"],
  18184. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18185. referencedClasses: [],
  18186. messageSends: ["basicAt:put:"]
  18187. }),
  18188. $globals.CompiledMethod);
  18189. $core.addMethod(
  18190. $core.method({
  18191. selector: "isCompiledMethod",
  18192. protocol: "testing",
  18193. fn: function (){
  18194. var self=this,$self=this;
  18195. return true;
  18196. },
  18197. args: [],
  18198. source: "isCompiledMethod\x0a\x09^ true",
  18199. referencedClasses: [],
  18200. messageSends: []
  18201. }),
  18202. $globals.CompiledMethod);
  18203. $core.addMethod(
  18204. $core.method({
  18205. selector: "isOverridden",
  18206. protocol: "testing",
  18207. fn: function (){
  18208. var self=this,$self=this;
  18209. var selector;
  18210. return $core.withContext(function($ctx1) {
  18211. var $1;
  18212. var $early={};
  18213. try {
  18214. selector=$self._selector();
  18215. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18216. return $core.withContext(function($ctx2) {
  18217. $1=$recv(each)._includesSelector_(selector);
  18218. if($core.assert($1)){
  18219. throw $early=[true];
  18220. }
  18221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18222. }));
  18223. return false;
  18224. }
  18225. catch(e) {if(e===$early)return e[0]; throw e}
  18226. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18227. },
  18228. args: [],
  18229. 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",
  18230. referencedClasses: [],
  18231. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18232. }),
  18233. $globals.CompiledMethod);
  18234. $core.addMethod(
  18235. $core.method({
  18236. selector: "isOverride",
  18237. protocol: "testing",
  18238. fn: function (){
  18239. var self=this,$self=this;
  18240. var superclass;
  18241. return $core.withContext(function($ctx1) {
  18242. var $1,$2,$receiver;
  18243. $1=$self._methodClass();
  18244. $ctx1.sendIdx["methodClass"]=1;
  18245. superclass=$recv($1)._superclass();
  18246. $ctx1.sendIdx["superclass"]=1;
  18247. $2=superclass;
  18248. if(($receiver = $2) == null || $receiver.a$nil){
  18249. return false;
  18250. } else {
  18251. $2;
  18252. }
  18253. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18254. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18255. },
  18256. args: [],
  18257. 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",
  18258. referencedClasses: [],
  18259. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18260. }),
  18261. $globals.CompiledMethod);
  18262. $core.addMethod(
  18263. $core.method({
  18264. selector: "messageSends",
  18265. protocol: "accessing",
  18266. fn: function (){
  18267. var self=this,$self=this;
  18268. return $core.withContext(function($ctx1) {
  18269. return $self._basicAt_("messageSends");
  18270. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18271. },
  18272. args: [],
  18273. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18274. referencedClasses: [],
  18275. messageSends: ["basicAt:"]
  18276. }),
  18277. $globals.CompiledMethod);
  18278. $core.addMethod(
  18279. $core.method({
  18280. selector: "methodClass",
  18281. protocol: "accessing",
  18282. fn: function (){
  18283. var self=this,$self=this;
  18284. return $core.withContext(function($ctx1) {
  18285. return $self._basicAt_("owner");
  18286. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18287. },
  18288. args: [],
  18289. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18290. referencedClasses: [],
  18291. messageSends: ["basicAt:"]
  18292. }),
  18293. $globals.CompiledMethod);
  18294. $core.addMethod(
  18295. $core.method({
  18296. selector: "package",
  18297. protocol: "accessing",
  18298. fn: function (){
  18299. var self=this,$self=this;
  18300. return $core.withContext(function($ctx1) {
  18301. var $1,$receiver;
  18302. $1=$self._methodClass();
  18303. if(($receiver = $1) == null || $receiver.a$nil){
  18304. return $1;
  18305. } else {
  18306. var class_;
  18307. class_=$receiver;
  18308. return $recv(class_)._packageOfProtocol_($self._protocol());
  18309. }
  18310. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18311. },
  18312. args: [],
  18313. 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 ]",
  18314. referencedClasses: [],
  18315. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18316. }),
  18317. $globals.CompiledMethod);
  18318. $core.addMethod(
  18319. $core.method({
  18320. selector: "protocol",
  18321. protocol: "accessing",
  18322. fn: function (){
  18323. var self=this,$self=this;
  18324. return $core.withContext(function($ctx1) {
  18325. var $1,$receiver;
  18326. $1=$self._basicAt_("protocol");
  18327. if(($receiver = $1) == null || $receiver.a$nil){
  18328. return $self._defaultProtocol();
  18329. } else {
  18330. return $1;
  18331. }
  18332. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18333. },
  18334. args: [],
  18335. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18336. referencedClasses: [],
  18337. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18338. }),
  18339. $globals.CompiledMethod);
  18340. $core.addMethod(
  18341. $core.method({
  18342. selector: "protocol:",
  18343. protocol: "accessing",
  18344. fn: function (aString){
  18345. var self=this,$self=this;
  18346. var oldProtocol;
  18347. return $core.withContext(function($ctx1) {
  18348. var $1,$3,$2,$4,$receiver;
  18349. oldProtocol=$self._protocol();
  18350. $self._basicAt_put_("protocol",aString);
  18351. $1=$recv($globals.SystemAnnouncer)._current();
  18352. $3=$recv($globals.MethodMoved)._new();
  18353. $recv($3)._method_(self);
  18354. $recv($3)._oldProtocol_(oldProtocol);
  18355. $2=$recv($3)._yourself();
  18356. $recv($1)._announce_($2);
  18357. $4=$self._methodClass();
  18358. if(($receiver = $4) == null || $receiver.a$nil){
  18359. $4;
  18360. } else {
  18361. var methodClass;
  18362. methodClass=$receiver;
  18363. $recv($recv(methodClass)._organization())._addElement_(aString);
  18364. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18365. }
  18366. return self;
  18367. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18368. },
  18369. args: ["aString"],
  18370. 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 ]",
  18371. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18372. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18373. }),
  18374. $globals.CompiledMethod);
  18375. $core.addMethod(
  18376. $core.method({
  18377. selector: "referencedClasses",
  18378. protocol: "accessing",
  18379. fn: function (){
  18380. var self=this,$self=this;
  18381. return $core.withContext(function($ctx1) {
  18382. return $self._basicAt_("referencedClasses");
  18383. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18384. },
  18385. args: [],
  18386. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18387. referencedClasses: [],
  18388. messageSends: ["basicAt:"]
  18389. }),
  18390. $globals.CompiledMethod);
  18391. $core.addMethod(
  18392. $core.method({
  18393. selector: "selector",
  18394. protocol: "accessing",
  18395. fn: function (){
  18396. var self=this,$self=this;
  18397. return $core.withContext(function($ctx1) {
  18398. return $self._basicAt_("selector");
  18399. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18400. },
  18401. args: [],
  18402. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18403. referencedClasses: [],
  18404. messageSends: ["basicAt:"]
  18405. }),
  18406. $globals.CompiledMethod);
  18407. $core.addMethod(
  18408. $core.method({
  18409. selector: "selector:",
  18410. protocol: "accessing",
  18411. fn: function (aString){
  18412. var self=this,$self=this;
  18413. return $core.withContext(function($ctx1) {
  18414. $self._basicAt_put_("selector",aString);
  18415. return self;
  18416. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18417. },
  18418. args: ["aString"],
  18419. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18420. referencedClasses: [],
  18421. messageSends: ["basicAt:put:"]
  18422. }),
  18423. $globals.CompiledMethod);
  18424. $core.addMethod(
  18425. $core.method({
  18426. selector: "sendTo:arguments:",
  18427. protocol: "evaluating",
  18428. fn: function (anObject,aCollection){
  18429. var self=this,$self=this;
  18430. return $core.withContext(function($ctx1) {
  18431. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18432. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18433. },
  18434. args: ["anObject", "aCollection"],
  18435. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18436. referencedClasses: [],
  18437. messageSends: ["applyTo:arguments:", "fn"]
  18438. }),
  18439. $globals.CompiledMethod);
  18440. $core.addMethod(
  18441. $core.method({
  18442. selector: "source",
  18443. protocol: "accessing",
  18444. fn: function (){
  18445. var self=this,$self=this;
  18446. return $core.withContext(function($ctx1) {
  18447. var $1,$receiver;
  18448. $1=$self._basicAt_("source");
  18449. if(($receiver = $1) == null || $receiver.a$nil){
  18450. return "";
  18451. } else {
  18452. return $1;
  18453. }
  18454. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18455. },
  18456. args: [],
  18457. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18458. referencedClasses: [],
  18459. messageSends: ["ifNil:", "basicAt:"]
  18460. }),
  18461. $globals.CompiledMethod);
  18462. $core.addMethod(
  18463. $core.method({
  18464. selector: "source:",
  18465. protocol: "accessing",
  18466. fn: function (aString){
  18467. var self=this,$self=this;
  18468. return $core.withContext(function($ctx1) {
  18469. $self._basicAt_put_("source",aString);
  18470. return self;
  18471. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18472. },
  18473. args: ["aString"],
  18474. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18475. referencedClasses: [],
  18476. messageSends: ["basicAt:put:"]
  18477. }),
  18478. $globals.CompiledMethod);
  18479. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18480. $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`";
  18481. $core.addMethod(
  18482. $core.method({
  18483. selector: "addWorker",
  18484. protocol: "private",
  18485. fn: function (){
  18486. var self=this,$self=this;
  18487. return $core.withContext(function($ctx1) {
  18488. $recv($self["@worker"])._valueWithTimeout_((0));
  18489. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18490. return self;
  18491. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18492. },
  18493. args: [],
  18494. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18495. referencedClasses: [],
  18496. messageSends: ["valueWithTimeout:", "+"]
  18497. }),
  18498. $globals.ForkPool);
  18499. $core.addMethod(
  18500. $core.method({
  18501. selector: "defaultMaxPoolSize",
  18502. protocol: "defaults",
  18503. fn: function (){
  18504. var self=this,$self=this;
  18505. return $core.withContext(function($ctx1) {
  18506. return $recv($self._class())._defaultMaxPoolSize();
  18507. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18508. },
  18509. args: [],
  18510. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18511. referencedClasses: [],
  18512. messageSends: ["defaultMaxPoolSize", "class"]
  18513. }),
  18514. $globals.ForkPool);
  18515. $core.addMethod(
  18516. $core.method({
  18517. selector: "fork:",
  18518. protocol: "actions",
  18519. fn: function (aBlock){
  18520. var self=this,$self=this;
  18521. return $core.withContext(function($ctx1) {
  18522. var $1;
  18523. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18524. if($core.assert($1)){
  18525. $self._addWorker();
  18526. }
  18527. $recv($self["@queue"])._nextPut_(aBlock);
  18528. return self;
  18529. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18530. },
  18531. args: ["aBlock"],
  18532. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18533. referencedClasses: [],
  18534. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18535. }),
  18536. $globals.ForkPool);
  18537. $core.addMethod(
  18538. $core.method({
  18539. selector: "initialize",
  18540. protocol: "initialization",
  18541. fn: function (){
  18542. var self=this,$self=this;
  18543. return $core.withContext(function($ctx1) {
  18544. (
  18545. $ctx1.supercall = true,
  18546. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18547. $ctx1.supercall = false;
  18548. $self["@poolSize"]=(0);
  18549. $self["@queue"]=$recv($globals.Queue)._new();
  18550. $self["@worker"]=$self._makeWorker();
  18551. return self;
  18552. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18553. },
  18554. args: [],
  18555. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18556. referencedClasses: ["Queue"],
  18557. messageSends: ["initialize", "new", "makeWorker"]
  18558. }),
  18559. $globals.ForkPool);
  18560. $core.addMethod(
  18561. $core.method({
  18562. selector: "makeWorker",
  18563. protocol: "initialization",
  18564. fn: function (){
  18565. var self=this,$self=this;
  18566. var sentinel;
  18567. return $core.withContext(function($ctx1) {
  18568. var $1;
  18569. sentinel=$recv($globals.Object)._new();
  18570. return (function(){
  18571. var block;
  18572. return $core.withContext(function($ctx2) {
  18573. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18574. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18575. return sentinel;
  18576. }));
  18577. $1=$recv(block).__eq_eq(sentinel);
  18578. if(!$core.assert($1)){
  18579. return $recv((function(){
  18580. return $core.withContext(function($ctx3) {
  18581. return $recv(block)._value();
  18582. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18583. }))._ensure_((function(){
  18584. return $core.withContext(function($ctx3) {
  18585. return $self._addWorker();
  18586. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18587. }));
  18588. }
  18589. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18590. });
  18591. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18592. },
  18593. args: [],
  18594. 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 ] ]]",
  18595. referencedClasses: ["Object"],
  18596. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18597. }),
  18598. $globals.ForkPool);
  18599. $core.addMethod(
  18600. $core.method({
  18601. selector: "maxPoolSize",
  18602. protocol: "accessing",
  18603. fn: function (){
  18604. var self=this,$self=this;
  18605. return $core.withContext(function($ctx1) {
  18606. var $1,$receiver;
  18607. $1=$self["@maxPoolSize"];
  18608. if(($receiver = $1) == null || $receiver.a$nil){
  18609. return $self._defaultMaxPoolSize();
  18610. } else {
  18611. return $1;
  18612. }
  18613. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18614. },
  18615. args: [],
  18616. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18617. referencedClasses: [],
  18618. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18619. }),
  18620. $globals.ForkPool);
  18621. $core.addMethod(
  18622. $core.method({
  18623. selector: "maxPoolSize:",
  18624. protocol: "accessing",
  18625. fn: function (anInteger){
  18626. var self=this,$self=this;
  18627. $self["@maxPoolSize"]=anInteger;
  18628. return self;
  18629. },
  18630. args: ["anInteger"],
  18631. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18632. referencedClasses: [],
  18633. messageSends: []
  18634. }),
  18635. $globals.ForkPool);
  18636. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18637. $core.addMethod(
  18638. $core.method({
  18639. selector: "default",
  18640. protocol: "accessing",
  18641. fn: function (){
  18642. var self=this,$self=this;
  18643. return $core.withContext(function($ctx1) {
  18644. var $1,$receiver;
  18645. $1=$self["@default"];
  18646. if(($receiver = $1) == null || $receiver.a$nil){
  18647. $self["@default"]=$self._new();
  18648. return $self["@default"];
  18649. } else {
  18650. return $1;
  18651. }
  18652. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18653. },
  18654. args: [],
  18655. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18656. referencedClasses: [],
  18657. messageSends: ["ifNil:", "new"]
  18658. }),
  18659. $globals.ForkPool.a$cls);
  18660. $core.addMethod(
  18661. $core.method({
  18662. selector: "defaultMaxPoolSize",
  18663. protocol: "accessing",
  18664. fn: function (){
  18665. var self=this,$self=this;
  18666. return (100);
  18667. },
  18668. args: [],
  18669. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18670. referencedClasses: [],
  18671. messageSends: []
  18672. }),
  18673. $globals.ForkPool.a$cls);
  18674. $core.addMethod(
  18675. $core.method({
  18676. selector: "resetDefault",
  18677. protocol: "accessing",
  18678. fn: function (){
  18679. var self=this,$self=this;
  18680. $self["@default"]=nil;
  18681. return self;
  18682. },
  18683. args: [],
  18684. source: "resetDefault\x0a\x09default := nil",
  18685. referencedClasses: [],
  18686. messageSends: []
  18687. }),
  18688. $globals.ForkPool.a$cls);
  18689. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18690. $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.";
  18691. $core.addMethod(
  18692. $core.method({
  18693. selector: "arguments",
  18694. protocol: "accessing",
  18695. fn: function (){
  18696. var self=this,$self=this;
  18697. return $self["@arguments"];
  18698. },
  18699. args: [],
  18700. source: "arguments\x0a\x09^ arguments",
  18701. referencedClasses: [],
  18702. messageSends: []
  18703. }),
  18704. $globals.Message);
  18705. $core.addMethod(
  18706. $core.method({
  18707. selector: "arguments:",
  18708. protocol: "accessing",
  18709. fn: function (anArray){
  18710. var self=this,$self=this;
  18711. $self["@arguments"]=anArray;
  18712. return self;
  18713. },
  18714. args: ["anArray"],
  18715. source: "arguments: anArray\x0a\x09arguments := anArray",
  18716. referencedClasses: [],
  18717. messageSends: []
  18718. }),
  18719. $globals.Message);
  18720. $core.addMethod(
  18721. $core.method({
  18722. selector: "printOn:",
  18723. protocol: "printing",
  18724. fn: function (aStream){
  18725. var self=this,$self=this;
  18726. return $core.withContext(function($ctx1) {
  18727. (
  18728. $ctx1.supercall = true,
  18729. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18730. $ctx1.supercall = false;
  18731. $recv(aStream)._nextPutAll_("(");
  18732. $ctx1.sendIdx["nextPutAll:"]=1;
  18733. $recv(aStream)._nextPutAll_($self._selector());
  18734. $ctx1.sendIdx["nextPutAll:"]=2;
  18735. $recv(aStream)._nextPutAll_(")");
  18736. return self;
  18737. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18738. },
  18739. args: ["aStream"],
  18740. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18741. referencedClasses: [],
  18742. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18743. }),
  18744. $globals.Message);
  18745. $core.addMethod(
  18746. $core.method({
  18747. selector: "selector",
  18748. protocol: "accessing",
  18749. fn: function (){
  18750. var self=this,$self=this;
  18751. return $self["@selector"];
  18752. },
  18753. args: [],
  18754. source: "selector\x0a\x09^ selector",
  18755. referencedClasses: [],
  18756. messageSends: []
  18757. }),
  18758. $globals.Message);
  18759. $core.addMethod(
  18760. $core.method({
  18761. selector: "selector:",
  18762. protocol: "accessing",
  18763. fn: function (aString){
  18764. var self=this,$self=this;
  18765. $self["@selector"]=aString;
  18766. return self;
  18767. },
  18768. args: ["aString"],
  18769. source: "selector: aString\x0a\x09selector := aString",
  18770. referencedClasses: [],
  18771. messageSends: []
  18772. }),
  18773. $globals.Message);
  18774. $core.addMethod(
  18775. $core.method({
  18776. selector: "sendTo:",
  18777. protocol: "actions",
  18778. fn: function (anObject){
  18779. var self=this,$self=this;
  18780. return $core.withContext(function($ctx1) {
  18781. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18782. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18783. },
  18784. args: ["anObject"],
  18785. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18786. referencedClasses: [],
  18787. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18788. }),
  18789. $globals.Message);
  18790. $core.addMethod(
  18791. $core.method({
  18792. selector: "selector:arguments:",
  18793. protocol: "instance creation",
  18794. fn: function (aString,anArray){
  18795. var self=this,$self=this;
  18796. return $core.withContext(function($ctx1) {
  18797. var $1;
  18798. $1=$self._new();
  18799. $recv($1)._selector_(aString);
  18800. $recv($1)._arguments_(anArray);
  18801. return $recv($1)._yourself();
  18802. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18803. },
  18804. args: ["aString", "anArray"],
  18805. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18806. referencedClasses: [],
  18807. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18808. }),
  18809. $globals.Message.a$cls);
  18810. $core.addMethod(
  18811. $core.method({
  18812. selector: "selector:arguments:notUnderstoodBy:",
  18813. protocol: "dnu handling",
  18814. fn: function (aString,anArray,anObject){
  18815. var self=this,$self=this;
  18816. return $core.withContext(function($ctx1) {
  18817. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18818. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18819. },
  18820. args: ["aString", "anArray", "anObject"],
  18821. 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)",
  18822. referencedClasses: [],
  18823. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18824. }),
  18825. $globals.Message.a$cls);
  18826. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18827. $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.";
  18828. $core.addMethod(
  18829. $core.method({
  18830. selector: "arguments",
  18831. protocol: "accessing",
  18832. fn: function (){
  18833. var self=this,$self=this;
  18834. return $core.withContext(function($ctx1) {
  18835. return $recv($self["@message"])._arguments();
  18836. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18837. },
  18838. args: [],
  18839. source: "arguments\x0a\x09^ message arguments",
  18840. referencedClasses: [],
  18841. messageSends: ["arguments"]
  18842. }),
  18843. $globals.MessageSend);
  18844. $core.addMethod(
  18845. $core.method({
  18846. selector: "arguments:",
  18847. protocol: "accessing",
  18848. fn: function (aCollection){
  18849. var self=this,$self=this;
  18850. return $core.withContext(function($ctx1) {
  18851. $recv($self["@message"])._arguments_(aCollection);
  18852. return self;
  18853. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18854. },
  18855. args: ["aCollection"],
  18856. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18857. referencedClasses: [],
  18858. messageSends: ["arguments:"]
  18859. }),
  18860. $globals.MessageSend);
  18861. $core.addMethod(
  18862. $core.method({
  18863. selector: "initialize",
  18864. protocol: "initialization",
  18865. fn: function (){
  18866. var self=this,$self=this;
  18867. return $core.withContext(function($ctx1) {
  18868. (
  18869. $ctx1.supercall = true,
  18870. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18871. $ctx1.supercall = false;
  18872. $self["@message"]=$recv($globals.Message)._new();
  18873. return self;
  18874. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18875. },
  18876. args: [],
  18877. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18878. referencedClasses: ["Message"],
  18879. messageSends: ["initialize", "new"]
  18880. }),
  18881. $globals.MessageSend);
  18882. $core.addMethod(
  18883. $core.method({
  18884. selector: "printOn:",
  18885. protocol: "printing",
  18886. fn: function (aStream){
  18887. var self=this,$self=this;
  18888. return $core.withContext(function($ctx1) {
  18889. (
  18890. $ctx1.supercall = true,
  18891. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18892. $ctx1.supercall = false;
  18893. $recv(aStream)._nextPutAll_("(");
  18894. $ctx1.sendIdx["nextPutAll:"]=1;
  18895. $recv(aStream)._nextPutAll_($self._receiver());
  18896. $ctx1.sendIdx["nextPutAll:"]=2;
  18897. $recv(aStream)._nextPutAll_(" >> ");
  18898. $ctx1.sendIdx["nextPutAll:"]=3;
  18899. $recv(aStream)._nextPutAll_($self._selector());
  18900. $ctx1.sendIdx["nextPutAll:"]=4;
  18901. $recv(aStream)._nextPutAll_(")");
  18902. return self;
  18903. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18904. },
  18905. args: ["aStream"],
  18906. 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: ')'",
  18907. referencedClasses: [],
  18908. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18909. }),
  18910. $globals.MessageSend);
  18911. $core.addMethod(
  18912. $core.method({
  18913. selector: "receiver",
  18914. protocol: "accessing",
  18915. fn: function (){
  18916. var self=this,$self=this;
  18917. return $self["@receiver"];
  18918. },
  18919. args: [],
  18920. source: "receiver\x0a\x09^ receiver",
  18921. referencedClasses: [],
  18922. messageSends: []
  18923. }),
  18924. $globals.MessageSend);
  18925. $core.addMethod(
  18926. $core.method({
  18927. selector: "receiver:",
  18928. protocol: "accessing",
  18929. fn: function (anObject){
  18930. var self=this,$self=this;
  18931. $self["@receiver"]=anObject;
  18932. return self;
  18933. },
  18934. args: ["anObject"],
  18935. source: "receiver: anObject\x0a\x09receiver := anObject",
  18936. referencedClasses: [],
  18937. messageSends: []
  18938. }),
  18939. $globals.MessageSend);
  18940. $core.addMethod(
  18941. $core.method({
  18942. selector: "selector",
  18943. protocol: "accessing",
  18944. fn: function (){
  18945. var self=this,$self=this;
  18946. return $core.withContext(function($ctx1) {
  18947. return $recv($self["@message"])._selector();
  18948. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18949. },
  18950. args: [],
  18951. source: "selector\x0a\x09^ message selector",
  18952. referencedClasses: [],
  18953. messageSends: ["selector"]
  18954. }),
  18955. $globals.MessageSend);
  18956. $core.addMethod(
  18957. $core.method({
  18958. selector: "selector:",
  18959. protocol: "accessing",
  18960. fn: function (aString){
  18961. var self=this,$self=this;
  18962. return $core.withContext(function($ctx1) {
  18963. $recv($self["@message"])._selector_(aString);
  18964. return self;
  18965. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18966. },
  18967. args: ["aString"],
  18968. source: "selector: aString\x0a\x09message selector: aString",
  18969. referencedClasses: [],
  18970. messageSends: ["selector:"]
  18971. }),
  18972. $globals.MessageSend);
  18973. $core.addMethod(
  18974. $core.method({
  18975. selector: "value",
  18976. protocol: "evaluating",
  18977. fn: function (){
  18978. var self=this,$self=this;
  18979. return $core.withContext(function($ctx1) {
  18980. return $recv($self["@message"])._sendTo_($self._receiver());
  18981. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18982. },
  18983. args: [],
  18984. source: "value\x0a\x09^ message sendTo: self receiver",
  18985. referencedClasses: [],
  18986. messageSends: ["sendTo:", "receiver"]
  18987. }),
  18988. $globals.MessageSend);
  18989. $core.addMethod(
  18990. $core.method({
  18991. selector: "value:",
  18992. protocol: "evaluating",
  18993. fn: function (anObject){
  18994. var self=this,$self=this;
  18995. return $core.withContext(function($ctx1) {
  18996. var $1;
  18997. $1=$self["@message"];
  18998. $recv($1)._arguments_([anObject]);
  18999. return $recv($1)._sendTo_($self._receiver());
  19000. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  19001. },
  19002. args: ["anObject"],
  19003. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  19004. referencedClasses: [],
  19005. messageSends: ["arguments:", "sendTo:", "receiver"]
  19006. }),
  19007. $globals.MessageSend);
  19008. $core.addMethod(
  19009. $core.method({
  19010. selector: "value:value:",
  19011. protocol: "evaluating",
  19012. fn: function (firstArgument,secondArgument){
  19013. var self=this,$self=this;
  19014. return $core.withContext(function($ctx1) {
  19015. var $1;
  19016. $1=$self["@message"];
  19017. $recv($1)._arguments_([firstArgument,secondArgument]);
  19018. return $recv($1)._sendTo_($self._receiver());
  19019. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  19020. },
  19021. args: ["firstArgument", "secondArgument"],
  19022. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  19023. referencedClasses: [],
  19024. messageSends: ["arguments:", "sendTo:", "receiver"]
  19025. }),
  19026. $globals.MessageSend);
  19027. $core.addMethod(
  19028. $core.method({
  19029. selector: "value:value:value:",
  19030. protocol: "evaluating",
  19031. fn: function (firstArgument,secondArgument,thirdArgument){
  19032. var self=this,$self=this;
  19033. return $core.withContext(function($ctx1) {
  19034. var $1;
  19035. $1=$self["@message"];
  19036. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  19037. return $recv($1)._sendTo_($self._receiver());
  19038. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  19039. },
  19040. args: ["firstArgument", "secondArgument", "thirdArgument"],
  19041. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  19042. referencedClasses: [],
  19043. messageSends: ["arguments:", "sendTo:", "receiver"]
  19044. }),
  19045. $globals.MessageSend);
  19046. $core.addMethod(
  19047. $core.method({
  19048. selector: "valueWithPossibleArguments:",
  19049. protocol: "evaluating",
  19050. fn: function (aCollection){
  19051. var self=this,$self=this;
  19052. return $core.withContext(function($ctx1) {
  19053. $self._arguments_(aCollection);
  19054. return $self._value();
  19055. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  19056. },
  19057. args: ["aCollection"],
  19058. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  19059. referencedClasses: [],
  19060. messageSends: ["arguments:", "value"]
  19061. }),
  19062. $globals.MessageSend);
  19063. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  19064. $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`.";
  19065. $core.addMethod(
  19066. $core.method({
  19067. selector: "asString",
  19068. protocol: "converting",
  19069. fn: function (){
  19070. var self=this,$self=this;
  19071. return $core.withContext(function($ctx1) {
  19072. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  19073. $2=$self._isBlockContext();
  19074. if($core.assert($2)){
  19075. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  19076. $ctx1.sendIdx[","]=2;
  19077. $1=$recv($3).__comma(")");
  19078. $ctx1.sendIdx[","]=1;
  19079. } else {
  19080. var methodClass;
  19081. methodClass=$recv($self._method())._methodClass();
  19082. $5=methodClass;
  19083. $7=$self._receiver();
  19084. $ctx1.sendIdx["receiver"]=1;
  19085. $6=$recv($7)._class();
  19086. $ctx1.sendIdx["class"]=1;
  19087. $4=$recv($5).__eq($6);
  19088. if($core.assert($4)){
  19089. $11=$self._receiver();
  19090. $ctx1.sendIdx["receiver"]=2;
  19091. $10=$recv($11)._class();
  19092. $ctx1.sendIdx["class"]=2;
  19093. $9=$recv($10)._name();
  19094. $ctx1.sendIdx["name"]=1;
  19095. $8=$recv($9).__comma(" >> ");
  19096. $ctx1.sendIdx[","]=4;
  19097. $12=$self._selector();
  19098. $ctx1.sendIdx["selector"]=1;
  19099. $1=$recv($8).__comma($12);
  19100. $ctx1.sendIdx[","]=3;
  19101. } else {
  19102. $16=$recv($recv($self._receiver())._class())._name();
  19103. $ctx1.sendIdx["name"]=2;
  19104. $15=$recv($16).__comma("(");
  19105. $14=$recv($15).__comma($recv(methodClass)._name());
  19106. $ctx1.sendIdx[","]=7;
  19107. $13=$recv($14).__comma(") >> ");
  19108. $ctx1.sendIdx[","]=6;
  19109. $1=$recv($13).__comma($self._selector());
  19110. $ctx1.sendIdx[","]=5;
  19111. }
  19112. }
  19113. return $1;
  19114. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  19115. },
  19116. args: [],
  19117. 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 ] ]",
  19118. referencedClasses: [],
  19119. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19120. }),
  19121. $globals.MethodContext);
  19122. $core.addMethod(
  19123. $core.method({
  19124. selector: "basicReceiver",
  19125. protocol: "accessing",
  19126. fn: function (){
  19127. var self=this,$self=this;
  19128. return $core.withContext(function($ctx1) {
  19129. return self.receiver;
  19130. return self;
  19131. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  19132. },
  19133. args: [],
  19134. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  19135. referencedClasses: [],
  19136. messageSends: []
  19137. }),
  19138. $globals.MethodContext);
  19139. $core.addMethod(
  19140. $core.method({
  19141. selector: "evaluatedSelector",
  19142. protocol: "accessing",
  19143. fn: function (){
  19144. var self=this,$self=this;
  19145. return $core.withContext(function($ctx1) {
  19146. return self.evaluatedSelector;
  19147. return self;
  19148. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  19149. },
  19150. args: [],
  19151. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  19152. referencedClasses: [],
  19153. messageSends: []
  19154. }),
  19155. $globals.MethodContext);
  19156. $core.addMethod(
  19157. $core.method({
  19158. selector: "findContextSuchThat:",
  19159. protocol: "accessing",
  19160. fn: function (testBlock){
  19161. var self=this,$self=this;
  19162. var context;
  19163. return $core.withContext(function($ctx1) {
  19164. var $1;
  19165. var $early={};
  19166. try {
  19167. context=self;
  19168. $recv((function(){
  19169. return $core.withContext(function($ctx2) {
  19170. return $recv(context)._isNil();
  19171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19172. }))._whileFalse_((function(){
  19173. return $core.withContext(function($ctx2) {
  19174. $1=$recv(testBlock)._value_(context);
  19175. if($core.assert($1)){
  19176. throw $early=[context];
  19177. }
  19178. context=$recv(context)._outerContext();
  19179. return context;
  19180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19181. }));
  19182. return nil;
  19183. }
  19184. catch(e) {if(e===$early)return e[0]; throw e}
  19185. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19186. },
  19187. args: ["testBlock"],
  19188. 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",
  19189. referencedClasses: [],
  19190. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19191. }),
  19192. $globals.MethodContext);
  19193. $core.addMethod(
  19194. $core.method({
  19195. selector: "home",
  19196. protocol: "accessing",
  19197. fn: function (){
  19198. var self=this,$self=this;
  19199. return $core.withContext(function($ctx1) {
  19200. return self.homeContext;
  19201. return self;
  19202. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19203. },
  19204. args: [],
  19205. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19206. referencedClasses: [],
  19207. messageSends: []
  19208. }),
  19209. $globals.MethodContext);
  19210. $core.addMethod(
  19211. $core.method({
  19212. selector: "index",
  19213. protocol: "accessing",
  19214. fn: function (){
  19215. var self=this,$self=this;
  19216. return $core.withContext(function($ctx1) {
  19217. return self.index || 0;
  19218. return self;
  19219. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19220. },
  19221. args: [],
  19222. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19223. referencedClasses: [],
  19224. messageSends: []
  19225. }),
  19226. $globals.MethodContext);
  19227. $core.addMethod(
  19228. $core.method({
  19229. selector: "isBlockContext",
  19230. protocol: "testing",
  19231. fn: function (){
  19232. var self=this,$self=this;
  19233. return $core.withContext(function($ctx1) {
  19234. return $recv($self._selector())._isNil();
  19235. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19236. },
  19237. args: [],
  19238. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19239. referencedClasses: [],
  19240. messageSends: ["isNil", "selector"]
  19241. }),
  19242. $globals.MethodContext);
  19243. $core.addMethod(
  19244. $core.method({
  19245. selector: "locals",
  19246. protocol: "accessing",
  19247. fn: function (){
  19248. var self=this,$self=this;
  19249. return $core.withContext(function($ctx1) {
  19250. return self.locals || {};
  19251. return self;
  19252. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19253. },
  19254. args: [],
  19255. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19256. referencedClasses: [],
  19257. messageSends: []
  19258. }),
  19259. $globals.MethodContext);
  19260. $core.addMethod(
  19261. $core.method({
  19262. selector: "method",
  19263. protocol: "accessing",
  19264. fn: function (){
  19265. var self=this,$self=this;
  19266. var method,lookupClass,receiverClass,supercall;
  19267. return $core.withContext(function($ctx1) {
  19268. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19269. $1=$self._methodContext();
  19270. $ctx1.sendIdx["methodContext"]=1;
  19271. if(($receiver = $1) == null || $receiver.a$nil){
  19272. return nil;
  19273. } else {
  19274. $1;
  19275. }
  19276. $3=$self._methodContext();
  19277. $ctx1.sendIdx["methodContext"]=2;
  19278. $2=$recv($3)._receiver();
  19279. receiverClass=$recv($2)._class();
  19280. $4=receiverClass;
  19281. $6=$self._methodContext();
  19282. $ctx1.sendIdx["methodContext"]=3;
  19283. $5=$recv($6)._selector();
  19284. $ctx1.sendIdx["selector"]=1;
  19285. method=$recv($4)._lookupSelector_($5);
  19286. $ctx1.sendIdx["lookupSelector:"]=1;
  19287. $7=$self._outerContext();
  19288. if(($receiver = $7) == null || $receiver.a$nil){
  19289. supercall=false;
  19290. } else {
  19291. var outer;
  19292. outer=$receiver;
  19293. supercall=$recv(outer)._supercall();
  19294. }
  19295. $8=supercall;
  19296. if($core.assert($8)){
  19297. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19298. } else {
  19299. return method;
  19300. }
  19301. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19302. },
  19303. args: [],
  19304. 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 ]",
  19305. referencedClasses: [],
  19306. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19307. }),
  19308. $globals.MethodContext);
  19309. $core.addMethod(
  19310. $core.method({
  19311. selector: "methodContext",
  19312. protocol: "accessing",
  19313. fn: function (){
  19314. var self=this,$self=this;
  19315. return $core.withContext(function($ctx1) {
  19316. var $1,$2,$receiver;
  19317. $1=$self._isBlockContext();
  19318. if(!$core.assert($1)){
  19319. return self;
  19320. }
  19321. $2=$self._outerContext();
  19322. if(($receiver = $2) == null || $receiver.a$nil){
  19323. return $2;
  19324. } else {
  19325. var outer;
  19326. outer=$receiver;
  19327. return $recv(outer)._methodContext();
  19328. }
  19329. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19330. },
  19331. args: [],
  19332. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19333. referencedClasses: [],
  19334. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19335. }),
  19336. $globals.MethodContext);
  19337. $core.addMethod(
  19338. $core.method({
  19339. selector: "outerContext",
  19340. protocol: "accessing",
  19341. fn: function (){
  19342. var self=this,$self=this;
  19343. return $core.withContext(function($ctx1) {
  19344. return self.outerContext || self.homeContext;
  19345. return self;
  19346. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19347. },
  19348. args: [],
  19349. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19350. referencedClasses: [],
  19351. messageSends: []
  19352. }),
  19353. $globals.MethodContext);
  19354. $core.addMethod(
  19355. $core.method({
  19356. selector: "printOn:",
  19357. protocol: "printing",
  19358. fn: function (aStream){
  19359. var self=this,$self=this;
  19360. return $core.withContext(function($ctx1) {
  19361. (
  19362. $ctx1.supercall = true,
  19363. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19364. $ctx1.supercall = false;
  19365. $recv(aStream)._nextPutAll_("(");
  19366. $ctx1.sendIdx["nextPutAll:"]=1;
  19367. $recv(aStream)._nextPutAll_($self._asString());
  19368. $ctx1.sendIdx["nextPutAll:"]=2;
  19369. $recv(aStream)._nextPutAll_(")");
  19370. return self;
  19371. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19372. },
  19373. args: ["aStream"],
  19374. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19375. referencedClasses: [],
  19376. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19377. }),
  19378. $globals.MethodContext);
  19379. $core.addMethod(
  19380. $core.method({
  19381. selector: "receiver",
  19382. protocol: "accessing",
  19383. fn: function (){
  19384. var self=this,$self=this;
  19385. return $core.withContext(function($ctx1) {
  19386. var $2,$1;
  19387. $1=$recv($self._isBlockContext())._and_((function(){
  19388. return $core.withContext(function($ctx2) {
  19389. $2=$self._outerContext();
  19390. $ctx2.sendIdx["outerContext"]=1;
  19391. return $recv($2)._notNil();
  19392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19393. }));
  19394. if($core.assert($1)){
  19395. return $recv($self._outerContext())._receiver();
  19396. } else {
  19397. return $self._basicReceiver();
  19398. }
  19399. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19400. },
  19401. args: [],
  19402. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19403. referencedClasses: [],
  19404. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19405. }),
  19406. $globals.MethodContext);
  19407. $core.addMethod(
  19408. $core.method({
  19409. selector: "selector",
  19410. protocol: "accessing",
  19411. fn: function (){
  19412. var self=this,$self=this;
  19413. return $core.withContext(function($ctx1) {
  19414. if(self.selector) {
  19415. return $core.js2st(self.selector);
  19416. } else {
  19417. return nil;
  19418. }
  19419. ;
  19420. return self;
  19421. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19422. },
  19423. args: [],
  19424. 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'>",
  19425. referencedClasses: [],
  19426. messageSends: []
  19427. }),
  19428. $globals.MethodContext);
  19429. $core.addMethod(
  19430. $core.method({
  19431. selector: "sendIndexAt:",
  19432. protocol: "accessing",
  19433. fn: function (aSelector){
  19434. var self=this,$self=this;
  19435. return $core.withContext(function($ctx1) {
  19436. return self.sendIdx[aSelector] || 0;
  19437. return self;
  19438. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19439. },
  19440. args: ["aSelector"],
  19441. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19442. referencedClasses: [],
  19443. messageSends: []
  19444. }),
  19445. $globals.MethodContext);
  19446. $core.addMethod(
  19447. $core.method({
  19448. selector: "sendIndexes",
  19449. protocol: "accessing",
  19450. fn: function (){
  19451. var self=this,$self=this;
  19452. return $core.withContext(function($ctx1) {
  19453. return self.sendIdx;
  19454. return self;
  19455. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19456. },
  19457. args: [],
  19458. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19459. referencedClasses: [],
  19460. messageSends: []
  19461. }),
  19462. $globals.MethodContext);
  19463. $core.addMethod(
  19464. $core.method({
  19465. selector: "stubHere",
  19466. protocol: "accessing",
  19467. fn: function (){
  19468. var self=this,$self=this;
  19469. return $core.withContext(function($ctx1) {
  19470. self.homeContext = undefined;
  19471. return self;
  19472. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19473. },
  19474. args: [],
  19475. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19476. referencedClasses: [],
  19477. messageSends: []
  19478. }),
  19479. $globals.MethodContext);
  19480. $core.addMethod(
  19481. $core.method({
  19482. selector: "stubToAtMost:",
  19483. protocol: "error handling",
  19484. fn: function (anInteger){
  19485. var self=this,$self=this;
  19486. var context;
  19487. return $core.withContext(function($ctx1) {
  19488. var $1,$2,$receiver;
  19489. context=self;
  19490. $recv(anInteger)._timesRepeat_((function(){
  19491. return $core.withContext(function($ctx2) {
  19492. $1=context;
  19493. if(($receiver = $1) == null || $receiver.a$nil){
  19494. context=$1;
  19495. } else {
  19496. context=$recv(context)._home();
  19497. }
  19498. return context;
  19499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19500. }));
  19501. $2=context;
  19502. if(($receiver = $2) == null || $receiver.a$nil){
  19503. $2;
  19504. } else {
  19505. $recv(context)._stubHere();
  19506. }
  19507. return self;
  19508. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19509. },
  19510. args: ["anInteger"],
  19511. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19512. referencedClasses: [],
  19513. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19514. }),
  19515. $globals.MethodContext);
  19516. $core.addMethod(
  19517. $core.method({
  19518. selector: "supercall",
  19519. protocol: "accessing",
  19520. fn: function (){
  19521. var self=this,$self=this;
  19522. return $core.withContext(function($ctx1) {
  19523. return self.supercall == true;
  19524. return self;
  19525. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19526. },
  19527. args: [],
  19528. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19529. referencedClasses: [],
  19530. messageSends: []
  19531. }),
  19532. $globals.MethodContext);
  19533. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19534. $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' ]";
  19535. $core.addMethod(
  19536. $core.method({
  19537. selector: "constructorNamed:",
  19538. protocol: "instance creation",
  19539. fn: function (aString){
  19540. var self=this,$self=this;
  19541. return $core.withContext(function($ctx1) {
  19542. var nativeFunc=$globals.Platform._globals()[aString];
  19543. return new nativeFunc();
  19544. ;
  19545. return self;
  19546. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19547. },
  19548. args: ["aString"],
  19549. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19550. referencedClasses: [],
  19551. messageSends: []
  19552. }),
  19553. $globals.NativeFunction.a$cls);
  19554. $core.addMethod(
  19555. $core.method({
  19556. selector: "constructorNamed:value:",
  19557. protocol: "instance creation",
  19558. fn: function (aString,anObject){
  19559. var self=this,$self=this;
  19560. return $core.withContext(function($ctx1) {
  19561. var nativeFunc=$globals.Platform._globals()[aString];
  19562. return new nativeFunc(anObject);
  19563. ;
  19564. return self;
  19565. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19566. },
  19567. args: ["aString", "anObject"],
  19568. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19569. referencedClasses: [],
  19570. messageSends: []
  19571. }),
  19572. $globals.NativeFunction.a$cls);
  19573. $core.addMethod(
  19574. $core.method({
  19575. selector: "constructorNamed:value:value:",
  19576. protocol: "instance creation",
  19577. fn: function (aString,anObject,anObject2){
  19578. var self=this,$self=this;
  19579. return $core.withContext(function($ctx1) {
  19580. var nativeFunc=$globals.Platform._globals[aString];
  19581. return new nativeFunc(anObject,anObject2);
  19582. ;
  19583. return self;
  19584. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19585. },
  19586. args: ["aString", "anObject", "anObject2"],
  19587. 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'>",
  19588. referencedClasses: [],
  19589. messageSends: []
  19590. }),
  19591. $globals.NativeFunction.a$cls);
  19592. $core.addMethod(
  19593. $core.method({
  19594. selector: "constructorNamed:value:value:value:",
  19595. protocol: "instance creation",
  19596. fn: function (aString,anObject,anObject2,anObject3){
  19597. var self=this,$self=this;
  19598. return $core.withContext(function($ctx1) {
  19599. var nativeFunc=$globals.Platform._globals[aString];
  19600. return new nativeFunc(anObject,anObject2, anObject3);
  19601. ;
  19602. return self;
  19603. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19604. },
  19605. args: ["aString", "anObject", "anObject2", "anObject3"],
  19606. 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'>",
  19607. referencedClasses: [],
  19608. messageSends: []
  19609. }),
  19610. $globals.NativeFunction.a$cls);
  19611. $core.addMethod(
  19612. $core.method({
  19613. selector: "constructorOf:",
  19614. protocol: "instance creation",
  19615. fn: function (nativeFunc){
  19616. var self=this,$self=this;
  19617. return $core.withContext(function($ctx1) {
  19618. return new nativeFunc();
  19619. ;
  19620. return self;
  19621. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19622. },
  19623. args: ["nativeFunc"],
  19624. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19625. referencedClasses: [],
  19626. messageSends: []
  19627. }),
  19628. $globals.NativeFunction.a$cls);
  19629. $core.addMethod(
  19630. $core.method({
  19631. selector: "constructorOf:value:",
  19632. protocol: "instance creation",
  19633. fn: function (nativeFunc,anObject){
  19634. var self=this,$self=this;
  19635. return $core.withContext(function($ctx1) {
  19636. return new nativeFunc(anObject);
  19637. ;
  19638. return self;
  19639. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19640. },
  19641. args: ["nativeFunc", "anObject"],
  19642. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19643. referencedClasses: [],
  19644. messageSends: []
  19645. }),
  19646. $globals.NativeFunction.a$cls);
  19647. $core.addMethod(
  19648. $core.method({
  19649. selector: "constructorOf:value:value:",
  19650. protocol: "instance creation",
  19651. fn: function (nativeFunc,anObject,anObject2){
  19652. var self=this,$self=this;
  19653. return $core.withContext(function($ctx1) {
  19654. return new nativeFunc(anObject,anObject2);
  19655. ;
  19656. return self;
  19657. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19658. },
  19659. args: ["nativeFunc", "anObject", "anObject2"],
  19660. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19661. referencedClasses: [],
  19662. messageSends: []
  19663. }),
  19664. $globals.NativeFunction.a$cls);
  19665. $core.addMethod(
  19666. $core.method({
  19667. selector: "constructorOf:value:value:value:",
  19668. protocol: "instance creation",
  19669. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19670. var self=this,$self=this;
  19671. return $core.withContext(function($ctx1) {
  19672. return new nativeFunc(anObject,anObject2, anObject3);
  19673. ;
  19674. return self;
  19675. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19676. },
  19677. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19678. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19679. referencedClasses: [],
  19680. messageSends: []
  19681. }),
  19682. $globals.NativeFunction.a$cls);
  19683. $core.addMethod(
  19684. $core.method({
  19685. selector: "exists:",
  19686. protocol: "testing",
  19687. fn: function (aString){
  19688. var self=this,$self=this;
  19689. return $core.withContext(function($ctx1) {
  19690. return $recv($globals.Platform)._includesGlobal_(aString);
  19691. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19692. },
  19693. args: ["aString"],
  19694. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19695. referencedClasses: ["Platform"],
  19696. messageSends: ["includesGlobal:"]
  19697. }),
  19698. $globals.NativeFunction.a$cls);
  19699. $core.addMethod(
  19700. $core.method({
  19701. selector: "functionNamed:",
  19702. protocol: "function calling",
  19703. fn: function (aString){
  19704. var self=this,$self=this;
  19705. return $core.withContext(function($ctx1) {
  19706. var nativeFunc=$globals.Platform._globals[aString];
  19707. return nativeFunc();
  19708. ;
  19709. return self;
  19710. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19711. },
  19712. args: ["aString"],
  19713. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19714. referencedClasses: [],
  19715. messageSends: []
  19716. }),
  19717. $globals.NativeFunction.a$cls);
  19718. $core.addMethod(
  19719. $core.method({
  19720. selector: "functionNamed:value:",
  19721. protocol: "function calling",
  19722. fn: function (aString,anObject){
  19723. var self=this,$self=this;
  19724. return $core.withContext(function($ctx1) {
  19725. var nativeFunc=$globals.Platform._globals()[aString];
  19726. return nativeFunc(anObject);
  19727. ;
  19728. return self;
  19729. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19730. },
  19731. args: ["aString", "anObject"],
  19732. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19733. referencedClasses: [],
  19734. messageSends: []
  19735. }),
  19736. $globals.NativeFunction.a$cls);
  19737. $core.addMethod(
  19738. $core.method({
  19739. selector: "functionNamed:value:value:",
  19740. protocol: "function calling",
  19741. fn: function (aString,anObject,anObject2){
  19742. var self=this,$self=this;
  19743. return $core.withContext(function($ctx1) {
  19744. var nativeFunc=$globals.Platform._globals()[aString];
  19745. return nativeFunc(anObject,anObject2);
  19746. ;
  19747. return self;
  19748. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19749. },
  19750. args: ["aString", "anObject", "anObject2"],
  19751. 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'>",
  19752. referencedClasses: [],
  19753. messageSends: []
  19754. }),
  19755. $globals.NativeFunction.a$cls);
  19756. $core.addMethod(
  19757. $core.method({
  19758. selector: "functionNamed:value:value:value:",
  19759. protocol: "function calling",
  19760. fn: function (aString,anObject,anObject2,anObject3){
  19761. var self=this,$self=this;
  19762. return $core.withContext(function($ctx1) {
  19763. var nativeFunc=$globals.Platform._globals()[aString];
  19764. return nativeFunc(anObject,anObject2, anObject3);
  19765. ;
  19766. return self;
  19767. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19768. },
  19769. args: ["aString", "anObject", "anObject2", "anObject3"],
  19770. 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'>",
  19771. referencedClasses: [],
  19772. messageSends: []
  19773. }),
  19774. $globals.NativeFunction.a$cls);
  19775. $core.addMethod(
  19776. $core.method({
  19777. selector: "functionNamed:valueWithArgs:",
  19778. protocol: "function calling",
  19779. fn: function (aString,args){
  19780. var self=this,$self=this;
  19781. return $core.withContext(function($ctx1) {
  19782. var nativeFunc=$globals.Platform._globals()[aString];
  19783. return Function.prototype.apply.call(nativeFunc, null, args);
  19784. ;
  19785. return self;
  19786. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19787. },
  19788. args: ["aString", "args"],
  19789. 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'>",
  19790. referencedClasses: [],
  19791. messageSends: []
  19792. }),
  19793. $globals.NativeFunction.a$cls);
  19794. $core.addMethod(
  19795. $core.method({
  19796. selector: "functionOf:",
  19797. protocol: "function calling",
  19798. fn: function (nativeFunc){
  19799. var self=this,$self=this;
  19800. return $core.withContext(function($ctx1) {
  19801. return nativeFunc();
  19802. ;
  19803. return self;
  19804. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19805. },
  19806. args: ["nativeFunc"],
  19807. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19808. referencedClasses: [],
  19809. messageSends: []
  19810. }),
  19811. $globals.NativeFunction.a$cls);
  19812. $core.addMethod(
  19813. $core.method({
  19814. selector: "functionOf:value:",
  19815. protocol: "function calling",
  19816. fn: function (nativeFunc,anObject){
  19817. var self=this,$self=this;
  19818. return $core.withContext(function($ctx1) {
  19819. return nativeFunc(anObject);
  19820. ;
  19821. return self;
  19822. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19823. },
  19824. args: ["nativeFunc", "anObject"],
  19825. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19826. referencedClasses: [],
  19827. messageSends: []
  19828. }),
  19829. $globals.NativeFunction.a$cls);
  19830. $core.addMethod(
  19831. $core.method({
  19832. selector: "functionOf:value:value:",
  19833. protocol: "function calling",
  19834. fn: function (nativeFunc,anObject,anObject2){
  19835. var self=this,$self=this;
  19836. return $core.withContext(function($ctx1) {
  19837. return nativeFunc(anObject,anObject2);
  19838. ;
  19839. return self;
  19840. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19841. },
  19842. args: ["nativeFunc", "anObject", "anObject2"],
  19843. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19844. referencedClasses: [],
  19845. messageSends: []
  19846. }),
  19847. $globals.NativeFunction.a$cls);
  19848. $core.addMethod(
  19849. $core.method({
  19850. selector: "functionOf:value:value:value:",
  19851. protocol: "function calling",
  19852. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19853. var self=this,$self=this;
  19854. return $core.withContext(function($ctx1) {
  19855. return nativeFunc(anObject,anObject2, anObject3);
  19856. ;
  19857. return self;
  19858. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19859. },
  19860. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19861. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19862. referencedClasses: [],
  19863. messageSends: []
  19864. }),
  19865. $globals.NativeFunction.a$cls);
  19866. $core.addMethod(
  19867. $core.method({
  19868. selector: "functionOf:valueWithArgs:",
  19869. protocol: "function calling",
  19870. fn: function (nativeFunc,args){
  19871. var self=this,$self=this;
  19872. return $core.withContext(function($ctx1) {
  19873. return Function.prototype.apply.call(nativeFunc, null, args);
  19874. ;
  19875. return self;
  19876. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19877. },
  19878. args: ["nativeFunc", "args"],
  19879. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19880. referencedClasses: [],
  19881. messageSends: []
  19882. }),
  19883. $globals.NativeFunction.a$cls);
  19884. $core.addMethod(
  19885. $core.method({
  19886. selector: "isNativeFunction:",
  19887. protocol: "testing",
  19888. fn: function (anObject){
  19889. var self=this,$self=this;
  19890. return $core.withContext(function($ctx1) {
  19891. return typeof anObject === "function";
  19892. return self;
  19893. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19894. },
  19895. args: ["anObject"],
  19896. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19897. referencedClasses: [],
  19898. messageSends: []
  19899. }),
  19900. $globals.NativeFunction.a$cls);
  19901. $core.addMethod(
  19902. $core.method({
  19903. selector: "methodOf:this:",
  19904. protocol: "method calling",
  19905. fn: function (nativeFunc,thisObject){
  19906. var self=this,$self=this;
  19907. return $core.withContext(function($ctx1) {
  19908. return Function.prototype.call.call(nativeFunc, thisObject);
  19909. ;
  19910. return self;
  19911. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19912. },
  19913. args: ["nativeFunc", "thisObject"],
  19914. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19915. referencedClasses: [],
  19916. messageSends: []
  19917. }),
  19918. $globals.NativeFunction.a$cls);
  19919. $core.addMethod(
  19920. $core.method({
  19921. selector: "methodOf:this:value:",
  19922. protocol: "method calling",
  19923. fn: function (nativeFunc,thisObject,anObject){
  19924. var self=this,$self=this;
  19925. return $core.withContext(function($ctx1) {
  19926. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19927. ;
  19928. return self;
  19929. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19930. },
  19931. args: ["nativeFunc", "thisObject", "anObject"],
  19932. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19933. referencedClasses: [],
  19934. messageSends: []
  19935. }),
  19936. $globals.NativeFunction.a$cls);
  19937. $core.addMethod(
  19938. $core.method({
  19939. selector: "methodOf:this:value:value:",
  19940. protocol: "method calling",
  19941. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19942. var self=this,$self=this;
  19943. return $core.withContext(function($ctx1) {
  19944. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19945. ;
  19946. return self;
  19947. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19948. },
  19949. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19950. 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'>",
  19951. referencedClasses: [],
  19952. messageSends: []
  19953. }),
  19954. $globals.NativeFunction.a$cls);
  19955. $core.addMethod(
  19956. $core.method({
  19957. selector: "methodOf:this:value:value:value:",
  19958. protocol: "method calling",
  19959. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19960. var self=this,$self=this;
  19961. return $core.withContext(function($ctx1) {
  19962. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19963. ;
  19964. return self;
  19965. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19966. },
  19967. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19968. 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'>",
  19969. referencedClasses: [],
  19970. messageSends: []
  19971. }),
  19972. $globals.NativeFunction.a$cls);
  19973. $core.addMethod(
  19974. $core.method({
  19975. selector: "methodOf:this:valueWithArgs:",
  19976. protocol: "method calling",
  19977. fn: function (nativeFunc,thisObject,args){
  19978. var self=this,$self=this;
  19979. return $core.withContext(function($ctx1) {
  19980. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19981. ;
  19982. return self;
  19983. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19984. },
  19985. args: ["nativeFunc", "thisObject", "args"],
  19986. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19987. referencedClasses: [],
  19988. messageSends: []
  19989. }),
  19990. $globals.NativeFunction.a$cls);
  19991. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19992. $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.";
  19993. $core.addMethod(
  19994. $core.method({
  19995. selector: "clearInterval",
  19996. protocol: "timeout/interval",
  19997. fn: function (){
  19998. var self=this,$self=this;
  19999. return $core.withContext(function($ctx1) {
  20000. var interval = $self["@rawTimeout"];
  20001. clearInterval(interval);
  20002. ;
  20003. return self;
  20004. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  20005. },
  20006. args: [],
  20007. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  20008. referencedClasses: [],
  20009. messageSends: []
  20010. }),
  20011. $globals.Timeout);
  20012. $core.addMethod(
  20013. $core.method({
  20014. selector: "clearTimeout",
  20015. protocol: "timeout/interval",
  20016. fn: function (){
  20017. var self=this,$self=this;
  20018. return $core.withContext(function($ctx1) {
  20019. var timeout = $self["@rawTimeout"];
  20020. clearTimeout(timeout);
  20021. ;
  20022. return self;
  20023. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  20024. },
  20025. args: [],
  20026. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  20027. referencedClasses: [],
  20028. messageSends: []
  20029. }),
  20030. $globals.Timeout);
  20031. $core.addMethod(
  20032. $core.method({
  20033. selector: "rawTimeout:",
  20034. protocol: "accessing",
  20035. fn: function (anObject){
  20036. var self=this,$self=this;
  20037. $self["@rawTimeout"]=anObject;
  20038. return self;
  20039. },
  20040. args: ["anObject"],
  20041. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  20042. referencedClasses: [],
  20043. messageSends: []
  20044. }),
  20045. $globals.Timeout);
  20046. $core.addMethod(
  20047. $core.method({
  20048. selector: "on:",
  20049. protocol: "instance creation",
  20050. fn: function (anObject){
  20051. var self=this,$self=this;
  20052. return $core.withContext(function($ctx1) {
  20053. var $1;
  20054. $1=$self._new();
  20055. $recv($1)._rawTimeout_(anObject);
  20056. return $recv($1)._yourself();
  20057. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  20058. },
  20059. args: ["anObject"],
  20060. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  20061. referencedClasses: [],
  20062. messageSends: ["rawTimeout:", "new", "yourself"]
  20063. }),
  20064. $globals.Timeout.a$cls);
  20065. });
  20066. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20067. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20068. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20069. $core.addPackage("Kernel-Dag");
  20070. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  20071. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20072. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  20073. $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:`.";
  20074. $core.addMethod(
  20075. $core.method({
  20076. selector: "value:",
  20077. protocol: "evaluating",
  20078. fn: function (anObject){
  20079. var self=this,$self=this;
  20080. return $core.withContext(function($ctx1) {
  20081. return $self._visit_(anObject);
  20082. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  20083. },
  20084. args: ["anObject"],
  20085. source: "value: anObject\x0a\x09^ self visit: anObject",
  20086. referencedClasses: [],
  20087. messageSends: ["visit:"]
  20088. }),
  20089. $globals.AbstractDagVisitor);
  20090. $core.addMethod(
  20091. $core.method({
  20092. selector: "visit:",
  20093. protocol: "visiting",
  20094. fn: function (aNode){
  20095. var self=this,$self=this;
  20096. return $core.withContext(function($ctx1) {
  20097. return $recv(aNode)._acceptDagVisitor_(self);
  20098. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20099. },
  20100. args: ["aNode"],
  20101. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20102. referencedClasses: [],
  20103. messageSends: ["acceptDagVisitor:"]
  20104. }),
  20105. $globals.AbstractDagVisitor);
  20106. $core.addMethod(
  20107. $core.method({
  20108. selector: "visitAll:",
  20109. protocol: "visiting",
  20110. fn: function (aCollection){
  20111. var self=this,$self=this;
  20112. return $core.withContext(function($ctx1) {
  20113. return $recv(aCollection)._collect_((function(each){
  20114. return $core.withContext(function($ctx2) {
  20115. return $self._visit_(each);
  20116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20117. }));
  20118. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20119. },
  20120. args: ["aCollection"],
  20121. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20122. referencedClasses: [],
  20123. messageSends: ["collect:", "visit:"]
  20124. }),
  20125. $globals.AbstractDagVisitor);
  20126. $core.addMethod(
  20127. $core.method({
  20128. selector: "visitAllChildren:",
  20129. protocol: "visiting",
  20130. fn: function (aDagNode){
  20131. var self=this,$self=this;
  20132. return $core.withContext(function($ctx1) {
  20133. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20134. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20135. },
  20136. args: ["aDagNode"],
  20137. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20138. referencedClasses: [],
  20139. messageSends: ["visitAll:", "dagChildren"]
  20140. }),
  20141. $globals.AbstractDagVisitor);
  20142. $core.addMethod(
  20143. $core.method({
  20144. selector: "visitDagNode:",
  20145. protocol: "visiting",
  20146. fn: function (aNode){
  20147. var self=this,$self=this;
  20148. return $core.withContext(function($ctx1) {
  20149. $self._subclassResponsibility();
  20150. return self;
  20151. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20152. },
  20153. args: ["aNode"],
  20154. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20155. referencedClasses: [],
  20156. messageSends: ["subclassResponsibility"]
  20157. }),
  20158. $globals.AbstractDagVisitor);
  20159. $core.addMethod(
  20160. $core.method({
  20161. selector: "visitDagNodeVariantRedux:",
  20162. protocol: "visiting",
  20163. fn: function (aNode){
  20164. var self=this,$self=this;
  20165. var newChildren,oldChildren;
  20166. return $core.withContext(function($ctx1) {
  20167. var $2,$3,$1,$4,$5;
  20168. var $early={};
  20169. try {
  20170. oldChildren=$recv(aNode)._dagChildren();
  20171. newChildren=$self._visitAllChildren_(aNode);
  20172. $2=$recv(oldChildren)._size();
  20173. $ctx1.sendIdx["size"]=1;
  20174. $3=$recv(newChildren)._size();
  20175. $ctx1.sendIdx["size"]=2;
  20176. $1=$recv($2).__eq($3);
  20177. if($core.assert($1)){
  20178. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20179. return $core.withContext(function($ctx2) {
  20180. $4=$recv(oldChildren)._at_(i);
  20181. $ctx2.sendIdx["at:"]=1;
  20182. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20183. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20184. }),(function(){
  20185. throw $early=[aNode];
  20186. }));
  20187. }
  20188. $5=$recv(aNode)._copy();
  20189. $recv($5)._dagChildren_(newChildren);
  20190. return $recv($5)._yourself();
  20191. }
  20192. catch(e) {if(e===$early)return e[0]; throw e}
  20193. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20194. },
  20195. args: ["aNode"],
  20196. 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",
  20197. referencedClasses: [],
  20198. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20199. }),
  20200. $globals.AbstractDagVisitor);
  20201. $core.addMethod(
  20202. $core.method({
  20203. selector: "visitDagNodeVariantSimple:",
  20204. protocol: "visiting",
  20205. fn: function (aNode){
  20206. var self=this,$self=this;
  20207. return $core.withContext(function($ctx1) {
  20208. $self._visitAllChildren_(aNode);
  20209. return aNode;
  20210. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20211. },
  20212. args: ["aNode"],
  20213. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20214. referencedClasses: [],
  20215. messageSends: ["visitAllChildren:"]
  20216. }),
  20217. $globals.AbstractDagVisitor);
  20218. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20219. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20220. $core.addMethod(
  20221. $core.method({
  20222. selector: "initialize",
  20223. protocol: "initialization",
  20224. fn: function (){
  20225. var self=this,$self=this;
  20226. return $core.withContext(function($ctx1) {
  20227. (
  20228. $ctx1.supercall = true,
  20229. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20230. $ctx1.supercall = false;
  20231. $self["@path"]=[];
  20232. return self;
  20233. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20234. },
  20235. args: [],
  20236. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20237. referencedClasses: [],
  20238. messageSends: ["initialize"]
  20239. }),
  20240. $globals.PathDagVisitor);
  20241. $core.addMethod(
  20242. $core.method({
  20243. selector: "path",
  20244. protocol: "accessing",
  20245. fn: function (){
  20246. var self=this,$self=this;
  20247. return $self["@path"];
  20248. },
  20249. args: [],
  20250. source: "path\x0a\x09^ path",
  20251. referencedClasses: [],
  20252. messageSends: []
  20253. }),
  20254. $globals.PathDagVisitor);
  20255. $core.addMethod(
  20256. $core.method({
  20257. selector: "visit:",
  20258. protocol: "visiting",
  20259. fn: function (aNode){
  20260. var self=this,$self=this;
  20261. var oldPath,result;
  20262. return $core.withContext(function($ctx1) {
  20263. result=aNode;
  20264. oldPath=$self["@path"];
  20265. $recv((function(){
  20266. return $core.withContext(function($ctx2) {
  20267. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20268. result=(
  20269. $ctx2.supercall = true,
  20270. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20271. $ctx2.supercall = false;
  20272. return result;
  20273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20274. }))._ensure_((function(){
  20275. $self["@path"]=oldPath;
  20276. return $self["@path"];
  20277. }));
  20278. return result;
  20279. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20280. },
  20281. args: ["aNode"],
  20282. 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",
  20283. referencedClasses: [],
  20284. messageSends: ["ensure:", ",", "visit:"]
  20285. }),
  20286. $globals.PathDagVisitor);
  20287. $core.addMethod(
  20288. $core.method({
  20289. selector: "visitDagNodeVariantRedux:",
  20290. protocol: "visiting",
  20291. fn: function (aNode){
  20292. var self=this,$self=this;
  20293. var newNode;
  20294. return $core.withContext(function($ctx1) {
  20295. var $1;
  20296. newNode=(
  20297. $ctx1.supercall = true,
  20298. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20299. $ctx1.supercall = false;
  20300. $1=$recv(aNode).__eq_eq(newNode);
  20301. if(!$core.assert($1)){
  20302. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20303. }
  20304. return newNode;
  20305. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20306. },
  20307. args: ["aNode"],
  20308. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20309. referencedClasses: [],
  20310. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20311. }),
  20312. $globals.PathDagVisitor);
  20313. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20314. $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).";
  20315. $core.addMethod(
  20316. $core.method({
  20317. selector: "acceptDagVisitor:",
  20318. protocol: "visiting",
  20319. fn: function (aVisitor){
  20320. var self=this,$self=this;
  20321. return $core.withContext(function($ctx1) {
  20322. return $recv(aVisitor)._visitDagNode_(self);
  20323. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20324. },
  20325. args: ["aVisitor"],
  20326. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20327. referencedClasses: [],
  20328. messageSends: ["visitDagNode:"]
  20329. }),
  20330. $globals.DagNode);
  20331. $core.addMethod(
  20332. $core.method({
  20333. selector: "allDagChildren",
  20334. protocol: "accessing",
  20335. fn: function (){
  20336. var self=this,$self=this;
  20337. var allNodes;
  20338. return $core.withContext(function($ctx1) {
  20339. var $1;
  20340. $1=$self._dagChildren();
  20341. $ctx1.sendIdx["dagChildren"]=1;
  20342. allNodes=$recv($1)._asSet();
  20343. $recv($self._dagChildren())._do_((function(each){
  20344. return $core.withContext(function($ctx2) {
  20345. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20346. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20347. }));
  20348. return allNodes;
  20349. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20350. },
  20351. args: [],
  20352. 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",
  20353. referencedClasses: [],
  20354. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20355. }),
  20356. $globals.DagNode);
  20357. $core.addMethod(
  20358. $core.method({
  20359. selector: "dagChildren",
  20360. protocol: "accessing",
  20361. fn: function (){
  20362. var self=this,$self=this;
  20363. return $core.withContext(function($ctx1) {
  20364. $self._subclassResponsibility();
  20365. return self;
  20366. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20367. },
  20368. args: [],
  20369. source: "dagChildren\x0a\x09self subclassResponsibility",
  20370. referencedClasses: [],
  20371. messageSends: ["subclassResponsibility"]
  20372. }),
  20373. $globals.DagNode);
  20374. $core.addMethod(
  20375. $core.method({
  20376. selector: "dagChildren:",
  20377. protocol: "accessing",
  20378. fn: function (aCollection){
  20379. var self=this,$self=this;
  20380. return $core.withContext(function($ctx1) {
  20381. $self._subclassResponsibility();
  20382. return self;
  20383. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20384. },
  20385. args: ["aCollection"],
  20386. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20387. referencedClasses: [],
  20388. messageSends: ["subclassResponsibility"]
  20389. }),
  20390. $globals.DagNode);
  20391. $core.addMethod(
  20392. $core.method({
  20393. selector: "isDagNode",
  20394. protocol: "testing",
  20395. fn: function (){
  20396. var self=this,$self=this;
  20397. return true;
  20398. },
  20399. args: [],
  20400. source: "isDagNode\x0a\x09^ true",
  20401. referencedClasses: [],
  20402. messageSends: []
  20403. }),
  20404. $globals.DagNode);
  20405. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20406. $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.";
  20407. $core.addMethod(
  20408. $core.method({
  20409. selector: "addDagChild:",
  20410. protocol: "accessing",
  20411. fn: function (aDagNode){
  20412. var self=this,$self=this;
  20413. return $core.withContext(function($ctx1) {
  20414. $recv($self._dagChildren())._add_(aDagNode);
  20415. return self;
  20416. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20417. },
  20418. args: ["aDagNode"],
  20419. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20420. referencedClasses: [],
  20421. messageSends: ["add:", "dagChildren"]
  20422. }),
  20423. $globals.DagParentNode);
  20424. $core.addMethod(
  20425. $core.method({
  20426. selector: "dagChildren",
  20427. protocol: "accessing",
  20428. fn: function (){
  20429. var self=this,$self=this;
  20430. return $core.withContext(function($ctx1) {
  20431. var $1,$receiver;
  20432. $1=$self["@nodes"];
  20433. if(($receiver = $1) == null || $receiver.a$nil){
  20434. $self["@nodes"]=$recv($globals.Array)._new();
  20435. return $self["@nodes"];
  20436. } else {
  20437. return $1;
  20438. }
  20439. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20440. },
  20441. args: [],
  20442. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20443. referencedClasses: ["Array"],
  20444. messageSends: ["ifNil:", "new"]
  20445. }),
  20446. $globals.DagParentNode);
  20447. $core.addMethod(
  20448. $core.method({
  20449. selector: "dagChildren:",
  20450. protocol: "accessing",
  20451. fn: function (aCollection){
  20452. var self=this,$self=this;
  20453. $self["@nodes"]=aCollection;
  20454. return self;
  20455. },
  20456. args: ["aCollection"],
  20457. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20458. referencedClasses: [],
  20459. messageSends: []
  20460. }),
  20461. $globals.DagParentNode);
  20462. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20463. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20464. $core.addMethod(
  20465. $core.method({
  20466. selector: "dagChildren",
  20467. protocol: "accessing",
  20468. fn: function (){
  20469. var self=this,$self=this;
  20470. return [];
  20471. },
  20472. args: [],
  20473. source: "dagChildren\x0a\x09^ #()",
  20474. referencedClasses: [],
  20475. messageSends: []
  20476. }),
  20477. $globals.DagSink);
  20478. $core.addMethod(
  20479. $core.method({
  20480. selector: "dagChildren:",
  20481. protocol: "accessing",
  20482. fn: function (aCollection){
  20483. var self=this,$self=this;
  20484. return $core.withContext(function($ctx1) {
  20485. $recv(aCollection)._ifNotEmpty_((function(){
  20486. return $core.withContext(function($ctx2) {
  20487. return $self._error_("A DagSink cannot have children.");
  20488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20489. }));
  20490. return self;
  20491. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20492. },
  20493. args: ["aCollection"],
  20494. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20495. referencedClasses: [],
  20496. messageSends: ["ifNotEmpty:", "error:"]
  20497. }),
  20498. $globals.DagSink);
  20499. $core.addMethod(
  20500. $core.method({
  20501. selector: "isDagNode",
  20502. protocol: "*Kernel-Dag",
  20503. fn: function (){
  20504. var self=this,$self=this;
  20505. return false;
  20506. },
  20507. args: [],
  20508. source: "isDagNode\x0a\x09^ false",
  20509. referencedClasses: [],
  20510. messageSends: []
  20511. }),
  20512. $globals.Object);
  20513. });
  20514. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20515. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20516. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20517. $core.addPackage("Kernel-Exceptions");
  20518. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20519. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20520. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20521. $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.";
  20522. $core.addMethod(
  20523. $core.method({
  20524. selector: "beHandled",
  20525. protocol: "accessing",
  20526. fn: function (){
  20527. var self=this,$self=this;
  20528. return $core.withContext(function($ctx1) {
  20529. self.amberHandled = true;
  20530. return self;
  20531. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20532. },
  20533. args: [],
  20534. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20535. referencedClasses: [],
  20536. messageSends: []
  20537. }),
  20538. $globals.Error);
  20539. $core.addMethod(
  20540. $core.method({
  20541. selector: "beUnhandled",
  20542. protocol: "accessing",
  20543. fn: function (){
  20544. var self=this,$self=this;
  20545. return $core.withContext(function($ctx1) {
  20546. self.amberHandled = false;
  20547. return self;
  20548. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20549. },
  20550. args: [],
  20551. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20552. referencedClasses: [],
  20553. messageSends: []
  20554. }),
  20555. $globals.Error);
  20556. $core.addMethod(
  20557. $core.method({
  20558. selector: "context",
  20559. protocol: "accessing",
  20560. fn: function (){
  20561. var self=this,$self=this;
  20562. return $core.withContext(function($ctx1) {
  20563. return self.context;
  20564. return self;
  20565. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20566. },
  20567. args: [],
  20568. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20569. referencedClasses: [],
  20570. messageSends: []
  20571. }),
  20572. $globals.Error);
  20573. $core.addMethod(
  20574. $core.method({
  20575. selector: "initialize",
  20576. protocol: "initialization",
  20577. fn: function (){
  20578. var self=this,$self=this;
  20579. return $core.withContext(function($ctx1) {
  20580. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20581. return self;
  20582. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20583. },
  20584. args: [],
  20585. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20586. referencedClasses: [],
  20587. messageSends: ["messageText:", ",", "name", "class"]
  20588. }),
  20589. $globals.Error);
  20590. $core.addMethod(
  20591. $core.method({
  20592. selector: "isSmalltalkError",
  20593. protocol: "testing",
  20594. fn: function (){
  20595. var self=this,$self=this;
  20596. return $core.withContext(function($ctx1) {
  20597. return self.smalltalkError === true;
  20598. return self;
  20599. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20600. },
  20601. args: [],
  20602. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20603. referencedClasses: [],
  20604. messageSends: []
  20605. }),
  20606. $globals.Error);
  20607. $core.addMethod(
  20608. $core.method({
  20609. selector: "jsStack",
  20610. protocol: "accessing",
  20611. fn: function (){
  20612. var self=this,$self=this;
  20613. return $core.withContext(function($ctx1) {
  20614. return self.stack;
  20615. return self;
  20616. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20617. },
  20618. args: [],
  20619. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20620. referencedClasses: [],
  20621. messageSends: []
  20622. }),
  20623. $globals.Error);
  20624. $core.addMethod(
  20625. $core.method({
  20626. selector: "messageText",
  20627. protocol: "accessing",
  20628. fn: function (){
  20629. var self=this,$self=this;
  20630. return $self["@messageText"];
  20631. },
  20632. args: [],
  20633. source: "messageText\x0a\x09^ messageText",
  20634. referencedClasses: [],
  20635. messageSends: []
  20636. }),
  20637. $globals.Error);
  20638. $core.addMethod(
  20639. $core.method({
  20640. selector: "messageText:",
  20641. protocol: "accessing",
  20642. fn: function (aString){
  20643. var self=this,$self=this;
  20644. $self["@messageText"]=aString;
  20645. return self;
  20646. },
  20647. args: ["aString"],
  20648. source: "messageText: aString\x0a\x09messageText := aString",
  20649. referencedClasses: [],
  20650. messageSends: []
  20651. }),
  20652. $globals.Error);
  20653. $core.addMethod(
  20654. $core.method({
  20655. selector: "outer",
  20656. protocol: "signaling",
  20657. fn: function (){
  20658. var self=this,$self=this;
  20659. return $core.withContext(function($ctx1) {
  20660. return $self._pass();
  20661. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20662. },
  20663. args: [],
  20664. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20665. referencedClasses: [],
  20666. messageSends: ["pass"]
  20667. }),
  20668. $globals.Error);
  20669. $core.addMethod(
  20670. $core.method({
  20671. selector: "pass",
  20672. protocol: "signaling",
  20673. fn: function (){
  20674. var self=this,$self=this;
  20675. return $core.withContext(function($ctx1) {
  20676. self.amberHandled = false;
  20677. throw self;
  20678. ;
  20679. return self;
  20680. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20681. },
  20682. args: [],
  20683. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw self;\x0a\x09'>",
  20684. referencedClasses: [],
  20685. messageSends: []
  20686. }),
  20687. $globals.Error);
  20688. $core.addMethod(
  20689. $core.method({
  20690. selector: "resignal",
  20691. protocol: "signaling",
  20692. fn: function (){
  20693. var self=this,$self=this;
  20694. return $core.withContext(function($ctx1) {
  20695. $self._deprecatedAPI_("Use #pass.");
  20696. return $self._pass();
  20697. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20698. },
  20699. args: [],
  20700. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20701. referencedClasses: [],
  20702. messageSends: ["deprecatedAPI:", "pass"]
  20703. }),
  20704. $globals.Error);
  20705. $core.addMethod(
  20706. $core.method({
  20707. selector: "signal",
  20708. protocol: "signaling",
  20709. fn: function (){
  20710. var self=this,$self=this;
  20711. return $core.withContext(function($ctx1) {
  20712. self.amberHandled = false;
  20713. self.context = $core.getThisContext();
  20714. self.smalltalkError = true;
  20715. throw self;
  20716. ;
  20717. return self;
  20718. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20719. },
  20720. args: [],
  20721. 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'>",
  20722. referencedClasses: [],
  20723. messageSends: []
  20724. }),
  20725. $globals.Error);
  20726. $core.addMethod(
  20727. $core.method({
  20728. selector: "signal:",
  20729. protocol: "signaling",
  20730. fn: function (aString){
  20731. var self=this,$self=this;
  20732. return $core.withContext(function($ctx1) {
  20733. $self._messageText_(aString);
  20734. $self._signal();
  20735. return self;
  20736. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20737. },
  20738. args: ["aString"],
  20739. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20740. referencedClasses: [],
  20741. messageSends: ["messageText:", "signal"]
  20742. }),
  20743. $globals.Error);
  20744. $core.addMethod(
  20745. $core.method({
  20746. selector: "signalerContext",
  20747. protocol: "accessing",
  20748. fn: function (){
  20749. var self=this,$self=this;
  20750. return $core.withContext(function($ctx1) {
  20751. return $self._signalerContextFrom_($self._context());
  20752. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20753. },
  20754. args: [],
  20755. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20756. referencedClasses: [],
  20757. messageSends: ["signalerContextFrom:", "context"]
  20758. }),
  20759. $globals.Error);
  20760. $core.addMethod(
  20761. $core.method({
  20762. selector: "signalerContextFrom:",
  20763. protocol: "accessing",
  20764. fn: function (aContext){
  20765. var self=this,$self=this;
  20766. return $core.withContext(function($ctx1) {
  20767. var $3,$2,$1;
  20768. return $recv(aContext)._findContextSuchThat_((function(context){
  20769. return $core.withContext(function($ctx2) {
  20770. $3=$recv(context)._receiver();
  20771. $ctx2.sendIdx["receiver"]=1;
  20772. $2=$recv($3).__eq_eq(self);
  20773. $ctx2.sendIdx["=="]=1;
  20774. $1=$recv($2)._or_((function(){
  20775. return $core.withContext(function($ctx3) {
  20776. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20777. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20778. }));
  20779. return $recv($1)._not();
  20780. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20781. }));
  20782. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20783. },
  20784. args: ["aContext"],
  20785. 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 ]",
  20786. referencedClasses: [],
  20787. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20788. }),
  20789. $globals.Error);
  20790. $core.addMethod(
  20791. $core.method({
  20792. selector: "wasHandled",
  20793. protocol: "testing",
  20794. fn: function (){
  20795. var self=this,$self=this;
  20796. return $core.withContext(function($ctx1) {
  20797. return self.amberHandled || false;
  20798. return self;
  20799. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20800. },
  20801. args: [],
  20802. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20803. referencedClasses: [],
  20804. messageSends: []
  20805. }),
  20806. $globals.Error);
  20807. $core.addMethod(
  20808. $core.method({
  20809. selector: "classTag",
  20810. protocol: "accessing",
  20811. fn: function (){
  20812. var self=this,$self=this;
  20813. return "exception";
  20814. },
  20815. args: [],
  20816. 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'",
  20817. referencedClasses: [],
  20818. messageSends: []
  20819. }),
  20820. $globals.Error.a$cls);
  20821. $core.addMethod(
  20822. $core.method({
  20823. selector: "signal",
  20824. protocol: "instance creation",
  20825. fn: function (){
  20826. var self=this,$self=this;
  20827. return $core.withContext(function($ctx1) {
  20828. return $recv($self._new())._signal();
  20829. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20830. },
  20831. args: [],
  20832. source: "signal\x0a\x09^ self new signal",
  20833. referencedClasses: [],
  20834. messageSends: ["signal", "new"]
  20835. }),
  20836. $globals.Error.a$cls);
  20837. $core.addMethod(
  20838. $core.method({
  20839. selector: "signal:",
  20840. protocol: "instance creation",
  20841. fn: function (aString){
  20842. var self=this,$self=this;
  20843. return $core.withContext(function($ctx1) {
  20844. return $recv($self._new())._signal_(aString);
  20845. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20846. },
  20847. args: ["aString"],
  20848. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20849. referencedClasses: [],
  20850. messageSends: ["signal:", "new"]
  20851. }),
  20852. $globals.Error.a$cls);
  20853. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20854. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20855. $core.addMethod(
  20856. $core.method({
  20857. selector: "messageText",
  20858. protocol: "accessing",
  20859. fn: function (){
  20860. var self=this,$self=this;
  20861. return "Halt encountered";
  20862. },
  20863. args: [],
  20864. source: "messageText\x0a\x09^ 'Halt encountered'",
  20865. referencedClasses: [],
  20866. messageSends: []
  20867. }),
  20868. $globals.Halt);
  20869. $core.addMethod(
  20870. $core.method({
  20871. selector: "signalerContextFrom:",
  20872. protocol: "accessing",
  20873. fn: function (aContext){
  20874. var self=this,$self=this;
  20875. return $core.withContext(function($ctx1) {
  20876. var $3,$2,$1;
  20877. return $recv(aContext)._findContextSuchThat_((function(context){
  20878. return $core.withContext(function($ctx2) {
  20879. $3=$recv(context)._receiver();
  20880. $ctx2.sendIdx["receiver"]=1;
  20881. $2=$recv($3).__eq_eq(self);
  20882. $ctx2.sendIdx["=="]=1;
  20883. $1=$recv($2)._or_((function(){
  20884. return $core.withContext(function($ctx3) {
  20885. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20886. return $core.withContext(function($ctx4) {
  20887. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20888. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20889. }));
  20890. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20891. }));
  20892. $ctx2.sendIdx["or:"]=1;
  20893. return $recv($1)._not();
  20894. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20895. }));
  20896. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20897. },
  20898. args: ["aContext"],
  20899. 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 ]",
  20900. referencedClasses: [],
  20901. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20902. }),
  20903. $globals.Halt);
  20904. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20905. $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:`";
  20906. $core.addMethod(
  20907. $core.method({
  20908. selector: "context:",
  20909. protocol: "accessing",
  20910. fn: function (aMethodContext){
  20911. var self=this,$self=this;
  20912. return $core.withContext(function($ctx1) {
  20913. self.context = aMethodContext;
  20914. return self;
  20915. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20916. },
  20917. args: ["aMethodContext"],
  20918. 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'>",
  20919. referencedClasses: [],
  20920. messageSends: []
  20921. }),
  20922. $globals.JavaScriptException);
  20923. $core.addMethod(
  20924. $core.method({
  20925. selector: "exception",
  20926. protocol: "accessing",
  20927. fn: function (){
  20928. var self=this,$self=this;
  20929. return $self["@exception"];
  20930. },
  20931. args: [],
  20932. source: "exception\x0a\x09^ exception",
  20933. referencedClasses: [],
  20934. messageSends: []
  20935. }),
  20936. $globals.JavaScriptException);
  20937. $core.addMethod(
  20938. $core.method({
  20939. selector: "exception:",
  20940. protocol: "accessing",
  20941. fn: function (anException){
  20942. var self=this,$self=this;
  20943. $self["@exception"]=anException;
  20944. return self;
  20945. },
  20946. args: ["anException"],
  20947. source: "exception: anException\x0a\x09exception := anException",
  20948. referencedClasses: [],
  20949. messageSends: []
  20950. }),
  20951. $globals.JavaScriptException);
  20952. $core.addMethod(
  20953. $core.method({
  20954. selector: "messageText",
  20955. protocol: "accessing",
  20956. fn: function (){
  20957. var self=this,$self=this;
  20958. return $core.withContext(function($ctx1) {
  20959. return "JavaScript exception: " + $self["@exception"].toString();
  20960. return self;
  20961. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20962. },
  20963. args: [],
  20964. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20965. referencedClasses: [],
  20966. messageSends: []
  20967. }),
  20968. $globals.JavaScriptException);
  20969. $core.addMethod(
  20970. $core.method({
  20971. selector: "shouldBeStubbed",
  20972. protocol: "testing",
  20973. fn: function (){
  20974. var self=this,$self=this;
  20975. return $core.withContext(function($ctx1) {
  20976. return $self["@exception"] instanceof RangeError;
  20977. return self;
  20978. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20979. },
  20980. args: [],
  20981. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20982. referencedClasses: [],
  20983. messageSends: []
  20984. }),
  20985. $globals.JavaScriptException);
  20986. $core.addMethod(
  20987. $core.method({
  20988. selector: "wrap",
  20989. protocol: "error handling",
  20990. fn: function (){
  20991. var self=this,$self=this;
  20992. return $core.withContext(function($ctx1) {
  20993. var $1;
  20994. $recv((function(){
  20995. return $core.withContext(function($ctx2) {
  20996. return $self._signal();
  20997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20998. }))._tryCatch_((function(){
  20999. return $core.withContext(function($ctx2) {
  21000. $1=$self._shouldBeStubbed();
  21001. if($core.assert($1)){
  21002. return $recv($self._context())._stubToAtMost_((100));
  21003. }
  21004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21005. }));
  21006. return self;
  21007. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  21008. },
  21009. args: [],
  21010. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  21011. referencedClasses: [],
  21012. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  21013. }),
  21014. $globals.JavaScriptException);
  21015. $core.addMethod(
  21016. $core.method({
  21017. selector: "on:",
  21018. protocol: "instance creation",
  21019. fn: function (anException){
  21020. var self=this,$self=this;
  21021. return $core.withContext(function($ctx1) {
  21022. var $1;
  21023. $1=$self._new();
  21024. $recv($1)._exception_(anException);
  21025. return $recv($1)._yourself();
  21026. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  21027. },
  21028. args: ["anException"],
  21029. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  21030. referencedClasses: [],
  21031. messageSends: ["exception:", "new", "yourself"]
  21032. }),
  21033. $globals.JavaScriptException.a$cls);
  21034. $core.addMethod(
  21035. $core.method({
  21036. selector: "on:context:",
  21037. protocol: "instance creation",
  21038. fn: function (anException,aMethodContext){
  21039. var self=this,$self=this;
  21040. return $core.withContext(function($ctx1) {
  21041. var $1;
  21042. $1=$self._new();
  21043. $recv($1)._exception_(anException);
  21044. $recv($1)._context_(aMethodContext);
  21045. return $recv($1)._yourself();
  21046. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  21047. },
  21048. args: ["anException", "aMethodContext"],
  21049. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  21050. referencedClasses: [],
  21051. messageSends: ["exception:", "new", "context:", "yourself"]
  21052. }),
  21053. $globals.JavaScriptException.a$cls);
  21054. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  21055. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  21056. $core.addMethod(
  21057. $core.method({
  21058. selector: "message",
  21059. protocol: "accessing",
  21060. fn: function (){
  21061. var self=this,$self=this;
  21062. return $self["@message"];
  21063. },
  21064. args: [],
  21065. source: "message\x0a\x09^ message",
  21066. referencedClasses: [],
  21067. messageSends: []
  21068. }),
  21069. $globals.MessageNotUnderstood);
  21070. $core.addMethod(
  21071. $core.method({
  21072. selector: "message:",
  21073. protocol: "accessing",
  21074. fn: function (aMessage){
  21075. var self=this,$self=this;
  21076. $self["@message"]=aMessage;
  21077. return self;
  21078. },
  21079. args: ["aMessage"],
  21080. source: "message: aMessage\x0a\x09message := aMessage",
  21081. referencedClasses: [],
  21082. messageSends: []
  21083. }),
  21084. $globals.MessageNotUnderstood);
  21085. $core.addMethod(
  21086. $core.method({
  21087. selector: "messageText",
  21088. protocol: "accessing",
  21089. fn: function (){
  21090. var self=this,$self=this;
  21091. return $core.withContext(function($ctx1) {
  21092. var $1;
  21093. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  21094. $ctx1.sendIdx[","]=1;
  21095. return $1;
  21096. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  21097. },
  21098. args: [],
  21099. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  21100. referencedClasses: [],
  21101. messageSends: [",", "asString", "receiver", "selector", "message"]
  21102. }),
  21103. $globals.MessageNotUnderstood);
  21104. $core.addMethod(
  21105. $core.method({
  21106. selector: "receiver",
  21107. protocol: "accessing",
  21108. fn: function (){
  21109. var self=this,$self=this;
  21110. return $self["@receiver"];
  21111. },
  21112. args: [],
  21113. source: "receiver\x0a\x09^ receiver",
  21114. referencedClasses: [],
  21115. messageSends: []
  21116. }),
  21117. $globals.MessageNotUnderstood);
  21118. $core.addMethod(
  21119. $core.method({
  21120. selector: "receiver:",
  21121. protocol: "accessing",
  21122. fn: function (anObject){
  21123. var self=this,$self=this;
  21124. $self["@receiver"]=anObject;
  21125. return self;
  21126. },
  21127. args: ["anObject"],
  21128. source: "receiver: anObject\x0a\x09receiver := anObject",
  21129. referencedClasses: [],
  21130. messageSends: []
  21131. }),
  21132. $globals.MessageNotUnderstood);
  21133. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21134. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21135. $core.addMethod(
  21136. $core.method({
  21137. selector: "object",
  21138. protocol: "accessing",
  21139. fn: function (){
  21140. var self=this,$self=this;
  21141. return $self["@object"];
  21142. },
  21143. args: [],
  21144. source: "object\x0a\x09^ object",
  21145. referencedClasses: [],
  21146. messageSends: []
  21147. }),
  21148. $globals.NonBooleanReceiver);
  21149. $core.addMethod(
  21150. $core.method({
  21151. selector: "object:",
  21152. protocol: "accessing",
  21153. fn: function (anObject){
  21154. var self=this,$self=this;
  21155. $self["@object"]=anObject;
  21156. return self;
  21157. },
  21158. args: ["anObject"],
  21159. source: "object: anObject\x0a\x09object := anObject",
  21160. referencedClasses: [],
  21161. messageSends: []
  21162. }),
  21163. $globals.NonBooleanReceiver);
  21164. $core.addMethod(
  21165. $core.method({
  21166. selector: "signalOn:",
  21167. protocol: "instance creation",
  21168. fn: function (anObject){
  21169. var self=this,$self=this;
  21170. return $core.withContext(function($ctx1) {
  21171. var $1;
  21172. $1=$self._new();
  21173. $recv($1)._object_(anObject);
  21174. return $recv($1)._signal();
  21175. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21176. },
  21177. args: ["anObject"],
  21178. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21179. referencedClasses: [],
  21180. messageSends: ["object:", "new", "signal"]
  21181. }),
  21182. $globals.NonBooleanReceiver.a$cls);
  21183. });
  21184. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21185. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21186. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21187. $core.addPackage("Kernel-Promises");
  21188. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21189. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21190. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21191. $core.addMethod(
  21192. $core.method({
  21193. selector: "all:",
  21194. protocol: "composites",
  21195. fn: function (aCollection){
  21196. var self=this,$self=this;
  21197. return $core.withContext(function($ctx1) {
  21198. return Promise.all($recv(aCollection)._asArray());
  21199. return self;
  21200. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21201. },
  21202. args: ["aCollection"],
  21203. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21204. referencedClasses: [],
  21205. messageSends: []
  21206. }),
  21207. $globals.Promise.a$cls);
  21208. $core.addMethod(
  21209. $core.method({
  21210. selector: "any:",
  21211. protocol: "composites",
  21212. fn: function (aCollection){
  21213. var self=this,$self=this;
  21214. return $core.withContext(function($ctx1) {
  21215. return Promise.race($recv(aCollection)._asArray());
  21216. return self;
  21217. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21218. },
  21219. args: ["aCollection"],
  21220. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21221. referencedClasses: [],
  21222. messageSends: []
  21223. }),
  21224. $globals.Promise.a$cls);
  21225. $core.addMethod(
  21226. $core.method({
  21227. selector: "forBlock:",
  21228. protocol: "instance creation",
  21229. fn: function (aBlock){
  21230. var self=this,$self=this;
  21231. return $core.withContext(function($ctx1) {
  21232. return $recv($self._new())._then_(aBlock);
  21233. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21234. },
  21235. args: ["aBlock"],
  21236. 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",
  21237. referencedClasses: [],
  21238. messageSends: ["then:", "new"]
  21239. }),
  21240. $globals.Promise.a$cls);
  21241. $core.addMethod(
  21242. $core.method({
  21243. selector: "new",
  21244. protocol: "instance creation",
  21245. fn: function (){
  21246. var self=this,$self=this;
  21247. return $core.withContext(function($ctx1) {
  21248. return Promise.resolve();
  21249. return self;
  21250. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21251. },
  21252. args: [],
  21253. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21254. referencedClasses: [],
  21255. messageSends: []
  21256. }),
  21257. $globals.Promise.a$cls);
  21258. $core.addMethod(
  21259. $core.method({
  21260. selector: "new:",
  21261. protocol: "instance creation",
  21262. fn: function (aBlock){
  21263. var self=this,$self=this;
  21264. return $core.withContext(function($ctx1) {
  21265. return new Promise(function (resolve, reject) {
  21266. var model = {value: resolve, signal: reject};
  21267. aBlock._value_(model);
  21268. });
  21269. return self;
  21270. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21271. },
  21272. args: ["aBlock"],
  21273. 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})'>",
  21274. referencedClasses: [],
  21275. messageSends: []
  21276. }),
  21277. $globals.Promise.a$cls);
  21278. $core.addMethod(
  21279. $core.method({
  21280. selector: "signal:",
  21281. protocol: "instance creation",
  21282. fn: function (anObject){
  21283. var self=this,$self=this;
  21284. return $core.withContext(function($ctx1) {
  21285. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21286. return self;
  21287. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21288. },
  21289. args: ["anObject"],
  21290. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21291. referencedClasses: [],
  21292. messageSends: []
  21293. }),
  21294. $globals.Promise.a$cls);
  21295. $core.addMethod(
  21296. $core.method({
  21297. selector: "value:",
  21298. protocol: "instance creation",
  21299. fn: function (anObject){
  21300. var self=this,$self=this;
  21301. return $core.withContext(function($ctx1) {
  21302. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21303. return self;
  21304. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21305. },
  21306. args: ["anObject"],
  21307. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21308. referencedClasses: [],
  21309. messageSends: []
  21310. }),
  21311. $globals.Promise.a$cls);
  21312. $core.addTrait("TThenable", "Kernel-Promises");
  21313. $core.addMethod(
  21314. $core.method({
  21315. selector: "catch:",
  21316. protocol: "promises",
  21317. fn: function (aBlock){
  21318. var self=this,$self=this;
  21319. return $core.withContext(function($ctx1) {
  21320. return self.then(null, function (err) {return $core.seamless(function () {
  21321. return aBlock._value_(err);
  21322. })});
  21323. return self;
  21324. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21325. },
  21326. args: ["aBlock"],
  21327. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21328. referencedClasses: [],
  21329. messageSends: []
  21330. }),
  21331. $globals.TThenable);
  21332. $core.addMethod(
  21333. $core.method({
  21334. selector: "on:do:",
  21335. protocol: "promises",
  21336. fn: function (aClass,aBlock){
  21337. var self=this,$self=this;
  21338. return $core.withContext(function($ctx1) {
  21339. return self.then(null, function (err) {return $core.seamless(function () {
  21340. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21341. else throw err;
  21342. })});
  21343. return self;
  21344. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21345. },
  21346. args: ["aClass", "aBlock"],
  21347. 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})})'>",
  21348. referencedClasses: [],
  21349. messageSends: []
  21350. }),
  21351. $globals.TThenable);
  21352. $core.addMethod(
  21353. $core.method({
  21354. selector: "on:do:catch:",
  21355. protocol: "promises",
  21356. fn: function (aClass,aBlock,anotherBlock){
  21357. var self=this,$self=this;
  21358. return $core.withContext(function($ctx1) {
  21359. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21360. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21361. },
  21362. args: ["aClass", "aBlock", "anotherBlock"],
  21363. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21364. referencedClasses: [],
  21365. messageSends: ["catch:", "on:do:"]
  21366. }),
  21367. $globals.TThenable);
  21368. $core.addMethod(
  21369. $core.method({
  21370. selector: "then:",
  21371. protocol: "promises",
  21372. fn: function (aBlockOrArray){
  21373. var self=this,$self=this;
  21374. return $core.withContext(function($ctx1) {
  21375. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21376. return array.reduce(function (soFar, aBlock) {
  21377. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21378. function (result) {return $core.seamless(function () {
  21379. if (Array.isArray(result)) {
  21380. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21381. } else {
  21382. return aBlock._value_(result);
  21383. }
  21384. })} :
  21385. function (result) {return $core.seamless(function () {
  21386. return aBlock._value_(result);
  21387. })}
  21388. );
  21389. }, self);
  21390. return self;
  21391. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21392. },
  21393. args: ["aBlockOrArray"],
  21394. 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)'>",
  21395. referencedClasses: [],
  21396. messageSends: []
  21397. }),
  21398. $globals.TThenable);
  21399. $core.addMethod(
  21400. $core.method({
  21401. selector: "then:catch:",
  21402. protocol: "promises",
  21403. fn: function (aBlockOrArray,anotherBlock){
  21404. var self=this,$self=this;
  21405. return $core.withContext(function($ctx1) {
  21406. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21407. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21408. },
  21409. args: ["aBlockOrArray", "anotherBlock"],
  21410. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21411. referencedClasses: [],
  21412. messageSends: ["catch:", "then:"]
  21413. }),
  21414. $globals.TThenable);
  21415. $core.addMethod(
  21416. $core.method({
  21417. selector: "then:on:do:",
  21418. protocol: "promises",
  21419. fn: function (aBlockOrArray,aClass,aBlock){
  21420. var self=this,$self=this;
  21421. return $core.withContext(function($ctx1) {
  21422. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21423. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21424. },
  21425. args: ["aBlockOrArray", "aClass", "aBlock"],
  21426. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21427. referencedClasses: [],
  21428. messageSends: ["on:do:", "then:"]
  21429. }),
  21430. $globals.TThenable);
  21431. $core.addMethod(
  21432. $core.method({
  21433. selector: "then:on:do:catch:",
  21434. protocol: "promises",
  21435. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21436. var self=this,$self=this;
  21437. return $core.withContext(function($ctx1) {
  21438. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21439. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21440. },
  21441. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21442. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21443. referencedClasses: [],
  21444. messageSends: ["catch:", "on:do:", "then:"]
  21445. }),
  21446. $globals.TThenable);
  21447. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21448. });
  21449. 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";
  21450. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21451. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21452. $core.addPackage("Kernel-Infrastructure");
  21453. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21454. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21455. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21456. $core.addMethod(
  21457. $core.method({
  21458. selector: "organizeClasses",
  21459. protocol: "organization",
  21460. fn: function (){
  21461. var self=this,$self=this;
  21462. return $core.withContext(function($ctx1) {
  21463. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21464. return $core.withContext(function($ctx2) {
  21465. return $recv(each)._enterOrganization();
  21466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21467. }));
  21468. return self;
  21469. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21470. },
  21471. args: [],
  21472. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21473. referencedClasses: ["Smalltalk"],
  21474. messageSends: ["do:", "classes", "enterOrganization"]
  21475. }),
  21476. $globals.AmberBootstrapInitialization.a$cls);
  21477. $core.addMethod(
  21478. $core.method({
  21479. selector: "organizeMethods",
  21480. protocol: "organization",
  21481. fn: function (){
  21482. var self=this,$self=this;
  21483. return $core.withContext(function($ctx1) {
  21484. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21485. return $core.withContext(function($ctx2) {
  21486. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21487. return $core.withContext(function($ctx3) {
  21488. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21489. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21490. }));
  21491. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21492. }));
  21493. $ctx1.sendIdx["do:"]=1;
  21494. return self;
  21495. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21496. },
  21497. args: [],
  21498. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21499. referencedClasses: ["Smalltalk"],
  21500. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21501. }),
  21502. $globals.AmberBootstrapInitialization.a$cls);
  21503. $core.addMethod(
  21504. $core.method({
  21505. selector: "run",
  21506. protocol: "public api",
  21507. fn: function (){
  21508. var self=this,$self=this;
  21509. return $core.withContext(function($ctx1) {
  21510. $recv($globals.SmalltalkImage)._initialize();
  21511. $self._organizeClasses();
  21512. $self._organizeMethods();
  21513. $recv($globals.Smalltalk)._postLoad();
  21514. return self;
  21515. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21516. },
  21517. args: [],
  21518. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09Smalltalk postLoad",
  21519. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21520. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21521. }),
  21522. $globals.AmberBootstrapInitialization.a$cls);
  21523. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21524. $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`.";
  21525. $core.addMethod(
  21526. $core.method({
  21527. selector: "=",
  21528. protocol: "comparing",
  21529. fn: function (anObject){
  21530. var self=this,$self=this;
  21531. return $core.withContext(function($ctx1) {
  21532. var $2,$1;
  21533. $2=$recv(anObject)._class();
  21534. $ctx1.sendIdx["class"]=1;
  21535. $1=$recv($2).__eq_eq($self._class());
  21536. if(!$core.assert($1)){
  21537. return false;
  21538. }
  21539. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21540. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21541. },
  21542. args: ["anObject"],
  21543. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21544. referencedClasses: ["JSObjectProxy"],
  21545. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21546. }),
  21547. $globals.JSObjectProxy);
  21548. $core.addMethod(
  21549. $core.method({
  21550. selector: "asJavaScriptObject",
  21551. protocol: "converting",
  21552. fn: function (){
  21553. var self=this,$self=this;
  21554. return $self["@jsObject"];
  21555. },
  21556. args: [],
  21557. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21558. referencedClasses: [],
  21559. messageSends: []
  21560. }),
  21561. $globals.JSObjectProxy);
  21562. $core.addMethod(
  21563. $core.method({
  21564. selector: "at:",
  21565. protocol: "accessing",
  21566. fn: function (aString){
  21567. var self=this,$self=this;
  21568. return $core.withContext(function($ctx1) {
  21569. return $self['@jsObject'][aString];
  21570. return self;
  21571. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21572. },
  21573. args: ["aString"],
  21574. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21575. referencedClasses: [],
  21576. messageSends: []
  21577. }),
  21578. $globals.JSObjectProxy);
  21579. $core.addMethod(
  21580. $core.method({
  21581. selector: "at:ifAbsent:",
  21582. protocol: "accessing",
  21583. fn: function (aString,aBlock){
  21584. var self=this,$self=this;
  21585. return $core.withContext(function($ctx1) {
  21586. var obj = $self['@jsObject'];
  21587. return aString in obj ? obj[aString] : aBlock._value();
  21588. ;
  21589. return self;
  21590. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21591. },
  21592. args: ["aString", "aBlock"],
  21593. 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'>",
  21594. referencedClasses: [],
  21595. messageSends: []
  21596. }),
  21597. $globals.JSObjectProxy);
  21598. $core.addMethod(
  21599. $core.method({
  21600. selector: "at:ifPresent:",
  21601. protocol: "accessing",
  21602. fn: function (aString,aBlock){
  21603. var self=this,$self=this;
  21604. return $core.withContext(function($ctx1) {
  21605. var obj = $self['@jsObject'];
  21606. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21607. ;
  21608. return self;
  21609. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21610. },
  21611. args: ["aString", "aBlock"],
  21612. 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'>",
  21613. referencedClasses: [],
  21614. messageSends: []
  21615. }),
  21616. $globals.JSObjectProxy);
  21617. $core.addMethod(
  21618. $core.method({
  21619. selector: "at:ifPresent:ifAbsent:",
  21620. protocol: "accessing",
  21621. fn: function (aString,aBlock,anotherBlock){
  21622. var self=this,$self=this;
  21623. return $core.withContext(function($ctx1) {
  21624. var obj = $self['@jsObject'];
  21625. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21626. ;
  21627. return self;
  21628. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21629. },
  21630. args: ["aString", "aBlock", "anotherBlock"],
  21631. 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'>",
  21632. referencedClasses: [],
  21633. messageSends: []
  21634. }),
  21635. $globals.JSObjectProxy);
  21636. $core.addMethod(
  21637. $core.method({
  21638. selector: "at:put:",
  21639. protocol: "accessing",
  21640. fn: function (aString,anObject){
  21641. var self=this,$self=this;
  21642. return $core.withContext(function($ctx1) {
  21643. return $self['@jsObject'][aString] = anObject;
  21644. return self;
  21645. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21646. },
  21647. args: ["aString", "anObject"],
  21648. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21649. referencedClasses: [],
  21650. messageSends: []
  21651. }),
  21652. $globals.JSObjectProxy);
  21653. $core.addMethod(
  21654. $core.method({
  21655. selector: "catch:",
  21656. protocol: "promises",
  21657. fn: function (aBlock){
  21658. var self=this,$self=this;
  21659. return $core.withContext(function($ctx1) {
  21660. var $1,$2;
  21661. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21662. if($core.assert($1)){
  21663. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21664. } else {
  21665. $2=(
  21666. $ctx1.supercall = true,
  21667. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21668. $ctx1.supercall = false;
  21669. return $2;
  21670. }
  21671. return self;
  21672. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21673. },
  21674. args: ["aBlock"],
  21675. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21676. referencedClasses: ["NativeFunction", "TThenable"],
  21677. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21678. }),
  21679. $globals.JSObjectProxy);
  21680. $core.addMethod(
  21681. $core.method({
  21682. selector: "doesNotUnderstand:",
  21683. protocol: "proxy",
  21684. fn: function (aMessage){
  21685. var self=this,$self=this;
  21686. return $core.withContext(function($ctx1) {
  21687. var $1,$receiver;
  21688. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21689. if(($receiver = $1) == null || $receiver.a$nil){
  21690. return (
  21691. $ctx1.supercall = true,
  21692. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21693. $ctx1.supercall = false;
  21694. } else {
  21695. var jsSelector;
  21696. jsSelector=$receiver;
  21697. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21698. }
  21699. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21700. },
  21701. args: ["aMessage"],
  21702. 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 ]",
  21703. referencedClasses: ["JSObjectProxy"],
  21704. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21705. }),
  21706. $globals.JSObjectProxy);
  21707. $core.addMethod(
  21708. $core.method({
  21709. selector: "in:",
  21710. protocol: "accessing",
  21711. fn: function (aValuable){
  21712. var self=this,$self=this;
  21713. return $core.withContext(function($ctx1) {
  21714. return $recv(aValuable)._value_($self["@jsObject"]);
  21715. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21716. },
  21717. args: ["aValuable"],
  21718. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21719. referencedClasses: [],
  21720. messageSends: ["value:"]
  21721. }),
  21722. $globals.JSObjectProxy);
  21723. $core.addMethod(
  21724. $core.method({
  21725. selector: "jsObject",
  21726. protocol: "accessing",
  21727. fn: function (){
  21728. var self=this,$self=this;
  21729. return $self["@jsObject"];
  21730. },
  21731. args: [],
  21732. source: "jsObject\x0a\x09^ jsObject",
  21733. referencedClasses: [],
  21734. messageSends: []
  21735. }),
  21736. $globals.JSObjectProxy);
  21737. $core.addMethod(
  21738. $core.method({
  21739. selector: "keysAndValuesDo:",
  21740. protocol: "enumerating",
  21741. fn: function (aBlock){
  21742. var self=this,$self=this;
  21743. return $core.withContext(function($ctx1) {
  21744. var o = $self['@jsObject'];
  21745. for(var i in o) {
  21746. aBlock._value_value_(i, o[i]);
  21747. }
  21748. ;
  21749. return self;
  21750. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21751. },
  21752. args: ["aBlock"],
  21753. 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'>",
  21754. referencedClasses: [],
  21755. messageSends: []
  21756. }),
  21757. $globals.JSObjectProxy);
  21758. $core.addMethod(
  21759. $core.method({
  21760. selector: "on:do:",
  21761. protocol: "promises",
  21762. fn: function (aClass,aBlock){
  21763. var self=this,$self=this;
  21764. return $core.withContext(function($ctx1) {
  21765. var $1,$2;
  21766. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21767. if($core.assert($1)){
  21768. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21769. } else {
  21770. $2=(
  21771. $ctx1.supercall = true,
  21772. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21773. $ctx1.supercall = false;
  21774. return $2;
  21775. }
  21776. return self;
  21777. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21778. },
  21779. args: ["aClass", "aBlock"],
  21780. 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 ]",
  21781. referencedClasses: ["NativeFunction", "TThenable"],
  21782. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21783. }),
  21784. $globals.JSObjectProxy);
  21785. $core.addMethod(
  21786. $core.method({
  21787. selector: "printOn:",
  21788. protocol: "printing",
  21789. fn: function (aStream){
  21790. var self=this,$self=this;
  21791. return $core.withContext(function($ctx1) {
  21792. $recv(aStream)._nextPutAll_($self._printString());
  21793. return self;
  21794. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21795. },
  21796. args: ["aStream"],
  21797. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21798. referencedClasses: [],
  21799. messageSends: ["nextPutAll:", "printString"]
  21800. }),
  21801. $globals.JSObjectProxy);
  21802. $core.addMethod(
  21803. $core.method({
  21804. selector: "printString",
  21805. protocol: "printing",
  21806. fn: function (){
  21807. var self=this,$self=this;
  21808. return $core.withContext(function($ctx1) {
  21809. var js = $self['@jsObject'];
  21810. return js.toString
  21811. ? js.toString()
  21812. : Object.prototype.toString.call(js)
  21813. ;
  21814. return self;
  21815. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21816. },
  21817. args: [],
  21818. 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'>",
  21819. referencedClasses: [],
  21820. messageSends: []
  21821. }),
  21822. $globals.JSObjectProxy);
  21823. $core.addMethod(
  21824. $core.method({
  21825. selector: "putOn:",
  21826. protocol: "streaming",
  21827. fn: function (aStream){
  21828. var self=this,$self=this;
  21829. return $core.withContext(function($ctx1) {
  21830. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21831. return self;
  21832. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21833. },
  21834. args: ["aStream"],
  21835. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21836. referencedClasses: [],
  21837. messageSends: ["nextPutJSObject:"]
  21838. }),
  21839. $globals.JSObjectProxy);
  21840. $core.addMethod(
  21841. $core.method({
  21842. selector: "removeKey:",
  21843. protocol: "accessing",
  21844. fn: function (aString){
  21845. var self=this,$self=this;
  21846. return $core.withContext(function($ctx1) {
  21847. delete $self['@jsObject'][aString]; return aString;
  21848. return self;
  21849. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21850. },
  21851. args: ["aString"],
  21852. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21853. referencedClasses: [],
  21854. messageSends: []
  21855. }),
  21856. $globals.JSObjectProxy);
  21857. $core.addMethod(
  21858. $core.method({
  21859. selector: "then:",
  21860. protocol: "promises",
  21861. fn: function (aBlockOrArray){
  21862. var self=this,$self=this;
  21863. return $core.withContext(function($ctx1) {
  21864. var $1,$2;
  21865. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21866. if($core.assert($1)){
  21867. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21868. } else {
  21869. $2=(
  21870. $ctx1.supercall = true,
  21871. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21872. $ctx1.supercall = false;
  21873. return $2;
  21874. }
  21875. return self;
  21876. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21877. },
  21878. args: ["aBlockOrArray"],
  21879. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21880. referencedClasses: ["NativeFunction", "TThenable"],
  21881. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21882. }),
  21883. $globals.JSObjectProxy);
  21884. $core.addMethod(
  21885. $core.method({
  21886. selector: "addObjectVariablesTo:ofProxy:",
  21887. protocol: "proxy",
  21888. fn: function (aDictionary,aProxy){
  21889. var self=this,$self=this;
  21890. return $core.withContext(function($ctx1) {
  21891. var jsObject = aProxy['@jsObject'];
  21892. for(var i in jsObject) {
  21893. aDictionary._at_put_(i, jsObject[i]);
  21894. }
  21895. ;
  21896. return self;
  21897. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21898. },
  21899. args: ["aDictionary", "aProxy"],
  21900. 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'>",
  21901. referencedClasses: [],
  21902. messageSends: []
  21903. }),
  21904. $globals.JSObjectProxy.a$cls);
  21905. $core.addMethod(
  21906. $core.method({
  21907. selector: "compareJSObjectOfProxy:withProxy:",
  21908. protocol: "proxy",
  21909. fn: function (aProxy,anotherProxy){
  21910. var self=this,$self=this;
  21911. return $core.withContext(function($ctx1) {
  21912. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21913. return aProxy["@jsObject"] === anotherJSObject;
  21914. return self;
  21915. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21916. },
  21917. args: ["aProxy", "anotherProxy"],
  21918. 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'>",
  21919. referencedClasses: [],
  21920. messageSends: []
  21921. }),
  21922. $globals.JSObjectProxy.a$cls);
  21923. $core.addMethod(
  21924. $core.method({
  21925. selector: "forwardMessage:withArguments:ofProxy:",
  21926. protocol: "proxy",
  21927. fn: function (aString,anArray,aProxy){
  21928. var self=this,$self=this;
  21929. return $core.withContext(function($ctx1) {
  21930. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21931. ;
  21932. return self;
  21933. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21934. },
  21935. args: ["aString", "anArray", "aProxy"],
  21936. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21937. referencedClasses: [],
  21938. messageSends: []
  21939. }),
  21940. $globals.JSObjectProxy.a$cls);
  21941. $core.addMethod(
  21942. $core.method({
  21943. selector: "jsObject:ofProxy:",
  21944. protocol: "proxy",
  21945. fn: function (aJSObject,aProxy){
  21946. var self=this,$self=this;
  21947. return $core.withContext(function($ctx1) {
  21948. aProxy['@jsObject'] = aJSObject;
  21949. return self;
  21950. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21951. },
  21952. args: ["aJSObject", "aProxy"],
  21953. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21954. referencedClasses: [],
  21955. messageSends: []
  21956. }),
  21957. $globals.JSObjectProxy.a$cls);
  21958. $core.addMethod(
  21959. $core.method({
  21960. selector: "lookupProperty:ofProxy:",
  21961. protocol: "proxy",
  21962. fn: function (aString,aProxy){
  21963. var self=this,$self=this;
  21964. return $core.withContext(function($ctx1) {
  21965. return aString in aProxy._jsObject() ? aString : nil;
  21966. return self;
  21967. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21968. },
  21969. args: ["aString", "aProxy"],
  21970. 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'>",
  21971. referencedClasses: [],
  21972. messageSends: []
  21973. }),
  21974. $globals.JSObjectProxy.a$cls);
  21975. $core.addMethod(
  21976. $core.method({
  21977. selector: "null",
  21978. protocol: "accessing",
  21979. fn: function (){
  21980. var self=this,$self=this;
  21981. return $core.withContext(function($ctx1) {
  21982. return null;
  21983. return self;
  21984. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21985. },
  21986. args: [],
  21987. source: "null\x0a\x09<inlineJS: 'return null'>",
  21988. referencedClasses: [],
  21989. messageSends: []
  21990. }),
  21991. $globals.JSObjectProxy.a$cls);
  21992. $core.addMethod(
  21993. $core.method({
  21994. selector: "on:",
  21995. protocol: "instance creation",
  21996. fn: function (aJSObject){
  21997. var self=this,$self=this;
  21998. var instance;
  21999. return $core.withContext(function($ctx1) {
  22000. instance=$self._new();
  22001. $self._jsObject_ofProxy_(aJSObject,instance);
  22002. return instance;
  22003. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  22004. },
  22005. args: ["aJSObject"],
  22006. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  22007. referencedClasses: [],
  22008. messageSends: ["new", "jsObject:ofProxy:"]
  22009. }),
  22010. $globals.JSObjectProxy.a$cls);
  22011. $core.addMethod(
  22012. $core.method({
  22013. selector: "undefined",
  22014. protocol: "accessing",
  22015. fn: function (){
  22016. var self=this,$self=this;
  22017. return $core.withContext(function($ctx1) {
  22018. return undefined;
  22019. return self;
  22020. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  22021. },
  22022. args: [],
  22023. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  22024. referencedClasses: [],
  22025. messageSends: []
  22026. }),
  22027. $globals.JSObjectProxy.a$cls);
  22028. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  22029. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  22030. $core.addMethod(
  22031. $core.method({
  22032. selector: "addElement:",
  22033. protocol: "accessing",
  22034. fn: function (anObject){
  22035. var self=this,$self=this;
  22036. return $core.withContext(function($ctx1) {
  22037. $recv($self._elements())._add_(anObject);
  22038. return self;
  22039. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  22040. },
  22041. args: ["anObject"],
  22042. source: "addElement: anObject\x0a\x09self elements add: anObject",
  22043. referencedClasses: [],
  22044. messageSends: ["add:", "elements"]
  22045. }),
  22046. $globals.Organizer);
  22047. $core.addMethod(
  22048. $core.method({
  22049. selector: "elements",
  22050. protocol: "accessing",
  22051. fn: function (){
  22052. var self=this,$self=this;
  22053. return $self["@elements"];
  22054. },
  22055. args: [],
  22056. source: "elements\x0a\x09^ elements",
  22057. referencedClasses: [],
  22058. messageSends: []
  22059. }),
  22060. $globals.Organizer);
  22061. $core.addMethod(
  22062. $core.method({
  22063. selector: "initialize",
  22064. protocol: "initialization",
  22065. fn: function (){
  22066. var self=this,$self=this;
  22067. return $core.withContext(function($ctx1) {
  22068. (
  22069. $ctx1.supercall = true,
  22070. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22071. $ctx1.supercall = false;
  22072. $self["@elements"]=$recv($globals.Set)._new();
  22073. return self;
  22074. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  22075. },
  22076. args: [],
  22077. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  22078. referencedClasses: ["Set"],
  22079. messageSends: ["initialize", "new"]
  22080. }),
  22081. $globals.Organizer);
  22082. $core.addMethod(
  22083. $core.method({
  22084. selector: "removeElement:",
  22085. protocol: "accessing",
  22086. fn: function (anObject){
  22087. var self=this,$self=this;
  22088. return $core.withContext(function($ctx1) {
  22089. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  22090. }));
  22091. return self;
  22092. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  22093. },
  22094. args: ["anObject"],
  22095. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  22096. referencedClasses: [],
  22097. messageSends: ["remove:ifAbsent:", "elements"]
  22098. }),
  22099. $globals.Organizer);
  22100. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  22101. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  22102. $core.addMethod(
  22103. $core.method({
  22104. selector: "addElement:",
  22105. protocol: "accessing",
  22106. fn: function (aString){
  22107. var self=this,$self=this;
  22108. return $core.withContext(function($ctx1) {
  22109. var $1,$3,$2;
  22110. (
  22111. $ctx1.supercall = true,
  22112. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  22113. $ctx1.supercall = false;
  22114. $1=$recv($globals.SystemAnnouncer)._current();
  22115. $3=$recv($globals.ProtocolAdded)._new();
  22116. $recv($3)._protocol_(aString);
  22117. $recv($3)._theClass_($self._theClass());
  22118. $2=$recv($3)._yourself();
  22119. $recv($1)._announce_($2);
  22120. return self;
  22121. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  22122. },
  22123. args: ["aString"],
  22124. 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)",
  22125. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  22126. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22127. }),
  22128. $globals.ClassOrganizer);
  22129. $core.addMethod(
  22130. $core.method({
  22131. selector: "removeElement:",
  22132. protocol: "accessing",
  22133. fn: function (aString){
  22134. var self=this,$self=this;
  22135. return $core.withContext(function($ctx1) {
  22136. var $1,$3,$2;
  22137. (
  22138. $ctx1.supercall = true,
  22139. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  22140. $ctx1.supercall = false;
  22141. $1=$recv($globals.SystemAnnouncer)._current();
  22142. $3=$recv($globals.ProtocolRemoved)._new();
  22143. $recv($3)._protocol_(aString);
  22144. $recv($3)._theClass_($self._theClass());
  22145. $2=$recv($3)._yourself();
  22146. $recv($1)._announce_($2);
  22147. return self;
  22148. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  22149. },
  22150. args: ["aString"],
  22151. 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)",
  22152. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22153. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22154. }),
  22155. $globals.ClassOrganizer);
  22156. $core.addMethod(
  22157. $core.method({
  22158. selector: "theClass",
  22159. protocol: "accessing",
  22160. fn: function (){
  22161. var self=this,$self=this;
  22162. return $self["@traitOrBehavior"];
  22163. },
  22164. args: [],
  22165. source: "theClass\x0a\x09^ traitOrBehavior",
  22166. referencedClasses: [],
  22167. messageSends: []
  22168. }),
  22169. $globals.ClassOrganizer);
  22170. $core.addMethod(
  22171. $core.method({
  22172. selector: "theClass:",
  22173. protocol: "accessing",
  22174. fn: function (aClass){
  22175. var self=this,$self=this;
  22176. $self["@traitOrBehavior"]=aClass;
  22177. return self;
  22178. },
  22179. args: ["aClass"],
  22180. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22181. referencedClasses: [],
  22182. messageSends: []
  22183. }),
  22184. $globals.ClassOrganizer);
  22185. $core.addMethod(
  22186. $core.method({
  22187. selector: "on:",
  22188. protocol: "instance creation",
  22189. fn: function (aClass){
  22190. var self=this,$self=this;
  22191. return $core.withContext(function($ctx1) {
  22192. var $1;
  22193. $1=$self._new();
  22194. $recv($1)._theClass_(aClass);
  22195. return $recv($1)._yourself();
  22196. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22197. },
  22198. args: ["aClass"],
  22199. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22200. referencedClasses: [],
  22201. messageSends: ["theClass:", "new", "yourself"]
  22202. }),
  22203. $globals.ClassOrganizer.a$cls);
  22204. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22205. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22206. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22207. $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'";
  22208. $core.addMethod(
  22209. $core.method({
  22210. selector: "basicTransport",
  22211. protocol: "private",
  22212. fn: function (){
  22213. var self=this,$self=this;
  22214. return $self["@basicTransport"];
  22215. },
  22216. args: [],
  22217. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22218. referencedClasses: [],
  22219. messageSends: []
  22220. }),
  22221. $globals.Package);
  22222. $core.addMethod(
  22223. $core.method({
  22224. selector: "beClean",
  22225. protocol: "accessing",
  22226. fn: function (){
  22227. var self=this,$self=this;
  22228. return $core.withContext(function($ctx1) {
  22229. var $1,$3,$2;
  22230. $self["@dirty"]=false;
  22231. $1=$recv($globals.SystemAnnouncer)._current();
  22232. $3=$recv($globals.PackageClean)._new();
  22233. $recv($3)._package_(self);
  22234. $2=$recv($3)._yourself();
  22235. $recv($1)._announce_($2);
  22236. return self;
  22237. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22238. },
  22239. args: [],
  22240. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22241. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22242. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22243. }),
  22244. $globals.Package);
  22245. $core.addMethod(
  22246. $core.method({
  22247. selector: "beDirty",
  22248. protocol: "accessing",
  22249. fn: function (){
  22250. var self=this,$self=this;
  22251. return $core.withContext(function($ctx1) {
  22252. var $1,$3,$2;
  22253. $self["@dirty"]=true;
  22254. $1=$recv($globals.SystemAnnouncer)._current();
  22255. $3=$recv($globals.PackageDirty)._new();
  22256. $recv($3)._package_(self);
  22257. $2=$recv($3)._yourself();
  22258. $recv($1)._announce_($2);
  22259. return self;
  22260. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22261. },
  22262. args: [],
  22263. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22264. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22265. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22266. }),
  22267. $globals.Package);
  22268. $core.addMethod(
  22269. $core.method({
  22270. selector: "classTemplate",
  22271. protocol: "accessing",
  22272. fn: function (){
  22273. var self=this,$self=this;
  22274. return $core.withContext(function($ctx1) {
  22275. return $recv($globals.String)._streamContents_((function(stream){
  22276. return $core.withContext(function($ctx2) {
  22277. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22278. $ctx2.sendIdx["write:"]=1;
  22279. $recv(stream)._lf();
  22280. $ctx2.sendIdx["lf"]=1;
  22281. $recv(stream)._tab();
  22282. $ctx2.sendIdx["tab"]=1;
  22283. $recv(stream)._write_("instanceVariableNames: ''");
  22284. $ctx2.sendIdx["write:"]=2;
  22285. $recv(stream)._lf();
  22286. $recv(stream)._tab();
  22287. $recv(stream)._write_("package: ");
  22288. return $recv(stream)._print_($self._name());
  22289. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22290. }));
  22291. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22292. },
  22293. args: [],
  22294. 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 ]",
  22295. referencedClasses: ["String"],
  22296. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22297. }),
  22298. $globals.Package);
  22299. $core.addMethod(
  22300. $core.method({
  22301. selector: "classes",
  22302. protocol: "classes",
  22303. fn: function (){
  22304. var self=this,$self=this;
  22305. return $core.withContext(function($ctx1) {
  22306. return $recv($recv($self._organization())._elements())._copy();
  22307. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22308. },
  22309. args: [],
  22310. source: "classes\x0a\x09^ self organization elements copy",
  22311. referencedClasses: [],
  22312. messageSends: ["copy", "elements", "organization"]
  22313. }),
  22314. $globals.Package);
  22315. $core.addMethod(
  22316. $core.method({
  22317. selector: "definition",
  22318. protocol: "accessing",
  22319. fn: function (){
  22320. var self=this,$self=this;
  22321. return $core.withContext(function($ctx1) {
  22322. var $1;
  22323. return $recv($globals.String)._streamContents_((function(stream){
  22324. return $core.withContext(function($ctx2) {
  22325. $1=$recv($self._class())._name();
  22326. $ctx2.sendIdx["name"]=1;
  22327. $recv(stream)._write_($1);
  22328. $ctx2.sendIdx["write:"]=1;
  22329. $recv(stream)._lf();
  22330. $ctx2.sendIdx["lf"]=1;
  22331. $recv(stream)._tab();
  22332. $ctx2.sendIdx["tab"]=1;
  22333. $recv(stream)._write_("named: ");
  22334. $ctx2.sendIdx["write:"]=2;
  22335. $recv(stream)._print_($self._name());
  22336. $recv(stream)._lf();
  22337. $ctx2.sendIdx["lf"]=2;
  22338. $recv(stream)._tab();
  22339. $ctx2.sendIdx["tab"]=2;
  22340. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22341. $ctx2.sendIdx["write:"]=3;
  22342. $recv(stream)._lf();
  22343. $recv(stream)._tab();
  22344. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22345. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22346. }));
  22347. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22348. },
  22349. args: [],
  22350. 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. ')' } ]",
  22351. referencedClasses: ["String"],
  22352. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22353. }),
  22354. $globals.Package);
  22355. $core.addMethod(
  22356. $core.method({
  22357. selector: "eval:",
  22358. protocol: "evaluating",
  22359. fn: function (aString){
  22360. var self=this,$self=this;
  22361. return $core.withContext(function($ctx1) {
  22362. var $1,$receiver;
  22363. $1=$self["@evalBlock"];
  22364. if(($receiver = $1) == null || $receiver.a$nil){
  22365. return $recv($globals.Compiler)._eval_(aString);
  22366. } else {
  22367. return $recv($self["@evalBlock"])._value_(aString);
  22368. }
  22369. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22370. },
  22371. args: ["aString"],
  22372. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22373. referencedClasses: ["Compiler"],
  22374. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22375. }),
  22376. $globals.Package);
  22377. $core.addMethod(
  22378. $core.method({
  22379. selector: "evalBlock",
  22380. protocol: "accessing",
  22381. fn: function (){
  22382. var self=this,$self=this;
  22383. return $self["@evalBlock"];
  22384. },
  22385. args: [],
  22386. source: "evalBlock\x0a\x09^ evalBlock",
  22387. referencedClasses: [],
  22388. messageSends: []
  22389. }),
  22390. $globals.Package);
  22391. $core.addMethod(
  22392. $core.method({
  22393. selector: "evalBlock:",
  22394. protocol: "accessing",
  22395. fn: function (aBlock){
  22396. var self=this,$self=this;
  22397. $self["@evalBlock"]=aBlock;
  22398. return self;
  22399. },
  22400. args: ["aBlock"],
  22401. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22402. referencedClasses: [],
  22403. messageSends: []
  22404. }),
  22405. $globals.Package);
  22406. $core.addMethod(
  22407. $core.method({
  22408. selector: "imports",
  22409. protocol: "accessing",
  22410. fn: function (){
  22411. var self=this,$self=this;
  22412. return $core.withContext(function($ctx1) {
  22413. var $1,$receiver;
  22414. $1=$self["@imports"];
  22415. if(($receiver = $1) == null || $receiver.a$nil){
  22416. $self._imports_([]);
  22417. return $self["@imports"];
  22418. } else {
  22419. return $1;
  22420. }
  22421. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22422. },
  22423. args: [],
  22424. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22425. referencedClasses: [],
  22426. messageSends: ["ifNil:", "imports:"]
  22427. }),
  22428. $globals.Package);
  22429. $core.addMethod(
  22430. $core.method({
  22431. selector: "imports:",
  22432. protocol: "accessing",
  22433. fn: function (anArray){
  22434. var self=this,$self=this;
  22435. return $core.withContext(function($ctx1) {
  22436. $self._validateImports_(anArray);
  22437. $self["@imports"]=$recv(anArray)._asSet();
  22438. return self;
  22439. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22440. },
  22441. args: ["anArray"],
  22442. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22443. referencedClasses: [],
  22444. messageSends: ["validateImports:", "asSet"]
  22445. }),
  22446. $globals.Package);
  22447. $core.addMethod(
  22448. $core.method({
  22449. selector: "importsAsJson",
  22450. protocol: "converting",
  22451. fn: function (){
  22452. var self=this,$self=this;
  22453. return $core.withContext(function($ctx1) {
  22454. var $1;
  22455. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22456. return $core.withContext(function($ctx2) {
  22457. $1=$recv(each)._isString();
  22458. if($core.assert($1)){
  22459. return each;
  22460. } else {
  22461. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22462. $ctx2.sendIdx[","]=1;
  22463. }
  22464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22465. }));
  22466. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22467. },
  22468. args: [],
  22469. 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 ]]",
  22470. referencedClasses: [],
  22471. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22472. }),
  22473. $globals.Package);
  22474. $core.addMethod(
  22475. $core.method({
  22476. selector: "importsDefinition",
  22477. protocol: "accessing",
  22478. fn: function (){
  22479. var self=this,$self=this;
  22480. return $core.withContext(function($ctx1) {
  22481. return $recv($globals.String)._streamContents_((function(stream){
  22482. return $core.withContext(function($ctx2) {
  22483. $recv(stream)._write_("{");
  22484. $ctx2.sendIdx["write:"]=1;
  22485. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22486. return $core.withContext(function($ctx3) {
  22487. return $recv(stream)._print_(each);
  22488. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22489. }),(function(){
  22490. return $core.withContext(function($ctx3) {
  22491. return $recv(stream)._write_(". ");
  22492. $ctx3.sendIdx["write:"]=2;
  22493. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22494. }));
  22495. return $recv(stream)._write_("}");
  22496. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22497. }));
  22498. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22499. },
  22500. args: [],
  22501. 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: '}' ]",
  22502. referencedClasses: ["String"],
  22503. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22504. }),
  22505. $globals.Package);
  22506. $core.addMethod(
  22507. $core.method({
  22508. selector: "importsFromJson:",
  22509. protocol: "converting",
  22510. fn: function (anArray){
  22511. var self=this,$self=this;
  22512. return $core.withContext(function($ctx1) {
  22513. var $1;
  22514. return $recv(anArray)._collect_((function(each){
  22515. var split;
  22516. return $core.withContext(function($ctx2) {
  22517. split=$recv(each)._tokenize_("=");
  22518. $1=$recv($recv(split)._size()).__eq((1));
  22519. if($core.assert($1)){
  22520. return $recv(split)._first();
  22521. $ctx2.sendIdx["first"]=1;
  22522. } else {
  22523. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22524. }
  22525. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22526. }));
  22527. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22528. },
  22529. args: ["anArray"],
  22530. 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 ]]",
  22531. referencedClasses: [],
  22532. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22533. }),
  22534. $globals.Package);
  22535. $core.addMethod(
  22536. $core.method({
  22537. selector: "initialize",
  22538. protocol: "initialization",
  22539. fn: function (){
  22540. var self=this,$self=this;
  22541. return $core.withContext(function($ctx1) {
  22542. (
  22543. $ctx1.supercall = true,
  22544. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22545. $ctx1.supercall = false;
  22546. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22547. $self["@evalBlock"]=nil;
  22548. $self["@dirty"]=nil;
  22549. $self["@imports"]=nil;
  22550. $self["@transport"]=nil;
  22551. return self;
  22552. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22553. },
  22554. args: [],
  22555. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22556. referencedClasses: ["PackageOrganizer"],
  22557. messageSends: ["initialize", "new"]
  22558. }),
  22559. $globals.Package);
  22560. $core.addMethod(
  22561. $core.method({
  22562. selector: "isDirty",
  22563. protocol: "testing",
  22564. fn: function (){
  22565. var self=this,$self=this;
  22566. return $core.withContext(function($ctx1) {
  22567. var $1,$receiver;
  22568. $1=$self["@dirty"];
  22569. if(($receiver = $1) == null || $receiver.a$nil){
  22570. return false;
  22571. } else {
  22572. return $1;
  22573. }
  22574. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22575. },
  22576. args: [],
  22577. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22578. referencedClasses: [],
  22579. messageSends: ["ifNil:"]
  22580. }),
  22581. $globals.Package);
  22582. $core.addMethod(
  22583. $core.method({
  22584. selector: "isPackage",
  22585. protocol: "testing",
  22586. fn: function (){
  22587. var self=this,$self=this;
  22588. return true;
  22589. },
  22590. args: [],
  22591. source: "isPackage\x0a\x09^ true",
  22592. referencedClasses: [],
  22593. messageSends: []
  22594. }),
  22595. $globals.Package);
  22596. $core.addMethod(
  22597. $core.method({
  22598. selector: "javaScriptDescriptor:",
  22599. protocol: "accessing",
  22600. fn: function (anObject){
  22601. var self=this,$self=this;
  22602. var basicEval,basicImports;
  22603. return $core.withContext(function($ctx1) {
  22604. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22605. return $core.withContext(function($ctx2) {
  22606. return nil._asJavaScriptObject();
  22607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22608. }));
  22609. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22610. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22611. return [];
  22612. }));
  22613. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22614. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22615. }));
  22616. $self._evalBlock_(basicEval);
  22617. $self._imports_($self._importsFromJson_(basicImports));
  22618. return self;
  22619. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22620. },
  22621. args: ["anObject"],
  22622. 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)",
  22623. referencedClasses: [],
  22624. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22625. }),
  22626. $globals.Package);
  22627. $core.addMethod(
  22628. $core.method({
  22629. selector: "loadDependencies",
  22630. protocol: "dependencies",
  22631. fn: function (){
  22632. var self=this,$self=this;
  22633. var classes,packages;
  22634. return $core.withContext(function($ctx1) {
  22635. var $1;
  22636. classes=$self._loadDependencyClasses();
  22637. $1=$recv($recv(classes)._collect_((function(each){
  22638. return $core.withContext(function($ctx2) {
  22639. return $recv(each)._package();
  22640. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22641. })))._asSet();
  22642. $recv($1)._remove_ifAbsent_(self,(function(){
  22643. }));
  22644. return $recv($1)._yourself();
  22645. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22646. },
  22647. args: [],
  22648. 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",
  22649. referencedClasses: [],
  22650. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22651. }),
  22652. $globals.Package);
  22653. $core.addMethod(
  22654. $core.method({
  22655. selector: "loadDependencyClasses",
  22656. protocol: "dependencies",
  22657. fn: function (){
  22658. var self=this,$self=this;
  22659. var starCategoryName;
  22660. return $core.withContext(function($ctx1) {
  22661. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22662. starCategoryName="*".__comma($self._name());
  22663. $ctx1.sendIdx[","]=1;
  22664. $3=$self._classes();
  22665. $ctx1.sendIdx["classes"]=1;
  22666. $2=$recv($3)._collect_((function(each){
  22667. return $core.withContext(function($ctx2) {
  22668. return $recv(each)._superclass();
  22669. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22670. }));
  22671. $ctx1.sendIdx["collect:"]=1;
  22672. $1=$recv($2)._asSet();
  22673. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22674. return $core.withContext(function($ctx2) {
  22675. $5=$recv(each)._protocols();
  22676. $ctx2.sendIdx["protocols"]=1;
  22677. $7=$recv(each)._theMetaClass();
  22678. if(($receiver = $7) == null || $receiver.a$nil){
  22679. $6=[];
  22680. } else {
  22681. var meta;
  22682. meta=$receiver;
  22683. $6=$recv(meta)._protocols();
  22684. }
  22685. $4=$recv($5).__comma($6);
  22686. return $recv($4)._includes_(starCategoryName);
  22687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22688. })));
  22689. $ctx1.sendIdx["addAll:"]=1;
  22690. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22691. return $core.withContext(function($ctx2) {
  22692. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22693. return $core.withContext(function($ctx3) {
  22694. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22695. return $core.withContext(function($ctx4) {
  22696. return $recv(eachTT)._trait();
  22697. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22698. })));
  22699. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22700. }));
  22701. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22702. })));
  22703. $recv($1)._remove_ifAbsent_(nil,(function(){
  22704. }));
  22705. return $recv($1)._yourself();
  22706. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22707. },
  22708. args: [],
  22709. 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",
  22710. referencedClasses: ["Smalltalk", "Array"],
  22711. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22712. }),
  22713. $globals.Package);
  22714. $core.addMethod(
  22715. $core.method({
  22716. selector: "name",
  22717. protocol: "accessing",
  22718. fn: function (){
  22719. var self=this,$self=this;
  22720. return $self["@name"];
  22721. },
  22722. args: [],
  22723. source: "name\x0a\x09^ name",
  22724. referencedClasses: [],
  22725. messageSends: []
  22726. }),
  22727. $globals.Package);
  22728. $core.addMethod(
  22729. $core.method({
  22730. selector: "name:",
  22731. protocol: "accessing",
  22732. fn: function (aString){
  22733. var self=this,$self=this;
  22734. $self["@name"]=aString;
  22735. return self;
  22736. },
  22737. args: ["aString"],
  22738. source: "name: aString\x0a\x09name := aString",
  22739. referencedClasses: [],
  22740. messageSends: []
  22741. }),
  22742. $globals.Package);
  22743. $core.addMethod(
  22744. $core.method({
  22745. selector: "organization",
  22746. protocol: "accessing",
  22747. fn: function (){
  22748. var self=this,$self=this;
  22749. return $self["@organization"];
  22750. },
  22751. args: [],
  22752. source: "organization\x0a\x09^ organization",
  22753. referencedClasses: [],
  22754. messageSends: []
  22755. }),
  22756. $globals.Package);
  22757. $core.addMethod(
  22758. $core.method({
  22759. selector: "printOn:",
  22760. protocol: "printing",
  22761. fn: function (aStream){
  22762. var self=this,$self=this;
  22763. return $core.withContext(function($ctx1) {
  22764. (
  22765. $ctx1.supercall = true,
  22766. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22767. $ctx1.supercall = false;
  22768. $recv(aStream)._nextPutAll_(" (");
  22769. $ctx1.sendIdx["nextPutAll:"]=1;
  22770. $recv(aStream)._nextPutAll_($self._name());
  22771. $ctx1.sendIdx["nextPutAll:"]=2;
  22772. $recv(aStream)._nextPutAll_(")");
  22773. return self;
  22774. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22775. },
  22776. args: ["aStream"],
  22777. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22778. referencedClasses: [],
  22779. messageSends: ["printOn:", "nextPutAll:", "name"]
  22780. }),
  22781. $globals.Package);
  22782. $core.addMethod(
  22783. $core.method({
  22784. selector: "setupClasses",
  22785. protocol: "classes",
  22786. fn: function (){
  22787. var self=this,$self=this;
  22788. return $core.withContext(function($ctx1) {
  22789. $recv($self._classes())._do_((function(each){
  22790. return $core.withContext(function($ctx2) {
  22791. return $recv(each)._initialize();
  22792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22793. }));
  22794. return self;
  22795. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22796. },
  22797. args: [],
  22798. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22799. referencedClasses: [],
  22800. messageSends: ["do:", "classes", "initialize"]
  22801. }),
  22802. $globals.Package);
  22803. $core.addMethod(
  22804. $core.method({
  22805. selector: "sortedClasses",
  22806. protocol: "classes",
  22807. fn: function (){
  22808. var self=this,$self=this;
  22809. return $core.withContext(function($ctx1) {
  22810. return $recv($self._class())._sortedClasses_($self._classes());
  22811. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22812. },
  22813. args: [],
  22814. 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",
  22815. referencedClasses: [],
  22816. messageSends: ["sortedClasses:", "class", "classes"]
  22817. }),
  22818. $globals.Package);
  22819. $core.addMethod(
  22820. $core.method({
  22821. selector: "sortedImportsAsArray",
  22822. protocol: "private",
  22823. fn: function (){
  22824. var self=this,$self=this;
  22825. return $core.withContext(function($ctx1) {
  22826. var $3,$2,$4,$1,$6,$5,$7;
  22827. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22828. return $core.withContext(function($ctx2) {
  22829. $3=$recv(a)._isString();
  22830. $ctx2.sendIdx["isString"]=1;
  22831. $2=$recv($3)._not();
  22832. $4=$recv(b)._isString();
  22833. $ctx2.sendIdx["isString"]=2;
  22834. $1=$recv($2).__and($4);
  22835. return $recv($1)._or_((function(){
  22836. return $core.withContext(function($ctx3) {
  22837. $6=$recv(a)._isString();
  22838. $ctx3.sendIdx["isString"]=3;
  22839. $5=$recv($6).__eq($recv(b)._isString());
  22840. return $recv($5)._and_((function(){
  22841. return $core.withContext(function($ctx4) {
  22842. $7=$recv(a)._value();
  22843. $ctx4.sendIdx["value"]=1;
  22844. return $recv($7).__lt_eq($recv(b)._value());
  22845. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22846. }));
  22847. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22848. }));
  22849. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22850. }));
  22851. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22852. },
  22853. args: [],
  22854. 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 ]]]",
  22855. referencedClasses: [],
  22856. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22857. }),
  22858. $globals.Package);
  22859. $core.addMethod(
  22860. $core.method({
  22861. selector: "traitCompositions",
  22862. protocol: "dependencies",
  22863. fn: function (){
  22864. var self=this,$self=this;
  22865. var traitCompositions;
  22866. return $core.withContext(function($ctx1) {
  22867. var $1,$2,$3,$receiver;
  22868. traitCompositions=$recv($globals.Dictionary)._new();
  22869. $recv($self._classes())._do_((function(each){
  22870. return $core.withContext(function($ctx2) {
  22871. $1=traitCompositions;
  22872. $2=$recv(each)._traitComposition();
  22873. $ctx2.sendIdx["traitComposition"]=1;
  22874. $recv($1)._at_put_(each,$2);
  22875. $ctx2.sendIdx["at:put:"]=1;
  22876. $3=$recv(each)._theMetaClass();
  22877. if(($receiver = $3) == null || $receiver.a$nil){
  22878. return $3;
  22879. } else {
  22880. var meta;
  22881. meta=$receiver;
  22882. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22883. }
  22884. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22885. }));
  22886. return $recv(traitCompositions)._reject_((function(each){
  22887. return $core.withContext(function($ctx2) {
  22888. return $recv(each)._isEmpty();
  22889. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22890. }));
  22891. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22892. },
  22893. args: [],
  22894. 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 ]",
  22895. referencedClasses: ["Dictionary"],
  22896. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22897. }),
  22898. $globals.Package);
  22899. $core.addMethod(
  22900. $core.method({
  22901. selector: "transport",
  22902. protocol: "accessing",
  22903. fn: function (){
  22904. var self=this,$self=this;
  22905. return $core.withContext(function($ctx1) {
  22906. var $1,$receiver;
  22907. $1=$self["@transport"];
  22908. if(($receiver = $1) == null || $receiver.a$nil){
  22909. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22910. return $self["@transport"];
  22911. } else {
  22912. return $1;
  22913. }
  22914. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22915. },
  22916. args: [],
  22917. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22918. referencedClasses: ["PackageTransport"],
  22919. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22920. }),
  22921. $globals.Package);
  22922. $core.addMethod(
  22923. $core.method({
  22924. selector: "transport:",
  22925. protocol: "accessing",
  22926. fn: function (aPackageTransport){
  22927. var self=this,$self=this;
  22928. return $core.withContext(function($ctx1) {
  22929. $self["@transport"]=aPackageTransport;
  22930. $recv(aPackageTransport)._package_(self);
  22931. return self;
  22932. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22933. },
  22934. args: ["aPackageTransport"],
  22935. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22936. referencedClasses: [],
  22937. messageSends: ["package:"]
  22938. }),
  22939. $globals.Package);
  22940. $core.addMethod(
  22941. $core.method({
  22942. selector: "validateImports:",
  22943. protocol: "validation",
  22944. fn: function (aCollection){
  22945. var self=this,$self=this;
  22946. return $core.withContext(function($ctx1) {
  22947. var $1,$2,$5,$4,$3,$6;
  22948. $recv(aCollection)._do_((function(import_){
  22949. return $core.withContext(function($ctx2) {
  22950. $1=$recv(import_)._isString();
  22951. $ctx2.sendIdx["isString"]=1;
  22952. if(!$core.assert($1)){
  22953. $2=$recv(import_)._respondsTo_("key");
  22954. if(!$core.assert($2)){
  22955. $self._error_("Imports must be Strings or Associations");
  22956. $ctx2.sendIdx["error:"]=1;
  22957. }
  22958. $5=$recv(import_)._key();
  22959. $ctx2.sendIdx["key"]=1;
  22960. $4=$recv($5)._isString();
  22961. $ctx2.sendIdx["isString"]=2;
  22962. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22963. if(!$core.assert($3)){
  22964. $self._error_("Key and value must be Strings");
  22965. $ctx2.sendIdx["error:"]=2;
  22966. }
  22967. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22968. if(!$core.assert($6)){
  22969. return $self._error_("Keys must be identifiers");
  22970. }
  22971. }
  22972. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22973. }));
  22974. return self;
  22975. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22976. },
  22977. args: ["aCollection"],
  22978. 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' ]]]",
  22979. referencedClasses: [],
  22980. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22981. }),
  22982. $globals.Package);
  22983. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22984. $core.addMethod(
  22985. $core.method({
  22986. selector: "named:",
  22987. protocol: "accessing",
  22988. fn: function (aPackageName){
  22989. var self=this,$self=this;
  22990. return $core.withContext(function($ctx1) {
  22991. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22992. return $core.withContext(function($ctx2) {
  22993. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22995. }));
  22996. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22997. },
  22998. args: ["aPackageName"],
  22999. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  23000. referencedClasses: ["Smalltalk"],
  23001. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  23002. }),
  23003. $globals.Package.a$cls);
  23004. $core.addMethod(
  23005. $core.method({
  23006. selector: "named:ifAbsent:",
  23007. protocol: "accessing",
  23008. fn: function (aPackageName,aBlock){
  23009. var self=this,$self=this;
  23010. return $core.withContext(function($ctx1) {
  23011. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  23012. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  23013. },
  23014. args: ["aPackageName", "aBlock"],
  23015. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  23016. referencedClasses: ["Smalltalk"],
  23017. messageSends: ["packageAt:ifAbsent:"]
  23018. }),
  23019. $globals.Package.a$cls);
  23020. $core.addMethod(
  23021. $core.method({
  23022. selector: "named:imports:transport:",
  23023. protocol: "accessing",
  23024. fn: function (aPackageName,anArray,aTransport){
  23025. var self=this,$self=this;
  23026. var pkg;
  23027. return $core.withContext(function($ctx1) {
  23028. pkg=$self._named_(aPackageName);
  23029. $recv(pkg)._imports_(anArray);
  23030. $recv(pkg)._transport_(aTransport);
  23031. return pkg;
  23032. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23033. },
  23034. args: ["aPackageName", "anArray", "aTransport"],
  23035. 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",
  23036. referencedClasses: [],
  23037. messageSends: ["named:", "imports:", "transport:"]
  23038. }),
  23039. $globals.Package.a$cls);
  23040. $core.addMethod(
  23041. $core.method({
  23042. selector: "named:javaScriptDescriptor:",
  23043. protocol: "instance creation",
  23044. fn: function (aString,anObject){
  23045. var self=this,$self=this;
  23046. var pkg;
  23047. return $core.withContext(function($ctx1) {
  23048. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  23049. $recv(pkg)._javaScriptDescriptor_(anObject);
  23050. return pkg;
  23051. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  23052. },
  23053. args: ["aString", "anObject"],
  23054. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  23055. referencedClasses: ["Smalltalk"],
  23056. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  23057. }),
  23058. $globals.Package.a$cls);
  23059. $core.addMethod(
  23060. $core.method({
  23061. selector: "named:transport:",
  23062. protocol: "accessing",
  23063. fn: function (aPackageName,aTransport){
  23064. var self=this,$self=this;
  23065. var pkg;
  23066. return $core.withContext(function($ctx1) {
  23067. pkg=$self._named_(aPackageName);
  23068. $recv(pkg)._transport_(aTransport);
  23069. return pkg;
  23070. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23071. },
  23072. args: ["aPackageName", "aTransport"],
  23073. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  23074. referencedClasses: [],
  23075. messageSends: ["named:", "transport:"]
  23076. }),
  23077. $globals.Package.a$cls);
  23078. $core.addMethod(
  23079. $core.method({
  23080. selector: "new:",
  23081. protocol: "instance creation",
  23082. fn: function (aString){
  23083. var self=this,$self=this;
  23084. return $core.withContext(function($ctx1) {
  23085. var $1;
  23086. $1=$recv($globals.Package)._new();
  23087. $recv($1)._name_(aString);
  23088. return $recv($1)._yourself();
  23089. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  23090. },
  23091. args: ["aString"],
  23092. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  23093. referencedClasses: ["Package"],
  23094. messageSends: ["name:", "new", "yourself"]
  23095. }),
  23096. $globals.Package.a$cls);
  23097. $core.addMethod(
  23098. $core.method({
  23099. selector: "sortedClasses:",
  23100. protocol: "sorting",
  23101. fn: function (classes){
  23102. var self=this,$self=this;
  23103. var children,others,nodes,expandedClasses;
  23104. return $core.withContext(function($ctx1) {
  23105. var $1,$3,$2;
  23106. children=[];
  23107. others=[];
  23108. $recv(classes)._do_((function(each){
  23109. return $core.withContext(function($ctx2) {
  23110. $1=$recv(classes)._includes_($recv(each)._superclass());
  23111. if($core.assert($1)){
  23112. return $recv(others)._add_(each);
  23113. } else {
  23114. return $recv(children)._add_(each);
  23115. $ctx2.sendIdx["add:"]=1;
  23116. }
  23117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23118. }));
  23119. $ctx1.sendIdx["do:"]=1;
  23120. nodes=$recv(children)._collect_((function(each){
  23121. return $core.withContext(function($ctx2) {
  23122. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  23123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23124. }));
  23125. nodes=$recv(nodes)._sorted_((function(a,b){
  23126. return $core.withContext(function($ctx2) {
  23127. $3=$recv(a)._theClass();
  23128. $ctx2.sendIdx["theClass"]=1;
  23129. $2=$recv($3)._name();
  23130. $ctx2.sendIdx["name"]=1;
  23131. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  23132. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  23133. }));
  23134. expandedClasses=$recv($globals.Array)._new();
  23135. $recv(nodes)._do_((function(aNode){
  23136. return $core.withContext(function($ctx2) {
  23137. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  23138. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  23139. }));
  23140. return expandedClasses;
  23141. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  23142. },
  23143. args: ["classes"],
  23144. 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",
  23145. referencedClasses: ["ClassSorterNode", "Array"],
  23146. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23147. }),
  23148. $globals.Package.a$cls);
  23149. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23150. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23151. $core.addMethod(
  23152. $core.method({
  23153. selector: "announcer",
  23154. protocol: "accessing",
  23155. fn: function (){
  23156. var self=this,$self=this;
  23157. return $core.withContext(function($ctx1) {
  23158. return $recv($globals.SystemAnnouncer)._current();
  23159. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23160. },
  23161. args: [],
  23162. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23163. referencedClasses: ["SystemAnnouncer"],
  23164. messageSends: ["current"]
  23165. }),
  23166. $globals.PackageStateObserver);
  23167. $core.addMethod(
  23168. $core.method({
  23169. selector: "observeSystem",
  23170. protocol: "actions",
  23171. fn: function (){
  23172. var self=this,$self=this;
  23173. return $core.withContext(function($ctx1) {
  23174. var $1;
  23175. $1=$self._announcer();
  23176. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23177. $ctx1.sendIdx["on:send:to:"]=1;
  23178. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23179. $ctx1.sendIdx["on:send:to:"]=2;
  23180. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23181. $ctx1.sendIdx["on:send:to:"]=3;
  23182. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23183. return self;
  23184. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23185. },
  23186. args: [],
  23187. 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",
  23188. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23189. messageSends: ["on:send:to:", "announcer"]
  23190. }),
  23191. $globals.PackageStateObserver);
  23192. $core.addMethod(
  23193. $core.method({
  23194. selector: "onClassModification:",
  23195. protocol: "reactions",
  23196. fn: function (anAnnouncement){
  23197. var self=this,$self=this;
  23198. return $core.withContext(function($ctx1) {
  23199. var $1,$receiver;
  23200. $1=$recv(anAnnouncement)._theClass();
  23201. if(($receiver = $1) == null || $receiver.a$nil){
  23202. $1;
  23203. } else {
  23204. var theClass;
  23205. theClass=$receiver;
  23206. $recv($recv(theClass)._package())._beDirty();
  23207. }
  23208. return self;
  23209. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23210. },
  23211. args: ["anAnnouncement"],
  23212. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23213. referencedClasses: [],
  23214. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23215. }),
  23216. $globals.PackageStateObserver);
  23217. $core.addMethod(
  23218. $core.method({
  23219. selector: "onMethodModification:",
  23220. protocol: "reactions",
  23221. fn: function (anAnnouncement){
  23222. var self=this,$self=this;
  23223. return $core.withContext(function($ctx1) {
  23224. var $1,$receiver;
  23225. $1=$recv($recv(anAnnouncement)._method())._package();
  23226. if(($receiver = $1) == null || $receiver.a$nil){
  23227. $1;
  23228. } else {
  23229. var package_;
  23230. package_=$receiver;
  23231. $recv(package_)._beDirty();
  23232. }
  23233. return self;
  23234. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23235. },
  23236. args: ["anAnnouncement"],
  23237. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23238. referencedClasses: [],
  23239. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23240. }),
  23241. $globals.PackageStateObserver);
  23242. $core.addMethod(
  23243. $core.method({
  23244. selector: "onPackageAdded:",
  23245. protocol: "reactions",
  23246. fn: function (anAnnouncement){
  23247. var self=this,$self=this;
  23248. return $core.withContext(function($ctx1) {
  23249. $recv($recv(anAnnouncement)._package())._beDirty();
  23250. return self;
  23251. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23252. },
  23253. args: ["anAnnouncement"],
  23254. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23255. referencedClasses: [],
  23256. messageSends: ["beDirty", "package"]
  23257. }),
  23258. $globals.PackageStateObserver);
  23259. $core.addMethod(
  23260. $core.method({
  23261. selector: "onProtocolModification:",
  23262. protocol: "reactions",
  23263. fn: function (anAnnouncement){
  23264. var self=this,$self=this;
  23265. return $core.withContext(function($ctx1) {
  23266. var $1,$receiver;
  23267. $1=$recv(anAnnouncement)._package();
  23268. if(($receiver = $1) == null || $receiver.a$nil){
  23269. $1;
  23270. } else {
  23271. var package_;
  23272. package_=$receiver;
  23273. $recv(package_)._beDirty();
  23274. }
  23275. return self;
  23276. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23277. },
  23278. args: ["anAnnouncement"],
  23279. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23280. referencedClasses: [],
  23281. messageSends: ["ifNotNil:", "package", "beDirty"]
  23282. }),
  23283. $globals.PackageStateObserver);
  23284. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23285. $core.addMethod(
  23286. $core.method({
  23287. selector: "current",
  23288. protocol: "accessing",
  23289. fn: function (){
  23290. var self=this,$self=this;
  23291. return $core.withContext(function($ctx1) {
  23292. var $1,$receiver;
  23293. $1=$self["@current"];
  23294. if(($receiver = $1) == null || $receiver.a$nil){
  23295. $self["@current"]=$self._new();
  23296. return $self["@current"];
  23297. } else {
  23298. return $1;
  23299. }
  23300. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23301. },
  23302. args: [],
  23303. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23304. referencedClasses: [],
  23305. messageSends: ["ifNil:", "new"]
  23306. }),
  23307. $globals.PackageStateObserver.a$cls);
  23308. $core.addMethod(
  23309. $core.method({
  23310. selector: "initialize",
  23311. protocol: "initialization",
  23312. fn: function (){
  23313. var self=this,$self=this;
  23314. return $core.withContext(function($ctx1) {
  23315. $recv($self._current())._observeSystem();
  23316. return self;
  23317. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23318. },
  23319. args: [],
  23320. source: "initialize\x0a\x09self current observeSystem",
  23321. referencedClasses: [],
  23322. messageSends: ["observeSystem", "current"]
  23323. }),
  23324. $globals.PackageStateObserver.a$cls);
  23325. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23326. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23327. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23328. $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`";
  23329. $core.addMethod(
  23330. $core.method({
  23331. selector: "defaultValue",
  23332. protocol: "accessing",
  23333. fn: function (){
  23334. var self=this,$self=this;
  23335. return $self["@defaultValue"];
  23336. },
  23337. args: [],
  23338. source: "defaultValue\x0a\x09^ defaultValue",
  23339. referencedClasses: [],
  23340. messageSends: []
  23341. }),
  23342. $globals.Setting);
  23343. $core.addMethod(
  23344. $core.method({
  23345. selector: "defaultValue:",
  23346. protocol: "accessing",
  23347. fn: function (aStringifiableObject){
  23348. var self=this,$self=this;
  23349. $self["@defaultValue"]=aStringifiableObject;
  23350. return self;
  23351. },
  23352. args: ["aStringifiableObject"],
  23353. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23354. referencedClasses: [],
  23355. messageSends: []
  23356. }),
  23357. $globals.Setting);
  23358. $core.addMethod(
  23359. $core.method({
  23360. selector: "key",
  23361. protocol: "accessing",
  23362. fn: function (){
  23363. var self=this,$self=this;
  23364. return $self["@key"];
  23365. },
  23366. args: [],
  23367. source: "key\x0a\x09^ key",
  23368. referencedClasses: [],
  23369. messageSends: []
  23370. }),
  23371. $globals.Setting);
  23372. $core.addMethod(
  23373. $core.method({
  23374. selector: "key:",
  23375. protocol: "accessing",
  23376. fn: function (aString){
  23377. var self=this,$self=this;
  23378. $self["@key"]=aString;
  23379. return self;
  23380. },
  23381. args: ["aString"],
  23382. source: "key: aString\x0a\x09key := aString",
  23383. referencedClasses: [],
  23384. messageSends: []
  23385. }),
  23386. $globals.Setting);
  23387. $core.addMethod(
  23388. $core.method({
  23389. selector: "value",
  23390. protocol: "accessing",
  23391. fn: function (){
  23392. var self=this,$self=this;
  23393. return $core.withContext(function($ctx1) {
  23394. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23395. return $core.withContext(function($ctx2) {
  23396. return $self._defaultValue();
  23397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23398. }));
  23399. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23400. },
  23401. args: [],
  23402. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23403. referencedClasses: ["Smalltalk"],
  23404. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23405. }),
  23406. $globals.Setting);
  23407. $core.addMethod(
  23408. $core.method({
  23409. selector: "value:",
  23410. protocol: "accessing",
  23411. fn: function (aStringifiableObject){
  23412. var self=this,$self=this;
  23413. return $core.withContext(function($ctx1) {
  23414. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23415. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23416. },
  23417. args: ["aStringifiableObject"],
  23418. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23419. referencedClasses: ["Smalltalk"],
  23420. messageSends: ["at:put:", "settings", "key"]
  23421. }),
  23422. $globals.Setting);
  23423. $core.addMethod(
  23424. $core.method({
  23425. selector: "at:ifAbsent:",
  23426. protocol: "instance creation",
  23427. fn: function (aString,aDefaultValue){
  23428. var self=this,$self=this;
  23429. return $core.withContext(function($ctx1) {
  23430. var $1;
  23431. $1=(
  23432. $ctx1.supercall = true,
  23433. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23434. $ctx1.supercall = false;
  23435. $recv($1)._key_(aString);
  23436. $recv($1)._defaultValue_(aDefaultValue);
  23437. return $recv($1)._yourself();
  23438. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23439. },
  23440. args: ["aString", "aDefaultValue"],
  23441. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23442. referencedClasses: [],
  23443. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23444. }),
  23445. $globals.Setting.a$cls);
  23446. $core.addMethod(
  23447. $core.method({
  23448. selector: "new",
  23449. protocol: "instance creation",
  23450. fn: function (){
  23451. var self=this,$self=this;
  23452. return $core.withContext(function($ctx1) {
  23453. $self._shouldNotImplement();
  23454. return self;
  23455. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23456. },
  23457. args: [],
  23458. source: "new\x0a\x09self shouldNotImplement",
  23459. referencedClasses: [],
  23460. messageSends: ["shouldNotImplement"]
  23461. }),
  23462. $globals.Setting.a$cls);
  23463. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23464. $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.";
  23465. $core.addMethod(
  23466. $core.method({
  23467. selector: "addGlobalJsVariable:",
  23468. protocol: "globals",
  23469. fn: function (aString){
  23470. var self=this,$self=this;
  23471. return $core.withContext(function($ctx1) {
  23472. $recv($self._globalJsVariables())._add_(aString);
  23473. return self;
  23474. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23475. },
  23476. args: ["aString"],
  23477. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23478. referencedClasses: [],
  23479. messageSends: ["add:", "globalJsVariables"]
  23480. }),
  23481. $globals.SmalltalkImage);
  23482. $core.addMethod(
  23483. $core.method({
  23484. selector: "adoptPackageDescriptors",
  23485. protocol: "private",
  23486. fn: function (){
  23487. var self=this,$self=this;
  23488. var pkgs;
  23489. return $core.withContext(function($ctx1) {
  23490. pkgs=$recv($globals.Set)._new();
  23491. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23492. return $core.withContext(function($ctx2) {
  23493. return $recv(pkgs)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  23494. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23495. }));
  23496. return pkgs;
  23497. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{pkgs:pkgs},$globals.SmalltalkImage)});
  23498. },
  23499. args: [],
  23500. source: "adoptPackageDescriptors\x0a\x09| pkgs |\x0a\x09pkgs := Set new.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09pkgs add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ pkgs",
  23501. referencedClasses: ["Set", "Package"],
  23502. messageSends: ["new", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  23503. }),
  23504. $globals.SmalltalkImage);
  23505. $core.addMethod(
  23506. $core.method({
  23507. selector: "amdRequire",
  23508. protocol: "accessing amd",
  23509. fn: function (){
  23510. var self=this,$self=this;
  23511. return $core.withContext(function($ctx1) {
  23512. return $recv($self._core())._at_("amdRequire");
  23513. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23514. },
  23515. args: [],
  23516. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23517. referencedClasses: [],
  23518. messageSends: ["at:", "core"]
  23519. }),
  23520. $globals.SmalltalkImage);
  23521. $core.addMethod(
  23522. $core.method({
  23523. selector: "asSmalltalkException:",
  23524. protocol: "error handling",
  23525. fn: function (anObject){
  23526. var self=this,$self=this;
  23527. return $core.withContext(function($ctx1) {
  23528. var $1;
  23529. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23530. return $core.withContext(function($ctx2) {
  23531. return $recv(anObject)._isKindOf_($globals.Error);
  23532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23533. }));
  23534. if($core.assert($1)){
  23535. return anObject;
  23536. } else {
  23537. return $recv($globals.JavaScriptException)._on_(anObject);
  23538. }
  23539. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23540. },
  23541. args: ["anObject"],
  23542. 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 ]",
  23543. referencedClasses: ["Error", "JavaScriptException"],
  23544. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23545. }),
  23546. $globals.SmalltalkImage);
  23547. $core.addMethod(
  23548. $core.method({
  23549. selector: "basicCreatePackage:",
  23550. protocol: "private",
  23551. fn: function (packageName){
  23552. var self=this,$self=this;
  23553. return $core.withContext(function($ctx1) {
  23554. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23555. return $core.withContext(function($ctx2) {
  23556. return $recv($globals.Package)._new_(packageName);
  23557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23558. }));
  23559. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23560. },
  23561. args: ["packageName"],
  23562. 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 ]",
  23563. referencedClasses: ["Package"],
  23564. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23565. }),
  23566. $globals.SmalltalkImage);
  23567. $core.addMethod(
  23568. $core.method({
  23569. selector: "basicParse:",
  23570. protocol: "private",
  23571. fn: function (aString){
  23572. var self=this,$self=this;
  23573. return $core.withContext(function($ctx1) {
  23574. return $recv($globals.SmalltalkParser)._parse_(aString);
  23575. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23576. },
  23577. args: ["aString"],
  23578. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23579. referencedClasses: ["SmalltalkParser"],
  23580. messageSends: ["parse:"]
  23581. }),
  23582. $globals.SmalltalkImage);
  23583. $core.addMethod(
  23584. $core.method({
  23585. selector: "cancelOptOut:",
  23586. protocol: "accessing",
  23587. fn: function (anObject){
  23588. var self=this,$self=this;
  23589. return $core.withContext(function($ctx1) {
  23590. delete anObject.klass; delete anObject.a$cls;;
  23591. return self;
  23592. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23593. },
  23594. args: ["anObject"],
  23595. 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;'>",
  23596. referencedClasses: [],
  23597. messageSends: []
  23598. }),
  23599. $globals.SmalltalkImage);
  23600. $core.addMethod(
  23601. $core.method({
  23602. selector: "classes",
  23603. protocol: "classes",
  23604. fn: function (){
  23605. var self=this,$self=this;
  23606. return $core.withContext(function($ctx1) {
  23607. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23608. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23609. },
  23610. args: [],
  23611. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23612. referencedClasses: [],
  23613. messageSends: ["copy", "traitsOrClasses", "core"]
  23614. }),
  23615. $globals.SmalltalkImage);
  23616. $core.addMethod(
  23617. $core.method({
  23618. selector: "core",
  23619. protocol: "accessing",
  23620. fn: function (){
  23621. var self=this,$self=this;
  23622. return $core.withContext(function($ctx1) {
  23623. return $core;
  23624. return self;
  23625. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23626. },
  23627. args: [],
  23628. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23629. referencedClasses: [],
  23630. messageSends: []
  23631. }),
  23632. $globals.SmalltalkImage);
  23633. $core.addMethod(
  23634. $core.method({
  23635. selector: "createPackage:",
  23636. protocol: "packages",
  23637. fn: function (packageName){
  23638. var self=this,$self=this;
  23639. var package_,announcement;
  23640. return $core.withContext(function($ctx1) {
  23641. var $1;
  23642. package_=$self._basicCreatePackage_(packageName);
  23643. $1=$recv($globals.PackageAdded)._new();
  23644. $recv($1)._package_(package_);
  23645. announcement=$recv($1)._yourself();
  23646. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23647. return package_;
  23648. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23649. },
  23650. args: ["packageName"],
  23651. 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",
  23652. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23653. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23654. }),
  23655. $globals.SmalltalkImage);
  23656. $core.addMethod(
  23657. $core.method({
  23658. selector: "defaultAmdNamespace",
  23659. protocol: "accessing amd",
  23660. fn: function (){
  23661. var self=this,$self=this;
  23662. return $core.withContext(function($ctx1) {
  23663. return "transport.defaultAmdNamespace"._settingValue();
  23664. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23665. },
  23666. args: [],
  23667. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23668. referencedClasses: [],
  23669. messageSends: ["settingValue"]
  23670. }),
  23671. $globals.SmalltalkImage);
  23672. $core.addMethod(
  23673. $core.method({
  23674. selector: "defaultAmdNamespace:",
  23675. protocol: "accessing amd",
  23676. fn: function (aString){
  23677. var self=this,$self=this;
  23678. return $core.withContext(function($ctx1) {
  23679. "transport.defaultAmdNamespace"._settingValue_(aString);
  23680. return self;
  23681. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23682. },
  23683. args: ["aString"],
  23684. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23685. referencedClasses: [],
  23686. messageSends: ["settingValue:"]
  23687. }),
  23688. $globals.SmalltalkImage);
  23689. $core.addMethod(
  23690. $core.method({
  23691. selector: "deleteClass:",
  23692. protocol: "private",
  23693. fn: function (aClass){
  23694. var self=this,$self=this;
  23695. return $core.withContext(function($ctx1) {
  23696. $core.removeClass(aClass);
  23697. return self;
  23698. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23699. },
  23700. args: ["aClass"],
  23701. 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)'>",
  23702. referencedClasses: [],
  23703. messageSends: []
  23704. }),
  23705. $globals.SmalltalkImage);
  23706. $core.addMethod(
  23707. $core.method({
  23708. selector: "deleteGlobalJsVariable:",
  23709. protocol: "globals",
  23710. fn: function (aString){
  23711. var self=this,$self=this;
  23712. return $core.withContext(function($ctx1) {
  23713. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23714. }));
  23715. return self;
  23716. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23717. },
  23718. args: ["aString"],
  23719. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23720. referencedClasses: [],
  23721. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23722. }),
  23723. $globals.SmalltalkImage);
  23724. $core.addMethod(
  23725. $core.method({
  23726. selector: "existsJsGlobal:",
  23727. protocol: "testing",
  23728. fn: function (aString){
  23729. var self=this,$self=this;
  23730. return $core.withContext(function($ctx1) {
  23731. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23732. return $recv($globals.Platform)._includesGlobal_(aString);
  23733. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23734. },
  23735. args: ["aString"],
  23736. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23737. referencedClasses: ["Platform"],
  23738. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23739. }),
  23740. $globals.SmalltalkImage);
  23741. $core.addMethod(
  23742. $core.method({
  23743. selector: "globalJsVariables",
  23744. protocol: "globals",
  23745. fn: function (){
  23746. var self=this,$self=this;
  23747. return $core.withContext(function($ctx1) {
  23748. var $1,$receiver;
  23749. $1=$self["@globalJsVariables"];
  23750. if(($receiver = $1) == null || $receiver.a$nil){
  23751. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23752. return $self["@globalJsVariables"];
  23753. } else {
  23754. return $1;
  23755. }
  23756. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23757. },
  23758. args: [],
  23759. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23760. referencedClasses: [],
  23761. messageSends: ["ifNil:"]
  23762. }),
  23763. $globals.SmalltalkImage);
  23764. $core.addMethod(
  23765. $core.method({
  23766. selector: "globals",
  23767. protocol: "accessing",
  23768. fn: function (){
  23769. var self=this,$self=this;
  23770. return $core.withContext(function($ctx1) {
  23771. return $globals;
  23772. return self;
  23773. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23774. },
  23775. args: [],
  23776. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23777. referencedClasses: [],
  23778. messageSends: []
  23779. }),
  23780. $globals.SmalltalkImage);
  23781. $core.addMethod(
  23782. $core.method({
  23783. selector: "includesKey:",
  23784. protocol: "accessing",
  23785. fn: function (aKey){
  23786. var self=this,$self=this;
  23787. return $core.withContext(function($ctx1) {
  23788. return $core.hasOwnProperty(aKey);
  23789. return self;
  23790. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23791. },
  23792. args: ["aKey"],
  23793. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23794. referencedClasses: [],
  23795. messageSends: []
  23796. }),
  23797. $globals.SmalltalkImage);
  23798. $core.addMethod(
  23799. $core.method({
  23800. selector: "isSmalltalkObject:",
  23801. protocol: "testing",
  23802. fn: function (anObject){
  23803. var self=this,$self=this;
  23804. return $core.withContext(function($ctx1) {
  23805. return anObject.a$cls != null;
  23806. return self;
  23807. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23808. },
  23809. args: ["anObject"],
  23810. 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'>",
  23811. referencedClasses: [],
  23812. messageSends: []
  23813. }),
  23814. $globals.SmalltalkImage);
  23815. $core.addMethod(
  23816. $core.method({
  23817. selector: "optOut:",
  23818. protocol: "accessing",
  23819. fn: function (anObject){
  23820. var self=this,$self=this;
  23821. return $core.withContext(function($ctx1) {
  23822. anObject.klass = null; anObject.a$cls = null;
  23823. return self;
  23824. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23825. },
  23826. args: ["anObject"],
  23827. 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'>",
  23828. referencedClasses: [],
  23829. messageSends: []
  23830. }),
  23831. $globals.SmalltalkImage);
  23832. $core.addMethod(
  23833. $core.method({
  23834. selector: "packageAt:ifAbsent:",
  23835. protocol: "packages",
  23836. fn: function (packageName,aBlock){
  23837. var self=this,$self=this;
  23838. return $core.withContext(function($ctx1) {
  23839. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23840. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23841. },
  23842. args: ["packageName", "aBlock"],
  23843. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23844. referencedClasses: [],
  23845. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23846. }),
  23847. $globals.SmalltalkImage);
  23848. $core.addMethod(
  23849. $core.method({
  23850. selector: "packageAt:ifPresent:",
  23851. protocol: "packages",
  23852. fn: function (packageName,aBlock){
  23853. var self=this,$self=this;
  23854. return $core.withContext(function($ctx1) {
  23855. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23856. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23857. },
  23858. args: ["packageName", "aBlock"],
  23859. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23860. referencedClasses: [],
  23861. messageSends: ["at:ifPresent:", "packageDictionary"]
  23862. }),
  23863. $globals.SmalltalkImage);
  23864. $core.addMethod(
  23865. $core.method({
  23866. selector: "packageDictionary",
  23867. protocol: "packages",
  23868. fn: function (){
  23869. var self=this,$self=this;
  23870. return $core.withContext(function($ctx1) {
  23871. var $1,$receiver;
  23872. $1=$self["@packageDictionary"];
  23873. if(($receiver = $1) == null || $receiver.a$nil){
  23874. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23875. return $self["@packageDictionary"];
  23876. } else {
  23877. return $1;
  23878. }
  23879. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23880. },
  23881. args: [],
  23882. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23883. referencedClasses: ["Dictionary"],
  23884. messageSends: ["ifNil:", "new"]
  23885. }),
  23886. $globals.SmalltalkImage);
  23887. $core.addMethod(
  23888. $core.method({
  23889. selector: "packages",
  23890. protocol: "packages",
  23891. fn: function (){
  23892. var self=this,$self=this;
  23893. return $core.withContext(function($ctx1) {
  23894. return $recv($recv($self._packageDictionary())._values())._copy();
  23895. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23896. },
  23897. args: [],
  23898. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23899. referencedClasses: [],
  23900. messageSends: ["copy", "values", "packageDictionary"]
  23901. }),
  23902. $globals.SmalltalkImage);
  23903. $core.addMethod(
  23904. $core.method({
  23905. selector: "parse:",
  23906. protocol: "accessing",
  23907. fn: function (aString){
  23908. var self=this,$self=this;
  23909. var result;
  23910. return $core.withContext(function($ctx1) {
  23911. var $1;
  23912. $recv((function(){
  23913. return $core.withContext(function($ctx2) {
  23914. result=$self._basicParse_(aString);
  23915. return result;
  23916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23917. }))._tryCatch_((function(ex){
  23918. return $core.withContext(function($ctx2) {
  23919. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23920. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23921. }));
  23922. $1=result;
  23923. $recv($1)._source_(aString);
  23924. return $recv($1)._yourself();
  23925. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23926. },
  23927. args: ["aString"],
  23928. 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",
  23929. referencedClasses: [],
  23930. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23931. }),
  23932. $globals.SmalltalkImage);
  23933. $core.addMethod(
  23934. $core.method({
  23935. selector: "parseError:parsing:",
  23936. protocol: "error handling",
  23937. fn: function (anException,aString){
  23938. var self=this,$self=this;
  23939. return $core.withContext(function($ctx1) {
  23940. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23941. $1=$recv(anException)._basicAt_("location");
  23942. $ctx1.sendIdx["basicAt:"]=1;
  23943. if(($receiver = $1) == null || $receiver.a$nil){
  23944. return $recv(anException)._pass();
  23945. } else {
  23946. var loc;
  23947. loc=$receiver;
  23948. $2=$recv($globals.ParseError)._new();
  23949. $9=$recv(loc)._start();
  23950. $ctx1.sendIdx["start"]=1;
  23951. $8=$recv($9)._line();
  23952. $7="Parse error on line ".__comma($8);
  23953. $6=$recv($7).__comma(" column ");
  23954. $ctx1.sendIdx[","]=4;
  23955. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  23956. $ctx1.sendIdx[","]=3;
  23957. $4=$recv($5).__comma(" : Unexpected character ");
  23958. $ctx1.sendIdx[","]=2;
  23959. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23960. $ctx1.sendIdx[","]=1;
  23961. $recv($2)._messageText_($3);
  23962. return $recv($2)._yourself();
  23963. }
  23964. return self;
  23965. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  23966. },
  23967. args: ["anException", "aString"],
  23968. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  23969. referencedClasses: ["ParseError"],
  23970. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  23971. }),
  23972. $globals.SmalltalkImage);
  23973. $core.addMethod(
  23974. $core.method({
  23975. selector: "postLoad",
  23976. protocol: "image",
  23977. fn: function (){
  23978. var self=this,$self=this;
  23979. var pkgs,classes;
  23980. return $core.withContext(function($ctx1) {
  23981. var $1;
  23982. pkgs=$self._adoptPackageDescriptors();
  23983. $recv(pkgs)._do_("beClean");
  23984. $ctx1.sendIdx["do:"]=1;
  23985. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23986. return $core.withContext(function($ctx2) {
  23987. return $recv(pkgs)._includes_($recv(each)._package());
  23988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23989. }));
  23990. $recv(classes)._do_((function(each){
  23991. return $core.withContext(function($ctx2) {
  23992. $1=$recv(each).__eq($self._class());
  23993. if(!$core.assert($1)){
  23994. return $recv(each)._initialize();
  23995. }
  23996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23997. }));
  23998. $self._sweepPackageDescriptors_(pkgs);
  23999. return self;
  24000. }, function($ctx1) {$ctx1.fill(self,"postLoad",{pkgs:pkgs,classes:classes},$globals.SmalltalkImage)});
  24001. },
  24002. args: [],
  24003. source: "postLoad\x0a\x09| pkgs classes |\x0a\x09pkgs := self adoptPackageDescriptors.\x0a\x09pkgs do: #beClean.\x0a\x09classes := Smalltalk classes select:\x0a\x09\x09[ :each | pkgs includes: each package ].\x0a\x09classes do: [ :each |\x0a\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09self sweepPackageDescriptors: pkgs",
  24004. referencedClasses: ["Smalltalk"],
  24005. messageSends: ["adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  24006. }),
  24007. $globals.SmalltalkImage);
  24008. $core.addMethod(
  24009. $core.method({
  24010. selector: "pseudoVariableNames",
  24011. protocol: "accessing",
  24012. fn: function (){
  24013. var self=this,$self=this;
  24014. return ["self", "super", "nil", "true", "false", "thisContext"];
  24015. },
  24016. args: [],
  24017. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  24018. referencedClasses: [],
  24019. messageSends: []
  24020. }),
  24021. $globals.SmalltalkImage);
  24022. $core.addMethod(
  24023. $core.method({
  24024. selector: "readJSObject:",
  24025. protocol: "accessing",
  24026. fn: function (anObject){
  24027. var self=this,$self=this;
  24028. return $core.withContext(function($ctx1) {
  24029. return $core.readJSObject(anObject);
  24030. return self;
  24031. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  24032. },
  24033. args: ["anObject"],
  24034. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  24035. referencedClasses: [],
  24036. messageSends: []
  24037. }),
  24038. $globals.SmalltalkImage);
  24039. $core.addMethod(
  24040. $core.method({
  24041. selector: "removeClass:",
  24042. protocol: "classes",
  24043. fn: function (aClass){
  24044. var self=this,$self=this;
  24045. return $core.withContext(function($ctx1) {
  24046. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  24047. $1=$recv(aClass)._isMetaclass();
  24048. if($core.assert($1)){
  24049. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  24050. $ctx1.sendIdx[","]=1;
  24051. $self._error_($2);
  24052. $ctx1.sendIdx["error:"]=1;
  24053. }
  24054. $recv(aClass)._allSubclassesDo_((function(subclass){
  24055. return $core.withContext(function($ctx2) {
  24056. $5=$recv(aClass)._name();
  24057. $ctx2.sendIdx["name"]=1;
  24058. $4=$recv($5).__comma(" has a subclass: ");
  24059. $ctx2.sendIdx[","]=3;
  24060. $6=$recv(subclass)._name();
  24061. $ctx2.sendIdx["name"]=2;
  24062. $3=$recv($4).__comma($6);
  24063. $ctx2.sendIdx[","]=2;
  24064. return $self._error_($3);
  24065. $ctx2.sendIdx["error:"]=2;
  24066. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  24067. }));
  24068. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  24069. return $core.withContext(function($ctx2) {
  24070. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  24071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  24072. }));
  24073. $self._deleteClass_(aClass);
  24074. $recv(aClass)._setTraitComposition_([]);
  24075. $ctx1.sendIdx["setTraitComposition:"]=1;
  24076. $7=$recv(aClass)._theMetaClass();
  24077. if(($receiver = $7) == null || $receiver.a$nil){
  24078. $7;
  24079. } else {
  24080. var meta;
  24081. meta=$receiver;
  24082. $recv(meta)._setTraitComposition_([]);
  24083. }
  24084. $8=$recv($globals.SystemAnnouncer)._current();
  24085. $10=$recv($globals.ClassRemoved)._new();
  24086. $recv($10)._theClass_(aClass);
  24087. $9=$recv($10)._yourself();
  24088. $recv($8)._announce_($9);
  24089. return self;
  24090. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  24091. },
  24092. args: ["aClass"],
  24093. 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)",
  24094. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  24095. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  24096. }),
  24097. $globals.SmalltalkImage);
  24098. $core.addMethod(
  24099. $core.method({
  24100. selector: "removePackage:",
  24101. protocol: "packages",
  24102. fn: function (packageName){
  24103. var self=this,$self=this;
  24104. var pkg;
  24105. return $core.withContext(function($ctx1) {
  24106. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24107. return $core.withContext(function($ctx2) {
  24108. return $self._error_("Missing package: ".__comma(packageName));
  24109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24110. }));
  24111. $recv($recv(pkg)._classes())._do_((function(each){
  24112. return $core.withContext(function($ctx2) {
  24113. return $self._removeClass_(each);
  24114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24115. }));
  24116. $recv($self._packageDictionary())._removeKey_(packageName);
  24117. return self;
  24118. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  24119. },
  24120. args: ["packageName"],
  24121. 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",
  24122. referencedClasses: [],
  24123. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  24124. }),
  24125. $globals.SmalltalkImage);
  24126. $core.addMethod(
  24127. $core.method({
  24128. selector: "renamePackage:to:",
  24129. protocol: "packages",
  24130. fn: function (packageName,newName){
  24131. var self=this,$self=this;
  24132. var pkg;
  24133. return $core.withContext(function($ctx1) {
  24134. var $1,$2,$3;
  24135. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24136. return $core.withContext(function($ctx2) {
  24137. $1="Missing package: ".__comma(packageName);
  24138. $ctx2.sendIdx[","]=1;
  24139. return $self._error_($1);
  24140. $ctx2.sendIdx["error:"]=1;
  24141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24142. }));
  24143. $self._packageAt_ifPresent_(newName,(function(){
  24144. return $core.withContext(function($ctx2) {
  24145. return $self._error_("Already exists a package called: ".__comma(newName));
  24146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24147. }));
  24148. $2=pkg;
  24149. $recv($2)._name_(newName);
  24150. $recv($2)._beDirty();
  24151. $3=$self._packageDictionary();
  24152. $recv($3)._at_put_(newName,pkg);
  24153. $recv($3)._removeKey_(packageName);
  24154. return self;
  24155. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24156. },
  24157. args: ["packageName", "newName"],
  24158. 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",
  24159. referencedClasses: [],
  24160. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24161. }),
  24162. $globals.SmalltalkImage);
  24163. $core.addMethod(
  24164. $core.method({
  24165. selector: "reservedWords",
  24166. protocol: "accessing",
  24167. fn: function (){
  24168. var self=this,$self=this;
  24169. 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"];
  24170. },
  24171. args: [],
  24172. 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)",
  24173. referencedClasses: [],
  24174. messageSends: []
  24175. }),
  24176. $globals.SmalltalkImage);
  24177. $core.addMethod(
  24178. $core.method({
  24179. selector: "settings",
  24180. protocol: "accessing",
  24181. fn: function (){
  24182. var self=this,$self=this;
  24183. return $globals.SmalltalkSettings;
  24184. },
  24185. args: [],
  24186. source: "settings\x0a\x09^ SmalltalkSettings",
  24187. referencedClasses: ["SmalltalkSettings"],
  24188. messageSends: []
  24189. }),
  24190. $globals.SmalltalkImage);
  24191. $core.addMethod(
  24192. $core.method({
  24193. selector: "sweepPackageDescriptors:",
  24194. protocol: "private",
  24195. fn: function (pkgs){
  24196. var self=this,$self=this;
  24197. var pd;
  24198. return $core.withContext(function($ctx1) {
  24199. pd=$recv($self._core())._packageDescriptors();
  24200. $recv(pkgs)._do_((function(each){
  24201. return $core.withContext(function($ctx2) {
  24202. return $recv(pd)._removeKey_($recv(each)._name());
  24203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24204. }));
  24205. return self;
  24206. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24207. },
  24208. args: ["pkgs"],
  24209. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24210. referencedClasses: [],
  24211. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24212. }),
  24213. $globals.SmalltalkImage);
  24214. $core.addMethod(
  24215. $core.method({
  24216. selector: "version",
  24217. protocol: "accessing",
  24218. fn: function (){
  24219. var self=this,$self=this;
  24220. return "0.22.2";
  24221. },
  24222. args: [],
  24223. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.2'",
  24224. referencedClasses: [],
  24225. messageSends: []
  24226. }),
  24227. $globals.SmalltalkImage);
  24228. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24229. $core.addMethod(
  24230. $core.method({
  24231. selector: "current",
  24232. protocol: "instance creation",
  24233. fn: function (){
  24234. var self=this,$self=this;
  24235. return $core.withContext(function($ctx1) {
  24236. var $1,$receiver;
  24237. $1=$self["@current"];
  24238. if(($receiver = $1) == null || $receiver.a$nil){
  24239. $self["@current"]=(
  24240. $ctx1.supercall = true,
  24241. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24242. $ctx1.supercall = false;
  24243. return $self["@current"];
  24244. } else {
  24245. $self._deprecatedAPI();
  24246. return $self["@current"];
  24247. }
  24248. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24249. },
  24250. args: [],
  24251. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24252. referencedClasses: [],
  24253. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24254. }),
  24255. $globals.SmalltalkImage.a$cls);
  24256. $core.addMethod(
  24257. $core.method({
  24258. selector: "initialize",
  24259. protocol: "initialization",
  24260. fn: function (){
  24261. var self=this,$self=this;
  24262. var st;
  24263. return $core.withContext(function($ctx1) {
  24264. st=$self._current();
  24265. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24266. return self;
  24267. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24268. },
  24269. args: [],
  24270. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24271. referencedClasses: [],
  24272. messageSends: ["current", "at:put:", "globals"]
  24273. }),
  24274. $globals.SmalltalkImage.a$cls);
  24275. $core.addMethod(
  24276. $core.method({
  24277. selector: "new",
  24278. protocol: "instance creation",
  24279. fn: function (){
  24280. var self=this,$self=this;
  24281. return $core.withContext(function($ctx1) {
  24282. $self._shouldNotImplement();
  24283. return self;
  24284. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24285. },
  24286. args: [],
  24287. source: "new\x0a\x09self shouldNotImplement",
  24288. referencedClasses: [],
  24289. messageSends: ["shouldNotImplement"]
  24290. }),
  24291. $globals.SmalltalkImage.a$cls);
  24292. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24293. $core.addMethod(
  24294. $core.method({
  24295. selector: "nextPutJSObject:",
  24296. protocol: "*Kernel-Infrastructure",
  24297. fn: function (aJSObject){
  24298. var self=this,$self=this;
  24299. return $core.withContext(function($ctx1) {
  24300. $self._nextPut_(aJSObject);
  24301. return self;
  24302. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24303. },
  24304. args: ["aJSObject"],
  24305. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24306. referencedClasses: [],
  24307. messageSends: ["nextPut:"]
  24308. }),
  24309. $globals.ProtoStream);
  24310. $core.addMethod(
  24311. $core.method({
  24312. selector: "asJavaScriptPropertyName",
  24313. protocol: "*Kernel-Infrastructure",
  24314. fn: function (){
  24315. var self=this,$self=this;
  24316. return $core.withContext(function($ctx1) {
  24317. return $core.st2prop(self);
  24318. return self;
  24319. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24320. },
  24321. args: [],
  24322. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24323. referencedClasses: [],
  24324. messageSends: []
  24325. }),
  24326. $globals.String);
  24327. $core.addMethod(
  24328. $core.method({
  24329. selector: "asSetting",
  24330. protocol: "*Kernel-Infrastructure",
  24331. fn: function (){
  24332. var self=this,$self=this;
  24333. return $core.withContext(function($ctx1) {
  24334. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24335. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24336. },
  24337. args: [],
  24338. 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",
  24339. referencedClasses: ["Setting"],
  24340. messageSends: ["at:ifAbsent:"]
  24341. }),
  24342. $globals.String);
  24343. $core.addMethod(
  24344. $core.method({
  24345. selector: "asSettingIfAbsent:",
  24346. protocol: "*Kernel-Infrastructure",
  24347. fn: function (aDefaultValue){
  24348. var self=this,$self=this;
  24349. return $core.withContext(function($ctx1) {
  24350. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24351. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24352. },
  24353. args: ["aDefaultValue"],
  24354. 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",
  24355. referencedClasses: ["Setting"],
  24356. messageSends: ["at:ifAbsent:"]
  24357. }),
  24358. $globals.String);
  24359. $core.addMethod(
  24360. $core.method({
  24361. selector: "settingValue",
  24362. protocol: "*Kernel-Infrastructure",
  24363. fn: function (){
  24364. var self=this,$self=this;
  24365. return $core.withContext(function($ctx1) {
  24366. return $recv($self._asSetting())._value();
  24367. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24368. },
  24369. args: [],
  24370. source: "settingValue\x0a\x09^ self asSetting value",
  24371. referencedClasses: [],
  24372. messageSends: ["value", "asSetting"]
  24373. }),
  24374. $globals.String);
  24375. $core.addMethod(
  24376. $core.method({
  24377. selector: "settingValue:",
  24378. protocol: "*Kernel-Infrastructure",
  24379. fn: function (aValue){
  24380. var self=this,$self=this;
  24381. return $core.withContext(function($ctx1) {
  24382. return $recv($self._asSetting())._value_(aValue);
  24383. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24384. },
  24385. args: ["aValue"],
  24386. 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",
  24387. referencedClasses: [],
  24388. messageSends: ["value:", "asSetting"]
  24389. }),
  24390. $globals.String);
  24391. $core.addMethod(
  24392. $core.method({
  24393. selector: "settingValueIfAbsent:",
  24394. protocol: "*Kernel-Infrastructure",
  24395. fn: function (aDefaultValue){
  24396. var self=this,$self=this;
  24397. return $core.withContext(function($ctx1) {
  24398. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24399. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24400. },
  24401. args: ["aDefaultValue"],
  24402. 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",
  24403. referencedClasses: [],
  24404. messageSends: ["value", "asSettingIfAbsent:"]
  24405. }),
  24406. $globals.String);
  24407. });
  24408. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24409. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24410. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24411. $core.addPackage("Kernel-Announcements");
  24412. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24413. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24414. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24415. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24416. $core.addMethod(
  24417. $core.method({
  24418. selector: "announcementClass",
  24419. protocol: "accessing",
  24420. fn: function (){
  24421. var self=this,$self=this;
  24422. return $self["@announcementClass"];
  24423. },
  24424. args: [],
  24425. source: "announcementClass\x0a\x09^ announcementClass",
  24426. referencedClasses: [],
  24427. messageSends: []
  24428. }),
  24429. $globals.AnnouncementSubscription);
  24430. $core.addMethod(
  24431. $core.method({
  24432. selector: "announcementClass:",
  24433. protocol: "accessing",
  24434. fn: function (aClass){
  24435. var self=this,$self=this;
  24436. $self["@announcementClass"]=aClass;
  24437. return self;
  24438. },
  24439. args: ["aClass"],
  24440. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24441. referencedClasses: [],
  24442. messageSends: []
  24443. }),
  24444. $globals.AnnouncementSubscription);
  24445. $core.addMethod(
  24446. $core.method({
  24447. selector: "deliver:",
  24448. protocol: "announcing",
  24449. fn: function (anAnnouncement){
  24450. var self=this,$self=this;
  24451. return $core.withContext(function($ctx1) {
  24452. var $1;
  24453. $1=$self._handlesAnnouncement_(anAnnouncement);
  24454. if($core.assert($1)){
  24455. $recv($self._valuable())._value_(anAnnouncement);
  24456. }
  24457. return self;
  24458. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24459. },
  24460. args: ["anAnnouncement"],
  24461. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24462. referencedClasses: [],
  24463. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24464. }),
  24465. $globals.AnnouncementSubscription);
  24466. $core.addMethod(
  24467. $core.method({
  24468. selector: "handlesAnnouncement:",
  24469. protocol: "announcing",
  24470. fn: function (anAnnouncement){
  24471. var self=this,$self=this;
  24472. return $core.withContext(function($ctx1) {
  24473. var $2,$3,$1,$receiver;
  24474. $2=$recv($globals.Smalltalk)._globals();
  24475. $ctx1.sendIdx["globals"]=1;
  24476. $3=$recv($self._announcementClass())._name();
  24477. $ctx1.sendIdx["name"]=1;
  24478. $1=$recv($2)._at_($3);
  24479. $ctx1.sendIdx["at:"]=1;
  24480. if(($receiver = $1) == null || $receiver.a$nil){
  24481. return false;
  24482. } else {
  24483. var class_;
  24484. class_=$receiver;
  24485. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24486. }
  24487. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24488. },
  24489. args: ["anAnnouncement"],
  24490. 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 ]",
  24491. referencedClasses: ["Smalltalk"],
  24492. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24493. }),
  24494. $globals.AnnouncementSubscription);
  24495. $core.addMethod(
  24496. $core.method({
  24497. selector: "receiver",
  24498. protocol: "accessing",
  24499. fn: function (){
  24500. var self=this,$self=this;
  24501. return $core.withContext(function($ctx1) {
  24502. return $recv($self._valuable())._receiver();
  24503. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24504. },
  24505. args: [],
  24506. source: "receiver\x0a\x09^ self valuable receiver",
  24507. referencedClasses: [],
  24508. messageSends: ["receiver", "valuable"]
  24509. }),
  24510. $globals.AnnouncementSubscription);
  24511. $core.addMethod(
  24512. $core.method({
  24513. selector: "valuable",
  24514. protocol: "accessing",
  24515. fn: function (){
  24516. var self=this,$self=this;
  24517. return $self["@valuable"];
  24518. },
  24519. args: [],
  24520. source: "valuable\x0a\x09^ valuable",
  24521. referencedClasses: [],
  24522. messageSends: []
  24523. }),
  24524. $globals.AnnouncementSubscription);
  24525. $core.addMethod(
  24526. $core.method({
  24527. selector: "valuable:",
  24528. protocol: "accessing",
  24529. fn: function (aValuable){
  24530. var self=this,$self=this;
  24531. $self["@valuable"]=aValuable;
  24532. return self;
  24533. },
  24534. args: ["aValuable"],
  24535. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24536. referencedClasses: [],
  24537. messageSends: []
  24538. }),
  24539. $globals.AnnouncementSubscription);
  24540. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24541. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24542. $core.addMethod(
  24543. $core.method({
  24544. selector: "receiver",
  24545. protocol: "accessing",
  24546. fn: function (){
  24547. var self=this,$self=this;
  24548. return $self["@receiver"];
  24549. },
  24550. args: [],
  24551. source: "receiver\x0a\x09^ receiver",
  24552. referencedClasses: [],
  24553. messageSends: []
  24554. }),
  24555. $globals.AnnouncementValuable);
  24556. $core.addMethod(
  24557. $core.method({
  24558. selector: "receiver:",
  24559. protocol: "accessing",
  24560. fn: function (anObject){
  24561. var self=this,$self=this;
  24562. $self["@receiver"]=anObject;
  24563. return self;
  24564. },
  24565. args: ["anObject"],
  24566. source: "receiver: anObject\x0a\x09receiver := anObject",
  24567. referencedClasses: [],
  24568. messageSends: []
  24569. }),
  24570. $globals.AnnouncementValuable);
  24571. $core.addMethod(
  24572. $core.method({
  24573. selector: "valuable",
  24574. protocol: "accessing",
  24575. fn: function (){
  24576. var self=this,$self=this;
  24577. return $self["@valuable"];
  24578. },
  24579. args: [],
  24580. source: "valuable\x0a\x09^ valuable",
  24581. referencedClasses: [],
  24582. messageSends: []
  24583. }),
  24584. $globals.AnnouncementValuable);
  24585. $core.addMethod(
  24586. $core.method({
  24587. selector: "valuable:",
  24588. protocol: "accessing",
  24589. fn: function (anObject){
  24590. var self=this,$self=this;
  24591. $self["@valuable"]=anObject;
  24592. return self;
  24593. },
  24594. args: ["anObject"],
  24595. source: "valuable: anObject\x0a\x09valuable := anObject",
  24596. referencedClasses: [],
  24597. messageSends: []
  24598. }),
  24599. $globals.AnnouncementValuable);
  24600. $core.addMethod(
  24601. $core.method({
  24602. selector: "value",
  24603. protocol: "evaluating",
  24604. fn: function (){
  24605. var self=this,$self=this;
  24606. return $core.withContext(function($ctx1) {
  24607. return $recv($self._valuable())._value();
  24608. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24609. },
  24610. args: [],
  24611. source: "value\x0a\x09^ self valuable value",
  24612. referencedClasses: [],
  24613. messageSends: ["value", "valuable"]
  24614. }),
  24615. $globals.AnnouncementValuable);
  24616. $core.addMethod(
  24617. $core.method({
  24618. selector: "value:",
  24619. protocol: "evaluating",
  24620. fn: function (anObject){
  24621. var self=this,$self=this;
  24622. return $core.withContext(function($ctx1) {
  24623. return $recv($self._valuable())._value_(anObject);
  24624. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24625. },
  24626. args: ["anObject"],
  24627. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24628. referencedClasses: [],
  24629. messageSends: ["value:", "valuable"]
  24630. }),
  24631. $globals.AnnouncementValuable);
  24632. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24633. $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' ].";
  24634. $core.addMethod(
  24635. $core.method({
  24636. selector: "announce:",
  24637. protocol: "announcing",
  24638. fn: function (anAnnouncement){
  24639. var self=this,$self=this;
  24640. return $core.withContext(function($ctx1) {
  24641. $recv($self["@subscriptions"])._do_((function(each){
  24642. return $core.withContext(function($ctx2) {
  24643. return $recv(each)._deliver_(anAnnouncement);
  24644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24645. }));
  24646. return self;
  24647. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24648. },
  24649. args: ["anAnnouncement"],
  24650. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24651. referencedClasses: [],
  24652. messageSends: ["do:", "deliver:"]
  24653. }),
  24654. $globals.Announcer);
  24655. $core.addMethod(
  24656. $core.method({
  24657. selector: "initialize",
  24658. protocol: "initialization",
  24659. fn: function (){
  24660. var self=this,$self=this;
  24661. return $core.withContext(function($ctx1) {
  24662. (
  24663. $ctx1.supercall = true,
  24664. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24665. $ctx1.supercall = false;
  24666. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24667. return self;
  24668. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24669. },
  24670. args: [],
  24671. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24672. referencedClasses: ["OrderedCollection"],
  24673. messageSends: ["initialize", "new"]
  24674. }),
  24675. $globals.Announcer);
  24676. $core.addMethod(
  24677. $core.method({
  24678. selector: "on:do:",
  24679. protocol: "subscribing",
  24680. fn: function (aClass,aBlock){
  24681. var self=this,$self=this;
  24682. return $core.withContext(function($ctx1) {
  24683. $self._on_do_for_(aClass,aBlock,nil);
  24684. return self;
  24685. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24686. },
  24687. args: ["aClass", "aBlock"],
  24688. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24689. referencedClasses: [],
  24690. messageSends: ["on:do:for:"]
  24691. }),
  24692. $globals.Announcer);
  24693. $core.addMethod(
  24694. $core.method({
  24695. selector: "on:do:for:",
  24696. protocol: "subscribing",
  24697. fn: function (aClass,aBlock,aReceiver){
  24698. var self=this,$self=this;
  24699. return $core.withContext(function($ctx1) {
  24700. var $1,$3,$5,$6,$4,$2;
  24701. $1=$self["@subscriptions"];
  24702. $3=$recv($globals.AnnouncementSubscription)._new();
  24703. $ctx1.sendIdx["new"]=1;
  24704. $5=$recv($globals.AnnouncementValuable)._new();
  24705. $recv($5)._valuable_(aBlock);
  24706. $recv($5)._receiver_(aReceiver);
  24707. $6=$recv($5)._yourself();
  24708. $ctx1.sendIdx["yourself"]=1;
  24709. $4=$6;
  24710. $recv($3)._valuable_($4);
  24711. $ctx1.sendIdx["valuable:"]=1;
  24712. $recv($3)._announcementClass_(aClass);
  24713. $2=$recv($3)._yourself();
  24714. $recv($1)._add_($2);
  24715. return self;
  24716. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24717. },
  24718. args: ["aClass", "aBlock", "aReceiver"],
  24719. 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)",
  24720. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24721. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24722. }),
  24723. $globals.Announcer);
  24724. $core.addMethod(
  24725. $core.method({
  24726. selector: "on:doOnce:",
  24727. protocol: "subscribing",
  24728. fn: function (aClass,aBlock){
  24729. var self=this,$self=this;
  24730. var subscription;
  24731. return $core.withContext(function($ctx1) {
  24732. var $1;
  24733. $1=$recv($globals.AnnouncementSubscription)._new();
  24734. $recv($1)._announcementClass_(aClass);
  24735. subscription=$recv($1)._yourself();
  24736. $recv(subscription)._valuable_((function(ann){
  24737. return $core.withContext(function($ctx2) {
  24738. $recv($self["@subscriptions"])._remove_(subscription);
  24739. return $recv(aBlock)._value_(ann);
  24740. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24741. }));
  24742. $recv($self["@subscriptions"])._add_(subscription);
  24743. return self;
  24744. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24745. },
  24746. args: ["aClass", "aBlock"],
  24747. 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",
  24748. referencedClasses: ["AnnouncementSubscription"],
  24749. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24750. }),
  24751. $globals.Announcer);
  24752. $core.addMethod(
  24753. $core.method({
  24754. selector: "on:send:to:",
  24755. protocol: "subscribing",
  24756. fn: function (aClass,aSelector,anObject){
  24757. var self=this,$self=this;
  24758. return $core.withContext(function($ctx1) {
  24759. var $1,$3,$5,$6,$4,$2;
  24760. $1=$self["@subscriptions"];
  24761. $3=$recv($globals.AnnouncementSubscription)._new();
  24762. $ctx1.sendIdx["new"]=1;
  24763. $5=$recv($globals.MessageSend)._new();
  24764. $recv($5)._receiver_(anObject);
  24765. $recv($5)._selector_(aSelector);
  24766. $6=$recv($5)._yourself();
  24767. $ctx1.sendIdx["yourself"]=1;
  24768. $4=$6;
  24769. $recv($3)._valuable_($4);
  24770. $recv($3)._announcementClass_(aClass);
  24771. $2=$recv($3)._yourself();
  24772. $recv($1)._add_($2);
  24773. return self;
  24774. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24775. },
  24776. args: ["aClass", "aSelector", "anObject"],
  24777. 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)",
  24778. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24779. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24780. }),
  24781. $globals.Announcer);
  24782. $core.addMethod(
  24783. $core.method({
  24784. selector: "unsubscribe:",
  24785. protocol: "subscribing",
  24786. fn: function (anObject){
  24787. var self=this,$self=this;
  24788. return $core.withContext(function($ctx1) {
  24789. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24790. return $core.withContext(function($ctx2) {
  24791. return $recv($recv(each)._receiver()).__eq(anObject);
  24792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24793. }));
  24794. return self;
  24795. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24796. },
  24797. args: ["anObject"],
  24798. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24799. referencedClasses: [],
  24800. messageSends: ["reject:", "=", "receiver"]
  24801. }),
  24802. $globals.Announcer);
  24803. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24804. $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`";
  24805. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24806. $core.addMethod(
  24807. $core.method({
  24808. selector: "current",
  24809. protocol: "accessing",
  24810. fn: function (){
  24811. var self=this,$self=this;
  24812. return $core.withContext(function($ctx1) {
  24813. var $1,$receiver;
  24814. $1=$self["@current"];
  24815. if(($receiver = $1) == null || $receiver.a$nil){
  24816. $self["@current"]=(
  24817. $ctx1.supercall = true,
  24818. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24819. $ctx1.supercall = false;
  24820. return $self["@current"];
  24821. } else {
  24822. return $1;
  24823. }
  24824. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24825. },
  24826. args: [],
  24827. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24828. referencedClasses: [],
  24829. messageSends: ["ifNil:", "new"]
  24830. }),
  24831. $globals.SystemAnnouncer.a$cls);
  24832. $core.addMethod(
  24833. $core.method({
  24834. selector: "new",
  24835. protocol: "instance creation",
  24836. fn: function (){
  24837. var self=this,$self=this;
  24838. return $core.withContext(function($ctx1) {
  24839. $self._shouldNotImplement();
  24840. return self;
  24841. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24842. },
  24843. args: [],
  24844. source: "new\x0a\x09self shouldNotImplement",
  24845. referencedClasses: [],
  24846. messageSends: ["shouldNotImplement"]
  24847. }),
  24848. $globals.SystemAnnouncer.a$cls);
  24849. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24850. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24851. $core.addMethod(
  24852. $core.method({
  24853. selector: "classTag",
  24854. protocol: "accessing",
  24855. fn: function (){
  24856. var self=this,$self=this;
  24857. return "announcement";
  24858. },
  24859. args: [],
  24860. 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'",
  24861. referencedClasses: [],
  24862. messageSends: []
  24863. }),
  24864. $globals.SystemAnnouncement.a$cls);
  24865. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24866. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24867. $core.addMethod(
  24868. $core.method({
  24869. selector: "theClass",
  24870. protocol: "accessing",
  24871. fn: function (){
  24872. var self=this,$self=this;
  24873. return $self["@theClass"];
  24874. },
  24875. args: [],
  24876. source: "theClass\x0a\x09^ theClass",
  24877. referencedClasses: [],
  24878. messageSends: []
  24879. }),
  24880. $globals.ClassAnnouncement);
  24881. $core.addMethod(
  24882. $core.method({
  24883. selector: "theClass:",
  24884. protocol: "accessing",
  24885. fn: function (aClass){
  24886. var self=this,$self=this;
  24887. $self["@theClass"]=aClass;
  24888. return self;
  24889. },
  24890. args: ["aClass"],
  24891. source: "theClass: aClass\x0a\x09theClass := aClass",
  24892. referencedClasses: [],
  24893. messageSends: []
  24894. }),
  24895. $globals.ClassAnnouncement);
  24896. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24897. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24898. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24899. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24900. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24901. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24902. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24903. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24904. $core.addMethod(
  24905. $core.method({
  24906. selector: "oldClass",
  24907. protocol: "accessing",
  24908. fn: function (){
  24909. var self=this,$self=this;
  24910. return $self["@oldClass"];
  24911. },
  24912. args: [],
  24913. source: "oldClass\x0a\x09^ oldClass",
  24914. referencedClasses: [],
  24915. messageSends: []
  24916. }),
  24917. $globals.ClassMigrated);
  24918. $core.addMethod(
  24919. $core.method({
  24920. selector: "oldClass:",
  24921. protocol: "accessing",
  24922. fn: function (aClass){
  24923. var self=this,$self=this;
  24924. $self["@oldClass"]=aClass;
  24925. return self;
  24926. },
  24927. args: ["aClass"],
  24928. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24929. referencedClasses: [],
  24930. messageSends: []
  24931. }),
  24932. $globals.ClassMigrated);
  24933. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24934. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24935. $core.addMethod(
  24936. $core.method({
  24937. selector: "oldPackage",
  24938. protocol: "accessing",
  24939. fn: function (){
  24940. var self=this,$self=this;
  24941. return $self["@oldPackage"];
  24942. },
  24943. args: [],
  24944. source: "oldPackage\x0a\x09^ oldPackage",
  24945. referencedClasses: [],
  24946. messageSends: []
  24947. }),
  24948. $globals.ClassMoved);
  24949. $core.addMethod(
  24950. $core.method({
  24951. selector: "oldPackage:",
  24952. protocol: "accessing",
  24953. fn: function (aPackage){
  24954. var self=this,$self=this;
  24955. $self["@oldPackage"]=aPackage;
  24956. return self;
  24957. },
  24958. args: ["aPackage"],
  24959. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24960. referencedClasses: [],
  24961. messageSends: []
  24962. }),
  24963. $globals.ClassMoved);
  24964. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24965. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24966. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24967. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24968. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24969. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24970. $core.addMethod(
  24971. $core.method({
  24972. selector: "method",
  24973. protocol: "accessing",
  24974. fn: function (){
  24975. var self=this,$self=this;
  24976. return $self["@method"];
  24977. },
  24978. args: [],
  24979. source: "method\x0a\x09^ method",
  24980. referencedClasses: [],
  24981. messageSends: []
  24982. }),
  24983. $globals.MethodAnnouncement);
  24984. $core.addMethod(
  24985. $core.method({
  24986. selector: "method:",
  24987. protocol: "accessing",
  24988. fn: function (aCompiledMethod){
  24989. var self=this,$self=this;
  24990. $self["@method"]=aCompiledMethod;
  24991. return self;
  24992. },
  24993. args: ["aCompiledMethod"],
  24994. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24995. referencedClasses: [],
  24996. messageSends: []
  24997. }),
  24998. $globals.MethodAnnouncement);
  24999. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  25000. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  25001. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  25002. $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.";
  25003. $core.addMethod(
  25004. $core.method({
  25005. selector: "oldMethod",
  25006. protocol: "accessing",
  25007. fn: function (){
  25008. var self=this,$self=this;
  25009. return $self["@oldMethod"];
  25010. },
  25011. args: [],
  25012. source: "oldMethod\x0a\x09^ oldMethod",
  25013. referencedClasses: [],
  25014. messageSends: []
  25015. }),
  25016. $globals.MethodModified);
  25017. $core.addMethod(
  25018. $core.method({
  25019. selector: "oldMethod:",
  25020. protocol: "accessing",
  25021. fn: function (aMethod){
  25022. var self=this,$self=this;
  25023. $self["@oldMethod"]=aMethod;
  25024. return self;
  25025. },
  25026. args: ["aMethod"],
  25027. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  25028. referencedClasses: [],
  25029. messageSends: []
  25030. }),
  25031. $globals.MethodModified);
  25032. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  25033. $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.";
  25034. $core.addMethod(
  25035. $core.method({
  25036. selector: "oldProtocol",
  25037. protocol: "accessing",
  25038. fn: function (){
  25039. var self=this,$self=this;
  25040. return $self["@oldProtocol"];
  25041. },
  25042. args: [],
  25043. source: "oldProtocol\x0a\x09^ oldProtocol",
  25044. referencedClasses: [],
  25045. messageSends: []
  25046. }),
  25047. $globals.MethodMoved);
  25048. $core.addMethod(
  25049. $core.method({
  25050. selector: "oldProtocol:",
  25051. protocol: "accessing",
  25052. fn: function (aString){
  25053. var self=this,$self=this;
  25054. $self["@oldProtocol"]=aString;
  25055. return self;
  25056. },
  25057. args: ["aString"],
  25058. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  25059. referencedClasses: [],
  25060. messageSends: []
  25061. }),
  25062. $globals.MethodMoved);
  25063. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  25064. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  25065. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  25066. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  25067. $core.addMethod(
  25068. $core.method({
  25069. selector: "package",
  25070. protocol: "accessing",
  25071. fn: function (){
  25072. var self=this,$self=this;
  25073. return $self["@package"];
  25074. },
  25075. args: [],
  25076. source: "package\x0a\x09^ package",
  25077. referencedClasses: [],
  25078. messageSends: []
  25079. }),
  25080. $globals.PackageAnnouncement);
  25081. $core.addMethod(
  25082. $core.method({
  25083. selector: "package:",
  25084. protocol: "accessing",
  25085. fn: function (aPackage){
  25086. var self=this,$self=this;
  25087. $self["@package"]=aPackage;
  25088. return self;
  25089. },
  25090. args: ["aPackage"],
  25091. source: "package: aPackage\x0a\x09package := aPackage",
  25092. referencedClasses: [],
  25093. messageSends: []
  25094. }),
  25095. $globals.PackageAnnouncement);
  25096. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25097. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  25098. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25099. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  25100. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25101. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  25102. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25103. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  25104. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  25105. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  25106. $core.addMethod(
  25107. $core.method({
  25108. selector: "package",
  25109. protocol: "accessing",
  25110. fn: function (){
  25111. var self=this,$self=this;
  25112. return $core.withContext(function($ctx1) {
  25113. var $1,$receiver;
  25114. $1=$self._theClass();
  25115. if(($receiver = $1) == null || $receiver.a$nil){
  25116. return $1;
  25117. } else {
  25118. var class_;
  25119. class_=$receiver;
  25120. return $recv(class_)._packageOfProtocol_($self._protocol());
  25121. }
  25122. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  25123. },
  25124. args: [],
  25125. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25126. referencedClasses: [],
  25127. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25128. }),
  25129. $globals.ProtocolAnnouncement);
  25130. $core.addMethod(
  25131. $core.method({
  25132. selector: "protocol",
  25133. protocol: "accessing",
  25134. fn: function (){
  25135. var self=this,$self=this;
  25136. return $self["@protocol"];
  25137. },
  25138. args: [],
  25139. source: "protocol\x0a\x09^ protocol",
  25140. referencedClasses: [],
  25141. messageSends: []
  25142. }),
  25143. $globals.ProtocolAnnouncement);
  25144. $core.addMethod(
  25145. $core.method({
  25146. selector: "protocol:",
  25147. protocol: "accessing",
  25148. fn: function (aString){
  25149. var self=this,$self=this;
  25150. $self["@protocol"]=aString;
  25151. return self;
  25152. },
  25153. args: ["aString"],
  25154. source: "protocol: aString\x0a\x09protocol := aString",
  25155. referencedClasses: [],
  25156. messageSends: []
  25157. }),
  25158. $globals.ProtocolAnnouncement);
  25159. $core.addMethod(
  25160. $core.method({
  25161. selector: "theClass",
  25162. protocol: "accessing",
  25163. fn: function (){
  25164. var self=this,$self=this;
  25165. return $self["@theClass"];
  25166. },
  25167. args: [],
  25168. source: "theClass\x0a\x09^ theClass",
  25169. referencedClasses: [],
  25170. messageSends: []
  25171. }),
  25172. $globals.ProtocolAnnouncement);
  25173. $core.addMethod(
  25174. $core.method({
  25175. selector: "theClass:",
  25176. protocol: "accessing",
  25177. fn: function (aClass){
  25178. var self=this,$self=this;
  25179. $self["@theClass"]=aClass;
  25180. return self;
  25181. },
  25182. args: ["aClass"],
  25183. source: "theClass: aClass\x0a\x09theClass := aClass",
  25184. referencedClasses: [],
  25185. messageSends: []
  25186. }),
  25187. $globals.ProtocolAnnouncement);
  25188. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25189. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25190. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25191. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25192. });
  25193. 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";
  25194. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25195. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25196. $core.addPackage("Platform-Services");
  25197. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  25198. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25199. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25200. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25201. $core.addMethod(
  25202. $core.method({
  25203. selector: "handleError:",
  25204. protocol: "error handling",
  25205. fn: function (anError){
  25206. var self=this,$self=this;
  25207. return $core.withContext(function($ctx1) {
  25208. var $1,$receiver;
  25209. $1=$recv(anError)._context();
  25210. $ctx1.sendIdx["context"]=1;
  25211. if(($receiver = $1) == null || $receiver.a$nil){
  25212. $1;
  25213. } else {
  25214. $self._logErrorContext_($recv(anError)._context());
  25215. }
  25216. $self._logError_(anError);
  25217. return self;
  25218. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25219. },
  25220. args: ["anError"],
  25221. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25222. referencedClasses: [],
  25223. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25224. }),
  25225. $globals.ConsoleErrorHandler);
  25226. $core.addMethod(
  25227. $core.method({
  25228. selector: "log:",
  25229. protocol: "private",
  25230. fn: function (aString){
  25231. var self=this,$self=this;
  25232. return $core.withContext(function($ctx1) {
  25233. $recv(console)._log_(aString);
  25234. return self;
  25235. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25236. },
  25237. args: ["aString"],
  25238. source: "log: aString\x0a\x09console log: aString",
  25239. referencedClasses: [],
  25240. messageSends: ["log:"]
  25241. }),
  25242. $globals.ConsoleErrorHandler);
  25243. $core.addMethod(
  25244. $core.method({
  25245. selector: "logContext:",
  25246. protocol: "private",
  25247. fn: function (aContext){
  25248. var self=this,$self=this;
  25249. return $core.withContext(function($ctx1) {
  25250. var $1,$receiver;
  25251. $1=$recv(aContext)._home();
  25252. $ctx1.sendIdx["home"]=1;
  25253. if(($receiver = $1) == null || $receiver.a$nil){
  25254. $1;
  25255. } else {
  25256. $self._logContext_($recv(aContext)._home());
  25257. }
  25258. $self._log_($recv(aContext)._asString());
  25259. return self;
  25260. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25261. },
  25262. args: ["aContext"],
  25263. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25264. referencedClasses: [],
  25265. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25266. }),
  25267. $globals.ConsoleErrorHandler);
  25268. $core.addMethod(
  25269. $core.method({
  25270. selector: "logError:",
  25271. protocol: "private",
  25272. fn: function (anError){
  25273. var self=this,$self=this;
  25274. return $core.withContext(function($ctx1) {
  25275. $self._log_($recv(anError)._messageText());
  25276. return self;
  25277. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25278. },
  25279. args: ["anError"],
  25280. source: "logError: anError\x0a\x09self log: anError messageText",
  25281. referencedClasses: [],
  25282. messageSends: ["log:", "messageText"]
  25283. }),
  25284. $globals.ConsoleErrorHandler);
  25285. $core.addMethod(
  25286. $core.method({
  25287. selector: "logErrorContext:",
  25288. protocol: "private",
  25289. fn: function (aContext){
  25290. var self=this,$self=this;
  25291. return $core.withContext(function($ctx1) {
  25292. var $1,$receiver;
  25293. if(($receiver = aContext) == null || $receiver.a$nil){
  25294. aContext;
  25295. } else {
  25296. $1=$recv(aContext)._home();
  25297. $ctx1.sendIdx["home"]=1;
  25298. if(($receiver = $1) == null || $receiver.a$nil){
  25299. $1;
  25300. } else {
  25301. $self._logContext_($recv(aContext)._home());
  25302. }
  25303. }
  25304. return self;
  25305. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25306. },
  25307. args: ["aContext"],
  25308. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25309. referencedClasses: [],
  25310. messageSends: ["ifNotNil:", "home", "logContext:"]
  25311. }),
  25312. $globals.ConsoleErrorHandler);
  25313. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25314. $core.addMethod(
  25315. $core.method({
  25316. selector: "initialize",
  25317. protocol: "initialization",
  25318. fn: function (){
  25319. var self=this,$self=this;
  25320. return $core.withContext(function($ctx1) {
  25321. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25322. return self;
  25323. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25324. },
  25325. args: [],
  25326. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25327. referencedClasses: ["ErrorHandler"],
  25328. messageSends: ["registerIfNone:", "new"]
  25329. }),
  25330. $globals.ConsoleErrorHandler.a$cls);
  25331. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25332. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25333. $core.addMethod(
  25334. $core.method({
  25335. selector: "clear",
  25336. protocol: "printing",
  25337. fn: function (){
  25338. var self=this,$self=this;
  25339. return self;
  25340. },
  25341. args: [],
  25342. source: "clear\x0a\x09\x22no op\x22",
  25343. referencedClasses: [],
  25344. messageSends: []
  25345. }),
  25346. $globals.ConsoleTranscript);
  25347. $core.addMethod(
  25348. $core.method({
  25349. selector: "cr",
  25350. protocol: "printing",
  25351. fn: function (){
  25352. var self=this,$self=this;
  25353. return self;
  25354. },
  25355. args: [],
  25356. source: "cr\x0a\x09\x22no op\x22",
  25357. referencedClasses: [],
  25358. messageSends: []
  25359. }),
  25360. $globals.ConsoleTranscript);
  25361. $core.addMethod(
  25362. $core.method({
  25363. selector: "open",
  25364. protocol: "actions",
  25365. fn: function (){
  25366. var self=this,$self=this;
  25367. return self;
  25368. },
  25369. args: [],
  25370. source: "open",
  25371. referencedClasses: [],
  25372. messageSends: []
  25373. }),
  25374. $globals.ConsoleTranscript);
  25375. $core.addMethod(
  25376. $core.method({
  25377. selector: "show:",
  25378. protocol: "printing",
  25379. fn: function (anObject){
  25380. var self=this,$self=this;
  25381. return $core.withContext(function($ctx1) {
  25382. console.log(String($recv(anObject)._asString()));
  25383. return self;
  25384. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25385. },
  25386. args: ["anObject"],
  25387. 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()))'>",
  25388. referencedClasses: [],
  25389. messageSends: []
  25390. }),
  25391. $globals.ConsoleTranscript);
  25392. $core.addMethod(
  25393. $core.method({
  25394. selector: "initialize",
  25395. protocol: "initialization",
  25396. fn: function (){
  25397. var self=this,$self=this;
  25398. return $core.withContext(function($ctx1) {
  25399. $recv($globals.Transcript)._registerIfNone_($self._new());
  25400. return self;
  25401. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25402. },
  25403. args: [],
  25404. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25405. referencedClasses: ["Transcript"],
  25406. messageSends: ["registerIfNone:", "new"]
  25407. }),
  25408. $globals.ConsoleTranscript.a$cls);
  25409. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25410. $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.";
  25411. $core.addMethod(
  25412. $core.method({
  25413. selector: "addInstVarNamed:to:",
  25414. protocol: "compiling",
  25415. fn: function (aString,aClass){
  25416. var self=this,$self=this;
  25417. var newInstVars;
  25418. return $core.withContext(function($ctx1) {
  25419. var $1,$2,$3,$4,$5;
  25420. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25421. $1=$recv(aClass)._isMetaclass();
  25422. if($core.assert($1)){
  25423. $2=$self._classBuilder();
  25424. $ctx1.sendIdx["classBuilder"]=1;
  25425. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25426. } else {
  25427. $3=$self._classBuilder();
  25428. $4=$recv(aClass)._superclass();
  25429. $5=$recv(aClass)._name();
  25430. $ctx1.sendIdx["name"]=1;
  25431. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25432. }
  25433. return self;
  25434. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25435. },
  25436. args: ["aString", "aClass"],
  25437. 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 ]",
  25438. referencedClasses: [],
  25439. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25440. }),
  25441. $globals.Environment);
  25442. $core.addMethod(
  25443. $core.method({
  25444. selector: "allSelectors",
  25445. protocol: "accessing",
  25446. fn: function (){
  25447. var self=this,$self=this;
  25448. return $core.withContext(function($ctx1) {
  25449. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25450. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25451. },
  25452. args: [],
  25453. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25454. referencedClasses: ["Smalltalk"],
  25455. messageSends: ["allSelectors", "core"]
  25456. }),
  25457. $globals.Environment);
  25458. $core.addMethod(
  25459. $core.method({
  25460. selector: "availableClassNames",
  25461. protocol: "accessing",
  25462. fn: function (){
  25463. var self=this,$self=this;
  25464. return $core.withContext(function($ctx1) {
  25465. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25466. return $core.withContext(function($ctx2) {
  25467. return $recv(each)._name();
  25468. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25469. }));
  25470. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25471. },
  25472. args: [],
  25473. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25474. referencedClasses: ["Smalltalk"],
  25475. messageSends: ["collect:", "classes", "name"]
  25476. }),
  25477. $globals.Environment);
  25478. $core.addMethod(
  25479. $core.method({
  25480. selector: "availablePackageNames",
  25481. protocol: "accessing",
  25482. fn: function (){
  25483. var self=this,$self=this;
  25484. return $core.withContext(function($ctx1) {
  25485. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25486. return $core.withContext(function($ctx2) {
  25487. return $recv(each)._name();
  25488. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25489. }));
  25490. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25491. },
  25492. args: [],
  25493. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25494. referencedClasses: ["Smalltalk"],
  25495. messageSends: ["collect:", "packages", "name"]
  25496. }),
  25497. $globals.Environment);
  25498. $core.addMethod(
  25499. $core.method({
  25500. selector: "availableProtocolsFor:",
  25501. protocol: "accessing",
  25502. fn: function (aClass){
  25503. var self=this,$self=this;
  25504. var protocols;
  25505. return $core.withContext(function($ctx1) {
  25506. var $1,$receiver;
  25507. protocols=$recv(aClass)._protocols();
  25508. $1=$recv(aClass)._superclass();
  25509. $ctx1.sendIdx["superclass"]=1;
  25510. if(($receiver = $1) == null || $receiver.a$nil){
  25511. $1;
  25512. } else {
  25513. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25514. }
  25515. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25516. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25517. },
  25518. args: ["aClass"],
  25519. 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",
  25520. referencedClasses: [],
  25521. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25522. }),
  25523. $globals.Environment);
  25524. $core.addMethod(
  25525. $core.method({
  25526. selector: "classBuilder",
  25527. protocol: "accessing",
  25528. fn: function (){
  25529. var self=this,$self=this;
  25530. return $core.withContext(function($ctx1) {
  25531. return $recv($globals.ClassBuilder)._new();
  25532. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25533. },
  25534. args: [],
  25535. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25536. referencedClasses: ["ClassBuilder"],
  25537. messageSends: ["new"]
  25538. }),
  25539. $globals.Environment);
  25540. $core.addMethod(
  25541. $core.method({
  25542. selector: "classNamed:",
  25543. protocol: "accessing",
  25544. fn: function (aString){
  25545. var self=this,$self=this;
  25546. return $core.withContext(function($ctx1) {
  25547. var $1,$receiver;
  25548. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25549. if(($receiver = $1) == null || $receiver.a$nil){
  25550. return $self._error_("Invalid class name");
  25551. } else {
  25552. return $1;
  25553. }
  25554. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25555. },
  25556. args: ["aString"],
  25557. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25558. referencedClasses: ["Smalltalk"],
  25559. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25560. }),
  25561. $globals.Environment);
  25562. $core.addMethod(
  25563. $core.method({
  25564. selector: "classes",
  25565. protocol: "accessing",
  25566. fn: function (){
  25567. var self=this,$self=this;
  25568. return $core.withContext(function($ctx1) {
  25569. return $recv($globals.Smalltalk)._classes();
  25570. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25571. },
  25572. args: [],
  25573. source: "classes\x0a\x09^ Smalltalk classes",
  25574. referencedClasses: ["Smalltalk"],
  25575. messageSends: ["classes"]
  25576. }),
  25577. $globals.Environment);
  25578. $core.addMethod(
  25579. $core.method({
  25580. selector: "commitPackage:onSuccess:onError:",
  25581. protocol: "actions",
  25582. fn: function (aPackage,aBlock,anotherBlock){
  25583. var self=this,$self=this;
  25584. return $core.withContext(function($ctx1) {
  25585. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25586. return self;
  25587. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25588. },
  25589. args: ["aPackage", "aBlock", "anotherBlock"],
  25590. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25591. referencedClasses: [],
  25592. messageSends: ["commitOnSuccess:onError:", "transport"]
  25593. }),
  25594. $globals.Environment);
  25595. $core.addMethod(
  25596. $core.method({
  25597. selector: "compileClassComment:for:",
  25598. protocol: "compiling",
  25599. fn: function (aString,aClass){
  25600. var self=this,$self=this;
  25601. return $core.withContext(function($ctx1) {
  25602. $recv(aClass)._comment_(aString);
  25603. return self;
  25604. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25605. },
  25606. args: ["aString", "aClass"],
  25607. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25608. referencedClasses: [],
  25609. messageSends: ["comment:"]
  25610. }),
  25611. $globals.Environment);
  25612. $core.addMethod(
  25613. $core.method({
  25614. selector: "compileClassDefinition:",
  25615. protocol: "compiling",
  25616. fn: function (aString){
  25617. var self=this,$self=this;
  25618. return $core.withContext(function($ctx1) {
  25619. $recv((function(){
  25620. return $core.withContext(function($ctx2) {
  25621. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25622. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25623. }))._on_do_($globals.Error,(function(error){
  25624. return $core.withContext(function($ctx2) {
  25625. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25626. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25627. }));
  25628. return self;
  25629. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25630. },
  25631. args: ["aString"],
  25632. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25633. referencedClasses: ["DoIt", "Error", "Terminal"],
  25634. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25635. }),
  25636. $globals.Environment);
  25637. $core.addMethod(
  25638. $core.method({
  25639. selector: "compileMethod:for:protocol:",
  25640. protocol: "compiling",
  25641. fn: function (sourceCode,class_,protocol){
  25642. var self=this,$self=this;
  25643. return $core.withContext(function($ctx1) {
  25644. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25645. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25646. },
  25647. args: ["sourceCode", "class", "protocol"],
  25648. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25649. referencedClasses: [],
  25650. messageSends: ["compile:protocol:"]
  25651. }),
  25652. $globals.Environment);
  25653. $core.addMethod(
  25654. $core.method({
  25655. selector: "copyClass:to:",
  25656. protocol: "actions",
  25657. fn: function (aClass,aClassName){
  25658. var self=this,$self=this;
  25659. return $core.withContext(function($ctx1) {
  25660. var $1,$2,$receiver;
  25661. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25662. if(($receiver = $1) == null || $receiver.a$nil){
  25663. $1;
  25664. } else {
  25665. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25666. $ctx1.sendIdx[","]=1;
  25667. $self._error_($2);
  25668. }
  25669. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25670. return self;
  25671. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25672. },
  25673. args: ["aClass", "aClassName"],
  25674. 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",
  25675. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25676. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25677. }),
  25678. $globals.Environment);
  25679. $core.addMethod(
  25680. $core.method({
  25681. selector: "doItReceiver",
  25682. protocol: "accessing",
  25683. fn: function (){
  25684. var self=this,$self=this;
  25685. return $core.withContext(function($ctx1) {
  25686. return $recv($globals.DoIt)._new();
  25687. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25688. },
  25689. args: [],
  25690. source: "doItReceiver\x0a\x09^ DoIt new",
  25691. referencedClasses: ["DoIt"],
  25692. messageSends: ["new"]
  25693. }),
  25694. $globals.Environment);
  25695. $core.addMethod(
  25696. $core.method({
  25697. selector: "evaluate:for:",
  25698. protocol: "evaluating",
  25699. fn: function (aString,anObject){
  25700. var self=this,$self=this;
  25701. return $core.withContext(function($ctx1) {
  25702. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25703. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25704. },
  25705. args: ["aString", "anObject"],
  25706. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25707. referencedClasses: ["Evaluator"],
  25708. messageSends: ["evaluate:for:"]
  25709. }),
  25710. $globals.Environment);
  25711. $core.addMethod(
  25712. $core.method({
  25713. selector: "evaluate:on:do:",
  25714. protocol: "error handling",
  25715. fn: function (aBlock,anErrorClass,exceptionBlock){
  25716. var self=this,$self=this;
  25717. return $core.withContext(function($ctx1) {
  25718. var $1;
  25719. $recv(aBlock)._tryCatch_((function(exception){
  25720. return $core.withContext(function($ctx2) {
  25721. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25722. if($core.assert($1)){
  25723. return $recv(exceptionBlock)._value_(exception);
  25724. } else {
  25725. return $recv(exception)._pass();
  25726. }
  25727. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25728. }));
  25729. return self;
  25730. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25731. },
  25732. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25733. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception pass ] ]",
  25734. referencedClasses: [],
  25735. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25736. }),
  25737. $globals.Environment);
  25738. $core.addMethod(
  25739. $core.method({
  25740. selector: "inspect:",
  25741. protocol: "actions",
  25742. fn: function (anObject){
  25743. var self=this,$self=this;
  25744. return $core.withContext(function($ctx1) {
  25745. $recv($globals.Inspector)._inspect_(anObject);
  25746. return self;
  25747. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25748. },
  25749. args: ["anObject"],
  25750. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25751. referencedClasses: ["Inspector"],
  25752. messageSends: ["inspect:"]
  25753. }),
  25754. $globals.Environment);
  25755. $core.addMethod(
  25756. $core.method({
  25757. selector: "moveClass:toPackage:",
  25758. protocol: "actions",
  25759. fn: function (aClass,aPackageName){
  25760. var self=this,$self=this;
  25761. var package_;
  25762. return $core.withContext(function($ctx1) {
  25763. var $1,$2,$receiver;
  25764. package_=$recv($globals.Package)._named_(aPackageName);
  25765. $1=package_;
  25766. if(($receiver = $1) == null || $receiver.a$nil){
  25767. $self._error_("Invalid package name");
  25768. } else {
  25769. $1;
  25770. }
  25771. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25772. if($core.assert($2)){
  25773. return self;
  25774. }
  25775. $recv(aClass)._package_(package_);
  25776. $recv(aClass)._recompile();
  25777. return self;
  25778. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25779. },
  25780. args: ["aClass", "aPackageName"],
  25781. 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",
  25782. referencedClasses: ["Package"],
  25783. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25784. }),
  25785. $globals.Environment);
  25786. $core.addMethod(
  25787. $core.method({
  25788. selector: "moveMethod:toClass:",
  25789. protocol: "actions",
  25790. fn: function (aMethod,aClassName){
  25791. var self=this,$self=this;
  25792. var destinationClass;
  25793. return $core.withContext(function($ctx1) {
  25794. var $2,$3,$1,$5,$4;
  25795. destinationClass=$self._classNamed_(aClassName);
  25796. $2=destinationClass;
  25797. $3=$recv(aMethod)._methodClass();
  25798. $ctx1.sendIdx["methodClass"]=1;
  25799. $1=$recv($2).__eq_eq($3);
  25800. if($core.assert($1)){
  25801. return self;
  25802. }
  25803. $5=$recv(aMethod)._methodClass();
  25804. $ctx1.sendIdx["methodClass"]=2;
  25805. $4=$recv($5)._isMetaclass();
  25806. if($core.assert($4)){
  25807. destinationClass=$recv(destinationClass)._theMetaClass();
  25808. destinationClass;
  25809. }
  25810. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25811. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25812. return self;
  25813. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25814. },
  25815. args: ["aMethod", "aClassName"],
  25816. 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",
  25817. referencedClasses: [],
  25818. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25819. }),
  25820. $globals.Environment);
  25821. $core.addMethod(
  25822. $core.method({
  25823. selector: "moveMethod:toProtocol:",
  25824. protocol: "actions",
  25825. fn: function (aMethod,aProtocol){
  25826. var self=this,$self=this;
  25827. return $core.withContext(function($ctx1) {
  25828. $recv(aMethod)._protocol_(aProtocol);
  25829. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25830. return self;
  25831. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25832. },
  25833. args: ["aMethod", "aProtocol"],
  25834. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25835. referencedClasses: [],
  25836. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25837. }),
  25838. $globals.Environment);
  25839. $core.addMethod(
  25840. $core.method({
  25841. selector: "packages",
  25842. protocol: "accessing",
  25843. fn: function (){
  25844. var self=this,$self=this;
  25845. return $core.withContext(function($ctx1) {
  25846. return $recv($globals.Smalltalk)._packages();
  25847. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25848. },
  25849. args: [],
  25850. source: "packages\x0a\x09^ Smalltalk packages",
  25851. referencedClasses: ["Smalltalk"],
  25852. messageSends: ["packages"]
  25853. }),
  25854. $globals.Environment);
  25855. $core.addMethod(
  25856. $core.method({
  25857. selector: "registerErrorHandler:",
  25858. protocol: "services",
  25859. fn: function (anErrorHandler){
  25860. var self=this,$self=this;
  25861. return $core.withContext(function($ctx1) {
  25862. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25863. return self;
  25864. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25865. },
  25866. args: ["anErrorHandler"],
  25867. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25868. referencedClasses: ["ErrorHandler"],
  25869. messageSends: ["register:"]
  25870. }),
  25871. $globals.Environment);
  25872. $core.addMethod(
  25873. $core.method({
  25874. selector: "registerFinder:",
  25875. protocol: "services",
  25876. fn: function (aFinder){
  25877. var self=this,$self=this;
  25878. return $core.withContext(function($ctx1) {
  25879. $recv($globals.Finder)._register_(aFinder);
  25880. return self;
  25881. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25882. },
  25883. args: ["aFinder"],
  25884. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25885. referencedClasses: ["Finder"],
  25886. messageSends: ["register:"]
  25887. }),
  25888. $globals.Environment);
  25889. $core.addMethod(
  25890. $core.method({
  25891. selector: "registerInspector:",
  25892. protocol: "services",
  25893. fn: function (anInspector){
  25894. var self=this,$self=this;
  25895. return $core.withContext(function($ctx1) {
  25896. $recv($globals.Inspector)._register_(anInspector);
  25897. return self;
  25898. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25899. },
  25900. args: ["anInspector"],
  25901. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25902. referencedClasses: ["Inspector"],
  25903. messageSends: ["register:"]
  25904. }),
  25905. $globals.Environment);
  25906. $core.addMethod(
  25907. $core.method({
  25908. selector: "registerProgressHandler:",
  25909. protocol: "services",
  25910. fn: function (aProgressHandler){
  25911. var self=this,$self=this;
  25912. return $core.withContext(function($ctx1) {
  25913. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25914. return self;
  25915. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25916. },
  25917. args: ["aProgressHandler"],
  25918. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25919. referencedClasses: ["ProgressHandler"],
  25920. messageSends: ["register:"]
  25921. }),
  25922. $globals.Environment);
  25923. $core.addMethod(
  25924. $core.method({
  25925. selector: "registerTranscript:",
  25926. protocol: "services",
  25927. fn: function (aTranscript){
  25928. var self=this,$self=this;
  25929. return $core.withContext(function($ctx1) {
  25930. $recv($globals.Transcript)._register_(aTranscript);
  25931. return self;
  25932. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25933. },
  25934. args: ["aTranscript"],
  25935. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25936. referencedClasses: ["Transcript"],
  25937. messageSends: ["register:"]
  25938. }),
  25939. $globals.Environment);
  25940. $core.addMethod(
  25941. $core.method({
  25942. selector: "removeClass:",
  25943. protocol: "actions",
  25944. fn: function (aClass){
  25945. var self=this,$self=this;
  25946. return $core.withContext(function($ctx1) {
  25947. $recv($globals.Smalltalk)._removeClass_(aClass);
  25948. return self;
  25949. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25950. },
  25951. args: ["aClass"],
  25952. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25953. referencedClasses: ["Smalltalk"],
  25954. messageSends: ["removeClass:"]
  25955. }),
  25956. $globals.Environment);
  25957. $core.addMethod(
  25958. $core.method({
  25959. selector: "removeMethod:",
  25960. protocol: "actions",
  25961. fn: function (aMethod){
  25962. var self=this,$self=this;
  25963. return $core.withContext(function($ctx1) {
  25964. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25965. return self;
  25966. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25967. },
  25968. args: ["aMethod"],
  25969. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25970. referencedClasses: [],
  25971. messageSends: ["removeCompiledMethod:", "methodClass"]
  25972. }),
  25973. $globals.Environment);
  25974. $core.addMethod(
  25975. $core.method({
  25976. selector: "removeProtocol:from:",
  25977. protocol: "actions",
  25978. fn: function (aString,aClass){
  25979. var self=this,$self=this;
  25980. return $core.withContext(function($ctx1) {
  25981. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25982. return $core.withContext(function($ctx2) {
  25983. return $recv(aClass)._removeCompiledMethod_(each);
  25984. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25985. }));
  25986. return self;
  25987. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25988. },
  25989. args: ["aString", "aClass"],
  25990. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25991. referencedClasses: [],
  25992. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25993. }),
  25994. $globals.Environment);
  25995. $core.addMethod(
  25996. $core.method({
  25997. selector: "renameClass:to:",
  25998. protocol: "actions",
  25999. fn: function (aClass,aClassName){
  26000. var self=this,$self=this;
  26001. return $core.withContext(function($ctx1) {
  26002. var $1,$2,$receiver;
  26003. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  26004. if(($receiver = $1) == null || $receiver.a$nil){
  26005. $1;
  26006. } else {
  26007. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  26008. $ctx1.sendIdx[","]=1;
  26009. $self._error_($2);
  26010. }
  26011. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  26012. return self;
  26013. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  26014. },
  26015. args: ["aClass", "aClassName"],
  26016. 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",
  26017. referencedClasses: ["Smalltalk", "ClassBuilder"],
  26018. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  26019. }),
  26020. $globals.Environment);
  26021. $core.addMethod(
  26022. $core.method({
  26023. selector: "renamePackage:to:",
  26024. protocol: "actions",
  26025. fn: function (aPackageName,aNewPackageName){
  26026. var self=this,$self=this;
  26027. return $core.withContext(function($ctx1) {
  26028. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  26029. return self;
  26030. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  26031. },
  26032. args: ["aPackageName", "aNewPackageName"],
  26033. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  26034. referencedClasses: ["Smalltalk"],
  26035. messageSends: ["renamePackage:to:"]
  26036. }),
  26037. $globals.Environment);
  26038. $core.addMethod(
  26039. $core.method({
  26040. selector: "renameProtocol:to:in:",
  26041. protocol: "actions",
  26042. fn: function (aString,anotherString,aClass){
  26043. var self=this,$self=this;
  26044. return $core.withContext(function($ctx1) {
  26045. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  26046. return $core.withContext(function($ctx2) {
  26047. return $recv(each)._protocol_(anotherString);
  26048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26049. }));
  26050. return self;
  26051. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  26052. },
  26053. args: ["aString", "anotherString", "aClass"],
  26054. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  26055. referencedClasses: [],
  26056. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  26057. }),
  26058. $globals.Environment);
  26059. $core.addMethod(
  26060. $core.method({
  26061. selector: "setClassCommentOf:to:",
  26062. protocol: "actions",
  26063. fn: function (aClass,aString){
  26064. var self=this,$self=this;
  26065. return $core.withContext(function($ctx1) {
  26066. $recv(aClass)._comment_(aString);
  26067. return self;
  26068. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  26069. },
  26070. args: ["aClass", "aString"],
  26071. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  26072. referencedClasses: [],
  26073. messageSends: ["comment:"]
  26074. }),
  26075. $globals.Environment);
  26076. $core.addMethod(
  26077. $core.method({
  26078. selector: "systemAnnouncer",
  26079. protocol: "accessing",
  26080. fn: function (){
  26081. var self=this,$self=this;
  26082. return $core.withContext(function($ctx1) {
  26083. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  26084. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  26085. },
  26086. args: [],
  26087. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  26088. referencedClasses: ["Smalltalk"],
  26089. messageSends: ["current", "at:", "globals"]
  26090. }),
  26091. $globals.Environment);
  26092. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  26093. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  26094. $core.addMethod(
  26095. $core.method({
  26096. selector: "do:on:displaying:",
  26097. protocol: "progress handling",
  26098. fn: function (aBlock,aCollection,aString){
  26099. var self=this,$self=this;
  26100. return $core.withContext(function($ctx1) {
  26101. $recv(aCollection)._do_(aBlock);
  26102. return self;
  26103. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  26104. },
  26105. args: ["aBlock", "aCollection", "aString"],
  26106. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  26107. referencedClasses: [],
  26108. messageSends: ["do:"]
  26109. }),
  26110. $globals.NullProgressHandler);
  26111. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  26112. $core.addMethod(
  26113. $core.method({
  26114. selector: "initialize",
  26115. protocol: "initialization",
  26116. fn: function (){
  26117. var self=this,$self=this;
  26118. return $core.withContext(function($ctx1) {
  26119. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26120. return self;
  26121. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  26122. },
  26123. args: [],
  26124. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26125. referencedClasses: ["ProgressHandler"],
  26126. messageSends: ["registerIfNone:", "new"]
  26127. }),
  26128. $globals.NullProgressHandler.a$cls);
  26129. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26130. $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.";
  26131. $globals.Service.a$cls.iVarNames = ["current"];
  26132. $core.addMethod(
  26133. $core.method({
  26134. selector: "current",
  26135. protocol: "accessing",
  26136. fn: function (){
  26137. var self=this,$self=this;
  26138. return $self["@current"];
  26139. },
  26140. args: [],
  26141. source: "current\x0a\x09^ current",
  26142. referencedClasses: [],
  26143. messageSends: []
  26144. }),
  26145. $globals.Service.a$cls);
  26146. $core.addMethod(
  26147. $core.method({
  26148. selector: "new",
  26149. protocol: "instance creation",
  26150. fn: function (){
  26151. var self=this,$self=this;
  26152. return $core.withContext(function($ctx1) {
  26153. $self._shouldNotImplement();
  26154. return self;
  26155. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26156. },
  26157. args: [],
  26158. source: "new\x0a\x09self shouldNotImplement",
  26159. referencedClasses: [],
  26160. messageSends: ["shouldNotImplement"]
  26161. }),
  26162. $globals.Service.a$cls);
  26163. $core.addMethod(
  26164. $core.method({
  26165. selector: "register:",
  26166. protocol: "registration",
  26167. fn: function (anObject){
  26168. var self=this,$self=this;
  26169. $self["@current"]=anObject;
  26170. return self;
  26171. },
  26172. args: ["anObject"],
  26173. source: "register: anObject\x0a\x09current := anObject",
  26174. referencedClasses: [],
  26175. messageSends: []
  26176. }),
  26177. $globals.Service.a$cls);
  26178. $core.addMethod(
  26179. $core.method({
  26180. selector: "registerIfNone:",
  26181. protocol: "registration",
  26182. fn: function (anObject){
  26183. var self=this,$self=this;
  26184. return $core.withContext(function($ctx1) {
  26185. var $1,$receiver;
  26186. $1=$self._current();
  26187. if(($receiver = $1) == null || $receiver.a$nil){
  26188. $self._register_(anObject);
  26189. } else {
  26190. $1;
  26191. }
  26192. return self;
  26193. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26194. },
  26195. args: ["anObject"],
  26196. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26197. referencedClasses: [],
  26198. messageSends: ["ifNil:", "current", "register:"]
  26199. }),
  26200. $globals.Service.a$cls);
  26201. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26202. $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.";
  26203. $core.addMethod(
  26204. $core.method({
  26205. selector: "handleError:",
  26206. protocol: "error handling",
  26207. fn: function (anError){
  26208. var self=this,$self=this;
  26209. return $core.withContext(function($ctx1) {
  26210. var $1;
  26211. $1=$recv((function(){
  26212. return $core.withContext(function($ctx2) {
  26213. return $recv(anError)._isSmalltalkError();
  26214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26215. }))._tryCatch_((function(){
  26216. return false;
  26217. }));
  26218. if($core.assert($1)){
  26219. $self._handleUnhandledError_(anError);
  26220. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26221. } else {
  26222. var smalltalkError;
  26223. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26224. $recv(smalltalkError)._wrap();
  26225. $self._handleUnhandledError_(smalltalkError);
  26226. }
  26227. return self;
  26228. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26229. },
  26230. args: ["anError"],
  26231. 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 ]",
  26232. referencedClasses: ["JavaScriptException"],
  26233. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26234. }),
  26235. $globals.ErrorHandler.a$cls);
  26236. $core.addMethod(
  26237. $core.method({
  26238. selector: "handleUnhandledError:",
  26239. protocol: "error handling",
  26240. fn: function (anError){
  26241. var self=this,$self=this;
  26242. return $core.withContext(function($ctx1) {
  26243. var $1;
  26244. $1=$recv(anError)._wasHandled();
  26245. if(!$core.assert($1)){
  26246. $recv($self._current())._handleError_(anError);
  26247. $recv(anError)._beHandled();
  26248. }
  26249. return self;
  26250. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26251. },
  26252. args: ["anError"],
  26253. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26254. referencedClasses: [],
  26255. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26256. }),
  26257. $globals.ErrorHandler.a$cls);
  26258. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26259. $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.";
  26260. $core.addMethod(
  26261. $core.method({
  26262. selector: "findClass:",
  26263. protocol: "finding",
  26264. fn: function (aClass){
  26265. var self=this,$self=this;
  26266. return $core.withContext(function($ctx1) {
  26267. return $recv($self._current())._findClass_(aClass);
  26268. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26269. },
  26270. args: ["aClass"],
  26271. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26272. referencedClasses: [],
  26273. messageSends: ["findClass:", "current"]
  26274. }),
  26275. $globals.Finder.a$cls);
  26276. $core.addMethod(
  26277. $core.method({
  26278. selector: "findMethod:",
  26279. protocol: "finding",
  26280. fn: function (aCompiledMethod){
  26281. var self=this,$self=this;
  26282. return $core.withContext(function($ctx1) {
  26283. return $recv($self._current())._findMethod_(aCompiledMethod);
  26284. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26285. },
  26286. args: ["aCompiledMethod"],
  26287. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26288. referencedClasses: [],
  26289. messageSends: ["findMethod:", "current"]
  26290. }),
  26291. $globals.Finder.a$cls);
  26292. $core.addMethod(
  26293. $core.method({
  26294. selector: "findString:",
  26295. protocol: "finding",
  26296. fn: function (aString){
  26297. var self=this,$self=this;
  26298. return $core.withContext(function($ctx1) {
  26299. return $recv($self._current())._findString_(aString);
  26300. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26301. },
  26302. args: ["aString"],
  26303. source: "findString: aString\x0a\x09^ self current findString: aString",
  26304. referencedClasses: [],
  26305. messageSends: ["findString:", "current"]
  26306. }),
  26307. $globals.Finder.a$cls);
  26308. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26309. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26310. $core.addMethod(
  26311. $core.method({
  26312. selector: "inspect:",
  26313. protocol: "inspecting",
  26314. fn: function (anObject){
  26315. var self=this,$self=this;
  26316. return $core.withContext(function($ctx1) {
  26317. return $recv($self._current())._inspect_(anObject);
  26318. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26319. },
  26320. args: ["anObject"],
  26321. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26322. referencedClasses: [],
  26323. messageSends: ["inspect:", "current"]
  26324. }),
  26325. $globals.Inspector.a$cls);
  26326. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26327. $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";
  26328. $core.addMethod(
  26329. $core.method({
  26330. selector: "globals",
  26331. protocol: "accessing",
  26332. fn: function (){
  26333. var self=this,$self=this;
  26334. return $core.withContext(function($ctx1) {
  26335. return $recv($self._current())._globals();
  26336. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26337. },
  26338. args: [],
  26339. source: "globals\x0a\x09^ self current globals",
  26340. referencedClasses: [],
  26341. messageSends: ["globals", "current"]
  26342. }),
  26343. $globals.Platform.a$cls);
  26344. $core.addMethod(
  26345. $core.method({
  26346. selector: "includesGlobal:",
  26347. protocol: "testing",
  26348. fn: function (aString){
  26349. var self=this,$self=this;
  26350. return $core.withContext(function($ctx1) {
  26351. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26352. return true;
  26353. }),(function(){
  26354. return false;
  26355. }));
  26356. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26357. },
  26358. args: ["aString"],
  26359. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26360. referencedClasses: [],
  26361. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26362. }),
  26363. $globals.Platform.a$cls);
  26364. $core.addMethod(
  26365. $core.method({
  26366. selector: "newXhr",
  26367. protocol: "accessing",
  26368. fn: function (){
  26369. var self=this,$self=this;
  26370. return $core.withContext(function($ctx1) {
  26371. return $recv($self._current())._newXhr();
  26372. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26373. },
  26374. args: [],
  26375. source: "newXhr\x0a\x09^ self current newXhr",
  26376. referencedClasses: [],
  26377. messageSends: ["newXhr", "current"]
  26378. }),
  26379. $globals.Platform.a$cls);
  26380. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26381. $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`.";
  26382. $core.addMethod(
  26383. $core.method({
  26384. selector: "do:on:displaying:",
  26385. protocol: "progress handling",
  26386. fn: function (aBlock,aCollection,aString){
  26387. var self=this,$self=this;
  26388. return $core.withContext(function($ctx1) {
  26389. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26390. return self;
  26391. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26392. },
  26393. args: ["aBlock", "aCollection", "aString"],
  26394. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26395. referencedClasses: [],
  26396. messageSends: ["do:on:displaying:", "current"]
  26397. }),
  26398. $globals.ProgressHandler.a$cls);
  26399. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26400. $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:'.";
  26401. $core.addMethod(
  26402. $core.method({
  26403. selector: "alert:",
  26404. protocol: "dialogs",
  26405. fn: function (aString){
  26406. var self=this,$self=this;
  26407. return $core.withContext(function($ctx1) {
  26408. return $recv($self._current())._alert_(aString);
  26409. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26410. },
  26411. args: ["aString"],
  26412. source: "alert: aString\x0a\x09^ self current alert: aString",
  26413. referencedClasses: [],
  26414. messageSends: ["alert:", "current"]
  26415. }),
  26416. $globals.Terminal.a$cls);
  26417. $core.addMethod(
  26418. $core.method({
  26419. selector: "confirm:",
  26420. protocol: "dialogs",
  26421. fn: function (aString){
  26422. var self=this,$self=this;
  26423. return $core.withContext(function($ctx1) {
  26424. return $recv($self._current())._confirm_(aString);
  26425. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26426. },
  26427. args: ["aString"],
  26428. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26429. referencedClasses: [],
  26430. messageSends: ["confirm:", "current"]
  26431. }),
  26432. $globals.Terminal.a$cls);
  26433. $core.addMethod(
  26434. $core.method({
  26435. selector: "prompt:",
  26436. protocol: "dialogs",
  26437. fn: function (aString){
  26438. var self=this,$self=this;
  26439. return $core.withContext(function($ctx1) {
  26440. return $recv($self._current())._prompt_(aString);
  26441. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26442. },
  26443. args: ["aString"],
  26444. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26445. referencedClasses: [],
  26446. messageSends: ["prompt:", "current"]
  26447. }),
  26448. $globals.Terminal.a$cls);
  26449. $core.addMethod(
  26450. $core.method({
  26451. selector: "prompt:default:",
  26452. protocol: "dialogs",
  26453. fn: function (aString,defaultString){
  26454. var self=this,$self=this;
  26455. return $core.withContext(function($ctx1) {
  26456. return $recv($self._current())._prompt_default_(aString,defaultString);
  26457. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26458. },
  26459. args: ["aString", "defaultString"],
  26460. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26461. referencedClasses: [],
  26462. messageSends: ["prompt:default:", "current"]
  26463. }),
  26464. $globals.Terminal.a$cls);
  26465. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26466. $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.";
  26467. $core.addMethod(
  26468. $core.method({
  26469. selector: "clear",
  26470. protocol: "printing",
  26471. fn: function (){
  26472. var self=this,$self=this;
  26473. return $core.withContext(function($ctx1) {
  26474. $recv($self._current())._clear();
  26475. return self;
  26476. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26477. },
  26478. args: [],
  26479. source: "clear\x0a\x09self current clear",
  26480. referencedClasses: [],
  26481. messageSends: ["clear", "current"]
  26482. }),
  26483. $globals.Transcript.a$cls);
  26484. $core.addMethod(
  26485. $core.method({
  26486. selector: "cr",
  26487. protocol: "printing",
  26488. fn: function (){
  26489. var self=this,$self=this;
  26490. return $core.withContext(function($ctx1) {
  26491. $recv($self._current())._show_($recv($globals.String)._cr());
  26492. return self;
  26493. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26494. },
  26495. args: [],
  26496. source: "cr\x0a\x09self current show: String cr",
  26497. referencedClasses: ["String"],
  26498. messageSends: ["show:", "current", "cr"]
  26499. }),
  26500. $globals.Transcript.a$cls);
  26501. $core.addMethod(
  26502. $core.method({
  26503. selector: "inspect:",
  26504. protocol: "printing",
  26505. fn: function (anObject){
  26506. var self=this,$self=this;
  26507. return $core.withContext(function($ctx1) {
  26508. $self._show_(anObject);
  26509. return self;
  26510. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26511. },
  26512. args: ["anObject"],
  26513. source: "inspect: anObject\x0a\x09self show: anObject",
  26514. referencedClasses: [],
  26515. messageSends: ["show:"]
  26516. }),
  26517. $globals.Transcript.a$cls);
  26518. $core.addMethod(
  26519. $core.method({
  26520. selector: "open",
  26521. protocol: "instance creation",
  26522. fn: function (){
  26523. var self=this,$self=this;
  26524. return $core.withContext(function($ctx1) {
  26525. $recv($self._current())._open();
  26526. return self;
  26527. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26528. },
  26529. args: [],
  26530. source: "open\x0a\x09self current open",
  26531. referencedClasses: [],
  26532. messageSends: ["open", "current"]
  26533. }),
  26534. $globals.Transcript.a$cls);
  26535. $core.addMethod(
  26536. $core.method({
  26537. selector: "show:",
  26538. protocol: "printing",
  26539. fn: function (anObject){
  26540. var self=this,$self=this;
  26541. return $core.withContext(function($ctx1) {
  26542. $recv($self._current())._show_(anObject);
  26543. return self;
  26544. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26545. },
  26546. args: ["anObject"],
  26547. source: "show: anObject\x0a\x09self current show: anObject",
  26548. referencedClasses: [],
  26549. messageSends: ["show:", "current"]
  26550. }),
  26551. $globals.Transcript.a$cls);
  26552. $core.addMethod(
  26553. $core.method({
  26554. selector: "inspectOn:",
  26555. protocol: "*Platform-Services",
  26556. fn: function (anInspector){
  26557. var self=this,$self=this;
  26558. var variables;
  26559. return $core.withContext(function($ctx1) {
  26560. variables=$recv($globals.Dictionary)._new();
  26561. $recv(variables)._at_put_("#self",self);
  26562. $ctx1.sendIdx["at:put:"]=1;
  26563. $recv(variables)._at_put_("#keys",$self._keys());
  26564. $ctx1.sendIdx["at:put:"]=2;
  26565. $self._keysAndValuesDo_((function(key,value){
  26566. return $core.withContext(function($ctx2) {
  26567. return $recv(variables)._at_put_(key,value);
  26568. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26569. }));
  26570. $recv(anInspector)._setLabel_($self._printString());
  26571. $recv(anInspector)._setVariables_(variables);
  26572. return self;
  26573. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26574. },
  26575. args: ["anInspector"],
  26576. 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",
  26577. referencedClasses: ["Dictionary"],
  26578. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26579. }),
  26580. $globals.AssociativeCollection);
  26581. $core.addMethod(
  26582. $core.method({
  26583. selector: "inspectOn:",
  26584. protocol: "*Platform-Services",
  26585. fn: function (anInspector){
  26586. var self=this,$self=this;
  26587. var variables;
  26588. return $core.withContext(function($ctx1) {
  26589. variables=$recv($globals.Dictionary)._new();
  26590. $recv(variables)._at_put_("#self",self);
  26591. $ctx1.sendIdx["at:put:"]=1;
  26592. $self._withIndexDo_((function(each,i){
  26593. return $core.withContext(function($ctx2) {
  26594. return $recv(variables)._at_put_(i,each);
  26595. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26596. }));
  26597. $recv(anInspector)._setLabel_($self._printString());
  26598. $recv(anInspector)._setVariables_(variables);
  26599. return self;
  26600. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26601. },
  26602. args: ["anInspector"],
  26603. 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",
  26604. referencedClasses: ["Dictionary"],
  26605. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26606. }),
  26607. $globals.Collection);
  26608. $core.addMethod(
  26609. $core.method({
  26610. selector: "inspectOn:",
  26611. protocol: "*Platform-Services",
  26612. fn: function (anInspector){
  26613. var self=this,$self=this;
  26614. var variables;
  26615. return $core.withContext(function($ctx1) {
  26616. variables=$recv($globals.Dictionary)._new();
  26617. $recv(variables)._at_put_("#self",self);
  26618. $ctx1.sendIdx["at:put:"]=1;
  26619. $recv(variables)._at_put_("#year",$self._year());
  26620. $ctx1.sendIdx["at:put:"]=2;
  26621. $recv(variables)._at_put_("#month",$self._month());
  26622. $ctx1.sendIdx["at:put:"]=3;
  26623. $recv(variables)._at_put_("#day",$self._day());
  26624. $ctx1.sendIdx["at:put:"]=4;
  26625. $recv(variables)._at_put_("#hours",$self._hours());
  26626. $ctx1.sendIdx["at:put:"]=5;
  26627. $recv(variables)._at_put_("#minutes",$self._minutes());
  26628. $ctx1.sendIdx["at:put:"]=6;
  26629. $recv(variables)._at_put_("#seconds",$self._seconds());
  26630. $ctx1.sendIdx["at:put:"]=7;
  26631. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26632. $recv(anInspector)._setLabel_($self._printString());
  26633. $recv(anInspector)._setVariables_(variables);
  26634. return self;
  26635. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26636. },
  26637. args: ["anInspector"],
  26638. 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",
  26639. referencedClasses: ["Dictionary"],
  26640. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26641. }),
  26642. $globals.Date);
  26643. $core.addMethod(
  26644. $core.method({
  26645. selector: "inspectOn:",
  26646. protocol: "*Platform-Services",
  26647. fn: function (anInspector){
  26648. var self=this,$self=this;
  26649. var variables;
  26650. return $core.withContext(function($ctx1) {
  26651. variables=$recv($globals.Dictionary)._new();
  26652. $recv(variables)._at_put_("#self",$self._jsObject());
  26653. $recv(anInspector)._setLabel_($self._printString());
  26654. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26655. $recv(anInspector)._setVariables_(variables);
  26656. return self;
  26657. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26658. },
  26659. args: ["anInspector"],
  26660. 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",
  26661. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26662. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26663. }),
  26664. $globals.JSObjectProxy);
  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;
  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. $recv(variables)._at_put_("#home",$self._home());
  26677. $ctx1.sendIdx["at:put:"]=2;
  26678. $recv(variables)._at_put_("#receiver",$self._receiver());
  26679. $ctx1.sendIdx["at:put:"]=3;
  26680. $recv(variables)._at_put_("#selector",$self._selector());
  26681. $ctx1.sendIdx["at:put:"]=4;
  26682. $recv(variables)._at_put_("#locals",$self._locals());
  26683. $ctx1.sendIdx["at:put:"]=5;
  26684. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26685. return $core.withContext(function($ctx2) {
  26686. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26688. }));
  26689. $recv(anInspector)._setLabel_($self._printString());
  26690. $recv(anInspector)._setVariables_(variables);
  26691. return self;
  26692. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26693. },
  26694. args: ["anInspector"],
  26695. 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",
  26696. referencedClasses: ["Dictionary"],
  26697. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26698. }),
  26699. $globals.MethodContext);
  26700. $core.addMethod(
  26701. $core.method({
  26702. selector: "inspectOn:",
  26703. protocol: "*Platform-Services",
  26704. fn: function (anInspector){
  26705. var self=this,$self=this;
  26706. var variables;
  26707. return $core.withContext(function($ctx1) {
  26708. variables=$recv($globals.Dictionary)._new();
  26709. $recv(variables)._at_put_("#self",self);
  26710. $ctx1.sendIdx["at:put:"]=1;
  26711. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26712. return $core.withContext(function($ctx2) {
  26713. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26715. }));
  26716. $recv(anInspector)._setLabel_($self._printString());
  26717. $recv(anInspector)._setVariables_(variables);
  26718. return self;
  26719. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26720. },
  26721. args: ["anInspector"],
  26722. 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",
  26723. referencedClasses: ["Dictionary"],
  26724. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26725. }),
  26726. $globals.Object);
  26727. $core.addMethod(
  26728. $core.method({
  26729. selector: "do:displayingProgress:",
  26730. protocol: "*Platform-Services",
  26731. fn: function (aBlock,aString){
  26732. var self=this,$self=this;
  26733. return $core.withContext(function($ctx1) {
  26734. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26735. return self;
  26736. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26737. },
  26738. args: ["aBlock", "aString"],
  26739. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26740. referencedClasses: ["ProgressHandler"],
  26741. messageSends: ["do:on:displaying:"]
  26742. }),
  26743. $globals.SequenceableCollection);
  26744. $core.addMethod(
  26745. $core.method({
  26746. selector: "inspectOn:",
  26747. protocol: "*Platform-Services",
  26748. fn: function (anInspector){
  26749. var self=this,$self=this;
  26750. var variables,i;
  26751. return $core.withContext(function($ctx1) {
  26752. variables=$recv($globals.Dictionary)._new();
  26753. $recv(variables)._at_put_("#self",self);
  26754. $ctx1.sendIdx["at:put:"]=1;
  26755. i=(1);
  26756. $self._do_((function(each){
  26757. return $core.withContext(function($ctx2) {
  26758. $recv(variables)._at_put_(i,each);
  26759. i=$recv(i).__plus((1));
  26760. return i;
  26761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26762. }));
  26763. $recv(anInspector)._setLabel_($self._printString());
  26764. $recv(anInspector)._setVariables_(variables);
  26765. return self;
  26766. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26767. },
  26768. args: ["anInspector"],
  26769. 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",
  26770. referencedClasses: ["Dictionary"],
  26771. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26772. }),
  26773. $globals.Set);
  26774. $core.addMethod(
  26775. $core.method({
  26776. selector: "inspectOn:",
  26777. protocol: "*Platform-Services",
  26778. fn: function (anInspector){
  26779. var self=this,$self=this;
  26780. var label;
  26781. return $core.withContext(function($ctx1) {
  26782. var $3,$2,$1,$5,$4;
  26783. (
  26784. $ctx1.supercall = true,
  26785. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26786. $ctx1.supercall = false;
  26787. $3=$self._printString();
  26788. $ctx1.sendIdx["printString"]=1;
  26789. $2=$recv($3)._size();
  26790. $1=$recv($2).__gt((30));
  26791. if($core.assert($1)){
  26792. $5=$self._printString();
  26793. $ctx1.sendIdx["printString"]=2;
  26794. $4=$recv($5)._copyFrom_to_((1),(30));
  26795. label=$recv($4).__comma("...'");
  26796. label;
  26797. } else {
  26798. label=$self._printString();
  26799. label;
  26800. }
  26801. $recv(anInspector)._setLabel_(label);
  26802. return self;
  26803. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26804. },
  26805. args: ["anInspector"],
  26806. 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",
  26807. referencedClasses: [],
  26808. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26809. }),
  26810. $globals.String);
  26811. });
  26812. define('amber/deploy',[
  26813. './helpers',
  26814. './boot', // pre-fetch, dep of ./helpers
  26815. // --- packages of the core Amber begin here ---
  26816. 'amber_core/Kernel-Helpers',
  26817. 'amber_core/Kernel-Objects',
  26818. 'amber_core/Kernel-Classes',
  26819. 'amber_core/Kernel-Methods',
  26820. 'amber_core/Kernel-Collections',
  26821. 'amber_core/Kernel-Dag',
  26822. 'amber_core/Kernel-Infrastructure',
  26823. 'amber_core/Kernel-Promises',
  26824. 'amber_core/Kernel-Exceptions',
  26825. 'amber_core/Kernel-Announcements',
  26826. 'amber_core/Platform-Services',
  26827. // --- packages of the core Amber end here ---
  26828. ], function (amber) {
  26829. return amber;
  26830. });
  26831. // jshint ignore:start
  26832. define('amber/parser',['./boot'], function($boot) {
  26833. var $globals = $boot.globals;
  26834. $globals.SmalltalkParser = (function() {
  26835. "use strict";
  26836. /*
  26837. * Generated by PEG.js 0.9.0.
  26838. *
  26839. * http://pegjs.org/
  26840. */
  26841. function peg$subclass(child, parent) {
  26842. function ctor() { this.constructor = child; }
  26843. ctor.prototype = parent.prototype;
  26844. child.prototype = new ctor();
  26845. }
  26846. function peg$SyntaxError(message, expected, found, location) {
  26847. this.message = message;
  26848. this.expected = expected;
  26849. this.found = found;
  26850. this.location = location;
  26851. this.name = "SyntaxError";
  26852. if (typeof Error.captureStackTrace === "function") {
  26853. Error.captureStackTrace(this, peg$SyntaxError);
  26854. }
  26855. }
  26856. peg$subclass(peg$SyntaxError, Error);
  26857. function peg$parse(input) {
  26858. var options = arguments.length > 1 ? arguments[1] : {},
  26859. parser = this,
  26860. peg$FAILED = {},
  26861. peg$startRuleFunctions = { start: peg$parsestart },
  26862. peg$startRuleFunction = peg$parsestart,
  26863. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26864. 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]" },
  26865. peg$c2 = "\"",
  26866. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26867. peg$c4 = /^[^"]/,
  26868. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26869. peg$c6 = ".",
  26870. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26871. peg$c8 = /^[a-zA-Z]/,
  26872. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26873. peg$c10 = /^[a-zA-Z0-9]/,
  26874. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26875. peg$c12 = ":",
  26876. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26877. peg$c14 = /^[A-Z]/,
  26878. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26879. peg$c16 = function(val) {
  26880. return $globals.ValueNode._new()
  26881. ._location_(location())
  26882. ._source_(text())
  26883. ._value_(val);
  26884. },
  26885. peg$c17 = "'",
  26886. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26887. peg$c19 = "''",
  26888. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26889. peg$c21 = function() {return '\'';},
  26890. peg$c22 = /^[^']/,
  26891. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26892. peg$c24 = function(val) {return val.join('');},
  26893. peg$c25 = "$",
  26894. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26895. peg$c27 = { type: "any", description: "any character" },
  26896. peg$c28 = function(char) {
  26897. return $globals.ValueNode._new()
  26898. ._location_(location())
  26899. ._source_(text())
  26900. ._value_(char);
  26901. },
  26902. peg$c29 = "#",
  26903. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26904. peg$c31 = function(rest) {return rest;},
  26905. peg$c32 = "e",
  26906. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26907. peg$c34 = function(n) {return parseFloat(n);},
  26908. peg$c35 = "-",
  26909. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26910. peg$c37 = "16r",
  26911. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26912. peg$c39 = /^[0-9a-fA-F]/,
  26913. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26914. peg$c41 = function(neg, num) {
  26915. return parseInt(((neg || '') + num), 16);
  26916. },
  26917. peg$c42 = /^[0-9]/,
  26918. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26919. peg$c44 = function(n) {return parseFloat(n, 10);},
  26920. peg$c45 = function(n) {return parseInt(n, 10);},
  26921. peg$c46 = "#(",
  26922. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26923. peg$c48 = ")",
  26924. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26925. peg$c50 = function(rest) {
  26926. return rest
  26927. ._location_(location())
  26928. ._source_(text());
  26929. },
  26930. peg$c51 = "(",
  26931. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26932. peg$c53 = function(lit) {return lit._value();},
  26933. peg$c54 = function(lits) {
  26934. return $globals.ValueNode._new()
  26935. ._value_(lits);
  26936. },
  26937. peg$c55 = "{",
  26938. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26939. peg$c57 = "}",
  26940. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26941. peg$c59 = function(expressions) {
  26942. return $globals.DynamicArrayNode._new()
  26943. ._location_(location())
  26944. ._source_(text())
  26945. ._dagChildren_(expressions || []);
  26946. },
  26947. peg$c60 = "#{",
  26948. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26949. peg$c62 = function(expressions) {
  26950. return $globals.DynamicDictionaryNode._new()
  26951. ._location_(location())
  26952. ._source_(text())
  26953. ._dagChildren_(expressions || []);
  26954. },
  26955. peg$c63 = "true",
  26956. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26957. peg$c65 = function() {return true;},
  26958. peg$c66 = "false",
  26959. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26960. peg$c68 = function() {return false;},
  26961. peg$c69 = "nil",
  26962. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26963. peg$c71 = function() {return null;},
  26964. peg$c72 = function(identifier) {
  26965. return $globals.VariableNode._new()
  26966. ._location_(location())
  26967. ._source_(text())
  26968. ._value_(identifier);
  26969. },
  26970. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26971. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26972. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26973. peg$c76 = function(pairs) {
  26974. var selector = '';
  26975. var params = [];
  26976. for(var i = 0; i < pairs.length; i++) {
  26977. selector += pairs[i].key;
  26978. params.push(pairs[i].arg);
  26979. }
  26980. return [selector, params];
  26981. },
  26982. peg$c77 = function(selector, arg) {
  26983. return [selector, [arg]];
  26984. },
  26985. peg$c78 = function(selector) {return [selector, []];},
  26986. peg$c79 = function(expression) {
  26987. return expression;
  26988. },
  26989. peg$c80 = function(first, others) {
  26990. return [first].concat(others);
  26991. },
  26992. peg$c81 = function(selector) {
  26993. return $globals.Message._selector_arguments_(selector, []);
  26994. },
  26995. peg$c82 = function(pairs) {
  26996. var selector = '';
  26997. var args = [];
  26998. for(var i = 0; i < pairs.length; i++) {
  26999. selector += pairs[i].key;
  27000. args.push(pairs[i].arg._value());
  27001. }
  27002. return $globals.Message._selector_arguments_(selector, args)
  27003. },
  27004. peg$c83 = "<",
  27005. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  27006. peg$c85 = ">",
  27007. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  27008. peg$c87 = function(message) {return message;},
  27009. peg$c88 = ":=",
  27010. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  27011. peg$c90 = function(variable, expression) {
  27012. return $globals.AssignmentNode._new()
  27013. ._location_(location())
  27014. ._source_(text())
  27015. ._left_(variable)
  27016. ._right_(expression);
  27017. },
  27018. peg$c91 = "^",
  27019. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  27020. peg$c93 = function(expression) {
  27021. return $globals.ReturnNode._new()
  27022. ._location_(location())
  27023. ._source_(text())
  27024. ._dagChildren_([expression]);
  27025. },
  27026. peg$c94 = "|",
  27027. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  27028. peg$c96 = function(variable) {return variable;},
  27029. peg$c97 = function(vars) {
  27030. return vars;
  27031. },
  27032. peg$c98 = function(param) {return param;},
  27033. peg$c99 = function(params) {
  27034. return params;
  27035. },
  27036. peg$c100 = function(ret) {return [ret];},
  27037. peg$c101 = function(exps, ret) {
  27038. var expressions = exps;
  27039. expressions.push(ret);
  27040. return expressions;
  27041. },
  27042. peg$c102 = function(expressions) {return expressions || [];},
  27043. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  27044. return $globals.SequenceNode._new()
  27045. ._location_(location())
  27046. ._source_(text())
  27047. ._temps_(temps || [])
  27048. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  27049. ._dagChildren_(statements || []);
  27050. },
  27051. peg$c104 = "[",
  27052. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  27053. peg$c106 = "]",
  27054. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  27055. peg$c108 = function(params, sequence) {
  27056. return $globals.BlockNode._new()
  27057. ._location_(location())
  27058. ._source_(text())
  27059. ._parameters_(params || [])
  27060. ._dagChildren_([sequence._asBlockSequenceNode()]);
  27061. },
  27062. peg$c109 = function(selector) {
  27063. return $globals.SendNode._new()
  27064. ._location_(location())
  27065. ._source_(text())
  27066. ._selector_(selector);
  27067. },
  27068. peg$c110 = function(receiver, tail) {
  27069. return receiver._withTail_(tail);
  27070. },
  27071. peg$c111 = function(selector, arg) {
  27072. return $globals.SendNode._new()
  27073. ._location_(location())
  27074. ._source_(text())
  27075. ._selector_(selector)
  27076. ._arguments_([arg]);
  27077. },
  27078. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  27079. peg$c113 = function(pairs) {
  27080. var selector = '';
  27081. var args = [];
  27082. for(var i = 0; i < pairs.length; i++) {
  27083. selector += pairs[i].key;
  27084. args.push(pairs[i].arg);
  27085. }
  27086. return $globals.SendNode._new()
  27087. ._location_(location())
  27088. ._source_(text())
  27089. ._selector_(selector)
  27090. ._arguments_(args);
  27091. },
  27092. peg$c114 = function(binarys, final) {
  27093. if (final) binarys.push(final);
  27094. return binarys;
  27095. },
  27096. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  27097. peg$c116 = ";",
  27098. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  27099. peg$c118 = function(receiver, tail, mess) {return mess;},
  27100. peg$c119 = function(receiver, tail, messages) {
  27101. messages.unshift(receiver._withTail_(tail));
  27102. return $globals.CascadeNode._new()
  27103. ._location_(location())
  27104. ._source_(text())
  27105. ._dagChildren_(messages);
  27106. },
  27107. peg$c120 = function(pattern, sequence) {
  27108. return $globals.MethodNode._new()
  27109. ._location_(location())
  27110. ._source_(text())
  27111. ._selector_(pattern[0])
  27112. ._arguments_(pattern[1])
  27113. ._dagChildren_([sequence]);
  27114. },
  27115. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  27116. peg$c122 = function(receiver, tail) {
  27117. var last = tail.pop();
  27118. return [receiver._withTail_(tail), last._arguments()[0]];
  27119. },
  27120. peg$c123 = function(first, others) {
  27121. return first.concat.apply(first, others);
  27122. },
  27123. peg$currPos = 0,
  27124. peg$savedPos = 0,
  27125. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27126. peg$maxFailPos = 0,
  27127. peg$maxFailExpected = [],
  27128. peg$silentFails = 0,
  27129. peg$resultsCache = {},
  27130. peg$result;
  27131. if ("startRule" in options) {
  27132. if (!(options.startRule in peg$startRuleFunctions)) {
  27133. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27134. }
  27135. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27136. }
  27137. function text() {
  27138. return input.substring(peg$savedPos, peg$currPos);
  27139. }
  27140. function location() {
  27141. return peg$computeLocation(peg$savedPos, peg$currPos);
  27142. }
  27143. function expected(description) {
  27144. throw peg$buildException(
  27145. null,
  27146. [{ type: "other", description: description }],
  27147. input.substring(peg$savedPos, peg$currPos),
  27148. peg$computeLocation(peg$savedPos, peg$currPos)
  27149. );
  27150. }
  27151. function error(message) {
  27152. throw peg$buildException(
  27153. message,
  27154. null,
  27155. input.substring(peg$savedPos, peg$currPos),
  27156. peg$computeLocation(peg$savedPos, peg$currPos)
  27157. );
  27158. }
  27159. function peg$computePosDetails(pos) {
  27160. var details = peg$posDetailsCache[pos],
  27161. p, ch;
  27162. if (details) {
  27163. return details;
  27164. } else {
  27165. p = pos - 1;
  27166. while (!peg$posDetailsCache[p]) {
  27167. p--;
  27168. }
  27169. details = peg$posDetailsCache[p];
  27170. details = {
  27171. line: details.line,
  27172. column: details.column,
  27173. seenCR: details.seenCR
  27174. };
  27175. while (p < pos) {
  27176. ch = input.charAt(p);
  27177. if (ch === "\n") {
  27178. if (!details.seenCR) { details.line++; }
  27179. details.column = 1;
  27180. details.seenCR = false;
  27181. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27182. details.line++;
  27183. details.column = 1;
  27184. details.seenCR = true;
  27185. } else {
  27186. details.column++;
  27187. details.seenCR = false;
  27188. }
  27189. p++;
  27190. }
  27191. peg$posDetailsCache[pos] = details;
  27192. return details;
  27193. }
  27194. }
  27195. function peg$computeLocation(startPos, endPos) {
  27196. var startPosDetails = peg$computePosDetails(startPos),
  27197. endPosDetails = peg$computePosDetails(endPos);
  27198. return {
  27199. start: {
  27200. offset: startPos,
  27201. line: startPosDetails.line,
  27202. column: startPosDetails.column
  27203. },
  27204. end: {
  27205. offset: endPos,
  27206. line: endPosDetails.line,
  27207. column: endPosDetails.column
  27208. }
  27209. };
  27210. }
  27211. function peg$fail(expected) {
  27212. if (peg$currPos < peg$maxFailPos) { return; }
  27213. if (peg$currPos > peg$maxFailPos) {
  27214. peg$maxFailPos = peg$currPos;
  27215. peg$maxFailExpected = [];
  27216. }
  27217. peg$maxFailExpected.push(expected);
  27218. }
  27219. function peg$buildException(message, expected, found, location) {
  27220. function cleanupExpected(expected) {
  27221. var i = 1;
  27222. expected.sort(function(a, b) {
  27223. if (a.description < b.description) {
  27224. return -1;
  27225. } else if (a.description > b.description) {
  27226. return 1;
  27227. } else {
  27228. return 0;
  27229. }
  27230. });
  27231. while (i < expected.length) {
  27232. if (expected[i - 1] === expected[i]) {
  27233. expected.splice(i, 1);
  27234. } else {
  27235. i++;
  27236. }
  27237. }
  27238. }
  27239. function buildMessage(expected, found) {
  27240. function stringEscape(s) {
  27241. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27242. return s
  27243. .replace(/\\/g, '\\\\')
  27244. .replace(/"/g, '\\"')
  27245. .replace(/\x08/g, '\\b')
  27246. .replace(/\t/g, '\\t')
  27247. .replace(/\n/g, '\\n')
  27248. .replace(/\f/g, '\\f')
  27249. .replace(/\r/g, '\\r')
  27250. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27251. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27252. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27253. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27254. }
  27255. var expectedDescs = new Array(expected.length),
  27256. expectedDesc, foundDesc, i;
  27257. for (i = 0; i < expected.length; i++) {
  27258. expectedDescs[i] = expected[i].description;
  27259. }
  27260. expectedDesc = expected.length > 1
  27261. ? expectedDescs.slice(0, -1).join(", ")
  27262. + " or "
  27263. + expectedDescs[expected.length - 1]
  27264. : expectedDescs[0];
  27265. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27266. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27267. }
  27268. if (expected !== null) {
  27269. cleanupExpected(expected);
  27270. }
  27271. return new peg$SyntaxError(
  27272. message !== null ? message : buildMessage(expected, found),
  27273. expected,
  27274. found,
  27275. location
  27276. );
  27277. }
  27278. function peg$parsestart() {
  27279. var s0;
  27280. var key = peg$currPos * 66 + 0,
  27281. cached = peg$resultsCache[key];
  27282. if (cached) {
  27283. peg$currPos = cached.nextPos;
  27284. return cached.result;
  27285. }
  27286. s0 = peg$parsemethod();
  27287. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27288. return s0;
  27289. }
  27290. function peg$parseseparator() {
  27291. var s0, s1;
  27292. var key = peg$currPos * 66 + 1,
  27293. cached = peg$resultsCache[key];
  27294. if (cached) {
  27295. peg$currPos = cached.nextPos;
  27296. return cached.result;
  27297. }
  27298. s0 = [];
  27299. if (peg$c0.test(input.charAt(peg$currPos))) {
  27300. s1 = input.charAt(peg$currPos);
  27301. peg$currPos++;
  27302. } else {
  27303. s1 = peg$FAILED;
  27304. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27305. }
  27306. if (s1 !== peg$FAILED) {
  27307. while (s1 !== peg$FAILED) {
  27308. s0.push(s1);
  27309. if (peg$c0.test(input.charAt(peg$currPos))) {
  27310. s1 = input.charAt(peg$currPos);
  27311. peg$currPos++;
  27312. } else {
  27313. s1 = peg$FAILED;
  27314. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27315. }
  27316. }
  27317. } else {
  27318. s0 = peg$FAILED;
  27319. }
  27320. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27321. return s0;
  27322. }
  27323. function peg$parsecomments() {
  27324. var s0, s1, s2, s3, s4;
  27325. var key = peg$currPos * 66 + 2,
  27326. cached = peg$resultsCache[key];
  27327. if (cached) {
  27328. peg$currPos = cached.nextPos;
  27329. return cached.result;
  27330. }
  27331. s0 = [];
  27332. s1 = peg$currPos;
  27333. if (input.charCodeAt(peg$currPos) === 34) {
  27334. s2 = peg$c2;
  27335. peg$currPos++;
  27336. } else {
  27337. s2 = peg$FAILED;
  27338. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27339. }
  27340. if (s2 !== peg$FAILED) {
  27341. s3 = [];
  27342. if (peg$c4.test(input.charAt(peg$currPos))) {
  27343. s4 = input.charAt(peg$currPos);
  27344. peg$currPos++;
  27345. } else {
  27346. s4 = peg$FAILED;
  27347. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27348. }
  27349. while (s4 !== peg$FAILED) {
  27350. s3.push(s4);
  27351. if (peg$c4.test(input.charAt(peg$currPos))) {
  27352. s4 = input.charAt(peg$currPos);
  27353. peg$currPos++;
  27354. } else {
  27355. s4 = peg$FAILED;
  27356. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27357. }
  27358. }
  27359. if (s3 !== peg$FAILED) {
  27360. if (input.charCodeAt(peg$currPos) === 34) {
  27361. s4 = peg$c2;
  27362. peg$currPos++;
  27363. } else {
  27364. s4 = peg$FAILED;
  27365. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27366. }
  27367. if (s4 !== peg$FAILED) {
  27368. s2 = [s2, s3, s4];
  27369. s1 = s2;
  27370. } else {
  27371. peg$currPos = s1;
  27372. s1 = peg$FAILED;
  27373. }
  27374. } else {
  27375. peg$currPos = s1;
  27376. s1 = peg$FAILED;
  27377. }
  27378. } else {
  27379. peg$currPos = s1;
  27380. s1 = peg$FAILED;
  27381. }
  27382. if (s1 !== peg$FAILED) {
  27383. while (s1 !== peg$FAILED) {
  27384. s0.push(s1);
  27385. s1 = peg$currPos;
  27386. if (input.charCodeAt(peg$currPos) === 34) {
  27387. s2 = peg$c2;
  27388. peg$currPos++;
  27389. } else {
  27390. s2 = peg$FAILED;
  27391. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27392. }
  27393. if (s2 !== peg$FAILED) {
  27394. s3 = [];
  27395. if (peg$c4.test(input.charAt(peg$currPos))) {
  27396. s4 = input.charAt(peg$currPos);
  27397. peg$currPos++;
  27398. } else {
  27399. s4 = peg$FAILED;
  27400. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27401. }
  27402. while (s4 !== peg$FAILED) {
  27403. s3.push(s4);
  27404. if (peg$c4.test(input.charAt(peg$currPos))) {
  27405. s4 = input.charAt(peg$currPos);
  27406. peg$currPos++;
  27407. } else {
  27408. s4 = peg$FAILED;
  27409. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27410. }
  27411. }
  27412. if (s3 !== peg$FAILED) {
  27413. if (input.charCodeAt(peg$currPos) === 34) {
  27414. s4 = peg$c2;
  27415. peg$currPos++;
  27416. } else {
  27417. s4 = peg$FAILED;
  27418. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27419. }
  27420. if (s4 !== peg$FAILED) {
  27421. s2 = [s2, s3, s4];
  27422. s1 = s2;
  27423. } else {
  27424. peg$currPos = s1;
  27425. s1 = peg$FAILED;
  27426. }
  27427. } else {
  27428. peg$currPos = s1;
  27429. s1 = peg$FAILED;
  27430. }
  27431. } else {
  27432. peg$currPos = s1;
  27433. s1 = peg$FAILED;
  27434. }
  27435. }
  27436. } else {
  27437. s0 = peg$FAILED;
  27438. }
  27439. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27440. return s0;
  27441. }
  27442. function peg$parsews() {
  27443. var s0, s1;
  27444. var key = peg$currPos * 66 + 3,
  27445. cached = peg$resultsCache[key];
  27446. if (cached) {
  27447. peg$currPos = cached.nextPos;
  27448. return cached.result;
  27449. }
  27450. s0 = [];
  27451. s1 = peg$parseseparator();
  27452. if (s1 === peg$FAILED) {
  27453. s1 = peg$parsecomments();
  27454. }
  27455. while (s1 !== peg$FAILED) {
  27456. s0.push(s1);
  27457. s1 = peg$parseseparator();
  27458. if (s1 === peg$FAILED) {
  27459. s1 = peg$parsecomments();
  27460. }
  27461. }
  27462. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27463. return s0;
  27464. }
  27465. function peg$parsemaybeDotsWs() {
  27466. var s0, s1;
  27467. var key = peg$currPos * 66 + 4,
  27468. cached = peg$resultsCache[key];
  27469. if (cached) {
  27470. peg$currPos = cached.nextPos;
  27471. return cached.result;
  27472. }
  27473. s0 = [];
  27474. if (input.charCodeAt(peg$currPos) === 46) {
  27475. s1 = peg$c6;
  27476. peg$currPos++;
  27477. } else {
  27478. s1 = peg$FAILED;
  27479. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27480. }
  27481. if (s1 === peg$FAILED) {
  27482. s1 = peg$parseseparator();
  27483. if (s1 === peg$FAILED) {
  27484. s1 = peg$parsecomments();
  27485. }
  27486. }
  27487. while (s1 !== peg$FAILED) {
  27488. s0.push(s1);
  27489. if (input.charCodeAt(peg$currPos) === 46) {
  27490. s1 = peg$c6;
  27491. peg$currPos++;
  27492. } else {
  27493. s1 = peg$FAILED;
  27494. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27495. }
  27496. if (s1 === peg$FAILED) {
  27497. s1 = peg$parseseparator();
  27498. if (s1 === peg$FAILED) {
  27499. s1 = peg$parsecomments();
  27500. }
  27501. }
  27502. }
  27503. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27504. return s0;
  27505. }
  27506. function peg$parsesomeDotsWs() {
  27507. var s0, s1, s2, s3;
  27508. var key = peg$currPos * 66 + 5,
  27509. cached = peg$resultsCache[key];
  27510. if (cached) {
  27511. peg$currPos = cached.nextPos;
  27512. return cached.result;
  27513. }
  27514. s0 = peg$currPos;
  27515. s1 = peg$parsews();
  27516. if (s1 !== peg$FAILED) {
  27517. if (input.charCodeAt(peg$currPos) === 46) {
  27518. s2 = peg$c6;
  27519. peg$currPos++;
  27520. } else {
  27521. s2 = peg$FAILED;
  27522. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27523. }
  27524. if (s2 !== peg$FAILED) {
  27525. s3 = peg$parsemaybeDotsWs();
  27526. if (s3 !== peg$FAILED) {
  27527. s1 = [s1, s2, s3];
  27528. s0 = s1;
  27529. } else {
  27530. peg$currPos = s0;
  27531. s0 = peg$FAILED;
  27532. }
  27533. } else {
  27534. peg$currPos = s0;
  27535. s0 = peg$FAILED;
  27536. }
  27537. } else {
  27538. peg$currPos = s0;
  27539. s0 = peg$FAILED;
  27540. }
  27541. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27542. return s0;
  27543. }
  27544. function peg$parseidentifier() {
  27545. var s0, s1, s2, s3, s4;
  27546. var key = peg$currPos * 66 + 6,
  27547. cached = peg$resultsCache[key];
  27548. if (cached) {
  27549. peg$currPos = cached.nextPos;
  27550. return cached.result;
  27551. }
  27552. s0 = peg$currPos;
  27553. s1 = peg$currPos;
  27554. if (peg$c8.test(input.charAt(peg$currPos))) {
  27555. s2 = input.charAt(peg$currPos);
  27556. peg$currPos++;
  27557. } else {
  27558. s2 = peg$FAILED;
  27559. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27560. }
  27561. if (s2 !== peg$FAILED) {
  27562. s3 = [];
  27563. if (peg$c10.test(input.charAt(peg$currPos))) {
  27564. s4 = input.charAt(peg$currPos);
  27565. peg$currPos++;
  27566. } else {
  27567. s4 = peg$FAILED;
  27568. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27569. }
  27570. while (s4 !== peg$FAILED) {
  27571. s3.push(s4);
  27572. if (peg$c10.test(input.charAt(peg$currPos))) {
  27573. s4 = input.charAt(peg$currPos);
  27574. peg$currPos++;
  27575. } else {
  27576. s4 = peg$FAILED;
  27577. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27578. }
  27579. }
  27580. if (s3 !== peg$FAILED) {
  27581. s2 = [s2, s3];
  27582. s1 = s2;
  27583. } else {
  27584. peg$currPos = s1;
  27585. s1 = peg$FAILED;
  27586. }
  27587. } else {
  27588. peg$currPos = s1;
  27589. s1 = peg$FAILED;
  27590. }
  27591. if (s1 !== peg$FAILED) {
  27592. s0 = input.substring(s0, peg$currPos);
  27593. } else {
  27594. s0 = s1;
  27595. }
  27596. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27597. return s0;
  27598. }
  27599. function peg$parsekeyword() {
  27600. var s0, s1, s2, s3;
  27601. var key = peg$currPos * 66 + 7,
  27602. cached = peg$resultsCache[key];
  27603. if (cached) {
  27604. peg$currPos = cached.nextPos;
  27605. return cached.result;
  27606. }
  27607. s0 = peg$currPos;
  27608. s1 = peg$currPos;
  27609. s2 = peg$parseidentifier();
  27610. if (s2 !== peg$FAILED) {
  27611. if (input.charCodeAt(peg$currPos) === 58) {
  27612. s3 = peg$c12;
  27613. peg$currPos++;
  27614. } else {
  27615. s3 = peg$FAILED;
  27616. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27617. }
  27618. if (s3 !== peg$FAILED) {
  27619. s2 = [s2, s3];
  27620. s1 = s2;
  27621. } else {
  27622. peg$currPos = s1;
  27623. s1 = peg$FAILED;
  27624. }
  27625. } else {
  27626. peg$currPos = s1;
  27627. s1 = peg$FAILED;
  27628. }
  27629. if (s1 !== peg$FAILED) {
  27630. s0 = input.substring(s0, peg$currPos);
  27631. } else {
  27632. s0 = s1;
  27633. }
  27634. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27635. return s0;
  27636. }
  27637. function peg$parseclassName() {
  27638. var s0, s1, s2, s3, s4;
  27639. var key = peg$currPos * 66 + 8,
  27640. cached = peg$resultsCache[key];
  27641. if (cached) {
  27642. peg$currPos = cached.nextPos;
  27643. return cached.result;
  27644. }
  27645. s0 = peg$currPos;
  27646. s1 = peg$currPos;
  27647. if (peg$c14.test(input.charAt(peg$currPos))) {
  27648. s2 = input.charAt(peg$currPos);
  27649. peg$currPos++;
  27650. } else {
  27651. s2 = peg$FAILED;
  27652. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27653. }
  27654. if (s2 !== peg$FAILED) {
  27655. s3 = [];
  27656. if (peg$c10.test(input.charAt(peg$currPos))) {
  27657. s4 = input.charAt(peg$currPos);
  27658. peg$currPos++;
  27659. } else {
  27660. s4 = peg$FAILED;
  27661. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27662. }
  27663. while (s4 !== peg$FAILED) {
  27664. s3.push(s4);
  27665. if (peg$c10.test(input.charAt(peg$currPos))) {
  27666. s4 = input.charAt(peg$currPos);
  27667. peg$currPos++;
  27668. } else {
  27669. s4 = peg$FAILED;
  27670. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27671. }
  27672. }
  27673. if (s3 !== peg$FAILED) {
  27674. s2 = [s2, s3];
  27675. s1 = s2;
  27676. } else {
  27677. peg$currPos = s1;
  27678. s1 = peg$FAILED;
  27679. }
  27680. } else {
  27681. peg$currPos = s1;
  27682. s1 = peg$FAILED;
  27683. }
  27684. if (s1 !== peg$FAILED) {
  27685. s0 = input.substring(s0, peg$currPos);
  27686. } else {
  27687. s0 = s1;
  27688. }
  27689. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27690. return s0;
  27691. }
  27692. function peg$parsestring() {
  27693. var s0, s1;
  27694. var key = peg$currPos * 66 + 9,
  27695. cached = peg$resultsCache[key];
  27696. if (cached) {
  27697. peg$currPos = cached.nextPos;
  27698. return cached.result;
  27699. }
  27700. s0 = peg$currPos;
  27701. s1 = peg$parserawString();
  27702. if (s1 !== peg$FAILED) {
  27703. peg$savedPos = s0;
  27704. s1 = peg$c16(s1);
  27705. }
  27706. s0 = s1;
  27707. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27708. return s0;
  27709. }
  27710. function peg$parserawString() {
  27711. var s0, s1, s2, s3, s4;
  27712. var key = peg$currPos * 66 + 10,
  27713. cached = peg$resultsCache[key];
  27714. if (cached) {
  27715. peg$currPos = cached.nextPos;
  27716. return cached.result;
  27717. }
  27718. s0 = peg$currPos;
  27719. if (input.charCodeAt(peg$currPos) === 39) {
  27720. s1 = peg$c17;
  27721. peg$currPos++;
  27722. } else {
  27723. s1 = peg$FAILED;
  27724. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27725. }
  27726. if (s1 !== peg$FAILED) {
  27727. s2 = [];
  27728. s3 = peg$currPos;
  27729. if (input.substr(peg$currPos, 2) === peg$c19) {
  27730. s4 = peg$c19;
  27731. peg$currPos += 2;
  27732. } else {
  27733. s4 = peg$FAILED;
  27734. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27735. }
  27736. if (s4 !== peg$FAILED) {
  27737. peg$savedPos = s3;
  27738. s4 = peg$c21();
  27739. }
  27740. s3 = s4;
  27741. if (s3 === peg$FAILED) {
  27742. if (peg$c22.test(input.charAt(peg$currPos))) {
  27743. s3 = input.charAt(peg$currPos);
  27744. peg$currPos++;
  27745. } else {
  27746. s3 = peg$FAILED;
  27747. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27748. }
  27749. }
  27750. while (s3 !== peg$FAILED) {
  27751. s2.push(s3);
  27752. s3 = peg$currPos;
  27753. if (input.substr(peg$currPos, 2) === peg$c19) {
  27754. s4 = peg$c19;
  27755. peg$currPos += 2;
  27756. } else {
  27757. s4 = peg$FAILED;
  27758. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27759. }
  27760. if (s4 !== peg$FAILED) {
  27761. peg$savedPos = s3;
  27762. s4 = peg$c21();
  27763. }
  27764. s3 = s4;
  27765. if (s3 === peg$FAILED) {
  27766. if (peg$c22.test(input.charAt(peg$currPos))) {
  27767. s3 = input.charAt(peg$currPos);
  27768. peg$currPos++;
  27769. } else {
  27770. s3 = peg$FAILED;
  27771. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27772. }
  27773. }
  27774. }
  27775. if (s2 !== peg$FAILED) {
  27776. if (input.charCodeAt(peg$currPos) === 39) {
  27777. s3 = peg$c17;
  27778. peg$currPos++;
  27779. } else {
  27780. s3 = peg$FAILED;
  27781. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27782. }
  27783. if (s3 !== peg$FAILED) {
  27784. peg$savedPos = s0;
  27785. s1 = peg$c24(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. } else {
  27796. peg$currPos = s0;
  27797. s0 = peg$FAILED;
  27798. }
  27799. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27800. return s0;
  27801. }
  27802. function peg$parsecharacter() {
  27803. var s0, s1, s2;
  27804. var key = peg$currPos * 66 + 11,
  27805. cached = peg$resultsCache[key];
  27806. if (cached) {
  27807. peg$currPos = cached.nextPos;
  27808. return cached.result;
  27809. }
  27810. s0 = peg$currPos;
  27811. if (input.charCodeAt(peg$currPos) === 36) {
  27812. s1 = peg$c25;
  27813. peg$currPos++;
  27814. } else {
  27815. s1 = peg$FAILED;
  27816. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27817. }
  27818. if (s1 !== peg$FAILED) {
  27819. if (input.length > peg$currPos) {
  27820. s2 = input.charAt(peg$currPos);
  27821. peg$currPos++;
  27822. } else {
  27823. s2 = peg$FAILED;
  27824. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27825. }
  27826. if (s2 !== peg$FAILED) {
  27827. peg$savedPos = s0;
  27828. s1 = peg$c28(s2);
  27829. s0 = s1;
  27830. } else {
  27831. peg$currPos = s0;
  27832. s0 = peg$FAILED;
  27833. }
  27834. } else {
  27835. peg$currPos = s0;
  27836. s0 = peg$FAILED;
  27837. }
  27838. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27839. return s0;
  27840. }
  27841. function peg$parsesymbol() {
  27842. var s0, s1, s2;
  27843. var key = peg$currPos * 66 + 12,
  27844. cached = peg$resultsCache[key];
  27845. if (cached) {
  27846. peg$currPos = cached.nextPos;
  27847. return cached.result;
  27848. }
  27849. s0 = peg$currPos;
  27850. if (input.charCodeAt(peg$currPos) === 35) {
  27851. s1 = peg$c29;
  27852. peg$currPos++;
  27853. } else {
  27854. s1 = peg$FAILED;
  27855. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27856. }
  27857. if (s1 !== peg$FAILED) {
  27858. s2 = peg$parsebareSymbol();
  27859. if (s2 !== peg$FAILED) {
  27860. peg$savedPos = s0;
  27861. s1 = peg$c31(s2);
  27862. s0 = s1;
  27863. } else {
  27864. peg$currPos = s0;
  27865. s0 = peg$FAILED;
  27866. }
  27867. } else {
  27868. peg$currPos = s0;
  27869. s0 = peg$FAILED;
  27870. }
  27871. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27872. return s0;
  27873. }
  27874. function peg$parsebareSymbol() {
  27875. var s0, s1, s2, s3;
  27876. var key = peg$currPos * 66 + 13,
  27877. cached = peg$resultsCache[key];
  27878. if (cached) {
  27879. peg$currPos = cached.nextPos;
  27880. return cached.result;
  27881. }
  27882. s0 = peg$currPos;
  27883. s1 = peg$currPos;
  27884. s2 = [];
  27885. s3 = peg$parsekeyword();
  27886. if (s3 !== peg$FAILED) {
  27887. while (s3 !== peg$FAILED) {
  27888. s2.push(s3);
  27889. s3 = peg$parsekeyword();
  27890. }
  27891. } else {
  27892. s2 = peg$FAILED;
  27893. }
  27894. if (s2 !== peg$FAILED) {
  27895. s1 = input.substring(s1, peg$currPos);
  27896. } else {
  27897. s1 = s2;
  27898. }
  27899. if (s1 === peg$FAILED) {
  27900. s1 = peg$parsebinarySelector();
  27901. if (s1 === peg$FAILED) {
  27902. s1 = peg$parseidentifier();
  27903. if (s1 === peg$FAILED) {
  27904. s1 = peg$parserawString();
  27905. }
  27906. }
  27907. }
  27908. if (s1 !== peg$FAILED) {
  27909. peg$savedPos = s0;
  27910. s1 = peg$c16(s1);
  27911. }
  27912. s0 = s1;
  27913. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27914. return s0;
  27915. }
  27916. function peg$parsenumber() {
  27917. var s0, s1;
  27918. var key = peg$currPos * 66 + 14,
  27919. cached = peg$resultsCache[key];
  27920. if (cached) {
  27921. peg$currPos = cached.nextPos;
  27922. return cached.result;
  27923. }
  27924. s0 = peg$currPos;
  27925. s1 = peg$parserawNumber();
  27926. if (s1 !== peg$FAILED) {
  27927. peg$savedPos = s0;
  27928. s1 = peg$c16(s1);
  27929. }
  27930. s0 = s1;
  27931. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27932. return s0;
  27933. }
  27934. function peg$parserawNumber() {
  27935. var s0;
  27936. var key = peg$currPos * 66 + 15,
  27937. cached = peg$resultsCache[key];
  27938. if (cached) {
  27939. peg$currPos = cached.nextPos;
  27940. return cached.result;
  27941. }
  27942. s0 = peg$parsenumberExp();
  27943. if (s0 === peg$FAILED) {
  27944. s0 = peg$parsehex();
  27945. if (s0 === peg$FAILED) {
  27946. s0 = peg$parsefloat();
  27947. if (s0 === peg$FAILED) {
  27948. s0 = peg$parseinteger();
  27949. }
  27950. }
  27951. }
  27952. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27953. return s0;
  27954. }
  27955. function peg$parsenumberExp() {
  27956. var s0, s1, s2, s3, s4, s5;
  27957. var key = peg$currPos * 66 + 16,
  27958. cached = peg$resultsCache[key];
  27959. if (cached) {
  27960. peg$currPos = cached.nextPos;
  27961. return cached.result;
  27962. }
  27963. s0 = peg$currPos;
  27964. s1 = peg$currPos;
  27965. s2 = peg$currPos;
  27966. s3 = peg$parsefloat();
  27967. if (s3 === peg$FAILED) {
  27968. s3 = peg$parseinteger();
  27969. }
  27970. if (s3 !== peg$FAILED) {
  27971. if (input.charCodeAt(peg$currPos) === 101) {
  27972. s4 = peg$c32;
  27973. peg$currPos++;
  27974. } else {
  27975. s4 = peg$FAILED;
  27976. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27977. }
  27978. if (s4 !== peg$FAILED) {
  27979. s5 = peg$parseinteger();
  27980. if (s5 !== peg$FAILED) {
  27981. s3 = [s3, s4, s5];
  27982. s2 = s3;
  27983. } else {
  27984. peg$currPos = s2;
  27985. s2 = peg$FAILED;
  27986. }
  27987. } else {
  27988. peg$currPos = s2;
  27989. s2 = peg$FAILED;
  27990. }
  27991. } else {
  27992. peg$currPos = s2;
  27993. s2 = peg$FAILED;
  27994. }
  27995. if (s2 !== peg$FAILED) {
  27996. s1 = input.substring(s1, peg$currPos);
  27997. } else {
  27998. s1 = s2;
  27999. }
  28000. if (s1 !== peg$FAILED) {
  28001. peg$savedPos = s0;
  28002. s1 = peg$c34(s1);
  28003. }
  28004. s0 = s1;
  28005. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28006. return s0;
  28007. }
  28008. function peg$parsehex() {
  28009. var s0, s1, s2, s3, s4, s5;
  28010. var key = peg$currPos * 66 + 17,
  28011. cached = peg$resultsCache[key];
  28012. if (cached) {
  28013. peg$currPos = cached.nextPos;
  28014. return cached.result;
  28015. }
  28016. s0 = peg$currPos;
  28017. if (input.charCodeAt(peg$currPos) === 45) {
  28018. s1 = peg$c35;
  28019. peg$currPos++;
  28020. } else {
  28021. s1 = peg$FAILED;
  28022. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28023. }
  28024. if (s1 === peg$FAILED) {
  28025. s1 = null;
  28026. }
  28027. if (s1 !== peg$FAILED) {
  28028. if (input.substr(peg$currPos, 3) === peg$c37) {
  28029. s2 = peg$c37;
  28030. peg$currPos += 3;
  28031. } else {
  28032. s2 = peg$FAILED;
  28033. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  28034. }
  28035. if (s2 !== peg$FAILED) {
  28036. s3 = peg$currPos;
  28037. s4 = [];
  28038. if (peg$c39.test(input.charAt(peg$currPos))) {
  28039. s5 = input.charAt(peg$currPos);
  28040. peg$currPos++;
  28041. } else {
  28042. s5 = peg$FAILED;
  28043. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28044. }
  28045. if (s5 !== peg$FAILED) {
  28046. while (s5 !== peg$FAILED) {
  28047. s4.push(s5);
  28048. if (peg$c39.test(input.charAt(peg$currPos))) {
  28049. s5 = input.charAt(peg$currPos);
  28050. peg$currPos++;
  28051. } else {
  28052. s5 = peg$FAILED;
  28053. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28054. }
  28055. }
  28056. } else {
  28057. s4 = peg$FAILED;
  28058. }
  28059. if (s4 !== peg$FAILED) {
  28060. s3 = input.substring(s3, peg$currPos);
  28061. } else {
  28062. s3 = s4;
  28063. }
  28064. if (s3 !== peg$FAILED) {
  28065. peg$savedPos = s0;
  28066. s1 = peg$c41(s1, s3);
  28067. s0 = s1;
  28068. } else {
  28069. peg$currPos = s0;
  28070. s0 = peg$FAILED;
  28071. }
  28072. } else {
  28073. peg$currPos = s0;
  28074. s0 = peg$FAILED;
  28075. }
  28076. } else {
  28077. peg$currPos = s0;
  28078. s0 = peg$FAILED;
  28079. }
  28080. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28081. return s0;
  28082. }
  28083. function peg$parsefloat() {
  28084. var s0, s1, s2, s3, s4, s5, s6, s7;
  28085. var key = peg$currPos * 66 + 18,
  28086. cached = peg$resultsCache[key];
  28087. if (cached) {
  28088. peg$currPos = cached.nextPos;
  28089. return cached.result;
  28090. }
  28091. s0 = peg$currPos;
  28092. s1 = peg$currPos;
  28093. s2 = peg$currPos;
  28094. if (input.charCodeAt(peg$currPos) === 45) {
  28095. s3 = peg$c35;
  28096. peg$currPos++;
  28097. } else {
  28098. s3 = peg$FAILED;
  28099. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28100. }
  28101. if (s3 === peg$FAILED) {
  28102. s3 = null;
  28103. }
  28104. if (s3 !== peg$FAILED) {
  28105. s4 = [];
  28106. if (peg$c42.test(input.charAt(peg$currPos))) {
  28107. s5 = input.charAt(peg$currPos);
  28108. peg$currPos++;
  28109. } else {
  28110. s5 = peg$FAILED;
  28111. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28112. }
  28113. if (s5 !== peg$FAILED) {
  28114. while (s5 !== peg$FAILED) {
  28115. s4.push(s5);
  28116. if (peg$c42.test(input.charAt(peg$currPos))) {
  28117. s5 = input.charAt(peg$currPos);
  28118. peg$currPos++;
  28119. } else {
  28120. s5 = peg$FAILED;
  28121. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28122. }
  28123. }
  28124. } else {
  28125. s4 = peg$FAILED;
  28126. }
  28127. if (s4 !== peg$FAILED) {
  28128. if (input.charCodeAt(peg$currPos) === 46) {
  28129. s5 = peg$c6;
  28130. peg$currPos++;
  28131. } else {
  28132. s5 = peg$FAILED;
  28133. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28134. }
  28135. if (s5 !== peg$FAILED) {
  28136. s6 = [];
  28137. if (peg$c42.test(input.charAt(peg$currPos))) {
  28138. s7 = input.charAt(peg$currPos);
  28139. peg$currPos++;
  28140. } else {
  28141. s7 = peg$FAILED;
  28142. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28143. }
  28144. if (s7 !== peg$FAILED) {
  28145. while (s7 !== peg$FAILED) {
  28146. s6.push(s7);
  28147. if (peg$c42.test(input.charAt(peg$currPos))) {
  28148. s7 = input.charAt(peg$currPos);
  28149. peg$currPos++;
  28150. } else {
  28151. s7 = peg$FAILED;
  28152. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28153. }
  28154. }
  28155. } else {
  28156. s6 = peg$FAILED;
  28157. }
  28158. if (s6 !== peg$FAILED) {
  28159. s3 = [s3, s4, s5, s6];
  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. } else {
  28170. peg$currPos = s2;
  28171. s2 = peg$FAILED;
  28172. }
  28173. } else {
  28174. peg$currPos = s2;
  28175. s2 = peg$FAILED;
  28176. }
  28177. if (s2 !== peg$FAILED) {
  28178. s1 = input.substring(s1, peg$currPos);
  28179. } else {
  28180. s1 = s2;
  28181. }
  28182. if (s1 !== peg$FAILED) {
  28183. peg$savedPos = s0;
  28184. s1 = peg$c44(s1);
  28185. }
  28186. s0 = s1;
  28187. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28188. return s0;
  28189. }
  28190. function peg$parseinteger() {
  28191. var s0, s1, s2, s3, s4, s5;
  28192. var key = peg$currPos * 66 + 19,
  28193. cached = peg$resultsCache[key];
  28194. if (cached) {
  28195. peg$currPos = cached.nextPos;
  28196. return cached.result;
  28197. }
  28198. s0 = peg$currPos;
  28199. s1 = peg$currPos;
  28200. s2 = peg$currPos;
  28201. if (input.charCodeAt(peg$currPos) === 45) {
  28202. s3 = peg$c35;
  28203. peg$currPos++;
  28204. } else {
  28205. s3 = peg$FAILED;
  28206. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28207. }
  28208. if (s3 === peg$FAILED) {
  28209. s3 = null;
  28210. }
  28211. if (s3 !== peg$FAILED) {
  28212. s4 = [];
  28213. if (peg$c42.test(input.charAt(peg$currPos))) {
  28214. s5 = input.charAt(peg$currPos);
  28215. peg$currPos++;
  28216. } else {
  28217. s5 = peg$FAILED;
  28218. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28219. }
  28220. if (s5 !== peg$FAILED) {
  28221. while (s5 !== peg$FAILED) {
  28222. s4.push(s5);
  28223. if (peg$c42.test(input.charAt(peg$currPos))) {
  28224. s5 = input.charAt(peg$currPos);
  28225. peg$currPos++;
  28226. } else {
  28227. s5 = peg$FAILED;
  28228. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28229. }
  28230. }
  28231. } else {
  28232. s4 = peg$FAILED;
  28233. }
  28234. if (s4 !== peg$FAILED) {
  28235. s3 = [s3, s4];
  28236. s2 = s3;
  28237. } else {
  28238. peg$currPos = s2;
  28239. s2 = peg$FAILED;
  28240. }
  28241. } else {
  28242. peg$currPos = s2;
  28243. s2 = peg$FAILED;
  28244. }
  28245. if (s2 !== peg$FAILED) {
  28246. s1 = input.substring(s1, peg$currPos);
  28247. } else {
  28248. s1 = s2;
  28249. }
  28250. if (s1 !== peg$FAILED) {
  28251. peg$savedPos = s0;
  28252. s1 = peg$c45(s1);
  28253. }
  28254. s0 = s1;
  28255. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28256. return s0;
  28257. }
  28258. function peg$parseliteralArray() {
  28259. var s0, s1, s2, s3, s4;
  28260. var key = peg$currPos * 66 + 20,
  28261. cached = peg$resultsCache[key];
  28262. if (cached) {
  28263. peg$currPos = cached.nextPos;
  28264. return cached.result;
  28265. }
  28266. s0 = peg$currPos;
  28267. if (input.substr(peg$currPos, 2) === peg$c46) {
  28268. s1 = peg$c46;
  28269. peg$currPos += 2;
  28270. } else {
  28271. s1 = peg$FAILED;
  28272. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28273. }
  28274. if (s1 !== peg$FAILED) {
  28275. s2 = peg$parsewsLiteralArrayContents();
  28276. if (s2 !== peg$FAILED) {
  28277. s3 = peg$parsews();
  28278. if (s3 !== peg$FAILED) {
  28279. if (input.charCodeAt(peg$currPos) === 41) {
  28280. s4 = peg$c48;
  28281. peg$currPos++;
  28282. } else {
  28283. s4 = peg$FAILED;
  28284. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28285. }
  28286. if (s4 !== peg$FAILED) {
  28287. peg$savedPos = s0;
  28288. s1 = peg$c50(s2);
  28289. s0 = s1;
  28290. } else {
  28291. peg$currPos = s0;
  28292. s0 = peg$FAILED;
  28293. }
  28294. } else {
  28295. peg$currPos = s0;
  28296. s0 = peg$FAILED;
  28297. }
  28298. } else {
  28299. peg$currPos = s0;
  28300. s0 = peg$FAILED;
  28301. }
  28302. } else {
  28303. peg$currPos = s0;
  28304. s0 = peg$FAILED;
  28305. }
  28306. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28307. return s0;
  28308. }
  28309. function peg$parsebareLiteralArray() {
  28310. var s0, s1, s2, s3, s4;
  28311. var key = peg$currPos * 66 + 21,
  28312. cached = peg$resultsCache[key];
  28313. if (cached) {
  28314. peg$currPos = cached.nextPos;
  28315. return cached.result;
  28316. }
  28317. s0 = peg$currPos;
  28318. if (input.charCodeAt(peg$currPos) === 40) {
  28319. s1 = peg$c51;
  28320. peg$currPos++;
  28321. } else {
  28322. s1 = peg$FAILED;
  28323. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28324. }
  28325. if (s1 !== peg$FAILED) {
  28326. s2 = peg$parsewsLiteralArrayContents();
  28327. if (s2 !== peg$FAILED) {
  28328. s3 = peg$parsews();
  28329. if (s3 !== peg$FAILED) {
  28330. if (input.charCodeAt(peg$currPos) === 41) {
  28331. s4 = peg$c48;
  28332. peg$currPos++;
  28333. } else {
  28334. s4 = peg$FAILED;
  28335. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28336. }
  28337. if (s4 !== peg$FAILED) {
  28338. peg$savedPos = s0;
  28339. s1 = peg$c50(s2);
  28340. s0 = s1;
  28341. } else {
  28342. peg$currPos = s0;
  28343. s0 = peg$FAILED;
  28344. }
  28345. } else {
  28346. peg$currPos = s0;
  28347. s0 = peg$FAILED;
  28348. }
  28349. } else {
  28350. peg$currPos = s0;
  28351. s0 = peg$FAILED;
  28352. }
  28353. } else {
  28354. peg$currPos = s0;
  28355. s0 = peg$FAILED;
  28356. }
  28357. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28358. return s0;
  28359. }
  28360. function peg$parseliteralArrayElement() {
  28361. var s0;
  28362. var key = peg$currPos * 66 + 22,
  28363. cached = peg$resultsCache[key];
  28364. if (cached) {
  28365. peg$currPos = cached.nextPos;
  28366. return cached.result;
  28367. }
  28368. s0 = peg$parseparseTimeLiteral();
  28369. if (s0 === peg$FAILED) {
  28370. s0 = peg$parsebareLiteralArray();
  28371. if (s0 === peg$FAILED) {
  28372. s0 = peg$parsebareSymbol();
  28373. }
  28374. }
  28375. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28376. return s0;
  28377. }
  28378. function peg$parsewsLiteralArrayContents() {
  28379. var s0, s1, s2, s3, s4;
  28380. var key = peg$currPos * 66 + 23,
  28381. cached = peg$resultsCache[key];
  28382. if (cached) {
  28383. peg$currPos = cached.nextPos;
  28384. return cached.result;
  28385. }
  28386. s0 = peg$currPos;
  28387. s1 = [];
  28388. s2 = peg$currPos;
  28389. s3 = peg$parsews();
  28390. if (s3 !== peg$FAILED) {
  28391. s4 = peg$parseliteralArrayElement();
  28392. if (s4 !== peg$FAILED) {
  28393. peg$savedPos = s2;
  28394. s3 = peg$c53(s4);
  28395. s2 = s3;
  28396. } else {
  28397. peg$currPos = s2;
  28398. s2 = peg$FAILED;
  28399. }
  28400. } else {
  28401. peg$currPos = s2;
  28402. s2 = peg$FAILED;
  28403. }
  28404. while (s2 !== peg$FAILED) {
  28405. s1.push(s2);
  28406. s2 = peg$currPos;
  28407. s3 = peg$parsews();
  28408. if (s3 !== peg$FAILED) {
  28409. s4 = peg$parseliteralArrayElement();
  28410. if (s4 !== peg$FAILED) {
  28411. peg$savedPos = s2;
  28412. s3 = peg$c53(s4);
  28413. s2 = s3;
  28414. } else {
  28415. peg$currPos = s2;
  28416. s2 = peg$FAILED;
  28417. }
  28418. } else {
  28419. peg$currPos = s2;
  28420. s2 = peg$FAILED;
  28421. }
  28422. }
  28423. if (s1 !== peg$FAILED) {
  28424. peg$savedPos = s0;
  28425. s1 = peg$c54(s1);
  28426. }
  28427. s0 = s1;
  28428. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28429. return s0;
  28430. }
  28431. function peg$parsedynamicArray() {
  28432. var s0, s1, s2, s3, s4;
  28433. var key = peg$currPos * 66 + 24,
  28434. cached = peg$resultsCache[key];
  28435. if (cached) {
  28436. peg$currPos = cached.nextPos;
  28437. return cached.result;
  28438. }
  28439. s0 = peg$currPos;
  28440. if (input.charCodeAt(peg$currPos) === 123) {
  28441. s1 = peg$c55;
  28442. peg$currPos++;
  28443. } else {
  28444. s1 = peg$FAILED;
  28445. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28446. }
  28447. if (s1 !== peg$FAILED) {
  28448. s2 = peg$parsewsExpressions();
  28449. if (s2 === peg$FAILED) {
  28450. s2 = null;
  28451. }
  28452. if (s2 !== peg$FAILED) {
  28453. s3 = peg$parsemaybeDotsWs();
  28454. if (s3 !== peg$FAILED) {
  28455. if (input.charCodeAt(peg$currPos) === 125) {
  28456. s4 = peg$c57;
  28457. peg$currPos++;
  28458. } else {
  28459. s4 = peg$FAILED;
  28460. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28461. }
  28462. if (s4 !== peg$FAILED) {
  28463. peg$savedPos = s0;
  28464. s1 = peg$c59(s2);
  28465. s0 = s1;
  28466. } else {
  28467. peg$currPos = s0;
  28468. s0 = peg$FAILED;
  28469. }
  28470. } else {
  28471. peg$currPos = s0;
  28472. s0 = peg$FAILED;
  28473. }
  28474. } else {
  28475. peg$currPos = s0;
  28476. s0 = peg$FAILED;
  28477. }
  28478. } else {
  28479. peg$currPos = s0;
  28480. s0 = peg$FAILED;
  28481. }
  28482. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28483. return s0;
  28484. }
  28485. function peg$parsedynamicDictionary() {
  28486. var s0, s1, s2, s3, s4;
  28487. var key = peg$currPos * 66 + 25,
  28488. cached = peg$resultsCache[key];
  28489. if (cached) {
  28490. peg$currPos = cached.nextPos;
  28491. return cached.result;
  28492. }
  28493. s0 = peg$currPos;
  28494. if (input.substr(peg$currPos, 2) === peg$c60) {
  28495. s1 = peg$c60;
  28496. peg$currPos += 2;
  28497. } else {
  28498. s1 = peg$FAILED;
  28499. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28500. }
  28501. if (s1 !== peg$FAILED) {
  28502. s2 = peg$parsewsAssociations();
  28503. if (s2 === peg$FAILED) {
  28504. s2 = null;
  28505. }
  28506. if (s2 !== peg$FAILED) {
  28507. s3 = peg$parsemaybeDotsWs();
  28508. if (s3 !== peg$FAILED) {
  28509. if (input.charCodeAt(peg$currPos) === 125) {
  28510. s4 = peg$c57;
  28511. peg$currPos++;
  28512. } else {
  28513. s4 = peg$FAILED;
  28514. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28515. }
  28516. if (s4 !== peg$FAILED) {
  28517. peg$savedPos = s0;
  28518. s1 = peg$c62(s2);
  28519. s0 = s1;
  28520. } else {
  28521. peg$currPos = s0;
  28522. s0 = peg$FAILED;
  28523. }
  28524. } else {
  28525. peg$currPos = s0;
  28526. s0 = peg$FAILED;
  28527. }
  28528. } else {
  28529. peg$currPos = s0;
  28530. s0 = peg$FAILED;
  28531. }
  28532. } else {
  28533. peg$currPos = s0;
  28534. s0 = peg$FAILED;
  28535. }
  28536. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28537. return s0;
  28538. }
  28539. function peg$parsepseudoVariable() {
  28540. var s0, s1, s2;
  28541. var key = peg$currPos * 66 + 26,
  28542. cached = peg$resultsCache[key];
  28543. if (cached) {
  28544. peg$currPos = cached.nextPos;
  28545. return cached.result;
  28546. }
  28547. s0 = peg$currPos;
  28548. s1 = peg$currPos;
  28549. if (input.substr(peg$currPos, 4) === peg$c63) {
  28550. s2 = peg$c63;
  28551. peg$currPos += 4;
  28552. } else {
  28553. s2 = peg$FAILED;
  28554. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28555. }
  28556. if (s2 !== peg$FAILED) {
  28557. peg$savedPos = s1;
  28558. s2 = peg$c65();
  28559. }
  28560. s1 = s2;
  28561. if (s1 === peg$FAILED) {
  28562. s1 = peg$currPos;
  28563. if (input.substr(peg$currPos, 5) === peg$c66) {
  28564. s2 = peg$c66;
  28565. peg$currPos += 5;
  28566. } else {
  28567. s2 = peg$FAILED;
  28568. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28569. }
  28570. if (s2 !== peg$FAILED) {
  28571. peg$savedPos = s1;
  28572. s2 = peg$c68();
  28573. }
  28574. s1 = s2;
  28575. if (s1 === peg$FAILED) {
  28576. s1 = peg$currPos;
  28577. if (input.substr(peg$currPos, 3) === peg$c69) {
  28578. s2 = peg$c69;
  28579. peg$currPos += 3;
  28580. } else {
  28581. s2 = peg$FAILED;
  28582. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28583. }
  28584. if (s2 !== peg$FAILED) {
  28585. peg$savedPos = s1;
  28586. s2 = peg$c71();
  28587. }
  28588. s1 = s2;
  28589. }
  28590. }
  28591. if (s1 !== peg$FAILED) {
  28592. peg$savedPos = s0;
  28593. s1 = peg$c16(s1);
  28594. }
  28595. s0 = s1;
  28596. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28597. return s0;
  28598. }
  28599. function peg$parseparseTimeLiteral() {
  28600. var s0;
  28601. var key = peg$currPos * 66 + 27,
  28602. cached = peg$resultsCache[key];
  28603. if (cached) {
  28604. peg$currPos = cached.nextPos;
  28605. return cached.result;
  28606. }
  28607. s0 = peg$parsepseudoVariable();
  28608. if (s0 === peg$FAILED) {
  28609. s0 = peg$parsenumber();
  28610. if (s0 === peg$FAILED) {
  28611. s0 = peg$parseliteralArray();
  28612. if (s0 === peg$FAILED) {
  28613. s0 = peg$parsestring();
  28614. if (s0 === peg$FAILED) {
  28615. s0 = peg$parsesymbol();
  28616. if (s0 === peg$FAILED) {
  28617. s0 = peg$parsecharacter();
  28618. }
  28619. }
  28620. }
  28621. }
  28622. }
  28623. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28624. return s0;
  28625. }
  28626. function peg$parseruntimeLiteral() {
  28627. var s0;
  28628. var key = peg$currPos * 66 + 28,
  28629. cached = peg$resultsCache[key];
  28630. if (cached) {
  28631. peg$currPos = cached.nextPos;
  28632. return cached.result;
  28633. }
  28634. s0 = peg$parsedynamicDictionary();
  28635. if (s0 === peg$FAILED) {
  28636. s0 = peg$parsedynamicArray();
  28637. if (s0 === peg$FAILED) {
  28638. s0 = peg$parseblock();
  28639. }
  28640. }
  28641. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28642. return s0;
  28643. }
  28644. function peg$parseliteral() {
  28645. var s0;
  28646. var key = peg$currPos * 66 + 29,
  28647. cached = peg$resultsCache[key];
  28648. if (cached) {
  28649. peg$currPos = cached.nextPos;
  28650. return cached.result;
  28651. }
  28652. s0 = peg$parseruntimeLiteral();
  28653. if (s0 === peg$FAILED) {
  28654. s0 = peg$parseparseTimeLiteral();
  28655. }
  28656. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28657. return s0;
  28658. }
  28659. function peg$parsevariable() {
  28660. var s0, s1;
  28661. var key = peg$currPos * 66 + 30,
  28662. cached = peg$resultsCache[key];
  28663. if (cached) {
  28664. peg$currPos = cached.nextPos;
  28665. return cached.result;
  28666. }
  28667. s0 = peg$currPos;
  28668. s1 = peg$parseidentifier();
  28669. if (s1 !== peg$FAILED) {
  28670. peg$savedPos = s0;
  28671. s1 = peg$c72(s1);
  28672. }
  28673. s0 = s1;
  28674. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28675. return s0;
  28676. }
  28677. function peg$parsebinarySelector() {
  28678. var s0, s1, s2;
  28679. var key = peg$currPos * 66 + 31,
  28680. cached = peg$resultsCache[key];
  28681. if (cached) {
  28682. peg$currPos = cached.nextPos;
  28683. return cached.result;
  28684. }
  28685. s0 = peg$currPos;
  28686. s1 = [];
  28687. if (peg$c73.test(input.charAt(peg$currPos))) {
  28688. s2 = input.charAt(peg$currPos);
  28689. peg$currPos++;
  28690. } else {
  28691. s2 = peg$FAILED;
  28692. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28693. }
  28694. if (s2 !== peg$FAILED) {
  28695. while (s2 !== peg$FAILED) {
  28696. s1.push(s2);
  28697. if (peg$c73.test(input.charAt(peg$currPos))) {
  28698. s2 = input.charAt(peg$currPos);
  28699. peg$currPos++;
  28700. } else {
  28701. s2 = peg$FAILED;
  28702. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28703. }
  28704. }
  28705. } else {
  28706. s1 = peg$FAILED;
  28707. }
  28708. if (s1 !== peg$FAILED) {
  28709. s0 = input.substring(s0, peg$currPos);
  28710. } else {
  28711. s0 = s1;
  28712. }
  28713. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28714. return s0;
  28715. }
  28716. function peg$parsewsKeywordPattern() {
  28717. var s0, s1, s2, s3, s4, s5, s6;
  28718. var key = peg$currPos * 66 + 32,
  28719. cached = peg$resultsCache[key];
  28720. if (cached) {
  28721. peg$currPos = cached.nextPos;
  28722. return cached.result;
  28723. }
  28724. s0 = peg$currPos;
  28725. s1 = [];
  28726. s2 = peg$currPos;
  28727. s3 = peg$parsews();
  28728. if (s3 !== peg$FAILED) {
  28729. s4 = peg$parsekeyword();
  28730. if (s4 !== peg$FAILED) {
  28731. s5 = peg$parsews();
  28732. if (s5 !== peg$FAILED) {
  28733. s6 = peg$parseidentifier();
  28734. if (s6 !== peg$FAILED) {
  28735. peg$savedPos = s2;
  28736. s3 = peg$c75(s4, s6);
  28737. s2 = s3;
  28738. } else {
  28739. peg$currPos = s2;
  28740. s2 = peg$FAILED;
  28741. }
  28742. } else {
  28743. peg$currPos = s2;
  28744. s2 = peg$FAILED;
  28745. }
  28746. } else {
  28747. peg$currPos = s2;
  28748. s2 = peg$FAILED;
  28749. }
  28750. } else {
  28751. peg$currPos = s2;
  28752. s2 = peg$FAILED;
  28753. }
  28754. if (s2 !== peg$FAILED) {
  28755. while (s2 !== peg$FAILED) {
  28756. s1.push(s2);
  28757. s2 = peg$currPos;
  28758. s3 = peg$parsews();
  28759. if (s3 !== peg$FAILED) {
  28760. s4 = peg$parsekeyword();
  28761. if (s4 !== peg$FAILED) {
  28762. s5 = peg$parsews();
  28763. if (s5 !== peg$FAILED) {
  28764. s6 = peg$parseidentifier();
  28765. if (s6 !== peg$FAILED) {
  28766. peg$savedPos = s2;
  28767. s3 = peg$c75(s4, s6);
  28768. s2 = s3;
  28769. } else {
  28770. peg$currPos = s2;
  28771. s2 = peg$FAILED;
  28772. }
  28773. } else {
  28774. peg$currPos = s2;
  28775. s2 = peg$FAILED;
  28776. }
  28777. } else {
  28778. peg$currPos = s2;
  28779. s2 = peg$FAILED;
  28780. }
  28781. } else {
  28782. peg$currPos = s2;
  28783. s2 = peg$FAILED;
  28784. }
  28785. }
  28786. } else {
  28787. s1 = peg$FAILED;
  28788. }
  28789. if (s1 !== peg$FAILED) {
  28790. peg$savedPos = s0;
  28791. s1 = peg$c76(s1);
  28792. }
  28793. s0 = s1;
  28794. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28795. return s0;
  28796. }
  28797. function peg$parsewsBinaryPattern() {
  28798. var s0, s1, s2, s3, s4;
  28799. var key = peg$currPos * 66 + 33,
  28800. cached = peg$resultsCache[key];
  28801. if (cached) {
  28802. peg$currPos = cached.nextPos;
  28803. return cached.result;
  28804. }
  28805. s0 = peg$currPos;
  28806. s1 = peg$parsews();
  28807. if (s1 !== peg$FAILED) {
  28808. s2 = peg$parsebinarySelector();
  28809. if (s2 !== peg$FAILED) {
  28810. s3 = peg$parsews();
  28811. if (s3 !== peg$FAILED) {
  28812. s4 = peg$parseidentifier();
  28813. if (s4 !== peg$FAILED) {
  28814. peg$savedPos = s0;
  28815. s1 = peg$c77(s2, s4);
  28816. s0 = s1;
  28817. } else {
  28818. peg$currPos = s0;
  28819. s0 = peg$FAILED;
  28820. }
  28821. } else {
  28822. peg$currPos = s0;
  28823. s0 = peg$FAILED;
  28824. }
  28825. } else {
  28826. peg$currPos = s0;
  28827. s0 = peg$FAILED;
  28828. }
  28829. } else {
  28830. peg$currPos = s0;
  28831. s0 = peg$FAILED;
  28832. }
  28833. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28834. return s0;
  28835. }
  28836. function peg$parsewsUnaryPattern() {
  28837. var s0, s1, s2;
  28838. var key = peg$currPos * 66 + 34,
  28839. cached = peg$resultsCache[key];
  28840. if (cached) {
  28841. peg$currPos = cached.nextPos;
  28842. return cached.result;
  28843. }
  28844. s0 = peg$currPos;
  28845. s1 = peg$parsews();
  28846. if (s1 !== peg$FAILED) {
  28847. s2 = peg$parseidentifier();
  28848. if (s2 !== peg$FAILED) {
  28849. peg$savedPos = s0;
  28850. s1 = peg$c78(s2);
  28851. s0 = s1;
  28852. } else {
  28853. peg$currPos = s0;
  28854. s0 = peg$FAILED;
  28855. }
  28856. } else {
  28857. peg$currPos = s0;
  28858. s0 = peg$FAILED;
  28859. }
  28860. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28861. return s0;
  28862. }
  28863. function peg$parseexpression() {
  28864. var s0;
  28865. var key = peg$currPos * 66 + 35,
  28866. cached = peg$resultsCache[key];
  28867. if (cached) {
  28868. peg$currPos = cached.nextPos;
  28869. return cached.result;
  28870. }
  28871. s0 = peg$parseassignment();
  28872. if (s0 === peg$FAILED) {
  28873. s0 = peg$parsecascade();
  28874. if (s0 === peg$FAILED) {
  28875. s0 = peg$parsekeywordSend();
  28876. }
  28877. }
  28878. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28879. return s0;
  28880. }
  28881. function peg$parsewsExpressionsRest() {
  28882. var s0, s1, s2;
  28883. var key = peg$currPos * 66 + 36,
  28884. cached = peg$resultsCache[key];
  28885. if (cached) {
  28886. peg$currPos = cached.nextPos;
  28887. return cached.result;
  28888. }
  28889. s0 = peg$currPos;
  28890. s1 = peg$parsesomeDotsWs();
  28891. if (s1 !== peg$FAILED) {
  28892. s2 = peg$parseexpression();
  28893. if (s2 !== peg$FAILED) {
  28894. peg$savedPos = s0;
  28895. s1 = peg$c79(s2);
  28896. s0 = s1;
  28897. } else {
  28898. peg$currPos = s0;
  28899. s0 = peg$FAILED;
  28900. }
  28901. } else {
  28902. peg$currPos = s0;
  28903. s0 = peg$FAILED;
  28904. }
  28905. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28906. return s0;
  28907. }
  28908. function peg$parsewsExpressions() {
  28909. var s0, s1, s2, s3, s4;
  28910. var key = peg$currPos * 66 + 37,
  28911. cached = peg$resultsCache[key];
  28912. if (cached) {
  28913. peg$currPos = cached.nextPos;
  28914. return cached.result;
  28915. }
  28916. s0 = peg$currPos;
  28917. s1 = peg$parsemaybeDotsWs();
  28918. if (s1 !== peg$FAILED) {
  28919. s2 = peg$parseexpression();
  28920. if (s2 !== peg$FAILED) {
  28921. s3 = [];
  28922. s4 = peg$parsewsExpressionsRest();
  28923. while (s4 !== peg$FAILED) {
  28924. s3.push(s4);
  28925. s4 = peg$parsewsExpressionsRest();
  28926. }
  28927. if (s3 !== peg$FAILED) {
  28928. peg$savedPos = s0;
  28929. s1 = peg$c80(s2, s3);
  28930. s0 = s1;
  28931. } else {
  28932. peg$currPos = s0;
  28933. s0 = peg$FAILED;
  28934. }
  28935. } else {
  28936. peg$currPos = s0;
  28937. s0 = peg$FAILED;
  28938. }
  28939. } else {
  28940. peg$currPos = s0;
  28941. s0 = peg$FAILED;
  28942. }
  28943. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28944. return s0;
  28945. }
  28946. function peg$parsewsUnaryPragmaMessage() {
  28947. var s0, s1, s2, s3, s4;
  28948. var key = peg$currPos * 66 + 38,
  28949. cached = peg$resultsCache[key];
  28950. if (cached) {
  28951. peg$currPos = cached.nextPos;
  28952. return cached.result;
  28953. }
  28954. s0 = peg$currPos;
  28955. s1 = peg$parsews();
  28956. if (s1 !== peg$FAILED) {
  28957. s2 = peg$parseidentifier();
  28958. if (s2 !== peg$FAILED) {
  28959. s3 = peg$currPos;
  28960. peg$silentFails++;
  28961. if (input.charCodeAt(peg$currPos) === 58) {
  28962. s4 = peg$c12;
  28963. peg$currPos++;
  28964. } else {
  28965. s4 = peg$FAILED;
  28966. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28967. }
  28968. peg$silentFails--;
  28969. if (s4 === peg$FAILED) {
  28970. s3 = void 0;
  28971. } else {
  28972. peg$currPos = s3;
  28973. s3 = peg$FAILED;
  28974. }
  28975. if (s3 !== peg$FAILED) {
  28976. peg$savedPos = s0;
  28977. s1 = peg$c81(s2);
  28978. s0 = s1;
  28979. } else {
  28980. peg$currPos = s0;
  28981. s0 = peg$FAILED;
  28982. }
  28983. } else {
  28984. peg$currPos = s0;
  28985. s0 = peg$FAILED;
  28986. }
  28987. } else {
  28988. peg$currPos = s0;
  28989. s0 = peg$FAILED;
  28990. }
  28991. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28992. return s0;
  28993. }
  28994. function peg$parsewsKeywordPragmaMessage() {
  28995. var s0, s1, s2, s3, s4, s5, s6;
  28996. var key = peg$currPos * 66 + 39,
  28997. cached = peg$resultsCache[key];
  28998. if (cached) {
  28999. peg$currPos = cached.nextPos;
  29000. return cached.result;
  29001. }
  29002. s0 = peg$currPos;
  29003. s1 = [];
  29004. s2 = peg$currPos;
  29005. s3 = peg$parsews();
  29006. if (s3 !== peg$FAILED) {
  29007. s4 = peg$parsekeyword();
  29008. if (s4 !== peg$FAILED) {
  29009. s5 = peg$parsews();
  29010. if (s5 !== peg$FAILED) {
  29011. s6 = peg$parseparseTimeLiteral();
  29012. if (s6 !== peg$FAILED) {
  29013. peg$savedPos = s2;
  29014. s3 = peg$c75(s4, s6);
  29015. s2 = s3;
  29016. } else {
  29017. peg$currPos = s2;
  29018. s2 = peg$FAILED;
  29019. }
  29020. } else {
  29021. peg$currPos = s2;
  29022. s2 = peg$FAILED;
  29023. }
  29024. } else {
  29025. peg$currPos = s2;
  29026. s2 = peg$FAILED;
  29027. }
  29028. } else {
  29029. peg$currPos = s2;
  29030. s2 = peg$FAILED;
  29031. }
  29032. if (s2 !== peg$FAILED) {
  29033. while (s2 !== peg$FAILED) {
  29034. s1.push(s2);
  29035. s2 = peg$currPos;
  29036. s3 = peg$parsews();
  29037. if (s3 !== peg$FAILED) {
  29038. s4 = peg$parsekeyword();
  29039. if (s4 !== peg$FAILED) {
  29040. s5 = peg$parsews();
  29041. if (s5 !== peg$FAILED) {
  29042. s6 = peg$parseparseTimeLiteral();
  29043. if (s6 !== peg$FAILED) {
  29044. peg$savedPos = s2;
  29045. s3 = peg$c75(s4, s6);
  29046. s2 = s3;
  29047. } else {
  29048. peg$currPos = s2;
  29049. s2 = peg$FAILED;
  29050. }
  29051. } else {
  29052. peg$currPos = s2;
  29053. s2 = peg$FAILED;
  29054. }
  29055. } else {
  29056. peg$currPos = s2;
  29057. s2 = peg$FAILED;
  29058. }
  29059. } else {
  29060. peg$currPos = s2;
  29061. s2 = peg$FAILED;
  29062. }
  29063. }
  29064. } else {
  29065. s1 = peg$FAILED;
  29066. }
  29067. if (s1 !== peg$FAILED) {
  29068. peg$savedPos = s0;
  29069. s1 = peg$c82(s1);
  29070. }
  29071. s0 = s1;
  29072. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29073. return s0;
  29074. }
  29075. function peg$parsewsPragmaMessage() {
  29076. var s0;
  29077. var key = peg$currPos * 66 + 40,
  29078. cached = peg$resultsCache[key];
  29079. if (cached) {
  29080. peg$currPos = cached.nextPos;
  29081. return cached.result;
  29082. }
  29083. s0 = peg$parsewsUnaryPragmaMessage();
  29084. if (s0 === peg$FAILED) {
  29085. s0 = peg$parsewsKeywordPragmaMessage();
  29086. }
  29087. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29088. return s0;
  29089. }
  29090. function peg$parsewsPragmas() {
  29091. var s0, s1, s2, s3, s4, s5, s6;
  29092. var key = peg$currPos * 66 + 41,
  29093. cached = peg$resultsCache[key];
  29094. if (cached) {
  29095. peg$currPos = cached.nextPos;
  29096. return cached.result;
  29097. }
  29098. s0 = [];
  29099. s1 = peg$currPos;
  29100. s2 = peg$parsews();
  29101. if (s2 !== peg$FAILED) {
  29102. if (input.charCodeAt(peg$currPos) === 60) {
  29103. s3 = peg$c83;
  29104. peg$currPos++;
  29105. } else {
  29106. s3 = peg$FAILED;
  29107. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29108. }
  29109. if (s3 !== peg$FAILED) {
  29110. s4 = peg$parsewsPragmaMessage();
  29111. if (s4 !== peg$FAILED) {
  29112. s5 = peg$parsews();
  29113. if (s5 !== peg$FAILED) {
  29114. if (input.charCodeAt(peg$currPos) === 62) {
  29115. s6 = peg$c85;
  29116. peg$currPos++;
  29117. } else {
  29118. s6 = peg$FAILED;
  29119. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29120. }
  29121. if (s6 !== peg$FAILED) {
  29122. peg$savedPos = s1;
  29123. s2 = peg$c87(s4);
  29124. s1 = s2;
  29125. } else {
  29126. peg$currPos = s1;
  29127. s1 = peg$FAILED;
  29128. }
  29129. } else {
  29130. peg$currPos = s1;
  29131. s1 = peg$FAILED;
  29132. }
  29133. } else {
  29134. peg$currPos = s1;
  29135. s1 = peg$FAILED;
  29136. }
  29137. } else {
  29138. peg$currPos = s1;
  29139. s1 = peg$FAILED;
  29140. }
  29141. } else {
  29142. peg$currPos = s1;
  29143. s1 = peg$FAILED;
  29144. }
  29145. while (s1 !== peg$FAILED) {
  29146. s0.push(s1);
  29147. s1 = peg$currPos;
  29148. s2 = peg$parsews();
  29149. if (s2 !== peg$FAILED) {
  29150. if (input.charCodeAt(peg$currPos) === 60) {
  29151. s3 = peg$c83;
  29152. peg$currPos++;
  29153. } else {
  29154. s3 = peg$FAILED;
  29155. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29156. }
  29157. if (s3 !== peg$FAILED) {
  29158. s4 = peg$parsewsPragmaMessage();
  29159. if (s4 !== peg$FAILED) {
  29160. s5 = peg$parsews();
  29161. if (s5 !== peg$FAILED) {
  29162. if (input.charCodeAt(peg$currPos) === 62) {
  29163. s6 = peg$c85;
  29164. peg$currPos++;
  29165. } else {
  29166. s6 = peg$FAILED;
  29167. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29168. }
  29169. if (s6 !== peg$FAILED) {
  29170. peg$savedPos = s1;
  29171. s2 = peg$c87(s4);
  29172. s1 = s2;
  29173. } else {
  29174. peg$currPos = s1;
  29175. s1 = peg$FAILED;
  29176. }
  29177. } else {
  29178. peg$currPos = s1;
  29179. s1 = peg$FAILED;
  29180. }
  29181. } else {
  29182. peg$currPos = s1;
  29183. s1 = peg$FAILED;
  29184. }
  29185. } else {
  29186. peg$currPos = s1;
  29187. s1 = peg$FAILED;
  29188. }
  29189. } else {
  29190. peg$currPos = s1;
  29191. s1 = peg$FAILED;
  29192. }
  29193. }
  29194. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29195. return s0;
  29196. }
  29197. function peg$parseassignment() {
  29198. var s0, s1, s2, s3, s4, s5;
  29199. var key = peg$currPos * 66 + 42,
  29200. cached = peg$resultsCache[key];
  29201. if (cached) {
  29202. peg$currPos = cached.nextPos;
  29203. return cached.result;
  29204. }
  29205. s0 = peg$currPos;
  29206. s1 = peg$parsevariable();
  29207. if (s1 !== peg$FAILED) {
  29208. s2 = peg$parsews();
  29209. if (s2 !== peg$FAILED) {
  29210. if (input.substr(peg$currPos, 2) === peg$c88) {
  29211. s3 = peg$c88;
  29212. peg$currPos += 2;
  29213. } else {
  29214. s3 = peg$FAILED;
  29215. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29216. }
  29217. if (s3 !== peg$FAILED) {
  29218. s4 = peg$parsews();
  29219. if (s4 !== peg$FAILED) {
  29220. s5 = peg$parseexpression();
  29221. if (s5 !== peg$FAILED) {
  29222. peg$savedPos = s0;
  29223. s1 = peg$c90(s1, s5);
  29224. s0 = s1;
  29225. } else {
  29226. peg$currPos = s0;
  29227. s0 = peg$FAILED;
  29228. }
  29229. } else {
  29230. peg$currPos = s0;
  29231. s0 = peg$FAILED;
  29232. }
  29233. } else {
  29234. peg$currPos = s0;
  29235. s0 = peg$FAILED;
  29236. }
  29237. } else {
  29238. peg$currPos = s0;
  29239. s0 = peg$FAILED;
  29240. }
  29241. } else {
  29242. peg$currPos = s0;
  29243. s0 = peg$FAILED;
  29244. }
  29245. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29246. return s0;
  29247. }
  29248. function peg$parseret() {
  29249. var s0, s1, s2, s3;
  29250. var key = peg$currPos * 66 + 43,
  29251. cached = peg$resultsCache[key];
  29252. if (cached) {
  29253. peg$currPos = cached.nextPos;
  29254. return cached.result;
  29255. }
  29256. s0 = peg$currPos;
  29257. if (input.charCodeAt(peg$currPos) === 94) {
  29258. s1 = peg$c91;
  29259. peg$currPos++;
  29260. } else {
  29261. s1 = peg$FAILED;
  29262. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29263. }
  29264. if (s1 !== peg$FAILED) {
  29265. s2 = peg$parsews();
  29266. if (s2 !== peg$FAILED) {
  29267. s3 = peg$parseexpression();
  29268. if (s3 !== peg$FAILED) {
  29269. peg$savedPos = s0;
  29270. s1 = peg$c93(s3);
  29271. s0 = s1;
  29272. } else {
  29273. peg$currPos = s0;
  29274. s0 = peg$FAILED;
  29275. }
  29276. } else {
  29277. peg$currPos = s0;
  29278. s0 = peg$FAILED;
  29279. }
  29280. } else {
  29281. peg$currPos = s0;
  29282. s0 = peg$FAILED;
  29283. }
  29284. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29285. return s0;
  29286. }
  29287. function peg$parsetemps() {
  29288. var s0, s1, s2, s3, s4, s5;
  29289. var key = peg$currPos * 66 + 44,
  29290. cached = peg$resultsCache[key];
  29291. if (cached) {
  29292. peg$currPos = cached.nextPos;
  29293. return cached.result;
  29294. }
  29295. s0 = peg$currPos;
  29296. if (input.charCodeAt(peg$currPos) === 124) {
  29297. s1 = peg$c94;
  29298. peg$currPos++;
  29299. } else {
  29300. s1 = peg$FAILED;
  29301. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29302. }
  29303. if (s1 !== peg$FAILED) {
  29304. s2 = [];
  29305. s3 = peg$currPos;
  29306. s4 = peg$parsews();
  29307. if (s4 !== peg$FAILED) {
  29308. s5 = peg$parseidentifier();
  29309. if (s5 !== peg$FAILED) {
  29310. peg$savedPos = s3;
  29311. s4 = peg$c96(s5);
  29312. s3 = s4;
  29313. } else {
  29314. peg$currPos = s3;
  29315. s3 = peg$FAILED;
  29316. }
  29317. } else {
  29318. peg$currPos = s3;
  29319. s3 = peg$FAILED;
  29320. }
  29321. while (s3 !== peg$FAILED) {
  29322. s2.push(s3);
  29323. s3 = peg$currPos;
  29324. s4 = peg$parsews();
  29325. if (s4 !== peg$FAILED) {
  29326. s5 = peg$parseidentifier();
  29327. if (s5 !== peg$FAILED) {
  29328. peg$savedPos = s3;
  29329. s4 = peg$c96(s5);
  29330. s3 = s4;
  29331. } else {
  29332. peg$currPos = s3;
  29333. s3 = peg$FAILED;
  29334. }
  29335. } else {
  29336. peg$currPos = s3;
  29337. s3 = peg$FAILED;
  29338. }
  29339. }
  29340. if (s2 !== peg$FAILED) {
  29341. s3 = peg$parsews();
  29342. if (s3 !== peg$FAILED) {
  29343. if (input.charCodeAt(peg$currPos) === 124) {
  29344. s4 = peg$c94;
  29345. peg$currPos++;
  29346. } else {
  29347. s4 = peg$FAILED;
  29348. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29349. }
  29350. if (s4 !== peg$FAILED) {
  29351. peg$savedPos = s0;
  29352. s1 = peg$c97(s2);
  29353. s0 = s1;
  29354. } else {
  29355. peg$currPos = s0;
  29356. s0 = peg$FAILED;
  29357. }
  29358. } else {
  29359. peg$currPos = s0;
  29360. s0 = peg$FAILED;
  29361. }
  29362. } else {
  29363. peg$currPos = s0;
  29364. s0 = peg$FAILED;
  29365. }
  29366. } else {
  29367. peg$currPos = s0;
  29368. s0 = peg$FAILED;
  29369. }
  29370. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29371. return s0;
  29372. }
  29373. function peg$parsewsBlockParamList() {
  29374. var s0, s1, s2, s3, s4, s5, s6;
  29375. var key = peg$currPos * 66 + 45,
  29376. cached = peg$resultsCache[key];
  29377. if (cached) {
  29378. peg$currPos = cached.nextPos;
  29379. return cached.result;
  29380. }
  29381. s0 = peg$currPos;
  29382. s1 = [];
  29383. s2 = peg$currPos;
  29384. s3 = peg$parsews();
  29385. if (s3 !== peg$FAILED) {
  29386. if (input.charCodeAt(peg$currPos) === 58) {
  29387. s4 = peg$c12;
  29388. peg$currPos++;
  29389. } else {
  29390. s4 = peg$FAILED;
  29391. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29392. }
  29393. if (s4 !== peg$FAILED) {
  29394. s5 = peg$parsews();
  29395. if (s5 !== peg$FAILED) {
  29396. s6 = peg$parseidentifier();
  29397. if (s6 !== peg$FAILED) {
  29398. peg$savedPos = s2;
  29399. s3 = peg$c98(s6);
  29400. s2 = s3;
  29401. } else {
  29402. peg$currPos = s2;
  29403. s2 = peg$FAILED;
  29404. }
  29405. } else {
  29406. peg$currPos = s2;
  29407. s2 = peg$FAILED;
  29408. }
  29409. } else {
  29410. peg$currPos = s2;
  29411. s2 = peg$FAILED;
  29412. }
  29413. } else {
  29414. peg$currPos = s2;
  29415. s2 = peg$FAILED;
  29416. }
  29417. if (s2 !== peg$FAILED) {
  29418. while (s2 !== peg$FAILED) {
  29419. s1.push(s2);
  29420. s2 = peg$currPos;
  29421. s3 = peg$parsews();
  29422. if (s3 !== peg$FAILED) {
  29423. if (input.charCodeAt(peg$currPos) === 58) {
  29424. s4 = peg$c12;
  29425. peg$currPos++;
  29426. } else {
  29427. s4 = peg$FAILED;
  29428. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29429. }
  29430. if (s4 !== peg$FAILED) {
  29431. s5 = peg$parsews();
  29432. if (s5 !== peg$FAILED) {
  29433. s6 = peg$parseidentifier();
  29434. if (s6 !== peg$FAILED) {
  29435. peg$savedPos = s2;
  29436. s3 = peg$c98(s6);
  29437. s2 = s3;
  29438. } else {
  29439. peg$currPos = s2;
  29440. s2 = peg$FAILED;
  29441. }
  29442. } else {
  29443. peg$currPos = s2;
  29444. s2 = peg$FAILED;
  29445. }
  29446. } else {
  29447. peg$currPos = s2;
  29448. s2 = peg$FAILED;
  29449. }
  29450. } else {
  29451. peg$currPos = s2;
  29452. s2 = peg$FAILED;
  29453. }
  29454. }
  29455. } else {
  29456. s1 = peg$FAILED;
  29457. }
  29458. if (s1 !== peg$FAILED) {
  29459. s2 = peg$parsews();
  29460. if (s2 !== peg$FAILED) {
  29461. if (input.charCodeAt(peg$currPos) === 124) {
  29462. s3 = peg$c94;
  29463. peg$currPos++;
  29464. } else {
  29465. s3 = peg$FAILED;
  29466. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29467. }
  29468. if (s3 !== peg$FAILED) {
  29469. peg$savedPos = s0;
  29470. s1 = peg$c99(s1);
  29471. s0 = s1;
  29472. } else {
  29473. peg$currPos = s0;
  29474. s0 = peg$FAILED;
  29475. }
  29476. } else {
  29477. peg$currPos = s0;
  29478. s0 = peg$FAILED;
  29479. }
  29480. } else {
  29481. peg$currPos = s0;
  29482. s0 = peg$FAILED;
  29483. }
  29484. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29485. return s0;
  29486. }
  29487. function peg$parsesubexpression() {
  29488. var s0, s1, s2, s3, s4, s5;
  29489. var key = peg$currPos * 66 + 46,
  29490. cached = peg$resultsCache[key];
  29491. if (cached) {
  29492. peg$currPos = cached.nextPos;
  29493. return cached.result;
  29494. }
  29495. s0 = peg$currPos;
  29496. if (input.charCodeAt(peg$currPos) === 40) {
  29497. s1 = peg$c51;
  29498. peg$currPos++;
  29499. } else {
  29500. s1 = peg$FAILED;
  29501. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29502. }
  29503. if (s1 !== peg$FAILED) {
  29504. s2 = peg$parsews();
  29505. if (s2 !== peg$FAILED) {
  29506. s3 = peg$parseexpression();
  29507. if (s3 !== peg$FAILED) {
  29508. s4 = peg$parsews();
  29509. if (s4 !== peg$FAILED) {
  29510. if (input.charCodeAt(peg$currPos) === 41) {
  29511. s5 = peg$c48;
  29512. peg$currPos++;
  29513. } else {
  29514. s5 = peg$FAILED;
  29515. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29516. }
  29517. if (s5 !== peg$FAILED) {
  29518. peg$savedPos = s0;
  29519. s1 = peg$c79(s3);
  29520. s0 = s1;
  29521. } else {
  29522. peg$currPos = s0;
  29523. s0 = peg$FAILED;
  29524. }
  29525. } else {
  29526. peg$currPos = s0;
  29527. s0 = peg$FAILED;
  29528. }
  29529. } else {
  29530. peg$currPos = s0;
  29531. s0 = peg$FAILED;
  29532. }
  29533. } else {
  29534. peg$currPos = s0;
  29535. s0 = peg$FAILED;
  29536. }
  29537. } else {
  29538. peg$currPos = s0;
  29539. s0 = peg$FAILED;
  29540. }
  29541. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29542. return s0;
  29543. }
  29544. function peg$parsewsStatements() {
  29545. var s0, s1, s2, s3;
  29546. var key = peg$currPos * 66 + 47,
  29547. cached = peg$resultsCache[key];
  29548. if (cached) {
  29549. peg$currPos = cached.nextPos;
  29550. return cached.result;
  29551. }
  29552. s0 = peg$currPos;
  29553. s1 = peg$parsemaybeDotsWs();
  29554. if (s1 !== peg$FAILED) {
  29555. s2 = peg$parseret();
  29556. if (s2 !== peg$FAILED) {
  29557. peg$savedPos = s0;
  29558. s1 = peg$c100(s2);
  29559. s0 = s1;
  29560. } else {
  29561. peg$currPos = s0;
  29562. s0 = peg$FAILED;
  29563. }
  29564. } else {
  29565. peg$currPos = s0;
  29566. s0 = peg$FAILED;
  29567. }
  29568. if (s0 === peg$FAILED) {
  29569. s0 = peg$currPos;
  29570. s1 = peg$parsewsExpressions();
  29571. if (s1 !== peg$FAILED) {
  29572. s2 = peg$parsesomeDotsWs();
  29573. if (s2 !== peg$FAILED) {
  29574. s3 = peg$parseret();
  29575. if (s3 !== peg$FAILED) {
  29576. peg$savedPos = s0;
  29577. s1 = peg$c101(s1, s3);
  29578. s0 = s1;
  29579. } else {
  29580. peg$currPos = s0;
  29581. s0 = peg$FAILED;
  29582. }
  29583. } else {
  29584. peg$currPos = s0;
  29585. s0 = peg$FAILED;
  29586. }
  29587. } else {
  29588. peg$currPos = s0;
  29589. s0 = peg$FAILED;
  29590. }
  29591. if (s0 === peg$FAILED) {
  29592. s0 = peg$currPos;
  29593. s1 = peg$parsewsExpressions();
  29594. if (s1 === peg$FAILED) {
  29595. s1 = null;
  29596. }
  29597. if (s1 !== peg$FAILED) {
  29598. peg$savedPos = s0;
  29599. s1 = peg$c102(s1);
  29600. }
  29601. s0 = s1;
  29602. }
  29603. }
  29604. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29605. return s0;
  29606. }
  29607. function peg$parsewsSequenceWs() {
  29608. var s0, s1, s2, s3, s4, s5, s6;
  29609. var key = peg$currPos * 66 + 48,
  29610. cached = peg$resultsCache[key];
  29611. if (cached) {
  29612. peg$currPos = cached.nextPos;
  29613. return cached.result;
  29614. }
  29615. s0 = peg$currPos;
  29616. s1 = peg$parsewsPragmas();
  29617. if (s1 === peg$FAILED) {
  29618. s1 = null;
  29619. }
  29620. if (s1 !== peg$FAILED) {
  29621. s2 = peg$parsews();
  29622. if (s2 !== peg$FAILED) {
  29623. s3 = peg$parsetemps();
  29624. if (s3 === peg$FAILED) {
  29625. s3 = null;
  29626. }
  29627. if (s3 !== peg$FAILED) {
  29628. s4 = peg$parsewsPragmas();
  29629. if (s4 === peg$FAILED) {
  29630. s4 = null;
  29631. }
  29632. if (s4 !== peg$FAILED) {
  29633. s5 = peg$parsewsStatements();
  29634. if (s5 === peg$FAILED) {
  29635. s5 = null;
  29636. }
  29637. if (s5 !== peg$FAILED) {
  29638. s6 = peg$parsemaybeDotsWs();
  29639. if (s6 !== peg$FAILED) {
  29640. peg$savedPos = s0;
  29641. s1 = peg$c103(s1, s3, s4, s5);
  29642. s0 = s1;
  29643. } else {
  29644. peg$currPos = s0;
  29645. s0 = peg$FAILED;
  29646. }
  29647. } else {
  29648. peg$currPos = s0;
  29649. s0 = peg$FAILED;
  29650. }
  29651. } else {
  29652. peg$currPos = s0;
  29653. s0 = peg$FAILED;
  29654. }
  29655. } else {
  29656. peg$currPos = s0;
  29657. s0 = peg$FAILED;
  29658. }
  29659. } else {
  29660. peg$currPos = s0;
  29661. s0 = peg$FAILED;
  29662. }
  29663. } else {
  29664. peg$currPos = s0;
  29665. s0 = peg$FAILED;
  29666. }
  29667. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29668. return s0;
  29669. }
  29670. function peg$parseblock() {
  29671. var s0, s1, s2, s3, s4;
  29672. var key = peg$currPos * 66 + 49,
  29673. cached = peg$resultsCache[key];
  29674. if (cached) {
  29675. peg$currPos = cached.nextPos;
  29676. return cached.result;
  29677. }
  29678. s0 = peg$currPos;
  29679. if (input.charCodeAt(peg$currPos) === 91) {
  29680. s1 = peg$c104;
  29681. peg$currPos++;
  29682. } else {
  29683. s1 = peg$FAILED;
  29684. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29685. }
  29686. if (s1 !== peg$FAILED) {
  29687. s2 = peg$parsewsBlockParamList();
  29688. if (s2 === peg$FAILED) {
  29689. s2 = null;
  29690. }
  29691. if (s2 !== peg$FAILED) {
  29692. s3 = peg$parsewsSequenceWs();
  29693. if (s3 !== peg$FAILED) {
  29694. if (input.charCodeAt(peg$currPos) === 93) {
  29695. s4 = peg$c106;
  29696. peg$currPos++;
  29697. } else {
  29698. s4 = peg$FAILED;
  29699. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29700. }
  29701. if (s4 !== peg$FAILED) {
  29702. peg$savedPos = s0;
  29703. s1 = peg$c108(s2, s3);
  29704. s0 = s1;
  29705. } else {
  29706. peg$currPos = s0;
  29707. s0 = peg$FAILED;
  29708. }
  29709. } else {
  29710. peg$currPos = s0;
  29711. s0 = peg$FAILED;
  29712. }
  29713. } else {
  29714. peg$currPos = s0;
  29715. s0 = peg$FAILED;
  29716. }
  29717. } else {
  29718. peg$currPos = s0;
  29719. s0 = peg$FAILED;
  29720. }
  29721. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29722. return s0;
  29723. }
  29724. function peg$parseoperand() {
  29725. var s0;
  29726. var key = peg$currPos * 66 + 50,
  29727. cached = peg$resultsCache[key];
  29728. if (cached) {
  29729. peg$currPos = cached.nextPos;
  29730. return cached.result;
  29731. }
  29732. s0 = peg$parseliteral();
  29733. if (s0 === peg$FAILED) {
  29734. s0 = peg$parsevariable();
  29735. if (s0 === peg$FAILED) {
  29736. s0 = peg$parsesubexpression();
  29737. }
  29738. }
  29739. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29740. return s0;
  29741. }
  29742. function peg$parsewsUnaryMessage() {
  29743. var s0, s1, s2, s3, s4;
  29744. var key = peg$currPos * 66 + 51,
  29745. cached = peg$resultsCache[key];
  29746. if (cached) {
  29747. peg$currPos = cached.nextPos;
  29748. return cached.result;
  29749. }
  29750. s0 = peg$currPos;
  29751. s1 = peg$parsews();
  29752. if (s1 !== peg$FAILED) {
  29753. s2 = peg$parseidentifier();
  29754. if (s2 !== peg$FAILED) {
  29755. s3 = peg$currPos;
  29756. peg$silentFails++;
  29757. if (input.charCodeAt(peg$currPos) === 58) {
  29758. s4 = peg$c12;
  29759. peg$currPos++;
  29760. } else {
  29761. s4 = peg$FAILED;
  29762. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29763. }
  29764. peg$silentFails--;
  29765. if (s4 === peg$FAILED) {
  29766. s3 = void 0;
  29767. } else {
  29768. peg$currPos = s3;
  29769. s3 = peg$FAILED;
  29770. }
  29771. if (s3 !== peg$FAILED) {
  29772. peg$savedPos = s0;
  29773. s1 = peg$c109(s2);
  29774. s0 = s1;
  29775. } else {
  29776. peg$currPos = s0;
  29777. s0 = peg$FAILED;
  29778. }
  29779. } else {
  29780. peg$currPos = s0;
  29781. s0 = peg$FAILED;
  29782. }
  29783. } else {
  29784. peg$currPos = s0;
  29785. s0 = peg$FAILED;
  29786. }
  29787. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29788. return s0;
  29789. }
  29790. function peg$parsewsUnaryTail() {
  29791. var s0, s1;
  29792. var key = peg$currPos * 66 + 52,
  29793. cached = peg$resultsCache[key];
  29794. if (cached) {
  29795. peg$currPos = cached.nextPos;
  29796. return cached.result;
  29797. }
  29798. s0 = [];
  29799. s1 = peg$parsewsUnaryMessage();
  29800. while (s1 !== peg$FAILED) {
  29801. s0.push(s1);
  29802. s1 = peg$parsewsUnaryMessage();
  29803. }
  29804. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29805. return s0;
  29806. }
  29807. function peg$parseunarySend() {
  29808. var s0, s1, s2;
  29809. var key = peg$currPos * 66 + 53,
  29810. cached = peg$resultsCache[key];
  29811. if (cached) {
  29812. peg$currPos = cached.nextPos;
  29813. return cached.result;
  29814. }
  29815. s0 = peg$currPos;
  29816. s1 = peg$parseoperand();
  29817. if (s1 !== peg$FAILED) {
  29818. s2 = peg$parsewsUnaryTail();
  29819. if (s2 !== peg$FAILED) {
  29820. peg$savedPos = s0;
  29821. s1 = peg$c110(s1, s2);
  29822. s0 = s1;
  29823. } else {
  29824. peg$currPos = s0;
  29825. s0 = peg$FAILED;
  29826. }
  29827. } else {
  29828. peg$currPos = s0;
  29829. s0 = peg$FAILED;
  29830. }
  29831. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29832. return s0;
  29833. }
  29834. function peg$parsewsBinaryMessage() {
  29835. var s0, s1, s2, s3, s4;
  29836. var key = peg$currPos * 66 + 54,
  29837. cached = peg$resultsCache[key];
  29838. if (cached) {
  29839. peg$currPos = cached.nextPos;
  29840. return cached.result;
  29841. }
  29842. s0 = peg$currPos;
  29843. s1 = peg$parsews();
  29844. if (s1 !== peg$FAILED) {
  29845. s2 = peg$parsebinarySelector();
  29846. if (s2 !== peg$FAILED) {
  29847. s3 = peg$parsews();
  29848. if (s3 !== peg$FAILED) {
  29849. s4 = peg$parseunarySend();
  29850. if (s4 !== peg$FAILED) {
  29851. peg$savedPos = s0;
  29852. s1 = peg$c111(s2, s4);
  29853. s0 = s1;
  29854. } else {
  29855. peg$currPos = s0;
  29856. s0 = peg$FAILED;
  29857. }
  29858. } else {
  29859. peg$currPos = s0;
  29860. s0 = peg$FAILED;
  29861. }
  29862. } else {
  29863. peg$currPos = s0;
  29864. s0 = peg$FAILED;
  29865. }
  29866. } else {
  29867. peg$currPos = s0;
  29868. s0 = peg$FAILED;
  29869. }
  29870. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29871. return s0;
  29872. }
  29873. function peg$parsewsBinaryTail() {
  29874. var s0, s1, s2, s3;
  29875. var key = peg$currPos * 66 + 55,
  29876. cached = peg$resultsCache[key];
  29877. if (cached) {
  29878. peg$currPos = cached.nextPos;
  29879. return cached.result;
  29880. }
  29881. s0 = peg$currPos;
  29882. s1 = peg$parsewsUnaryTail();
  29883. if (s1 !== peg$FAILED) {
  29884. s2 = [];
  29885. s3 = peg$parsewsBinaryMessage();
  29886. while (s3 !== peg$FAILED) {
  29887. s2.push(s3);
  29888. s3 = peg$parsewsBinaryMessage();
  29889. }
  29890. if (s2 !== peg$FAILED) {
  29891. peg$savedPos = s0;
  29892. s1 = peg$c112(s1, s2);
  29893. s0 = s1;
  29894. } else {
  29895. peg$currPos = s0;
  29896. s0 = peg$FAILED;
  29897. }
  29898. } else {
  29899. peg$currPos = s0;
  29900. s0 = peg$FAILED;
  29901. }
  29902. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29903. return s0;
  29904. }
  29905. function peg$parsebinarySend() {
  29906. var s0, s1, s2;
  29907. var key = peg$currPos * 66 + 56,
  29908. cached = peg$resultsCache[key];
  29909. if (cached) {
  29910. peg$currPos = cached.nextPos;
  29911. return cached.result;
  29912. }
  29913. s0 = peg$currPos;
  29914. s1 = peg$parseoperand();
  29915. if (s1 !== peg$FAILED) {
  29916. s2 = peg$parsewsBinaryTail();
  29917. if (s2 !== peg$FAILED) {
  29918. peg$savedPos = s0;
  29919. s1 = peg$c110(s1, s2);
  29920. s0 = s1;
  29921. } else {
  29922. peg$currPos = s0;
  29923. s0 = peg$FAILED;
  29924. }
  29925. } else {
  29926. peg$currPos = s0;
  29927. s0 = peg$FAILED;
  29928. }
  29929. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29930. return s0;
  29931. }
  29932. function peg$parsewsKeywordMessage() {
  29933. var s0, s1, s2, s3, s4, s5, s6;
  29934. var key = peg$currPos * 66 + 57,
  29935. cached = peg$resultsCache[key];
  29936. if (cached) {
  29937. peg$currPos = cached.nextPos;
  29938. return cached.result;
  29939. }
  29940. s0 = peg$currPos;
  29941. s1 = [];
  29942. s2 = peg$currPos;
  29943. s3 = peg$parsews();
  29944. if (s3 !== peg$FAILED) {
  29945. s4 = peg$parsekeyword();
  29946. if (s4 !== peg$FAILED) {
  29947. s5 = peg$parsews();
  29948. if (s5 !== peg$FAILED) {
  29949. s6 = peg$parsebinarySend();
  29950. if (s6 !== peg$FAILED) {
  29951. peg$savedPos = s2;
  29952. s3 = peg$c75(s4, s6);
  29953. s2 = s3;
  29954. } else {
  29955. peg$currPos = s2;
  29956. s2 = peg$FAILED;
  29957. }
  29958. } else {
  29959. peg$currPos = s2;
  29960. s2 = peg$FAILED;
  29961. }
  29962. } else {
  29963. peg$currPos = s2;
  29964. s2 = peg$FAILED;
  29965. }
  29966. } else {
  29967. peg$currPos = s2;
  29968. s2 = peg$FAILED;
  29969. }
  29970. if (s2 !== peg$FAILED) {
  29971. while (s2 !== peg$FAILED) {
  29972. s1.push(s2);
  29973. s2 = peg$currPos;
  29974. s3 = peg$parsews();
  29975. if (s3 !== peg$FAILED) {
  29976. s4 = peg$parsekeyword();
  29977. if (s4 !== peg$FAILED) {
  29978. s5 = peg$parsews();
  29979. if (s5 !== peg$FAILED) {
  29980. s6 = peg$parsebinarySend();
  29981. if (s6 !== peg$FAILED) {
  29982. peg$savedPos = s2;
  29983. s3 = peg$c75(s4, s6);
  29984. s2 = s3;
  29985. } else {
  29986. peg$currPos = s2;
  29987. s2 = peg$FAILED;
  29988. }
  29989. } else {
  29990. peg$currPos = s2;
  29991. s2 = peg$FAILED;
  29992. }
  29993. } else {
  29994. peg$currPos = s2;
  29995. s2 = peg$FAILED;
  29996. }
  29997. } else {
  29998. peg$currPos = s2;
  29999. s2 = peg$FAILED;
  30000. }
  30001. }
  30002. } else {
  30003. s1 = peg$FAILED;
  30004. }
  30005. if (s1 !== peg$FAILED) {
  30006. peg$savedPos = s0;
  30007. s1 = peg$c113(s1);
  30008. }
  30009. s0 = s1;
  30010. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30011. return s0;
  30012. }
  30013. function peg$parsewsKeywordTail() {
  30014. var s0, s1, s2;
  30015. var key = peg$currPos * 66 + 58,
  30016. cached = peg$resultsCache[key];
  30017. if (cached) {
  30018. peg$currPos = cached.nextPos;
  30019. return cached.result;
  30020. }
  30021. s0 = peg$currPos;
  30022. s1 = peg$parsewsBinaryTail();
  30023. if (s1 !== peg$FAILED) {
  30024. s2 = peg$parsewsKeywordMessage();
  30025. if (s2 === peg$FAILED) {
  30026. s2 = null;
  30027. }
  30028. if (s2 !== peg$FAILED) {
  30029. peg$savedPos = s0;
  30030. s1 = peg$c114(s1, s2);
  30031. s0 = s1;
  30032. } else {
  30033. peg$currPos = s0;
  30034. s0 = peg$FAILED;
  30035. }
  30036. } else {
  30037. peg$currPos = s0;
  30038. s0 = peg$FAILED;
  30039. }
  30040. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30041. return s0;
  30042. }
  30043. function peg$parsekeywordSend() {
  30044. var s0, s1, s2;
  30045. var key = peg$currPos * 66 + 59,
  30046. cached = peg$resultsCache[key];
  30047. if (cached) {
  30048. peg$currPos = cached.nextPos;
  30049. return cached.result;
  30050. }
  30051. s0 = peg$currPos;
  30052. s1 = peg$parseoperand();
  30053. if (s1 !== peg$FAILED) {
  30054. s2 = peg$parsewsKeywordTail();
  30055. if (s2 !== peg$FAILED) {
  30056. peg$savedPos = s0;
  30057. s1 = peg$c110(s1, s2);
  30058. s0 = s1;
  30059. } else {
  30060. peg$currPos = s0;
  30061. s0 = peg$FAILED;
  30062. }
  30063. } else {
  30064. peg$currPos = s0;
  30065. s0 = peg$FAILED;
  30066. }
  30067. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30068. return s0;
  30069. }
  30070. function peg$parsewsMessage() {
  30071. var s0;
  30072. var key = peg$currPos * 66 + 60,
  30073. cached = peg$resultsCache[key];
  30074. if (cached) {
  30075. peg$currPos = cached.nextPos;
  30076. return cached.result;
  30077. }
  30078. s0 = peg$parsewsBinaryMessage();
  30079. if (s0 === peg$FAILED) {
  30080. s0 = peg$parsewsUnaryMessage();
  30081. if (s0 === peg$FAILED) {
  30082. s0 = peg$parsewsKeywordMessage();
  30083. }
  30084. }
  30085. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30086. return s0;
  30087. }
  30088. function peg$parsecascade() {
  30089. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  30090. var key = peg$currPos * 66 + 61,
  30091. cached = peg$resultsCache[key];
  30092. if (cached) {
  30093. peg$currPos = cached.nextPos;
  30094. return cached.result;
  30095. }
  30096. s0 = peg$currPos;
  30097. s1 = peg$parseoperand();
  30098. if (s1 !== peg$FAILED) {
  30099. s2 = peg$parsewsKeywordTail();
  30100. if (s2 !== peg$FAILED) {
  30101. peg$savedPos = peg$currPos;
  30102. s3 = peg$c115(s1, s2);
  30103. if (s3) {
  30104. s3 = void 0;
  30105. } else {
  30106. s3 = peg$FAILED;
  30107. }
  30108. if (s3 !== peg$FAILED) {
  30109. s4 = [];
  30110. s5 = peg$currPos;
  30111. s6 = peg$parsews();
  30112. if (s6 !== peg$FAILED) {
  30113. if (input.charCodeAt(peg$currPos) === 59) {
  30114. s7 = peg$c116;
  30115. peg$currPos++;
  30116. } else {
  30117. s7 = peg$FAILED;
  30118. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30119. }
  30120. if (s7 !== peg$FAILED) {
  30121. s8 = peg$parsewsMessage();
  30122. if (s8 !== peg$FAILED) {
  30123. peg$savedPos = s5;
  30124. s6 = peg$c118(s1, s2, s8);
  30125. s5 = s6;
  30126. } else {
  30127. peg$currPos = s5;
  30128. s5 = peg$FAILED;
  30129. }
  30130. } else {
  30131. peg$currPos = s5;
  30132. s5 = peg$FAILED;
  30133. }
  30134. } else {
  30135. peg$currPos = s5;
  30136. s5 = peg$FAILED;
  30137. }
  30138. if (s5 !== peg$FAILED) {
  30139. while (s5 !== peg$FAILED) {
  30140. s4.push(s5);
  30141. s5 = peg$currPos;
  30142. s6 = peg$parsews();
  30143. if (s6 !== peg$FAILED) {
  30144. if (input.charCodeAt(peg$currPos) === 59) {
  30145. s7 = peg$c116;
  30146. peg$currPos++;
  30147. } else {
  30148. s7 = peg$FAILED;
  30149. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30150. }
  30151. if (s7 !== peg$FAILED) {
  30152. s8 = peg$parsewsMessage();
  30153. if (s8 !== peg$FAILED) {
  30154. peg$savedPos = s5;
  30155. s6 = peg$c118(s1, s2, s8);
  30156. s5 = s6;
  30157. } else {
  30158. peg$currPos = s5;
  30159. s5 = peg$FAILED;
  30160. }
  30161. } else {
  30162. peg$currPos = s5;
  30163. s5 = peg$FAILED;
  30164. }
  30165. } else {
  30166. peg$currPos = s5;
  30167. s5 = peg$FAILED;
  30168. }
  30169. }
  30170. } else {
  30171. s4 = peg$FAILED;
  30172. }
  30173. if (s4 !== peg$FAILED) {
  30174. peg$savedPos = s0;
  30175. s1 = peg$c119(s1, s2, s4);
  30176. s0 = s1;
  30177. } else {
  30178. peg$currPos = s0;
  30179. s0 = peg$FAILED;
  30180. }
  30181. } else {
  30182. peg$currPos = s0;
  30183. s0 = peg$FAILED;
  30184. }
  30185. } else {
  30186. peg$currPos = s0;
  30187. s0 = peg$FAILED;
  30188. }
  30189. } else {
  30190. peg$currPos = s0;
  30191. s0 = peg$FAILED;
  30192. }
  30193. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30194. return s0;
  30195. }
  30196. function peg$parsemethod() {
  30197. var s0, s1, s2;
  30198. var key = peg$currPos * 66 + 62,
  30199. cached = peg$resultsCache[key];
  30200. if (cached) {
  30201. peg$currPos = cached.nextPos;
  30202. return cached.result;
  30203. }
  30204. s0 = peg$currPos;
  30205. s1 = peg$parsewsKeywordPattern();
  30206. if (s1 === peg$FAILED) {
  30207. s1 = peg$parsewsBinaryPattern();
  30208. if (s1 === peg$FAILED) {
  30209. s1 = peg$parsewsUnaryPattern();
  30210. }
  30211. }
  30212. if (s1 !== peg$FAILED) {
  30213. s2 = peg$parsewsSequenceWs();
  30214. if (s2 !== peg$FAILED) {
  30215. peg$savedPos = s0;
  30216. s1 = peg$c120(s1, s2);
  30217. s0 = s1;
  30218. } else {
  30219. peg$currPos = s0;
  30220. s0 = peg$FAILED;
  30221. }
  30222. } else {
  30223. peg$currPos = s0;
  30224. s0 = peg$FAILED;
  30225. }
  30226. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30227. return s0;
  30228. }
  30229. function peg$parseassociationSend() {
  30230. var s0, s1, s2, s3;
  30231. var key = peg$currPos * 66 + 63,
  30232. cached = peg$resultsCache[key];
  30233. if (cached) {
  30234. peg$currPos = cached.nextPos;
  30235. return cached.result;
  30236. }
  30237. s0 = peg$currPos;
  30238. s1 = peg$parseoperand();
  30239. if (s1 !== peg$FAILED) {
  30240. s2 = peg$parsewsBinaryTail();
  30241. if (s2 !== peg$FAILED) {
  30242. peg$savedPos = peg$currPos;
  30243. s3 = peg$c121(s1, s2);
  30244. if (s3) {
  30245. s3 = void 0;
  30246. } else {
  30247. s3 = peg$FAILED;
  30248. }
  30249. if (s3 !== peg$FAILED) {
  30250. peg$savedPos = s0;
  30251. s1 = peg$c122(s1, s2);
  30252. s0 = s1;
  30253. } else {
  30254. peg$currPos = s0;
  30255. s0 = peg$FAILED;
  30256. }
  30257. } else {
  30258. peg$currPos = s0;
  30259. s0 = peg$FAILED;
  30260. }
  30261. } else {
  30262. peg$currPos = s0;
  30263. s0 = peg$FAILED;
  30264. }
  30265. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30266. return s0;
  30267. }
  30268. function peg$parsewsAssociationsRest() {
  30269. var s0, s1, s2;
  30270. var key = peg$currPos * 66 + 64,
  30271. cached = peg$resultsCache[key];
  30272. if (cached) {
  30273. peg$currPos = cached.nextPos;
  30274. return cached.result;
  30275. }
  30276. s0 = peg$currPos;
  30277. s1 = peg$parsesomeDotsWs();
  30278. if (s1 !== peg$FAILED) {
  30279. s2 = peg$parseassociationSend();
  30280. if (s2 !== peg$FAILED) {
  30281. peg$savedPos = s0;
  30282. s1 = peg$c79(s2);
  30283. s0 = s1;
  30284. } else {
  30285. peg$currPos = s0;
  30286. s0 = peg$FAILED;
  30287. }
  30288. } else {
  30289. peg$currPos = s0;
  30290. s0 = peg$FAILED;
  30291. }
  30292. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30293. return s0;
  30294. }
  30295. function peg$parsewsAssociations() {
  30296. var s0, s1, s2, s3, s4;
  30297. var key = peg$currPos * 66 + 65,
  30298. cached = peg$resultsCache[key];
  30299. if (cached) {
  30300. peg$currPos = cached.nextPos;
  30301. return cached.result;
  30302. }
  30303. s0 = peg$currPos;
  30304. s1 = peg$parsemaybeDotsWs();
  30305. if (s1 !== peg$FAILED) {
  30306. s2 = peg$parseassociationSend();
  30307. if (s2 !== peg$FAILED) {
  30308. s3 = [];
  30309. s4 = peg$parsewsAssociationsRest();
  30310. while (s4 !== peg$FAILED) {
  30311. s3.push(s4);
  30312. s4 = peg$parsewsAssociationsRest();
  30313. }
  30314. if (s3 !== peg$FAILED) {
  30315. peg$savedPos = s0;
  30316. s1 = peg$c123(s2, s3);
  30317. s0 = s1;
  30318. } else {
  30319. peg$currPos = s0;
  30320. s0 = peg$FAILED;
  30321. }
  30322. } else {
  30323. peg$currPos = s0;
  30324. s0 = peg$FAILED;
  30325. }
  30326. } else {
  30327. peg$currPos = s0;
  30328. s0 = peg$FAILED;
  30329. }
  30330. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30331. return s0;
  30332. }
  30333. peg$result = peg$startRuleFunction();
  30334. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30335. return peg$result;
  30336. } else {
  30337. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30338. peg$fail({ type: "end", description: "end of input" });
  30339. }
  30340. throw peg$buildException(
  30341. null,
  30342. peg$maxFailExpected,
  30343. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30344. peg$maxFailPos < input.length
  30345. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30346. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30347. );
  30348. }
  30349. }
  30350. return {
  30351. SyntaxError: peg$SyntaxError,
  30352. parse: peg$parse
  30353. };
  30354. })();
  30355. });
  30356. 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";
  30357. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30358. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30359. $core.addPackage("Platform-ImportExport");
  30360. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30361. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30362. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30363. $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.";
  30364. $core.addMethod(
  30365. $core.method({
  30366. selector: "exportPackage:on:",
  30367. protocol: "output",
  30368. fn: function (aPackage,aStream){
  30369. var self=this,$self=this;
  30370. return $core.withContext(function($ctx1) {
  30371. $self._subclassResponsibility();
  30372. return self;
  30373. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30374. },
  30375. args: ["aPackage", "aStream"],
  30376. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30377. referencedClasses: [],
  30378. messageSends: ["subclassResponsibility"]
  30379. }),
  30380. $globals.AbstractExporter);
  30381. $core.addMethod(
  30382. $core.method({
  30383. selector: "extensionMethodsOfPackage:",
  30384. protocol: "accessing",
  30385. fn: function (aPackage){
  30386. var self=this,$self=this;
  30387. var result;
  30388. return $core.withContext(function($ctx1) {
  30389. result=$recv($globals.OrderedCollection)._new();
  30390. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30391. return $core.withContext(function($ctx2) {
  30392. return $recv(result)._addAll_($recv(each)._ownMethods());
  30393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30394. }));
  30395. return result;
  30396. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30397. },
  30398. args: ["aPackage"],
  30399. 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",
  30400. referencedClasses: ["OrderedCollection"],
  30401. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30402. }),
  30403. $globals.AbstractExporter);
  30404. $core.addMethod(
  30405. $core.method({
  30406. selector: "extensionProtocolsOfPackage:",
  30407. protocol: "accessing",
  30408. fn: function (aPackage){
  30409. var self=this,$self=this;
  30410. var extensionName,result;
  30411. return $core.withContext(function($ctx1) {
  30412. var $1,$2,$3;
  30413. $1=$recv(aPackage)._name();
  30414. $ctx1.sendIdx["name"]=1;
  30415. extensionName="*".__comma($1);
  30416. result=$recv($globals.OrderedCollection)._new();
  30417. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30418. return $core.withContext(function($ctx2) {
  30419. $2=$recv(a)._name();
  30420. $ctx2.sendIdx["name"]=2;
  30421. return $recv($2).__lt($recv(b)._name());
  30422. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30423. })))._do_((function(each){
  30424. return $core.withContext(function($ctx2) {
  30425. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30426. return $core.withContext(function($ctx3) {
  30427. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30428. if($core.assert($3)){
  30429. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30430. }
  30431. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30432. }));
  30433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30434. }));
  30435. $ctx1.sendIdx["do:"]=1;
  30436. return result;
  30437. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30438. },
  30439. args: ["aPackage"],
  30440. 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",
  30441. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30442. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30443. }),
  30444. $globals.AbstractExporter);
  30445. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30446. $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.";
  30447. $core.addMethod(
  30448. $core.method({
  30449. selector: "chunkEscape:",
  30450. protocol: "convenience",
  30451. fn: function (aString){
  30452. var self=this,$self=this;
  30453. return $core.withContext(function($ctx1) {
  30454. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30455. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30456. },
  30457. args: ["aString"],
  30458. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30459. referencedClasses: [],
  30460. messageSends: ["trimBoth", "replace:with:"]
  30461. }),
  30462. $globals.ChunkExporter);
  30463. $core.addMethod(
  30464. $core.method({
  30465. selector: "exportBehavior:on:",
  30466. protocol: "output",
  30467. fn: function (aBehavior,aStream){
  30468. var self=this,$self=this;
  30469. return $core.withContext(function($ctx1) {
  30470. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30471. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30472. return self;
  30473. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30474. },
  30475. args: ["aBehavior", "aStream"],
  30476. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30477. referencedClasses: [],
  30478. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30479. }),
  30480. $globals.ChunkExporter);
  30481. $core.addMethod(
  30482. $core.method({
  30483. selector: "exportCategoryEpilogueOf:on:",
  30484. protocol: "output",
  30485. fn: function (aCategory,aStream){
  30486. var self=this,$self=this;
  30487. return $core.withContext(function($ctx1) {
  30488. $recv(aStream)._write_(" !");
  30489. $recv(aStream)._lf();
  30490. $ctx1.sendIdx["lf"]=1;
  30491. $recv(aStream)._lf();
  30492. return self;
  30493. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30494. },
  30495. args: ["aCategory", "aStream"],
  30496. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30497. referencedClasses: [],
  30498. messageSends: ["write:", "lf"]
  30499. }),
  30500. $globals.ChunkExporter);
  30501. $core.addMethod(
  30502. $core.method({
  30503. selector: "exportCategoryPrologueOf:on:",
  30504. protocol: "output",
  30505. fn: function (aCategory,aStream){
  30506. var self=this,$self=this;
  30507. return $core.withContext(function($ctx1) {
  30508. $recv(aStream)._write_("!");
  30509. $ctx1.sendIdx["write:"]=1;
  30510. $recv(aStream)._print_($recv(aCategory)._theClass());
  30511. $ctx1.sendIdx["print:"]=1;
  30512. $recv(aStream)._write_(" methodsFor: ");
  30513. $ctx1.sendIdx["write:"]=2;
  30514. $recv(aStream)._print_(aCategory);
  30515. $recv(aStream)._write_("!");
  30516. return self;
  30517. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30518. },
  30519. args: ["aCategory", "aStream"],
  30520. 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: '!'",
  30521. referencedClasses: [],
  30522. messageSends: ["write:", "print:", "theClass"]
  30523. }),
  30524. $globals.ChunkExporter);
  30525. $core.addMethod(
  30526. $core.method({
  30527. selector: "exportDefinitionOf:on:",
  30528. protocol: "output",
  30529. fn: function (aClass,aStream){
  30530. var self=this,$self=this;
  30531. return $core.withContext(function($ctx1) {
  30532. var $1,$2,$3,$4;
  30533. $recv(aStream)._print_($recv(aClass)._superclass());
  30534. $ctx1.sendIdx["print:"]=1;
  30535. $recv(aStream)._write_(" subclass: ");
  30536. $ctx1.sendIdx["write:"]=1;
  30537. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30538. $1=$recv(aStream)._lf();
  30539. $ctx1.sendIdx["lf"]=1;
  30540. $recv(aStream)._tab();
  30541. $ctx1.sendIdx["tab"]=1;
  30542. $recv(aStream)._write_("instanceVariableNames: ");
  30543. $ctx1.sendIdx["write:"]=2;
  30544. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30545. $ctx1.sendIdx["print:"]=2;
  30546. $recv(aStream)._lf();
  30547. $ctx1.sendIdx["lf"]=2;
  30548. $recv(aStream)._tab();
  30549. $recv(aStream)._write_("package: ");
  30550. $ctx1.sendIdx["write:"]=3;
  30551. $recv(aStream)._print_($recv(aClass)._category());
  30552. $ctx1.sendIdx["print:"]=3;
  30553. $recv(aStream)._write_("!");
  30554. $ctx1.sendIdx["write:"]=4;
  30555. $2=$recv(aStream)._lf();
  30556. $ctx1.sendIdx["lf"]=3;
  30557. $3=$recv(aClass)._comment();
  30558. $ctx1.sendIdx["comment"]=1;
  30559. $recv($3)._ifNotEmpty_((function(){
  30560. return $core.withContext(function($ctx2) {
  30561. $recv(aStream)._write_("!");
  30562. $ctx2.sendIdx["write:"]=5;
  30563. $recv(aStream)._print_(aClass);
  30564. $recv(aStream)._write_(" commentStamp!");
  30565. $ctx2.sendIdx["write:"]=6;
  30566. $recv(aStream)._lf();
  30567. $ctx2.sendIdx["lf"]=4;
  30568. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30569. $4=$recv(aStream)._lf();
  30570. $ctx2.sendIdx["lf"]=5;
  30571. return $4;
  30572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30573. }));
  30574. $recv(aStream)._lf();
  30575. return self;
  30576. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30577. },
  30578. args: ["aClass", "aStream"],
  30579. 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",
  30580. referencedClasses: [],
  30581. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30582. }),
  30583. $globals.ChunkExporter);
  30584. $core.addMethod(
  30585. $core.method({
  30586. selector: "exportMetaDefinitionOf:on:",
  30587. protocol: "output",
  30588. fn: function (aClass,aStream){
  30589. var self=this,$self=this;
  30590. var classIvars,classTraitComposition;
  30591. return $core.withContext(function($ctx1) {
  30592. var $1,$2;
  30593. $1=$recv(aClass)._class();
  30594. $ctx1.sendIdx["class"]=1;
  30595. classIvars=$recv($1)._instanceVariableNames();
  30596. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30597. $2=$recv(classIvars)._notEmpty();
  30598. if($core.assert($2)){
  30599. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30600. $ctx1.sendIdx["print:"]=1;
  30601. $recv(aStream)._space();
  30602. $recv(aStream)._write_("instanceVariableNames: ");
  30603. $ctx1.sendIdx["write:"]=1;
  30604. $recv(aStream)._print_(" "._join_(classIvars));
  30605. $recv(aStream)._write_("!");
  30606. $recv(aStream)._lf();
  30607. $ctx1.sendIdx["lf"]=1;
  30608. $recv(aStream)._lf();
  30609. }
  30610. return self;
  30611. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30612. },
  30613. args: ["aClass", "aStream"],
  30614. 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 ]",
  30615. referencedClasses: [],
  30616. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30617. }),
  30618. $globals.ChunkExporter);
  30619. $core.addMethod(
  30620. $core.method({
  30621. selector: "exportMethod:on:",
  30622. protocol: "output",
  30623. fn: function (aMethod,aStream){
  30624. var self=this,$self=this;
  30625. return $core.withContext(function($ctx1) {
  30626. $recv(aStream)._lf();
  30627. $ctx1.sendIdx["lf"]=1;
  30628. $recv(aStream)._lf();
  30629. $ctx1.sendIdx["lf"]=2;
  30630. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30631. $ctx1.sendIdx["write:"]=1;
  30632. $recv(aStream)._lf();
  30633. $recv(aStream)._write_("!");
  30634. return self;
  30635. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30636. },
  30637. args: ["aMethod", "aStream"],
  30638. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30639. referencedClasses: [],
  30640. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30641. }),
  30642. $globals.ChunkExporter);
  30643. $core.addMethod(
  30644. $core.method({
  30645. selector: "exportPackage:on:",
  30646. protocol: "output",
  30647. fn: function (aPackage,aStream){
  30648. var self=this,$self=this;
  30649. return $core.withContext(function($ctx1) {
  30650. var $1,$receiver;
  30651. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30652. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30653. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30654. return $core.withContext(function($ctx2) {
  30655. $self._exportBehavior_on_(each,aStream);
  30656. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30657. $1=$recv(each)._theMetaClass();
  30658. if(($receiver = $1) == null || $receiver.a$nil){
  30659. return $1;
  30660. } else {
  30661. var meta;
  30662. meta=$receiver;
  30663. return $self._exportBehavior_on_(meta,aStream);
  30664. }
  30665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30666. }));
  30667. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30668. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30669. return self;
  30670. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30671. },
  30672. args: ["aPackage", "aStream"],
  30673. 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",
  30674. referencedClasses: [],
  30675. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30676. }),
  30677. $globals.ChunkExporter);
  30678. $core.addMethod(
  30679. $core.method({
  30680. selector: "exportPackageDefinitionOf:on:",
  30681. protocol: "output",
  30682. fn: function (aPackage,aStream){
  30683. var self=this,$self=this;
  30684. return $core.withContext(function($ctx1) {
  30685. $recv(aStream)._write_("Smalltalk createPackage: ");
  30686. $ctx1.sendIdx["write:"]=1;
  30687. $recv(aStream)._print_($recv(aPackage)._name());
  30688. $recv(aStream)._write_("!");
  30689. $recv(aStream)._lf();
  30690. return self;
  30691. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30692. },
  30693. args: ["aPackage", "aStream"],
  30694. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30695. referencedClasses: [],
  30696. messageSends: ["write:", "print:", "name", "lf"]
  30697. }),
  30698. $globals.ChunkExporter);
  30699. $core.addMethod(
  30700. $core.method({
  30701. selector: "exportPackageImportsOf:on:",
  30702. protocol: "output",
  30703. fn: function (aPackage,aStream){
  30704. var self=this,$self=this;
  30705. return $core.withContext(function($ctx1) {
  30706. var $1;
  30707. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30708. return $core.withContext(function($ctx2) {
  30709. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30710. $ctx2.sendIdx["write:"]=1;
  30711. $1=$recv(aPackage)._name();
  30712. $ctx2.sendIdx["name"]=1;
  30713. $recv(aStream)._print_($1);
  30714. $ctx2.sendIdx["print:"]=1;
  30715. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30716. $ctx2.sendIdx["write:"]=2;
  30717. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30718. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30719. return $recv(aStream)._lf();
  30720. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30721. }));
  30722. return self;
  30723. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30724. },
  30725. args: ["aPackage", "aStream"],
  30726. 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 ]",
  30727. referencedClasses: [],
  30728. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30729. }),
  30730. $globals.ChunkExporter);
  30731. $core.addMethod(
  30732. $core.method({
  30733. selector: "exportPackageTraitCompositionsOf:on:",
  30734. protocol: "output",
  30735. fn: function (aPackage,aStream){
  30736. var self=this,$self=this;
  30737. return $core.withContext(function($ctx1) {
  30738. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30739. return $core.withContext(function($ctx2) {
  30740. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30741. return $core.withContext(function($ctx3) {
  30742. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30743. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30744. }));
  30745. $recv(aStream)._write_("! !");
  30746. $recv(aStream)._lf();
  30747. $ctx2.sendIdx["lf"]=1;
  30748. return $recv(aStream)._lf();
  30749. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30750. }));
  30751. return self;
  30752. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30753. },
  30754. args: ["aPackage", "aStream"],
  30755. 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 ]",
  30756. referencedClasses: [],
  30757. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30758. }),
  30759. $globals.ChunkExporter);
  30760. $core.addMethod(
  30761. $core.method({
  30762. selector: "exportProtocol:on:",
  30763. protocol: "output",
  30764. fn: function (aProtocol,aStream){
  30765. var self=this,$self=this;
  30766. return $core.withContext(function($ctx1) {
  30767. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30768. return $core.withContext(function($ctx2) {
  30769. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30770. $recv(methods)._do_((function(method){
  30771. return $core.withContext(function($ctx3) {
  30772. return $self._exportMethod_on_(method,aStream);
  30773. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30774. }));
  30775. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30776. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30777. }));
  30778. return self;
  30779. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30780. },
  30781. args: ["aProtocol", "aStream"],
  30782. 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 ]",
  30783. referencedClasses: [],
  30784. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30785. }),
  30786. $globals.ChunkExporter);
  30787. $core.addMethod(
  30788. $core.method({
  30789. selector: "exportProtocolEpilogueOf:on:",
  30790. protocol: "output",
  30791. fn: function (aProtocol,aStream){
  30792. var self=this,$self=this;
  30793. return $core.withContext(function($ctx1) {
  30794. $recv(aStream)._write_(" !");
  30795. $recv(aStream)._lf();
  30796. $ctx1.sendIdx["lf"]=1;
  30797. $recv(aStream)._lf();
  30798. return self;
  30799. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30800. },
  30801. args: ["aProtocol", "aStream"],
  30802. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30803. referencedClasses: [],
  30804. messageSends: ["write:", "lf"]
  30805. }),
  30806. $globals.ChunkExporter);
  30807. $core.addMethod(
  30808. $core.method({
  30809. selector: "exportProtocolPrologueOf:on:",
  30810. protocol: "output",
  30811. fn: function (aProtocol,aStream){
  30812. var self=this,$self=this;
  30813. return $core.withContext(function($ctx1) {
  30814. $recv(aStream)._write_("!");
  30815. $ctx1.sendIdx["write:"]=1;
  30816. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30817. $ctx1.sendIdx["print:"]=1;
  30818. $recv(aStream)._write_(" methodsFor: ");
  30819. $ctx1.sendIdx["write:"]=2;
  30820. $recv(aStream)._print_($recv(aProtocol)._name());
  30821. $recv(aStream)._write_("!");
  30822. return self;
  30823. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30824. },
  30825. args: ["aProtocol", "aStream"],
  30826. 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: '!'",
  30827. referencedClasses: [],
  30828. messageSends: ["write:", "print:", "theClass", "name"]
  30829. }),
  30830. $globals.ChunkExporter);
  30831. $core.addMethod(
  30832. $core.method({
  30833. selector: "exportProtocols:on:",
  30834. protocol: "output",
  30835. fn: function (aCollection,aStream){
  30836. var self=this,$self=this;
  30837. return $core.withContext(function($ctx1) {
  30838. $recv(aCollection)._do_((function(each){
  30839. return $core.withContext(function($ctx2) {
  30840. return $self._exportProtocol_on_(each,aStream);
  30841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30842. }));
  30843. return self;
  30844. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30845. },
  30846. args: ["aCollection", "aStream"],
  30847. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30848. referencedClasses: [],
  30849. messageSends: ["do:", "exportProtocol:on:"]
  30850. }),
  30851. $globals.ChunkExporter);
  30852. $core.addMethod(
  30853. $core.method({
  30854. selector: "exportTraitComposition:of:on:",
  30855. protocol: "output",
  30856. fn: function (aTraitComposition,aBehavior,aStream){
  30857. var self=this,$self=this;
  30858. return $core.withContext(function($ctx1) {
  30859. $recv(aStream)._print_(aBehavior);
  30860. $recv(aStream)._write_(" setTraitComposition: ");
  30861. $ctx1.sendIdx["write:"]=1;
  30862. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30863. $ctx1.sendIdx["write:"]=2;
  30864. $recv(aStream)._write_(" asTraitComposition!");
  30865. $recv(aStream)._lf();
  30866. return self;
  30867. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30868. },
  30869. args: ["aTraitComposition", "aBehavior", "aStream"],
  30870. 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",
  30871. referencedClasses: [],
  30872. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30873. }),
  30874. $globals.ChunkExporter);
  30875. $core.addMethod(
  30876. $core.method({
  30877. selector: "exportTraitDefinitionOf:on:",
  30878. protocol: "output",
  30879. fn: function (aClass,aStream){
  30880. var self=this,$self=this;
  30881. return $core.withContext(function($ctx1) {
  30882. var $1,$2,$3,$4;
  30883. $recv(aStream)._write_("Trait named: ");
  30884. $ctx1.sendIdx["write:"]=1;
  30885. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30886. $1=$recv(aStream)._lf();
  30887. $ctx1.sendIdx["lf"]=1;
  30888. $recv(aStream)._tab();
  30889. $recv(aStream)._write_("package: ");
  30890. $ctx1.sendIdx["write:"]=2;
  30891. $recv(aStream)._print_($recv(aClass)._category());
  30892. $ctx1.sendIdx["print:"]=1;
  30893. $recv(aStream)._write_("!");
  30894. $ctx1.sendIdx["write:"]=3;
  30895. $2=$recv(aStream)._lf();
  30896. $ctx1.sendIdx["lf"]=2;
  30897. $3=$recv(aClass)._comment();
  30898. $ctx1.sendIdx["comment"]=1;
  30899. $recv($3)._ifNotEmpty_((function(){
  30900. return $core.withContext(function($ctx2) {
  30901. $recv(aStream)._write_("!");
  30902. $ctx2.sendIdx["write:"]=4;
  30903. $recv(aStream)._print_(aClass);
  30904. $recv(aStream)._write_(" commentStamp!");
  30905. $ctx2.sendIdx["write:"]=5;
  30906. $recv(aStream)._lf();
  30907. $ctx2.sendIdx["lf"]=3;
  30908. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30909. $4=$recv(aStream)._lf();
  30910. $ctx2.sendIdx["lf"]=4;
  30911. return $4;
  30912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30913. }));
  30914. $recv(aStream)._lf();
  30915. return self;
  30916. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30917. },
  30918. args: ["aClass", "aStream"],
  30919. 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",
  30920. referencedClasses: [],
  30921. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30922. }),
  30923. $globals.ChunkExporter);
  30924. $core.addMethod(
  30925. $core.method({
  30926. selector: "extensionCategoriesOfPackage:",
  30927. protocol: "accessing",
  30928. fn: function (aPackage){
  30929. var self=this,$self=this;
  30930. var name,map,result;
  30931. return $core.withContext(function($ctx1) {
  30932. var $1;
  30933. name=$recv(aPackage)._name();
  30934. result=$recv($globals.OrderedCollection)._new();
  30935. $ctx1.sendIdx["new"]=1;
  30936. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30937. return $core.withContext(function($ctx2) {
  30938. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30939. return $core.withContext(function($ctx3) {
  30940. map=$recv($globals.Dictionary)._new();
  30941. $recv(aClass)._protocolsDo_((function(category,methods){
  30942. return $core.withContext(function($ctx4) {
  30943. $1=$recv(category).__eq("*".__comma(name));
  30944. if($core.assert($1)){
  30945. return $recv(map)._at_put_(category,methods);
  30946. }
  30947. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30948. }));
  30949. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30950. return $core.withContext(function($ctx4) {
  30951. return $recv(a).__lt_eq(b);
  30952. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30953. })))._collect_((function(category){
  30954. return $core.withContext(function($ctx4) {
  30955. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30956. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30957. })));
  30958. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30959. }));
  30960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30961. }));
  30962. $ctx1.sendIdx["do:"]=1;
  30963. return result;
  30964. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30965. },
  30966. args: ["aPackage"],
  30967. 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",
  30968. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30969. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30970. }),
  30971. $globals.ChunkExporter);
  30972. $core.addMethod(
  30973. $core.method({
  30974. selector: "ownCategoriesOfClass:",
  30975. protocol: "accessing",
  30976. fn: function (aClass){
  30977. var self=this,$self=this;
  30978. var map;
  30979. return $core.withContext(function($ctx1) {
  30980. var $1;
  30981. map=$recv($globals.Dictionary)._new();
  30982. $recv(aClass)._protocolsDo_((function(each,methods){
  30983. return $core.withContext(function($ctx2) {
  30984. $1=$recv(each)._match_("^\x5c*");
  30985. if(!$core.assert($1)){
  30986. return $recv(map)._at_put_(each,methods);
  30987. }
  30988. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30989. }));
  30990. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30991. return $core.withContext(function($ctx2) {
  30992. return $recv(a).__lt_eq(b);
  30993. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30994. })))._collect_((function(each){
  30995. return $core.withContext(function($ctx2) {
  30996. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30998. }));
  30999. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  31000. },
  31001. args: ["aClass"],
  31002. 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) ]",
  31003. referencedClasses: ["Dictionary", "MethodCategory"],
  31004. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  31005. }),
  31006. $globals.ChunkExporter);
  31007. $core.addMethod(
  31008. $core.method({
  31009. selector: "ownCategoriesOfMetaClass:",
  31010. protocol: "accessing",
  31011. fn: function (aClass){
  31012. var self=this,$self=this;
  31013. return $core.withContext(function($ctx1) {
  31014. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  31015. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  31016. },
  31017. args: ["aClass"],
  31018. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  31019. referencedClasses: [],
  31020. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  31021. }),
  31022. $globals.ChunkExporter);
  31023. $core.addMethod(
  31024. $core.method({
  31025. selector: "ownMethodProtocolsOfClass:",
  31026. protocol: "accessing",
  31027. fn: function (aClass){
  31028. var self=this,$self=this;
  31029. return $core.withContext(function($ctx1) {
  31030. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  31031. return $core.withContext(function($ctx2) {
  31032. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  31033. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31034. }));
  31035. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  31036. },
  31037. args: ["aClass"],
  31038. 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 ]",
  31039. referencedClasses: ["ExportMethodProtocol"],
  31040. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  31041. }),
  31042. $globals.ChunkExporter);
  31043. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  31044. $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.).";
  31045. $core.addMethod(
  31046. $core.method({
  31047. selector: "exportBehavior:on:",
  31048. protocol: "output",
  31049. fn: function (aBehavior,aStream){
  31050. var self=this,$self=this;
  31051. return $core.withContext(function($ctx1) {
  31052. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  31053. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  31054. return $core.withContext(function($ctx2) {
  31055. return $self._exportMethod_on_(method,aStream);
  31056. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  31057. }));
  31058. return self;
  31059. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31060. },
  31061. args: ["aBehavior", "aStream"],
  31062. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  31063. referencedClasses: [],
  31064. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  31065. }),
  31066. $globals.Exporter);
  31067. $core.addMethod(
  31068. $core.method({
  31069. selector: "exportDefinitionOf:on:",
  31070. protocol: "output",
  31071. fn: function (aClass,aStream){
  31072. var self=this,$self=this;
  31073. return $core.withContext(function($ctx1) {
  31074. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  31075. $recv(aStream)._lf();
  31076. $ctx1.sendIdx["lf"]=1;
  31077. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31078. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31079. $5=$recv(aClass)._superclass();
  31080. if(($receiver = $5) == null || $receiver.a$nil){
  31081. $4="null";
  31082. } else {
  31083. var superclass;
  31084. superclass=$receiver;
  31085. $4=$recv(superclass)._asJavaScriptSource();
  31086. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31087. }
  31088. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  31089. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31090. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  31091. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31092. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  31093. $1=$recv(aStream)._write_($2);
  31094. $ctx1.sendIdx["write:"]=1;
  31095. $8=$recv(aClass)._comment();
  31096. $ctx1.sendIdx["comment"]=1;
  31097. $recv($8)._ifNotEmpty_((function(){
  31098. return $core.withContext(function($ctx2) {
  31099. $recv(aStream)._lf();
  31100. $ctx2.sendIdx["lf"]=2;
  31101. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31102. $ctx2.sendIdx["write:"]=2;
  31103. $recv(aStream)._lf();
  31104. $ctx2.sendIdx["lf"]=3;
  31105. $10=$recv(aClass)._asJavaScriptSource();
  31106. $ctx2.sendIdx["asJavaScriptSource"]=5;
  31107. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31108. $recv(aStream)._write_($9);
  31109. $ctx2.sendIdx["write:"]=3;
  31110. $recv(aStream)._lf();
  31111. $ctx2.sendIdx["lf"]=4;
  31112. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31114. }));
  31115. $recv(aStream)._lf();
  31116. return self;
  31117. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31118. },
  31119. args: ["aClass", "aStream"],
  31120. 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",
  31121. referencedClasses: [],
  31122. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31123. }),
  31124. $globals.Exporter);
  31125. $core.addMethod(
  31126. $core.method({
  31127. selector: "exportMetaDefinitionOf:on:",
  31128. protocol: "output",
  31129. fn: function (aClass,aStream){
  31130. var self=this,$self=this;
  31131. return $core.withContext(function($ctx1) {
  31132. var $2,$1,$4,$3;
  31133. $recv(aStream)._lf();
  31134. $ctx1.sendIdx["lf"]=1;
  31135. $2=$recv(aClass)._theMetaClass();
  31136. $ctx1.sendIdx["theMetaClass"]=1;
  31137. $1=$recv($2)._instanceVariableNames();
  31138. $recv($1)._ifNotEmpty_((function(classIvars){
  31139. return $core.withContext(function($ctx2) {
  31140. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  31141. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31142. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  31143. $recv(aStream)._write_($3);
  31144. return $recv(aStream)._lf();
  31145. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  31146. }));
  31147. return self;
  31148. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31149. },
  31150. args: ["aClass", "aStream"],
  31151. 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 ]",
  31152. referencedClasses: [],
  31153. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  31154. }),
  31155. $globals.Exporter);
  31156. $core.addMethod(
  31157. $core.method({
  31158. selector: "exportMethod:on:",
  31159. protocol: "output",
  31160. fn: function (aMethod,aStream){
  31161. var self=this,$self=this;
  31162. return $core.withContext(function($ctx1) {
  31163. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  31164. $recv(aStream)._write_("$core.addMethod(");
  31165. $ctx1.sendIdx["write:"]=1;
  31166. $recv(aStream)._lf();
  31167. $ctx1.sendIdx["lf"]=1;
  31168. $recv(aStream)._write_("$core.method({");
  31169. $ctx1.sendIdx["write:"]=2;
  31170. $recv(aStream)._lf();
  31171. $ctx1.sendIdx["lf"]=2;
  31172. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  31173. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31174. $1=["selector: ",$2,","];
  31175. $recv(aStream)._write_($1);
  31176. $ctx1.sendIdx["write:"]=3;
  31177. $recv(aStream)._lf();
  31178. $ctx1.sendIdx["lf"]=3;
  31179. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  31180. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31181. $3=["protocol: ",$4,","];
  31182. $recv(aStream)._write_($3);
  31183. $ctx1.sendIdx["write:"]=4;
  31184. $recv(aStream)._lf();
  31185. $ctx1.sendIdx["lf"]=4;
  31186. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  31187. $ctx1.sendIdx["write:"]=5;
  31188. $recv(aStream)._lf();
  31189. $ctx1.sendIdx["lf"]=5;
  31190. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31191. $ctx1.sendIdx["write:"]=6;
  31192. $recv(aStream)._lf();
  31193. $ctx1.sendIdx["lf"]=6;
  31194. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31195. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31196. $5=["args: ",$6,","];
  31197. $recv(aStream)._write_($5);
  31198. $ctx1.sendIdx["write:"]=7;
  31199. $recv(aStream)._lf();
  31200. $ctx1.sendIdx["lf"]=7;
  31201. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31202. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31203. $7=["source: ",$8,","];
  31204. $recv(aStream)._write_($7);
  31205. $ctx1.sendIdx["write:"]=8;
  31206. $recv(aStream)._lf();
  31207. $ctx1.sendIdx["lf"]=8;
  31208. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31209. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31210. $9=["referencedClasses: ",$10,","];
  31211. $recv(aStream)._write_($9);
  31212. $ctx1.sendIdx["write:"]=9;
  31213. $recv(aStream)._lf();
  31214. $ctx1.sendIdx["lf"]=9;
  31215. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31216. $ctx1.sendIdx["write:"]=10;
  31217. $recv(aStream)._lf();
  31218. $ctx1.sendIdx["lf"]=10;
  31219. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31220. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31221. $11=["messageSends: ",$12];
  31222. $recv(aStream)._write_($11);
  31223. $ctx1.sendIdx["write:"]=11;
  31224. $recv(aStream)._lf();
  31225. $ctx1.sendIdx["lf"]=11;
  31226. $recv(aStream)._write_("}),");
  31227. $ctx1.sendIdx["write:"]=12;
  31228. $recv(aStream)._lf();
  31229. $ctx1.sendIdx["lf"]=12;
  31230. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31231. $recv(aStream)._lf();
  31232. $ctx1.sendIdx["lf"]=13;
  31233. $recv(aStream)._lf();
  31234. return self;
  31235. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31236. },
  31237. args: ["aMethod", "aStream"],
  31238. 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",
  31239. referencedClasses: [],
  31240. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31241. }),
  31242. $globals.Exporter);
  31243. $core.addMethod(
  31244. $core.method({
  31245. selector: "exportPackage:on:",
  31246. protocol: "output",
  31247. fn: function (aPackage,aStream){
  31248. var self=this,$self=this;
  31249. return $core.withContext(function($ctx1) {
  31250. var $1,$receiver;
  31251. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31252. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31253. $self._exportPackageContextOf_on_(aPackage,aStream);
  31254. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31255. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31256. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31257. return $core.withContext(function($ctx2) {
  31258. $self._exportBehavior_on_(each,aStream);
  31259. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31260. $1=$recv(each)._theMetaClass();
  31261. if(($receiver = $1) == null || $receiver.a$nil){
  31262. return $1;
  31263. } else {
  31264. var meta;
  31265. meta=$receiver;
  31266. return $self._exportBehavior_on_(meta,aStream);
  31267. }
  31268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31269. }));
  31270. $ctx1.sendIdx["do:"]=1;
  31271. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31272. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31273. return $core.withContext(function($ctx2) {
  31274. return $self._exportMethod_on_(each,aStream);
  31275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31276. }));
  31277. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31278. return self;
  31279. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31280. },
  31281. args: ["aPackage", "aStream"],
  31282. 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",
  31283. referencedClasses: [],
  31284. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31285. }),
  31286. $globals.Exporter);
  31287. $core.addMethod(
  31288. $core.method({
  31289. selector: "exportPackageBodyBlockPrologueOf:on:",
  31290. protocol: "output",
  31291. fn: function (aPackage,aStream){
  31292. var self=this,$self=this;
  31293. return $core.withContext(function($ctx1) {
  31294. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31295. $ctx1.sendIdx["write:"]=1;
  31296. $recv(aStream)._lf();
  31297. $ctx1.sendIdx["lf"]=1;
  31298. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31299. $recv(aStream)._lf();
  31300. return self;
  31301. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31302. },
  31303. args: ["aPackage", "aStream"],
  31304. 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",
  31305. referencedClasses: [],
  31306. messageSends: ["write:", "lf"]
  31307. }),
  31308. $globals.Exporter);
  31309. $core.addMethod(
  31310. $core.method({
  31311. selector: "exportPackageContextOf:on:",
  31312. protocol: "output",
  31313. fn: function (aPackage,aStream){
  31314. var self=this,$self=this;
  31315. return $core.withContext(function($ctx1) {
  31316. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  31317. $recv(aStream)._lf();
  31318. return self;
  31319. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31320. },
  31321. args: ["aPackage", "aStream"],
  31322. 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",
  31323. referencedClasses: [],
  31324. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31325. }),
  31326. $globals.Exporter);
  31327. $core.addMethod(
  31328. $core.method({
  31329. selector: "exportPackageDefinitionOf:on:",
  31330. protocol: "output",
  31331. fn: function (aPackage,aStream){
  31332. var self=this,$self=this;
  31333. return $core.withContext(function($ctx1) {
  31334. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31335. $recv(aStream)._lf();
  31336. return self;
  31337. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31338. },
  31339. args: ["aPackage", "aStream"],
  31340. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31341. referencedClasses: [],
  31342. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31343. }),
  31344. $globals.Exporter);
  31345. $core.addMethod(
  31346. $core.method({
  31347. selector: "exportPackageEpilogueOf:on:",
  31348. protocol: "output",
  31349. fn: function (aPackage,aStream){
  31350. var self=this,$self=this;
  31351. return $core.withContext(function($ctx1) {
  31352. $self._subclassResponsibility();
  31353. return self;
  31354. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31355. },
  31356. args: ["aPackage", "aStream"],
  31357. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31358. referencedClasses: [],
  31359. messageSends: ["subclassResponsibility"]
  31360. }),
  31361. $globals.Exporter);
  31362. $core.addMethod(
  31363. $core.method({
  31364. selector: "exportPackageImportsOf:on:",
  31365. protocol: "output",
  31366. fn: function (aPackage,aStream){
  31367. var self=this,$self=this;
  31368. return $core.withContext(function($ctx1) {
  31369. var $2,$1;
  31370. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31371. return $core.withContext(function($ctx2) {
  31372. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31373. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31374. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31375. $recv(aStream)._write_($1);
  31376. return $recv(aStream)._lf();
  31377. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31378. }));
  31379. return self;
  31380. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31381. },
  31382. args: ["aPackage", "aStream"],
  31383. 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 ]",
  31384. referencedClasses: [],
  31385. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31386. }),
  31387. $globals.Exporter);
  31388. $core.addMethod(
  31389. $core.method({
  31390. selector: "exportPackagePrologueOf:on:",
  31391. protocol: "output",
  31392. fn: function (aPackage,aStream){
  31393. var self=this,$self=this;
  31394. return $core.withContext(function($ctx1) {
  31395. $self._subclassResponsibility();
  31396. return self;
  31397. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31398. },
  31399. args: ["aPackage", "aStream"],
  31400. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31401. referencedClasses: [],
  31402. messageSends: ["subclassResponsibility"]
  31403. }),
  31404. $globals.Exporter);
  31405. $core.addMethod(
  31406. $core.method({
  31407. selector: "exportPackageTraitCompositionsOf:on:",
  31408. protocol: "output",
  31409. fn: function (aPackage,aStream){
  31410. var self=this,$self=this;
  31411. return $core.withContext(function($ctx1) {
  31412. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31413. return $core.withContext(function($ctx2) {
  31414. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31415. return $core.withContext(function($ctx3) {
  31416. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31417. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31418. }));
  31419. return $recv(aStream)._lf();
  31420. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31421. }));
  31422. return self;
  31423. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31424. },
  31425. args: ["aPackage", "aStream"],
  31426. 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 ]",
  31427. referencedClasses: [],
  31428. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31429. }),
  31430. $globals.Exporter);
  31431. $core.addMethod(
  31432. $core.method({
  31433. selector: "exportPackageTransportOf:on:",
  31434. protocol: "output",
  31435. fn: function (aPackage,aStream){
  31436. var self=this,$self=this;
  31437. return $core.withContext(function($ctx1) {
  31438. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31439. $recv(aStream)._lf();
  31440. return self;
  31441. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31442. },
  31443. args: ["aPackage", "aStream"],
  31444. 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",
  31445. referencedClasses: [],
  31446. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31447. }),
  31448. $globals.Exporter);
  31449. $core.addMethod(
  31450. $core.method({
  31451. selector: "exportTraitComposition:of:on:",
  31452. protocol: "output",
  31453. fn: function (aTraitComposition,aBehavior,aStream){
  31454. var self=this,$self=this;
  31455. return $core.withContext(function($ctx1) {
  31456. var $2,$1;
  31457. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31458. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31459. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31460. $recv(aStream)._write_($1);
  31461. $recv(aStream)._lf();
  31462. return self;
  31463. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31464. },
  31465. args: ["aTraitComposition", "aBehavior", "aStream"],
  31466. 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",
  31467. referencedClasses: [],
  31468. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31469. }),
  31470. $globals.Exporter);
  31471. $core.addMethod(
  31472. $core.method({
  31473. selector: "exportTraitDefinitionOf:on:",
  31474. protocol: "output",
  31475. fn: function (aClass,aStream){
  31476. var self=this,$self=this;
  31477. return $core.withContext(function($ctx1) {
  31478. var $3,$4,$2,$1,$5,$7,$6;
  31479. $recv(aStream)._lf();
  31480. $ctx1.sendIdx["lf"]=1;
  31481. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31482. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31483. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31484. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31485. $2=["$core.addTrait(",$3,", ",$4,");"];
  31486. $1=$recv(aStream)._write_($2);
  31487. $ctx1.sendIdx["write:"]=1;
  31488. $5=$recv(aClass)._comment();
  31489. $ctx1.sendIdx["comment"]=1;
  31490. $recv($5)._ifNotEmpty_((function(){
  31491. return $core.withContext(function($ctx2) {
  31492. $recv(aStream)._lf();
  31493. $ctx2.sendIdx["lf"]=2;
  31494. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31495. $ctx2.sendIdx["write:"]=2;
  31496. $recv(aStream)._lf();
  31497. $ctx2.sendIdx["lf"]=3;
  31498. $7=$recv(aClass)._asJavaScriptSource();
  31499. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31500. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31501. $recv(aStream)._write_($6);
  31502. $ctx2.sendIdx["write:"]=3;
  31503. $recv(aStream)._lf();
  31504. $ctx2.sendIdx["lf"]=4;
  31505. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31507. }));
  31508. $recv(aStream)._lf();
  31509. return self;
  31510. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31511. },
  31512. args: ["aClass", "aStream"],
  31513. 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",
  31514. referencedClasses: [],
  31515. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31516. }),
  31517. $globals.Exporter);
  31518. $core.addMethod(
  31519. $core.method({
  31520. selector: "ownMethodsOfClass:",
  31521. protocol: "accessing",
  31522. fn: function (aClass){
  31523. var self=this,$self=this;
  31524. return $core.withContext(function($ctx1) {
  31525. var $1;
  31526. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31527. return $core.withContext(function($ctx2) {
  31528. $1=$recv(a)._selector();
  31529. $ctx2.sendIdx["selector"]=1;
  31530. return $recv($1).__lt_eq($recv(b)._selector());
  31531. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31532. })))._reject_((function(each){
  31533. return $core.withContext(function($ctx2) {
  31534. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31536. }));
  31537. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31538. },
  31539. args: ["aClass"],
  31540. 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*') ]",
  31541. referencedClasses: [],
  31542. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31543. }),
  31544. $globals.Exporter);
  31545. $core.addMethod(
  31546. $core.method({
  31547. selector: "ownMethodsOfMetaClass:",
  31548. protocol: "accessing",
  31549. fn: function (aClass){
  31550. var self=this,$self=this;
  31551. return $core.withContext(function($ctx1) {
  31552. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31553. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31554. },
  31555. args: ["aClass"],
  31556. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31557. referencedClasses: [],
  31558. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31559. }),
  31560. $globals.Exporter);
  31561. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31562. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31563. $core.addMethod(
  31564. $core.method({
  31565. selector: "amdNamesOfPackages:",
  31566. protocol: "private",
  31567. fn: function (anArray){
  31568. var self=this,$self=this;
  31569. return $core.withContext(function($ctx1) {
  31570. var $1;
  31571. return $recv($recv(anArray)._select_((function(each){
  31572. return $core.withContext(function($ctx2) {
  31573. $1=$self._amdNamespaceOfPackage_(each);
  31574. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31575. return $recv($1)._notNil();
  31576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31577. })))._collect_((function(each){
  31578. return $core.withContext(function($ctx2) {
  31579. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31580. $ctx2.sendIdx[","]=1;
  31581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31582. }));
  31583. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31584. },
  31585. args: ["anArray"],
  31586. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31587. referencedClasses: [],
  31588. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31589. }),
  31590. $globals.AmdExporter);
  31591. $core.addMethod(
  31592. $core.method({
  31593. selector: "amdNamespaceOfPackage:",
  31594. protocol: "private",
  31595. fn: function (aPackage){
  31596. var self=this,$self=this;
  31597. return $core.withContext(function($ctx1) {
  31598. var $3,$2,$1;
  31599. $3=$recv(aPackage)._transport();
  31600. $ctx1.sendIdx["transport"]=1;
  31601. $2=$recv($3)._type();
  31602. $1=$recv($2).__eq("amd");
  31603. if($core.assert($1)){
  31604. return $recv($recv(aPackage)._transport())._namespace();
  31605. } else {
  31606. return nil;
  31607. }
  31608. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31609. },
  31610. args: ["aPackage"],
  31611. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31612. referencedClasses: [],
  31613. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31614. }),
  31615. $globals.AmdExporter);
  31616. $core.addMethod(
  31617. $core.method({
  31618. selector: "exportPackageEpilogueOf:on:",
  31619. protocol: "output",
  31620. fn: function (aPackage,aStream){
  31621. var self=this,$self=this;
  31622. return $core.withContext(function($ctx1) {
  31623. $recv(aStream)._write_("});");
  31624. $recv(aStream)._lf();
  31625. return self;
  31626. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31627. },
  31628. args: ["aPackage", "aStream"],
  31629. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31630. referencedClasses: [],
  31631. messageSends: ["write:", "lf"]
  31632. }),
  31633. $globals.AmdExporter);
  31634. $core.addMethod(
  31635. $core.method({
  31636. selector: "exportPackagePrologueOf:on:",
  31637. protocol: "output",
  31638. fn: function (aPackage,aStream){
  31639. var self=this,$self=this;
  31640. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31641. return $core.withContext(function($ctx1) {
  31642. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31643. pragmaStart="";
  31644. pragmaEnd="";
  31645. importsForOutput=$self._importsForOutput_(aPackage);
  31646. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31647. $1=$recv(importsForOutput)._value();
  31648. $ctx1.sendIdx["value"]=1;
  31649. $recv($1)._ifNotEmpty_((function(){
  31650. return $core.withContext(function($ctx2) {
  31651. $3=$recv($globals.String)._lf();
  31652. $ctx2.sendIdx["lf"]=1;
  31653. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31654. $ctx2.sendIdx[","]=2;
  31655. $4=$recv($globals.String)._lf();
  31656. $ctx2.sendIdx["lf"]=2;
  31657. pragmaStart=$recv($2).__comma($4);
  31658. $ctx2.sendIdx[","]=1;
  31659. $6=$recv($globals.String)._lf();
  31660. $ctx2.sendIdx["lf"]=3;
  31661. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31662. $ctx2.sendIdx[","]=4;
  31663. $7=$recv($globals.String)._lf();
  31664. $ctx2.sendIdx["lf"]=4;
  31665. pragmaEnd=$recv($5).__comma($7);
  31666. $ctx2.sendIdx[","]=3;
  31667. return pragmaEnd;
  31668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31669. }));
  31670. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31671. $ctx1.sendIdx[","]=7;
  31672. $13=$recv($14).__comma([":2:"]);
  31673. $ctx1.sendIdx[","]=6;
  31674. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31675. $ctx1.sendIdx[","]=5;
  31676. $11=$recv($12)._asJavaScriptSource();
  31677. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31678. $ctx1.sendIdx["replace:with:"]=2;
  31679. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31680. $ctx1.sendIdx["replace:with:"]=1;
  31681. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31682. $ctx1.sendIdx[","]=8;
  31683. $17=$recv($18)._join_(",");
  31684. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31685. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31686. $ctx1.sendIdx["replace:with:"]=3;
  31687. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31688. $recv(aStream)._write_($8);
  31689. $recv(aStream)._lf();
  31690. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31691. return self;
  31692. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31693. },
  31694. args: ["aPackage", "aStream"],
  31695. 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",
  31696. referencedClasses: ["String"],
  31697. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31698. }),
  31699. $globals.AmdExporter);
  31700. $core.addMethod(
  31701. $core.method({
  31702. selector: "importsForOutput:",
  31703. protocol: "private",
  31704. fn: function (aPackage){
  31705. var self=this,$self=this;
  31706. var namedImports,anonImports,importVarNames;
  31707. return $core.withContext(function($ctx1) {
  31708. var $1;
  31709. namedImports=[];
  31710. anonImports=[];
  31711. importVarNames=[];
  31712. $recv($recv(aPackage)._imports())._do_((function(each){
  31713. return $core.withContext(function($ctx2) {
  31714. $1=$recv(each)._isString();
  31715. if($core.assert($1)){
  31716. return $recv(anonImports)._add_(each);
  31717. $ctx2.sendIdx["add:"]=1;
  31718. } else {
  31719. $recv(namedImports)._add_($recv(each)._value());
  31720. $ctx2.sendIdx["add:"]=2;
  31721. return $recv(importVarNames)._add_($recv(each)._key());
  31722. }
  31723. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31724. }));
  31725. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31726. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31727. },
  31728. args: ["aPackage"],
  31729. 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)",
  31730. referencedClasses: [],
  31731. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31732. }),
  31733. $globals.AmdExporter);
  31734. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31735. $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";
  31736. $core.addMethod(
  31737. $core.method({
  31738. selector: "last",
  31739. protocol: "accessing",
  31740. fn: function (){
  31741. var self=this,$self=this;
  31742. return $self["@last"];
  31743. },
  31744. args: [],
  31745. source: "last\x0a\x09^ last",
  31746. referencedClasses: [],
  31747. messageSends: []
  31748. }),
  31749. $globals.ChunkParser);
  31750. $core.addMethod(
  31751. $core.method({
  31752. selector: "nextChunk",
  31753. protocol: "reading",
  31754. fn: function (){
  31755. var self=this,$self=this;
  31756. var char,result,chunk;
  31757. return $core.withContext(function($ctx1) {
  31758. var $1,$2,$3,$4;
  31759. var $early={};
  31760. try {
  31761. result=""._writeStream();
  31762. $recv((function(){
  31763. return $core.withContext(function($ctx2) {
  31764. char=$recv($self["@stream"])._next();
  31765. $ctx2.sendIdx["next"]=1;
  31766. return $recv(char)._notNil();
  31767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31768. }))._whileTrue_((function(){
  31769. return $core.withContext(function($ctx2) {
  31770. $1=$recv(char).__eq("!");
  31771. $ctx2.sendIdx["="]=1;
  31772. if($core.assert($1)){
  31773. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31774. if($core.assert($2)){
  31775. $recv($self["@stream"])._next();
  31776. } else {
  31777. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31778. $3=$self["@last"];
  31779. throw $early=[$3];
  31780. }
  31781. }
  31782. return $recv(result)._nextPut_(char);
  31783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31784. }));
  31785. $self["@last"]=nil;
  31786. $4=$self["@last"];
  31787. return $4;
  31788. }
  31789. catch(e) {if(e===$early)return e[0]; throw e}
  31790. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31791. },
  31792. args: [],
  31793. 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",
  31794. referencedClasses: [],
  31795. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31796. }),
  31797. $globals.ChunkParser);
  31798. $core.addMethod(
  31799. $core.method({
  31800. selector: "stream:",
  31801. protocol: "accessing",
  31802. fn: function (aStream){
  31803. var self=this,$self=this;
  31804. $self["@stream"]=aStream;
  31805. return self;
  31806. },
  31807. args: ["aStream"],
  31808. source: "stream: aStream\x0a\x09stream := aStream",
  31809. referencedClasses: [],
  31810. messageSends: []
  31811. }),
  31812. $globals.ChunkParser);
  31813. $core.addMethod(
  31814. $core.method({
  31815. selector: "on:",
  31816. protocol: "instance creation",
  31817. fn: function (aStream){
  31818. var self=this,$self=this;
  31819. return $core.withContext(function($ctx1) {
  31820. return $recv($self._new())._stream_(aStream);
  31821. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31822. },
  31823. args: ["aStream"],
  31824. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31825. referencedClasses: [],
  31826. messageSends: ["stream:", "new"]
  31827. }),
  31828. $globals.ChunkParser.a$cls);
  31829. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31830. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31831. $core.addMethod(
  31832. $core.method({
  31833. selector: "class:",
  31834. protocol: "accessing",
  31835. fn: function (aClass){
  31836. var self=this,$self=this;
  31837. $self["@class"]=aClass;
  31838. return self;
  31839. },
  31840. args: ["aClass"],
  31841. source: "class: aClass\x0a\x09class := aClass",
  31842. referencedClasses: [],
  31843. messageSends: []
  31844. }),
  31845. $globals.ClassCommentReader);
  31846. $core.addMethod(
  31847. $core.method({
  31848. selector: "initialize",
  31849. protocol: "initialization",
  31850. fn: function (){
  31851. var self=this,$self=this;
  31852. return $core.withContext(function($ctx1) {
  31853. (
  31854. $ctx1.supercall = true,
  31855. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31856. $ctx1.supercall = false;
  31857. return self;
  31858. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31859. },
  31860. args: [],
  31861. source: "initialize\x0a\x09super initialize.",
  31862. referencedClasses: [],
  31863. messageSends: ["initialize"]
  31864. }),
  31865. $globals.ClassCommentReader);
  31866. $core.addMethod(
  31867. $core.method({
  31868. selector: "scanFrom:",
  31869. protocol: "fileIn",
  31870. fn: function (aChunkParser){
  31871. var self=this,$self=this;
  31872. var chunk;
  31873. return $core.withContext(function($ctx1) {
  31874. chunk=$recv(aChunkParser)._nextChunk();
  31875. $recv(chunk)._ifNotEmpty_((function(){
  31876. return $core.withContext(function($ctx2) {
  31877. return $self._setComment_(chunk);
  31878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31879. }));
  31880. return self;
  31881. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31882. },
  31883. args: ["aChunkParser"],
  31884. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31885. referencedClasses: [],
  31886. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31887. }),
  31888. $globals.ClassCommentReader);
  31889. $core.addMethod(
  31890. $core.method({
  31891. selector: "setComment:",
  31892. protocol: "private",
  31893. fn: function (aString){
  31894. var self=this,$self=this;
  31895. return $core.withContext(function($ctx1) {
  31896. $recv($self["@class"])._comment_(aString);
  31897. return self;
  31898. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31899. },
  31900. args: ["aString"],
  31901. source: "setComment: aString\x0a\x09class comment: aString",
  31902. referencedClasses: [],
  31903. messageSends: ["comment:"]
  31904. }),
  31905. $globals.ClassCommentReader);
  31906. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31907. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31908. $core.addMethod(
  31909. $core.method({
  31910. selector: "class:category:",
  31911. protocol: "accessing",
  31912. fn: function (aClass,aString){
  31913. var self=this,$self=this;
  31914. $self["@class"]=aClass;
  31915. $self["@category"]=aString;
  31916. return self;
  31917. },
  31918. args: ["aClass", "aString"],
  31919. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31920. referencedClasses: [],
  31921. messageSends: []
  31922. }),
  31923. $globals.ClassProtocolReader);
  31924. $core.addMethod(
  31925. $core.method({
  31926. selector: "compileMethod:",
  31927. protocol: "private",
  31928. fn: function (aString){
  31929. var self=this,$self=this;
  31930. return $core.withContext(function($ctx1) {
  31931. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31932. return self;
  31933. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31934. },
  31935. args: ["aString"],
  31936. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31937. referencedClasses: ["Compiler"],
  31938. messageSends: ["install:forClass:protocol:", "new"]
  31939. }),
  31940. $globals.ClassProtocolReader);
  31941. $core.addMethod(
  31942. $core.method({
  31943. selector: "initialize",
  31944. protocol: "initialization",
  31945. fn: function (){
  31946. var self=this,$self=this;
  31947. return $core.withContext(function($ctx1) {
  31948. (
  31949. $ctx1.supercall = true,
  31950. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31951. $ctx1.supercall = false;
  31952. return self;
  31953. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31954. },
  31955. args: [],
  31956. source: "initialize\x0a\x09super initialize.",
  31957. referencedClasses: [],
  31958. messageSends: ["initialize"]
  31959. }),
  31960. $globals.ClassProtocolReader);
  31961. $core.addMethod(
  31962. $core.method({
  31963. selector: "scanFrom:",
  31964. protocol: "fileIn",
  31965. fn: function (aChunkParser){
  31966. var self=this,$self=this;
  31967. var chunk;
  31968. return $core.withContext(function($ctx1) {
  31969. $recv((function(){
  31970. return $core.withContext(function($ctx2) {
  31971. chunk=$recv(aChunkParser)._nextChunk();
  31972. return $recv(chunk)._isEmpty();
  31973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31974. }))._whileFalse_((function(){
  31975. return $core.withContext(function($ctx2) {
  31976. return $self._compileMethod_(chunk);
  31977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31978. }));
  31979. return self;
  31980. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31981. },
  31982. args: ["aChunkParser"],
  31983. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31984. referencedClasses: [],
  31985. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31986. }),
  31987. $globals.ClassProtocolReader);
  31988. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31989. $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.";
  31990. $core.addMethod(
  31991. $core.method({
  31992. selector: "methods",
  31993. protocol: "accessing",
  31994. fn: function (){
  31995. var self=this,$self=this;
  31996. return $core.withContext(function($ctx1) {
  31997. var $1;
  31998. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31999. return $core.withContext(function($ctx2) {
  32000. $1=$recv(a)._selector();
  32001. $ctx2.sendIdx["selector"]=1;
  32002. return $recv($1).__lt_eq($recv(b)._selector());
  32003. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32004. }));
  32005. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  32006. },
  32007. args: [],
  32008. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  32009. referencedClasses: [],
  32010. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  32011. }),
  32012. $globals.ExportMethodProtocol);
  32013. $core.addMethod(
  32014. $core.method({
  32015. selector: "name",
  32016. protocol: "accessing",
  32017. fn: function (){
  32018. var self=this,$self=this;
  32019. return $self["@name"];
  32020. },
  32021. args: [],
  32022. source: "name\x0a\x09^ name",
  32023. referencedClasses: [],
  32024. messageSends: []
  32025. }),
  32026. $globals.ExportMethodProtocol);
  32027. $core.addMethod(
  32028. $core.method({
  32029. selector: "name:",
  32030. protocol: "accessing",
  32031. fn: function (aString){
  32032. var self=this,$self=this;
  32033. $self["@name"]=aString;
  32034. return self;
  32035. },
  32036. args: ["aString"],
  32037. source: "name: aString\x0a\x09name := aString",
  32038. referencedClasses: [],
  32039. messageSends: []
  32040. }),
  32041. $globals.ExportMethodProtocol);
  32042. $core.addMethod(
  32043. $core.method({
  32044. selector: "ownMethods",
  32045. protocol: "accessing",
  32046. fn: function (){
  32047. var self=this,$self=this;
  32048. return $core.withContext(function($ctx1) {
  32049. var $1;
  32050. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  32051. return $core.withContext(function($ctx2) {
  32052. $1=$recv(a)._selector();
  32053. $ctx2.sendIdx["selector"]=1;
  32054. return $recv($1).__lt_eq($recv(b)._selector());
  32055. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32056. }));
  32057. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  32058. },
  32059. args: [],
  32060. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  32061. referencedClasses: [],
  32062. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  32063. }),
  32064. $globals.ExportMethodProtocol);
  32065. $core.addMethod(
  32066. $core.method({
  32067. selector: "theClass",
  32068. protocol: "accessing",
  32069. fn: function (){
  32070. var self=this,$self=this;
  32071. return $self["@theClass"];
  32072. },
  32073. args: [],
  32074. source: "theClass\x0a\x09^ theClass",
  32075. referencedClasses: [],
  32076. messageSends: []
  32077. }),
  32078. $globals.ExportMethodProtocol);
  32079. $core.addMethod(
  32080. $core.method({
  32081. selector: "theClass:",
  32082. protocol: "accessing",
  32083. fn: function (aClass){
  32084. var self=this,$self=this;
  32085. $self["@theClass"]=aClass;
  32086. return self;
  32087. },
  32088. args: ["aClass"],
  32089. source: "theClass: aClass\x0a\x09theClass := aClass",
  32090. referencedClasses: [],
  32091. messageSends: []
  32092. }),
  32093. $globals.ExportMethodProtocol);
  32094. $core.addMethod(
  32095. $core.method({
  32096. selector: "name:theClass:",
  32097. protocol: "instance creation",
  32098. fn: function (aString,aClass){
  32099. var self=this,$self=this;
  32100. return $core.withContext(function($ctx1) {
  32101. var $1;
  32102. $1=$self._new();
  32103. $recv($1)._name_(aString);
  32104. $recv($1)._theClass_(aClass);
  32105. return $recv($1)._yourself();
  32106. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  32107. },
  32108. args: ["aString", "aClass"],
  32109. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  32110. referencedClasses: [],
  32111. messageSends: ["name:", "new", "theClass:", "yourself"]
  32112. }),
  32113. $globals.ExportMethodProtocol.a$cls);
  32114. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  32115. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  32116. $core.addMethod(
  32117. $core.method({
  32118. selector: "import:",
  32119. protocol: "fileIn",
  32120. fn: function (aStream){
  32121. var self=this,$self=this;
  32122. var chunk,result,parser,lastEmpty;
  32123. return $core.withContext(function($ctx1) {
  32124. var $1;
  32125. parser=$recv($globals.ChunkParser)._on_(aStream);
  32126. lastEmpty=false;
  32127. $self["@lastSection"]="n/a, not started";
  32128. $self["@lastChunk"]=nil;
  32129. $recv((function(){
  32130. return $core.withContext(function($ctx2) {
  32131. $recv((function(){
  32132. return $core.withContext(function($ctx3) {
  32133. chunk=$recv(parser)._nextChunk();
  32134. return $recv(chunk)._isNil();
  32135. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32136. }))._whileFalse_((function(){
  32137. return $core.withContext(function($ctx3) {
  32138. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  32139. lastEmpty=true;
  32140. return lastEmpty;
  32141. }),(function(){
  32142. return $core.withContext(function($ctx4) {
  32143. $self["@lastSection"]=chunk;
  32144. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  32145. $1=lastEmpty;
  32146. if($core.assert($1)){
  32147. lastEmpty=false;
  32148. return $recv(result)._scanFrom_(parser);
  32149. }
  32150. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  32151. }));
  32152. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32153. }));
  32154. $self["@lastSection"]="n/a, finished";
  32155. return $self["@lastSection"];
  32156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32157. }))._on_do_($globals.Error,(function(e){
  32158. return $core.withContext(function($ctx2) {
  32159. $self["@lastChunk"]=$recv(parser)._last();
  32160. return $recv(e)._pass();
  32161. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32162. }));
  32163. return self;
  32164. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  32165. },
  32166. args: ["aStream"],
  32167. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e pass ].",
  32168. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32169. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32170. }),
  32171. $globals.Importer);
  32172. $core.addMethod(
  32173. $core.method({
  32174. selector: "lastChunk",
  32175. protocol: "accessing",
  32176. fn: function (){
  32177. var self=this,$self=this;
  32178. return $self["@lastChunk"];
  32179. },
  32180. args: [],
  32181. source: "lastChunk\x0a\x09^ lastChunk",
  32182. referencedClasses: [],
  32183. messageSends: []
  32184. }),
  32185. $globals.Importer);
  32186. $core.addMethod(
  32187. $core.method({
  32188. selector: "lastSection",
  32189. protocol: "accessing",
  32190. fn: function (){
  32191. var self=this,$self=this;
  32192. return $self["@lastSection"];
  32193. },
  32194. args: [],
  32195. source: "lastSection\x0a\x09^ lastSection",
  32196. referencedClasses: [],
  32197. messageSends: []
  32198. }),
  32199. $globals.Importer);
  32200. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32201. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32202. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32203. $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.";
  32204. $core.addMethod(
  32205. $core.method({
  32206. selector: "ajaxPutAt:data:onSuccess:onError:",
  32207. protocol: "private",
  32208. fn: function (aURL,aString,aBlock,anotherBlock){
  32209. var self=this,$self=this;
  32210. var xhr;
  32211. return $core.withContext(function($ctx1) {
  32212. var $1,$4,$3,$2;
  32213. xhr=$recv($globals.Platform)._newXhr();
  32214. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32215. $recv(xhr)._onreadystatechange_((function(){
  32216. return $core.withContext(function($ctx2) {
  32217. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32218. if($core.assert($1)){
  32219. $4=$recv(xhr)._status();
  32220. $ctx2.sendIdx["status"]=1;
  32221. $3=$recv($4).__gt_eq((200));
  32222. $2=$recv($3)._and_((function(){
  32223. return $core.withContext(function($ctx3) {
  32224. return $recv($recv(xhr)._status()).__lt((300));
  32225. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32226. }));
  32227. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32228. }
  32229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32230. }));
  32231. $recv(xhr)._send_(aString);
  32232. return self;
  32233. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32234. },
  32235. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32236. 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",
  32237. referencedClasses: ["Platform"],
  32238. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32239. }),
  32240. $globals.PackageHandler);
  32241. $core.addMethod(
  32242. $core.method({
  32243. selector: "chunkContentsFor:",
  32244. protocol: "accessing",
  32245. fn: function (aPackage){
  32246. var self=this,$self=this;
  32247. return $core.withContext(function($ctx1) {
  32248. return $recv($globals.String)._streamContents_((function(str){
  32249. return $core.withContext(function($ctx2) {
  32250. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32251. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32252. }));
  32253. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32254. },
  32255. args: ["aPackage"],
  32256. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32257. referencedClasses: ["String"],
  32258. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32259. }),
  32260. $globals.PackageHandler);
  32261. $core.addMethod(
  32262. $core.method({
  32263. selector: "chunkExporter",
  32264. protocol: "factory",
  32265. fn: function (){
  32266. var self=this,$self=this;
  32267. return $core.withContext(function($ctx1) {
  32268. return $recv($self._chunkExporterClass())._new();
  32269. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32270. },
  32271. args: [],
  32272. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32273. referencedClasses: [],
  32274. messageSends: ["new", "chunkExporterClass"]
  32275. }),
  32276. $globals.PackageHandler);
  32277. $core.addMethod(
  32278. $core.method({
  32279. selector: "chunkExporterClass",
  32280. protocol: "accessing",
  32281. fn: function (){
  32282. var self=this,$self=this;
  32283. return $globals.ChunkExporter;
  32284. },
  32285. args: [],
  32286. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32287. referencedClasses: ["ChunkExporter"],
  32288. messageSends: []
  32289. }),
  32290. $globals.PackageHandler);
  32291. $core.addMethod(
  32292. $core.method({
  32293. selector: "commit:",
  32294. protocol: "committing",
  32295. fn: function (aPackage){
  32296. var self=this,$self=this;
  32297. return $core.withContext(function($ctx1) {
  32298. var $1,$2;
  32299. $self._commit_onSuccess_onError_(aPackage,(function(){
  32300. }),(function(error){
  32301. return $core.withContext(function($ctx2) {
  32302. $1=$recv($globals.PackageCommitError)._new();
  32303. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32304. $ctx2.sendIdx[","]=1;
  32305. $recv($1)._messageText_($2);
  32306. return $recv($1)._signal();
  32307. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32308. }));
  32309. return self;
  32310. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32311. },
  32312. args: ["aPackage"],
  32313. 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 ]",
  32314. referencedClasses: ["PackageCommitError"],
  32315. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32316. }),
  32317. $globals.PackageHandler);
  32318. $core.addMethod(
  32319. $core.method({
  32320. selector: "commit:onSuccess:onError:",
  32321. protocol: "committing",
  32322. fn: function (aPackage,aBlock,anotherBlock){
  32323. var self=this,$self=this;
  32324. return $core.withContext(function($ctx1) {
  32325. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32326. return $core.withContext(function($ctx2) {
  32327. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32328. return $core.withContext(function($ctx3) {
  32329. $recv(aPackage)._beClean();
  32330. return $recv(aBlock)._value();
  32331. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32332. }),anotherBlock);
  32333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32334. }),anotherBlock);
  32335. return self;
  32336. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32337. },
  32338. args: ["aPackage", "aBlock", "anotherBlock"],
  32339. 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",
  32340. referencedClasses: [],
  32341. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32342. }),
  32343. $globals.PackageHandler);
  32344. $core.addMethod(
  32345. $core.method({
  32346. selector: "commitJsFileFor:onSuccess:onError:",
  32347. protocol: "committing",
  32348. fn: function (aPackage,aBlock,anotherBlock){
  32349. var self=this,$self=this;
  32350. return $core.withContext(function($ctx1) {
  32351. var $2,$1;
  32352. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32353. $ctx1.sendIdx[","]=2;
  32354. $1=$recv($2).__comma(".js");
  32355. $ctx1.sendIdx[","]=1;
  32356. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32357. return self;
  32358. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32359. },
  32360. args: ["aPackage", "aBlock", "anotherBlock"],
  32361. 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",
  32362. referencedClasses: [],
  32363. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32364. }),
  32365. $globals.PackageHandler);
  32366. $core.addMethod(
  32367. $core.method({
  32368. selector: "commitPathJsFor:",
  32369. protocol: "accessing",
  32370. fn: function (aPackage){
  32371. var self=this,$self=this;
  32372. return $core.withContext(function($ctx1) {
  32373. $self._subclassResponsibility();
  32374. return self;
  32375. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32376. },
  32377. args: ["aPackage"],
  32378. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32379. referencedClasses: [],
  32380. messageSends: ["subclassResponsibility"]
  32381. }),
  32382. $globals.PackageHandler);
  32383. $core.addMethod(
  32384. $core.method({
  32385. selector: "commitPathStFor:",
  32386. protocol: "accessing",
  32387. fn: function (aPackage){
  32388. var self=this,$self=this;
  32389. return $core.withContext(function($ctx1) {
  32390. $self._subclassResponsibility();
  32391. return self;
  32392. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32393. },
  32394. args: ["aPackage"],
  32395. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32396. referencedClasses: [],
  32397. messageSends: ["subclassResponsibility"]
  32398. }),
  32399. $globals.PackageHandler);
  32400. $core.addMethod(
  32401. $core.method({
  32402. selector: "commitStFileFor:onSuccess:onError:",
  32403. protocol: "committing",
  32404. fn: function (aPackage,aBlock,anotherBlock){
  32405. var self=this,$self=this;
  32406. return $core.withContext(function($ctx1) {
  32407. var $2,$1;
  32408. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32409. $ctx1.sendIdx[","]=2;
  32410. $1=$recv($2).__comma(".st");
  32411. $ctx1.sendIdx[","]=1;
  32412. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32413. return self;
  32414. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32415. },
  32416. args: ["aPackage", "aBlock", "anotherBlock"],
  32417. 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",
  32418. referencedClasses: [],
  32419. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32420. }),
  32421. $globals.PackageHandler);
  32422. $core.addMethod(
  32423. $core.method({
  32424. selector: "contentsFor:",
  32425. protocol: "accessing",
  32426. fn: function (aPackage){
  32427. var self=this,$self=this;
  32428. return $core.withContext(function($ctx1) {
  32429. return $recv($globals.String)._streamContents_((function(str){
  32430. return $core.withContext(function($ctx2) {
  32431. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32432. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32433. }));
  32434. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32435. },
  32436. args: ["aPackage"],
  32437. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32438. referencedClasses: ["String"],
  32439. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32440. }),
  32441. $globals.PackageHandler);
  32442. $core.addMethod(
  32443. $core.method({
  32444. selector: "exporter",
  32445. protocol: "factory",
  32446. fn: function (){
  32447. var self=this,$self=this;
  32448. return $core.withContext(function($ctx1) {
  32449. return $recv($self._exporterClass())._new();
  32450. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32451. },
  32452. args: [],
  32453. source: "exporter\x0a\x09^ self exporterClass new",
  32454. referencedClasses: [],
  32455. messageSends: ["new", "exporterClass"]
  32456. }),
  32457. $globals.PackageHandler);
  32458. $core.addMethod(
  32459. $core.method({
  32460. selector: "exporterClass",
  32461. protocol: "accessing",
  32462. fn: function (){
  32463. var self=this,$self=this;
  32464. return $core.withContext(function($ctx1) {
  32465. $self._subclassResponsibility();
  32466. return self;
  32467. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32468. },
  32469. args: [],
  32470. source: "exporterClass\x0a\x09self subclassResponsibility",
  32471. referencedClasses: [],
  32472. messageSends: ["subclassResponsibility"]
  32473. }),
  32474. $globals.PackageHandler);
  32475. $core.addMethod(
  32476. $core.method({
  32477. selector: "load:",
  32478. protocol: "loading",
  32479. fn: function (aPackage){
  32480. var self=this,$self=this;
  32481. return $core.withContext(function($ctx1) {
  32482. $self._subclassResponsibility();
  32483. return self;
  32484. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32485. },
  32486. args: ["aPackage"],
  32487. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32488. referencedClasses: [],
  32489. messageSends: ["subclassResponsibility"]
  32490. }),
  32491. $globals.PackageHandler);
  32492. $core.addMethod(
  32493. $core.method({
  32494. selector: "onCommitError:",
  32495. protocol: "error handling",
  32496. fn: function (anError){
  32497. var self=this,$self=this;
  32498. return $core.withContext(function($ctx1) {
  32499. var $1,$2;
  32500. $1=$recv($globals.PackageCommitError)._new();
  32501. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32502. $ctx1.sendIdx[","]=1;
  32503. $recv($1)._messageText_($2);
  32504. $recv($1)._signal();
  32505. return self;
  32506. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32507. },
  32508. args: ["anError"],
  32509. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32510. referencedClasses: ["PackageCommitError"],
  32511. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32512. }),
  32513. $globals.PackageHandler);
  32514. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32515. $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.";
  32516. $core.addMethod(
  32517. $core.method({
  32518. selector: "commitPathJsFor:",
  32519. protocol: "accessing",
  32520. fn: function (aPackage){
  32521. var self=this,$self=this;
  32522. return $core.withContext(function($ctx1) {
  32523. return $self._toUrl_($self._namespaceFor_(aPackage));
  32524. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32525. },
  32526. args: ["aPackage"],
  32527. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32528. referencedClasses: [],
  32529. messageSends: ["toUrl:", "namespaceFor:"]
  32530. }),
  32531. $globals.AmdPackageHandler);
  32532. $core.addMethod(
  32533. $core.method({
  32534. selector: "commitPathStFor:",
  32535. protocol: "accessing",
  32536. fn: function (aPackage){
  32537. var self=this,$self=this;
  32538. var path,pathWithout;
  32539. return $core.withContext(function($ctx1) {
  32540. var $1,$2;
  32541. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32542. $ctx1.sendIdx[","]=1;
  32543. path=$self._toUrl_($1);
  32544. pathWithout=$self._commitPathJsFor_(aPackage);
  32545. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32546. if($core.assert($2)){
  32547. return pathWithout;
  32548. } else {
  32549. return path;
  32550. }
  32551. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32552. },
  32553. args: ["aPackage"],
  32554. 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 ]",
  32555. referencedClasses: [],
  32556. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32557. }),
  32558. $globals.AmdPackageHandler);
  32559. $core.addMethod(
  32560. $core.method({
  32561. selector: "exporterClass",
  32562. protocol: "accessing",
  32563. fn: function (){
  32564. var self=this,$self=this;
  32565. return $globals.AmdExporter;
  32566. },
  32567. args: [],
  32568. source: "exporterClass\x0a\x09^ AmdExporter",
  32569. referencedClasses: ["AmdExporter"],
  32570. messageSends: []
  32571. }),
  32572. $globals.AmdPackageHandler);
  32573. $core.addMethod(
  32574. $core.method({
  32575. selector: "load:",
  32576. protocol: "loading",
  32577. fn: function (aPackage){
  32578. var self=this,$self=this;
  32579. return $core.withContext(function($ctx1) {
  32580. var $1,$3,$2,$receiver;
  32581. return $recv($globals.Promise)._new_((function(model){
  32582. return $core.withContext(function($ctx2) {
  32583. $1=$recv($globals.Smalltalk)._amdRequire();
  32584. if(($receiver = $1) == null || $receiver.a$nil){
  32585. return $self._error_("AMD loader not present");
  32586. } else {
  32587. var require;
  32588. require=$receiver;
  32589. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32590. $ctx2.sendIdx[","]=1;
  32591. $2=[$3];
  32592. return $recv(require)._value_value_value_($2,(function(result){
  32593. return $core.withContext(function($ctx3) {
  32594. return $recv(model)._value_(result);
  32595. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32596. }),(function(error){
  32597. return $core.withContext(function($ctx3) {
  32598. return $recv(model)._signal_(error);
  32599. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32600. }));
  32601. }
  32602. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32603. }));
  32604. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32605. },
  32606. args: ["aPackage"],
  32607. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32608. referencedClasses: ["Promise", "Smalltalk"],
  32609. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32610. }),
  32611. $globals.AmdPackageHandler);
  32612. $core.addMethod(
  32613. $core.method({
  32614. selector: "namespaceFor:",
  32615. protocol: "committing",
  32616. fn: function (aPackage){
  32617. var self=this,$self=this;
  32618. return $core.withContext(function($ctx1) {
  32619. return $recv($recv(aPackage)._transport())._namespace();
  32620. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32621. },
  32622. args: ["aPackage"],
  32623. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32624. referencedClasses: [],
  32625. messageSends: ["namespace", "transport"]
  32626. }),
  32627. $globals.AmdPackageHandler);
  32628. $core.addMethod(
  32629. $core.method({
  32630. selector: "toUrl:",
  32631. protocol: "private",
  32632. fn: function (aString){
  32633. var self=this,$self=this;
  32634. return $core.withContext(function($ctx1) {
  32635. var $1,$receiver;
  32636. $1=$recv($globals.Smalltalk)._amdRequire();
  32637. if(($receiver = $1) == null || $receiver.a$nil){
  32638. return $self._error_("AMD loader not present");
  32639. } else {
  32640. var require;
  32641. require=$receiver;
  32642. return $recv($recv(require)._provided())._toUrl_(aString);
  32643. }
  32644. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32645. },
  32646. args: ["aString"],
  32647. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  32648. referencedClasses: ["Smalltalk"],
  32649. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  32650. }),
  32651. $globals.AmdPackageHandler);
  32652. $core.addMethod(
  32653. $core.method({
  32654. selector: "defaultNamespace",
  32655. protocol: "commit paths",
  32656. fn: function (){
  32657. var self=this,$self=this;
  32658. return $core.withContext(function($ctx1) {
  32659. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32660. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32661. },
  32662. args: [],
  32663. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32664. referencedClasses: ["Smalltalk"],
  32665. messageSends: ["defaultAmdNamespace"]
  32666. }),
  32667. $globals.AmdPackageHandler.a$cls);
  32668. $core.addMethod(
  32669. $core.method({
  32670. selector: "defaultNamespace:",
  32671. protocol: "commit paths",
  32672. fn: function (aString){
  32673. var self=this,$self=this;
  32674. return $core.withContext(function($ctx1) {
  32675. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32676. return self;
  32677. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32678. },
  32679. args: ["aString"],
  32680. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32681. referencedClasses: ["Smalltalk"],
  32682. messageSends: ["defaultAmdNamespace:"]
  32683. }),
  32684. $globals.AmdPackageHandler.a$cls);
  32685. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32686. $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.";
  32687. $core.addMethod(
  32688. $core.method({
  32689. selector: "asJavaScriptObject",
  32690. protocol: "converting",
  32691. fn: function (){
  32692. var self=this,$self=this;
  32693. return $core.withContext(function($ctx1) {
  32694. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32695. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32696. },
  32697. args: [],
  32698. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32699. referencedClasses: [],
  32700. messageSends: ["type"]
  32701. }),
  32702. $globals.PackageTransport);
  32703. $core.addMethod(
  32704. $core.method({
  32705. selector: "commit",
  32706. protocol: "committing",
  32707. fn: function (){
  32708. var self=this,$self=this;
  32709. return $core.withContext(function($ctx1) {
  32710. $recv($self._commitHandler())._commit_($self._package());
  32711. return self;
  32712. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32713. },
  32714. args: [],
  32715. source: "commit\x0a\x09self commitHandler commit: self package",
  32716. referencedClasses: [],
  32717. messageSends: ["commit:", "commitHandler", "package"]
  32718. }),
  32719. $globals.PackageTransport);
  32720. $core.addMethod(
  32721. $core.method({
  32722. selector: "commitHandler",
  32723. protocol: "factory",
  32724. fn: function (){
  32725. var self=this,$self=this;
  32726. return $core.withContext(function($ctx1) {
  32727. return $recv($self._commitHandlerClass())._new();
  32728. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32729. },
  32730. args: [],
  32731. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32732. referencedClasses: [],
  32733. messageSends: ["new", "commitHandlerClass"]
  32734. }),
  32735. $globals.PackageTransport);
  32736. $core.addMethod(
  32737. $core.method({
  32738. selector: "commitHandlerClass",
  32739. protocol: "accessing",
  32740. fn: function (){
  32741. var self=this,$self=this;
  32742. return $core.withContext(function($ctx1) {
  32743. $self._subclassResponsibility();
  32744. return self;
  32745. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32746. },
  32747. args: [],
  32748. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32749. referencedClasses: [],
  32750. messageSends: ["subclassResponsibility"]
  32751. }),
  32752. $globals.PackageTransport);
  32753. $core.addMethod(
  32754. $core.method({
  32755. selector: "commitOnSuccess:onError:",
  32756. protocol: "committing",
  32757. fn: function (aBlock,anotherBlock){
  32758. var self=this,$self=this;
  32759. return $core.withContext(function($ctx1) {
  32760. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32761. return self;
  32762. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32763. },
  32764. args: ["aBlock", "anotherBlock"],
  32765. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32766. referencedClasses: [],
  32767. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32768. }),
  32769. $globals.PackageTransport);
  32770. $core.addMethod(
  32771. $core.method({
  32772. selector: "definition",
  32773. protocol: "accessing",
  32774. fn: function (){
  32775. var self=this,$self=this;
  32776. return "";
  32777. },
  32778. args: [],
  32779. source: "definition\x0a\x09^ ''",
  32780. referencedClasses: [],
  32781. messageSends: []
  32782. }),
  32783. $globals.PackageTransport);
  32784. $core.addMethod(
  32785. $core.method({
  32786. selector: "load",
  32787. protocol: "loading",
  32788. fn: function (){
  32789. var self=this,$self=this;
  32790. return $core.withContext(function($ctx1) {
  32791. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32792. return $core.withContext(function($ctx2) {
  32793. return $recv($globals.Smalltalk)._postLoad();
  32794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32795. }));
  32796. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32797. },
  32798. args: [],
  32799. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32800. referencedClasses: ["Smalltalk"],
  32801. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32802. }),
  32803. $globals.PackageTransport);
  32804. $core.addMethod(
  32805. $core.method({
  32806. selector: "package",
  32807. protocol: "accessing",
  32808. fn: function (){
  32809. var self=this,$self=this;
  32810. return $self["@package"];
  32811. },
  32812. args: [],
  32813. source: "package\x0a\x09^ package",
  32814. referencedClasses: [],
  32815. messageSends: []
  32816. }),
  32817. $globals.PackageTransport);
  32818. $core.addMethod(
  32819. $core.method({
  32820. selector: "package:",
  32821. protocol: "accessing",
  32822. fn: function (aPackage){
  32823. var self=this,$self=this;
  32824. $self["@package"]=aPackage;
  32825. return self;
  32826. },
  32827. args: ["aPackage"],
  32828. source: "package: aPackage\x0a\x09package := aPackage",
  32829. referencedClasses: [],
  32830. messageSends: []
  32831. }),
  32832. $globals.PackageTransport);
  32833. $core.addMethod(
  32834. $core.method({
  32835. selector: "setupFromJson:",
  32836. protocol: "initialization",
  32837. fn: function (anObject){
  32838. var self=this,$self=this;
  32839. return self;
  32840. },
  32841. args: ["anObject"],
  32842. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32843. referencedClasses: [],
  32844. messageSends: []
  32845. }),
  32846. $globals.PackageTransport);
  32847. $core.addMethod(
  32848. $core.method({
  32849. selector: "type",
  32850. protocol: "accessing",
  32851. fn: function (){
  32852. var self=this,$self=this;
  32853. return $core.withContext(function($ctx1) {
  32854. return $recv($self._class())._type();
  32855. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32856. },
  32857. args: [],
  32858. source: "type\x0a\x09^ self class type",
  32859. referencedClasses: [],
  32860. messageSends: ["type", "class"]
  32861. }),
  32862. $globals.PackageTransport);
  32863. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32864. $core.addMethod(
  32865. $core.method({
  32866. selector: "classRegisteredFor:",
  32867. protocol: "accessing",
  32868. fn: function (aString){
  32869. var self=this,$self=this;
  32870. return $core.withContext(function($ctx1) {
  32871. return $recv($self["@registry"])._at_(aString);
  32872. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32873. },
  32874. args: ["aString"],
  32875. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32876. referencedClasses: [],
  32877. messageSends: ["at:"]
  32878. }),
  32879. $globals.PackageTransport.a$cls);
  32880. $core.addMethod(
  32881. $core.method({
  32882. selector: "defaultType",
  32883. protocol: "accessing",
  32884. fn: function (){
  32885. var self=this,$self=this;
  32886. return $core.withContext(function($ctx1) {
  32887. return $recv($globals.AmdPackageTransport)._type();
  32888. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32889. },
  32890. args: [],
  32891. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32892. referencedClasses: ["AmdPackageTransport"],
  32893. messageSends: ["type"]
  32894. }),
  32895. $globals.PackageTransport.a$cls);
  32896. $core.addMethod(
  32897. $core.method({
  32898. selector: "for:",
  32899. protocol: "instance creation",
  32900. fn: function (aString){
  32901. var self=this,$self=this;
  32902. return $core.withContext(function($ctx1) {
  32903. return $recv($self._classRegisteredFor_(aString))._new();
  32904. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32905. },
  32906. args: ["aString"],
  32907. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32908. referencedClasses: [],
  32909. messageSends: ["new", "classRegisteredFor:"]
  32910. }),
  32911. $globals.PackageTransport.a$cls);
  32912. $core.addMethod(
  32913. $core.method({
  32914. selector: "fromJson:",
  32915. protocol: "instance creation",
  32916. fn: function (anObject){
  32917. var self=this,$self=this;
  32918. return $core.withContext(function($ctx1) {
  32919. var $1,$2,$receiver;
  32920. if(($receiver = anObject) == null || $receiver.a$nil){
  32921. $1=$self._for_($self._defaultType());
  32922. $ctx1.sendIdx["for:"]=1;
  32923. return $1;
  32924. } else {
  32925. anObject;
  32926. }
  32927. $2=$self._for_($recv(anObject)._type());
  32928. $recv($2)._setupFromJson_(anObject);
  32929. return $recv($2)._yourself();
  32930. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32931. },
  32932. args: ["anObject"],
  32933. 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",
  32934. referencedClasses: [],
  32935. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32936. }),
  32937. $globals.PackageTransport.a$cls);
  32938. $core.addMethod(
  32939. $core.method({
  32940. selector: "initialize",
  32941. protocol: "initialization",
  32942. fn: function (){
  32943. var self=this,$self=this;
  32944. return $core.withContext(function($ctx1) {
  32945. var $1;
  32946. (
  32947. $ctx1.supercall = true,
  32948. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32949. $ctx1.supercall = false;
  32950. $1=$self.__eq_eq($globals.PackageTransport);
  32951. if($core.assert($1)){
  32952. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32953. $self["@registry"];
  32954. } else {
  32955. $self._register();
  32956. }
  32957. return self;
  32958. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32959. },
  32960. args: [],
  32961. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32962. referencedClasses: ["PackageTransport"],
  32963. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32964. }),
  32965. $globals.PackageTransport.a$cls);
  32966. $core.addMethod(
  32967. $core.method({
  32968. selector: "register",
  32969. protocol: "registration",
  32970. fn: function (){
  32971. var self=this,$self=this;
  32972. return $core.withContext(function($ctx1) {
  32973. $recv($globals.PackageTransport)._register_(self);
  32974. return self;
  32975. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32976. },
  32977. args: [],
  32978. source: "register\x0a\x09PackageTransport register: self",
  32979. referencedClasses: ["PackageTransport"],
  32980. messageSends: ["register:"]
  32981. }),
  32982. $globals.PackageTransport.a$cls);
  32983. $core.addMethod(
  32984. $core.method({
  32985. selector: "register:",
  32986. protocol: "registration",
  32987. fn: function (aClass){
  32988. var self=this,$self=this;
  32989. return $core.withContext(function($ctx1) {
  32990. var $1,$receiver;
  32991. $1=$recv(aClass)._type();
  32992. $ctx1.sendIdx["type"]=1;
  32993. if(($receiver = $1) == null || $receiver.a$nil){
  32994. $1;
  32995. } else {
  32996. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32997. }
  32998. return self;
  32999. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  33000. },
  33001. args: ["aClass"],
  33002. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  33003. referencedClasses: [],
  33004. messageSends: ["ifNotNil:", "type", "at:put:"]
  33005. }),
  33006. $globals.PackageTransport.a$cls);
  33007. $core.addMethod(
  33008. $core.method({
  33009. selector: "type",
  33010. protocol: "accessing",
  33011. fn: function (){
  33012. var self=this,$self=this;
  33013. return nil;
  33014. },
  33015. args: [],
  33016. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  33017. referencedClasses: [],
  33018. messageSends: []
  33019. }),
  33020. $globals.PackageTransport.a$cls);
  33021. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  33022. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  33023. $core.addMethod(
  33024. $core.method({
  33025. selector: "asJavaScriptObject",
  33026. protocol: "converting",
  33027. fn: function (){
  33028. var self=this,$self=this;
  33029. return $core.withContext(function($ctx1) {
  33030. var $1;
  33031. $1=(
  33032. $ctx1.supercall = true,
  33033. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  33034. $ctx1.supercall = false;
  33035. $recv($1)._at_put_("amdNamespace",$self._namespace());
  33036. return $recv($1)._yourself();
  33037. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  33038. },
  33039. args: [],
  33040. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  33041. referencedClasses: [],
  33042. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  33043. }),
  33044. $globals.AmdPackageTransport);
  33045. $core.addMethod(
  33046. $core.method({
  33047. selector: "commitHandlerClass",
  33048. protocol: "accessing",
  33049. fn: function (){
  33050. var self=this,$self=this;
  33051. return $globals.AmdPackageHandler;
  33052. },
  33053. args: [],
  33054. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  33055. referencedClasses: ["AmdPackageHandler"],
  33056. messageSends: []
  33057. }),
  33058. $globals.AmdPackageTransport);
  33059. $core.addMethod(
  33060. $core.method({
  33061. selector: "defaultNamespace",
  33062. protocol: "defaults",
  33063. fn: function (){
  33064. var self=this,$self=this;
  33065. return $core.withContext(function($ctx1) {
  33066. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  33067. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  33068. },
  33069. args: [],
  33070. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  33071. referencedClasses: ["Smalltalk"],
  33072. messageSends: ["defaultAmdNamespace"]
  33073. }),
  33074. $globals.AmdPackageTransport);
  33075. $core.addMethod(
  33076. $core.method({
  33077. selector: "definition",
  33078. protocol: "accessing",
  33079. fn: function (){
  33080. var self=this,$self=this;
  33081. return $core.withContext(function($ctx1) {
  33082. return $recv($globals.String)._streamContents_((function(stream){
  33083. return $core.withContext(function($ctx2) {
  33084. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  33085. return $recv(stream)._print_($self._namespace());
  33086. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  33087. }));
  33088. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  33089. },
  33090. args: [],
  33091. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  33092. referencedClasses: ["String"],
  33093. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  33094. }),
  33095. $globals.AmdPackageTransport);
  33096. $core.addMethod(
  33097. $core.method({
  33098. selector: "namespace",
  33099. protocol: "accessing",
  33100. fn: function (){
  33101. var self=this,$self=this;
  33102. return $core.withContext(function($ctx1) {
  33103. var $1,$receiver;
  33104. $1=$self["@namespace"];
  33105. if(($receiver = $1) == null || $receiver.a$nil){
  33106. return $self._defaultNamespace();
  33107. } else {
  33108. return $1;
  33109. }
  33110. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  33111. },
  33112. args: [],
  33113. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  33114. referencedClasses: [],
  33115. messageSends: ["ifNil:", "defaultNamespace"]
  33116. }),
  33117. $globals.AmdPackageTransport);
  33118. $core.addMethod(
  33119. $core.method({
  33120. selector: "namespace:",
  33121. protocol: "accessing",
  33122. fn: function (aString){
  33123. var self=this,$self=this;
  33124. $self["@namespace"]=aString;
  33125. return self;
  33126. },
  33127. args: ["aString"],
  33128. source: "namespace: aString\x0a\x09namespace := aString",
  33129. referencedClasses: [],
  33130. messageSends: []
  33131. }),
  33132. $globals.AmdPackageTransport);
  33133. $core.addMethod(
  33134. $core.method({
  33135. selector: "printOn:",
  33136. protocol: "printing",
  33137. fn: function (aStream){
  33138. var self=this,$self=this;
  33139. return $core.withContext(function($ctx1) {
  33140. (
  33141. $ctx1.supercall = true,
  33142. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  33143. $ctx1.supercall = false;
  33144. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  33145. $ctx1.sendIdx["nextPutAll:"]=1;
  33146. $recv(aStream)._nextPutAll_($self._namespace());
  33147. $ctx1.sendIdx["nextPutAll:"]=2;
  33148. $recv(aStream)._nextPutAll_(")");
  33149. return self;
  33150. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  33151. },
  33152. args: ["aStream"],
  33153. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  33154. referencedClasses: [],
  33155. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  33156. }),
  33157. $globals.AmdPackageTransport);
  33158. $core.addMethod(
  33159. $core.method({
  33160. selector: "setPath:",
  33161. protocol: "actions",
  33162. fn: function (aString){
  33163. var self=this,$self=this;
  33164. return $core.withContext(function($ctx1) {
  33165. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  33166. return self;
  33167. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  33168. },
  33169. args: ["aString"],
  33170. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09require provided config: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  33171. referencedClasses: [],
  33172. messageSends: ["config:", "provided", "namespace"]
  33173. }),
  33174. $globals.AmdPackageTransport);
  33175. $core.addMethod(
  33176. $core.method({
  33177. selector: "setupFromJson:",
  33178. protocol: "initialization",
  33179. fn: function (anObject){
  33180. var self=this,$self=this;
  33181. return $core.withContext(function($ctx1) {
  33182. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33183. return self;
  33184. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  33185. },
  33186. args: ["anObject"],
  33187. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33188. referencedClasses: [],
  33189. messageSends: ["namespace:", "at:"]
  33190. }),
  33191. $globals.AmdPackageTransport);
  33192. $core.addMethod(
  33193. $core.method({
  33194. selector: "namespace:",
  33195. protocol: "instance creation",
  33196. fn: function (aString){
  33197. var self=this,$self=this;
  33198. return $core.withContext(function($ctx1) {
  33199. var $1;
  33200. $1=$self._new();
  33201. $recv($1)._namespace_(aString);
  33202. return $recv($1)._yourself();
  33203. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33204. },
  33205. args: ["aString"],
  33206. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33207. referencedClasses: [],
  33208. messageSends: ["namespace:", "new", "yourself"]
  33209. }),
  33210. $globals.AmdPackageTransport.a$cls);
  33211. $core.addMethod(
  33212. $core.method({
  33213. selector: "type",
  33214. protocol: "accessing",
  33215. fn: function (){
  33216. var self=this,$self=this;
  33217. return "amd";
  33218. },
  33219. args: [],
  33220. source: "type\x0a\x09^ 'amd'",
  33221. referencedClasses: [],
  33222. messageSends: []
  33223. }),
  33224. $globals.AmdPackageTransport.a$cls);
  33225. $core.addMethod(
  33226. $core.method({
  33227. selector: "exportBehaviorDefinitionTo:using:",
  33228. protocol: "*Platform-ImportExport",
  33229. fn: function (aStream,anExporter){
  33230. var self=this,$self=this;
  33231. return $core.withContext(function($ctx1) {
  33232. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33233. return self;
  33234. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33235. },
  33236. args: ["aStream", "anExporter"],
  33237. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33238. referencedClasses: [],
  33239. messageSends: ["exportDefinitionOf:on:"]
  33240. }),
  33241. $globals.Class);
  33242. $core.addMethod(
  33243. $core.method({
  33244. selector: "exportBehaviorDefinitionTo:using:",
  33245. protocol: "*Platform-ImportExport",
  33246. fn: function (aStream,anExporter){
  33247. var self=this,$self=this;
  33248. return $core.withContext(function($ctx1) {
  33249. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33250. return self;
  33251. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33252. },
  33253. args: ["aStream", "anExporter"],
  33254. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33255. referencedClasses: [],
  33256. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33257. }),
  33258. $globals.Metaclass);
  33259. $core.addMethod(
  33260. $core.method({
  33261. selector: "commit",
  33262. protocol: "*Platform-ImportExport",
  33263. fn: function (){
  33264. var self=this,$self=this;
  33265. return $core.withContext(function($ctx1) {
  33266. return $recv($self._transport())._commit();
  33267. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33268. },
  33269. args: [],
  33270. source: "commit\x0a\x09^ self transport commit",
  33271. referencedClasses: [],
  33272. messageSends: ["commit", "transport"]
  33273. }),
  33274. $globals.Package);
  33275. $core.addMethod(
  33276. $core.method({
  33277. selector: "load",
  33278. protocol: "*Platform-ImportExport",
  33279. fn: function (){
  33280. var self=this,$self=this;
  33281. return $core.withContext(function($ctx1) {
  33282. return $recv($self._transport())._load();
  33283. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33284. },
  33285. args: [],
  33286. source: "load\x0a\x09^ self transport load",
  33287. referencedClasses: [],
  33288. messageSends: ["load", "transport"]
  33289. }),
  33290. $globals.Package);
  33291. $core.addMethod(
  33292. $core.method({
  33293. selector: "loadFromNamespace:",
  33294. protocol: "*Platform-ImportExport",
  33295. fn: function (aString){
  33296. var self=this,$self=this;
  33297. return $core.withContext(function($ctx1) {
  33298. var $1;
  33299. $1=$self._transport();
  33300. $recv($1)._namespace_(aString);
  33301. return $recv($1)._load();
  33302. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33303. },
  33304. args: ["aString"],
  33305. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33306. referencedClasses: [],
  33307. messageSends: ["namespace:", "transport", "load"]
  33308. }),
  33309. $globals.Package);
  33310. $core.addMethod(
  33311. $core.method({
  33312. selector: "load:",
  33313. protocol: "*Platform-ImportExport",
  33314. fn: function (aPackageName){
  33315. var self=this,$self=this;
  33316. return $core.withContext(function($ctx1) {
  33317. return $recv($self._named_(aPackageName))._load();
  33318. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33319. },
  33320. args: ["aPackageName"],
  33321. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33322. referencedClasses: [],
  33323. messageSends: ["load", "named:"]
  33324. }),
  33325. $globals.Package.a$cls);
  33326. $core.addMethod(
  33327. $core.method({
  33328. selector: "load:fromNamespace:",
  33329. protocol: "*Platform-ImportExport",
  33330. fn: function (aPackageName,aString){
  33331. var self=this,$self=this;
  33332. return $core.withContext(function($ctx1) {
  33333. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33334. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33335. },
  33336. args: ["aPackageName", "aString"],
  33337. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33338. referencedClasses: [],
  33339. messageSends: ["loadFromNamespace:", "named:"]
  33340. }),
  33341. $globals.Package.a$cls);
  33342. $core.addMethod(
  33343. $core.method({
  33344. selector: "methodsFor:",
  33345. protocol: "*Platform-ImportExport",
  33346. fn: function (aString){
  33347. var self=this,$self=this;
  33348. return $core.withContext(function($ctx1) {
  33349. var $1;
  33350. $1=$recv($globals.ClassProtocolReader)._new();
  33351. $recv($1)._class_category_(self,aString);
  33352. return $recv($1)._yourself();
  33353. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33354. },
  33355. args: ["aString"],
  33356. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33357. referencedClasses: ["ClassProtocolReader"],
  33358. messageSends: ["class:category:", "new", "yourself"]
  33359. }),
  33360. $globals.TBehaviorProvider);
  33361. $core.addMethod(
  33362. $core.method({
  33363. selector: "methodsFor:stamp:",
  33364. protocol: "*Platform-ImportExport",
  33365. fn: function (aString,aStamp){
  33366. var self=this,$self=this;
  33367. return $core.withContext(function($ctx1) {
  33368. return $self._methodsFor_(aString);
  33369. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33370. },
  33371. args: ["aString", "aStamp"],
  33372. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33373. referencedClasses: [],
  33374. messageSends: ["methodsFor:"]
  33375. }),
  33376. $globals.TBehaviorProvider);
  33377. $core.addMethod(
  33378. $core.method({
  33379. selector: "commentStamp",
  33380. protocol: "*Platform-ImportExport",
  33381. fn: function (){
  33382. var self=this,$self=this;
  33383. return $core.withContext(function($ctx1) {
  33384. var $1;
  33385. $1=$recv($globals.ClassCommentReader)._new();
  33386. $recv($1)._class_(self);
  33387. return $recv($1)._yourself();
  33388. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33389. },
  33390. args: [],
  33391. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33392. referencedClasses: ["ClassCommentReader"],
  33393. messageSends: ["class:", "new", "yourself"]
  33394. }),
  33395. $globals.TMasterBehavior);
  33396. $core.addMethod(
  33397. $core.method({
  33398. selector: "commentStamp:prior:",
  33399. protocol: "*Platform-ImportExport",
  33400. fn: function (aStamp,prior){
  33401. var self=this,$self=this;
  33402. return $core.withContext(function($ctx1) {
  33403. return $self._commentStamp();
  33404. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33405. },
  33406. args: ["aStamp", "prior"],
  33407. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33408. referencedClasses: [],
  33409. messageSends: ["commentStamp"]
  33410. }),
  33411. $globals.TMasterBehavior);
  33412. $core.addMethod(
  33413. $core.method({
  33414. selector: "exportBehaviorDefinitionTo:using:",
  33415. protocol: "*Platform-ImportExport",
  33416. fn: function (aStream,anExporter){
  33417. var self=this,$self=this;
  33418. return $core.withContext(function($ctx1) {
  33419. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33420. return self;
  33421. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33422. },
  33423. args: ["aStream", "anExporter"],
  33424. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33425. referencedClasses: [],
  33426. messageSends: ["exportTraitDefinitionOf:on:"]
  33427. }),
  33428. $globals.Trait);
  33429. });
  33430. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33431. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33432. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33433. $core.addPackage("Compiler-AST");
  33434. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  33435. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33436. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33437. $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.";
  33438. $core.addMethod(
  33439. $core.method({
  33440. selector: "inPosition:",
  33441. protocol: "testing",
  33442. fn: function (aPoint){
  33443. var self=this,$self=this;
  33444. return $core.withContext(function($ctx1) {
  33445. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33446. return $core.withContext(function($ctx2) {
  33447. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33449. }));
  33450. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33451. },
  33452. args: ["aPoint"],
  33453. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33454. referencedClasses: [],
  33455. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33456. }),
  33457. $globals.ASTNode);
  33458. $core.addMethod(
  33459. $core.method({
  33460. selector: "isAssignmentNode",
  33461. protocol: "testing",
  33462. fn: function (){
  33463. var self=this,$self=this;
  33464. return false;
  33465. },
  33466. args: [],
  33467. source: "isAssignmentNode\x0a\x09^ false",
  33468. referencedClasses: [],
  33469. messageSends: []
  33470. }),
  33471. $globals.ASTNode);
  33472. $core.addMethod(
  33473. $core.method({
  33474. selector: "isBlockNode",
  33475. protocol: "testing",
  33476. fn: function (){
  33477. var self=this,$self=this;
  33478. return false;
  33479. },
  33480. args: [],
  33481. source: "isBlockNode\x0a\x09^ false",
  33482. referencedClasses: [],
  33483. messageSends: []
  33484. }),
  33485. $globals.ASTNode);
  33486. $core.addMethod(
  33487. $core.method({
  33488. selector: "isBlockSequenceNode",
  33489. protocol: "testing",
  33490. fn: function (){
  33491. var self=this,$self=this;
  33492. return false;
  33493. },
  33494. args: [],
  33495. source: "isBlockSequenceNode\x0a\x09^ false",
  33496. referencedClasses: [],
  33497. messageSends: []
  33498. }),
  33499. $globals.ASTNode);
  33500. $core.addMethod(
  33501. $core.method({
  33502. selector: "isCascadeNode",
  33503. protocol: "testing",
  33504. fn: function (){
  33505. var self=this,$self=this;
  33506. return false;
  33507. },
  33508. args: [],
  33509. source: "isCascadeNode\x0a\x09^ false",
  33510. referencedClasses: [],
  33511. messageSends: []
  33512. }),
  33513. $globals.ASTNode);
  33514. $core.addMethod(
  33515. $core.method({
  33516. selector: "isImmutable",
  33517. protocol: "testing",
  33518. fn: function (){
  33519. var self=this,$self=this;
  33520. return false;
  33521. },
  33522. args: [],
  33523. source: "isImmutable\x0a\x09^ false",
  33524. referencedClasses: [],
  33525. messageSends: []
  33526. }),
  33527. $globals.ASTNode);
  33528. $core.addMethod(
  33529. $core.method({
  33530. selector: "isJSStatementNode",
  33531. protocol: "testing",
  33532. fn: function (){
  33533. var self=this,$self=this;
  33534. return false;
  33535. },
  33536. args: [],
  33537. source: "isJSStatementNode\x0a\x09^ false",
  33538. referencedClasses: [],
  33539. messageSends: []
  33540. }),
  33541. $globals.ASTNode);
  33542. $core.addMethod(
  33543. $core.method({
  33544. selector: "isNavigationNode",
  33545. protocol: "testing",
  33546. fn: function (){
  33547. var self=this,$self=this;
  33548. return false;
  33549. },
  33550. args: [],
  33551. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33552. referencedClasses: [],
  33553. messageSends: []
  33554. }),
  33555. $globals.ASTNode);
  33556. $core.addMethod(
  33557. $core.method({
  33558. selector: "isReturnNode",
  33559. protocol: "testing",
  33560. fn: function (){
  33561. var self=this,$self=this;
  33562. return false;
  33563. },
  33564. args: [],
  33565. source: "isReturnNode\x0a\x09^ false",
  33566. referencedClasses: [],
  33567. messageSends: []
  33568. }),
  33569. $globals.ASTNode);
  33570. $core.addMethod(
  33571. $core.method({
  33572. selector: "isSendNode",
  33573. protocol: "testing",
  33574. fn: function (){
  33575. var self=this,$self=this;
  33576. return false;
  33577. },
  33578. args: [],
  33579. source: "isSendNode\x0a\x09^ false",
  33580. referencedClasses: [],
  33581. messageSends: []
  33582. }),
  33583. $globals.ASTNode);
  33584. $core.addMethod(
  33585. $core.method({
  33586. selector: "isSequenceNode",
  33587. protocol: "testing",
  33588. fn: function (){
  33589. var self=this,$self=this;
  33590. return false;
  33591. },
  33592. args: [],
  33593. source: "isSequenceNode\x0a\x09^ false",
  33594. referencedClasses: [],
  33595. messageSends: []
  33596. }),
  33597. $globals.ASTNode);
  33598. $core.addMethod(
  33599. $core.method({
  33600. selector: "isSuperKeyword",
  33601. protocol: "testing",
  33602. fn: function (){
  33603. var self=this,$self=this;
  33604. return false;
  33605. },
  33606. args: [],
  33607. source: "isSuperKeyword\x0a\x09^ false",
  33608. referencedClasses: [],
  33609. messageSends: []
  33610. }),
  33611. $globals.ASTNode);
  33612. $core.addMethod(
  33613. $core.method({
  33614. selector: "isValueNode",
  33615. protocol: "testing",
  33616. fn: function (){
  33617. var self=this,$self=this;
  33618. return false;
  33619. },
  33620. args: [],
  33621. source: "isValueNode\x0a\x09^ false",
  33622. referencedClasses: [],
  33623. messageSends: []
  33624. }),
  33625. $globals.ASTNode);
  33626. $core.addMethod(
  33627. $core.method({
  33628. selector: "isVariableNode",
  33629. protocol: "testing",
  33630. fn: function (){
  33631. var self=this,$self=this;
  33632. return false;
  33633. },
  33634. args: [],
  33635. source: "isVariableNode\x0a\x09^ false",
  33636. referencedClasses: [],
  33637. messageSends: []
  33638. }),
  33639. $globals.ASTNode);
  33640. $core.addMethod(
  33641. $core.method({
  33642. selector: "location:",
  33643. protocol: "accessing",
  33644. fn: function (aLocation){
  33645. var self=this,$self=this;
  33646. return $core.withContext(function($ctx1) {
  33647. var $3,$2,$1;
  33648. $3=$recv(aLocation)._start();
  33649. $ctx1.sendIdx["start"]=1;
  33650. $2=$recv($3)._line();
  33651. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33652. $self._position_($1);
  33653. return self;
  33654. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33655. },
  33656. args: ["aLocation"],
  33657. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33658. referencedClasses: [],
  33659. messageSends: ["position:", "@", "line", "start", "column"]
  33660. }),
  33661. $globals.ASTNode);
  33662. $core.addMethod(
  33663. $core.method({
  33664. selector: "method",
  33665. protocol: "accessing",
  33666. fn: function (){
  33667. var self=this,$self=this;
  33668. return $core.withContext(function($ctx1) {
  33669. var $1,$receiver;
  33670. $1=$self._parent();
  33671. if(($receiver = $1) == null || $receiver.a$nil){
  33672. return $1;
  33673. } else {
  33674. var node;
  33675. node=$receiver;
  33676. return $recv(node)._method();
  33677. }
  33678. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33679. },
  33680. args: [],
  33681. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33682. referencedClasses: [],
  33683. messageSends: ["ifNotNil:", "parent", "method"]
  33684. }),
  33685. $globals.ASTNode);
  33686. $core.addMethod(
  33687. $core.method({
  33688. selector: "navigationNodeAt:ifAbsent:",
  33689. protocol: "accessing",
  33690. fn: function (aPoint,aBlock){
  33691. var self=this,$self=this;
  33692. var children;
  33693. return $core.withContext(function($ctx1) {
  33694. var $2,$1;
  33695. var $early={};
  33696. try {
  33697. children=$recv($self._allDagChildren())._select_((function(each){
  33698. return $core.withContext(function($ctx2) {
  33699. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33700. return $core.withContext(function($ctx3) {
  33701. return $recv(each)._inPosition_(aPoint);
  33702. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33703. }));
  33704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33705. }));
  33706. $recv(children)._ifEmpty_((function(){
  33707. return $core.withContext(function($ctx2) {
  33708. throw $early=[$recv(aBlock)._value()];
  33709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33710. }));
  33711. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33712. return $core.withContext(function($ctx2) {
  33713. $2=$recv(a)._positionStart();
  33714. $ctx2.sendIdx["positionStart"]=1;
  33715. $1=$recv($2)._dist_(aPoint);
  33716. $ctx2.sendIdx["dist:"]=1;
  33717. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33718. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33719. })))._first();
  33720. }
  33721. catch(e) {if(e===$early)return e[0]; throw e}
  33722. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33723. },
  33724. args: ["aPoint", "aBlock"],
  33725. 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",
  33726. referencedClasses: [],
  33727. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33728. }),
  33729. $globals.ASTNode);
  33730. $core.addMethod(
  33731. $core.method({
  33732. selector: "parent",
  33733. protocol: "accessing",
  33734. fn: function (){
  33735. var self=this,$self=this;
  33736. return $self["@parent"];
  33737. },
  33738. args: [],
  33739. source: "parent\x0a\x09^ parent",
  33740. referencedClasses: [],
  33741. messageSends: []
  33742. }),
  33743. $globals.ASTNode);
  33744. $core.addMethod(
  33745. $core.method({
  33746. selector: "parent:",
  33747. protocol: "accessing",
  33748. fn: function (aNode){
  33749. var self=this,$self=this;
  33750. $self["@parent"]=aNode;
  33751. return self;
  33752. },
  33753. args: ["aNode"],
  33754. source: "parent: aNode\x0a\x09parent := aNode",
  33755. referencedClasses: [],
  33756. messageSends: []
  33757. }),
  33758. $globals.ASTNode);
  33759. $core.addMethod(
  33760. $core.method({
  33761. selector: "position",
  33762. protocol: "accessing",
  33763. fn: function (){
  33764. var self=this,$self=this;
  33765. return $core.withContext(function($ctx1) {
  33766. var $1,$2,$receiver;
  33767. $1=$self["@position"];
  33768. if(($receiver = $1) == null || $receiver.a$nil){
  33769. $2=$self._parent();
  33770. if(($receiver = $2) == null || $receiver.a$nil){
  33771. return $2;
  33772. } else {
  33773. var node;
  33774. node=$receiver;
  33775. return $recv(node)._position();
  33776. }
  33777. } else {
  33778. return $1;
  33779. }
  33780. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33781. },
  33782. args: [],
  33783. 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 ] ]",
  33784. referencedClasses: [],
  33785. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33786. }),
  33787. $globals.ASTNode);
  33788. $core.addMethod(
  33789. $core.method({
  33790. selector: "position:",
  33791. protocol: "accessing",
  33792. fn: function (aPosition){
  33793. var self=this,$self=this;
  33794. $self["@position"]=aPosition;
  33795. return self;
  33796. },
  33797. args: ["aPosition"],
  33798. source: "position: aPosition\x0a\x09position := aPosition",
  33799. referencedClasses: [],
  33800. messageSends: []
  33801. }),
  33802. $globals.ASTNode);
  33803. $core.addMethod(
  33804. $core.method({
  33805. selector: "positionEnd",
  33806. protocol: "accessing",
  33807. fn: function (){
  33808. var self=this,$self=this;
  33809. return $core.withContext(function($ctx1) {
  33810. var $1,$6,$5,$4,$3,$2;
  33811. $1=$self._positionStart();
  33812. $6=$self._source();
  33813. $ctx1.sendIdx["source"]=1;
  33814. $5=$recv($6)._lines();
  33815. $ctx1.sendIdx["lines"]=1;
  33816. $4=$recv($5)._size();
  33817. $ctx1.sendIdx["size"]=1;
  33818. $3=$recv($4).__minus((1));
  33819. $ctx1.sendIdx["-"]=1;
  33820. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33821. return $recv($1).__plus($2);
  33822. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33823. },
  33824. args: [],
  33825. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33826. referencedClasses: [],
  33827. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33828. }),
  33829. $globals.ASTNode);
  33830. $core.addMethod(
  33831. $core.method({
  33832. selector: "positionStart",
  33833. protocol: "accessing",
  33834. fn: function (){
  33835. var self=this,$self=this;
  33836. return $core.withContext(function($ctx1) {
  33837. return $self._position();
  33838. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33839. },
  33840. args: [],
  33841. source: "positionStart\x0a\x09^ self position",
  33842. referencedClasses: [],
  33843. messageSends: ["position"]
  33844. }),
  33845. $globals.ASTNode);
  33846. $core.addMethod(
  33847. $core.method({
  33848. selector: "requiresSmalltalkContext",
  33849. protocol: "testing",
  33850. fn: function (){
  33851. var self=this,$self=this;
  33852. return $core.withContext(function($ctx1) {
  33853. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33854. return $core.withContext(function($ctx2) {
  33855. return $recv(each)._requiresSmalltalkContext();
  33856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33857. }),(function(){
  33858. return nil;
  33859. })))._notNil();
  33860. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33861. },
  33862. args: [],
  33863. 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",
  33864. referencedClasses: [],
  33865. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33866. }),
  33867. $globals.ASTNode);
  33868. $core.addMethod(
  33869. $core.method({
  33870. selector: "shouldBeAliased",
  33871. protocol: "accessing",
  33872. fn: function (){
  33873. var self=this,$self=this;
  33874. return $core.withContext(function($ctx1) {
  33875. var $1,$receiver;
  33876. $1=$self["@shouldBeAliased"];
  33877. if(($receiver = $1) == null || $receiver.a$nil){
  33878. return false;
  33879. } else {
  33880. return $1;
  33881. }
  33882. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33883. },
  33884. args: [],
  33885. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33886. referencedClasses: [],
  33887. messageSends: ["ifNil:"]
  33888. }),
  33889. $globals.ASTNode);
  33890. $core.addMethod(
  33891. $core.method({
  33892. selector: "shouldBeAliased:",
  33893. protocol: "accessing",
  33894. fn: function (aBoolean){
  33895. var self=this,$self=this;
  33896. $self["@shouldBeAliased"]=aBoolean;
  33897. return self;
  33898. },
  33899. args: ["aBoolean"],
  33900. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33901. referencedClasses: [],
  33902. messageSends: []
  33903. }),
  33904. $globals.ASTNode);
  33905. $core.addMethod(
  33906. $core.method({
  33907. selector: "size",
  33908. protocol: "accessing",
  33909. fn: function (){
  33910. var self=this,$self=this;
  33911. return $core.withContext(function($ctx1) {
  33912. return $recv($self._source())._size();
  33913. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33914. },
  33915. args: [],
  33916. source: "size\x0a\x09^ self source size",
  33917. referencedClasses: [],
  33918. messageSends: ["size", "source"]
  33919. }),
  33920. $globals.ASTNode);
  33921. $core.addMethod(
  33922. $core.method({
  33923. selector: "source",
  33924. protocol: "accessing",
  33925. fn: function (){
  33926. var self=this,$self=this;
  33927. return $core.withContext(function($ctx1) {
  33928. var $1,$receiver;
  33929. $1=$self["@source"];
  33930. if(($receiver = $1) == null || $receiver.a$nil){
  33931. return "";
  33932. } else {
  33933. return $1;
  33934. }
  33935. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33936. },
  33937. args: [],
  33938. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33939. referencedClasses: [],
  33940. messageSends: ["ifNil:"]
  33941. }),
  33942. $globals.ASTNode);
  33943. $core.addMethod(
  33944. $core.method({
  33945. selector: "source:",
  33946. protocol: "accessing",
  33947. fn: function (aString){
  33948. var self=this,$self=this;
  33949. $self["@source"]=aString;
  33950. return self;
  33951. },
  33952. args: ["aString"],
  33953. source: "source: aString\x0a\x09source := aString",
  33954. referencedClasses: [],
  33955. messageSends: []
  33956. }),
  33957. $globals.ASTNode);
  33958. $core.addMethod(
  33959. $core.method({
  33960. selector: "withTail:",
  33961. protocol: "building",
  33962. fn: function (aCollection){
  33963. var self=this,$self=this;
  33964. return $core.withContext(function($ctx1) {
  33965. var $1;
  33966. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33967. return $core.withContext(function($ctx2) {
  33968. $1=$recv($globals.SendNode)._new();
  33969. $recv($1)._position_($recv(send)._position());
  33970. $recv($1)._source_($recv(send)._source());
  33971. $recv($1)._receiver_(receiver);
  33972. $recv($1)._selector_($recv(send)._selector());
  33973. $recv($1)._arguments_($recv(send)._arguments());
  33974. return $recv($1)._yourself();
  33975. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33976. }));
  33977. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33978. },
  33979. args: ["aCollection"],
  33980. 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 ]",
  33981. referencedClasses: ["SendNode"],
  33982. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33983. }),
  33984. $globals.ASTNode);
  33985. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33986. $globals.AssignmentNode.comment="I represent an assignment node.";
  33987. $core.addMethod(
  33988. $core.method({
  33989. selector: "acceptDagVisitor:",
  33990. protocol: "visiting",
  33991. fn: function (aVisitor){
  33992. var self=this,$self=this;
  33993. return $core.withContext(function($ctx1) {
  33994. return $recv(aVisitor)._visitAssignmentNode_(self);
  33995. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33996. },
  33997. args: ["aVisitor"],
  33998. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33999. referencedClasses: [],
  34000. messageSends: ["visitAssignmentNode:"]
  34001. }),
  34002. $globals.AssignmentNode);
  34003. $core.addMethod(
  34004. $core.method({
  34005. selector: "dagChildren",
  34006. protocol: "accessing",
  34007. fn: function (){
  34008. var self=this,$self=this;
  34009. return $core.withContext(function($ctx1) {
  34010. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  34011. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  34012. },
  34013. args: [],
  34014. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  34015. referencedClasses: ["Array"],
  34016. messageSends: ["with:with:", "left", "right"]
  34017. }),
  34018. $globals.AssignmentNode);
  34019. $core.addMethod(
  34020. $core.method({
  34021. selector: "isAssignmentNode",
  34022. protocol: "testing",
  34023. fn: function (){
  34024. var self=this,$self=this;
  34025. return true;
  34026. },
  34027. args: [],
  34028. source: "isAssignmentNode\x0a\x09^ true",
  34029. referencedClasses: [],
  34030. messageSends: []
  34031. }),
  34032. $globals.AssignmentNode);
  34033. $core.addMethod(
  34034. $core.method({
  34035. selector: "left",
  34036. protocol: "accessing",
  34037. fn: function (){
  34038. var self=this,$self=this;
  34039. return $self["@left"];
  34040. },
  34041. args: [],
  34042. source: "left\x0a\x09^ left",
  34043. referencedClasses: [],
  34044. messageSends: []
  34045. }),
  34046. $globals.AssignmentNode);
  34047. $core.addMethod(
  34048. $core.method({
  34049. selector: "left:",
  34050. protocol: "accessing",
  34051. fn: function (aNode){
  34052. var self=this,$self=this;
  34053. $self["@left"]=aNode;
  34054. return self;
  34055. },
  34056. args: ["aNode"],
  34057. source: "left: aNode\x0a\x09left := aNode",
  34058. referencedClasses: [],
  34059. messageSends: []
  34060. }),
  34061. $globals.AssignmentNode);
  34062. $core.addMethod(
  34063. $core.method({
  34064. selector: "right",
  34065. protocol: "accessing",
  34066. fn: function (){
  34067. var self=this,$self=this;
  34068. return $self["@right"];
  34069. },
  34070. args: [],
  34071. source: "right\x0a\x09^ right",
  34072. referencedClasses: [],
  34073. messageSends: []
  34074. }),
  34075. $globals.AssignmentNode);
  34076. $core.addMethod(
  34077. $core.method({
  34078. selector: "right:",
  34079. protocol: "accessing",
  34080. fn: function (aNode){
  34081. var self=this,$self=this;
  34082. $self["@right"]=aNode;
  34083. return self;
  34084. },
  34085. args: ["aNode"],
  34086. source: "right: aNode\x0a\x09right := aNode",
  34087. referencedClasses: [],
  34088. messageSends: []
  34089. }),
  34090. $globals.AssignmentNode);
  34091. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34092. $globals.BlockNode.comment="I represent an block closure node.";
  34093. $core.addMethod(
  34094. $core.method({
  34095. selector: "acceptDagVisitor:",
  34096. protocol: "visiting",
  34097. fn: function (aVisitor){
  34098. var self=this,$self=this;
  34099. return $core.withContext(function($ctx1) {
  34100. return $recv(aVisitor)._visitBlockNode_(self);
  34101. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34102. },
  34103. args: ["aVisitor"],
  34104. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34105. referencedClasses: [],
  34106. messageSends: ["visitBlockNode:"]
  34107. }),
  34108. $globals.BlockNode);
  34109. $core.addMethod(
  34110. $core.method({
  34111. selector: "isBlockNode",
  34112. protocol: "testing",
  34113. fn: function (){
  34114. var self=this,$self=this;
  34115. return true;
  34116. },
  34117. args: [],
  34118. source: "isBlockNode\x0a\x09^ true",
  34119. referencedClasses: [],
  34120. messageSends: []
  34121. }),
  34122. $globals.BlockNode);
  34123. $core.addMethod(
  34124. $core.method({
  34125. selector: "parameters",
  34126. protocol: "accessing",
  34127. fn: function (){
  34128. var self=this,$self=this;
  34129. return $core.withContext(function($ctx1) {
  34130. var $1,$receiver;
  34131. $1=$self["@parameters"];
  34132. if(($receiver = $1) == null || $receiver.a$nil){
  34133. $self["@parameters"]=$recv($globals.Array)._new();
  34134. return $self["@parameters"];
  34135. } else {
  34136. return $1;
  34137. }
  34138. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34139. },
  34140. args: [],
  34141. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34142. referencedClasses: ["Array"],
  34143. messageSends: ["ifNil:", "new"]
  34144. }),
  34145. $globals.BlockNode);
  34146. $core.addMethod(
  34147. $core.method({
  34148. selector: "parameters:",
  34149. protocol: "accessing",
  34150. fn: function (aCollection){
  34151. var self=this,$self=this;
  34152. $self["@parameters"]=aCollection;
  34153. return self;
  34154. },
  34155. args: ["aCollection"],
  34156. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34157. referencedClasses: [],
  34158. messageSends: []
  34159. }),
  34160. $globals.BlockNode);
  34161. $core.addMethod(
  34162. $core.method({
  34163. selector: "scope",
  34164. protocol: "accessing",
  34165. fn: function (){
  34166. var self=this,$self=this;
  34167. return $self["@scope"];
  34168. },
  34169. args: [],
  34170. source: "scope\x0a\x09^ scope",
  34171. referencedClasses: [],
  34172. messageSends: []
  34173. }),
  34174. $globals.BlockNode);
  34175. $core.addMethod(
  34176. $core.method({
  34177. selector: "scope:",
  34178. protocol: "accessing",
  34179. fn: function (aLexicalScope){
  34180. var self=this,$self=this;
  34181. $self["@scope"]=aLexicalScope;
  34182. return self;
  34183. },
  34184. args: ["aLexicalScope"],
  34185. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34186. referencedClasses: [],
  34187. messageSends: []
  34188. }),
  34189. $globals.BlockNode);
  34190. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34191. $globals.CascadeNode.comment="I represent an cascade node.";
  34192. $core.addMethod(
  34193. $core.method({
  34194. selector: "acceptDagVisitor:",
  34195. protocol: "visiting",
  34196. fn: function (aVisitor){
  34197. var self=this,$self=this;
  34198. return $core.withContext(function($ctx1) {
  34199. return $recv(aVisitor)._visitCascadeNode_(self);
  34200. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34201. },
  34202. args: ["aVisitor"],
  34203. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34204. referencedClasses: [],
  34205. messageSends: ["visitCascadeNode:"]
  34206. }),
  34207. $globals.CascadeNode);
  34208. $core.addMethod(
  34209. $core.method({
  34210. selector: "isCascadeNode",
  34211. protocol: "testing",
  34212. fn: function (){
  34213. var self=this,$self=this;
  34214. return true;
  34215. },
  34216. args: [],
  34217. source: "isCascadeNode\x0a\x09^ true",
  34218. referencedClasses: [],
  34219. messageSends: []
  34220. }),
  34221. $globals.CascadeNode);
  34222. $core.addMethod(
  34223. $core.method({
  34224. selector: "receiver",
  34225. protocol: "accessing",
  34226. fn: function (){
  34227. var self=this,$self=this;
  34228. return $self["@receiver"];
  34229. },
  34230. args: [],
  34231. source: "receiver\x0a\x09^ receiver",
  34232. referencedClasses: [],
  34233. messageSends: []
  34234. }),
  34235. $globals.CascadeNode);
  34236. $core.addMethod(
  34237. $core.method({
  34238. selector: "receiver:",
  34239. protocol: "accessing",
  34240. fn: function (aNode){
  34241. var self=this,$self=this;
  34242. $self["@receiver"]=aNode;
  34243. return self;
  34244. },
  34245. args: ["aNode"],
  34246. source: "receiver: aNode\x0a\x09receiver := aNode",
  34247. referencedClasses: [],
  34248. messageSends: []
  34249. }),
  34250. $globals.CascadeNode);
  34251. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34252. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34253. $core.addMethod(
  34254. $core.method({
  34255. selector: "acceptDagVisitor:",
  34256. protocol: "visiting",
  34257. fn: function (aVisitor){
  34258. var self=this,$self=this;
  34259. return $core.withContext(function($ctx1) {
  34260. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34261. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34262. },
  34263. args: ["aVisitor"],
  34264. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34265. referencedClasses: [],
  34266. messageSends: ["visitDynamicArrayNode:"]
  34267. }),
  34268. $globals.DynamicArrayNode);
  34269. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34270. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34271. $core.addMethod(
  34272. $core.method({
  34273. selector: "acceptDagVisitor:",
  34274. protocol: "visiting",
  34275. fn: function (aVisitor){
  34276. var self=this,$self=this;
  34277. return $core.withContext(function($ctx1) {
  34278. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34279. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34280. },
  34281. args: ["aVisitor"],
  34282. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34283. referencedClasses: [],
  34284. messageSends: ["visitDynamicDictionaryNode:"]
  34285. }),
  34286. $globals.DynamicDictionaryNode);
  34287. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34288. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34289. $core.addMethod(
  34290. $core.method({
  34291. selector: "acceptDagVisitor:",
  34292. protocol: "visiting",
  34293. fn: function (aVisitor){
  34294. var self=this,$self=this;
  34295. return $core.withContext(function($ctx1) {
  34296. return $recv(aVisitor)._visitJSStatementNode_(self);
  34297. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34298. },
  34299. args: ["aVisitor"],
  34300. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34301. referencedClasses: [],
  34302. messageSends: ["visitJSStatementNode:"]
  34303. }),
  34304. $globals.JSStatementNode);
  34305. $core.addMethod(
  34306. $core.method({
  34307. selector: "isJSStatementNode",
  34308. protocol: "testing",
  34309. fn: function (){
  34310. var self=this,$self=this;
  34311. return true;
  34312. },
  34313. args: [],
  34314. source: "isJSStatementNode\x0a\x09^ true",
  34315. referencedClasses: [],
  34316. messageSends: []
  34317. }),
  34318. $globals.JSStatementNode);
  34319. $core.addMethod(
  34320. $core.method({
  34321. selector: "requiresSmalltalkContext",
  34322. protocol: "testing",
  34323. fn: function (){
  34324. var self=this,$self=this;
  34325. return true;
  34326. },
  34327. args: [],
  34328. source: "requiresSmalltalkContext\x0a\x09^ true",
  34329. referencedClasses: [],
  34330. messageSends: []
  34331. }),
  34332. $globals.JSStatementNode);
  34333. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34334. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34335. $core.addMethod(
  34336. $core.method({
  34337. selector: "acceptDagVisitor:",
  34338. protocol: "visiting",
  34339. fn: function (aVisitor){
  34340. var self=this,$self=this;
  34341. return $core.withContext(function($ctx1) {
  34342. return $recv(aVisitor)._visitMethodNode_(self);
  34343. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34344. },
  34345. args: ["aVisitor"],
  34346. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34347. referencedClasses: [],
  34348. messageSends: ["visitMethodNode:"]
  34349. }),
  34350. $globals.MethodNode);
  34351. $core.addMethod(
  34352. $core.method({
  34353. selector: "arguments",
  34354. protocol: "accessing",
  34355. fn: function (){
  34356. var self=this,$self=this;
  34357. return $core.withContext(function($ctx1) {
  34358. var $1,$receiver;
  34359. $1=$self["@arguments"];
  34360. if(($receiver = $1) == null || $receiver.a$nil){
  34361. return [];
  34362. } else {
  34363. return $1;
  34364. }
  34365. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34366. },
  34367. args: [],
  34368. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34369. referencedClasses: [],
  34370. messageSends: ["ifNil:"]
  34371. }),
  34372. $globals.MethodNode);
  34373. $core.addMethod(
  34374. $core.method({
  34375. selector: "arguments:",
  34376. protocol: "accessing",
  34377. fn: function (aCollection){
  34378. var self=this,$self=this;
  34379. $self["@arguments"]=aCollection;
  34380. return self;
  34381. },
  34382. args: ["aCollection"],
  34383. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34384. referencedClasses: [],
  34385. messageSends: []
  34386. }),
  34387. $globals.MethodNode);
  34388. $core.addMethod(
  34389. $core.method({
  34390. selector: "classReferences",
  34391. protocol: "accessing",
  34392. fn: function (){
  34393. var self=this,$self=this;
  34394. return $self["@classReferences"];
  34395. },
  34396. args: [],
  34397. source: "classReferences\x0a\x09^ classReferences",
  34398. referencedClasses: [],
  34399. messageSends: []
  34400. }),
  34401. $globals.MethodNode);
  34402. $core.addMethod(
  34403. $core.method({
  34404. selector: "classReferences:",
  34405. protocol: "accessing",
  34406. fn: function (aCollection){
  34407. var self=this,$self=this;
  34408. $self["@classReferences"]=aCollection;
  34409. return self;
  34410. },
  34411. args: ["aCollection"],
  34412. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34413. referencedClasses: [],
  34414. messageSends: []
  34415. }),
  34416. $globals.MethodNode);
  34417. $core.addMethod(
  34418. $core.method({
  34419. selector: "messageSends",
  34420. protocol: "accessing",
  34421. fn: function (){
  34422. var self=this,$self=this;
  34423. return $core.withContext(function($ctx1) {
  34424. return $recv($self._sendIndexes())._keys();
  34425. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34426. },
  34427. args: [],
  34428. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34429. referencedClasses: [],
  34430. messageSends: ["keys", "sendIndexes"]
  34431. }),
  34432. $globals.MethodNode);
  34433. $core.addMethod(
  34434. $core.method({
  34435. selector: "method",
  34436. protocol: "accessing",
  34437. fn: function (){
  34438. var self=this,$self=this;
  34439. return self;
  34440. },
  34441. args: [],
  34442. source: "method\x0a\x09^ self",
  34443. referencedClasses: [],
  34444. messageSends: []
  34445. }),
  34446. $globals.MethodNode);
  34447. $core.addMethod(
  34448. $core.method({
  34449. selector: "scope",
  34450. protocol: "accessing",
  34451. fn: function (){
  34452. var self=this,$self=this;
  34453. return $self["@scope"];
  34454. },
  34455. args: [],
  34456. source: "scope\x0a\x09^ scope",
  34457. referencedClasses: [],
  34458. messageSends: []
  34459. }),
  34460. $globals.MethodNode);
  34461. $core.addMethod(
  34462. $core.method({
  34463. selector: "scope:",
  34464. protocol: "accessing",
  34465. fn: function (aMethodScope){
  34466. var self=this,$self=this;
  34467. $self["@scope"]=aMethodScope;
  34468. return self;
  34469. },
  34470. args: ["aMethodScope"],
  34471. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34472. referencedClasses: [],
  34473. messageSends: []
  34474. }),
  34475. $globals.MethodNode);
  34476. $core.addMethod(
  34477. $core.method({
  34478. selector: "selector",
  34479. protocol: "accessing",
  34480. fn: function (){
  34481. var self=this,$self=this;
  34482. return $self["@selector"];
  34483. },
  34484. args: [],
  34485. source: "selector\x0a\x09^ selector",
  34486. referencedClasses: [],
  34487. messageSends: []
  34488. }),
  34489. $globals.MethodNode);
  34490. $core.addMethod(
  34491. $core.method({
  34492. selector: "selector:",
  34493. protocol: "accessing",
  34494. fn: function (aString){
  34495. var self=this,$self=this;
  34496. $self["@selector"]=aString;
  34497. return self;
  34498. },
  34499. args: ["aString"],
  34500. source: "selector: aString\x0a\x09selector := aString",
  34501. referencedClasses: [],
  34502. messageSends: []
  34503. }),
  34504. $globals.MethodNode);
  34505. $core.addMethod(
  34506. $core.method({
  34507. selector: "sendIndexes",
  34508. protocol: "accessing",
  34509. fn: function (){
  34510. var self=this,$self=this;
  34511. return $self["@sendIndexes"];
  34512. },
  34513. args: [],
  34514. source: "sendIndexes\x0a\x09^ sendIndexes",
  34515. referencedClasses: [],
  34516. messageSends: []
  34517. }),
  34518. $globals.MethodNode);
  34519. $core.addMethod(
  34520. $core.method({
  34521. selector: "sendIndexes:",
  34522. protocol: "accessing",
  34523. fn: function (aDictionary){
  34524. var self=this,$self=this;
  34525. $self["@sendIndexes"]=aDictionary;
  34526. return self;
  34527. },
  34528. args: ["aDictionary"],
  34529. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34530. referencedClasses: [],
  34531. messageSends: []
  34532. }),
  34533. $globals.MethodNode);
  34534. $core.addMethod(
  34535. $core.method({
  34536. selector: "sequenceNode",
  34537. protocol: "accessing",
  34538. fn: function (){
  34539. var self=this,$self=this;
  34540. return $core.withContext(function($ctx1) {
  34541. var $1;
  34542. var $early={};
  34543. try {
  34544. $recv($self._dagChildren())._do_((function(each){
  34545. return $core.withContext(function($ctx2) {
  34546. $1=$recv(each)._isSequenceNode();
  34547. if($core.assert($1)){
  34548. throw $early=[each];
  34549. }
  34550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34551. }));
  34552. return nil;
  34553. }
  34554. catch(e) {if(e===$early)return e[0]; throw e}
  34555. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34556. },
  34557. args: [],
  34558. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34559. referencedClasses: [],
  34560. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34561. }),
  34562. $globals.MethodNode);
  34563. $core.addMethod(
  34564. $core.method({
  34565. selector: "source",
  34566. protocol: "accessing",
  34567. fn: function (){
  34568. var self=this,$self=this;
  34569. return $self["@source"];
  34570. },
  34571. args: [],
  34572. source: "source\x0a\x09^ source",
  34573. referencedClasses: [],
  34574. messageSends: []
  34575. }),
  34576. $globals.MethodNode);
  34577. $core.addMethod(
  34578. $core.method({
  34579. selector: "source:",
  34580. protocol: "accessing",
  34581. fn: function (aString){
  34582. var self=this,$self=this;
  34583. $self["@source"]=aString;
  34584. return self;
  34585. },
  34586. args: ["aString"],
  34587. source: "source: aString\x0a\x09source := aString",
  34588. referencedClasses: [],
  34589. messageSends: []
  34590. }),
  34591. $globals.MethodNode);
  34592. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34593. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34594. $core.addMethod(
  34595. $core.method({
  34596. selector: "acceptDagVisitor:",
  34597. protocol: "visiting",
  34598. fn: function (aVisitor){
  34599. var self=this,$self=this;
  34600. return $core.withContext(function($ctx1) {
  34601. return $recv(aVisitor)._visitReturnNode_(self);
  34602. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34603. },
  34604. args: ["aVisitor"],
  34605. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34606. referencedClasses: [],
  34607. messageSends: ["visitReturnNode:"]
  34608. }),
  34609. $globals.ReturnNode);
  34610. $core.addMethod(
  34611. $core.method({
  34612. selector: "isReturnNode",
  34613. protocol: "testing",
  34614. fn: function (){
  34615. var self=this,$self=this;
  34616. return true;
  34617. },
  34618. args: [],
  34619. source: "isReturnNode\x0a\x09^ true",
  34620. referencedClasses: [],
  34621. messageSends: []
  34622. }),
  34623. $globals.ReturnNode);
  34624. $core.addMethod(
  34625. $core.method({
  34626. selector: "nonLocalReturn",
  34627. protocol: "testing",
  34628. fn: function (){
  34629. var self=this,$self=this;
  34630. return $core.withContext(function($ctx1) {
  34631. return $recv($recv($self._scope())._isMethodScope())._not();
  34632. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34633. },
  34634. args: [],
  34635. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34636. referencedClasses: [],
  34637. messageSends: ["not", "isMethodScope", "scope"]
  34638. }),
  34639. $globals.ReturnNode);
  34640. $core.addMethod(
  34641. $core.method({
  34642. selector: "scope",
  34643. protocol: "accessing",
  34644. fn: function (){
  34645. var self=this,$self=this;
  34646. return $self["@scope"];
  34647. },
  34648. args: [],
  34649. source: "scope\x0a\x09^ scope",
  34650. referencedClasses: [],
  34651. messageSends: []
  34652. }),
  34653. $globals.ReturnNode);
  34654. $core.addMethod(
  34655. $core.method({
  34656. selector: "scope:",
  34657. protocol: "accessing",
  34658. fn: function (aLexicalScope){
  34659. var self=this,$self=this;
  34660. $self["@scope"]=aLexicalScope;
  34661. return self;
  34662. },
  34663. args: ["aLexicalScope"],
  34664. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34665. referencedClasses: [],
  34666. messageSends: []
  34667. }),
  34668. $globals.ReturnNode);
  34669. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34670. $globals.SendNode.comment="I represent an message send node.";
  34671. $core.addMethod(
  34672. $core.method({
  34673. selector: "acceptDagVisitor:",
  34674. protocol: "visiting",
  34675. fn: function (aVisitor){
  34676. var self=this,$self=this;
  34677. return $core.withContext(function($ctx1) {
  34678. return $recv(aVisitor)._visitSendNode_(self);
  34679. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34680. },
  34681. args: ["aVisitor"],
  34682. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34683. referencedClasses: [],
  34684. messageSends: ["visitSendNode:"]
  34685. }),
  34686. $globals.SendNode);
  34687. $core.addMethod(
  34688. $core.method({
  34689. selector: "arguments",
  34690. protocol: "accessing",
  34691. fn: function (){
  34692. var self=this,$self=this;
  34693. return $core.withContext(function($ctx1) {
  34694. var $1,$receiver;
  34695. $1=$self["@arguments"];
  34696. if(($receiver = $1) == null || $receiver.a$nil){
  34697. $self["@arguments"]=[];
  34698. return $self["@arguments"];
  34699. } else {
  34700. return $1;
  34701. }
  34702. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34703. },
  34704. args: [],
  34705. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34706. referencedClasses: [],
  34707. messageSends: ["ifNil:"]
  34708. }),
  34709. $globals.SendNode);
  34710. $core.addMethod(
  34711. $core.method({
  34712. selector: "arguments:",
  34713. protocol: "accessing",
  34714. fn: function (aCollection){
  34715. var self=this,$self=this;
  34716. $self["@arguments"]=aCollection;
  34717. return self;
  34718. },
  34719. args: ["aCollection"],
  34720. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34721. referencedClasses: [],
  34722. messageSends: []
  34723. }),
  34724. $globals.SendNode);
  34725. $core.addMethod(
  34726. $core.method({
  34727. selector: "dagChildren",
  34728. protocol: "accessing",
  34729. fn: function (){
  34730. var self=this,$self=this;
  34731. return $core.withContext(function($ctx1) {
  34732. var $1,$2,$3,$receiver;
  34733. $1=$self._receiver();
  34734. $ctx1.sendIdx["receiver"]=1;
  34735. if(($receiver = $1) == null || $receiver.a$nil){
  34736. $2=$self._arguments();
  34737. $ctx1.sendIdx["arguments"]=1;
  34738. return $recv($2)._copy();
  34739. } else {
  34740. $1;
  34741. }
  34742. $3=$recv($globals.Array)._with_($self._receiver());
  34743. $recv($3)._addAll_($self._arguments());
  34744. return $recv($3)._yourself();
  34745. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34746. },
  34747. args: [],
  34748. 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",
  34749. referencedClasses: ["Array"],
  34750. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34751. }),
  34752. $globals.SendNode);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "index",
  34756. protocol: "accessing",
  34757. fn: function (){
  34758. var self=this,$self=this;
  34759. return $self["@index"];
  34760. },
  34761. args: [],
  34762. source: "index\x0a\x09^ index",
  34763. referencedClasses: [],
  34764. messageSends: []
  34765. }),
  34766. $globals.SendNode);
  34767. $core.addMethod(
  34768. $core.method({
  34769. selector: "index:",
  34770. protocol: "accessing",
  34771. fn: function (anInteger){
  34772. var self=this,$self=this;
  34773. $self["@index"]=anInteger;
  34774. return self;
  34775. },
  34776. args: ["anInteger"],
  34777. source: "index: anInteger\x0a\x09index := anInteger",
  34778. referencedClasses: [],
  34779. messageSends: []
  34780. }),
  34781. $globals.SendNode);
  34782. $core.addMethod(
  34783. $core.method({
  34784. selector: "isNavigationNode",
  34785. protocol: "testing",
  34786. fn: function (){
  34787. var self=this,$self=this;
  34788. return true;
  34789. },
  34790. args: [],
  34791. source: "isNavigationNode\x0a\x09^ true",
  34792. referencedClasses: [],
  34793. messageSends: []
  34794. }),
  34795. $globals.SendNode);
  34796. $core.addMethod(
  34797. $core.method({
  34798. selector: "isSendNode",
  34799. protocol: "testing",
  34800. fn: function (){
  34801. var self=this,$self=this;
  34802. return true;
  34803. },
  34804. args: [],
  34805. source: "isSendNode\x0a\x09^ true",
  34806. referencedClasses: [],
  34807. messageSends: []
  34808. }),
  34809. $globals.SendNode);
  34810. $core.addMethod(
  34811. $core.method({
  34812. selector: "navigationLink",
  34813. protocol: "accessing",
  34814. fn: function (){
  34815. var self=this,$self=this;
  34816. return $core.withContext(function($ctx1) {
  34817. return $self._selector();
  34818. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34819. },
  34820. args: [],
  34821. source: "navigationLink\x0a\x09^ self selector",
  34822. referencedClasses: [],
  34823. messageSends: ["selector"]
  34824. }),
  34825. $globals.SendNode);
  34826. $core.addMethod(
  34827. $core.method({
  34828. selector: "receiver",
  34829. protocol: "accessing",
  34830. fn: function (){
  34831. var self=this,$self=this;
  34832. return $self["@receiver"];
  34833. },
  34834. args: [],
  34835. source: "receiver\x0a\x09^ receiver",
  34836. referencedClasses: [],
  34837. messageSends: []
  34838. }),
  34839. $globals.SendNode);
  34840. $core.addMethod(
  34841. $core.method({
  34842. selector: "receiver:",
  34843. protocol: "accessing",
  34844. fn: function (aNode){
  34845. var self=this,$self=this;
  34846. $self["@receiver"]=aNode;
  34847. return self;
  34848. },
  34849. args: ["aNode"],
  34850. source: "receiver: aNode\x0a\x09receiver := aNode",
  34851. referencedClasses: [],
  34852. messageSends: []
  34853. }),
  34854. $globals.SendNode);
  34855. $core.addMethod(
  34856. $core.method({
  34857. selector: "requiresSmalltalkContext",
  34858. protocol: "testing",
  34859. fn: function (){
  34860. var self=this,$self=this;
  34861. return true;
  34862. },
  34863. args: [],
  34864. source: "requiresSmalltalkContext\x0a\x09^ true",
  34865. referencedClasses: [],
  34866. messageSends: []
  34867. }),
  34868. $globals.SendNode);
  34869. $core.addMethod(
  34870. $core.method({
  34871. selector: "selector",
  34872. protocol: "accessing",
  34873. fn: function (){
  34874. var self=this,$self=this;
  34875. return $self["@selector"];
  34876. },
  34877. args: [],
  34878. source: "selector\x0a\x09^ selector",
  34879. referencedClasses: [],
  34880. messageSends: []
  34881. }),
  34882. $globals.SendNode);
  34883. $core.addMethod(
  34884. $core.method({
  34885. selector: "selector:",
  34886. protocol: "accessing",
  34887. fn: function (aString){
  34888. var self=this,$self=this;
  34889. $self["@selector"]=aString;
  34890. return self;
  34891. },
  34892. args: ["aString"],
  34893. source: "selector: aString\x0a\x09selector := aString",
  34894. referencedClasses: [],
  34895. messageSends: []
  34896. }),
  34897. $globals.SendNode);
  34898. $core.addMethod(
  34899. $core.method({
  34900. selector: "shouldBeInlined",
  34901. protocol: "accessing",
  34902. fn: function (){
  34903. var self=this,$self=this;
  34904. return $core.withContext(function($ctx1) {
  34905. var $1,$receiver;
  34906. $1=$self["@shouldBeInlined"];
  34907. if(($receiver = $1) == null || $receiver.a$nil){
  34908. return false;
  34909. } else {
  34910. return $1;
  34911. }
  34912. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34913. },
  34914. args: [],
  34915. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34916. referencedClasses: [],
  34917. messageSends: ["ifNil:"]
  34918. }),
  34919. $globals.SendNode);
  34920. $core.addMethod(
  34921. $core.method({
  34922. selector: "shouldBeInlined:",
  34923. protocol: "accessing",
  34924. fn: function (aBoolean){
  34925. var self=this,$self=this;
  34926. $self["@shouldBeInlined"]=aBoolean;
  34927. return self;
  34928. },
  34929. args: ["aBoolean"],
  34930. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34931. referencedClasses: [],
  34932. messageSends: []
  34933. }),
  34934. $globals.SendNode);
  34935. $core.addMethod(
  34936. $core.method({
  34937. selector: "superSend",
  34938. protocol: "accessing",
  34939. fn: function (){
  34940. var self=this,$self=this;
  34941. return $core.withContext(function($ctx1) {
  34942. var $2,$1;
  34943. $2=$self._receiver();
  34944. $ctx1.sendIdx["receiver"]=1;
  34945. $1=$recv($2)._notNil();
  34946. return $recv($1)._and_((function(){
  34947. return $core.withContext(function($ctx2) {
  34948. return $recv($self._receiver())._isSuperKeyword();
  34949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34950. }));
  34951. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34952. },
  34953. args: [],
  34954. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34955. referencedClasses: [],
  34956. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34957. }),
  34958. $globals.SendNode);
  34959. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34960. $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).";
  34961. $core.addMethod(
  34962. $core.method({
  34963. selector: "acceptDagVisitor:",
  34964. protocol: "visiting",
  34965. fn: function (aVisitor){
  34966. var self=this,$self=this;
  34967. return $core.withContext(function($ctx1) {
  34968. return $recv(aVisitor)._visitSequenceNode_(self);
  34969. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34970. },
  34971. args: ["aVisitor"],
  34972. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34973. referencedClasses: [],
  34974. messageSends: ["visitSequenceNode:"]
  34975. }),
  34976. $globals.SequenceNode);
  34977. $core.addMethod(
  34978. $core.method({
  34979. selector: "asBlockSequenceNode",
  34980. protocol: "building",
  34981. fn: function (){
  34982. var self=this,$self=this;
  34983. return $core.withContext(function($ctx1) {
  34984. var $1;
  34985. $1=$recv($globals.BlockSequenceNode)._new();
  34986. $recv($1)._position_($self._position());
  34987. $recv($1)._source_($self._source());
  34988. $recv($1)._dagChildren_($self._dagChildren());
  34989. $recv($1)._temps_($self._temps());
  34990. $recv($1)._pragmas_($self._pragmas());
  34991. return $recv($1)._yourself();
  34992. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34993. },
  34994. args: [],
  34995. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  34996. referencedClasses: ["BlockSequenceNode"],
  34997. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34998. }),
  34999. $globals.SequenceNode);
  35000. $core.addMethod(
  35001. $core.method({
  35002. selector: "isSequenceNode",
  35003. protocol: "testing",
  35004. fn: function (){
  35005. var self=this,$self=this;
  35006. return true;
  35007. },
  35008. args: [],
  35009. source: "isSequenceNode\x0a\x09^ true",
  35010. referencedClasses: [],
  35011. messageSends: []
  35012. }),
  35013. $globals.SequenceNode);
  35014. $core.addMethod(
  35015. $core.method({
  35016. selector: "pragmas",
  35017. protocol: "accessing",
  35018. fn: function (){
  35019. var self=this,$self=this;
  35020. return $core.withContext(function($ctx1) {
  35021. var $1,$receiver;
  35022. $1=$self["@pragmas"];
  35023. if(($receiver = $1) == null || $receiver.a$nil){
  35024. return [];
  35025. } else {
  35026. return $1;
  35027. }
  35028. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  35029. },
  35030. args: [],
  35031. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  35032. referencedClasses: [],
  35033. messageSends: ["ifNil:"]
  35034. }),
  35035. $globals.SequenceNode);
  35036. $core.addMethod(
  35037. $core.method({
  35038. selector: "pragmas:",
  35039. protocol: "accessing",
  35040. fn: function (aCollection){
  35041. var self=this,$self=this;
  35042. $self["@pragmas"]=aCollection;
  35043. return self;
  35044. },
  35045. args: ["aCollection"],
  35046. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  35047. referencedClasses: [],
  35048. messageSends: []
  35049. }),
  35050. $globals.SequenceNode);
  35051. $core.addMethod(
  35052. $core.method({
  35053. selector: "scope",
  35054. protocol: "accessing",
  35055. fn: function (){
  35056. var self=this,$self=this;
  35057. return $self["@scope"];
  35058. },
  35059. args: [],
  35060. source: "scope\x0a\x09^ scope",
  35061. referencedClasses: [],
  35062. messageSends: []
  35063. }),
  35064. $globals.SequenceNode);
  35065. $core.addMethod(
  35066. $core.method({
  35067. selector: "scope:",
  35068. protocol: "accessing",
  35069. fn: function (aLexicalScope){
  35070. var self=this,$self=this;
  35071. $self["@scope"]=aLexicalScope;
  35072. return self;
  35073. },
  35074. args: ["aLexicalScope"],
  35075. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35076. referencedClasses: [],
  35077. messageSends: []
  35078. }),
  35079. $globals.SequenceNode);
  35080. $core.addMethod(
  35081. $core.method({
  35082. selector: "temps",
  35083. protocol: "accessing",
  35084. fn: function (){
  35085. var self=this,$self=this;
  35086. return $core.withContext(function($ctx1) {
  35087. var $1,$receiver;
  35088. $1=$self["@temps"];
  35089. if(($receiver = $1) == null || $receiver.a$nil){
  35090. return [];
  35091. } else {
  35092. return $1;
  35093. }
  35094. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35095. },
  35096. args: [],
  35097. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35098. referencedClasses: [],
  35099. messageSends: ["ifNil:"]
  35100. }),
  35101. $globals.SequenceNode);
  35102. $core.addMethod(
  35103. $core.method({
  35104. selector: "temps:",
  35105. protocol: "accessing",
  35106. fn: function (aCollection){
  35107. var self=this,$self=this;
  35108. $self["@temps"]=aCollection;
  35109. return self;
  35110. },
  35111. args: ["aCollection"],
  35112. source: "temps: aCollection\x0a\x09temps := aCollection",
  35113. referencedClasses: [],
  35114. messageSends: []
  35115. }),
  35116. $globals.SequenceNode);
  35117. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35118. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35119. $core.addMethod(
  35120. $core.method({
  35121. selector: "acceptDagVisitor:",
  35122. protocol: "visiting",
  35123. fn: function (aVisitor){
  35124. var self=this,$self=this;
  35125. return $core.withContext(function($ctx1) {
  35126. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35127. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35128. },
  35129. args: ["aVisitor"],
  35130. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35131. referencedClasses: [],
  35132. messageSends: ["visitBlockSequenceNode:"]
  35133. }),
  35134. $globals.BlockSequenceNode);
  35135. $core.addMethod(
  35136. $core.method({
  35137. selector: "isBlockSequenceNode",
  35138. protocol: "testing",
  35139. fn: function (){
  35140. var self=this,$self=this;
  35141. return true;
  35142. },
  35143. args: [],
  35144. source: "isBlockSequenceNode\x0a\x09^ true",
  35145. referencedClasses: [],
  35146. messageSends: []
  35147. }),
  35148. $globals.BlockSequenceNode);
  35149. $core.addMethod(
  35150. $core.method({
  35151. selector: "pragmas:",
  35152. protocol: "visiting",
  35153. fn: function (aCollection){
  35154. var self=this,$self=this;
  35155. return $core.withContext(function($ctx1) {
  35156. var $1;
  35157. $recv(aCollection)._ifNotEmpty_((function(){
  35158. return $core.withContext(function($ctx2) {
  35159. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  35160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35161. }));
  35162. $1=(
  35163. $ctx1.supercall = true,
  35164. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  35165. $ctx1.supercall = false;
  35166. return $1;
  35167. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  35168. },
  35169. args: ["aCollection"],
  35170. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  35171. referencedClasses: ["CompilerError"],
  35172. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  35173. }),
  35174. $globals.BlockSequenceNode);
  35175. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35176. $globals.ValueNode.comment="I represent a value node.";
  35177. $core.addMethod(
  35178. $core.method({
  35179. selector: "acceptDagVisitor:",
  35180. protocol: "visiting",
  35181. fn: function (aVisitor){
  35182. var self=this,$self=this;
  35183. return $core.withContext(function($ctx1) {
  35184. return $recv(aVisitor)._visitValueNode_(self);
  35185. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35186. },
  35187. args: ["aVisitor"],
  35188. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35189. referencedClasses: [],
  35190. messageSends: ["visitValueNode:"]
  35191. }),
  35192. $globals.ValueNode);
  35193. $core.addMethod(
  35194. $core.method({
  35195. selector: "isImmutable",
  35196. protocol: "testing",
  35197. fn: function (){
  35198. var self=this,$self=this;
  35199. return $core.withContext(function($ctx1) {
  35200. return $recv($self._value())._isImmutable();
  35201. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35202. },
  35203. args: [],
  35204. source: "isImmutable\x0a\x09^ self value isImmutable",
  35205. referencedClasses: [],
  35206. messageSends: ["isImmutable", "value"]
  35207. }),
  35208. $globals.ValueNode);
  35209. $core.addMethod(
  35210. $core.method({
  35211. selector: "isValueNode",
  35212. protocol: "testing",
  35213. fn: function (){
  35214. var self=this,$self=this;
  35215. return true;
  35216. },
  35217. args: [],
  35218. source: "isValueNode\x0a\x09^ true",
  35219. referencedClasses: [],
  35220. messageSends: []
  35221. }),
  35222. $globals.ValueNode);
  35223. $core.addMethod(
  35224. $core.method({
  35225. selector: "value",
  35226. protocol: "accessing",
  35227. fn: function (){
  35228. var self=this,$self=this;
  35229. return $self["@value"];
  35230. },
  35231. args: [],
  35232. source: "value\x0a\x09^ value",
  35233. referencedClasses: [],
  35234. messageSends: []
  35235. }),
  35236. $globals.ValueNode);
  35237. $core.addMethod(
  35238. $core.method({
  35239. selector: "value:",
  35240. protocol: "accessing",
  35241. fn: function (anObject){
  35242. var self=this,$self=this;
  35243. $self["@value"]=anObject;
  35244. return self;
  35245. },
  35246. args: ["anObject"],
  35247. source: "value: anObject\x0a\x09value := anObject",
  35248. referencedClasses: [],
  35249. messageSends: []
  35250. }),
  35251. $globals.ValueNode);
  35252. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35253. $globals.VariableNode.comment="I represent an variable node.";
  35254. $core.addMethod(
  35255. $core.method({
  35256. selector: "acceptDagVisitor:",
  35257. protocol: "visiting",
  35258. fn: function (aVisitor){
  35259. var self=this,$self=this;
  35260. return $core.withContext(function($ctx1) {
  35261. return $recv(aVisitor)._visitVariableNode_(self);
  35262. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35263. },
  35264. args: ["aVisitor"],
  35265. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35266. referencedClasses: [],
  35267. messageSends: ["visitVariableNode:"]
  35268. }),
  35269. $globals.VariableNode);
  35270. $core.addMethod(
  35271. $core.method({
  35272. selector: "alias",
  35273. protocol: "accessing",
  35274. fn: function (){
  35275. var self=this,$self=this;
  35276. return $core.withContext(function($ctx1) {
  35277. return $recv($self._binding())._alias();
  35278. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35279. },
  35280. args: [],
  35281. source: "alias\x0a\x09^ self binding alias",
  35282. referencedClasses: [],
  35283. messageSends: ["alias", "binding"]
  35284. }),
  35285. $globals.VariableNode);
  35286. $core.addMethod(
  35287. $core.method({
  35288. selector: "assigned",
  35289. protocol: "accessing",
  35290. fn: function (){
  35291. var self=this,$self=this;
  35292. return $core.withContext(function($ctx1) {
  35293. var $1,$receiver;
  35294. $1=$self["@assigned"];
  35295. if(($receiver = $1) == null || $receiver.a$nil){
  35296. return false;
  35297. } else {
  35298. return $1;
  35299. }
  35300. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35301. },
  35302. args: [],
  35303. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35304. referencedClasses: [],
  35305. messageSends: ["ifNil:"]
  35306. }),
  35307. $globals.VariableNode);
  35308. $core.addMethod(
  35309. $core.method({
  35310. selector: "assigned:",
  35311. protocol: "accessing",
  35312. fn: function (aBoolean){
  35313. var self=this,$self=this;
  35314. $self["@assigned"]=aBoolean;
  35315. return self;
  35316. },
  35317. args: ["aBoolean"],
  35318. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35319. referencedClasses: [],
  35320. messageSends: []
  35321. }),
  35322. $globals.VariableNode);
  35323. $core.addMethod(
  35324. $core.method({
  35325. selector: "beAssigned",
  35326. protocol: "accessing",
  35327. fn: function (){
  35328. var self=this,$self=this;
  35329. return $core.withContext(function($ctx1) {
  35330. $recv($self._binding())._validateAssignment();
  35331. $self["@assigned"]=true;
  35332. return self;
  35333. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35334. },
  35335. args: [],
  35336. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35337. referencedClasses: [],
  35338. messageSends: ["validateAssignment", "binding"]
  35339. }),
  35340. $globals.VariableNode);
  35341. $core.addMethod(
  35342. $core.method({
  35343. selector: "binding",
  35344. protocol: "accessing",
  35345. fn: function (){
  35346. var self=this,$self=this;
  35347. return $self["@binding"];
  35348. },
  35349. args: [],
  35350. source: "binding\x0a\x09^ binding",
  35351. referencedClasses: [],
  35352. messageSends: []
  35353. }),
  35354. $globals.VariableNode);
  35355. $core.addMethod(
  35356. $core.method({
  35357. selector: "binding:",
  35358. protocol: "accessing",
  35359. fn: function (aScopeVar){
  35360. var self=this,$self=this;
  35361. $self["@binding"]=aScopeVar;
  35362. return self;
  35363. },
  35364. args: ["aScopeVar"],
  35365. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35366. referencedClasses: [],
  35367. messageSends: []
  35368. }),
  35369. $globals.VariableNode);
  35370. $core.addMethod(
  35371. $core.method({
  35372. selector: "isArgument",
  35373. protocol: "testing",
  35374. fn: function (){
  35375. var self=this,$self=this;
  35376. return $core.withContext(function($ctx1) {
  35377. return $recv($self._binding())._isArgVar();
  35378. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35379. },
  35380. args: [],
  35381. source: "isArgument\x0a\x09^ self binding isArgVar",
  35382. referencedClasses: [],
  35383. messageSends: ["isArgVar", "binding"]
  35384. }),
  35385. $globals.VariableNode);
  35386. $core.addMethod(
  35387. $core.method({
  35388. selector: "isImmutable",
  35389. protocol: "testing",
  35390. fn: function (){
  35391. var self=this,$self=this;
  35392. return $core.withContext(function($ctx1) {
  35393. return $recv($self._binding())._isImmutable();
  35394. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35395. },
  35396. args: [],
  35397. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35398. referencedClasses: [],
  35399. messageSends: ["isImmutable", "binding"]
  35400. }),
  35401. $globals.VariableNode);
  35402. $core.addMethod(
  35403. $core.method({
  35404. selector: "isNavigationNode",
  35405. protocol: "testing",
  35406. fn: function (){
  35407. var self=this,$self=this;
  35408. return true;
  35409. },
  35410. args: [],
  35411. source: "isNavigationNode\x0a\x09^ true",
  35412. referencedClasses: [],
  35413. messageSends: []
  35414. }),
  35415. $globals.VariableNode);
  35416. $core.addMethod(
  35417. $core.method({
  35418. selector: "isSuperKeyword",
  35419. protocol: "testing",
  35420. fn: function (){
  35421. var self=this,$self=this;
  35422. return $core.withContext(function($ctx1) {
  35423. return $recv($self._value()).__eq("super");
  35424. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35425. },
  35426. args: [],
  35427. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35428. referencedClasses: [],
  35429. messageSends: ["=", "value"]
  35430. }),
  35431. $globals.VariableNode);
  35432. $core.addMethod(
  35433. $core.method({
  35434. selector: "isVariableNode",
  35435. protocol: "testing",
  35436. fn: function (){
  35437. var self=this,$self=this;
  35438. return true;
  35439. },
  35440. args: [],
  35441. source: "isVariableNode\x0a\x09^ true",
  35442. referencedClasses: [],
  35443. messageSends: []
  35444. }),
  35445. $globals.VariableNode);
  35446. $core.addMethod(
  35447. $core.method({
  35448. selector: "navigationLink",
  35449. protocol: "accessing",
  35450. fn: function (){
  35451. var self=this,$self=this;
  35452. return $core.withContext(function($ctx1) {
  35453. return $self._value();
  35454. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35455. },
  35456. args: [],
  35457. source: "navigationLink\x0a\x09^ self value",
  35458. referencedClasses: [],
  35459. messageSends: ["value"]
  35460. }),
  35461. $globals.VariableNode);
  35462. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35463. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35464. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35465. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35466. $core.addMethod(
  35467. $core.method({
  35468. selector: "visit:",
  35469. protocol: "visiting",
  35470. fn: function (aNode){
  35471. var self=this,$self=this;
  35472. return $core.withContext(function($ctx1) {
  35473. var $1;
  35474. $recv($self._path())._ifNotEmpty_((function(p){
  35475. return $core.withContext(function($ctx2) {
  35476. return $recv(aNode)._parent_($recv(p)._last());
  35477. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35478. }));
  35479. $1=(
  35480. $ctx1.supercall = true,
  35481. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35482. $ctx1.supercall = false;
  35483. return $1;
  35484. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35485. },
  35486. args: ["aNode"],
  35487. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35488. referencedClasses: [],
  35489. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35490. }),
  35491. $globals.ParentFakingPathDagVisitor);
  35492. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35493. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35494. $core.addMethod(
  35495. $core.method({
  35496. selector: "visitAssignmentNode:",
  35497. protocol: "visiting",
  35498. fn: function (aNode){
  35499. var self=this,$self=this;
  35500. return $core.withContext(function($ctx1) {
  35501. return $self._visitDagNode_(aNode);
  35502. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35503. },
  35504. args: ["aNode"],
  35505. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35506. referencedClasses: [],
  35507. messageSends: ["visitDagNode:"]
  35508. }),
  35509. $globals.NodeVisitor);
  35510. $core.addMethod(
  35511. $core.method({
  35512. selector: "visitBlockNode:",
  35513. protocol: "visiting",
  35514. fn: function (aNode){
  35515. var self=this,$self=this;
  35516. return $core.withContext(function($ctx1) {
  35517. return $self._visitDagNode_(aNode);
  35518. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35519. },
  35520. args: ["aNode"],
  35521. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35522. referencedClasses: [],
  35523. messageSends: ["visitDagNode:"]
  35524. }),
  35525. $globals.NodeVisitor);
  35526. $core.addMethod(
  35527. $core.method({
  35528. selector: "visitBlockSequenceNode:",
  35529. protocol: "visiting",
  35530. fn: function (aNode){
  35531. var self=this,$self=this;
  35532. return $core.withContext(function($ctx1) {
  35533. return $self._visitSequenceNode_(aNode);
  35534. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35535. },
  35536. args: ["aNode"],
  35537. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35538. referencedClasses: [],
  35539. messageSends: ["visitSequenceNode:"]
  35540. }),
  35541. $globals.NodeVisitor);
  35542. $core.addMethod(
  35543. $core.method({
  35544. selector: "visitCascadeNode:",
  35545. protocol: "visiting",
  35546. fn: function (aNode){
  35547. var self=this,$self=this;
  35548. return $core.withContext(function($ctx1) {
  35549. return $self._visitDagNode_(aNode);
  35550. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35551. },
  35552. args: ["aNode"],
  35553. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35554. referencedClasses: [],
  35555. messageSends: ["visitDagNode:"]
  35556. }),
  35557. $globals.NodeVisitor);
  35558. $core.addMethod(
  35559. $core.method({
  35560. selector: "visitDagNode:",
  35561. protocol: "visiting",
  35562. fn: function (aNode){
  35563. var self=this,$self=this;
  35564. return $core.withContext(function($ctx1) {
  35565. return $self._visitDagNodeVariantSimple_(aNode);
  35566. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35567. },
  35568. args: ["aNode"],
  35569. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35570. referencedClasses: [],
  35571. messageSends: ["visitDagNodeVariantSimple:"]
  35572. }),
  35573. $globals.NodeVisitor);
  35574. $core.addMethod(
  35575. $core.method({
  35576. selector: "visitDynamicArrayNode:",
  35577. protocol: "visiting",
  35578. fn: function (aNode){
  35579. var self=this,$self=this;
  35580. return $core.withContext(function($ctx1) {
  35581. return $self._visitDagNode_(aNode);
  35582. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35583. },
  35584. args: ["aNode"],
  35585. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35586. referencedClasses: [],
  35587. messageSends: ["visitDagNode:"]
  35588. }),
  35589. $globals.NodeVisitor);
  35590. $core.addMethod(
  35591. $core.method({
  35592. selector: "visitDynamicDictionaryNode:",
  35593. protocol: "visiting",
  35594. fn: function (aNode){
  35595. var self=this,$self=this;
  35596. return $core.withContext(function($ctx1) {
  35597. return $self._visitDagNode_(aNode);
  35598. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35599. },
  35600. args: ["aNode"],
  35601. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35602. referencedClasses: [],
  35603. messageSends: ["visitDagNode:"]
  35604. }),
  35605. $globals.NodeVisitor);
  35606. $core.addMethod(
  35607. $core.method({
  35608. selector: "visitJSStatementNode:",
  35609. protocol: "visiting",
  35610. fn: function (aNode){
  35611. var self=this,$self=this;
  35612. return $core.withContext(function($ctx1) {
  35613. return $self._visitDagNode_(aNode);
  35614. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35615. },
  35616. args: ["aNode"],
  35617. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35618. referencedClasses: [],
  35619. messageSends: ["visitDagNode:"]
  35620. }),
  35621. $globals.NodeVisitor);
  35622. $core.addMethod(
  35623. $core.method({
  35624. selector: "visitMethodNode:",
  35625. protocol: "visiting",
  35626. fn: function (aNode){
  35627. var self=this,$self=this;
  35628. return $core.withContext(function($ctx1) {
  35629. return $self._visitDagNode_(aNode);
  35630. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35631. },
  35632. args: ["aNode"],
  35633. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35634. referencedClasses: [],
  35635. messageSends: ["visitDagNode:"]
  35636. }),
  35637. $globals.NodeVisitor);
  35638. $core.addMethod(
  35639. $core.method({
  35640. selector: "visitReturnNode:",
  35641. protocol: "visiting",
  35642. fn: function (aNode){
  35643. var self=this,$self=this;
  35644. return $core.withContext(function($ctx1) {
  35645. return $self._visitDagNode_(aNode);
  35646. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35647. },
  35648. args: ["aNode"],
  35649. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35650. referencedClasses: [],
  35651. messageSends: ["visitDagNode:"]
  35652. }),
  35653. $globals.NodeVisitor);
  35654. $core.addMethod(
  35655. $core.method({
  35656. selector: "visitSendNode:",
  35657. protocol: "visiting",
  35658. fn: function (aNode){
  35659. var self=this,$self=this;
  35660. return $core.withContext(function($ctx1) {
  35661. return $self._visitDagNode_(aNode);
  35662. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35663. },
  35664. args: ["aNode"],
  35665. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35666. referencedClasses: [],
  35667. messageSends: ["visitDagNode:"]
  35668. }),
  35669. $globals.NodeVisitor);
  35670. $core.addMethod(
  35671. $core.method({
  35672. selector: "visitSequenceNode:",
  35673. protocol: "visiting",
  35674. fn: function (aNode){
  35675. var self=this,$self=this;
  35676. return $core.withContext(function($ctx1) {
  35677. return $self._visitDagNode_(aNode);
  35678. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35679. },
  35680. args: ["aNode"],
  35681. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35682. referencedClasses: [],
  35683. messageSends: ["visitDagNode:"]
  35684. }),
  35685. $globals.NodeVisitor);
  35686. $core.addMethod(
  35687. $core.method({
  35688. selector: "visitValueNode:",
  35689. protocol: "visiting",
  35690. fn: function (aNode){
  35691. var self=this,$self=this;
  35692. return $core.withContext(function($ctx1) {
  35693. return $self._visitDagNode_(aNode);
  35694. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35695. },
  35696. args: ["aNode"],
  35697. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35698. referencedClasses: [],
  35699. messageSends: ["visitDagNode:"]
  35700. }),
  35701. $globals.NodeVisitor);
  35702. $core.addMethod(
  35703. $core.method({
  35704. selector: "visitVariableNode:",
  35705. protocol: "visiting",
  35706. fn: function (aNode){
  35707. var self=this,$self=this;
  35708. return $core.withContext(function($ctx1) {
  35709. return $self._visitDagNode_(aNode);
  35710. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35711. },
  35712. args: ["aNode"],
  35713. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35714. referencedClasses: [],
  35715. messageSends: ["visitDagNode:"]
  35716. }),
  35717. $globals.NodeVisitor);
  35718. $core.addMethod(
  35719. $core.method({
  35720. selector: "ast",
  35721. protocol: "*Compiler-AST",
  35722. fn: function (){
  35723. var self=this,$self=this;
  35724. return $core.withContext(function($ctx1) {
  35725. var $1;
  35726. $1=$self._source();
  35727. $ctx1.sendIdx["source"]=1;
  35728. $recv($1)._ifEmpty_((function(){
  35729. return $core.withContext(function($ctx2) {
  35730. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35732. }));
  35733. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35734. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35735. },
  35736. args: [],
  35737. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35738. referencedClasses: ["CompilerError", "Compiler"],
  35739. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35740. }),
  35741. $globals.CompiledMethod);
  35742. });
  35743. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35744. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35745. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35746. $core.addPackage("Compiler-Core");
  35747. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  35748. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35749. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35750. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35751. $core.addMethod(
  35752. $core.method({
  35753. selector: "compileNode:",
  35754. protocol: "compiling",
  35755. fn: function (aNode){
  35756. var self=this,$self=this;
  35757. return $core.withContext(function($ctx1) {
  35758. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35759. return $core.withContext(function($ctx2) {
  35760. return $recv(transformer)._value_(input);
  35761. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35762. }));
  35763. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35764. },
  35765. args: ["aNode"],
  35766. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35767. referencedClasses: [],
  35768. messageSends: ["inject:into:", "transformers", "value:"]
  35769. }),
  35770. $globals.AbstractCodeGenerator);
  35771. $core.addMethod(
  35772. $core.method({
  35773. selector: "currentClass",
  35774. protocol: "accessing",
  35775. fn: function (){
  35776. var self=this,$self=this;
  35777. return $self["@currentClass"];
  35778. },
  35779. args: [],
  35780. source: "currentClass\x0a\x09^ currentClass",
  35781. referencedClasses: [],
  35782. messageSends: []
  35783. }),
  35784. $globals.AbstractCodeGenerator);
  35785. $core.addMethod(
  35786. $core.method({
  35787. selector: "currentClass:",
  35788. protocol: "accessing",
  35789. fn: function (aClass){
  35790. var self=this,$self=this;
  35791. $self["@currentClass"]=aClass;
  35792. return self;
  35793. },
  35794. args: ["aClass"],
  35795. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35796. referencedClasses: [],
  35797. messageSends: []
  35798. }),
  35799. $globals.AbstractCodeGenerator);
  35800. $core.addMethod(
  35801. $core.method({
  35802. selector: "currentPackage",
  35803. protocol: "accessing",
  35804. fn: function (){
  35805. var self=this,$self=this;
  35806. return $self["@currentPackage"];
  35807. },
  35808. args: [],
  35809. source: "currentPackage\x0a\x09^ currentPackage",
  35810. referencedClasses: [],
  35811. messageSends: []
  35812. }),
  35813. $globals.AbstractCodeGenerator);
  35814. $core.addMethod(
  35815. $core.method({
  35816. selector: "currentPackage:",
  35817. protocol: "accessing",
  35818. fn: function (anObject){
  35819. var self=this,$self=this;
  35820. $self["@currentPackage"]=anObject;
  35821. return self;
  35822. },
  35823. args: ["anObject"],
  35824. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35825. referencedClasses: [],
  35826. messageSends: []
  35827. }),
  35828. $globals.AbstractCodeGenerator);
  35829. $core.addMethod(
  35830. $core.method({
  35831. selector: "pseudoVariables",
  35832. protocol: "accessing",
  35833. fn: function (){
  35834. var self=this,$self=this;
  35835. return $core.withContext(function($ctx1) {
  35836. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35837. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35838. },
  35839. args: [],
  35840. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35841. referencedClasses: ["Smalltalk"],
  35842. messageSends: ["pseudoVariableNames"]
  35843. }),
  35844. $globals.AbstractCodeGenerator);
  35845. $core.addMethod(
  35846. $core.method({
  35847. selector: "source",
  35848. protocol: "accessing",
  35849. fn: function (){
  35850. var self=this,$self=this;
  35851. return $core.withContext(function($ctx1) {
  35852. var $1,$receiver;
  35853. $1=$self["@source"];
  35854. if(($receiver = $1) == null || $receiver.a$nil){
  35855. return "";
  35856. } else {
  35857. return $1;
  35858. }
  35859. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35860. },
  35861. args: [],
  35862. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35863. referencedClasses: [],
  35864. messageSends: ["ifNil:"]
  35865. }),
  35866. $globals.AbstractCodeGenerator);
  35867. $core.addMethod(
  35868. $core.method({
  35869. selector: "source:",
  35870. protocol: "accessing",
  35871. fn: function (aString){
  35872. var self=this,$self=this;
  35873. $self["@source"]=aString;
  35874. return self;
  35875. },
  35876. args: ["aString"],
  35877. source: "source: aString\x0a\x09source := aString",
  35878. referencedClasses: [],
  35879. messageSends: []
  35880. }),
  35881. $globals.AbstractCodeGenerator);
  35882. $core.addMethod(
  35883. $core.method({
  35884. selector: "transformers",
  35885. protocol: "compiling",
  35886. fn: function (){
  35887. var self=this,$self=this;
  35888. var dict;
  35889. return $core.withContext(function($ctx1) {
  35890. dict=$self._transformersDictionary();
  35891. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35892. return $core.withContext(function($ctx2) {
  35893. return $recv(dict)._at_(each);
  35894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35895. }));
  35896. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35897. },
  35898. args: [],
  35899. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35900. referencedClasses: [],
  35901. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35902. }),
  35903. $globals.AbstractCodeGenerator);
  35904. $core.addMethod(
  35905. $core.method({
  35906. selector: "transformersDictionary",
  35907. protocol: "compiling",
  35908. fn: function (){
  35909. var self=this,$self=this;
  35910. return $core.withContext(function($ctx1) {
  35911. $self._subclassResponsibility();
  35912. return self;
  35913. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35914. },
  35915. args: [],
  35916. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35917. referencedClasses: [],
  35918. messageSends: ["subclassResponsibility"]
  35919. }),
  35920. $globals.AbstractCodeGenerator);
  35921. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35922. $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.";
  35923. $core.addMethod(
  35924. $core.method({
  35925. selector: "irTranslator",
  35926. protocol: "compiling",
  35927. fn: function (){
  35928. var self=this,$self=this;
  35929. return $core.withContext(function($ctx1) {
  35930. var $1;
  35931. $1=$recv($self._irTranslatorClass())._new();
  35932. $recv($1)._currentClass_($self._currentClass());
  35933. return $recv($1)._yourself();
  35934. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35935. },
  35936. args: [],
  35937. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35938. referencedClasses: [],
  35939. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35940. }),
  35941. $globals.CodeGenerator);
  35942. $core.addMethod(
  35943. $core.method({
  35944. selector: "irTranslatorClass",
  35945. protocol: "compiling",
  35946. fn: function (){
  35947. var self=this,$self=this;
  35948. return $globals.IRJSTranslator;
  35949. },
  35950. args: [],
  35951. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35952. referencedClasses: ["IRJSTranslator"],
  35953. messageSends: []
  35954. }),
  35955. $globals.CodeGenerator);
  35956. $core.addMethod(
  35957. $core.method({
  35958. selector: "semanticAnalyzer",
  35959. protocol: "compiling",
  35960. fn: function (){
  35961. var self=this,$self=this;
  35962. return $core.withContext(function($ctx1) {
  35963. var $1;
  35964. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35965. $recv($1)._thePackage_($self._currentPackage());
  35966. return $recv($1)._yourself();
  35967. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35968. },
  35969. args: [],
  35970. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35971. referencedClasses: ["SemanticAnalyzer"],
  35972. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35973. }),
  35974. $globals.CodeGenerator);
  35975. $core.addMethod(
  35976. $core.method({
  35977. selector: "transformersDictionary",
  35978. protocol: "compiling",
  35979. fn: function (){
  35980. var self=this,$self=this;
  35981. return $core.withContext(function($ctx1) {
  35982. var $1,$2,$receiver;
  35983. $1=$self["@transformersDictionary"];
  35984. if(($receiver = $1) == null || $receiver.a$nil){
  35985. $2=$recv($globals.Dictionary)._new();
  35986. $ctx1.sendIdx["new"]=1;
  35987. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35988. $ctx1.sendIdx["at:put:"]=1;
  35989. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35990. $ctx1.sendIdx["at:put:"]=2;
  35991. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35992. $ctx1.sendIdx["at:put:"]=3;
  35993. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35994. $self["@transformersDictionary"]=$recv($2)._yourself();
  35995. return $self["@transformersDictionary"];
  35996. } else {
  35997. return $1;
  35998. }
  35999. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  36000. },
  36001. args: [],
  36002. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator new;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  36003. referencedClasses: ["Dictionary", "EarlyPragmator"],
  36004. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  36005. }),
  36006. $globals.CodeGenerator);
  36007. $core.addMethod(
  36008. $core.method({
  36009. selector: "translator",
  36010. protocol: "compiling",
  36011. fn: function (){
  36012. var self=this,$self=this;
  36013. return $core.withContext(function($ctx1) {
  36014. var $1;
  36015. $1=$recv($globals.IRASTTranslator)._new();
  36016. $recv($1)._source_($self._source());
  36017. $recv($1)._theClass_($self._currentClass());
  36018. return $recv($1)._yourself();
  36019. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  36020. },
  36021. args: [],
  36022. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  36023. referencedClasses: ["IRASTTranslator"],
  36024. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  36025. }),
  36026. $globals.CodeGenerator);
  36027. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  36028. $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`";
  36029. $core.addMethod(
  36030. $core.method({
  36031. selector: "ast:forClass:protocol:",
  36032. protocol: "compiling",
  36033. fn: function (aString,aClass,anotherString){
  36034. var self=this,$self=this;
  36035. return $core.withContext(function($ctx1) {
  36036. var $early={};
  36037. try {
  36038. $self._source_(aString);
  36039. $self._forClass_protocol_(aClass,anotherString);
  36040. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  36041. throw $early=[x];
  36042. }));
  36043. $self._compileNode_($self._parse_(aString));
  36044. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  36045. return self;
  36046. }
  36047. catch(e) {if(e===$early)return e[0]; throw e}
  36048. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36049. },
  36050. args: ["aString", "aClass", "anotherString"],
  36051. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09CompilerError signal: 'AST transformation failed.'",
  36052. referencedClasses: ["CompilerError"],
  36053. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  36054. }),
  36055. $globals.Compiler);
  36056. $core.addMethod(
  36057. $core.method({
  36058. selector: "cleanCodeGenerator",
  36059. protocol: "accessing",
  36060. fn: function (){
  36061. var self=this,$self=this;
  36062. $self["@codeGenerator"]=nil;
  36063. return self;
  36064. },
  36065. args: [],
  36066. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  36067. referencedClasses: [],
  36068. messageSends: []
  36069. }),
  36070. $globals.Compiler);
  36071. $core.addMethod(
  36072. $core.method({
  36073. selector: "codeGenerator",
  36074. protocol: "accessing",
  36075. fn: function (){
  36076. var self=this,$self=this;
  36077. return $core.withContext(function($ctx1) {
  36078. var $1,$2,$receiver;
  36079. $1=$self["@codeGenerator"];
  36080. if(($receiver = $1) == null || $receiver.a$nil){
  36081. $2=$recv($self._codeGeneratorClass())._new();
  36082. $recv($2)._source_($self._source());
  36083. $recv($2)._currentClass_($self._currentClass());
  36084. $recv($2)._currentPackage_($self._currentPackage());
  36085. $self["@codeGenerator"]=$recv($2)._yourself();
  36086. return $self["@codeGenerator"];
  36087. } else {
  36088. return $1;
  36089. }
  36090. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  36091. },
  36092. args: [],
  36093. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  36094. referencedClasses: [],
  36095. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  36096. }),
  36097. $globals.Compiler);
  36098. $core.addMethod(
  36099. $core.method({
  36100. selector: "codeGeneratorClass",
  36101. protocol: "accessing",
  36102. fn: function (){
  36103. var self=this,$self=this;
  36104. return $core.withContext(function($ctx1) {
  36105. var $1,$receiver;
  36106. $1=$self["@codeGeneratorClass"];
  36107. if(($receiver = $1) == null || $receiver.a$nil){
  36108. return $globals.InliningCodeGenerator;
  36109. } else {
  36110. return $1;
  36111. }
  36112. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  36113. },
  36114. args: [],
  36115. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  36116. referencedClasses: ["InliningCodeGenerator"],
  36117. messageSends: ["ifNil:"]
  36118. }),
  36119. $globals.Compiler);
  36120. $core.addMethod(
  36121. $core.method({
  36122. selector: "codeGeneratorClass:",
  36123. protocol: "accessing",
  36124. fn: function (aClass){
  36125. var self=this,$self=this;
  36126. $self["@codeGeneratorClass"]=aClass;
  36127. return self;
  36128. },
  36129. args: ["aClass"],
  36130. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  36131. referencedClasses: [],
  36132. messageSends: []
  36133. }),
  36134. $globals.Compiler);
  36135. $core.addMethod(
  36136. $core.method({
  36137. selector: "compile:forClass:protocol:",
  36138. protocol: "compiling",
  36139. fn: function (aString,aClass,anotherString){
  36140. var self=this,$self=this;
  36141. return $core.withContext(function($ctx1) {
  36142. $self._source_(aString);
  36143. $self._forClass_protocol_(aClass,anotherString);
  36144. return $self._compileNode_($self._parse_(aString));
  36145. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36146. },
  36147. args: ["aString", "aClass", "anotherString"],
  36148. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  36149. referencedClasses: [],
  36150. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  36151. }),
  36152. $globals.Compiler);
  36153. $core.addMethod(
  36154. $core.method({
  36155. selector: "compileExpression:on:",
  36156. protocol: "compiling",
  36157. fn: function (aString,anObject){
  36158. var self=this,$self=this;
  36159. return $core.withContext(function($ctx1) {
  36160. var $1;
  36161. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  36162. $ctx1.sendIdx[","]=1;
  36163. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  36164. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  36165. },
  36166. args: ["aString", "anObject"],
  36167. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  36168. referencedClasses: [],
  36169. messageSends: ["compile:forClass:protocol:", ",", "class"]
  36170. }),
  36171. $globals.Compiler);
  36172. $core.addMethod(
  36173. $core.method({
  36174. selector: "compileNode:",
  36175. protocol: "compiling",
  36176. fn: function (aNode){
  36177. var self=this,$self=this;
  36178. var result;
  36179. return $core.withContext(function($ctx1) {
  36180. result=$recv($self._codeGenerator())._compileNode_(aNode);
  36181. $self._cleanCodeGenerator();
  36182. return result;
  36183. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  36184. },
  36185. args: ["aNode"],
  36186. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  36187. referencedClasses: [],
  36188. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  36189. }),
  36190. $globals.Compiler);
  36191. $core.addMethod(
  36192. $core.method({
  36193. selector: "currentClass",
  36194. protocol: "accessing",
  36195. fn: function (){
  36196. var self=this,$self=this;
  36197. return $self["@currentClass"];
  36198. },
  36199. args: [],
  36200. source: "currentClass\x0a\x09^ currentClass",
  36201. referencedClasses: [],
  36202. messageSends: []
  36203. }),
  36204. $globals.Compiler);
  36205. $core.addMethod(
  36206. $core.method({
  36207. selector: "currentClass:",
  36208. protocol: "accessing",
  36209. fn: function (aClass){
  36210. var self=this,$self=this;
  36211. $self["@currentClass"]=aClass;
  36212. return self;
  36213. },
  36214. args: ["aClass"],
  36215. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36216. referencedClasses: [],
  36217. messageSends: []
  36218. }),
  36219. $globals.Compiler);
  36220. $core.addMethod(
  36221. $core.method({
  36222. selector: "currentPackage",
  36223. protocol: "accessing",
  36224. fn: function (){
  36225. var self=this,$self=this;
  36226. return $self["@currentPackage"];
  36227. },
  36228. args: [],
  36229. source: "currentPackage\x0a\x09^ currentPackage",
  36230. referencedClasses: [],
  36231. messageSends: []
  36232. }),
  36233. $globals.Compiler);
  36234. $core.addMethod(
  36235. $core.method({
  36236. selector: "currentPackage:",
  36237. protocol: "accessing",
  36238. fn: function (anObject){
  36239. var self=this,$self=this;
  36240. $self["@currentPackage"]=anObject;
  36241. return self;
  36242. },
  36243. args: ["anObject"],
  36244. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36245. referencedClasses: [],
  36246. messageSends: []
  36247. }),
  36248. $globals.Compiler);
  36249. $core.addMethod(
  36250. $core.method({
  36251. selector: "eval:",
  36252. protocol: "compiling",
  36253. fn: function (aString){
  36254. var self=this,$self=this;
  36255. return $core.withContext(function($ctx1) {
  36256. return eval(aString);
  36257. return self;
  36258. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36259. },
  36260. args: ["aString"],
  36261. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36262. referencedClasses: [],
  36263. messageSends: []
  36264. }),
  36265. $globals.Compiler);
  36266. $core.addMethod(
  36267. $core.method({
  36268. selector: "eval:forPackage:",
  36269. protocol: "compiling",
  36270. fn: function (aString,aPackage){
  36271. var self=this,$self=this;
  36272. return $core.withContext(function($ctx1) {
  36273. var $receiver;
  36274. if(($receiver = aPackage) == null || $receiver.a$nil){
  36275. return $self._eval_(aString);
  36276. $ctx1.sendIdx["eval:"]=1;
  36277. } else {
  36278. return $recv(aPackage)._eval_(aString);
  36279. }
  36280. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36281. },
  36282. args: ["aString", "aPackage"],
  36283. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36284. referencedClasses: [],
  36285. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36286. }),
  36287. $globals.Compiler);
  36288. $core.addMethod(
  36289. $core.method({
  36290. selector: "evaluateExpression:",
  36291. protocol: "compiling",
  36292. fn: function (aString){
  36293. var self=this,$self=this;
  36294. return $core.withContext(function($ctx1) {
  36295. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36296. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36297. },
  36298. args: ["aString"],
  36299. 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",
  36300. referencedClasses: ["DoIt"],
  36301. messageSends: ["evaluateExpression:on:", "new"]
  36302. }),
  36303. $globals.Compiler);
  36304. $core.addMethod(
  36305. $core.method({
  36306. selector: "evaluateExpression:on:",
  36307. protocol: "compiling",
  36308. fn: function (aString,anObject){
  36309. var self=this,$self=this;
  36310. var result,method;
  36311. return $core.withContext(function($ctx1) {
  36312. var $1;
  36313. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36314. $recv(method)._protocol_("**xxxDoIt");
  36315. $1=$recv(anObject)._class();
  36316. $ctx1.sendIdx["class"]=1;
  36317. $recv($1)._addCompiledMethod_(method);
  36318. result=$recv(anObject)._xxxDoIt();
  36319. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36320. return result;
  36321. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36322. },
  36323. args: ["aString", "anObject"],
  36324. 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",
  36325. referencedClasses: [],
  36326. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36327. }),
  36328. $globals.Compiler);
  36329. $core.addMethod(
  36330. $core.method({
  36331. selector: "forClass:protocol:",
  36332. protocol: "compiling",
  36333. fn: function (aClass,anotherString){
  36334. var self=this,$self=this;
  36335. return $core.withContext(function($ctx1) {
  36336. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36337. $self._currentClass_(aClass);
  36338. return self;
  36339. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36340. },
  36341. args: ["aClass", "anotherString"],
  36342. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36343. referencedClasses: [],
  36344. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36345. }),
  36346. $globals.Compiler);
  36347. $core.addMethod(
  36348. $core.method({
  36349. selector: "install:forClass:protocol:",
  36350. protocol: "compiling",
  36351. fn: function (aString,aBehavior,anotherString){
  36352. var self=this,$self=this;
  36353. var compiledMethod;
  36354. return $core.withContext(function($ctx1) {
  36355. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36356. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36357. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36358. },
  36359. args: ["aString", "aBehavior", "anotherString"],
  36360. 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",
  36361. referencedClasses: ["ClassBuilder"],
  36362. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36363. }),
  36364. $globals.Compiler);
  36365. $core.addMethod(
  36366. $core.method({
  36367. selector: "parse:",
  36368. protocol: "compiling",
  36369. fn: function (aString){
  36370. var self=this,$self=this;
  36371. return $core.withContext(function($ctx1) {
  36372. return $recv($globals.Smalltalk)._parse_(aString);
  36373. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36374. },
  36375. args: ["aString"],
  36376. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36377. referencedClasses: ["Smalltalk"],
  36378. messageSends: ["parse:"]
  36379. }),
  36380. $globals.Compiler);
  36381. $core.addMethod(
  36382. $core.method({
  36383. selector: "parseExpression:",
  36384. protocol: "compiling",
  36385. fn: function (aString){
  36386. var self=this,$self=this;
  36387. return $core.withContext(function($ctx1) {
  36388. var $1;
  36389. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36390. $ctx1.sendIdx[","]=1;
  36391. return $self._parse_($1);
  36392. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36393. },
  36394. args: ["aString"],
  36395. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36396. referencedClasses: [],
  36397. messageSends: ["parse:", ","]
  36398. }),
  36399. $globals.Compiler);
  36400. $core.addMethod(
  36401. $core.method({
  36402. selector: "recompile:",
  36403. protocol: "compiling",
  36404. fn: function (aClass){
  36405. var self=this,$self=this;
  36406. return $core.withContext(function($ctx1) {
  36407. var $1,$2,$3,$receiver;
  36408. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36409. return $core.withContext(function($ctx2) {
  36410. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36411. $ctx2.sendIdx["="]=1;
  36412. if($core.assert($1)){
  36413. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36414. }
  36415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36416. }),"Recompiling ".__comma($recv(aClass)._name()));
  36417. $2=$recv(aClass)._theMetaClass();
  36418. if(($receiver = $2) == null || $receiver.a$nil){
  36419. $2;
  36420. } else {
  36421. var meta;
  36422. meta=$receiver;
  36423. $3=$recv(meta).__eq(aClass);
  36424. if(!$core.assert($3)){
  36425. $self._recompile_(meta);
  36426. }
  36427. }
  36428. return self;
  36429. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36430. },
  36431. args: ["aClass"],
  36432. 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 ] ]",
  36433. referencedClasses: [],
  36434. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36435. }),
  36436. $globals.Compiler);
  36437. $core.addMethod(
  36438. $core.method({
  36439. selector: "recompileAll",
  36440. protocol: "compiling",
  36441. fn: function (){
  36442. var self=this,$self=this;
  36443. return $core.withContext(function($ctx1) {
  36444. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36445. return $core.withContext(function($ctx2) {
  36446. return $self._recompile_(each);
  36447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36448. }),"Compiling all classes...");
  36449. return self;
  36450. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36451. },
  36452. args: [],
  36453. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36454. referencedClasses: ["Smalltalk"],
  36455. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36456. }),
  36457. $globals.Compiler);
  36458. $core.addMethod(
  36459. $core.method({
  36460. selector: "source",
  36461. protocol: "accessing",
  36462. fn: function (){
  36463. var self=this,$self=this;
  36464. return $core.withContext(function($ctx1) {
  36465. var $1,$receiver;
  36466. $1=$self["@source"];
  36467. if(($receiver = $1) == null || $receiver.a$nil){
  36468. return "";
  36469. } else {
  36470. return $1;
  36471. }
  36472. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36473. },
  36474. args: [],
  36475. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36476. referencedClasses: [],
  36477. messageSends: ["ifNil:"]
  36478. }),
  36479. $globals.Compiler);
  36480. $core.addMethod(
  36481. $core.method({
  36482. selector: "source:",
  36483. protocol: "accessing",
  36484. fn: function (aString){
  36485. var self=this,$self=this;
  36486. $self["@source"]=aString;
  36487. return self;
  36488. },
  36489. args: ["aString"],
  36490. source: "source: aString\x0a\x09source := aString",
  36491. referencedClasses: [],
  36492. messageSends: []
  36493. }),
  36494. $globals.Compiler);
  36495. $core.addMethod(
  36496. $core.method({
  36497. selector: "eval:",
  36498. protocol: "evaluating",
  36499. fn: function (aString){
  36500. var self=this,$self=this;
  36501. return $core.withContext(function($ctx1) {
  36502. return $recv($self._new())._eval_(aString);
  36503. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36504. },
  36505. args: ["aString"],
  36506. source: "eval: aString\x0a\x09^ self new eval: aString",
  36507. referencedClasses: [],
  36508. messageSends: ["eval:", "new"]
  36509. }),
  36510. $globals.Compiler.a$cls);
  36511. $core.addMethod(
  36512. $core.method({
  36513. selector: "recompile:",
  36514. protocol: "compiling",
  36515. fn: function (aClass){
  36516. var self=this,$self=this;
  36517. return $core.withContext(function($ctx1) {
  36518. $recv($self._new())._recompile_(aClass);
  36519. return self;
  36520. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36521. },
  36522. args: ["aClass"],
  36523. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36524. referencedClasses: [],
  36525. messageSends: ["recompile:", "new"]
  36526. }),
  36527. $globals.Compiler.a$cls);
  36528. $core.addMethod(
  36529. $core.method({
  36530. selector: "recompileAll",
  36531. protocol: "compiling",
  36532. fn: function (){
  36533. var self=this,$self=this;
  36534. return $core.withContext(function($ctx1) {
  36535. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36536. return $core.withContext(function($ctx2) {
  36537. return $self._recompile_(each);
  36538. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36539. }));
  36540. return self;
  36541. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36542. },
  36543. args: [],
  36544. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36545. referencedClasses: ["Smalltalk"],
  36546. messageSends: ["do:", "classes", "recompile:"]
  36547. }),
  36548. $globals.Compiler.a$cls);
  36549. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36550. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36551. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36552. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36553. $core.addMethod(
  36554. $core.method({
  36555. selector: "evaluate:context:",
  36556. protocol: "evaluating",
  36557. fn: function (aString,aContext){
  36558. var self=this,$self=this;
  36559. var compiler,ast;
  36560. return $core.withContext(function($ctx1) {
  36561. var $1;
  36562. var $early={};
  36563. try {
  36564. compiler=$recv($globals.Compiler)._new();
  36565. $recv((function(){
  36566. return $core.withContext(function($ctx2) {
  36567. ast=$recv(compiler)._parseExpression_(aString);
  36568. return ast;
  36569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36570. }))._on_do_($globals.Error,(function(ex){
  36571. return $core.withContext(function($ctx2) {
  36572. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36573. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36574. }));
  36575. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36576. $recv($1)._context_(aContext);
  36577. $recv($1)._visit_(ast);
  36578. return $recv(aContext)._evaluateNode_(ast);
  36579. }
  36580. catch(e) {if(e===$early)return e[0]; throw e}
  36581. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36582. },
  36583. args: ["aString", "aContext"],
  36584. 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",
  36585. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36586. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36587. }),
  36588. $globals.Evaluator);
  36589. $core.addMethod(
  36590. $core.method({
  36591. selector: "evaluate:for:",
  36592. protocol: "evaluating",
  36593. fn: function (aString,anObject){
  36594. var self=this,$self=this;
  36595. return $core.withContext(function($ctx1) {
  36596. return $recv(anObject)._evaluate_on_(aString,self);
  36597. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36598. },
  36599. args: ["aString", "anObject"],
  36600. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36601. referencedClasses: [],
  36602. messageSends: ["evaluate:on:"]
  36603. }),
  36604. $globals.Evaluator);
  36605. $core.addMethod(
  36606. $core.method({
  36607. selector: "evaluate:receiver:",
  36608. protocol: "evaluating",
  36609. fn: function (aString,anObject){
  36610. var self=this,$self=this;
  36611. var compiler;
  36612. return $core.withContext(function($ctx1) {
  36613. var $early={};
  36614. try {
  36615. compiler=$recv($globals.Compiler)._new();
  36616. $recv((function(){
  36617. return $core.withContext(function($ctx2) {
  36618. return $recv(compiler)._parseExpression_(aString);
  36619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36620. }))._on_do_($globals.Error,(function(ex){
  36621. return $core.withContext(function($ctx2) {
  36622. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36623. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36624. }));
  36625. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36626. }
  36627. catch(e) {if(e===$early)return e[0]; throw e}
  36628. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36629. },
  36630. args: ["aString", "anObject"],
  36631. 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",
  36632. referencedClasses: ["Compiler", "Error", "Terminal"],
  36633. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36634. }),
  36635. $globals.Evaluator);
  36636. $core.addMethod(
  36637. $core.method({
  36638. selector: "evaluate:for:",
  36639. protocol: "instance creation",
  36640. fn: function (aString,anObject){
  36641. var self=this,$self=this;
  36642. return $core.withContext(function($ctx1) {
  36643. return $recv($self._new())._evaluate_for_(aString,anObject);
  36644. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36645. },
  36646. args: ["aString", "anObject"],
  36647. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36648. referencedClasses: [],
  36649. messageSends: ["evaluate:for:", "new"]
  36650. }),
  36651. $globals.Evaluator.a$cls);
  36652. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36653. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36654. $core.addMethod(
  36655. $core.method({
  36656. selector: "canProcessPragma:",
  36657. protocol: "pragma processing",
  36658. fn: function (aMessage){
  36659. var self=this,$self=this;
  36660. var selector;
  36661. return $core.withContext(function($ctx1) {
  36662. selector=$recv(aMessage)._selector();
  36663. return $recv($self._respondsTo_(selector))._and_((function(){
  36664. return $core.withContext(function($ctx2) {
  36665. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36667. }));
  36668. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36669. },
  36670. args: ["aMessage"],
  36671. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  36672. referencedClasses: [],
  36673. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36674. }),
  36675. $globals.Pragmator);
  36676. $core.addMethod(
  36677. $core.method({
  36678. selector: "methodNode",
  36679. protocol: "accessing",
  36680. fn: function (){
  36681. var self=this,$self=this;
  36682. return $self["@methodNode"];
  36683. },
  36684. args: [],
  36685. source: "methodNode\x0a\x09^ methodNode",
  36686. referencedClasses: [],
  36687. messageSends: []
  36688. }),
  36689. $globals.Pragmator);
  36690. $core.addMethod(
  36691. $core.method({
  36692. selector: "methodNode:",
  36693. protocol: "accessing",
  36694. fn: function (anObject){
  36695. var self=this,$self=this;
  36696. $self["@methodNode"]=anObject;
  36697. return self;
  36698. },
  36699. args: ["anObject"],
  36700. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36701. referencedClasses: [],
  36702. messageSends: []
  36703. }),
  36704. $globals.Pragmator);
  36705. $core.addMethod(
  36706. $core.method({
  36707. selector: "processPragma:",
  36708. protocol: "pragma processing",
  36709. fn: function (aMessage){
  36710. var self=this,$self=this;
  36711. return $core.withContext(function($ctx1) {
  36712. var $1;
  36713. $1=$self._canProcessPragma_(aMessage);
  36714. if($core.assert($1)){
  36715. return $recv(aMessage)._sendTo_(self);
  36716. }
  36717. return self;
  36718. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36719. },
  36720. args: ["aMessage"],
  36721. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36722. referencedClasses: [],
  36723. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36724. }),
  36725. $globals.Pragmator);
  36726. $core.addMethod(
  36727. $core.method({
  36728. selector: "sequenceNode",
  36729. protocol: "accessing",
  36730. fn: function (){
  36731. var self=this,$self=this;
  36732. return $self["@sequenceNode"];
  36733. },
  36734. args: [],
  36735. source: "sequenceNode\x0a\x09^ sequenceNode",
  36736. referencedClasses: [],
  36737. messageSends: []
  36738. }),
  36739. $globals.Pragmator);
  36740. $core.addMethod(
  36741. $core.method({
  36742. selector: "sequenceNode:",
  36743. protocol: "accessing",
  36744. fn: function (anObject){
  36745. var self=this,$self=this;
  36746. $self["@sequenceNode"]=anObject;
  36747. return self;
  36748. },
  36749. args: ["anObject"],
  36750. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36751. referencedClasses: [],
  36752. messageSends: []
  36753. }),
  36754. $globals.Pragmator);
  36755. $core.addMethod(
  36756. $core.method({
  36757. selector: "visitMethodNode:",
  36758. protocol: "pragma processing",
  36759. fn: function (aNode){
  36760. var self=this,$self=this;
  36761. return $core.withContext(function($ctx1) {
  36762. var $1;
  36763. $self._methodNode_(aNode);
  36764. $1=(
  36765. $ctx1.supercall = true,
  36766. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36767. $ctx1.supercall = false;
  36768. return $1;
  36769. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36770. },
  36771. args: ["aNode"],
  36772. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36773. referencedClasses: [],
  36774. messageSends: ["methodNode:", "visitMethodNode:"]
  36775. }),
  36776. $globals.Pragmator);
  36777. $core.addMethod(
  36778. $core.method({
  36779. selector: "visitSequenceNode:",
  36780. protocol: "pragma processing",
  36781. fn: function (aNode){
  36782. var self=this,$self=this;
  36783. return $core.withContext(function($ctx1) {
  36784. var $1;
  36785. $self._sequenceNode_(aNode);
  36786. $recv($recv(aNode)._pragmas())._do_((function(each){
  36787. return $core.withContext(function($ctx2) {
  36788. return $self._processPragma_(each);
  36789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36790. }));
  36791. $1=(
  36792. $ctx1.supercall = true,
  36793. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36794. $ctx1.supercall = false;
  36795. return $1;
  36796. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36797. },
  36798. args: ["aNode"],
  36799. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36800. referencedClasses: [],
  36801. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36802. }),
  36803. $globals.Pragmator);
  36804. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36805. $core.addMethod(
  36806. $core.method({
  36807. selector: "asVariableName",
  36808. protocol: "*Compiler-Core",
  36809. fn: function (){
  36810. var self=this,$self=this;
  36811. return $core.withContext(function($ctx1) {
  36812. var $1;
  36813. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36814. if($core.assert($1)){
  36815. return $self.__comma("_");
  36816. } else {
  36817. return self;
  36818. }
  36819. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36820. },
  36821. args: [],
  36822. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36823. referencedClasses: ["Smalltalk"],
  36824. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36825. }),
  36826. $globals.String);
  36827. });
  36828. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36829. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36830. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36831. $core.addPackage("Compiler-Semantic");
  36832. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36833. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36834. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36835. $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.";
  36836. $core.addMethod(
  36837. $core.method({
  36838. selector: "addArg:",
  36839. protocol: "adding",
  36840. fn: function (aString){
  36841. var self=this,$self=this;
  36842. return $core.withContext(function($ctx1) {
  36843. var $1;
  36844. $1=$self._args();
  36845. $ctx1.sendIdx["args"]=1;
  36846. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36847. $recv($recv($self._args())._at_(aString))._scope_(self);
  36848. return self;
  36849. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36850. },
  36851. args: ["aString"],
  36852. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36853. referencedClasses: ["ArgVar"],
  36854. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36855. }),
  36856. $globals.LexicalScope);
  36857. $core.addMethod(
  36858. $core.method({
  36859. selector: "addTemp:",
  36860. protocol: "adding",
  36861. fn: function (aString){
  36862. var self=this,$self=this;
  36863. return $core.withContext(function($ctx1) {
  36864. var $1;
  36865. $1=$self._temps();
  36866. $ctx1.sendIdx["temps"]=1;
  36867. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36868. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36869. return self;
  36870. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36871. },
  36872. args: ["aString"],
  36873. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36874. referencedClasses: ["TempVar"],
  36875. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36876. }),
  36877. $globals.LexicalScope);
  36878. $core.addMethod(
  36879. $core.method({
  36880. selector: "alias",
  36881. protocol: "accessing",
  36882. fn: function (){
  36883. var self=this,$self=this;
  36884. return $core.withContext(function($ctx1) {
  36885. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36886. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36887. },
  36888. args: [],
  36889. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36890. referencedClasses: [],
  36891. messageSends: [",", "asString", "scopeLevel"]
  36892. }),
  36893. $globals.LexicalScope);
  36894. $core.addMethod(
  36895. $core.method({
  36896. selector: "allVariableNames",
  36897. protocol: "accessing",
  36898. fn: function (){
  36899. var self=this,$self=this;
  36900. return $core.withContext(function($ctx1) {
  36901. var $1;
  36902. $1=$recv($self._args())._keys();
  36903. $ctx1.sendIdx["keys"]=1;
  36904. return $recv($1).__comma($recv($self._temps())._keys());
  36905. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36906. },
  36907. args: [],
  36908. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36909. referencedClasses: [],
  36910. messageSends: [",", "keys", "args", "temps"]
  36911. }),
  36912. $globals.LexicalScope);
  36913. $core.addMethod(
  36914. $core.method({
  36915. selector: "args",
  36916. protocol: "accessing",
  36917. fn: function (){
  36918. var self=this,$self=this;
  36919. return $core.withContext(function($ctx1) {
  36920. var $1,$receiver;
  36921. $1=$self["@args"];
  36922. if(($receiver = $1) == null || $receiver.a$nil){
  36923. $self["@args"]=$recv($globals.Dictionary)._new();
  36924. return $self["@args"];
  36925. } else {
  36926. return $1;
  36927. }
  36928. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36929. },
  36930. args: [],
  36931. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36932. referencedClasses: ["Dictionary"],
  36933. messageSends: ["ifNil:", "new"]
  36934. }),
  36935. $globals.LexicalScope);
  36936. $core.addMethod(
  36937. $core.method({
  36938. selector: "bindingFor:",
  36939. protocol: "accessing",
  36940. fn: function (aStringOrNode){
  36941. var self=this,$self=this;
  36942. return $core.withContext(function($ctx1) {
  36943. var $2,$3,$4,$5,$1;
  36944. $2=$self._pseudoVars();
  36945. $3=$recv(aStringOrNode)._value();
  36946. $ctx1.sendIdx["value"]=1;
  36947. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36948. return $core.withContext(function($ctx2) {
  36949. $4=$self._args();
  36950. $5=$recv(aStringOrNode)._value();
  36951. $ctx2.sendIdx["value"]=2;
  36952. return $recv($4)._at_ifAbsent_($5,(function(){
  36953. return $core.withContext(function($ctx3) {
  36954. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36955. return nil;
  36956. }));
  36957. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36958. }));
  36959. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36961. }));
  36962. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36963. return $1;
  36964. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36965. },
  36966. args: ["aStringOrNode"],
  36967. 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 ]]]",
  36968. referencedClasses: [],
  36969. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36970. }),
  36971. $globals.LexicalScope);
  36972. $core.addMethod(
  36973. $core.method({
  36974. selector: "blockIndex",
  36975. protocol: "accessing",
  36976. fn: function (){
  36977. var self=this,$self=this;
  36978. return $core.withContext(function($ctx1) {
  36979. var $1,$receiver;
  36980. $1=$self["@blockIndex"];
  36981. if(($receiver = $1) == null || $receiver.a$nil){
  36982. return (0);
  36983. } else {
  36984. return $1;
  36985. }
  36986. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36987. },
  36988. args: [],
  36989. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36990. referencedClasses: [],
  36991. messageSends: ["ifNil:"]
  36992. }),
  36993. $globals.LexicalScope);
  36994. $core.addMethod(
  36995. $core.method({
  36996. selector: "blockIndex:",
  36997. protocol: "accessing",
  36998. fn: function (anInteger){
  36999. var self=this,$self=this;
  37000. $self["@blockIndex"]=anInteger;
  37001. return self;
  37002. },
  37003. args: ["anInteger"],
  37004. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  37005. referencedClasses: [],
  37006. messageSends: []
  37007. }),
  37008. $globals.LexicalScope);
  37009. $core.addMethod(
  37010. $core.method({
  37011. selector: "canInlineNonLocalReturns",
  37012. protocol: "testing",
  37013. fn: function (){
  37014. var self=this,$self=this;
  37015. return $core.withContext(function($ctx1) {
  37016. return $recv($self._isInlined())._and_((function(){
  37017. return $core.withContext(function($ctx2) {
  37018. return $recv($self._outerScope())._canInlineNonLocalReturns();
  37019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37020. }));
  37021. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  37022. },
  37023. args: [],
  37024. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  37025. referencedClasses: [],
  37026. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  37027. }),
  37028. $globals.LexicalScope);
  37029. $core.addMethod(
  37030. $core.method({
  37031. selector: "instruction",
  37032. protocol: "accessing",
  37033. fn: function (){
  37034. var self=this,$self=this;
  37035. return $self["@instruction"];
  37036. },
  37037. args: [],
  37038. source: "instruction\x0a\x09^ instruction",
  37039. referencedClasses: [],
  37040. messageSends: []
  37041. }),
  37042. $globals.LexicalScope);
  37043. $core.addMethod(
  37044. $core.method({
  37045. selector: "instruction:",
  37046. protocol: "accessing",
  37047. fn: function (anIRInstruction){
  37048. var self=this,$self=this;
  37049. $self["@instruction"]=anIRInstruction;
  37050. return self;
  37051. },
  37052. args: ["anIRInstruction"],
  37053. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  37054. referencedClasses: [],
  37055. messageSends: []
  37056. }),
  37057. $globals.LexicalScope);
  37058. $core.addMethod(
  37059. $core.method({
  37060. selector: "isBlockScope",
  37061. protocol: "testing",
  37062. fn: function (){
  37063. var self=this,$self=this;
  37064. return $core.withContext(function($ctx1) {
  37065. return $recv($self._isMethodScope())._not();
  37066. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  37067. },
  37068. args: [],
  37069. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  37070. referencedClasses: [],
  37071. messageSends: ["not", "isMethodScope"]
  37072. }),
  37073. $globals.LexicalScope);
  37074. $core.addMethod(
  37075. $core.method({
  37076. selector: "isInlined",
  37077. protocol: "testing",
  37078. fn: function (){
  37079. var self=this,$self=this;
  37080. return $core.withContext(function($ctx1) {
  37081. var $2,$1;
  37082. $2=$self._instruction();
  37083. $ctx1.sendIdx["instruction"]=1;
  37084. $1=$recv($2)._notNil();
  37085. return $recv($1)._and_((function(){
  37086. return $core.withContext(function($ctx2) {
  37087. return $recv($self._instruction())._isInlined();
  37088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37089. }));
  37090. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  37091. },
  37092. args: [],
  37093. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  37094. referencedClasses: [],
  37095. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  37096. }),
  37097. $globals.LexicalScope);
  37098. $core.addMethod(
  37099. $core.method({
  37100. selector: "isMethodScope",
  37101. protocol: "testing",
  37102. fn: function (){
  37103. var self=this,$self=this;
  37104. return false;
  37105. },
  37106. args: [],
  37107. source: "isMethodScope\x0a\x09^ false",
  37108. referencedClasses: [],
  37109. messageSends: []
  37110. }),
  37111. $globals.LexicalScope);
  37112. $core.addMethod(
  37113. $core.method({
  37114. selector: "lookupVariable:",
  37115. protocol: "accessing",
  37116. fn: function (aNode){
  37117. var self=this,$self=this;
  37118. var lookup;
  37119. return $core.withContext(function($ctx1) {
  37120. var $1,$2,$receiver;
  37121. lookup=$self._bindingFor_(aNode);
  37122. $1=lookup;
  37123. if(($receiver = $1) == null || $receiver.a$nil){
  37124. $2=$self._outerScope();
  37125. $ctx1.sendIdx["outerScope"]=1;
  37126. if(($receiver = $2) == null || $receiver.a$nil){
  37127. lookup=$2;
  37128. } else {
  37129. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  37130. }
  37131. lookup;
  37132. } else {
  37133. $1;
  37134. }
  37135. return lookup;
  37136. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  37137. },
  37138. args: ["aNode"],
  37139. 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",
  37140. referencedClasses: [],
  37141. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  37142. }),
  37143. $globals.LexicalScope);
  37144. $core.addMethod(
  37145. $core.method({
  37146. selector: "methodScope",
  37147. protocol: "accessing",
  37148. fn: function (){
  37149. var self=this,$self=this;
  37150. return $core.withContext(function($ctx1) {
  37151. var $1,$receiver;
  37152. $1=$self._outerScope();
  37153. $ctx1.sendIdx["outerScope"]=1;
  37154. if(($receiver = $1) == null || $receiver.a$nil){
  37155. return $1;
  37156. } else {
  37157. return $recv($self._outerScope())._methodScope();
  37158. }
  37159. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  37160. },
  37161. args: [],
  37162. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37163. referencedClasses: [],
  37164. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37165. }),
  37166. $globals.LexicalScope);
  37167. $core.addMethod(
  37168. $core.method({
  37169. selector: "node",
  37170. protocol: "accessing",
  37171. fn: function (){
  37172. var self=this,$self=this;
  37173. return $self["@node"];
  37174. },
  37175. args: [],
  37176. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37177. referencedClasses: [],
  37178. messageSends: []
  37179. }),
  37180. $globals.LexicalScope);
  37181. $core.addMethod(
  37182. $core.method({
  37183. selector: "node:",
  37184. protocol: "accessing",
  37185. fn: function (aNode){
  37186. var self=this,$self=this;
  37187. $self["@node"]=aNode;
  37188. return self;
  37189. },
  37190. args: ["aNode"],
  37191. source: "node: aNode\x0a\x09node := aNode",
  37192. referencedClasses: [],
  37193. messageSends: []
  37194. }),
  37195. $globals.LexicalScope);
  37196. $core.addMethod(
  37197. $core.method({
  37198. selector: "outerScope",
  37199. protocol: "accessing",
  37200. fn: function (){
  37201. var self=this,$self=this;
  37202. return $self["@outerScope"];
  37203. },
  37204. args: [],
  37205. source: "outerScope\x0a\x09^ outerScope",
  37206. referencedClasses: [],
  37207. messageSends: []
  37208. }),
  37209. $globals.LexicalScope);
  37210. $core.addMethod(
  37211. $core.method({
  37212. selector: "outerScope:",
  37213. protocol: "accessing",
  37214. fn: function (aLexicalScope){
  37215. var self=this,$self=this;
  37216. $self["@outerScope"]=aLexicalScope;
  37217. return self;
  37218. },
  37219. args: ["aLexicalScope"],
  37220. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37221. referencedClasses: [],
  37222. messageSends: []
  37223. }),
  37224. $globals.LexicalScope);
  37225. $core.addMethod(
  37226. $core.method({
  37227. selector: "pseudoVars",
  37228. protocol: "accessing",
  37229. fn: function (){
  37230. var self=this,$self=this;
  37231. return $core.withContext(function($ctx1) {
  37232. return $recv($self._methodScope())._pseudoVars();
  37233. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37234. },
  37235. args: [],
  37236. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37237. referencedClasses: [],
  37238. messageSends: ["pseudoVars", "methodScope"]
  37239. }),
  37240. $globals.LexicalScope);
  37241. $core.addMethod(
  37242. $core.method({
  37243. selector: "scopeLevel",
  37244. protocol: "accessing",
  37245. fn: function (){
  37246. var self=this,$self=this;
  37247. return $core.withContext(function($ctx1) {
  37248. var $1,$2,$4,$3,$receiver;
  37249. $1=$self._outerScope();
  37250. $ctx1.sendIdx["outerScope"]=1;
  37251. if(($receiver = $1) == null || $receiver.a$nil){
  37252. return (1);
  37253. } else {
  37254. $1;
  37255. }
  37256. $2=$self._isInlined();
  37257. if($core.assert($2)){
  37258. $4=$self._outerScope();
  37259. $ctx1.sendIdx["outerScope"]=2;
  37260. $3=$recv($4)._scopeLevel();
  37261. $ctx1.sendIdx["scopeLevel"]=1;
  37262. return $3;
  37263. }
  37264. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37265. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37266. },
  37267. args: [],
  37268. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37269. referencedClasses: [],
  37270. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37271. }),
  37272. $globals.LexicalScope);
  37273. $core.addMethod(
  37274. $core.method({
  37275. selector: "temps",
  37276. protocol: "accessing",
  37277. fn: function (){
  37278. var self=this,$self=this;
  37279. return $core.withContext(function($ctx1) {
  37280. var $1,$receiver;
  37281. $1=$self["@temps"];
  37282. if(($receiver = $1) == null || $receiver.a$nil){
  37283. $self["@temps"]=$recv($globals.Dictionary)._new();
  37284. return $self["@temps"];
  37285. } else {
  37286. return $1;
  37287. }
  37288. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37289. },
  37290. args: [],
  37291. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37292. referencedClasses: ["Dictionary"],
  37293. messageSends: ["ifNil:", "new"]
  37294. }),
  37295. $globals.LexicalScope);
  37296. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37297. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37298. $core.addMethod(
  37299. $core.method({
  37300. selector: "addIVar:",
  37301. protocol: "adding",
  37302. fn: function (aString){
  37303. var self=this,$self=this;
  37304. return $core.withContext(function($ctx1) {
  37305. var $1;
  37306. $1=$self._iVars();
  37307. $ctx1.sendIdx["iVars"]=1;
  37308. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37309. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37310. return self;
  37311. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37312. },
  37313. args: ["aString"],
  37314. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37315. referencedClasses: ["InstanceVar"],
  37316. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37317. }),
  37318. $globals.MethodLexicalScope);
  37319. $core.addMethod(
  37320. $core.method({
  37321. selector: "addNonLocalReturn:",
  37322. protocol: "adding",
  37323. fn: function (aScope){
  37324. var self=this,$self=this;
  37325. return $core.withContext(function($ctx1) {
  37326. $recv($self._nonLocalReturns())._add_(aScope);
  37327. return self;
  37328. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37329. },
  37330. args: ["aScope"],
  37331. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37332. referencedClasses: [],
  37333. messageSends: ["add:", "nonLocalReturns"]
  37334. }),
  37335. $globals.MethodLexicalScope);
  37336. $core.addMethod(
  37337. $core.method({
  37338. selector: "allVariableNames",
  37339. protocol: "accessing",
  37340. fn: function (){
  37341. var self=this,$self=this;
  37342. return $core.withContext(function($ctx1) {
  37343. var $1;
  37344. $1=(
  37345. $ctx1.supercall = true,
  37346. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37347. $ctx1.supercall = false;
  37348. return $recv($1).__comma($recv($self._iVars())._keys());
  37349. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37350. },
  37351. args: [],
  37352. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37353. referencedClasses: [],
  37354. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37355. }),
  37356. $globals.MethodLexicalScope);
  37357. $core.addMethod(
  37358. $core.method({
  37359. selector: "bindingFor:",
  37360. protocol: "accessing",
  37361. fn: function (aNode){
  37362. var self=this,$self=this;
  37363. return $core.withContext(function($ctx1) {
  37364. var $1,$receiver;
  37365. $1=(
  37366. $ctx1.supercall = true,
  37367. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37368. $ctx1.supercall = false;
  37369. if(($receiver = $1) == null || $receiver.a$nil){
  37370. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37371. return nil;
  37372. }));
  37373. } else {
  37374. return $1;
  37375. }
  37376. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37377. },
  37378. args: ["aNode"],
  37379. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37380. referencedClasses: [],
  37381. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37382. }),
  37383. $globals.MethodLexicalScope);
  37384. $core.addMethod(
  37385. $core.method({
  37386. selector: "canInlineNonLocalReturns",
  37387. protocol: "testing",
  37388. fn: function (){
  37389. var self=this,$self=this;
  37390. return true;
  37391. },
  37392. args: [],
  37393. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37394. referencedClasses: [],
  37395. messageSends: []
  37396. }),
  37397. $globals.MethodLexicalScope);
  37398. $core.addMethod(
  37399. $core.method({
  37400. selector: "hasLocalReturn",
  37401. protocol: "testing",
  37402. fn: function (){
  37403. var self=this,$self=this;
  37404. return $core.withContext(function($ctx1) {
  37405. return $self._localReturn();
  37406. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37407. },
  37408. args: [],
  37409. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37410. referencedClasses: [],
  37411. messageSends: ["localReturn"]
  37412. }),
  37413. $globals.MethodLexicalScope);
  37414. $core.addMethod(
  37415. $core.method({
  37416. selector: "hasNonLocalReturn",
  37417. protocol: "testing",
  37418. fn: function (){
  37419. var self=this,$self=this;
  37420. return $core.withContext(function($ctx1) {
  37421. return $recv($self._nonLocalReturns())._notEmpty();
  37422. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37423. },
  37424. args: [],
  37425. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37426. referencedClasses: [],
  37427. messageSends: ["notEmpty", "nonLocalReturns"]
  37428. }),
  37429. $globals.MethodLexicalScope);
  37430. $core.addMethod(
  37431. $core.method({
  37432. selector: "iVars",
  37433. protocol: "accessing",
  37434. fn: function (){
  37435. var self=this,$self=this;
  37436. return $core.withContext(function($ctx1) {
  37437. var $1,$receiver;
  37438. $1=$self["@iVars"];
  37439. if(($receiver = $1) == null || $receiver.a$nil){
  37440. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37441. return $self["@iVars"];
  37442. } else {
  37443. return $1;
  37444. }
  37445. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37446. },
  37447. args: [],
  37448. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37449. referencedClasses: ["Dictionary"],
  37450. messageSends: ["ifNil:", "new"]
  37451. }),
  37452. $globals.MethodLexicalScope);
  37453. $core.addMethod(
  37454. $core.method({
  37455. selector: "isMethodScope",
  37456. protocol: "testing",
  37457. fn: function (){
  37458. var self=this,$self=this;
  37459. return true;
  37460. },
  37461. args: [],
  37462. source: "isMethodScope\x0a\x09^ true",
  37463. referencedClasses: [],
  37464. messageSends: []
  37465. }),
  37466. $globals.MethodLexicalScope);
  37467. $core.addMethod(
  37468. $core.method({
  37469. selector: "localReturn",
  37470. protocol: "accessing",
  37471. fn: function (){
  37472. var self=this,$self=this;
  37473. return $core.withContext(function($ctx1) {
  37474. var $1,$receiver;
  37475. $1=$self["@localReturn"];
  37476. if(($receiver = $1) == null || $receiver.a$nil){
  37477. return false;
  37478. } else {
  37479. return $1;
  37480. }
  37481. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37482. },
  37483. args: [],
  37484. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37485. referencedClasses: [],
  37486. messageSends: ["ifNil:"]
  37487. }),
  37488. $globals.MethodLexicalScope);
  37489. $core.addMethod(
  37490. $core.method({
  37491. selector: "localReturn:",
  37492. protocol: "accessing",
  37493. fn: function (aBoolean){
  37494. var self=this,$self=this;
  37495. $self["@localReturn"]=aBoolean;
  37496. return self;
  37497. },
  37498. args: ["aBoolean"],
  37499. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37500. referencedClasses: [],
  37501. messageSends: []
  37502. }),
  37503. $globals.MethodLexicalScope);
  37504. $core.addMethod(
  37505. $core.method({
  37506. selector: "methodScope",
  37507. protocol: "accessing",
  37508. fn: function (){
  37509. var self=this,$self=this;
  37510. return self;
  37511. },
  37512. args: [],
  37513. source: "methodScope\x0a\x09^ self",
  37514. referencedClasses: [],
  37515. messageSends: []
  37516. }),
  37517. $globals.MethodLexicalScope);
  37518. $core.addMethod(
  37519. $core.method({
  37520. selector: "nonLocalReturns",
  37521. protocol: "accessing",
  37522. fn: function (){
  37523. var self=this,$self=this;
  37524. return $core.withContext(function($ctx1) {
  37525. var $1,$receiver;
  37526. $1=$self["@nonLocalReturns"];
  37527. if(($receiver = $1) == null || $receiver.a$nil){
  37528. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37529. return $self["@nonLocalReturns"];
  37530. } else {
  37531. return $1;
  37532. }
  37533. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37534. },
  37535. args: [],
  37536. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37537. referencedClasses: ["OrderedCollection"],
  37538. messageSends: ["ifNil:", "new"]
  37539. }),
  37540. $globals.MethodLexicalScope);
  37541. $core.addMethod(
  37542. $core.method({
  37543. selector: "pseudoVars",
  37544. protocol: "accessing",
  37545. fn: function (){
  37546. var self=this,$self=this;
  37547. return $core.withContext(function($ctx1) {
  37548. var $1,$2,$4,$3,$receiver;
  37549. $1=$self["@pseudoVars"];
  37550. if(($receiver = $1) == null || $receiver.a$nil){
  37551. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37552. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37553. return $core.withContext(function($ctx2) {
  37554. $2=$self["@pseudoVars"];
  37555. $4=$recv($globals.PseudoVar)._on_(each);
  37556. $recv($4)._scope_($self._methodScope());
  37557. $3=$recv($4)._yourself();
  37558. return $recv($2)._at_put_(each,$3);
  37559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37560. }));
  37561. } else {
  37562. $1;
  37563. }
  37564. return $self["@pseudoVars"];
  37565. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37566. },
  37567. args: [],
  37568. 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",
  37569. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37570. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37571. }),
  37572. $globals.MethodLexicalScope);
  37573. $core.addMethod(
  37574. $core.method({
  37575. selector: "removeNonLocalReturn:",
  37576. protocol: "adding",
  37577. fn: function (aScope){
  37578. var self=this,$self=this;
  37579. return $core.withContext(function($ctx1) {
  37580. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37581. }));
  37582. return self;
  37583. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37584. },
  37585. args: ["aScope"],
  37586. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37587. referencedClasses: [],
  37588. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37589. }),
  37590. $globals.MethodLexicalScope);
  37591. $core.addMethod(
  37592. $core.method({
  37593. selector: "unknownVariables",
  37594. protocol: "accessing",
  37595. fn: function (){
  37596. var self=this,$self=this;
  37597. return $core.withContext(function($ctx1) {
  37598. var $1,$receiver;
  37599. $1=$self["@unknownVariables"];
  37600. if(($receiver = $1) == null || $receiver.a$nil){
  37601. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37602. return $self["@unknownVariables"];
  37603. } else {
  37604. return $1;
  37605. }
  37606. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37607. },
  37608. args: [],
  37609. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37610. referencedClasses: ["OrderedCollection"],
  37611. messageSends: ["ifNil:", "new"]
  37612. }),
  37613. $globals.MethodLexicalScope);
  37614. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37615. $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.";
  37616. $core.addMethod(
  37617. $core.method({
  37618. selector: "alias",
  37619. protocol: "accessing",
  37620. fn: function (){
  37621. var self=this,$self=this;
  37622. return $core.withContext(function($ctx1) {
  37623. return $recv($self._name())._asVariableName();
  37624. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37625. },
  37626. args: [],
  37627. source: "alias\x0a\x09^ self name asVariableName",
  37628. referencedClasses: [],
  37629. messageSends: ["asVariableName", "name"]
  37630. }),
  37631. $globals.ScopeVar);
  37632. $core.addMethod(
  37633. $core.method({
  37634. selector: "isArgVar",
  37635. protocol: "testing",
  37636. fn: function (){
  37637. var self=this,$self=this;
  37638. return false;
  37639. },
  37640. args: [],
  37641. source: "isArgVar\x0a\x09^ false",
  37642. referencedClasses: [],
  37643. messageSends: []
  37644. }),
  37645. $globals.ScopeVar);
  37646. $core.addMethod(
  37647. $core.method({
  37648. selector: "isClassRefVar",
  37649. protocol: "testing",
  37650. fn: function (){
  37651. var self=this,$self=this;
  37652. return false;
  37653. },
  37654. args: [],
  37655. source: "isClassRefVar\x0a\x09^ false",
  37656. referencedClasses: [],
  37657. messageSends: []
  37658. }),
  37659. $globals.ScopeVar);
  37660. $core.addMethod(
  37661. $core.method({
  37662. selector: "isImmutable",
  37663. protocol: "testing",
  37664. fn: function (){
  37665. var self=this,$self=this;
  37666. return false;
  37667. },
  37668. args: [],
  37669. source: "isImmutable\x0a\x09^ false",
  37670. referencedClasses: [],
  37671. messageSends: []
  37672. }),
  37673. $globals.ScopeVar);
  37674. $core.addMethod(
  37675. $core.method({
  37676. selector: "isInstanceVar",
  37677. protocol: "testing",
  37678. fn: function (){
  37679. var self=this,$self=this;
  37680. return false;
  37681. },
  37682. args: [],
  37683. source: "isInstanceVar\x0a\x09^ false",
  37684. referencedClasses: [],
  37685. messageSends: []
  37686. }),
  37687. $globals.ScopeVar);
  37688. $core.addMethod(
  37689. $core.method({
  37690. selector: "isPseudoVar",
  37691. protocol: "testing",
  37692. fn: function (){
  37693. var self=this,$self=this;
  37694. return false;
  37695. },
  37696. args: [],
  37697. source: "isPseudoVar\x0a\x09^ false",
  37698. referencedClasses: [],
  37699. messageSends: []
  37700. }),
  37701. $globals.ScopeVar);
  37702. $core.addMethod(
  37703. $core.method({
  37704. selector: "isSelf",
  37705. protocol: "testing",
  37706. fn: function (){
  37707. var self=this,$self=this;
  37708. return false;
  37709. },
  37710. args: [],
  37711. source: "isSelf\x0a\x09^ false",
  37712. referencedClasses: [],
  37713. messageSends: []
  37714. }),
  37715. $globals.ScopeVar);
  37716. $core.addMethod(
  37717. $core.method({
  37718. selector: "isSuper",
  37719. protocol: "testing",
  37720. fn: function (){
  37721. var self=this,$self=this;
  37722. return false;
  37723. },
  37724. args: [],
  37725. source: "isSuper\x0a\x09^ false",
  37726. referencedClasses: [],
  37727. messageSends: []
  37728. }),
  37729. $globals.ScopeVar);
  37730. $core.addMethod(
  37731. $core.method({
  37732. selector: "isTempVar",
  37733. protocol: "testing",
  37734. fn: function (){
  37735. var self=this,$self=this;
  37736. return false;
  37737. },
  37738. args: [],
  37739. source: "isTempVar\x0a\x09^ false",
  37740. referencedClasses: [],
  37741. messageSends: []
  37742. }),
  37743. $globals.ScopeVar);
  37744. $core.addMethod(
  37745. $core.method({
  37746. selector: "isUnknownVar",
  37747. protocol: "testing",
  37748. fn: function (){
  37749. var self=this,$self=this;
  37750. return false;
  37751. },
  37752. args: [],
  37753. source: "isUnknownVar\x0a\x09^ false",
  37754. referencedClasses: [],
  37755. messageSends: []
  37756. }),
  37757. $globals.ScopeVar);
  37758. $core.addMethod(
  37759. $core.method({
  37760. selector: "name",
  37761. protocol: "accessing",
  37762. fn: function (){
  37763. var self=this,$self=this;
  37764. return $self["@name"];
  37765. },
  37766. args: [],
  37767. source: "name\x0a\x09^ name",
  37768. referencedClasses: [],
  37769. messageSends: []
  37770. }),
  37771. $globals.ScopeVar);
  37772. $core.addMethod(
  37773. $core.method({
  37774. selector: "name:",
  37775. protocol: "accessing",
  37776. fn: function (aString){
  37777. var self=this,$self=this;
  37778. $self["@name"]=aString;
  37779. return self;
  37780. },
  37781. args: ["aString"],
  37782. source: "name: aString\x0a\x09name := aString",
  37783. referencedClasses: [],
  37784. messageSends: []
  37785. }),
  37786. $globals.ScopeVar);
  37787. $core.addMethod(
  37788. $core.method({
  37789. selector: "scope",
  37790. protocol: "accessing",
  37791. fn: function (){
  37792. var self=this,$self=this;
  37793. return $self["@scope"];
  37794. },
  37795. args: [],
  37796. source: "scope\x0a\x09^ scope",
  37797. referencedClasses: [],
  37798. messageSends: []
  37799. }),
  37800. $globals.ScopeVar);
  37801. $core.addMethod(
  37802. $core.method({
  37803. selector: "scope:",
  37804. protocol: "accessing",
  37805. fn: function (aScope){
  37806. var self=this,$self=this;
  37807. $self["@scope"]=aScope;
  37808. return self;
  37809. },
  37810. args: ["aScope"],
  37811. source: "scope: aScope\x0a\x09scope := aScope",
  37812. referencedClasses: [],
  37813. messageSends: []
  37814. }),
  37815. $globals.ScopeVar);
  37816. $core.addMethod(
  37817. $core.method({
  37818. selector: "validateAssignment",
  37819. protocol: "testing",
  37820. fn: function (){
  37821. var self=this,$self=this;
  37822. return $core.withContext(function($ctx1) {
  37823. var $1,$2;
  37824. $1=$recv($self._isArgVar())._or_((function(){
  37825. return $core.withContext(function($ctx2) {
  37826. return $self._isPseudoVar();
  37827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37828. }));
  37829. if($core.assert($1)){
  37830. $2=$recv($globals.InvalidAssignmentError)._new();
  37831. $recv($2)._variableName_($self._name());
  37832. $recv($2)._signal();
  37833. }
  37834. return self;
  37835. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37836. },
  37837. args: [],
  37838. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37839. referencedClasses: ["InvalidAssignmentError"],
  37840. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37841. }),
  37842. $globals.ScopeVar);
  37843. $core.addMethod(
  37844. $core.method({
  37845. selector: "on:",
  37846. protocol: "instance creation",
  37847. fn: function (aString){
  37848. var self=this,$self=this;
  37849. return $core.withContext(function($ctx1) {
  37850. var $1;
  37851. $1=$self._new();
  37852. $recv($1)._name_(aString);
  37853. return $recv($1)._yourself();
  37854. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37855. },
  37856. args: ["aString"],
  37857. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37858. referencedClasses: [],
  37859. messageSends: ["name:", "new", "yourself"]
  37860. }),
  37861. $globals.ScopeVar.a$cls);
  37862. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37863. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37864. $core.addMethod(
  37865. $core.method({
  37866. selector: "isImmutable",
  37867. protocol: "testing",
  37868. fn: function (){
  37869. var self=this,$self=this;
  37870. return true;
  37871. },
  37872. args: [],
  37873. source: "isImmutable\x0a\x09^ true",
  37874. referencedClasses: [],
  37875. messageSends: []
  37876. }),
  37877. $globals.AliasVar);
  37878. $core.addMethod(
  37879. $core.method({
  37880. selector: "node",
  37881. protocol: "accessing",
  37882. fn: function (){
  37883. var self=this,$self=this;
  37884. return $self["@node"];
  37885. },
  37886. args: [],
  37887. source: "node\x0a\x09^ node",
  37888. referencedClasses: [],
  37889. messageSends: []
  37890. }),
  37891. $globals.AliasVar);
  37892. $core.addMethod(
  37893. $core.method({
  37894. selector: "node:",
  37895. protocol: "accessing",
  37896. fn: function (aNode){
  37897. var self=this,$self=this;
  37898. $self["@node"]=aNode;
  37899. return self;
  37900. },
  37901. args: ["aNode"],
  37902. source: "node: aNode\x0a\x09node := aNode",
  37903. referencedClasses: [],
  37904. messageSends: []
  37905. }),
  37906. $globals.AliasVar);
  37907. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37908. $globals.ArgVar.comment="I am an argument of a method or block.";
  37909. $core.addMethod(
  37910. $core.method({
  37911. selector: "isArgVar",
  37912. protocol: "testing",
  37913. fn: function (){
  37914. var self=this,$self=this;
  37915. return true;
  37916. },
  37917. args: [],
  37918. source: "isArgVar\x0a\x09^ true",
  37919. referencedClasses: [],
  37920. messageSends: []
  37921. }),
  37922. $globals.ArgVar);
  37923. $core.addMethod(
  37924. $core.method({
  37925. selector: "isImmutable",
  37926. protocol: "testing",
  37927. fn: function (){
  37928. var self=this,$self=this;
  37929. return true;
  37930. },
  37931. args: [],
  37932. source: "isImmutable\x0a\x09^ true",
  37933. referencedClasses: [],
  37934. messageSends: []
  37935. }),
  37936. $globals.ArgVar);
  37937. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37938. $globals.ClassRefVar.comment="I am an class reference variable";
  37939. $core.addMethod(
  37940. $core.method({
  37941. selector: "alias",
  37942. protocol: "accessing",
  37943. fn: function (){
  37944. var self=this,$self=this;
  37945. return $core.withContext(function($ctx1) {
  37946. return "$globals.".__comma($self._name());
  37947. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37948. },
  37949. args: [],
  37950. 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",
  37951. referencedClasses: [],
  37952. messageSends: [",", "name"]
  37953. }),
  37954. $globals.ClassRefVar);
  37955. $core.addMethod(
  37956. $core.method({
  37957. selector: "isClassRefVar",
  37958. protocol: "testing",
  37959. fn: function (){
  37960. var self=this,$self=this;
  37961. return true;
  37962. },
  37963. args: [],
  37964. source: "isClassRefVar\x0a\x09^ true",
  37965. referencedClasses: [],
  37966. messageSends: []
  37967. }),
  37968. $globals.ClassRefVar);
  37969. $core.addMethod(
  37970. $core.method({
  37971. selector: "isImmutable",
  37972. protocol: "testing",
  37973. fn: function (){
  37974. var self=this,$self=this;
  37975. return true;
  37976. },
  37977. args: [],
  37978. source: "isImmutable\x0a\x09^ true",
  37979. referencedClasses: [],
  37980. messageSends: []
  37981. }),
  37982. $globals.ClassRefVar);
  37983. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37984. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37985. $core.addMethod(
  37986. $core.method({
  37987. selector: "alias",
  37988. protocol: "testing",
  37989. fn: function (){
  37990. var self=this,$self=this;
  37991. return $core.withContext(function($ctx1) {
  37992. var $1;
  37993. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37994. $ctx1.sendIdx[","]=1;
  37995. return $1;
  37996. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37997. },
  37998. args: [],
  37999. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  38000. referencedClasses: [],
  38001. messageSends: [",", "name"]
  38002. }),
  38003. $globals.InstanceVar);
  38004. $core.addMethod(
  38005. $core.method({
  38006. selector: "isInstanceVar",
  38007. protocol: "testing",
  38008. fn: function (){
  38009. var self=this,$self=this;
  38010. return true;
  38011. },
  38012. args: [],
  38013. source: "isInstanceVar\x0a\x09^ true",
  38014. referencedClasses: [],
  38015. messageSends: []
  38016. }),
  38017. $globals.InstanceVar);
  38018. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38019. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  38020. $core.addMethod(
  38021. $core.method({
  38022. selector: "alias",
  38023. protocol: "accessing",
  38024. fn: function (){
  38025. var self=this,$self=this;
  38026. return $core.withContext(function($ctx1) {
  38027. return $self._name();
  38028. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  38029. },
  38030. args: [],
  38031. source: "alias\x0a\x09^ self name",
  38032. referencedClasses: [],
  38033. messageSends: ["name"]
  38034. }),
  38035. $globals.PseudoVar);
  38036. $core.addMethod(
  38037. $core.method({
  38038. selector: "isImmutable",
  38039. protocol: "testing",
  38040. fn: function (){
  38041. var self=this,$self=this;
  38042. return true;
  38043. },
  38044. args: [],
  38045. source: "isImmutable\x0a\x09^ true",
  38046. referencedClasses: [],
  38047. messageSends: []
  38048. }),
  38049. $globals.PseudoVar);
  38050. $core.addMethod(
  38051. $core.method({
  38052. selector: "isPseudoVar",
  38053. protocol: "testing",
  38054. fn: function (){
  38055. var self=this,$self=this;
  38056. return true;
  38057. },
  38058. args: [],
  38059. source: "isPseudoVar\x0a\x09^ true",
  38060. referencedClasses: [],
  38061. messageSends: []
  38062. }),
  38063. $globals.PseudoVar);
  38064. $core.addMethod(
  38065. $core.method({
  38066. selector: "isSelf",
  38067. protocol: "testing",
  38068. fn: function (){
  38069. var self=this,$self=this;
  38070. return $core.withContext(function($ctx1) {
  38071. return $recv($self["@name"]).__eq("self");
  38072. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  38073. },
  38074. args: [],
  38075. source: "isSelf\x0a\x09^ name = 'self'",
  38076. referencedClasses: [],
  38077. messageSends: ["="]
  38078. }),
  38079. $globals.PseudoVar);
  38080. $core.addMethod(
  38081. $core.method({
  38082. selector: "isSuper",
  38083. protocol: "testing",
  38084. fn: function (){
  38085. var self=this,$self=this;
  38086. return $core.withContext(function($ctx1) {
  38087. return $recv($self["@name"]).__eq("super");
  38088. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  38089. },
  38090. args: [],
  38091. source: "isSuper\x0a\x09^ name = 'super'",
  38092. referencedClasses: [],
  38093. messageSends: ["="]
  38094. }),
  38095. $globals.PseudoVar);
  38096. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38097. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  38098. $core.addMethod(
  38099. $core.method({
  38100. selector: "isTempVar",
  38101. protocol: "testing",
  38102. fn: function (){
  38103. var self=this,$self=this;
  38104. return true;
  38105. },
  38106. args: [],
  38107. source: "isTempVar\x0a\x09^ true",
  38108. referencedClasses: [],
  38109. messageSends: []
  38110. }),
  38111. $globals.TempVar);
  38112. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38113. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  38114. $core.addMethod(
  38115. $core.method({
  38116. selector: "isUnknownVar",
  38117. protocol: "testing",
  38118. fn: function (){
  38119. var self=this,$self=this;
  38120. return true;
  38121. },
  38122. args: [],
  38123. source: "isUnknownVar\x0a\x09^ true",
  38124. referencedClasses: [],
  38125. messageSends: []
  38126. }),
  38127. $globals.UnknownVar);
  38128. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  38129. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  38130. $core.addMethod(
  38131. $core.method({
  38132. selector: "classReferences",
  38133. protocol: "accessing",
  38134. fn: function (){
  38135. var self=this,$self=this;
  38136. return $core.withContext(function($ctx1) {
  38137. var $1,$receiver;
  38138. $1=$self["@classReferences"];
  38139. if(($receiver = $1) == null || $receiver.a$nil){
  38140. $self["@classReferences"]=$recv($globals.Set)._new();
  38141. return $self["@classReferences"];
  38142. } else {
  38143. return $1;
  38144. }
  38145. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  38146. },
  38147. args: [],
  38148. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  38149. referencedClasses: ["Set"],
  38150. messageSends: ["ifNil:", "new"]
  38151. }),
  38152. $globals.SemanticAnalyzer);
  38153. $core.addMethod(
  38154. $core.method({
  38155. selector: "errorShadowingVariable:",
  38156. protocol: "error handling",
  38157. fn: function (aString){
  38158. var self=this,$self=this;
  38159. return $core.withContext(function($ctx1) {
  38160. var $1;
  38161. $1=$recv($globals.ShadowingVariableError)._new();
  38162. $recv($1)._variableName_(aString);
  38163. $recv($1)._signal();
  38164. return self;
  38165. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  38166. },
  38167. args: ["aString"],
  38168. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38169. referencedClasses: ["ShadowingVariableError"],
  38170. messageSends: ["variableName:", "new", "signal"]
  38171. }),
  38172. $globals.SemanticAnalyzer);
  38173. $core.addMethod(
  38174. $core.method({
  38175. selector: "errorUnknownVariable:",
  38176. protocol: "error handling",
  38177. fn: function (aNode){
  38178. var self=this,$self=this;
  38179. var identifier;
  38180. return $core.withContext(function($ctx1) {
  38181. var $1,$2,$3;
  38182. identifier=$recv(aNode)._value();
  38183. $ctx1.sendIdx["value"]=1;
  38184. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  38185. return $core.withContext(function($ctx2) {
  38186. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  38187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38188. }));
  38189. if($core.assert($1)){
  38190. $2=$recv($globals.UnknownVariableError)._new();
  38191. $3=$recv(aNode)._value();
  38192. $ctx1.sendIdx["value"]=2;
  38193. $recv($2)._variableName_($3);
  38194. $recv($2)._signal();
  38195. } else {
  38196. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38197. }
  38198. return self;
  38199. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38200. },
  38201. args: ["aNode"],
  38202. 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 ]",
  38203. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38204. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38205. }),
  38206. $globals.SemanticAnalyzer);
  38207. $core.addMethod(
  38208. $core.method({
  38209. selector: "isVariableUndefined:inPackage:",
  38210. protocol: "testing",
  38211. fn: function (aString,aPackage){
  38212. var self=this,$self=this;
  38213. return $core.withContext(function($ctx1) {
  38214. var $1,$2,$receiver;
  38215. if(($receiver = aPackage) == null || $receiver.a$nil){
  38216. aPackage;
  38217. } else {
  38218. var packageKnownVars;
  38219. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38220. $1=$recv(packageKnownVars)._includes_(aString);
  38221. if($core.assert($1)){
  38222. return false;
  38223. }
  38224. }
  38225. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38226. $ctx1.sendIdx[","]=1;
  38227. return $recv($globals.Compiler)._eval_($2);
  38228. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38229. },
  38230. args: ["aString", "aPackage"],
  38231. 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'",
  38232. referencedClasses: ["Compiler"],
  38233. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38234. }),
  38235. $globals.SemanticAnalyzer);
  38236. $core.addMethod(
  38237. $core.method({
  38238. selector: "messageSends",
  38239. protocol: "accessing",
  38240. fn: function (){
  38241. var self=this,$self=this;
  38242. return $core.withContext(function($ctx1) {
  38243. var $1,$receiver;
  38244. $1=$self["@messageSends"];
  38245. if(($receiver = $1) == null || $receiver.a$nil){
  38246. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38247. return $self["@messageSends"];
  38248. } else {
  38249. return $1;
  38250. }
  38251. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38252. },
  38253. args: [],
  38254. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38255. referencedClasses: ["Dictionary"],
  38256. messageSends: ["ifNil:", "new"]
  38257. }),
  38258. $globals.SemanticAnalyzer);
  38259. $core.addMethod(
  38260. $core.method({
  38261. selector: "newBlockScope",
  38262. protocol: "factory",
  38263. fn: function (){
  38264. var self=this,$self=this;
  38265. return $core.withContext(function($ctx1) {
  38266. return $self._newScopeOfClass_($globals.LexicalScope);
  38267. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38268. },
  38269. args: [],
  38270. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38271. referencedClasses: ["LexicalScope"],
  38272. messageSends: ["newScopeOfClass:"]
  38273. }),
  38274. $globals.SemanticAnalyzer);
  38275. $core.addMethod(
  38276. $core.method({
  38277. selector: "newMethodScope",
  38278. protocol: "factory",
  38279. fn: function (){
  38280. var self=this,$self=this;
  38281. return $core.withContext(function($ctx1) {
  38282. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38283. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38284. },
  38285. args: [],
  38286. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38287. referencedClasses: ["MethodLexicalScope"],
  38288. messageSends: ["newScopeOfClass:"]
  38289. }),
  38290. $globals.SemanticAnalyzer);
  38291. $core.addMethod(
  38292. $core.method({
  38293. selector: "newScopeOfClass:",
  38294. protocol: "factory",
  38295. fn: function (aLexicalScopeClass){
  38296. var self=this,$self=this;
  38297. return $core.withContext(function($ctx1) {
  38298. var $1;
  38299. $1=$recv(aLexicalScopeClass)._new();
  38300. $recv($1)._outerScope_($self["@currentScope"]);
  38301. return $recv($1)._yourself();
  38302. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38303. },
  38304. args: ["aLexicalScopeClass"],
  38305. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38306. referencedClasses: [],
  38307. messageSends: ["outerScope:", "new", "yourself"]
  38308. }),
  38309. $globals.SemanticAnalyzer);
  38310. $core.addMethod(
  38311. $core.method({
  38312. selector: "nextBlockIndex",
  38313. protocol: "private",
  38314. fn: function (){
  38315. var self=this,$self=this;
  38316. return $core.withContext(function($ctx1) {
  38317. var $1,$receiver;
  38318. $1=$self["@blockIndex"];
  38319. if(($receiver = $1) == null || $receiver.a$nil){
  38320. $self["@blockIndex"]=(0);
  38321. $self["@blockIndex"];
  38322. } else {
  38323. $1;
  38324. }
  38325. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38326. return $self["@blockIndex"];
  38327. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38328. },
  38329. args: [],
  38330. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38331. referencedClasses: [],
  38332. messageSends: ["ifNil:", "+"]
  38333. }),
  38334. $globals.SemanticAnalyzer);
  38335. $core.addMethod(
  38336. $core.method({
  38337. selector: "popScope",
  38338. protocol: "scope",
  38339. fn: function (){
  38340. var self=this,$self=this;
  38341. return $core.withContext(function($ctx1) {
  38342. var $1,$receiver;
  38343. $1=$self["@currentScope"];
  38344. if(($receiver = $1) == null || $receiver.a$nil){
  38345. $1;
  38346. } else {
  38347. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38348. $self["@currentScope"];
  38349. }
  38350. return self;
  38351. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38352. },
  38353. args: [],
  38354. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38355. referencedClasses: [],
  38356. messageSends: ["ifNotNil:", "outerScope"]
  38357. }),
  38358. $globals.SemanticAnalyzer);
  38359. $core.addMethod(
  38360. $core.method({
  38361. selector: "pushScope:",
  38362. protocol: "scope",
  38363. fn: function (aScope){
  38364. var self=this,$self=this;
  38365. return $core.withContext(function($ctx1) {
  38366. $recv(aScope)._outerScope_($self["@currentScope"]);
  38367. $self["@currentScope"]=aScope;
  38368. return self;
  38369. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38370. },
  38371. args: ["aScope"],
  38372. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38373. referencedClasses: [],
  38374. messageSends: ["outerScope:"]
  38375. }),
  38376. $globals.SemanticAnalyzer);
  38377. $core.addMethod(
  38378. $core.method({
  38379. selector: "theClass",
  38380. protocol: "accessing",
  38381. fn: function (){
  38382. var self=this,$self=this;
  38383. return $self["@theClass"];
  38384. },
  38385. args: [],
  38386. source: "theClass\x0a\x09^ theClass",
  38387. referencedClasses: [],
  38388. messageSends: []
  38389. }),
  38390. $globals.SemanticAnalyzer);
  38391. $core.addMethod(
  38392. $core.method({
  38393. selector: "theClass:",
  38394. protocol: "accessing",
  38395. fn: function (aClass){
  38396. var self=this,$self=this;
  38397. $self["@theClass"]=aClass;
  38398. return self;
  38399. },
  38400. args: ["aClass"],
  38401. source: "theClass: aClass\x0a\x09theClass := aClass",
  38402. referencedClasses: [],
  38403. messageSends: []
  38404. }),
  38405. $globals.SemanticAnalyzer);
  38406. $core.addMethod(
  38407. $core.method({
  38408. selector: "thePackage",
  38409. protocol: "accessing",
  38410. fn: function (){
  38411. var self=this,$self=this;
  38412. return $self["@thePackage"];
  38413. },
  38414. args: [],
  38415. source: "thePackage\x0a\x09^ thePackage",
  38416. referencedClasses: [],
  38417. messageSends: []
  38418. }),
  38419. $globals.SemanticAnalyzer);
  38420. $core.addMethod(
  38421. $core.method({
  38422. selector: "thePackage:",
  38423. protocol: "accessing",
  38424. fn: function (aPackage){
  38425. var self=this,$self=this;
  38426. $self["@thePackage"]=aPackage;
  38427. return self;
  38428. },
  38429. args: ["aPackage"],
  38430. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38431. referencedClasses: [],
  38432. messageSends: []
  38433. }),
  38434. $globals.SemanticAnalyzer);
  38435. $core.addMethod(
  38436. $core.method({
  38437. selector: "validateVariableScope:",
  38438. protocol: "scope",
  38439. fn: function (aString){
  38440. var self=this,$self=this;
  38441. return $core.withContext(function($ctx1) {
  38442. var $1,$receiver;
  38443. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38444. if(($receiver = $1) == null || $receiver.a$nil){
  38445. $1;
  38446. } else {
  38447. $self._errorShadowingVariable_(aString);
  38448. }
  38449. return self;
  38450. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38451. },
  38452. args: ["aString"],
  38453. 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 ]",
  38454. referencedClasses: [],
  38455. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38456. }),
  38457. $globals.SemanticAnalyzer);
  38458. $core.addMethod(
  38459. $core.method({
  38460. selector: "visitAssignmentNode:",
  38461. protocol: "visiting",
  38462. fn: function (aNode){
  38463. var self=this,$self=this;
  38464. return $core.withContext(function($ctx1) {
  38465. (
  38466. $ctx1.supercall = true,
  38467. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38468. $ctx1.supercall = false;
  38469. $recv($recv(aNode)._left())._beAssigned();
  38470. return self;
  38471. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38472. },
  38473. args: ["aNode"],
  38474. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38475. referencedClasses: [],
  38476. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38477. }),
  38478. $globals.SemanticAnalyzer);
  38479. $core.addMethod(
  38480. $core.method({
  38481. selector: "visitBlockNode:",
  38482. protocol: "visiting",
  38483. fn: function (aNode){
  38484. var self=this,$self=this;
  38485. return $core.withContext(function($ctx1) {
  38486. $self._pushScope_($self._newBlockScope());
  38487. $recv(aNode)._scope_($self["@currentScope"]);
  38488. $recv($self["@currentScope"])._node_(aNode);
  38489. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38490. $recv($recv(aNode)._parameters())._do_((function(each){
  38491. return $core.withContext(function($ctx2) {
  38492. $self._validateVariableScope_(each);
  38493. return $recv($self["@currentScope"])._addArg_(each);
  38494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38495. }));
  38496. (
  38497. $ctx1.supercall = true,
  38498. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38499. $ctx1.supercall = false;
  38500. $self._popScope();
  38501. return self;
  38502. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38503. },
  38504. args: ["aNode"],
  38505. 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",
  38506. referencedClasses: [],
  38507. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38508. }),
  38509. $globals.SemanticAnalyzer);
  38510. $core.addMethod(
  38511. $core.method({
  38512. selector: "visitCascadeNode:",
  38513. protocol: "visiting",
  38514. fn: function (aNode){
  38515. var self=this,$self=this;
  38516. return $core.withContext(function($ctx1) {
  38517. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38518. (
  38519. $ctx1.supercall = true,
  38520. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38521. $ctx1.supercall = false;
  38522. return self;
  38523. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38524. },
  38525. args: ["aNode"],
  38526. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38527. referencedClasses: [],
  38528. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38529. }),
  38530. $globals.SemanticAnalyzer);
  38531. $core.addMethod(
  38532. $core.method({
  38533. selector: "visitMethodNode:",
  38534. protocol: "visiting",
  38535. fn: function (aNode){
  38536. var self=this,$self=this;
  38537. return $core.withContext(function($ctx1) {
  38538. $self._pushScope_($self._newMethodScope());
  38539. $recv(aNode)._scope_($self["@currentScope"]);
  38540. $recv($self["@currentScope"])._node_(aNode);
  38541. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38542. return $core.withContext(function($ctx2) {
  38543. return $recv($self["@currentScope"])._addIVar_(each);
  38544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38545. }));
  38546. $ctx1.sendIdx["do:"]=1;
  38547. $recv($recv(aNode)._arguments())._do_((function(each){
  38548. return $core.withContext(function($ctx2) {
  38549. $self._validateVariableScope_(each);
  38550. return $recv($self["@currentScope"])._addArg_(each);
  38551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38552. }));
  38553. (
  38554. $ctx1.supercall = true,
  38555. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38556. $ctx1.supercall = false;
  38557. $recv(aNode)._classReferences_($self._classReferences());
  38558. $recv(aNode)._sendIndexes_($self._messageSends());
  38559. $self._popScope();
  38560. return aNode;
  38561. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38562. },
  38563. args: ["aNode"],
  38564. 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",
  38565. referencedClasses: [],
  38566. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38567. }),
  38568. $globals.SemanticAnalyzer);
  38569. $core.addMethod(
  38570. $core.method({
  38571. selector: "visitReturnNode:",
  38572. protocol: "visiting",
  38573. fn: function (aNode){
  38574. var self=this,$self=this;
  38575. return $core.withContext(function($ctx1) {
  38576. var $1;
  38577. $recv(aNode)._scope_($self["@currentScope"]);
  38578. $1=$recv($self["@currentScope"])._isMethodScope();
  38579. if($core.assert($1)){
  38580. $recv($self["@currentScope"])._localReturn_(true);
  38581. } else {
  38582. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38583. }
  38584. (
  38585. $ctx1.supercall = true,
  38586. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38587. $ctx1.supercall = false;
  38588. return self;
  38589. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38590. },
  38591. args: ["aNode"],
  38592. 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",
  38593. referencedClasses: [],
  38594. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38595. }),
  38596. $globals.SemanticAnalyzer);
  38597. $core.addMethod(
  38598. $core.method({
  38599. selector: "visitSendNode:",
  38600. protocol: "visiting",
  38601. fn: function (aNode){
  38602. var self=this,$self=this;
  38603. var sends;
  38604. return $core.withContext(function($ctx1) {
  38605. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38606. return $core.withContext(function($ctx2) {
  38607. return $recv($globals.OrderedCollection)._new();
  38608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38609. }));
  38610. $recv(sends)._add_(aNode);
  38611. $recv(aNode)._index_($recv(sends)._size());
  38612. (
  38613. $ctx1.supercall = true,
  38614. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38615. $ctx1.supercall = false;
  38616. return self;
  38617. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38618. },
  38619. args: ["aNode"],
  38620. 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",
  38621. referencedClasses: ["OrderedCollection"],
  38622. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38623. }),
  38624. $globals.SemanticAnalyzer);
  38625. $core.addMethod(
  38626. $core.method({
  38627. selector: "visitSequenceNode:",
  38628. protocol: "visiting",
  38629. fn: function (aNode){
  38630. var self=this,$self=this;
  38631. return $core.withContext(function($ctx1) {
  38632. $recv($recv(aNode)._temps())._do_((function(each){
  38633. return $core.withContext(function($ctx2) {
  38634. $self._validateVariableScope_(each);
  38635. return $recv($self["@currentScope"])._addTemp_(each);
  38636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38637. }));
  38638. (
  38639. $ctx1.supercall = true,
  38640. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38641. $ctx1.supercall = false;
  38642. return self;
  38643. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38644. },
  38645. args: ["aNode"],
  38646. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38647. referencedClasses: [],
  38648. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38649. }),
  38650. $globals.SemanticAnalyzer);
  38651. $core.addMethod(
  38652. $core.method({
  38653. selector: "visitVariableNode:",
  38654. protocol: "visiting",
  38655. fn: function (aNode){
  38656. var self=this,$self=this;
  38657. var binding;
  38658. return $core.withContext(function($ctx1) {
  38659. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38660. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38661. $1=binding;
  38662. if(($receiver = $1) == null || $receiver.a$nil){
  38663. $3=$recv(aNode)._value();
  38664. $ctx1.sendIdx["value"]=1;
  38665. $2=$recv($3)._isCapitalized();
  38666. if($core.assert($2)){
  38667. $4=$recv($globals.ClassRefVar)._new();
  38668. $ctx1.sendIdx["new"]=1;
  38669. $5=$recv(aNode)._value();
  38670. $ctx1.sendIdx["value"]=2;
  38671. $recv($4)._name_($5);
  38672. $ctx1.sendIdx["name:"]=1;
  38673. $6=$recv($4)._yourself();
  38674. $ctx1.sendIdx["yourself"]=1;
  38675. binding=$6;
  38676. $7=$self._classReferences();
  38677. $8=$recv(aNode)._value();
  38678. $ctx1.sendIdx["value"]=3;
  38679. $recv($7)._add_($8);
  38680. } else {
  38681. $self._errorUnknownVariable_(aNode);
  38682. $9=$recv($globals.UnknownVar)._new();
  38683. $recv($9)._name_($recv(aNode)._value());
  38684. binding=$recv($9)._yourself();
  38685. binding;
  38686. }
  38687. } else {
  38688. $1;
  38689. }
  38690. $recv(aNode)._binding_(binding);
  38691. return self;
  38692. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38693. },
  38694. args: ["aNode"],
  38695. 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.",
  38696. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38697. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38698. }),
  38699. $globals.SemanticAnalyzer);
  38700. $core.addMethod(
  38701. $core.method({
  38702. selector: "on:",
  38703. protocol: "instance creation",
  38704. fn: function (aClass){
  38705. var self=this,$self=this;
  38706. return $core.withContext(function($ctx1) {
  38707. var $1;
  38708. $1=$self._new();
  38709. $recv($1)._theClass_(aClass);
  38710. return $recv($1)._yourself();
  38711. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38712. },
  38713. args: ["aClass"],
  38714. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38715. referencedClasses: [],
  38716. messageSends: ["theClass:", "new", "yourself"]
  38717. }),
  38718. $globals.SemanticAnalyzer.a$cls);
  38719. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38720. $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";
  38721. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38722. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38723. $core.addMethod(
  38724. $core.method({
  38725. selector: "messageText",
  38726. protocol: "accessing",
  38727. fn: function (){
  38728. var self=this,$self=this;
  38729. return $core.withContext(function($ctx1) {
  38730. return " Invalid assignment to variable: ".__comma($self._variableName());
  38731. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38732. },
  38733. args: [],
  38734. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38735. referencedClasses: [],
  38736. messageSends: [",", "variableName"]
  38737. }),
  38738. $globals.InvalidAssignmentError);
  38739. $core.addMethod(
  38740. $core.method({
  38741. selector: "variableName",
  38742. protocol: "accessing",
  38743. fn: function (){
  38744. var self=this,$self=this;
  38745. return $self["@variableName"];
  38746. },
  38747. args: [],
  38748. source: "variableName\x0a\x09^ variableName",
  38749. referencedClasses: [],
  38750. messageSends: []
  38751. }),
  38752. $globals.InvalidAssignmentError);
  38753. $core.addMethod(
  38754. $core.method({
  38755. selector: "variableName:",
  38756. protocol: "accessing",
  38757. fn: function (aString){
  38758. var self=this,$self=this;
  38759. $self["@variableName"]=aString;
  38760. return self;
  38761. },
  38762. args: ["aString"],
  38763. source: "variableName: aString\x0a\x09variableName := aString",
  38764. referencedClasses: [],
  38765. messageSends: []
  38766. }),
  38767. $globals.InvalidAssignmentError);
  38768. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38769. $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.";
  38770. $core.addMethod(
  38771. $core.method({
  38772. selector: "messageText",
  38773. protocol: "accessing",
  38774. fn: function (){
  38775. var self=this,$self=this;
  38776. return $core.withContext(function($ctx1) {
  38777. var $1;
  38778. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38779. $ctx1.sendIdx[","]=1;
  38780. return $1;
  38781. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38782. },
  38783. args: [],
  38784. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38785. referencedClasses: [],
  38786. messageSends: [",", "variableName"]
  38787. }),
  38788. $globals.ShadowingVariableError);
  38789. $core.addMethod(
  38790. $core.method({
  38791. selector: "variableName",
  38792. protocol: "accessing",
  38793. fn: function (){
  38794. var self=this,$self=this;
  38795. return $self["@variableName"];
  38796. },
  38797. args: [],
  38798. source: "variableName\x0a\x09^ variableName",
  38799. referencedClasses: [],
  38800. messageSends: []
  38801. }),
  38802. $globals.ShadowingVariableError);
  38803. $core.addMethod(
  38804. $core.method({
  38805. selector: "variableName:",
  38806. protocol: "accessing",
  38807. fn: function (aString){
  38808. var self=this,$self=this;
  38809. $self["@variableName"]=aString;
  38810. return self;
  38811. },
  38812. args: ["aString"],
  38813. source: "variableName: aString\x0a\x09variableName := aString",
  38814. referencedClasses: [],
  38815. messageSends: []
  38816. }),
  38817. $globals.ShadowingVariableError);
  38818. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38819. $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.";
  38820. $core.addMethod(
  38821. $core.method({
  38822. selector: "messageText",
  38823. protocol: "accessing",
  38824. fn: function (){
  38825. var self=this,$self=this;
  38826. return $core.withContext(function($ctx1) {
  38827. var $1;
  38828. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38829. $ctx1.sendIdx[","]=1;
  38830. return $1;
  38831. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38832. },
  38833. args: [],
  38834. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38835. referencedClasses: [],
  38836. messageSends: [",", "variableName"]
  38837. }),
  38838. $globals.UnknownVariableError);
  38839. $core.addMethod(
  38840. $core.method({
  38841. selector: "variableName",
  38842. protocol: "accessing",
  38843. fn: function (){
  38844. var self=this,$self=this;
  38845. return $self["@variableName"];
  38846. },
  38847. args: [],
  38848. source: "variableName\x0a\x09^ variableName",
  38849. referencedClasses: [],
  38850. messageSends: []
  38851. }),
  38852. $globals.UnknownVariableError);
  38853. $core.addMethod(
  38854. $core.method({
  38855. selector: "variableName:",
  38856. protocol: "accessing",
  38857. fn: function (aString){
  38858. var self=this,$self=this;
  38859. $self["@variableName"]=aString;
  38860. return self;
  38861. },
  38862. args: ["aString"],
  38863. source: "variableName: aString\x0a\x09variableName := aString",
  38864. referencedClasses: [],
  38865. messageSends: []
  38866. }),
  38867. $globals.UnknownVariableError);
  38868. $core.addMethod(
  38869. $core.method({
  38870. selector: "inlineJS:",
  38871. protocol: "*Compiler-Semantic",
  38872. fn: function (aString){
  38873. var self=this,$self=this;
  38874. return $core.withContext(function($ctx1) {
  38875. var $2,$1,$3,$5,$4;
  38876. $2=$self._sequenceNode();
  38877. $ctx1.sendIdx["sequenceNode"]=1;
  38878. $1=$recv($2)._dagChildren();
  38879. $recv($1)._ifNotEmpty_((function(){
  38880. return $core.withContext(function($ctx2) {
  38881. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  38882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38883. }));
  38884. $3=$self._sequenceNode();
  38885. $5=$recv($globals.JSStatementNode)._new();
  38886. $recv($5)._source_(aString);
  38887. $4=$recv($5)._yourself();
  38888. $recv($3)._addDagChild_($4);
  38889. return self;
  38890. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38891. },
  38892. args: ["aString"],
  38893. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38894. referencedClasses: ["CompilerError", "JSStatementNode"],
  38895. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38896. }),
  38897. $globals.EarlyPragmator);
  38898. });
  38899. 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";
  38900. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38901. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38902. $core.addPackage("Compiler-IR");
  38903. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38904. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38905. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38906. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38907. $core.addMethod(
  38908. $core.method({
  38909. selector: "addToSequence:",
  38910. protocol: "visiting",
  38911. fn: function (anInstruction){
  38912. var self=this,$self=this;
  38913. return $core.withContext(function($ctx1) {
  38914. var $1,$receiver;
  38915. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38916. anInstruction;
  38917. } else {
  38918. $1=$recv(anInstruction)._isVariable();
  38919. if(!$core.assert($1)){
  38920. $recv($self._sequence())._add_(anInstruction);
  38921. }
  38922. }
  38923. return anInstruction;
  38924. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38925. },
  38926. args: ["anInstruction"],
  38927. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38928. referencedClasses: [],
  38929. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38930. }),
  38931. $globals.IRASTTranslator);
  38932. $core.addMethod(
  38933. $core.method({
  38934. selector: "alias:",
  38935. protocol: "visiting",
  38936. fn: function (aNode){
  38937. var self=this,$self=this;
  38938. var variable;
  38939. return $core.withContext(function($ctx1) {
  38940. var $1,$2,$3,$5,$4,$6,$8,$7;
  38941. $1=$recv(aNode)._isImmutable();
  38942. if($core.assert($1)){
  38943. $2=$self._visit_(aNode);
  38944. $ctx1.sendIdx["visit:"]=1;
  38945. return $2;
  38946. }
  38947. $3=$recv($globals.IRVariable)._new();
  38948. $ctx1.sendIdx["new"]=1;
  38949. $5=$recv($globals.AliasVar)._new();
  38950. $ctx1.sendIdx["new"]=2;
  38951. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38952. $recv($3)._variable_($4);
  38953. $6=$recv($3)._yourself();
  38954. $ctx1.sendIdx["yourself"]=1;
  38955. variable=$6;
  38956. $8=$recv($globals.IRAssignment)._new();
  38957. $recv($8)._add_(variable);
  38958. $ctx1.sendIdx["add:"]=1;
  38959. $recv($8)._add_($self._visit_(aNode));
  38960. $ctx1.sendIdx["add:"]=2;
  38961. $7=$recv($8)._yourself();
  38962. $self._addToSequence_($7);
  38963. $recv($recv($self._method())._internalVariables())._add_(variable);
  38964. return variable;
  38965. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38966. },
  38967. args: ["aNode"],
  38968. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38969. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38970. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38971. }),
  38972. $globals.IRASTTranslator);
  38973. $core.addMethod(
  38974. $core.method({
  38975. selector: "aliasTemporally:",
  38976. protocol: "visiting",
  38977. fn: function (aCollection){
  38978. var self=this,$self=this;
  38979. var threshold,result;
  38980. return $core.withContext(function($ctx1) {
  38981. var $1,$2,$4,$3;
  38982. threshold=(0);
  38983. $recv(aCollection)._withIndexDo_((function(each,i){
  38984. return $core.withContext(function($ctx2) {
  38985. $1=$recv(each)._subtreeNeedsAliasing();
  38986. if($core.assert($1)){
  38987. threshold=i;
  38988. return threshold;
  38989. }
  38990. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38991. }));
  38992. $ctx1.sendIdx["withIndexDo:"]=1;
  38993. result=$recv($globals.OrderedCollection)._new();
  38994. $recv(aCollection)._withIndexDo_((function(each,i){
  38995. return $core.withContext(function($ctx2) {
  38996. $2=result;
  38997. $4=$recv(i).__lt_eq(threshold);
  38998. if($core.assert($4)){
  38999. $3=$self._alias_(each);
  39000. } else {
  39001. $3=$self._visit_(each);
  39002. }
  39003. return $recv($2)._add_($3);
  39004. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  39005. }));
  39006. return result;
  39007. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  39008. },
  39009. args: ["aCollection"],
  39010. 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",
  39011. referencedClasses: ["OrderedCollection"],
  39012. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  39013. }),
  39014. $globals.IRASTTranslator);
  39015. $core.addMethod(
  39016. $core.method({
  39017. selector: "method",
  39018. protocol: "accessing",
  39019. fn: function (){
  39020. var self=this,$self=this;
  39021. return $self["@method"];
  39022. },
  39023. args: [],
  39024. source: "method\x0a\x09^ method",
  39025. referencedClasses: [],
  39026. messageSends: []
  39027. }),
  39028. $globals.IRASTTranslator);
  39029. $core.addMethod(
  39030. $core.method({
  39031. selector: "method:",
  39032. protocol: "accessing",
  39033. fn: function (anIRMethod){
  39034. var self=this,$self=this;
  39035. $self["@method"]=anIRMethod;
  39036. return self;
  39037. },
  39038. args: ["anIRMethod"],
  39039. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  39040. referencedClasses: [],
  39041. messageSends: []
  39042. }),
  39043. $globals.IRASTTranslator);
  39044. $core.addMethod(
  39045. $core.method({
  39046. selector: "nextAlias",
  39047. protocol: "accessing",
  39048. fn: function (){
  39049. var self=this,$self=this;
  39050. return $core.withContext(function($ctx1) {
  39051. var $1,$receiver;
  39052. $1=$self["@nextAlias"];
  39053. if(($receiver = $1) == null || $receiver.a$nil){
  39054. $self["@nextAlias"]=(0);
  39055. $self["@nextAlias"];
  39056. } else {
  39057. $1;
  39058. }
  39059. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  39060. return $recv($self["@nextAlias"])._asString();
  39061. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  39062. },
  39063. args: [],
  39064. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  39065. referencedClasses: [],
  39066. messageSends: ["ifNil:", "+", "asString"]
  39067. }),
  39068. $globals.IRASTTranslator);
  39069. $core.addMethod(
  39070. $core.method({
  39071. selector: "sequence",
  39072. protocol: "accessing",
  39073. fn: function (){
  39074. var self=this,$self=this;
  39075. return $self["@sequence"];
  39076. },
  39077. args: [],
  39078. source: "sequence\x0a\x09^ sequence",
  39079. referencedClasses: [],
  39080. messageSends: []
  39081. }),
  39082. $globals.IRASTTranslator);
  39083. $core.addMethod(
  39084. $core.method({
  39085. selector: "sequence:",
  39086. protocol: "accessing",
  39087. fn: function (anIRSequence){
  39088. var self=this,$self=this;
  39089. $self["@sequence"]=anIRSequence;
  39090. return self;
  39091. },
  39092. args: ["anIRSequence"],
  39093. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  39094. referencedClasses: [],
  39095. messageSends: []
  39096. }),
  39097. $globals.IRASTTranslator);
  39098. $core.addMethod(
  39099. $core.method({
  39100. selector: "source",
  39101. protocol: "accessing",
  39102. fn: function (){
  39103. var self=this,$self=this;
  39104. return $self["@source"];
  39105. },
  39106. args: [],
  39107. source: "source\x0a\x09^ source",
  39108. referencedClasses: [],
  39109. messageSends: []
  39110. }),
  39111. $globals.IRASTTranslator);
  39112. $core.addMethod(
  39113. $core.method({
  39114. selector: "source:",
  39115. protocol: "accessing",
  39116. fn: function (aString){
  39117. var self=this,$self=this;
  39118. $self["@source"]=aString;
  39119. return self;
  39120. },
  39121. args: ["aString"],
  39122. source: "source: aString\x0a\x09source := aString",
  39123. referencedClasses: [],
  39124. messageSends: []
  39125. }),
  39126. $globals.IRASTTranslator);
  39127. $core.addMethod(
  39128. $core.method({
  39129. selector: "theClass",
  39130. protocol: "accessing",
  39131. fn: function (){
  39132. var self=this,$self=this;
  39133. return $self["@theClass"];
  39134. },
  39135. args: [],
  39136. source: "theClass\x0a\x09^ theClass",
  39137. referencedClasses: [],
  39138. messageSends: []
  39139. }),
  39140. $globals.IRASTTranslator);
  39141. $core.addMethod(
  39142. $core.method({
  39143. selector: "theClass:",
  39144. protocol: "accessing",
  39145. fn: function (aClass){
  39146. var self=this,$self=this;
  39147. $self["@theClass"]=aClass;
  39148. return self;
  39149. },
  39150. args: ["aClass"],
  39151. source: "theClass: aClass\x0a\x09theClass := aClass",
  39152. referencedClasses: [],
  39153. messageSends: []
  39154. }),
  39155. $globals.IRASTTranslator);
  39156. $core.addMethod(
  39157. $core.method({
  39158. selector: "visitAssignmentNode:",
  39159. protocol: "visiting",
  39160. fn: function (aNode){
  39161. var self=this,$self=this;
  39162. var left,right,assignment;
  39163. return $core.withContext(function($ctx1) {
  39164. var $2,$1;
  39165. right=$self._visit_($recv(aNode)._right());
  39166. $ctx1.sendIdx["visit:"]=1;
  39167. left=$self._visit_($recv(aNode)._left());
  39168. $2=$recv($globals.IRAssignment)._new();
  39169. $recv($2)._add_(left);
  39170. $ctx1.sendIdx["add:"]=1;
  39171. $recv($2)._add_(right);
  39172. $1=$recv($2)._yourself();
  39173. $self._addToSequence_($1);
  39174. return left;
  39175. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  39176. },
  39177. args: ["aNode"],
  39178. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  39179. referencedClasses: ["IRAssignment"],
  39180. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39181. }),
  39182. $globals.IRASTTranslator);
  39183. $core.addMethod(
  39184. $core.method({
  39185. selector: "visitBlockNode:",
  39186. protocol: "visiting",
  39187. fn: function (aNode){
  39188. var self=this,$self=this;
  39189. var closure;
  39190. return $core.withContext(function($ctx1) {
  39191. var $1,$2,$3,$5,$4,$6,$8,$7;
  39192. $1=$recv($globals.IRClosure)._new();
  39193. $ctx1.sendIdx["new"]=1;
  39194. $recv($1)._arguments_($recv(aNode)._parameters());
  39195. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39196. $2=$recv(aNode)._scope();
  39197. $ctx1.sendIdx["scope"]=1;
  39198. $recv($1)._scope_($2);
  39199. $ctx1.sendIdx["scope:"]=1;
  39200. $3=$recv($1)._yourself();
  39201. $ctx1.sendIdx["yourself"]=1;
  39202. closure=$3;
  39203. $5=$recv(aNode)._scope();
  39204. $ctx1.sendIdx["scope"]=2;
  39205. $4=$recv($5)._temps();
  39206. $recv($4)._do_((function(each){
  39207. return $core.withContext(function($ctx2) {
  39208. $6=closure;
  39209. $8=$recv($globals.IRTempDeclaration)._new();
  39210. $recv($8)._name_($recv(each)._name());
  39211. $recv($8)._scope_($recv(aNode)._scope());
  39212. $7=$recv($8)._yourself();
  39213. return $recv($6)._add_($7);
  39214. $ctx2.sendIdx["add:"]=1;
  39215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39216. }));
  39217. $ctx1.sendIdx["do:"]=1;
  39218. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39219. return $core.withContext(function($ctx2) {
  39220. return $recv(closure)._add_($self._visit_(each));
  39221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39222. }));
  39223. return closure;
  39224. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39225. },
  39226. args: ["aNode"],
  39227. 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",
  39228. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39229. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39230. }),
  39231. $globals.IRASTTranslator);
  39232. $core.addMethod(
  39233. $core.method({
  39234. selector: "visitBlockSequenceNode:",
  39235. protocol: "visiting",
  39236. fn: function (aNode){
  39237. var self=this,$self=this;
  39238. return $core.withContext(function($ctx1) {
  39239. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39240. $1=$recv($globals.IRBlockSequence)._new();
  39241. $ctx1.sendIdx["new"]=1;
  39242. return $self._withSequence_do_($1,(function(){
  39243. return $core.withContext(function($ctx2) {
  39244. $2=$recv(aNode)._dagChildren();
  39245. $ctx2.sendIdx["dagChildren"]=1;
  39246. return $recv($2)._ifNotEmpty_((function(){
  39247. return $core.withContext(function($ctx3) {
  39248. $4=$recv(aNode)._dagChildren();
  39249. $ctx3.sendIdx["dagChildren"]=2;
  39250. $3=$recv($4)._allButLast();
  39251. $recv($3)._do_((function(each){
  39252. return $core.withContext(function($ctx4) {
  39253. $5=$self._visitOrAlias_(each);
  39254. $ctx4.sendIdx["visitOrAlias:"]=1;
  39255. return $self._addToSequence_($5);
  39256. $ctx4.sendIdx["addToSequence:"]=1;
  39257. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39258. }));
  39259. $8=$recv(aNode)._dagChildren();
  39260. $ctx3.sendIdx["dagChildren"]=3;
  39261. $7=$recv($8)._last();
  39262. $ctx3.sendIdx["last"]=1;
  39263. $6=$recv($7)._isReturnNode();
  39264. if($core.assert($6)){
  39265. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39266. } else {
  39267. $10=$recv($globals.IRBlockReturn)._new();
  39268. $13=$recv(aNode)._dagChildren();
  39269. $ctx3.sendIdx["dagChildren"]=4;
  39270. $12=$recv($13)._last();
  39271. $ctx3.sendIdx["last"]=2;
  39272. $11=$self._visitOrAlias_($12);
  39273. $ctx3.sendIdx["visitOrAlias:"]=2;
  39274. $recv($10)._add_($11);
  39275. $9=$recv($10)._yourself();
  39276. return $self._addToSequence_($9);
  39277. $ctx3.sendIdx["addToSequence:"]=2;
  39278. }
  39279. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39280. }));
  39281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39282. }));
  39283. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39284. },
  39285. args: ["aNode"],
  39286. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  39287. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39288. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39289. }),
  39290. $globals.IRASTTranslator);
  39291. $core.addMethod(
  39292. $core.method({
  39293. selector: "visitCascadeNode:",
  39294. protocol: "visiting",
  39295. fn: function (aNode){
  39296. var self=this,$self=this;
  39297. var receiver;
  39298. return $core.withContext(function($ctx1) {
  39299. var $1,$2,$4,$3;
  39300. receiver=$recv(aNode)._receiver();
  39301. $1=$recv(receiver)._isImmutable();
  39302. if(!$core.assert($1)){
  39303. var alias;
  39304. alias=$self._alias_(receiver);
  39305. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39306. receiver;
  39307. }
  39308. $2=$recv(aNode)._dagChildren();
  39309. $ctx1.sendIdx["dagChildren"]=1;
  39310. $recv($2)._do_((function(each){
  39311. return $core.withContext(function($ctx2) {
  39312. return $recv(each)._receiver_(receiver);
  39313. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39314. }));
  39315. $ctx1.sendIdx["do:"]=1;
  39316. $4=$recv(aNode)._dagChildren();
  39317. $ctx1.sendIdx["dagChildren"]=2;
  39318. $3=$recv($4)._allButLast();
  39319. $recv($3)._do_((function(each){
  39320. return $core.withContext(function($ctx2) {
  39321. return $self._addToSequence_($self._visit_(each));
  39322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39323. }));
  39324. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39325. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39326. },
  39327. args: ["aNode"],
  39328. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  39329. referencedClasses: ["VariableNode"],
  39330. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39331. }),
  39332. $globals.IRASTTranslator);
  39333. $core.addMethod(
  39334. $core.method({
  39335. selector: "visitDynamicArrayNode:",
  39336. protocol: "visiting",
  39337. fn: function (aNode){
  39338. var self=this,$self=this;
  39339. var array;
  39340. return $core.withContext(function($ctx1) {
  39341. array=$recv($globals.IRDynamicArray)._new();
  39342. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39343. return $core.withContext(function($ctx2) {
  39344. return $recv(array)._add_(each);
  39345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39346. }));
  39347. return array;
  39348. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39349. },
  39350. args: ["aNode"],
  39351. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39352. referencedClasses: ["IRDynamicArray"],
  39353. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39354. }),
  39355. $globals.IRASTTranslator);
  39356. $core.addMethod(
  39357. $core.method({
  39358. selector: "visitDynamicDictionaryNode:",
  39359. protocol: "visiting",
  39360. fn: function (aNode){
  39361. var self=this,$self=this;
  39362. var dictionary;
  39363. return $core.withContext(function($ctx1) {
  39364. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39365. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39366. return $core.withContext(function($ctx2) {
  39367. return $recv(dictionary)._add_(each);
  39368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39369. }));
  39370. return dictionary;
  39371. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39372. },
  39373. args: ["aNode"],
  39374. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39375. referencedClasses: ["IRDynamicDictionary"],
  39376. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39377. }),
  39378. $globals.IRASTTranslator);
  39379. $core.addMethod(
  39380. $core.method({
  39381. selector: "visitJSStatementNode:",
  39382. protocol: "visiting",
  39383. fn: function (aNode){
  39384. var self=this,$self=this;
  39385. return $core.withContext(function($ctx1) {
  39386. var $1;
  39387. $1=$recv($globals.IRVerbatim)._new();
  39388. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39389. return $recv($1)._yourself();
  39390. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39391. },
  39392. args: ["aNode"],
  39393. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39394. referencedClasses: ["IRVerbatim"],
  39395. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39396. }),
  39397. $globals.IRASTTranslator);
  39398. $core.addMethod(
  39399. $core.method({
  39400. selector: "visitMethodNode:",
  39401. protocol: "visiting",
  39402. fn: function (aNode){
  39403. var self=this,$self=this;
  39404. return $core.withContext(function($ctx1) {
  39405. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39406. $2=$recv($globals.IRMethod)._new();
  39407. $ctx1.sendIdx["new"]=1;
  39408. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39409. $ctx1.sendIdx["source:"]=1;
  39410. $recv($2)._theClass_($self._theClass());
  39411. $recv($2)._arguments_($recv(aNode)._arguments());
  39412. $recv($2)._selector_($recv(aNode)._selector());
  39413. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39414. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39415. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39416. $3=$recv(aNode)._scope();
  39417. $ctx1.sendIdx["scope"]=1;
  39418. $recv($2)._scope_($3);
  39419. $ctx1.sendIdx["scope:"]=1;
  39420. $4=$recv($2)._yourself();
  39421. $ctx1.sendIdx["yourself"]=1;
  39422. $1=$4;
  39423. $self._method_($1);
  39424. $6=$recv(aNode)._scope();
  39425. $ctx1.sendIdx["scope"]=2;
  39426. $5=$recv($6)._temps();
  39427. $recv($5)._do_((function(each){
  39428. return $core.withContext(function($ctx2) {
  39429. $7=$self._method();
  39430. $ctx2.sendIdx["method"]=1;
  39431. $9=$recv($globals.IRTempDeclaration)._new();
  39432. $ctx2.sendIdx["new"]=2;
  39433. $recv($9)._name_($recv(each)._name());
  39434. $10=$recv(aNode)._scope();
  39435. $ctx2.sendIdx["scope"]=3;
  39436. $recv($9)._scope_($10);
  39437. $11=$recv($9)._yourself();
  39438. $ctx2.sendIdx["yourself"]=2;
  39439. $8=$11;
  39440. return $recv($7)._add_($8);
  39441. $ctx2.sendIdx["add:"]=1;
  39442. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39443. }));
  39444. $ctx1.sendIdx["do:"]=1;
  39445. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39446. return $core.withContext(function($ctx2) {
  39447. $12=$self._method();
  39448. $ctx2.sendIdx["method"]=2;
  39449. return $recv($12)._add_($self._visit_(each));
  39450. $ctx2.sendIdx["add:"]=2;
  39451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39452. }));
  39453. $14=$recv(aNode)._scope();
  39454. $ctx1.sendIdx["scope"]=4;
  39455. $13=$recv($14)._hasLocalReturn();
  39456. if(!$core.assert($13)){
  39457. $15=$self._method();
  39458. $ctx1.sendIdx["method"]=3;
  39459. $17=$recv($globals.IRReturn)._new();
  39460. $ctx1.sendIdx["new"]=3;
  39461. $19=$recv($globals.IRVariable)._new();
  39462. $ctx1.sendIdx["new"]=4;
  39463. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39464. $20=$recv($19)._yourself();
  39465. $ctx1.sendIdx["yourself"]=3;
  39466. $18=$20;
  39467. $recv($17)._add_($18);
  39468. $ctx1.sendIdx["add:"]=4;
  39469. $21=$recv($17)._yourself();
  39470. $ctx1.sendIdx["yourself"]=4;
  39471. $16=$21;
  39472. $recv($15)._add_($16);
  39473. $ctx1.sendIdx["add:"]=3;
  39474. $23=$recv($globals.IRVerbatim)._new();
  39475. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39476. $22=$recv($23)._yourself();
  39477. $recv($15)._add_($22);
  39478. }
  39479. return $self._method();
  39480. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39481. },
  39482. args: ["aNode"],
  39483. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39484. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39485. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  39486. }),
  39487. $globals.IRASTTranslator);
  39488. $core.addMethod(
  39489. $core.method({
  39490. selector: "visitOrAlias:",
  39491. protocol: "visiting",
  39492. fn: function (aNode){
  39493. var self=this,$self=this;
  39494. return $core.withContext(function($ctx1) {
  39495. var $1;
  39496. $1=$recv(aNode)._shouldBeAliased();
  39497. if($core.assert($1)){
  39498. return $self._alias_(aNode);
  39499. } else {
  39500. return $self._visit_(aNode);
  39501. }
  39502. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39503. },
  39504. args: ["aNode"],
  39505. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39506. referencedClasses: [],
  39507. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39508. }),
  39509. $globals.IRASTTranslator);
  39510. $core.addMethod(
  39511. $core.method({
  39512. selector: "visitReturnNode:",
  39513. protocol: "visiting",
  39514. fn: function (aNode){
  39515. var self=this,$self=this;
  39516. var return_;
  39517. return $core.withContext(function($ctx1) {
  39518. var $1;
  39519. $1=$recv(aNode)._nonLocalReturn();
  39520. if($core.assert($1)){
  39521. return_=$recv($globals.IRNonLocalReturn)._new();
  39522. $ctx1.sendIdx["new"]=1;
  39523. } else {
  39524. return_=$recv($globals.IRReturn)._new();
  39525. }
  39526. $recv(return_)._scope_($recv(aNode)._scope());
  39527. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39528. return $core.withContext(function($ctx2) {
  39529. return $recv(return_)._add_($self._visitOrAlias_(each));
  39530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39531. }));
  39532. return return_;
  39533. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39534. },
  39535. args: ["aNode"],
  39536. 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",
  39537. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39538. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39539. }),
  39540. $globals.IRASTTranslator);
  39541. $core.addMethod(
  39542. $core.method({
  39543. selector: "visitSendNode:",
  39544. protocol: "visiting",
  39545. fn: function (aNode){
  39546. var self=this,$self=this;
  39547. var send;
  39548. return $core.withContext(function($ctx1) {
  39549. var $1;
  39550. send=$recv($globals.IRSend)._new();
  39551. $1=send;
  39552. $recv($1)._selector_($recv(aNode)._selector());
  39553. $recv($1)._index_($recv(aNode)._index());
  39554. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39555. return $core.withContext(function($ctx2) {
  39556. return $recv(send)._add_(each);
  39557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39558. }));
  39559. return send;
  39560. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39561. },
  39562. args: ["aNode"],
  39563. 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",
  39564. referencedClasses: ["IRSend"],
  39565. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39566. }),
  39567. $globals.IRASTTranslator);
  39568. $core.addMethod(
  39569. $core.method({
  39570. selector: "visitSequenceNode:",
  39571. protocol: "visiting",
  39572. fn: function (aNode){
  39573. var self=this,$self=this;
  39574. return $core.withContext(function($ctx1) {
  39575. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39576. return $core.withContext(function($ctx2) {
  39577. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39578. return $core.withContext(function($ctx3) {
  39579. return $self._addToSequence_($self._visitOrAlias_(each));
  39580. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39581. }));
  39582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39583. }));
  39584. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39585. },
  39586. args: ["aNode"],
  39587. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  39588. referencedClasses: ["IRSequence"],
  39589. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39590. }),
  39591. $globals.IRASTTranslator);
  39592. $core.addMethod(
  39593. $core.method({
  39594. selector: "visitValueNode:",
  39595. protocol: "visiting",
  39596. fn: function (aNode){
  39597. var self=this,$self=this;
  39598. return $core.withContext(function($ctx1) {
  39599. var $1;
  39600. $1=$recv($globals.IRValue)._new();
  39601. $recv($1)._value_($recv(aNode)._value());
  39602. return $recv($1)._yourself();
  39603. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39604. },
  39605. args: ["aNode"],
  39606. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39607. referencedClasses: ["IRValue"],
  39608. messageSends: ["value:", "new", "value", "yourself"]
  39609. }),
  39610. $globals.IRASTTranslator);
  39611. $core.addMethod(
  39612. $core.method({
  39613. selector: "visitVariableNode:",
  39614. protocol: "visiting",
  39615. fn: function (aNode){
  39616. var self=this,$self=this;
  39617. return $core.withContext(function($ctx1) {
  39618. var $1;
  39619. $1=$recv($globals.IRVariable)._new();
  39620. $recv($1)._variable_($recv(aNode)._binding());
  39621. return $recv($1)._yourself();
  39622. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39623. },
  39624. args: ["aNode"],
  39625. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39626. referencedClasses: ["IRVariable"],
  39627. messageSends: ["variable:", "new", "binding", "yourself"]
  39628. }),
  39629. $globals.IRASTTranslator);
  39630. $core.addMethod(
  39631. $core.method({
  39632. selector: "withSequence:do:",
  39633. protocol: "accessing",
  39634. fn: function (aSequence,aBlock){
  39635. var self=this,$self=this;
  39636. var outerSequence;
  39637. return $core.withContext(function($ctx1) {
  39638. outerSequence=$self._sequence();
  39639. $self._sequence_(aSequence);
  39640. $ctx1.sendIdx["sequence:"]=1;
  39641. $recv(aBlock)._value();
  39642. $self._sequence_(outerSequence);
  39643. return aSequence;
  39644. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39645. },
  39646. args: ["aSequence", "aBlock"],
  39647. 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",
  39648. referencedClasses: [],
  39649. messageSends: ["sequence", "sequence:", "value"]
  39650. }),
  39651. $globals.IRASTTranslator);
  39652. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39653. $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.";
  39654. $core.addMethod(
  39655. $core.method({
  39656. selector: "add:",
  39657. protocol: "building",
  39658. fn: function (anObject){
  39659. var self=this,$self=this;
  39660. return $core.withContext(function($ctx1) {
  39661. $recv(anObject)._parent_(self);
  39662. return $recv($self._dagChildren())._add_(anObject);
  39663. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39664. },
  39665. args: ["anObject"],
  39666. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39667. referencedClasses: [],
  39668. messageSends: ["parent:", "add:", "dagChildren"]
  39669. }),
  39670. $globals.IRInstruction);
  39671. $core.addMethod(
  39672. $core.method({
  39673. selector: "isClosure",
  39674. protocol: "testing",
  39675. fn: function (){
  39676. var self=this,$self=this;
  39677. return false;
  39678. },
  39679. args: [],
  39680. source: "isClosure\x0a\x09^ false",
  39681. referencedClasses: [],
  39682. messageSends: []
  39683. }),
  39684. $globals.IRInstruction);
  39685. $core.addMethod(
  39686. $core.method({
  39687. selector: "isInlined",
  39688. protocol: "testing",
  39689. fn: function (){
  39690. var self=this,$self=this;
  39691. return false;
  39692. },
  39693. args: [],
  39694. source: "isInlined\x0a\x09^ false",
  39695. referencedClasses: [],
  39696. messageSends: []
  39697. }),
  39698. $globals.IRInstruction);
  39699. $core.addMethod(
  39700. $core.method({
  39701. selector: "isMethod",
  39702. protocol: "testing",
  39703. fn: function (){
  39704. var self=this,$self=this;
  39705. return false;
  39706. },
  39707. args: [],
  39708. source: "isMethod\x0a\x09^ false",
  39709. referencedClasses: [],
  39710. messageSends: []
  39711. }),
  39712. $globals.IRInstruction);
  39713. $core.addMethod(
  39714. $core.method({
  39715. selector: "isSelf",
  39716. protocol: "testing",
  39717. fn: function (){
  39718. var self=this,$self=this;
  39719. return false;
  39720. },
  39721. args: [],
  39722. source: "isSelf\x0a\x09^ false",
  39723. referencedClasses: [],
  39724. messageSends: []
  39725. }),
  39726. $globals.IRInstruction);
  39727. $core.addMethod(
  39728. $core.method({
  39729. selector: "isSend",
  39730. protocol: "testing",
  39731. fn: function (){
  39732. var self=this,$self=this;
  39733. return false;
  39734. },
  39735. args: [],
  39736. source: "isSend\x0a\x09^ false",
  39737. referencedClasses: [],
  39738. messageSends: []
  39739. }),
  39740. $globals.IRInstruction);
  39741. $core.addMethod(
  39742. $core.method({
  39743. selector: "isSequence",
  39744. protocol: "testing",
  39745. fn: function (){
  39746. var self=this,$self=this;
  39747. return false;
  39748. },
  39749. args: [],
  39750. source: "isSequence\x0a\x09^ false",
  39751. referencedClasses: [],
  39752. messageSends: []
  39753. }),
  39754. $globals.IRInstruction);
  39755. $core.addMethod(
  39756. $core.method({
  39757. selector: "isSuper",
  39758. protocol: "testing",
  39759. fn: function (){
  39760. var self=this,$self=this;
  39761. return false;
  39762. },
  39763. args: [],
  39764. source: "isSuper\x0a\x09^ false",
  39765. referencedClasses: [],
  39766. messageSends: []
  39767. }),
  39768. $globals.IRInstruction);
  39769. $core.addMethod(
  39770. $core.method({
  39771. selector: "isTempDeclaration",
  39772. protocol: "testing",
  39773. fn: function (){
  39774. var self=this,$self=this;
  39775. return false;
  39776. },
  39777. args: [],
  39778. source: "isTempDeclaration\x0a\x09^ false",
  39779. referencedClasses: [],
  39780. messageSends: []
  39781. }),
  39782. $globals.IRInstruction);
  39783. $core.addMethod(
  39784. $core.method({
  39785. selector: "isVariable",
  39786. protocol: "testing",
  39787. fn: function (){
  39788. var self=this,$self=this;
  39789. return false;
  39790. },
  39791. args: [],
  39792. source: "isVariable\x0a\x09^ false",
  39793. referencedClasses: [],
  39794. messageSends: []
  39795. }),
  39796. $globals.IRInstruction);
  39797. $core.addMethod(
  39798. $core.method({
  39799. selector: "method",
  39800. protocol: "accessing",
  39801. fn: function (){
  39802. var self=this,$self=this;
  39803. return $core.withContext(function($ctx1) {
  39804. return $recv($self._parent())._method();
  39805. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39806. },
  39807. args: [],
  39808. source: "method\x0a\x09^ self parent method",
  39809. referencedClasses: [],
  39810. messageSends: ["method", "parent"]
  39811. }),
  39812. $globals.IRInstruction);
  39813. $core.addMethod(
  39814. $core.method({
  39815. selector: "needsBoxingAsReceiver",
  39816. protocol: "testing",
  39817. fn: function (){
  39818. var self=this,$self=this;
  39819. return true;
  39820. },
  39821. args: [],
  39822. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39823. referencedClasses: [],
  39824. messageSends: []
  39825. }),
  39826. $globals.IRInstruction);
  39827. $core.addMethod(
  39828. $core.method({
  39829. selector: "parent",
  39830. protocol: "accessing",
  39831. fn: function (){
  39832. var self=this,$self=this;
  39833. return $self["@parent"];
  39834. },
  39835. args: [],
  39836. source: "parent\x0a\x09^ parent",
  39837. referencedClasses: [],
  39838. messageSends: []
  39839. }),
  39840. $globals.IRInstruction);
  39841. $core.addMethod(
  39842. $core.method({
  39843. selector: "parent:",
  39844. protocol: "accessing",
  39845. fn: function (anIRInstruction){
  39846. var self=this,$self=this;
  39847. $self["@parent"]=anIRInstruction;
  39848. return self;
  39849. },
  39850. args: ["anIRInstruction"],
  39851. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39852. referencedClasses: [],
  39853. messageSends: []
  39854. }),
  39855. $globals.IRInstruction);
  39856. $core.addMethod(
  39857. $core.method({
  39858. selector: "remove:",
  39859. protocol: "building",
  39860. fn: function (anIRInstruction){
  39861. var self=this,$self=this;
  39862. return $core.withContext(function($ctx1) {
  39863. $recv($self._dagChildren())._remove_(anIRInstruction);
  39864. return self;
  39865. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39866. },
  39867. args: ["anIRInstruction"],
  39868. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39869. referencedClasses: [],
  39870. messageSends: ["remove:", "dagChildren"]
  39871. }),
  39872. $globals.IRInstruction);
  39873. $core.addMethod(
  39874. $core.method({
  39875. selector: "replace:with:",
  39876. protocol: "building",
  39877. fn: function (anIRInstruction,anotherIRInstruction){
  39878. var self=this,$self=this;
  39879. return $core.withContext(function($ctx1) {
  39880. var $1;
  39881. $recv(anotherIRInstruction)._parent_(self);
  39882. $1=$self._dagChildren();
  39883. $ctx1.sendIdx["dagChildren"]=1;
  39884. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39885. return self;
  39886. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39887. },
  39888. args: ["anIRInstruction", "anotherIRInstruction"],
  39889. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39890. referencedClasses: [],
  39891. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39892. }),
  39893. $globals.IRInstruction);
  39894. $core.addMethod(
  39895. $core.method({
  39896. selector: "replaceWith:",
  39897. protocol: "building",
  39898. fn: function (anIRInstruction){
  39899. var self=this,$self=this;
  39900. return $core.withContext(function($ctx1) {
  39901. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39902. return self;
  39903. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39904. },
  39905. args: ["anIRInstruction"],
  39906. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39907. referencedClasses: [],
  39908. messageSends: ["replace:with:", "parent"]
  39909. }),
  39910. $globals.IRInstruction);
  39911. $core.addMethod(
  39912. $core.method({
  39913. selector: "scope",
  39914. protocol: "accessing",
  39915. fn: function (){
  39916. var self=this,$self=this;
  39917. return $core.withContext(function($ctx1) {
  39918. var $1,$receiver;
  39919. $1=$self._parent();
  39920. if(($receiver = $1) == null || $receiver.a$nil){
  39921. return $1;
  39922. } else {
  39923. var node;
  39924. node=$receiver;
  39925. return $recv(node)._scope();
  39926. }
  39927. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39928. },
  39929. args: [],
  39930. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39931. referencedClasses: [],
  39932. messageSends: ["ifNotNil:", "parent", "scope"]
  39933. }),
  39934. $globals.IRInstruction);
  39935. $core.addMethod(
  39936. $core.method({
  39937. selector: "yieldsValue",
  39938. protocol: "testing",
  39939. fn: function (){
  39940. var self=this,$self=this;
  39941. return true;
  39942. },
  39943. args: [],
  39944. source: "yieldsValue\x0a\x09^ true",
  39945. referencedClasses: [],
  39946. messageSends: []
  39947. }),
  39948. $globals.IRInstruction);
  39949. $core.addMethod(
  39950. $core.method({
  39951. selector: "on:",
  39952. protocol: "instance creation",
  39953. fn: function (aBuilder){
  39954. var self=this,$self=this;
  39955. return $core.withContext(function($ctx1) {
  39956. var $1;
  39957. $1=$self._new();
  39958. $recv($1)._builder_(aBuilder);
  39959. return $recv($1)._yourself();
  39960. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39961. },
  39962. args: ["aBuilder"],
  39963. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39964. referencedClasses: [],
  39965. messageSends: ["builder:", "new", "yourself"]
  39966. }),
  39967. $globals.IRInstruction.a$cls);
  39968. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39969. $core.addMethod(
  39970. $core.method({
  39971. selector: "acceptDagVisitor:",
  39972. protocol: "visiting",
  39973. fn: function (aVisitor){
  39974. var self=this,$self=this;
  39975. return $core.withContext(function($ctx1) {
  39976. return $recv(aVisitor)._visitIRAssignment_(self);
  39977. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39978. },
  39979. args: ["aVisitor"],
  39980. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39981. referencedClasses: [],
  39982. messageSends: ["visitIRAssignment:"]
  39983. }),
  39984. $globals.IRAssignment);
  39985. $core.addMethod(
  39986. $core.method({
  39987. selector: "left",
  39988. protocol: "accessing",
  39989. fn: function (){
  39990. var self=this,$self=this;
  39991. return $core.withContext(function($ctx1) {
  39992. return $recv($self._dagChildren())._first();
  39993. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39994. },
  39995. args: [],
  39996. source: "left\x0a\x09^ self dagChildren first",
  39997. referencedClasses: [],
  39998. messageSends: ["first", "dagChildren"]
  39999. }),
  40000. $globals.IRAssignment);
  40001. $core.addMethod(
  40002. $core.method({
  40003. selector: "right",
  40004. protocol: "accessing",
  40005. fn: function (){
  40006. var self=this,$self=this;
  40007. return $core.withContext(function($ctx1) {
  40008. return $recv($self._dagChildren())._last();
  40009. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  40010. },
  40011. args: [],
  40012. source: "right\x0a\x09^ self dagChildren last",
  40013. referencedClasses: [],
  40014. messageSends: ["last", "dagChildren"]
  40015. }),
  40016. $globals.IRAssignment);
  40017. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  40018. $core.addMethod(
  40019. $core.method({
  40020. selector: "acceptDagVisitor:",
  40021. protocol: "visiting",
  40022. fn: function (aVisitor){
  40023. var self=this,$self=this;
  40024. return $core.withContext(function($ctx1) {
  40025. return $recv(aVisitor)._visitIRDynamicArray_(self);
  40026. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  40027. },
  40028. args: ["aVisitor"],
  40029. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  40030. referencedClasses: [],
  40031. messageSends: ["visitIRDynamicArray:"]
  40032. }),
  40033. $globals.IRDynamicArray);
  40034. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  40035. $core.addMethod(
  40036. $core.method({
  40037. selector: "acceptDagVisitor:",
  40038. protocol: "visiting",
  40039. fn: function (aVisitor){
  40040. var self=this,$self=this;
  40041. return $core.withContext(function($ctx1) {
  40042. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  40043. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  40044. },
  40045. args: ["aVisitor"],
  40046. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  40047. referencedClasses: [],
  40048. messageSends: ["visitIRDynamicDictionary:"]
  40049. }),
  40050. $globals.IRDynamicDictionary);
  40051. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  40052. $core.addMethod(
  40053. $core.method({
  40054. selector: "scope",
  40055. protocol: "accessing",
  40056. fn: function (){
  40057. var self=this,$self=this;
  40058. return $self["@scope"];
  40059. },
  40060. args: [],
  40061. source: "scope\x0a\x09^ scope",
  40062. referencedClasses: [],
  40063. messageSends: []
  40064. }),
  40065. $globals.IRScopedInstruction);
  40066. $core.addMethod(
  40067. $core.method({
  40068. selector: "scope:",
  40069. protocol: "accessing",
  40070. fn: function (aScope){
  40071. var self=this,$self=this;
  40072. $self["@scope"]=aScope;
  40073. return self;
  40074. },
  40075. args: ["aScope"],
  40076. source: "scope: aScope\x0a\x09scope := aScope",
  40077. referencedClasses: [],
  40078. messageSends: []
  40079. }),
  40080. $globals.IRScopedInstruction);
  40081. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  40082. $core.addMethod(
  40083. $core.method({
  40084. selector: "arguments",
  40085. protocol: "accessing",
  40086. fn: function (){
  40087. var self=this,$self=this;
  40088. return $core.withContext(function($ctx1) {
  40089. var $1,$receiver;
  40090. $1=$self["@arguments"];
  40091. if(($receiver = $1) == null || $receiver.a$nil){
  40092. return [];
  40093. } else {
  40094. return $1;
  40095. }
  40096. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  40097. },
  40098. args: [],
  40099. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  40100. referencedClasses: [],
  40101. messageSends: ["ifNil:"]
  40102. }),
  40103. $globals.IRClosureInstruction);
  40104. $core.addMethod(
  40105. $core.method({
  40106. selector: "arguments:",
  40107. protocol: "accessing",
  40108. fn: function (aCollection){
  40109. var self=this,$self=this;
  40110. $self["@arguments"]=aCollection;
  40111. return self;
  40112. },
  40113. args: ["aCollection"],
  40114. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  40115. referencedClasses: [],
  40116. messageSends: []
  40117. }),
  40118. $globals.IRClosureInstruction);
  40119. $core.addMethod(
  40120. $core.method({
  40121. selector: "locals",
  40122. protocol: "accessing",
  40123. fn: function (){
  40124. var self=this,$self=this;
  40125. return $core.withContext(function($ctx1) {
  40126. var $1;
  40127. $1=$recv($self._arguments())._copy();
  40128. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  40129. return $core.withContext(function($ctx2) {
  40130. return $recv(each)._name();
  40131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40132. })));
  40133. return $recv($1)._yourself();
  40134. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  40135. },
  40136. args: [],
  40137. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  40138. referencedClasses: [],
  40139. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  40140. }),
  40141. $globals.IRClosureInstruction);
  40142. $core.addMethod(
  40143. $core.method({
  40144. selector: "requiresSmalltalkContext",
  40145. protocol: "accessing",
  40146. fn: function (){
  40147. var self=this,$self=this;
  40148. return $core.withContext(function($ctx1) {
  40149. var $1,$receiver;
  40150. $1=$self["@requiresSmalltalkContext"];
  40151. if(($receiver = $1) == null || $receiver.a$nil){
  40152. return false;
  40153. } else {
  40154. return $1;
  40155. }
  40156. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  40157. },
  40158. args: [],
  40159. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  40160. referencedClasses: [],
  40161. messageSends: ["ifNil:"]
  40162. }),
  40163. $globals.IRClosureInstruction);
  40164. $core.addMethod(
  40165. $core.method({
  40166. selector: "requiresSmalltalkContext:",
  40167. protocol: "accessing",
  40168. fn: function (anObject){
  40169. var self=this,$self=this;
  40170. $self["@requiresSmalltalkContext"]=anObject;
  40171. return self;
  40172. },
  40173. args: ["anObject"],
  40174. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40175. referencedClasses: [],
  40176. messageSends: []
  40177. }),
  40178. $globals.IRClosureInstruction);
  40179. $core.addMethod(
  40180. $core.method({
  40181. selector: "scope:",
  40182. protocol: "accessing",
  40183. fn: function (aScope){
  40184. var self=this,$self=this;
  40185. return $core.withContext(function($ctx1) {
  40186. (
  40187. $ctx1.supercall = true,
  40188. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40189. $ctx1.supercall = false;
  40190. $recv(aScope)._instruction_(self);
  40191. return self;
  40192. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40193. },
  40194. args: ["aScope"],
  40195. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40196. referencedClasses: [],
  40197. messageSends: ["scope:", "instruction:"]
  40198. }),
  40199. $globals.IRClosureInstruction);
  40200. $core.addMethod(
  40201. $core.method({
  40202. selector: "tempDeclarations",
  40203. protocol: "accessing",
  40204. fn: function (){
  40205. var self=this,$self=this;
  40206. return $core.withContext(function($ctx1) {
  40207. return $recv($self._dagChildren())._select_((function(each){
  40208. return $core.withContext(function($ctx2) {
  40209. return $recv(each)._isTempDeclaration();
  40210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40211. }));
  40212. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40213. },
  40214. args: [],
  40215. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40216. referencedClasses: [],
  40217. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40218. }),
  40219. $globals.IRClosureInstruction);
  40220. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40221. $core.addMethod(
  40222. $core.method({
  40223. selector: "acceptDagVisitor:",
  40224. protocol: "visiting",
  40225. fn: function (aVisitor){
  40226. var self=this,$self=this;
  40227. return $core.withContext(function($ctx1) {
  40228. return $recv(aVisitor)._visitIRClosure_(self);
  40229. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40230. },
  40231. args: ["aVisitor"],
  40232. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40233. referencedClasses: [],
  40234. messageSends: ["visitIRClosure:"]
  40235. }),
  40236. $globals.IRClosure);
  40237. $core.addMethod(
  40238. $core.method({
  40239. selector: "isClosure",
  40240. protocol: "testing",
  40241. fn: function (){
  40242. var self=this,$self=this;
  40243. return true;
  40244. },
  40245. args: [],
  40246. source: "isClosure\x0a\x09^ true",
  40247. referencedClasses: [],
  40248. messageSends: []
  40249. }),
  40250. $globals.IRClosure);
  40251. $core.addMethod(
  40252. $core.method({
  40253. selector: "sequence",
  40254. protocol: "accessing",
  40255. fn: function (){
  40256. var self=this,$self=this;
  40257. return $core.withContext(function($ctx1) {
  40258. return $recv($self._dagChildren())._last();
  40259. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40260. },
  40261. args: [],
  40262. source: "sequence\x0a\x09^ self dagChildren last",
  40263. referencedClasses: [],
  40264. messageSends: ["last", "dagChildren"]
  40265. }),
  40266. $globals.IRClosure);
  40267. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40268. $globals.IRMethod.comment="I am a method instruction";
  40269. $core.addMethod(
  40270. $core.method({
  40271. selector: "acceptDagVisitor:",
  40272. protocol: "visiting",
  40273. fn: function (aVisitor){
  40274. var self=this,$self=this;
  40275. return $core.withContext(function($ctx1) {
  40276. return $recv(aVisitor)._visitIRMethod_(self);
  40277. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40278. },
  40279. args: ["aVisitor"],
  40280. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40281. referencedClasses: [],
  40282. messageSends: ["visitIRMethod:"]
  40283. }),
  40284. $globals.IRMethod);
  40285. $core.addMethod(
  40286. $core.method({
  40287. selector: "classReferences",
  40288. protocol: "accessing",
  40289. fn: function (){
  40290. var self=this,$self=this;
  40291. return $self["@classReferences"];
  40292. },
  40293. args: [],
  40294. source: "classReferences\x0a\x09^ classReferences",
  40295. referencedClasses: [],
  40296. messageSends: []
  40297. }),
  40298. $globals.IRMethod);
  40299. $core.addMethod(
  40300. $core.method({
  40301. selector: "classReferences:",
  40302. protocol: "accessing",
  40303. fn: function (aCollection){
  40304. var self=this,$self=this;
  40305. $self["@classReferences"]=aCollection;
  40306. return self;
  40307. },
  40308. args: ["aCollection"],
  40309. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40310. referencedClasses: [],
  40311. messageSends: []
  40312. }),
  40313. $globals.IRMethod);
  40314. $core.addMethod(
  40315. $core.method({
  40316. selector: "internalVariables",
  40317. protocol: "accessing",
  40318. fn: function (){
  40319. var self=this,$self=this;
  40320. return $core.withContext(function($ctx1) {
  40321. var $1,$receiver;
  40322. $1=$self["@internalVariables"];
  40323. if(($receiver = $1) == null || $receiver.a$nil){
  40324. $self["@internalVariables"]=$recv($globals.Set)._new();
  40325. return $self["@internalVariables"];
  40326. } else {
  40327. return $1;
  40328. }
  40329. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40330. },
  40331. args: [],
  40332. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40333. referencedClasses: ["Set"],
  40334. messageSends: ["ifNil:", "new"]
  40335. }),
  40336. $globals.IRMethod);
  40337. $core.addMethod(
  40338. $core.method({
  40339. selector: "isMethod",
  40340. protocol: "testing",
  40341. fn: function (){
  40342. var self=this,$self=this;
  40343. return true;
  40344. },
  40345. args: [],
  40346. source: "isMethod\x0a\x09^ true",
  40347. referencedClasses: [],
  40348. messageSends: []
  40349. }),
  40350. $globals.IRMethod);
  40351. $core.addMethod(
  40352. $core.method({
  40353. selector: "messageSends",
  40354. protocol: "accessing",
  40355. fn: function (){
  40356. var self=this,$self=this;
  40357. return $core.withContext(function($ctx1) {
  40358. return $recv($self._sendIndexes())._keys();
  40359. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40360. },
  40361. args: [],
  40362. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40363. referencedClasses: [],
  40364. messageSends: ["keys", "sendIndexes"]
  40365. }),
  40366. $globals.IRMethod);
  40367. $core.addMethod(
  40368. $core.method({
  40369. selector: "method",
  40370. protocol: "accessing",
  40371. fn: function (){
  40372. var self=this,$self=this;
  40373. return self;
  40374. },
  40375. args: [],
  40376. source: "method\x0a\x09^ self",
  40377. referencedClasses: [],
  40378. messageSends: []
  40379. }),
  40380. $globals.IRMethod);
  40381. $core.addMethod(
  40382. $core.method({
  40383. selector: "selector",
  40384. protocol: "accessing",
  40385. fn: function (){
  40386. var self=this,$self=this;
  40387. return $self["@selector"];
  40388. },
  40389. args: [],
  40390. source: "selector\x0a\x09^ selector",
  40391. referencedClasses: [],
  40392. messageSends: []
  40393. }),
  40394. $globals.IRMethod);
  40395. $core.addMethod(
  40396. $core.method({
  40397. selector: "selector:",
  40398. protocol: "accessing",
  40399. fn: function (aString){
  40400. var self=this,$self=this;
  40401. $self["@selector"]=aString;
  40402. return self;
  40403. },
  40404. args: ["aString"],
  40405. source: "selector: aString\x0a\x09selector := aString",
  40406. referencedClasses: [],
  40407. messageSends: []
  40408. }),
  40409. $globals.IRMethod);
  40410. $core.addMethod(
  40411. $core.method({
  40412. selector: "sendIndexes",
  40413. protocol: "accessing",
  40414. fn: function (){
  40415. var self=this,$self=this;
  40416. return $self["@sendIndexes"];
  40417. },
  40418. args: [],
  40419. source: "sendIndexes\x0a\x09^ sendIndexes",
  40420. referencedClasses: [],
  40421. messageSends: []
  40422. }),
  40423. $globals.IRMethod);
  40424. $core.addMethod(
  40425. $core.method({
  40426. selector: "sendIndexes:",
  40427. protocol: "accessing",
  40428. fn: function (aDictionary){
  40429. var self=this,$self=this;
  40430. $self["@sendIndexes"]=aDictionary;
  40431. return self;
  40432. },
  40433. args: ["aDictionary"],
  40434. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40435. referencedClasses: [],
  40436. messageSends: []
  40437. }),
  40438. $globals.IRMethod);
  40439. $core.addMethod(
  40440. $core.method({
  40441. selector: "source",
  40442. protocol: "accessing",
  40443. fn: function (){
  40444. var self=this,$self=this;
  40445. return $self["@source"];
  40446. },
  40447. args: [],
  40448. source: "source\x0a\x09^ source",
  40449. referencedClasses: [],
  40450. messageSends: []
  40451. }),
  40452. $globals.IRMethod);
  40453. $core.addMethod(
  40454. $core.method({
  40455. selector: "source:",
  40456. protocol: "accessing",
  40457. fn: function (aString){
  40458. var self=this,$self=this;
  40459. $self["@source"]=aString;
  40460. return self;
  40461. },
  40462. args: ["aString"],
  40463. source: "source: aString\x0a\x09source := aString",
  40464. referencedClasses: [],
  40465. messageSends: []
  40466. }),
  40467. $globals.IRMethod);
  40468. $core.addMethod(
  40469. $core.method({
  40470. selector: "theClass",
  40471. protocol: "accessing",
  40472. fn: function (){
  40473. var self=this,$self=this;
  40474. return $self["@theClass"];
  40475. },
  40476. args: [],
  40477. source: "theClass\x0a\x09^ theClass",
  40478. referencedClasses: [],
  40479. messageSends: []
  40480. }),
  40481. $globals.IRMethod);
  40482. $core.addMethod(
  40483. $core.method({
  40484. selector: "theClass:",
  40485. protocol: "accessing",
  40486. fn: function (aClass){
  40487. var self=this,$self=this;
  40488. $self["@theClass"]=aClass;
  40489. return self;
  40490. },
  40491. args: ["aClass"],
  40492. source: "theClass: aClass\x0a\x09theClass := aClass",
  40493. referencedClasses: [],
  40494. messageSends: []
  40495. }),
  40496. $globals.IRMethod);
  40497. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40498. $globals.IRReturn.comment="I am a local return instruction.";
  40499. $core.addMethod(
  40500. $core.method({
  40501. selector: "acceptDagVisitor:",
  40502. protocol: "visiting",
  40503. fn: function (aVisitor){
  40504. var self=this,$self=this;
  40505. return $core.withContext(function($ctx1) {
  40506. return $recv(aVisitor)._visitIRReturn_(self);
  40507. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40508. },
  40509. args: ["aVisitor"],
  40510. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40511. referencedClasses: [],
  40512. messageSends: ["visitIRReturn:"]
  40513. }),
  40514. $globals.IRReturn);
  40515. $core.addMethod(
  40516. $core.method({
  40517. selector: "expression",
  40518. protocol: "accessing",
  40519. fn: function (){
  40520. var self=this,$self=this;
  40521. return $core.withContext(function($ctx1) {
  40522. return $recv($self._dagChildren())._single();
  40523. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40524. },
  40525. args: [],
  40526. source: "expression\x0a\x09^ self dagChildren single",
  40527. referencedClasses: [],
  40528. messageSends: ["single", "dagChildren"]
  40529. }),
  40530. $globals.IRReturn);
  40531. $core.addMethod(
  40532. $core.method({
  40533. selector: "scope",
  40534. protocol: "accessing",
  40535. fn: function (){
  40536. var self=this,$self=this;
  40537. return $core.withContext(function($ctx1) {
  40538. var $1,$receiver;
  40539. $1=$self["@scope"];
  40540. if(($receiver = $1) == null || $receiver.a$nil){
  40541. return $recv($self._parent())._scope();
  40542. } else {
  40543. return $1;
  40544. }
  40545. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40546. },
  40547. args: [],
  40548. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40549. referencedClasses: [],
  40550. messageSends: ["ifNil:", "scope", "parent"]
  40551. }),
  40552. $globals.IRReturn);
  40553. $core.addMethod(
  40554. $core.method({
  40555. selector: "yieldsValue",
  40556. protocol: "testing",
  40557. fn: function (){
  40558. var self=this,$self=this;
  40559. return false;
  40560. },
  40561. args: [],
  40562. source: "yieldsValue\x0a\x09^ false",
  40563. referencedClasses: [],
  40564. messageSends: []
  40565. }),
  40566. $globals.IRReturn);
  40567. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40568. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40569. $core.addMethod(
  40570. $core.method({
  40571. selector: "acceptDagVisitor:",
  40572. protocol: "visiting",
  40573. fn: function (aVisitor){
  40574. var self=this,$self=this;
  40575. return $core.withContext(function($ctx1) {
  40576. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40577. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40578. },
  40579. args: ["aVisitor"],
  40580. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40581. referencedClasses: [],
  40582. messageSends: ["visitIRBlockReturn:"]
  40583. }),
  40584. $globals.IRBlockReturn);
  40585. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40586. $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.";
  40587. $core.addMethod(
  40588. $core.method({
  40589. selector: "acceptDagVisitor:",
  40590. protocol: "visiting",
  40591. fn: function (aVisitor){
  40592. var self=this,$self=this;
  40593. return $core.withContext(function($ctx1) {
  40594. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40595. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40596. },
  40597. args: ["aVisitor"],
  40598. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40599. referencedClasses: [],
  40600. messageSends: ["visitIRNonLocalReturn:"]
  40601. }),
  40602. $globals.IRNonLocalReturn);
  40603. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40604. $core.addMethod(
  40605. $core.method({
  40606. selector: "acceptDagVisitor:",
  40607. protocol: "visiting",
  40608. fn: function (aVisitor){
  40609. var self=this,$self=this;
  40610. return $core.withContext(function($ctx1) {
  40611. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40612. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40613. },
  40614. args: ["aVisitor"],
  40615. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40616. referencedClasses: [],
  40617. messageSends: ["visitIRTempDeclaration:"]
  40618. }),
  40619. $globals.IRTempDeclaration);
  40620. $core.addMethod(
  40621. $core.method({
  40622. selector: "isTempDeclaration",
  40623. protocol: "testing",
  40624. fn: function (){
  40625. var self=this,$self=this;
  40626. return true;
  40627. },
  40628. args: [],
  40629. source: "isTempDeclaration\x0a\x09^ true",
  40630. referencedClasses: [],
  40631. messageSends: []
  40632. }),
  40633. $globals.IRTempDeclaration);
  40634. $core.addMethod(
  40635. $core.method({
  40636. selector: "name",
  40637. protocol: "accessing",
  40638. fn: function (){
  40639. var self=this,$self=this;
  40640. return $self["@name"];
  40641. },
  40642. args: [],
  40643. source: "name\x0a\x09^ name",
  40644. referencedClasses: [],
  40645. messageSends: []
  40646. }),
  40647. $globals.IRTempDeclaration);
  40648. $core.addMethod(
  40649. $core.method({
  40650. selector: "name:",
  40651. protocol: "accessing",
  40652. fn: function (aString){
  40653. var self=this,$self=this;
  40654. $self["@name"]=aString;
  40655. return self;
  40656. },
  40657. args: ["aString"],
  40658. source: "name: aString\x0a\x09name := aString",
  40659. referencedClasses: [],
  40660. messageSends: []
  40661. }),
  40662. $globals.IRTempDeclaration);
  40663. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40664. $globals.IRSend.comment="I am a message send instruction.";
  40665. $core.addMethod(
  40666. $core.method({
  40667. selector: "acceptDagVisitor:",
  40668. protocol: "visiting",
  40669. fn: function (aVisitor){
  40670. var self=this,$self=this;
  40671. return $core.withContext(function($ctx1) {
  40672. return $recv(aVisitor)._visitIRSend_(self);
  40673. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40674. },
  40675. args: ["aVisitor"],
  40676. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40677. referencedClasses: [],
  40678. messageSends: ["visitIRSend:"]
  40679. }),
  40680. $globals.IRSend);
  40681. $core.addMethod(
  40682. $core.method({
  40683. selector: "arguments",
  40684. protocol: "accessing",
  40685. fn: function (){
  40686. var self=this,$self=this;
  40687. return $core.withContext(function($ctx1) {
  40688. return $recv($self._dagChildren())._allButFirst();
  40689. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40690. },
  40691. args: [],
  40692. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40693. referencedClasses: [],
  40694. messageSends: ["allButFirst", "dagChildren"]
  40695. }),
  40696. $globals.IRSend);
  40697. $core.addMethod(
  40698. $core.method({
  40699. selector: "index",
  40700. protocol: "accessing",
  40701. fn: function (){
  40702. var self=this,$self=this;
  40703. return $self["@index"];
  40704. },
  40705. args: [],
  40706. source: "index\x0a\x09^ index",
  40707. referencedClasses: [],
  40708. messageSends: []
  40709. }),
  40710. $globals.IRSend);
  40711. $core.addMethod(
  40712. $core.method({
  40713. selector: "index:",
  40714. protocol: "accessing",
  40715. fn: function (anInteger){
  40716. var self=this,$self=this;
  40717. $self["@index"]=anInteger;
  40718. return self;
  40719. },
  40720. args: ["anInteger"],
  40721. source: "index: anInteger\x0a\x09index := anInteger",
  40722. referencedClasses: [],
  40723. messageSends: []
  40724. }),
  40725. $globals.IRSend);
  40726. $core.addMethod(
  40727. $core.method({
  40728. selector: "isSend",
  40729. protocol: "testing",
  40730. fn: function (){
  40731. var self=this,$self=this;
  40732. return true;
  40733. },
  40734. args: [],
  40735. source: "isSend\x0a\x09^ true",
  40736. referencedClasses: [],
  40737. messageSends: []
  40738. }),
  40739. $globals.IRSend);
  40740. $core.addMethod(
  40741. $core.method({
  40742. selector: "receiver",
  40743. protocol: "accessing",
  40744. fn: function (){
  40745. var self=this,$self=this;
  40746. return $core.withContext(function($ctx1) {
  40747. return $recv($self._dagChildren())._first();
  40748. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40749. },
  40750. args: [],
  40751. source: "receiver\x0a\x09^ self dagChildren first",
  40752. referencedClasses: [],
  40753. messageSends: ["first", "dagChildren"]
  40754. }),
  40755. $globals.IRSend);
  40756. $core.addMethod(
  40757. $core.method({
  40758. selector: "selector",
  40759. protocol: "accessing",
  40760. fn: function (){
  40761. var self=this,$self=this;
  40762. return $self["@selector"];
  40763. },
  40764. args: [],
  40765. source: "selector\x0a\x09^ selector",
  40766. referencedClasses: [],
  40767. messageSends: []
  40768. }),
  40769. $globals.IRSend);
  40770. $core.addMethod(
  40771. $core.method({
  40772. selector: "selector:",
  40773. protocol: "accessing",
  40774. fn: function (aString){
  40775. var self=this,$self=this;
  40776. $self["@selector"]=aString;
  40777. return self;
  40778. },
  40779. args: ["aString"],
  40780. source: "selector: aString\x0a\x09selector := aString",
  40781. referencedClasses: [],
  40782. messageSends: []
  40783. }),
  40784. $globals.IRSend);
  40785. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40786. $core.addMethod(
  40787. $core.method({
  40788. selector: "acceptDagVisitor:",
  40789. protocol: "visiting",
  40790. fn: function (aVisitor){
  40791. var self=this,$self=this;
  40792. return $core.withContext(function($ctx1) {
  40793. return $recv(aVisitor)._visitIRSequence_(self);
  40794. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40795. },
  40796. args: ["aVisitor"],
  40797. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40798. referencedClasses: [],
  40799. messageSends: ["visitIRSequence:"]
  40800. }),
  40801. $globals.IRSequence);
  40802. $core.addMethod(
  40803. $core.method({
  40804. selector: "isSequence",
  40805. protocol: "testing",
  40806. fn: function (){
  40807. var self=this,$self=this;
  40808. return true;
  40809. },
  40810. args: [],
  40811. source: "isSequence\x0a\x09^ true",
  40812. referencedClasses: [],
  40813. messageSends: []
  40814. }),
  40815. $globals.IRSequence);
  40816. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40817. $core.addMethod(
  40818. $core.method({
  40819. selector: "acceptDagVisitor:",
  40820. protocol: "visiting",
  40821. fn: function (aVisitor){
  40822. var self=this,$self=this;
  40823. return $core.withContext(function($ctx1) {
  40824. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40825. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40826. },
  40827. args: ["aVisitor"],
  40828. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40829. referencedClasses: [],
  40830. messageSends: ["visitIRBlockSequence:"]
  40831. }),
  40832. $globals.IRBlockSequence);
  40833. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40834. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40835. $core.addMethod(
  40836. $core.method({
  40837. selector: "acceptDagVisitor:",
  40838. protocol: "visiting",
  40839. fn: function (aVisitor){
  40840. var self=this,$self=this;
  40841. return $core.withContext(function($ctx1) {
  40842. return $recv(aVisitor)._visitIRValue_(self);
  40843. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40844. },
  40845. args: ["aVisitor"],
  40846. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40847. referencedClasses: [],
  40848. messageSends: ["visitIRValue:"]
  40849. }),
  40850. $globals.IRValue);
  40851. $core.addMethod(
  40852. $core.method({
  40853. selector: "needsBoxingAsReceiver",
  40854. protocol: "testing",
  40855. fn: function (){
  40856. var self=this,$self=this;
  40857. return false;
  40858. },
  40859. args: [],
  40860. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40861. referencedClasses: [],
  40862. messageSends: []
  40863. }),
  40864. $globals.IRValue);
  40865. $core.addMethod(
  40866. $core.method({
  40867. selector: "value",
  40868. protocol: "accessing",
  40869. fn: function (){
  40870. var self=this,$self=this;
  40871. return $self["@value"];
  40872. },
  40873. args: [],
  40874. source: "value\x0a\x09^ value",
  40875. referencedClasses: [],
  40876. messageSends: []
  40877. }),
  40878. $globals.IRValue);
  40879. $core.addMethod(
  40880. $core.method({
  40881. selector: "value:",
  40882. protocol: "accessing",
  40883. fn: function (aString){
  40884. var self=this,$self=this;
  40885. $self["@value"]=aString;
  40886. return self;
  40887. },
  40888. args: ["aString"],
  40889. source: "value: aString\x0a\x09value := aString",
  40890. referencedClasses: [],
  40891. messageSends: []
  40892. }),
  40893. $globals.IRValue);
  40894. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40895. $globals.IRVariable.comment="I am a variable instruction.";
  40896. $core.addMethod(
  40897. $core.method({
  40898. selector: "acceptDagVisitor:",
  40899. protocol: "visiting",
  40900. fn: function (aVisitor){
  40901. var self=this,$self=this;
  40902. return $core.withContext(function($ctx1) {
  40903. return $recv(aVisitor)._visitIRVariable_(self);
  40904. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40905. },
  40906. args: ["aVisitor"],
  40907. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40908. referencedClasses: [],
  40909. messageSends: ["visitIRVariable:"]
  40910. }),
  40911. $globals.IRVariable);
  40912. $core.addMethod(
  40913. $core.method({
  40914. selector: "isSelf",
  40915. protocol: "testing",
  40916. fn: function (){
  40917. var self=this,$self=this;
  40918. return $core.withContext(function($ctx1) {
  40919. return $recv($self._variable())._isSelf();
  40920. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40921. },
  40922. args: [],
  40923. source: "isSelf\x0a\x09^ self variable isSelf",
  40924. referencedClasses: [],
  40925. messageSends: ["isSelf", "variable"]
  40926. }),
  40927. $globals.IRVariable);
  40928. $core.addMethod(
  40929. $core.method({
  40930. selector: "isSuper",
  40931. protocol: "testing",
  40932. fn: function (){
  40933. var self=this,$self=this;
  40934. return $core.withContext(function($ctx1) {
  40935. return $recv($self._variable())._isSuper();
  40936. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40937. },
  40938. args: [],
  40939. source: "isSuper\x0a\x09^ self variable isSuper",
  40940. referencedClasses: [],
  40941. messageSends: ["isSuper", "variable"]
  40942. }),
  40943. $globals.IRVariable);
  40944. $core.addMethod(
  40945. $core.method({
  40946. selector: "isVariable",
  40947. protocol: "testing",
  40948. fn: function (){
  40949. var self=this,$self=this;
  40950. return true;
  40951. },
  40952. args: [],
  40953. source: "isVariable\x0a\x09^ true",
  40954. referencedClasses: [],
  40955. messageSends: []
  40956. }),
  40957. $globals.IRVariable);
  40958. $core.addMethod(
  40959. $core.method({
  40960. selector: "needsBoxingAsReceiver",
  40961. protocol: "testing",
  40962. fn: function (){
  40963. var self=this,$self=this;
  40964. return $core.withContext(function($ctx1) {
  40965. return $recv($recv($self._variable())._isPseudoVar())._not();
  40966. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40967. },
  40968. args: [],
  40969. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40970. referencedClasses: [],
  40971. messageSends: ["not", "isPseudoVar", "variable"]
  40972. }),
  40973. $globals.IRVariable);
  40974. $core.addMethod(
  40975. $core.method({
  40976. selector: "variable",
  40977. protocol: "accessing",
  40978. fn: function (){
  40979. var self=this,$self=this;
  40980. return $self["@variable"];
  40981. },
  40982. args: [],
  40983. source: "variable\x0a\x09^ variable",
  40984. referencedClasses: [],
  40985. messageSends: []
  40986. }),
  40987. $globals.IRVariable);
  40988. $core.addMethod(
  40989. $core.method({
  40990. selector: "variable:",
  40991. protocol: "accessing",
  40992. fn: function (aScopeVariable){
  40993. var self=this,$self=this;
  40994. $self["@variable"]=aScopeVariable;
  40995. return self;
  40996. },
  40997. args: ["aScopeVariable"],
  40998. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40999. referencedClasses: [],
  41000. messageSends: []
  41001. }),
  41002. $globals.IRVariable);
  41003. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  41004. $core.addMethod(
  41005. $core.method({
  41006. selector: "acceptDagVisitor:",
  41007. protocol: "visiting",
  41008. fn: function (aVisitor){
  41009. var self=this,$self=this;
  41010. return $core.withContext(function($ctx1) {
  41011. return $recv(aVisitor)._visitIRVerbatim_(self);
  41012. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  41013. },
  41014. args: ["aVisitor"],
  41015. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  41016. referencedClasses: [],
  41017. messageSends: ["visitIRVerbatim:"]
  41018. }),
  41019. $globals.IRVerbatim);
  41020. $core.addMethod(
  41021. $core.method({
  41022. selector: "source",
  41023. protocol: "accessing",
  41024. fn: function (){
  41025. var self=this,$self=this;
  41026. return $self["@source"];
  41027. },
  41028. args: [],
  41029. source: "source\x0a\x09^ source",
  41030. referencedClasses: [],
  41031. messageSends: []
  41032. }),
  41033. $globals.IRVerbatim);
  41034. $core.addMethod(
  41035. $core.method({
  41036. selector: "source:",
  41037. protocol: "accessing",
  41038. fn: function (aString){
  41039. var self=this,$self=this;
  41040. $self["@source"]=aString;
  41041. return self;
  41042. },
  41043. args: ["aString"],
  41044. source: "source: aString\x0a\x09source := aString",
  41045. referencedClasses: [],
  41046. messageSends: []
  41047. }),
  41048. $globals.IRVerbatim);
  41049. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  41050. $core.addMethod(
  41051. $core.method({
  41052. selector: "visitDagNode:",
  41053. protocol: "visiting",
  41054. fn: function (aNode){
  41055. var self=this,$self=this;
  41056. return $core.withContext(function($ctx1) {
  41057. return $self._visitDagNodeVariantSimple_(aNode);
  41058. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  41059. },
  41060. args: ["aNode"],
  41061. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  41062. referencedClasses: [],
  41063. messageSends: ["visitDagNodeVariantSimple:"]
  41064. }),
  41065. $globals.IRVisitor);
  41066. $core.addMethod(
  41067. $core.method({
  41068. selector: "visitIRAssignment:",
  41069. protocol: "visiting",
  41070. fn: function (anIRAssignment){
  41071. var self=this,$self=this;
  41072. return $core.withContext(function($ctx1) {
  41073. return $self._visitDagNode_(anIRAssignment);
  41074. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  41075. },
  41076. args: ["anIRAssignment"],
  41077. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  41078. referencedClasses: [],
  41079. messageSends: ["visitDagNode:"]
  41080. }),
  41081. $globals.IRVisitor);
  41082. $core.addMethod(
  41083. $core.method({
  41084. selector: "visitIRBlockReturn:",
  41085. protocol: "visiting",
  41086. fn: function (anIRBlockReturn){
  41087. var self=this,$self=this;
  41088. return $core.withContext(function($ctx1) {
  41089. return $self._visitIRReturn_(anIRBlockReturn);
  41090. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  41091. },
  41092. args: ["anIRBlockReturn"],
  41093. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  41094. referencedClasses: [],
  41095. messageSends: ["visitIRReturn:"]
  41096. }),
  41097. $globals.IRVisitor);
  41098. $core.addMethod(
  41099. $core.method({
  41100. selector: "visitIRBlockSequence:",
  41101. protocol: "visiting",
  41102. fn: function (anIRBlockSequence){
  41103. var self=this,$self=this;
  41104. return $core.withContext(function($ctx1) {
  41105. return $self._visitIRSequence_(anIRBlockSequence);
  41106. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  41107. },
  41108. args: ["anIRBlockSequence"],
  41109. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  41110. referencedClasses: [],
  41111. messageSends: ["visitIRSequence:"]
  41112. }),
  41113. $globals.IRVisitor);
  41114. $core.addMethod(
  41115. $core.method({
  41116. selector: "visitIRClosure:",
  41117. protocol: "visiting",
  41118. fn: function (anIRClosure){
  41119. var self=this,$self=this;
  41120. return $core.withContext(function($ctx1) {
  41121. return $self._visitDagNode_(anIRClosure);
  41122. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  41123. },
  41124. args: ["anIRClosure"],
  41125. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  41126. referencedClasses: [],
  41127. messageSends: ["visitDagNode:"]
  41128. }),
  41129. $globals.IRVisitor);
  41130. $core.addMethod(
  41131. $core.method({
  41132. selector: "visitIRDynamicArray:",
  41133. protocol: "visiting",
  41134. fn: function (anIRDynamicArray){
  41135. var self=this,$self=this;
  41136. return $core.withContext(function($ctx1) {
  41137. return $self._visitDagNode_(anIRDynamicArray);
  41138. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  41139. },
  41140. args: ["anIRDynamicArray"],
  41141. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  41142. referencedClasses: [],
  41143. messageSends: ["visitDagNode:"]
  41144. }),
  41145. $globals.IRVisitor);
  41146. $core.addMethod(
  41147. $core.method({
  41148. selector: "visitIRDynamicDictionary:",
  41149. protocol: "visiting",
  41150. fn: function (anIRDynamicDictionary){
  41151. var self=this,$self=this;
  41152. return $core.withContext(function($ctx1) {
  41153. return $self._visitDagNode_(anIRDynamicDictionary);
  41154. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  41155. },
  41156. args: ["anIRDynamicDictionary"],
  41157. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  41158. referencedClasses: [],
  41159. messageSends: ["visitDagNode:"]
  41160. }),
  41161. $globals.IRVisitor);
  41162. $core.addMethod(
  41163. $core.method({
  41164. selector: "visitIRInlinedClosure:",
  41165. protocol: "visiting",
  41166. fn: function (anIRInlinedClosure){
  41167. var self=this,$self=this;
  41168. return $core.withContext(function($ctx1) {
  41169. return $self._visitIRClosure_(anIRInlinedClosure);
  41170. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  41171. },
  41172. args: ["anIRInlinedClosure"],
  41173. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  41174. referencedClasses: [],
  41175. messageSends: ["visitIRClosure:"]
  41176. }),
  41177. $globals.IRVisitor);
  41178. $core.addMethod(
  41179. $core.method({
  41180. selector: "visitIRInlinedSequence:",
  41181. protocol: "visiting",
  41182. fn: function (anIRInlinedSequence){
  41183. var self=this,$self=this;
  41184. return $core.withContext(function($ctx1) {
  41185. return $self._visitIRSequence_(anIRInlinedSequence);
  41186. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  41187. },
  41188. args: ["anIRInlinedSequence"],
  41189. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41190. referencedClasses: [],
  41191. messageSends: ["visitIRSequence:"]
  41192. }),
  41193. $globals.IRVisitor);
  41194. $core.addMethod(
  41195. $core.method({
  41196. selector: "visitIRMethod:",
  41197. protocol: "visiting",
  41198. fn: function (anIRMethod){
  41199. var self=this,$self=this;
  41200. return $core.withContext(function($ctx1) {
  41201. return $self._visitDagNode_(anIRMethod);
  41202. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41203. },
  41204. args: ["anIRMethod"],
  41205. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41206. referencedClasses: [],
  41207. messageSends: ["visitDagNode:"]
  41208. }),
  41209. $globals.IRVisitor);
  41210. $core.addMethod(
  41211. $core.method({
  41212. selector: "visitIRNonLocalReturn:",
  41213. protocol: "visiting",
  41214. fn: function (anIRNonLocalReturn){
  41215. var self=this,$self=this;
  41216. return $core.withContext(function($ctx1) {
  41217. return $self._visitDagNode_(anIRNonLocalReturn);
  41218. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41219. },
  41220. args: ["anIRNonLocalReturn"],
  41221. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41222. referencedClasses: [],
  41223. messageSends: ["visitDagNode:"]
  41224. }),
  41225. $globals.IRVisitor);
  41226. $core.addMethod(
  41227. $core.method({
  41228. selector: "visitIRNonLocalReturnHandling:",
  41229. protocol: "visiting",
  41230. fn: function (anIRNonLocalReturnHandling){
  41231. var self=this,$self=this;
  41232. return $core.withContext(function($ctx1) {
  41233. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41234. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41235. },
  41236. args: ["anIRNonLocalReturnHandling"],
  41237. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41238. referencedClasses: [],
  41239. messageSends: ["visitDagNode:"]
  41240. }),
  41241. $globals.IRVisitor);
  41242. $core.addMethod(
  41243. $core.method({
  41244. selector: "visitIRReturn:",
  41245. protocol: "visiting",
  41246. fn: function (anIRReturn){
  41247. var self=this,$self=this;
  41248. return $core.withContext(function($ctx1) {
  41249. return $self._visitDagNode_(anIRReturn);
  41250. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41251. },
  41252. args: ["anIRReturn"],
  41253. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41254. referencedClasses: [],
  41255. messageSends: ["visitDagNode:"]
  41256. }),
  41257. $globals.IRVisitor);
  41258. $core.addMethod(
  41259. $core.method({
  41260. selector: "visitIRSend:",
  41261. protocol: "visiting",
  41262. fn: function (anIRSend){
  41263. var self=this,$self=this;
  41264. return $core.withContext(function($ctx1) {
  41265. return $self._visitDagNode_(anIRSend);
  41266. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41267. },
  41268. args: ["anIRSend"],
  41269. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41270. referencedClasses: [],
  41271. messageSends: ["visitDagNode:"]
  41272. }),
  41273. $globals.IRVisitor);
  41274. $core.addMethod(
  41275. $core.method({
  41276. selector: "visitIRSequence:",
  41277. protocol: "visiting",
  41278. fn: function (anIRSequence){
  41279. var self=this,$self=this;
  41280. return $core.withContext(function($ctx1) {
  41281. return $self._visitDagNode_(anIRSequence);
  41282. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41283. },
  41284. args: ["anIRSequence"],
  41285. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41286. referencedClasses: [],
  41287. messageSends: ["visitDagNode:"]
  41288. }),
  41289. $globals.IRVisitor);
  41290. $core.addMethod(
  41291. $core.method({
  41292. selector: "visitIRTempDeclaration:",
  41293. protocol: "visiting",
  41294. fn: function (anIRTempDeclaration){
  41295. var self=this,$self=this;
  41296. return $core.withContext(function($ctx1) {
  41297. return $self._visitDagNode_(anIRTempDeclaration);
  41298. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41299. },
  41300. args: ["anIRTempDeclaration"],
  41301. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41302. referencedClasses: [],
  41303. messageSends: ["visitDagNode:"]
  41304. }),
  41305. $globals.IRVisitor);
  41306. $core.addMethod(
  41307. $core.method({
  41308. selector: "visitIRValue:",
  41309. protocol: "visiting",
  41310. fn: function (anIRValue){
  41311. var self=this,$self=this;
  41312. return $core.withContext(function($ctx1) {
  41313. return $self._visitDagNode_(anIRValue);
  41314. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41315. },
  41316. args: ["anIRValue"],
  41317. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41318. referencedClasses: [],
  41319. messageSends: ["visitDagNode:"]
  41320. }),
  41321. $globals.IRVisitor);
  41322. $core.addMethod(
  41323. $core.method({
  41324. selector: "visitIRVariable:",
  41325. protocol: "visiting",
  41326. fn: function (anIRVariable){
  41327. var self=this,$self=this;
  41328. return $core.withContext(function($ctx1) {
  41329. return $self._visitDagNode_(anIRVariable);
  41330. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41331. },
  41332. args: ["anIRVariable"],
  41333. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41334. referencedClasses: [],
  41335. messageSends: ["visitDagNode:"]
  41336. }),
  41337. $globals.IRVisitor);
  41338. $core.addMethod(
  41339. $core.method({
  41340. selector: "visitIRVerbatim:",
  41341. protocol: "visiting",
  41342. fn: function (anIRVerbatim){
  41343. var self=this,$self=this;
  41344. return $core.withContext(function($ctx1) {
  41345. return $self._visitDagNode_(anIRVerbatim);
  41346. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41347. },
  41348. args: ["anIRVerbatim"],
  41349. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41350. referencedClasses: [],
  41351. messageSends: ["visitDagNode:"]
  41352. }),
  41353. $globals.IRVisitor);
  41354. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41355. $core.addMethod(
  41356. $core.method({
  41357. selector: "contents",
  41358. protocol: "accessing",
  41359. fn: function (){
  41360. var self=this,$self=this;
  41361. return $core.withContext(function($ctx1) {
  41362. return $recv($self._stream())._contents();
  41363. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41364. },
  41365. args: [],
  41366. source: "contents\x0a\x09^ self stream contents",
  41367. referencedClasses: [],
  41368. messageSends: ["contents", "stream"]
  41369. }),
  41370. $globals.IRJSTranslator);
  41371. $core.addMethod(
  41372. $core.method({
  41373. selector: "currentClass",
  41374. protocol: "accessing",
  41375. fn: function (){
  41376. var self=this,$self=this;
  41377. return $self["@currentClass"];
  41378. },
  41379. args: [],
  41380. source: "currentClass\x0a\x09^ currentClass",
  41381. referencedClasses: [],
  41382. messageSends: []
  41383. }),
  41384. $globals.IRJSTranslator);
  41385. $core.addMethod(
  41386. $core.method({
  41387. selector: "currentClass:",
  41388. protocol: "accessing",
  41389. fn: function (aClass){
  41390. var self=this,$self=this;
  41391. $self["@currentClass"]=aClass;
  41392. return self;
  41393. },
  41394. args: ["aClass"],
  41395. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41396. referencedClasses: [],
  41397. messageSends: []
  41398. }),
  41399. $globals.IRJSTranslator);
  41400. $core.addMethod(
  41401. $core.method({
  41402. selector: "initialize",
  41403. protocol: "initialization",
  41404. fn: function (){
  41405. var self=this,$self=this;
  41406. return $core.withContext(function($ctx1) {
  41407. (
  41408. $ctx1.supercall = true,
  41409. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41410. $ctx1.supercall = false;
  41411. $self["@stream"]=$recv($globals.JSStream)._new();
  41412. return self;
  41413. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41414. },
  41415. args: [],
  41416. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41417. referencedClasses: ["JSStream"],
  41418. messageSends: ["initialize", "new"]
  41419. }),
  41420. $globals.IRJSTranslator);
  41421. $core.addMethod(
  41422. $core.method({
  41423. selector: "stream",
  41424. protocol: "accessing",
  41425. fn: function (){
  41426. var self=this,$self=this;
  41427. return $self["@stream"];
  41428. },
  41429. args: [],
  41430. source: "stream\x0a\x09^ stream",
  41431. referencedClasses: [],
  41432. messageSends: []
  41433. }),
  41434. $globals.IRJSTranslator);
  41435. $core.addMethod(
  41436. $core.method({
  41437. selector: "stream:",
  41438. protocol: "accessing",
  41439. fn: function (aStream){
  41440. var self=this,$self=this;
  41441. $self["@stream"]=aStream;
  41442. return self;
  41443. },
  41444. args: ["aStream"],
  41445. source: "stream: aStream\x0a\x09stream := aStream",
  41446. referencedClasses: [],
  41447. messageSends: []
  41448. }),
  41449. $globals.IRJSTranslator);
  41450. $core.addMethod(
  41451. $core.method({
  41452. selector: "visitIRAssignment:",
  41453. protocol: "visiting",
  41454. fn: function (anIRAssignment){
  41455. var self=this,$self=this;
  41456. return $core.withContext(function($ctx1) {
  41457. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41458. return $core.withContext(function($ctx2) {
  41459. return $self._visit_($recv(anIRAssignment)._left());
  41460. $ctx2.sendIdx["visit:"]=1;
  41461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41462. }),(function(){
  41463. return $core.withContext(function($ctx2) {
  41464. return $self._visit_($recv(anIRAssignment)._right());
  41465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41466. }));
  41467. return self;
  41468. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41469. },
  41470. args: ["anIRAssignment"],
  41471. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41472. referencedClasses: [],
  41473. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41474. }),
  41475. $globals.IRJSTranslator);
  41476. $core.addMethod(
  41477. $core.method({
  41478. selector: "visitIRClosure:",
  41479. protocol: "visiting",
  41480. fn: function (anIRClosure){
  41481. var self=this,$self=this;
  41482. return $core.withContext(function($ctx1) {
  41483. var $1,$2;
  41484. $1=$self._stream();
  41485. $ctx1.sendIdx["stream"]=1;
  41486. $recv($1)._nextPutClosureWith_arguments_((function(){
  41487. return $core.withContext(function($ctx2) {
  41488. $2=$self._stream();
  41489. $ctx2.sendIdx["stream"]=2;
  41490. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41491. return $core.withContext(function($ctx3) {
  41492. return $recv($recv(each)._name())._asVariableName();
  41493. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41494. })));
  41495. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41496. return $core.withContext(function($ctx3) {
  41497. return (
  41498. $ctx3.supercall = true,
  41499. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41500. $ctx3.supercall = false;
  41501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41502. }));
  41503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41504. }),$recv(anIRClosure)._arguments());
  41505. return self;
  41506. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41507. },
  41508. args: ["anIRClosure"],
  41509. 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",
  41510. referencedClasses: [],
  41511. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41512. }),
  41513. $globals.IRJSTranslator);
  41514. $core.addMethod(
  41515. $core.method({
  41516. selector: "visitIRDynamicArray:",
  41517. protocol: "visiting",
  41518. fn: function (anIRDynamicArray){
  41519. var self=this,$self=this;
  41520. return $core.withContext(function($ctx1) {
  41521. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41522. return self;
  41523. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41524. },
  41525. args: ["anIRDynamicArray"],
  41526. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41527. referencedClasses: [],
  41528. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41529. }),
  41530. $globals.IRJSTranslator);
  41531. $core.addMethod(
  41532. $core.method({
  41533. selector: "visitIRDynamicDictionary:",
  41534. protocol: "visiting",
  41535. fn: function (anIRDynamicDictionary){
  41536. var self=this,$self=this;
  41537. return $core.withContext(function($ctx1) {
  41538. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41539. return self;
  41540. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41541. },
  41542. args: ["anIRDynamicDictionary"],
  41543. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41544. referencedClasses: [],
  41545. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41546. }),
  41547. $globals.IRJSTranslator);
  41548. $core.addMethod(
  41549. $core.method({
  41550. selector: "visitIRMethod:",
  41551. protocol: "visiting",
  41552. fn: function (anIRMethod){
  41553. var self=this,$self=this;
  41554. return $core.withContext(function($ctx1) {
  41555. var $1,$2,$3,$4,$5,$6,$7;
  41556. $1=$self._stream();
  41557. $ctx1.sendIdx["stream"]=1;
  41558. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41559. return $core.withContext(function($ctx2) {
  41560. $2=$self._stream();
  41561. $ctx2.sendIdx["stream"]=2;
  41562. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41563. return $core.withContext(function($ctx3) {
  41564. $3=$self._stream();
  41565. $ctx3.sendIdx["stream"]=3;
  41566. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41567. return $core.withContext(function($ctx4) {
  41568. return $recv($recv(each)._name())._asVariableName();
  41569. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41570. }));
  41571. $ctx3.sendIdx["collect:"]=1;
  41572. $recv($3)._nextPutVars_($4);
  41573. $ctx3.sendIdx["nextPutVars:"]=1;
  41574. $5=$self._stream();
  41575. $ctx3.sendIdx["stream"]=4;
  41576. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41577. return $core.withContext(function($ctx4) {
  41578. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41579. return $core.withContext(function($ctx5) {
  41580. $6=$self._stream();
  41581. $ctx5.sendIdx["stream"]=5;
  41582. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41583. return $core.withContext(function($ctx6) {
  41584. return $recv($recv(each)._variable())._alias();
  41585. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41586. })));
  41587. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41588. }));
  41589. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41590. if($core.assert($7)){
  41591. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41592. return $core.withContext(function($ctx5) {
  41593. return (
  41594. $ctx5.supercall = true,
  41595. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41596. $ctx5.supercall = false;
  41597. $ctx5.sendIdx["visitIRMethod:"]=1;
  41598. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41599. }));
  41600. } else {
  41601. return (
  41602. $ctx4.supercall = true,
  41603. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41604. $ctx4.supercall = false;
  41605. }
  41606. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41607. }));
  41608. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41609. }),$recv(anIRMethod)._arguments());
  41610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41611. }));
  41612. return $self._contents();
  41613. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41614. },
  41615. args: ["anIRMethod"],
  41616. 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",
  41617. referencedClasses: [],
  41618. 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"]
  41619. }),
  41620. $globals.IRJSTranslator);
  41621. $core.addMethod(
  41622. $core.method({
  41623. selector: "visitIRNonLocalReturn:",
  41624. protocol: "visiting",
  41625. fn: function (anIRNonLocalReturn){
  41626. var self=this,$self=this;
  41627. return $core.withContext(function($ctx1) {
  41628. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41629. return $core.withContext(function($ctx2) {
  41630. return (
  41631. $ctx2.supercall = true,
  41632. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41633. $ctx2.supercall = false;
  41634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41635. }));
  41636. return self;
  41637. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41638. },
  41639. args: ["anIRNonLocalReturn"],
  41640. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41641. referencedClasses: [],
  41642. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41643. }),
  41644. $globals.IRJSTranslator);
  41645. $core.addMethod(
  41646. $core.method({
  41647. selector: "visitIRReturn:",
  41648. protocol: "visiting",
  41649. fn: function (anIRReturn){
  41650. var self=this,$self=this;
  41651. return $core.withContext(function($ctx1) {
  41652. $recv($self._stream())._nextPutReturnWith_((function(){
  41653. return $core.withContext(function($ctx2) {
  41654. return (
  41655. $ctx2.supercall = true,
  41656. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41657. $ctx2.supercall = false;
  41658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41659. }));
  41660. return self;
  41661. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41662. },
  41663. args: ["anIRReturn"],
  41664. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41665. referencedClasses: [],
  41666. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41667. }),
  41668. $globals.IRJSTranslator);
  41669. $core.addMethod(
  41670. $core.method({
  41671. selector: "visitIRSend:",
  41672. protocol: "visiting",
  41673. fn: function (anIRSend){
  41674. var self=this,$self=this;
  41675. var sends,superclass;
  41676. return $core.withContext(function($ctx1) {
  41677. var $1,$2;
  41678. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41679. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41680. if($core.assert($1)){
  41681. $self._visitSuperSend_(anIRSend);
  41682. } else {
  41683. $self._visitSend_(anIRSend);
  41684. }
  41685. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41686. if($core.assert($2)){
  41687. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41688. }
  41689. return self;
  41690. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41691. },
  41692. args: ["anIRSend"],
  41693. 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 ]",
  41694. referencedClasses: [],
  41695. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41696. }),
  41697. $globals.IRJSTranslator);
  41698. $core.addMethod(
  41699. $core.method({
  41700. selector: "visitIRSequence:",
  41701. protocol: "visiting",
  41702. fn: function (anIRSequence){
  41703. var self=this,$self=this;
  41704. return $core.withContext(function($ctx1) {
  41705. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41706. return $core.withContext(function($ctx2) {
  41707. return $recv($self._stream())._nextPutStatementWith_((function(){
  41708. return $core.withContext(function($ctx3) {
  41709. return $self._visit_(each);
  41710. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41711. }));
  41712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41713. }));
  41714. return self;
  41715. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41716. },
  41717. args: ["anIRSequence"],
  41718. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41719. referencedClasses: [],
  41720. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41721. }),
  41722. $globals.IRJSTranslator);
  41723. $core.addMethod(
  41724. $core.method({
  41725. selector: "visitIRTempDeclaration:",
  41726. protocol: "visiting",
  41727. fn: function (anIRTempDeclaration){
  41728. var self=this,$self=this;
  41729. return self;
  41730. },
  41731. args: ["anIRTempDeclaration"],
  41732. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41733. referencedClasses: [],
  41734. messageSends: []
  41735. }),
  41736. $globals.IRJSTranslator);
  41737. $core.addMethod(
  41738. $core.method({
  41739. selector: "visitIRValue:",
  41740. protocol: "visiting",
  41741. fn: function (anIRValue){
  41742. var self=this,$self=this;
  41743. return $core.withContext(function($ctx1) {
  41744. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41745. return self;
  41746. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41747. },
  41748. args: ["anIRValue"],
  41749. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41750. referencedClasses: [],
  41751. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41752. }),
  41753. $globals.IRJSTranslator);
  41754. $core.addMethod(
  41755. $core.method({
  41756. selector: "visitIRVariable:",
  41757. protocol: "visiting",
  41758. fn: function (anIRVariable){
  41759. var self=this,$self=this;
  41760. return $core.withContext(function($ctx1) {
  41761. var $3,$2,$1,$4;
  41762. $3=$recv(anIRVariable)._variable();
  41763. $ctx1.sendIdx["variable"]=1;
  41764. $2=$recv($3)._name();
  41765. $1=$recv($2).__eq("thisContext");
  41766. if($core.assert($1)){
  41767. $4=$self._stream();
  41768. $ctx1.sendIdx["stream"]=1;
  41769. $recv($4)._nextPutAll_("$core.getThisContext()");
  41770. $ctx1.sendIdx["nextPutAll:"]=1;
  41771. } else {
  41772. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41773. }
  41774. return self;
  41775. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41776. },
  41777. args: ["anIRVariable"],
  41778. 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 ]",
  41779. referencedClasses: [],
  41780. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41781. }),
  41782. $globals.IRJSTranslator);
  41783. $core.addMethod(
  41784. $core.method({
  41785. selector: "visitIRVerbatim:",
  41786. protocol: "visiting",
  41787. fn: function (anIRVerbatim){
  41788. var self=this,$self=this;
  41789. return $core.withContext(function($ctx1) {
  41790. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41791. return self;
  41792. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41793. },
  41794. args: ["anIRVerbatim"],
  41795. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41796. referencedClasses: [],
  41797. messageSends: ["nextPutAll:", "stream", "source"]
  41798. }),
  41799. $globals.IRJSTranslator);
  41800. $core.addMethod(
  41801. $core.method({
  41802. selector: "visitInstructionList:enclosedBetween:and:",
  41803. protocol: "visiting",
  41804. fn: function (anArray,aString,anotherString){
  41805. var self=this,$self=this;
  41806. return $core.withContext(function($ctx1) {
  41807. var $1;
  41808. $1=$self._stream();
  41809. $ctx1.sendIdx["stream"]=1;
  41810. $recv($1)._nextPutAll_(aString);
  41811. $ctx1.sendIdx["nextPutAll:"]=1;
  41812. $recv(anArray)._do_separatedBy_((function(each){
  41813. return $core.withContext(function($ctx2) {
  41814. return $self._visit_(each);
  41815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41816. }),(function(){
  41817. return $core.withContext(function($ctx2) {
  41818. return $recv($self._stream())._nextPutAll_(",");
  41819. $ctx2.sendIdx["nextPutAll:"]=2;
  41820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41821. }));
  41822. $recv($self["@stream"])._nextPutAll_(anotherString);
  41823. return self;
  41824. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41825. },
  41826. args: ["anArray", "aString", "anotherString"],
  41827. 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",
  41828. referencedClasses: [],
  41829. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41830. }),
  41831. $globals.IRJSTranslator);
  41832. $core.addMethod(
  41833. $core.method({
  41834. selector: "visitReceiver:",
  41835. protocol: "visiting",
  41836. fn: function (anIRInstruction){
  41837. var self=this,$self=this;
  41838. var instr;
  41839. return $core.withContext(function($ctx1) {
  41840. var $1,$2,$4,$5,$3,$6,$7,$8;
  41841. $1=$recv(anIRInstruction)._isSelf();
  41842. if($core.assert($1)){
  41843. $2=$recv(anIRInstruction)._copy();
  41844. $ctx1.sendIdx["copy"]=1;
  41845. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41846. $recv($4)._name_("$self");
  41847. $5=$recv($4)._yourself();
  41848. $ctx1.sendIdx["yourself"]=1;
  41849. $3=$5;
  41850. $recv($2)._variable_($3);
  41851. instr=$recv($2)._yourself();
  41852. instr;
  41853. } else {
  41854. instr=anIRInstruction;
  41855. instr;
  41856. }
  41857. $6=$recv(instr)._needsBoxingAsReceiver();
  41858. if(!$core.assert($6)){
  41859. $7=$self._visit_(instr);
  41860. $ctx1.sendIdx["visit:"]=1;
  41861. return $7;
  41862. }
  41863. $8=$self._stream();
  41864. $ctx1.sendIdx["stream"]=1;
  41865. $recv($8)._nextPutAll_("$recv(");
  41866. $ctx1.sendIdx["nextPutAll:"]=1;
  41867. $self._visit_(instr);
  41868. $recv($self._stream())._nextPutAll_(")");
  41869. return self;
  41870. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41871. },
  41872. args: ["anIRInstruction"],
  41873. 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: ')'",
  41874. referencedClasses: [],
  41875. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41876. }),
  41877. $globals.IRJSTranslator);
  41878. $core.addMethod(
  41879. $core.method({
  41880. selector: "visitSend:",
  41881. protocol: "visiting",
  41882. fn: function (anIRSend){
  41883. var self=this,$self=this;
  41884. return $core.withContext(function($ctx1) {
  41885. $self._visitReceiver_($recv(anIRSend)._receiver());
  41886. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41887. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41888. return self;
  41889. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41890. },
  41891. args: ["anIRSend"],
  41892. 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: ')'",
  41893. referencedClasses: [],
  41894. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41895. }),
  41896. $globals.IRJSTranslator);
  41897. $core.addMethod(
  41898. $core.method({
  41899. selector: "visitSuperSend:",
  41900. protocol: "visiting",
  41901. fn: function (anIRSend){
  41902. var self=this,$self=this;
  41903. return $core.withContext(function($ctx1) {
  41904. var $1,$4,$3,$2,$5,$6,$7,$8;
  41905. $1=$self._stream();
  41906. $ctx1.sendIdx["stream"]=1;
  41907. $recv($1)._nextPutAll_("(");
  41908. $ctx1.sendIdx["nextPutAll:"]=1;
  41909. $recv($1)._lf();
  41910. $ctx1.sendIdx["lf"]=1;
  41911. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41912. $ctx1.sendIdx["nextPutAll:"]=2;
  41913. $recv($1)._lf();
  41914. $ctx1.sendIdx["lf"]=2;
  41915. $4=$recv(anIRSend)._scope();
  41916. $ctx1.sendIdx["scope"]=1;
  41917. $3=$recv($4)._alias();
  41918. $ctx1.sendIdx["alias"]=1;
  41919. $2=$recv($3).__comma(".supercall = true,");
  41920. $ctx1.sendIdx[","]=1;
  41921. $recv($1)._nextPutAll_($2);
  41922. $ctx1.sendIdx["nextPutAll:"]=3;
  41923. $recv($1)._lf();
  41924. $ctx1.sendIdx["lf"]=3;
  41925. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41926. $ctx1.sendIdx["nextPutAll:"]=4;
  41927. $recv($1)._lf();
  41928. $ctx1.sendIdx["lf"]=4;
  41929. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41930. $ctx1.sendIdx[","]=2;
  41931. $recv($1)._nextPutAll_($5);
  41932. $ctx1.sendIdx["nextPutAll:"]=5;
  41933. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41934. $ctx1.sendIdx["nextPutAll:"]=6;
  41935. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41936. $ctx1.sendIdx[","]=3;
  41937. $recv($1)._nextPutAll_($6);
  41938. $ctx1.sendIdx["nextPutAll:"]=7;
  41939. $7=$recv($1)._nextPutAll_("$self, ");
  41940. $ctx1.sendIdx["nextPutAll:"]=8;
  41941. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41942. $8=$self._stream();
  41943. $recv($8)._nextPutAll_("));");
  41944. $ctx1.sendIdx["nextPutAll:"]=9;
  41945. $recv($8)._lf();
  41946. $ctx1.sendIdx["lf"]=5;
  41947. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41948. $ctx1.sendIdx["nextPutAll:"]=10;
  41949. $recv($8)._lf();
  41950. $ctx1.sendIdx["lf"]=6;
  41951. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41952. $ctx1.sendIdx["nextPutAll:"]=11;
  41953. $recv($8)._lf();
  41954. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41955. return self;
  41956. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41957. },
  41958. args: ["anIRSend"],
  41959. 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);'",
  41960. referencedClasses: [],
  41961. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41962. }),
  41963. $globals.IRJSTranslator);
  41964. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41965. $core.addMethod(
  41966. $core.method({
  41967. selector: "contents",
  41968. protocol: "accessing",
  41969. fn: function (){
  41970. var self=this,$self=this;
  41971. return $core.withContext(function($ctx1) {
  41972. return $recv($self["@stream"])._contents();
  41973. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41974. },
  41975. args: [],
  41976. source: "contents\x0a\x09^ stream contents",
  41977. referencedClasses: [],
  41978. messageSends: ["contents"]
  41979. }),
  41980. $globals.JSStream);
  41981. $core.addMethod(
  41982. $core.method({
  41983. selector: "initialize",
  41984. protocol: "initialization",
  41985. fn: function (){
  41986. var self=this,$self=this;
  41987. return $core.withContext(function($ctx1) {
  41988. (
  41989. $ctx1.supercall = true,
  41990. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41991. $ctx1.supercall = false;
  41992. $self["@stream"]=""._writeStream();
  41993. return self;
  41994. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41995. },
  41996. args: [],
  41997. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41998. referencedClasses: [],
  41999. messageSends: ["initialize", "writeStream"]
  42000. }),
  42001. $globals.JSStream);
  42002. $core.addMethod(
  42003. $core.method({
  42004. selector: "lf",
  42005. protocol: "streaming",
  42006. fn: function (){
  42007. var self=this,$self=this;
  42008. return $core.withContext(function($ctx1) {
  42009. $recv($self["@stream"])._lf();
  42010. return self;
  42011. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  42012. },
  42013. args: [],
  42014. source: "lf\x0a\x09stream lf",
  42015. referencedClasses: [],
  42016. messageSends: ["lf"]
  42017. }),
  42018. $globals.JSStream);
  42019. $core.addMethod(
  42020. $core.method({
  42021. selector: "nextPut:",
  42022. protocol: "streaming",
  42023. fn: function (aString){
  42024. var self=this,$self=this;
  42025. return $core.withContext(function($ctx1) {
  42026. $recv($self["@stream"])._nextPut_(aString);
  42027. return self;
  42028. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  42029. },
  42030. args: ["aString"],
  42031. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  42032. referencedClasses: [],
  42033. messageSends: ["nextPut:"]
  42034. }),
  42035. $globals.JSStream);
  42036. $core.addMethod(
  42037. $core.method({
  42038. selector: "nextPutAll:",
  42039. protocol: "streaming",
  42040. fn: function (aString){
  42041. var self=this,$self=this;
  42042. return $core.withContext(function($ctx1) {
  42043. $recv($self["@stream"])._nextPutAll_(aString);
  42044. return self;
  42045. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  42046. },
  42047. args: ["aString"],
  42048. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  42049. referencedClasses: [],
  42050. messageSends: ["nextPutAll:"]
  42051. }),
  42052. $globals.JSStream);
  42053. $core.addMethod(
  42054. $core.method({
  42055. selector: "nextPutAssignLhs:rhs:",
  42056. protocol: "streaming",
  42057. fn: function (aBlock,anotherBlock){
  42058. var self=this,$self=this;
  42059. return $core.withContext(function($ctx1) {
  42060. $recv(aBlock)._value();
  42061. $ctx1.sendIdx["value"]=1;
  42062. $recv($self["@stream"])._nextPutAll_("=");
  42063. $recv(anotherBlock)._value();
  42064. return self;
  42065. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42066. },
  42067. args: ["aBlock", "anotherBlock"],
  42068. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  42069. referencedClasses: [],
  42070. messageSends: ["value", "nextPutAll:"]
  42071. }),
  42072. $globals.JSStream);
  42073. $core.addMethod(
  42074. $core.method({
  42075. selector: "nextPutBlockContextFor:during:",
  42076. protocol: "streaming",
  42077. fn: function (anIRClosure,aBlock){
  42078. var self=this,$self=this;
  42079. return $core.withContext(function($ctx1) {
  42080. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  42081. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  42082. if(!$core.assert($1)){
  42083. $2=$recv(aBlock)._value();
  42084. $ctx1.sendIdx["value"]=1;
  42085. return $2;
  42086. }
  42087. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42088. $ctx1.sendIdx["nextPutAll:"]=1;
  42089. $self._lf();
  42090. $ctx1.sendIdx["lf"]=1;
  42091. $6=$recv(anIRClosure)._scope();
  42092. $ctx1.sendIdx["scope"]=1;
  42093. $5=$recv($6)._alias();
  42094. $ctx1.sendIdx["alias"]=1;
  42095. $4="return $core.withContext(function(".__comma($5);
  42096. $ctx1.sendIdx[","]=2;
  42097. $3=$recv($4).__comma(") {");
  42098. $ctx1.sendIdx[","]=1;
  42099. $self._nextPutAll_($3);
  42100. $ctx1.sendIdx["nextPutAll:"]=2;
  42101. $self._lf();
  42102. $ctx1.sendIdx["lf"]=2;
  42103. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42104. $ctx1.sendIdx["nextPutAll:"]=3;
  42105. $7=$self._lf();
  42106. $ctx1.sendIdx["lf"]=3;
  42107. $recv(aBlock)._value();
  42108. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42109. $ctx1.sendIdx["nextPutAll:"]=4;
  42110. $self._lf();
  42111. $ctx1.sendIdx["lf"]=4;
  42112. $11=$recv(anIRClosure)._scope();
  42113. $ctx1.sendIdx["scope"]=2;
  42114. $10=$recv($11)._alias();
  42115. $ctx1.sendIdx["alias"]=2;
  42116. $9="}, function(".__comma($10);
  42117. $ctx1.sendIdx[","]=4;
  42118. $8=$recv($9).__comma(") {");
  42119. $ctx1.sendIdx[","]=3;
  42120. $self._nextPutAll_($8);
  42121. $ctx1.sendIdx["nextPutAll:"]=5;
  42122. $15=$recv(anIRClosure)._scope();
  42123. $ctx1.sendIdx["scope"]=3;
  42124. $14=$recv($15)._alias();
  42125. $ctx1.sendIdx["alias"]=3;
  42126. $13=$recv($14).__comma(".fillBlock({");
  42127. $ctx1.sendIdx[","]=5;
  42128. $12=$self._nextPutAll_($13);
  42129. $ctx1.sendIdx["nextPutAll:"]=6;
  42130. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  42131. return $core.withContext(function($ctx2) {
  42132. $16=$recv(each)._asVariableName();
  42133. $ctx2.sendIdx["asVariableName"]=1;
  42134. $self._nextPutAll_($16);
  42135. $ctx2.sendIdx["nextPutAll:"]=7;
  42136. $self._nextPutAll_(":");
  42137. $ctx2.sendIdx["nextPutAll:"]=8;
  42138. $17=$self._nextPutAll_($recv(each)._asVariableName());
  42139. $ctx2.sendIdx["nextPutAll:"]=9;
  42140. return $17;
  42141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42142. }),(function(){
  42143. return $core.withContext(function($ctx2) {
  42144. return $self._nextPutAll_(",");
  42145. $ctx2.sendIdx["nextPutAll:"]=10;
  42146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42147. }));
  42148. $self._nextPutAll_("},");
  42149. $ctx1.sendIdx["nextPutAll:"]=11;
  42150. $23=$recv(anIRClosure)._scope();
  42151. $ctx1.sendIdx["scope"]=4;
  42152. $22=$recv($23)._outerScope();
  42153. $21=$recv($22)._alias();
  42154. $20=$recv($21).__comma(",");
  42155. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  42156. $ctx1.sendIdx[","]=7;
  42157. $18=$recv($19).__comma(")});");
  42158. $ctx1.sendIdx[","]=6;
  42159. $self._nextPutAll_($18);
  42160. $ctx1.sendIdx["nextPutAll:"]=12;
  42161. $self._lf();
  42162. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42163. return self;
  42164. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  42165. },
  42166. args: ["anIRClosure", "aBlock"],
  42167. 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);'",
  42168. referencedClasses: [],
  42169. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  42170. }),
  42171. $globals.JSStream);
  42172. $core.addMethod(
  42173. $core.method({
  42174. selector: "nextPutClosureWith:arguments:",
  42175. protocol: "streaming",
  42176. fn: function (aBlock,anArray){
  42177. var self=this,$self=this;
  42178. return $core.withContext(function($ctx1) {
  42179. var $1,$2,$3;
  42180. $recv($self["@stream"])._nextPutAll_("(function(");
  42181. $ctx1.sendIdx["nextPutAll:"]=1;
  42182. $recv(anArray)._do_separatedBy_((function(each){
  42183. return $core.withContext(function($ctx2) {
  42184. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42185. $ctx2.sendIdx["nextPutAll:"]=2;
  42186. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42187. }),(function(){
  42188. return $core.withContext(function($ctx2) {
  42189. return $recv($self["@stream"])._nextPut_(",");
  42190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42191. }));
  42192. $1=$self["@stream"];
  42193. $recv($1)._nextPutAll_("){");
  42194. $ctx1.sendIdx["nextPutAll:"]=3;
  42195. $2=$recv($1)._lf();
  42196. $ctx1.sendIdx["lf"]=1;
  42197. $recv(aBlock)._value();
  42198. $3=$self["@stream"];
  42199. $recv($3)._lf();
  42200. $recv($3)._nextPutAll_("})");
  42201. return self;
  42202. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42203. },
  42204. args: ["aBlock", "anArray"],
  42205. 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: '})'",
  42206. referencedClasses: [],
  42207. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42208. }),
  42209. $globals.JSStream);
  42210. $core.addMethod(
  42211. $core.method({
  42212. selector: "nextPutContextFor:during:",
  42213. protocol: "streaming",
  42214. fn: function (aMethod,aBlock){
  42215. var self=this,$self=this;
  42216. return $core.withContext(function($ctx1) {
  42217. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42218. $1=$recv(aMethod)._requiresSmalltalkContext();
  42219. if(!$core.assert($1)){
  42220. $2=$recv(aBlock)._value();
  42221. $ctx1.sendIdx["value"]=1;
  42222. return $2;
  42223. }
  42224. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42225. $ctx1.sendIdx["nextPutAll:"]=1;
  42226. $self._lf();
  42227. $ctx1.sendIdx["lf"]=1;
  42228. $6=$recv(aMethod)._scope();
  42229. $ctx1.sendIdx["scope"]=1;
  42230. $5=$recv($6)._alias();
  42231. $ctx1.sendIdx["alias"]=1;
  42232. $4="return $core.withContext(function(".__comma($5);
  42233. $ctx1.sendIdx[","]=2;
  42234. $3=$recv($4).__comma(") {");
  42235. $ctx1.sendIdx[","]=1;
  42236. $self._nextPutAll_($3);
  42237. $ctx1.sendIdx["nextPutAll:"]=2;
  42238. $self._lf();
  42239. $ctx1.sendIdx["lf"]=2;
  42240. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42241. $ctx1.sendIdx["nextPutAll:"]=3;
  42242. $7=$self._lf();
  42243. $ctx1.sendIdx["lf"]=3;
  42244. $recv(aBlock)._value();
  42245. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42246. $ctx1.sendIdx["nextPutAll:"]=4;
  42247. $self._lf();
  42248. $ctx1.sendIdx["lf"]=4;
  42249. $12=$recv(aMethod)._scope();
  42250. $ctx1.sendIdx["scope"]=2;
  42251. $11=$recv($12)._alias();
  42252. $ctx1.sendIdx["alias"]=2;
  42253. $10="}, function(".__comma($11);
  42254. $ctx1.sendIdx[","]=5;
  42255. $9=$recv($10).__comma(") {");
  42256. $ctx1.sendIdx[","]=4;
  42257. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42258. $ctx1.sendIdx[","]=3;
  42259. $self._nextPutAll_($8);
  42260. $ctx1.sendIdx["nextPutAll:"]=5;
  42261. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42262. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42263. $15=".fill(self,".__comma($16);
  42264. $14=$recv($15).__comma(",{");
  42265. $ctx1.sendIdx[","]=6;
  42266. $13=$self._nextPutAll_($14);
  42267. $ctx1.sendIdx["nextPutAll:"]=6;
  42268. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42269. return $core.withContext(function($ctx2) {
  42270. $17=$recv(each)._asVariableName();
  42271. $ctx2.sendIdx["asVariableName"]=1;
  42272. $self._nextPutAll_($17);
  42273. $ctx2.sendIdx["nextPutAll:"]=7;
  42274. $self._nextPutAll_(":");
  42275. $ctx2.sendIdx["nextPutAll:"]=8;
  42276. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42277. $ctx2.sendIdx["nextPutAll:"]=9;
  42278. return $18;
  42279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42280. }),(function(){
  42281. return $core.withContext(function($ctx2) {
  42282. return $self._nextPutAll_(",");
  42283. $ctx2.sendIdx["nextPutAll:"]=10;
  42284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42285. }));
  42286. $self._nextPutAll_("},");
  42287. $ctx1.sendIdx["nextPutAll:"]=11;
  42288. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42289. $ctx1.sendIdx["nextPutAll:"]=12;
  42290. $self._nextPutAll_(")});");
  42291. $ctx1.sendIdx["nextPutAll:"]=13;
  42292. $self._lf();
  42293. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42294. return self;
  42295. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42296. },
  42297. args: ["aMethod", "aBlock"],
  42298. 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);'",
  42299. referencedClasses: [],
  42300. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42301. }),
  42302. $globals.JSStream);
  42303. $core.addMethod(
  42304. $core.method({
  42305. selector: "nextPutFunctionWith:arguments:",
  42306. protocol: "streaming",
  42307. fn: function (aBlock,anArray){
  42308. var self=this,$self=this;
  42309. return $core.withContext(function($ctx1) {
  42310. var $1,$2,$3,$4,$5;
  42311. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42312. $ctx1.sendIdx["nextPutAll:"]=1;
  42313. $recv(anArray)._do_separatedBy_((function(each){
  42314. return $core.withContext(function($ctx2) {
  42315. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42316. $ctx2.sendIdx["nextPutAll:"]=2;
  42317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42318. }),(function(){
  42319. return $core.withContext(function($ctx2) {
  42320. return $recv($self["@stream"])._nextPut_(",");
  42321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42322. }));
  42323. $1=$self["@stream"];
  42324. $recv($1)._nextPutAll_("){");
  42325. $ctx1.sendIdx["nextPutAll:"]=3;
  42326. $2=$recv($1)._lf();
  42327. $ctx1.sendIdx["lf"]=1;
  42328. $3=$self["@stream"];
  42329. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42330. $ctx1.sendIdx["nextPutAll:"]=4;
  42331. $4=$recv($3)._lf();
  42332. $ctx1.sendIdx["lf"]=2;
  42333. $recv(aBlock)._value();
  42334. $5=$self["@stream"];
  42335. $recv($5)._lf();
  42336. $recv($5)._nextPutAll_("}");
  42337. return self;
  42338. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42339. },
  42340. args: ["aBlock", "anArray"],
  42341. 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: '}'",
  42342. referencedClasses: [],
  42343. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42344. }),
  42345. $globals.JSStream);
  42346. $core.addMethod(
  42347. $core.method({
  42348. selector: "nextPutIf:then:",
  42349. protocol: "streaming",
  42350. fn: function (aBlock,anotherBlock){
  42351. var self=this,$self=this;
  42352. return $core.withContext(function($ctx1) {
  42353. var $1;
  42354. $recv($self["@stream"])._nextPutAll_("if(");
  42355. $ctx1.sendIdx["nextPutAll:"]=1;
  42356. $recv(aBlock)._value();
  42357. $ctx1.sendIdx["value"]=1;
  42358. $1=$self["@stream"];
  42359. $recv($1)._nextPutAll_("){");
  42360. $ctx1.sendIdx["nextPutAll:"]=2;
  42361. $recv($1)._lf();
  42362. $recv(anotherBlock)._value();
  42363. $recv($self["@stream"])._nextPutAll_("}");
  42364. $self._omitSemicolon_(true);
  42365. return self;
  42366. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42367. },
  42368. args: ["aBlock", "anotherBlock"],
  42369. 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",
  42370. referencedClasses: [],
  42371. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42372. }),
  42373. $globals.JSStream);
  42374. $core.addMethod(
  42375. $core.method({
  42376. selector: "nextPutIf:then:else:",
  42377. protocol: "streaming",
  42378. fn: function (aBlock,ifBlock,elseBlock){
  42379. var self=this,$self=this;
  42380. return $core.withContext(function($ctx1) {
  42381. var $1,$2,$3;
  42382. $recv($self["@stream"])._nextPutAll_("if(");
  42383. $ctx1.sendIdx["nextPutAll:"]=1;
  42384. $recv(aBlock)._value();
  42385. $ctx1.sendIdx["value"]=1;
  42386. $1=$self["@stream"];
  42387. $recv($1)._nextPutAll_("){");
  42388. $ctx1.sendIdx["nextPutAll:"]=2;
  42389. $2=$recv($1)._lf();
  42390. $ctx1.sendIdx["lf"]=1;
  42391. $recv(ifBlock)._value();
  42392. $ctx1.sendIdx["value"]=2;
  42393. $3=$self["@stream"];
  42394. $recv($3)._nextPutAll_("} else {");
  42395. $ctx1.sendIdx["nextPutAll:"]=3;
  42396. $recv($3)._lf();
  42397. $recv(elseBlock)._value();
  42398. $recv($self["@stream"])._nextPutAll_("}");
  42399. $self._omitSemicolon_(true);
  42400. return self;
  42401. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42402. },
  42403. args: ["aBlock", "ifBlock", "elseBlock"],
  42404. 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",
  42405. referencedClasses: [],
  42406. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42407. }),
  42408. $globals.JSStream);
  42409. $core.addMethod(
  42410. $core.method({
  42411. selector: "nextPutMethodDeclaration:with:",
  42412. protocol: "streaming",
  42413. fn: function (aMethod,aBlock){
  42414. var self=this,$self=this;
  42415. return $core.withContext(function($ctx1) {
  42416. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42417. $1=$self["@stream"];
  42418. $recv($1)._nextPutAll_("$core.method({");
  42419. $ctx1.sendIdx["nextPutAll:"]=1;
  42420. $recv($1)._lf();
  42421. $ctx1.sendIdx["lf"]=1;
  42422. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42423. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42424. $3="selector: ".__comma($4);
  42425. $ctx1.sendIdx[","]=2;
  42426. $2=$recv($3).__comma(",");
  42427. $ctx1.sendIdx[","]=1;
  42428. $recv($1)._nextPutAll_($2);
  42429. $ctx1.sendIdx["nextPutAll:"]=2;
  42430. $recv($1)._lf();
  42431. $ctx1.sendIdx["lf"]=2;
  42432. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42433. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42434. $6="source: ".__comma($7);
  42435. $ctx1.sendIdx[","]=4;
  42436. $5=$recv($6).__comma(",");
  42437. $ctx1.sendIdx[","]=3;
  42438. $recv($1)._nextPutAll_($5);
  42439. $ctx1.sendIdx["nextPutAll:"]=3;
  42440. $8=$recv($1)._lf();
  42441. $ctx1.sendIdx["lf"]=3;
  42442. $recv(aBlock)._value();
  42443. $ctx1.sendIdx["value"]=1;
  42444. $9=$self["@stream"];
  42445. $12=$recv($globals.String)._lf();
  42446. $ctx1.sendIdx["lf"]=4;
  42447. $11=",".__comma($12);
  42448. $ctx1.sendIdx[","]=6;
  42449. $10=$recv($11).__comma("messageSends: ");
  42450. $ctx1.sendIdx[","]=5;
  42451. $recv($9)._nextPutAll_($10);
  42452. $ctx1.sendIdx["nextPutAll:"]=4;
  42453. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42454. $ctx1.sendIdx["asArray"]=1;
  42455. $14=$recv($15)._asJavaScriptSource();
  42456. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42457. $13=$recv($14).__comma(",");
  42458. $ctx1.sendIdx[","]=7;
  42459. $recv($9)._nextPutAll_($13);
  42460. $ctx1.sendIdx["nextPutAll:"]=5;
  42461. $recv($9)._lf();
  42462. $ctx1.sendIdx["lf"]=5;
  42463. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42464. return $core.withContext(function($ctx2) {
  42465. return $recv(each)._value();
  42466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42467. })))._asArray())._asJavaScriptSource();
  42468. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42469. $17="args: ".__comma($18);
  42470. $16=$recv($17).__comma(",");
  42471. $ctx1.sendIdx[","]=8;
  42472. $recv($9)._nextPutAll_($16);
  42473. $ctx1.sendIdx["nextPutAll:"]=6;
  42474. $recv($9)._lf();
  42475. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42476. $ctx1.sendIdx["nextPutAll:"]=7;
  42477. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42478. return $core.withContext(function($ctx2) {
  42479. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42480. $ctx2.sendIdx["nextPutAll:"]=8;
  42481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42482. }),(function(){
  42483. return $core.withContext(function($ctx2) {
  42484. return $recv($self["@stream"])._nextPutAll_(",");
  42485. $ctx2.sendIdx["nextPutAll:"]=9;
  42486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42487. }));
  42488. $20=$self["@stream"];
  42489. $recv($20)._nextPutAll_("]");
  42490. $ctx1.sendIdx["nextPutAll:"]=10;
  42491. $recv($20)._nextPutAll_("})");
  42492. return self;
  42493. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42494. },
  42495. args: ["aMethod", "aBlock"],
  42496. 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: '})'",
  42497. referencedClasses: ["String"],
  42498. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42499. }),
  42500. $globals.JSStream);
  42501. $core.addMethod(
  42502. $core.method({
  42503. selector: "nextPutNonLocalReturnHandlingWith:",
  42504. protocol: "streaming",
  42505. fn: function (aBlock){
  42506. var self=this,$self=this;
  42507. return $core.withContext(function($ctx1) {
  42508. var $1,$2,$3;
  42509. $1=$self["@stream"];
  42510. $recv($1)._nextPutAll_("var $early={};");
  42511. $ctx1.sendIdx["nextPutAll:"]=1;
  42512. $recv($1)._lf();
  42513. $ctx1.sendIdx["lf"]=1;
  42514. $recv($1)._nextPutAll_("try {");
  42515. $ctx1.sendIdx["nextPutAll:"]=2;
  42516. $2=$recv($1)._lf();
  42517. $ctx1.sendIdx["lf"]=2;
  42518. $recv(aBlock)._value();
  42519. $3=$self["@stream"];
  42520. $recv($3)._nextPutAll_("}");
  42521. $ctx1.sendIdx["nextPutAll:"]=3;
  42522. $recv($3)._lf();
  42523. $ctx1.sendIdx["lf"]=3;
  42524. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42525. $recv($3)._lf();
  42526. return self;
  42527. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42528. },
  42529. args: ["aBlock"],
  42530. 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",
  42531. referencedClasses: [],
  42532. messageSends: ["nextPutAll:", "lf", "value"]
  42533. }),
  42534. $globals.JSStream);
  42535. $core.addMethod(
  42536. $core.method({
  42537. selector: "nextPutNonLocalReturnWith:",
  42538. protocol: "streaming",
  42539. fn: function (aBlock){
  42540. var self=this,$self=this;
  42541. return $core.withContext(function($ctx1) {
  42542. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42543. $ctx1.sendIdx["nextPutAll:"]=1;
  42544. $recv(aBlock)._value();
  42545. $recv($self["@stream"])._nextPutAll_("]");
  42546. return self;
  42547. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42548. },
  42549. args: ["aBlock"],
  42550. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42551. referencedClasses: [],
  42552. messageSends: ["nextPutAll:", "value"]
  42553. }),
  42554. $globals.JSStream);
  42555. $core.addMethod(
  42556. $core.method({
  42557. selector: "nextPutReturnWith:",
  42558. protocol: "streaming",
  42559. fn: function (aBlock){
  42560. var self=this,$self=this;
  42561. return $core.withContext(function($ctx1) {
  42562. $recv($self["@stream"])._nextPutAll_("return ");
  42563. $recv(aBlock)._value();
  42564. return self;
  42565. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42566. },
  42567. args: ["aBlock"],
  42568. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42569. referencedClasses: [],
  42570. messageSends: ["nextPutAll:", "value"]
  42571. }),
  42572. $globals.JSStream);
  42573. $core.addMethod(
  42574. $core.method({
  42575. selector: "nextPutSendIndexFor:",
  42576. protocol: "streaming",
  42577. fn: function (anIRSend){
  42578. var self=this,$self=this;
  42579. return $core.withContext(function($ctx1) {
  42580. $self._nextPutAll_(";");
  42581. $ctx1.sendIdx["nextPutAll:"]=1;
  42582. $self._lf();
  42583. $ctx1.sendIdx["lf"]=1;
  42584. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42585. $ctx1.sendIdx["nextPutAll:"]=2;
  42586. $self._lf();
  42587. $ctx1.sendIdx["lf"]=2;
  42588. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42589. $ctx1.sendIdx["nextPutAll:"]=3;
  42590. $self._nextPutAll_(".sendIdx[");
  42591. $ctx1.sendIdx["nextPutAll:"]=4;
  42592. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42593. $ctx1.sendIdx["nextPutAll:"]=5;
  42594. $self._nextPutAll_("]=");
  42595. $ctx1.sendIdx["nextPutAll:"]=6;
  42596. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42597. $ctx1.sendIdx["nextPutAll:"]=7;
  42598. $self._nextPutAll_(";");
  42599. $ctx1.sendIdx["nextPutAll:"]=8;
  42600. $self._lf();
  42601. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42602. return self;
  42603. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42604. },
  42605. args: ["anIRSend"],
  42606. 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)'",
  42607. referencedClasses: [],
  42608. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42609. }),
  42610. $globals.JSStream);
  42611. $core.addMethod(
  42612. $core.method({
  42613. selector: "nextPutStatementWith:",
  42614. protocol: "streaming",
  42615. fn: function (aBlock){
  42616. var self=this,$self=this;
  42617. return $core.withContext(function($ctx1) {
  42618. var $1;
  42619. $self._omitSemicolon_(false);
  42620. $ctx1.sendIdx["omitSemicolon:"]=1;
  42621. $recv(aBlock)._value();
  42622. $1=$self._omitSemicolon();
  42623. if(!$core.assert($1)){
  42624. $recv($self["@stream"])._nextPutAll_(";");
  42625. }
  42626. $self._omitSemicolon_(false);
  42627. $recv($self["@stream"])._lf();
  42628. return self;
  42629. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42630. },
  42631. args: ["aBlock"],
  42632. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42633. referencedClasses: [],
  42634. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42635. }),
  42636. $globals.JSStream);
  42637. $core.addMethod(
  42638. $core.method({
  42639. selector: "nextPutVars:",
  42640. protocol: "streaming",
  42641. fn: function (aCollection){
  42642. var self=this,$self=this;
  42643. return $core.withContext(function($ctx1) {
  42644. var $1;
  42645. $recv(aCollection)._ifNotEmpty_((function(){
  42646. return $core.withContext(function($ctx2) {
  42647. $recv($self["@stream"])._nextPutAll_("var ");
  42648. $ctx2.sendIdx["nextPutAll:"]=1;
  42649. $recv(aCollection)._do_separatedBy_((function(each){
  42650. return $core.withContext(function($ctx3) {
  42651. return $recv($self["@stream"])._nextPutAll_(each);
  42652. $ctx3.sendIdx["nextPutAll:"]=2;
  42653. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42654. }),(function(){
  42655. return $core.withContext(function($ctx3) {
  42656. return $recv($self["@stream"])._nextPutAll_(",");
  42657. $ctx3.sendIdx["nextPutAll:"]=3;
  42658. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42659. }));
  42660. $1=$self["@stream"];
  42661. $recv($1)._nextPutAll_(";");
  42662. return $recv($1)._lf();
  42663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42664. }));
  42665. return self;
  42666. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42667. },
  42668. args: ["aCollection"],
  42669. 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 ]",
  42670. referencedClasses: [],
  42671. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42672. }),
  42673. $globals.JSStream);
  42674. $core.addMethod(
  42675. $core.method({
  42676. selector: "omitSemicolon",
  42677. protocol: "accessing",
  42678. fn: function (){
  42679. var self=this,$self=this;
  42680. return $self["@omitSemicolon"];
  42681. },
  42682. args: [],
  42683. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42684. referencedClasses: [],
  42685. messageSends: []
  42686. }),
  42687. $globals.JSStream);
  42688. $core.addMethod(
  42689. $core.method({
  42690. selector: "omitSemicolon:",
  42691. protocol: "accessing",
  42692. fn: function (aBoolean){
  42693. var self=this,$self=this;
  42694. $self["@omitSemicolon"]=aBoolean;
  42695. return self;
  42696. },
  42697. args: ["aBoolean"],
  42698. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42699. referencedClasses: [],
  42700. messageSends: []
  42701. }),
  42702. $globals.JSStream);
  42703. $core.addMethod(
  42704. $core.method({
  42705. selector: "isReferenced",
  42706. protocol: "*Compiler-IR",
  42707. fn: function (){
  42708. var self=this,$self=this;
  42709. return $core.withContext(function($ctx1) {
  42710. var $3,$2,$1;
  42711. $3=$self._parent();
  42712. $ctx1.sendIdx["parent"]=1;
  42713. $2=$recv($3)._isSequenceNode();
  42714. $1=$recv($2)._or_((function(){
  42715. return $core.withContext(function($ctx2) {
  42716. return $recv($self._parent())._isAssignmentNode();
  42717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42718. }));
  42719. return $recv($1)._not();
  42720. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42721. },
  42722. args: [],
  42723. 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",
  42724. referencedClasses: [],
  42725. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42726. }),
  42727. $globals.ASTNode);
  42728. $core.addMethod(
  42729. $core.method({
  42730. selector: "subtreeNeedsAliasing",
  42731. protocol: "*Compiler-IR",
  42732. fn: function (){
  42733. var self=this,$self=this;
  42734. return $core.withContext(function($ctx1) {
  42735. return $recv($self._shouldBeAliased())._or_((function(){
  42736. return $core.withContext(function($ctx2) {
  42737. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42738. return $core.withContext(function($ctx3) {
  42739. return $recv(each)._subtreeNeedsAliasing();
  42740. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42741. }));
  42742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42743. }));
  42744. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42745. },
  42746. args: [],
  42747. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42748. referencedClasses: [],
  42749. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42750. }),
  42751. $globals.ASTNode);
  42752. $core.addMethod(
  42753. $core.method({
  42754. selector: "shouldBeAliased",
  42755. protocol: "*Compiler-IR",
  42756. fn: function (){
  42757. var self=this,$self=this;
  42758. return $core.withContext(function($ctx1) {
  42759. var $1;
  42760. $1=(
  42761. $ctx1.supercall = true,
  42762. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42763. $ctx1.supercall = false;
  42764. return $recv($1)._or_((function(){
  42765. return $core.withContext(function($ctx2) {
  42766. return $self._isReferenced();
  42767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42768. }));
  42769. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42770. },
  42771. args: [],
  42772. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42773. referencedClasses: [],
  42774. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42775. }),
  42776. $globals.AssignmentNode);
  42777. $core.addMethod(
  42778. $core.method({
  42779. selector: "appendToInstruction:",
  42780. protocol: "*Compiler-IR",
  42781. fn: function (anIRInstruction){
  42782. var self=this,$self=this;
  42783. return $core.withContext(function($ctx1) {
  42784. $recv(anIRInstruction)._appendBlock_(self);
  42785. return self;
  42786. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42787. },
  42788. args: ["anIRInstruction"],
  42789. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42790. referencedClasses: [],
  42791. messageSends: ["appendBlock:"]
  42792. }),
  42793. $globals.BlockClosure);
  42794. $core.addMethod(
  42795. $core.method({
  42796. selector: "subtreeNeedsAliasing",
  42797. protocol: "*Compiler-IR",
  42798. fn: function (){
  42799. var self=this,$self=this;
  42800. return $core.withContext(function($ctx1) {
  42801. return $self._shouldBeAliased();
  42802. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42803. },
  42804. args: [],
  42805. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42806. referencedClasses: [],
  42807. messageSends: ["shouldBeAliased"]
  42808. }),
  42809. $globals.BlockNode);
  42810. $core.addMethod(
  42811. $core.method({
  42812. selector: "subtreeNeedsAliasing",
  42813. protocol: "*Compiler-IR",
  42814. fn: function (){
  42815. var self=this,$self=this;
  42816. return $core.withContext(function($ctx1) {
  42817. return $recv($recv($self._parent())._isSequenceNode())._not();
  42818. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42819. },
  42820. args: [],
  42821. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42822. referencedClasses: [],
  42823. messageSends: ["not", "isSequenceNode", "parent"]
  42824. }),
  42825. $globals.CascadeNode);
  42826. $core.addMethod(
  42827. $core.method({
  42828. selector: "shouldBeAliased",
  42829. protocol: "*Compiler-IR",
  42830. fn: function (){
  42831. var self=this,$self=this;
  42832. var sends;
  42833. return $core.withContext(function($ctx1) {
  42834. var $2,$1;
  42835. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42836. $2=(
  42837. $ctx1.supercall = true,
  42838. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42839. $ctx1.supercall = false;
  42840. $1=$recv($2)._or_((function(){
  42841. return $core.withContext(function($ctx2) {
  42842. return $recv($self._isReferenced())._and_((function(){
  42843. return $core.withContext(function($ctx3) {
  42844. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42845. return $core.withContext(function($ctx4) {
  42846. return $self._superSend();
  42847. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42848. }));
  42849. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42850. }));
  42851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42852. }));
  42853. $ctx1.sendIdx["or:"]=1;
  42854. return $1;
  42855. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42856. },
  42857. args: [],
  42858. 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 ] ] ])",
  42859. referencedClasses: [],
  42860. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42861. }),
  42862. $globals.SendNode);
  42863. $core.addMethod(
  42864. $core.method({
  42865. selector: "subtreeNeedsAliasing",
  42866. protocol: "*Compiler-IR",
  42867. fn: function (){
  42868. var self=this,$self=this;
  42869. return $core.withContext(function($ctx1) {
  42870. return $recv($self._shouldBeInlined())._or_((function(){
  42871. return $core.withContext(function($ctx2) {
  42872. return (
  42873. $ctx2.supercall = true,
  42874. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42875. $ctx2.supercall = false;
  42876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42877. }));
  42878. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42879. },
  42880. args: [],
  42881. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42882. referencedClasses: [],
  42883. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42884. }),
  42885. $globals.SendNode);
  42886. });
  42887. 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";
  42888. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42889. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42890. $core.addPackage("Compiler-Inlining");
  42891. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42892. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42893. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42894. $core.addMethod(
  42895. $core.method({
  42896. selector: "visitSendNode:",
  42897. protocol: "visiting",
  42898. fn: function (aNode){
  42899. var self=this,$self=this;
  42900. return $core.withContext(function($ctx1) {
  42901. var $1,$2,$3,$4,$receiver;
  42902. $1=$recv(aNode)._superSend();
  42903. if(!$core.assert($1)){
  42904. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42905. if($core.assert($2)){
  42906. $recv(aNode)._shouldBeInlined_(true);
  42907. $3=$recv(aNode)._receiver();
  42908. if(($receiver = $3) == null || $receiver.a$nil){
  42909. $3;
  42910. } else {
  42911. var receiver;
  42912. receiver=$receiver;
  42913. $recv(receiver)._shouldBeAliased_(true);
  42914. }
  42915. }
  42916. }
  42917. $4=(
  42918. $ctx1.supercall = true,
  42919. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42920. $ctx1.supercall = false;
  42921. return $4;
  42922. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42923. },
  42924. args: ["aNode"],
  42925. 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",
  42926. referencedClasses: ["IRSendInliner"],
  42927. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42928. }),
  42929. $globals.ASTPreInliner);
  42930. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42931. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42932. $core.addMethod(
  42933. $core.method({
  42934. selector: "acceptDagVisitor:",
  42935. protocol: "visiting",
  42936. fn: function (aVisitor){
  42937. var self=this,$self=this;
  42938. return $core.withContext(function($ctx1) {
  42939. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42940. return self;
  42941. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42942. },
  42943. args: ["aVisitor"],
  42944. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42945. referencedClasses: [],
  42946. messageSends: ["visitIRInlinedClosure:"]
  42947. }),
  42948. $globals.IRInlinedClosure);
  42949. $core.addMethod(
  42950. $core.method({
  42951. selector: "isInlined",
  42952. protocol: "testing",
  42953. fn: function (){
  42954. var self=this,$self=this;
  42955. return true;
  42956. },
  42957. args: [],
  42958. source: "isInlined\x0a\x09^ true",
  42959. referencedClasses: [],
  42960. messageSends: []
  42961. }),
  42962. $globals.IRInlinedClosure);
  42963. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42964. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42965. $core.addMethod(
  42966. $core.method({
  42967. selector: "acceptDagVisitor:",
  42968. protocol: "visiting",
  42969. fn: function (aVisitor){
  42970. var self=this,$self=this;
  42971. return $core.withContext(function($ctx1) {
  42972. $recv(aVisitor)._visitInlinedSend_(self);
  42973. return self;
  42974. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42975. },
  42976. args: ["aVisitor"],
  42977. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42978. referencedClasses: [],
  42979. messageSends: ["visitInlinedSend:"]
  42980. }),
  42981. $globals.IRInlinedSend);
  42982. $core.addMethod(
  42983. $core.method({
  42984. selector: "internalVariables",
  42985. protocol: "accessing",
  42986. fn: function (){
  42987. var self=this,$self=this;
  42988. return [];
  42989. },
  42990. args: [],
  42991. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42992. referencedClasses: [],
  42993. messageSends: []
  42994. }),
  42995. $globals.IRInlinedSend);
  42996. $core.addMethod(
  42997. $core.method({
  42998. selector: "isInlined",
  42999. protocol: "testing",
  43000. fn: function (){
  43001. var self=this,$self=this;
  43002. return true;
  43003. },
  43004. args: [],
  43005. source: "isInlined\x0a\x09^ true",
  43006. referencedClasses: [],
  43007. messageSends: []
  43008. }),
  43009. $globals.IRInlinedSend);
  43010. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43011. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  43012. $core.addMethod(
  43013. $core.method({
  43014. selector: "acceptDagVisitor:",
  43015. protocol: "visiting",
  43016. fn: function (aVisitor){
  43017. var self=this,$self=this;
  43018. return $core.withContext(function($ctx1) {
  43019. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  43020. return self;
  43021. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  43022. },
  43023. args: ["aVisitor"],
  43024. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  43025. referencedClasses: [],
  43026. messageSends: ["visitIRInlinedIfFalse:"]
  43027. }),
  43028. $globals.IRInlinedIfFalse);
  43029. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43030. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  43031. $core.addMethod(
  43032. $core.method({
  43033. selector: "acceptDagVisitor:",
  43034. protocol: "visiting",
  43035. fn: function (aVisitor){
  43036. var self=this,$self=this;
  43037. return $core.withContext(function($ctx1) {
  43038. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  43039. return self;
  43040. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  43041. },
  43042. args: ["aVisitor"],
  43043. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  43044. referencedClasses: [],
  43045. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  43046. }),
  43047. $globals.IRInlinedIfNilIfNotNil);
  43048. $core.addMethod(
  43049. $core.method({
  43050. selector: "internalVariables",
  43051. protocol: "accessing",
  43052. fn: function (){
  43053. var self=this,$self=this;
  43054. return $core.withContext(function($ctx1) {
  43055. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  43056. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  43057. },
  43058. args: [],
  43059. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  43060. referencedClasses: ["Array"],
  43061. messageSends: ["with:", "receiverInternalVariable"]
  43062. }),
  43063. $globals.IRInlinedIfNilIfNotNil);
  43064. $core.addMethod(
  43065. $core.method({
  43066. selector: "receiverInternalVariable",
  43067. protocol: "accessing",
  43068. fn: function (){
  43069. var self=this,$self=this;
  43070. return $core.withContext(function($ctx1) {
  43071. var $1;
  43072. $1=$recv($globals.IRVariable)._new();
  43073. $ctx1.sendIdx["new"]=1;
  43074. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  43075. return $recv($1)._yourself();
  43076. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  43077. },
  43078. args: [],
  43079. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  43080. referencedClasses: ["IRVariable", "AliasVar"],
  43081. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  43082. }),
  43083. $globals.IRInlinedIfNilIfNotNil);
  43084. $core.addMethod(
  43085. $core.method({
  43086. selector: "receiverInternalVariableName",
  43087. protocol: "accessing",
  43088. fn: function (){
  43089. var self=this,$self=this;
  43090. return "$receiver";
  43091. },
  43092. args: [],
  43093. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  43094. referencedClasses: [],
  43095. messageSends: []
  43096. }),
  43097. $globals.IRInlinedIfNilIfNotNil);
  43098. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43099. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  43100. $core.addMethod(
  43101. $core.method({
  43102. selector: "acceptDagVisitor:",
  43103. protocol: "visiting",
  43104. fn: function (aVisitor){
  43105. var self=this,$self=this;
  43106. return $core.withContext(function($ctx1) {
  43107. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  43108. return self;
  43109. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  43110. },
  43111. args: ["aVisitor"],
  43112. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  43113. referencedClasses: [],
  43114. messageSends: ["visitIRInlinedIfTrue:"]
  43115. }),
  43116. $globals.IRInlinedIfTrue);
  43117. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43118. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  43119. $core.addMethod(
  43120. $core.method({
  43121. selector: "acceptDagVisitor:",
  43122. protocol: "visiting",
  43123. fn: function (aVisitor){
  43124. var self=this,$self=this;
  43125. return $core.withContext(function($ctx1) {
  43126. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  43127. return self;
  43128. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  43129. },
  43130. args: ["aVisitor"],
  43131. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  43132. referencedClasses: [],
  43133. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  43134. }),
  43135. $globals.IRInlinedIfTrueIfFalse);
  43136. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  43137. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  43138. $core.addMethod(
  43139. $core.method({
  43140. selector: "acceptDagVisitor:",
  43141. protocol: "visiting",
  43142. fn: function (aVisitor){
  43143. var self=this,$self=this;
  43144. return $core.withContext(function($ctx1) {
  43145. $recv(aVisitor)._visitIRInlinedSequence_(self);
  43146. return self;
  43147. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  43148. },
  43149. args: ["aVisitor"],
  43150. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  43151. referencedClasses: [],
  43152. messageSends: ["visitIRInlinedSequence:"]
  43153. }),
  43154. $globals.IRInlinedSequence);
  43155. $core.addMethod(
  43156. $core.method({
  43157. selector: "isInlined",
  43158. protocol: "testing",
  43159. fn: function (){
  43160. var self=this,$self=this;
  43161. return true;
  43162. },
  43163. args: [],
  43164. source: "isInlined\x0a\x09^ true",
  43165. referencedClasses: [],
  43166. messageSends: []
  43167. }),
  43168. $globals.IRInlinedSequence);
  43169. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43170. $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`";
  43171. $core.addMethod(
  43172. $core.method({
  43173. selector: "assignmentInliner",
  43174. protocol: "factory",
  43175. fn: function (){
  43176. var self=this,$self=this;
  43177. return $core.withContext(function($ctx1) {
  43178. var $1;
  43179. $1=$recv($globals.IRAssignmentInliner)._new();
  43180. $recv($1)._translator_(self);
  43181. return $recv($1)._yourself();
  43182. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  43183. },
  43184. args: [],
  43185. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43186. referencedClasses: ["IRAssignmentInliner"],
  43187. messageSends: ["translator:", "new", "yourself"]
  43188. }),
  43189. $globals.IRInliner);
  43190. $core.addMethod(
  43191. $core.method({
  43192. selector: "returnInliner",
  43193. protocol: "factory",
  43194. fn: function (){
  43195. var self=this,$self=this;
  43196. return $core.withContext(function($ctx1) {
  43197. var $1;
  43198. $1=$recv($globals.IRReturnInliner)._new();
  43199. $recv($1)._translator_(self);
  43200. return $recv($1)._yourself();
  43201. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43202. },
  43203. args: [],
  43204. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43205. referencedClasses: ["IRReturnInliner"],
  43206. messageSends: ["translator:", "new", "yourself"]
  43207. }),
  43208. $globals.IRInliner);
  43209. $core.addMethod(
  43210. $core.method({
  43211. selector: "sendInliner",
  43212. protocol: "factory",
  43213. fn: function (){
  43214. var self=this,$self=this;
  43215. return $core.withContext(function($ctx1) {
  43216. var $1;
  43217. $1=$recv($globals.IRSendInliner)._new();
  43218. $recv($1)._translator_(self);
  43219. return $recv($1)._yourself();
  43220. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43221. },
  43222. args: [],
  43223. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43224. referencedClasses: ["IRSendInliner"],
  43225. messageSends: ["translator:", "new", "yourself"]
  43226. }),
  43227. $globals.IRInliner);
  43228. $core.addMethod(
  43229. $core.method({
  43230. selector: "shouldInlineAssignment:",
  43231. protocol: "testing",
  43232. fn: function (anIRAssignment){
  43233. var self=this,$self=this;
  43234. return $core.withContext(function($ctx1) {
  43235. var $3,$2,$1;
  43236. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43237. return $core.withContext(function($ctx2) {
  43238. $3=$recv(anIRAssignment)._right();
  43239. $ctx2.sendIdx["right"]=1;
  43240. $2=$recv($3)._isSend();
  43241. return $recv($2)._and_((function(){
  43242. return $core.withContext(function($ctx3) {
  43243. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43244. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43245. }));
  43246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43247. }));
  43248. $ctx1.sendIdx["and:"]=1;
  43249. return $1;
  43250. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43251. },
  43252. args: ["anIRAssignment"],
  43253. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43254. referencedClasses: [],
  43255. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43256. }),
  43257. $globals.IRInliner);
  43258. $core.addMethod(
  43259. $core.method({
  43260. selector: "shouldInlineReturn:",
  43261. protocol: "testing",
  43262. fn: function (anIRReturn){
  43263. var self=this,$self=this;
  43264. return $core.withContext(function($ctx1) {
  43265. var $3,$2,$1;
  43266. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43267. return $core.withContext(function($ctx2) {
  43268. $3=$recv(anIRReturn)._expression();
  43269. $ctx2.sendIdx["expression"]=1;
  43270. $2=$recv($3)._isSend();
  43271. return $recv($2)._and_((function(){
  43272. return $core.withContext(function($ctx3) {
  43273. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43274. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43275. }));
  43276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43277. }));
  43278. $ctx1.sendIdx["and:"]=1;
  43279. return $1;
  43280. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43281. },
  43282. args: ["anIRReturn"],
  43283. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43284. referencedClasses: [],
  43285. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43286. }),
  43287. $globals.IRInliner);
  43288. $core.addMethod(
  43289. $core.method({
  43290. selector: "shouldInlineSend:",
  43291. protocol: "testing",
  43292. fn: function (anIRSend){
  43293. var self=this,$self=this;
  43294. return $core.withContext(function($ctx1) {
  43295. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43296. return $core.withContext(function($ctx2) {
  43297. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43299. }));
  43300. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43301. },
  43302. args: ["anIRSend"],
  43303. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43304. referencedClasses: ["IRSendInliner"],
  43305. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43306. }),
  43307. $globals.IRInliner);
  43308. $core.addMethod(
  43309. $core.method({
  43310. selector: "visitIRAssignment:",
  43311. protocol: "visiting",
  43312. fn: function (anIRAssignment){
  43313. var self=this,$self=this;
  43314. return $core.withContext(function($ctx1) {
  43315. var $1;
  43316. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43317. if($core.assert($1)){
  43318. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43319. } else {
  43320. return (
  43321. $ctx1.supercall = true,
  43322. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43323. $ctx1.supercall = false;
  43324. }
  43325. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43326. },
  43327. args: ["anIRAssignment"],
  43328. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43329. referencedClasses: [],
  43330. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43331. }),
  43332. $globals.IRInliner);
  43333. $core.addMethod(
  43334. $core.method({
  43335. selector: "visitIRNonLocalReturn:",
  43336. protocol: "visiting",
  43337. fn: function (anIRNonLocalReturn){
  43338. var self=this,$self=this;
  43339. var localReturn;
  43340. return $core.withContext(function($ctx1) {
  43341. var $2,$1,$4,$3,$5,$6,$7;
  43342. $2=$recv(anIRNonLocalReturn)._scope();
  43343. $ctx1.sendIdx["scope"]=1;
  43344. $1=$recv($2)._canInlineNonLocalReturns();
  43345. if($core.assert($1)){
  43346. $4=$recv(anIRNonLocalReturn)._scope();
  43347. $ctx1.sendIdx["scope"]=2;
  43348. $3=$recv($4)._methodScope();
  43349. $5=$recv(anIRNonLocalReturn)._scope();
  43350. $ctx1.sendIdx["scope"]=3;
  43351. $recv($3)._removeNonLocalReturn_($5);
  43352. $6=$recv($globals.IRReturn)._new();
  43353. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43354. localReturn=$recv($6)._yourself();
  43355. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43356. return $core.withContext(function($ctx2) {
  43357. return $recv(localReturn)._add_(each);
  43358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43359. }));
  43360. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43361. return $self._visitIRReturn_(localReturn);
  43362. }
  43363. $7=(
  43364. $ctx1.supercall = true,
  43365. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43366. $ctx1.supercall = false;
  43367. return $7;
  43368. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43369. },
  43370. args: ["anIRNonLocalReturn"],
  43371. 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",
  43372. referencedClasses: ["IRReturn"],
  43373. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43374. }),
  43375. $globals.IRInliner);
  43376. $core.addMethod(
  43377. $core.method({
  43378. selector: "visitIRReturn:",
  43379. protocol: "visiting",
  43380. fn: function (anIRReturn){
  43381. var self=this,$self=this;
  43382. return $core.withContext(function($ctx1) {
  43383. var $1;
  43384. $1=$self._shouldInlineReturn_(anIRReturn);
  43385. if($core.assert($1)){
  43386. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43387. } else {
  43388. return (
  43389. $ctx1.supercall = true,
  43390. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43391. $ctx1.supercall = false;
  43392. }
  43393. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43394. },
  43395. args: ["anIRReturn"],
  43396. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43397. referencedClasses: [],
  43398. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43399. }),
  43400. $globals.IRInliner);
  43401. $core.addMethod(
  43402. $core.method({
  43403. selector: "visitIRSend:",
  43404. protocol: "visiting",
  43405. fn: function (anIRSend){
  43406. var self=this,$self=this;
  43407. return $core.withContext(function($ctx1) {
  43408. var $1;
  43409. $1=$self._shouldInlineSend_(anIRSend);
  43410. if($core.assert($1)){
  43411. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43412. } else {
  43413. return (
  43414. $ctx1.supercall = true,
  43415. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43416. $ctx1.supercall = false;
  43417. }
  43418. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43419. },
  43420. args: ["anIRSend"],
  43421. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43422. referencedClasses: [],
  43423. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43424. }),
  43425. $globals.IRInliner);
  43426. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43427. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43428. $core.addMethod(
  43429. $core.method({
  43430. selector: "visitIRInlinedClosure:",
  43431. protocol: "visiting",
  43432. fn: function (anIRInlinedClosure){
  43433. var self=this,$self=this;
  43434. return $core.withContext(function($ctx1) {
  43435. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43436. return $core.withContext(function($ctx2) {
  43437. return $recv($recv(each)._name())._asVariableName();
  43438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43439. })));
  43440. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43441. return self;
  43442. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43443. },
  43444. args: ["anIRInlinedClosure"],
  43445. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43446. referencedClasses: [],
  43447. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43448. }),
  43449. $globals.IRInliningJSTranslator);
  43450. $core.addMethod(
  43451. $core.method({
  43452. selector: "visitIRInlinedIfFalse:",
  43453. protocol: "visiting",
  43454. fn: function (anIRInlinedIfFalse){
  43455. var self=this,$self=this;
  43456. return $core.withContext(function($ctx1) {
  43457. var $1,$2,$4,$3;
  43458. $1=$self._stream();
  43459. $ctx1.sendIdx["stream"]=1;
  43460. $recv($1)._nextPutIf_then_((function(){
  43461. return $core.withContext(function($ctx2) {
  43462. $2=$self._stream();
  43463. $ctx2.sendIdx["stream"]=2;
  43464. $recv($2)._nextPutAll_("!$core.assert(");
  43465. $ctx2.sendIdx["nextPutAll:"]=1;
  43466. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43467. $ctx2.sendIdx["dagChildren"]=1;
  43468. $3=$recv($4)._first();
  43469. $self._visit_($3);
  43470. $ctx2.sendIdx["visit:"]=1;
  43471. return $recv($self._stream())._nextPutAll_(")");
  43472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43473. }),(function(){
  43474. return $core.withContext(function($ctx2) {
  43475. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43477. }));
  43478. return self;
  43479. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43480. },
  43481. args: ["anIRInlinedIfFalse"],
  43482. 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 ]",
  43483. referencedClasses: [],
  43484. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43485. }),
  43486. $globals.IRInliningJSTranslator);
  43487. $core.addMethod(
  43488. $core.method({
  43489. selector: "visitIRInlinedIfNilIfNotNil:",
  43490. protocol: "visiting",
  43491. fn: function (anIRInlinedIfNilIfNotNil){
  43492. var self=this,$self=this;
  43493. return $core.withContext(function($ctx1) {
  43494. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43495. $1=$self._stream();
  43496. $ctx1.sendIdx["stream"]=1;
  43497. $recv($1)._nextPutIf_then_else_((function(){
  43498. var recvVarName;
  43499. return $core.withContext(function($ctx2) {
  43500. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43501. $2=$self._stream();
  43502. $ctx2.sendIdx["stream"]=2;
  43503. $4="(".__comma(recvVarName);
  43504. $ctx2.sendIdx[","]=2;
  43505. $3=$recv($4).__comma(" = ");
  43506. $ctx2.sendIdx[","]=1;
  43507. $recv($2)._nextPutAll_($3);
  43508. $ctx2.sendIdx["nextPutAll:"]=1;
  43509. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43510. $ctx2.sendIdx["dagChildren"]=1;
  43511. $5=$recv($6)._first();
  43512. $self._visit_($5);
  43513. $ctx2.sendIdx["visit:"]=1;
  43514. $7=$self._stream();
  43515. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43516. $ctx2.sendIdx[","]=3;
  43517. return $recv($7)._nextPutAll_($8);
  43518. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43519. }),(function(){
  43520. return $core.withContext(function($ctx2) {
  43521. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43522. $ctx2.sendIdx["dagChildren"]=2;
  43523. $9=$recv($10)._second();
  43524. return $self._visit_($9);
  43525. $ctx2.sendIdx["visit:"]=2;
  43526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43527. }),(function(){
  43528. return $core.withContext(function($ctx2) {
  43529. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43531. }));
  43532. return self;
  43533. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43534. },
  43535. args: ["anIRInlinedIfNilIfNotNil"],
  43536. 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 ]",
  43537. referencedClasses: [],
  43538. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43539. }),
  43540. $globals.IRInliningJSTranslator);
  43541. $core.addMethod(
  43542. $core.method({
  43543. selector: "visitIRInlinedIfTrue:",
  43544. protocol: "visiting",
  43545. fn: function (anIRInlinedIfTrue){
  43546. var self=this,$self=this;
  43547. return $core.withContext(function($ctx1) {
  43548. var $1,$2,$4,$3;
  43549. $1=$self._stream();
  43550. $ctx1.sendIdx["stream"]=1;
  43551. $recv($1)._nextPutIf_then_((function(){
  43552. return $core.withContext(function($ctx2) {
  43553. $2=$self._stream();
  43554. $ctx2.sendIdx["stream"]=2;
  43555. $recv($2)._nextPutAll_("$core.assert(");
  43556. $ctx2.sendIdx["nextPutAll:"]=1;
  43557. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43558. $ctx2.sendIdx["dagChildren"]=1;
  43559. $3=$recv($4)._first();
  43560. $self._visit_($3);
  43561. $ctx2.sendIdx["visit:"]=1;
  43562. return $recv($self._stream())._nextPutAll_(")");
  43563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43564. }),(function(){
  43565. return $core.withContext(function($ctx2) {
  43566. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43568. }));
  43569. return self;
  43570. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43571. },
  43572. args: ["anIRInlinedIfTrue"],
  43573. 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 ]",
  43574. referencedClasses: [],
  43575. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43576. }),
  43577. $globals.IRInliningJSTranslator);
  43578. $core.addMethod(
  43579. $core.method({
  43580. selector: "visitIRInlinedIfTrueIfFalse:",
  43581. protocol: "visiting",
  43582. fn: function (anIRInlinedIfTrueIfFalse){
  43583. var self=this,$self=this;
  43584. return $core.withContext(function($ctx1) {
  43585. var $1,$2,$4,$3,$6,$5;
  43586. $1=$self._stream();
  43587. $ctx1.sendIdx["stream"]=1;
  43588. $recv($1)._nextPutIf_then_else_((function(){
  43589. return $core.withContext(function($ctx2) {
  43590. $2=$self._stream();
  43591. $ctx2.sendIdx["stream"]=2;
  43592. $recv($2)._nextPutAll_("$core.assert(");
  43593. $ctx2.sendIdx["nextPutAll:"]=1;
  43594. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43595. $ctx2.sendIdx["dagChildren"]=1;
  43596. $3=$recv($4)._first();
  43597. $self._visit_($3);
  43598. $ctx2.sendIdx["visit:"]=1;
  43599. return $recv($self._stream())._nextPutAll_(")");
  43600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43601. }),(function(){
  43602. return $core.withContext(function($ctx2) {
  43603. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43604. $ctx2.sendIdx["dagChildren"]=2;
  43605. $5=$recv($6)._second();
  43606. return $self._visit_($5);
  43607. $ctx2.sendIdx["visit:"]=2;
  43608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43609. }),(function(){
  43610. return $core.withContext(function($ctx2) {
  43611. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43613. }));
  43614. return self;
  43615. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43616. },
  43617. args: ["anIRInlinedIfTrueIfFalse"],
  43618. 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 ]",
  43619. referencedClasses: [],
  43620. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43621. }),
  43622. $globals.IRInliningJSTranslator);
  43623. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43624. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43625. $core.addMethod(
  43626. $core.method({
  43627. selector: "ifFalse:",
  43628. protocol: "inlining",
  43629. fn: function (anIRInstruction){
  43630. var self=this,$self=this;
  43631. return $core.withContext(function($ctx1) {
  43632. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43633. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43634. },
  43635. args: ["anIRInstruction"],
  43636. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43637. referencedClasses: ["IRInlinedIfFalse"],
  43638. messageSends: ["inlinedSend:withBlock:", "new"]
  43639. }),
  43640. $globals.IRSendInliner);
  43641. $core.addMethod(
  43642. $core.method({
  43643. selector: "ifFalse:ifTrue:",
  43644. protocol: "inlining",
  43645. fn: function (anIRInstruction,anotherIRInstruction){
  43646. var self=this,$self=this;
  43647. return $core.withContext(function($ctx1) {
  43648. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43649. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43650. },
  43651. args: ["anIRInstruction", "anotherIRInstruction"],
  43652. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43653. referencedClasses: [],
  43654. messageSends: ["perform:withArguments:"]
  43655. }),
  43656. $globals.IRSendInliner);
  43657. $core.addMethod(
  43658. $core.method({
  43659. selector: "ifNil:",
  43660. protocol: "inlining",
  43661. fn: function (anIRInstruction){
  43662. var self=this,$self=this;
  43663. return $core.withContext(function($ctx1) {
  43664. var $1,$3,$5,$6,$4,$2;
  43665. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43666. $ctx1.sendIdx["new"]=1;
  43667. $3=$recv($globals.IRClosure)._new();
  43668. $ctx1.sendIdx["new"]=2;
  43669. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43670. $5=$recv($globals.IRBlockSequence)._new();
  43671. $recv($5)._add_($recv($self._send())._receiver());
  43672. $6=$recv($5)._yourself();
  43673. $ctx1.sendIdx["yourself"]=1;
  43674. $4=$6;
  43675. $recv($3)._add_($4);
  43676. $ctx1.sendIdx["add:"]=1;
  43677. $2=$recv($3)._yourself();
  43678. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43679. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43680. },
  43681. args: ["anIRInstruction"],
  43682. 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)",
  43683. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43684. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43685. }),
  43686. $globals.IRSendInliner);
  43687. $core.addMethod(
  43688. $core.method({
  43689. selector: "ifNil:ifNotNil:",
  43690. protocol: "inlining",
  43691. fn: function (anIRInstruction,anotherIRInstruction){
  43692. var self=this,$self=this;
  43693. return $core.withContext(function($ctx1) {
  43694. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43695. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43696. },
  43697. args: ["anIRInstruction", "anotherIRInstruction"],
  43698. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43699. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43700. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43701. }),
  43702. $globals.IRSendInliner);
  43703. $core.addMethod(
  43704. $core.method({
  43705. selector: "ifNotNil:",
  43706. protocol: "inlining",
  43707. fn: function (anIRInstruction){
  43708. var self=this,$self=this;
  43709. return $core.withContext(function($ctx1) {
  43710. var $1,$3,$5,$6,$4,$2;
  43711. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43712. $ctx1.sendIdx["new"]=1;
  43713. $3=$recv($globals.IRClosure)._new();
  43714. $ctx1.sendIdx["new"]=2;
  43715. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43716. $5=$recv($globals.IRBlockSequence)._new();
  43717. $recv($5)._add_($recv($self._send())._receiver());
  43718. $6=$recv($5)._yourself();
  43719. $ctx1.sendIdx["yourself"]=1;
  43720. $4=$6;
  43721. $recv($3)._add_($4);
  43722. $ctx1.sendIdx["add:"]=1;
  43723. $2=$recv($3)._yourself();
  43724. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43725. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43726. },
  43727. args: ["anIRInstruction"],
  43728. 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",
  43729. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43730. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43731. }),
  43732. $globals.IRSendInliner);
  43733. $core.addMethod(
  43734. $core.method({
  43735. selector: "ifNotNil:ifNil:",
  43736. protocol: "inlining",
  43737. fn: function (anIRInstruction,anotherIRInstruction){
  43738. var self=this,$self=this;
  43739. return $core.withContext(function($ctx1) {
  43740. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43741. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43742. },
  43743. args: ["anIRInstruction", "anotherIRInstruction"],
  43744. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43745. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43746. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43747. }),
  43748. $globals.IRSendInliner);
  43749. $core.addMethod(
  43750. $core.method({
  43751. selector: "ifTrue:",
  43752. protocol: "inlining",
  43753. fn: function (anIRInstruction){
  43754. var self=this,$self=this;
  43755. return $core.withContext(function($ctx1) {
  43756. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43757. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43758. },
  43759. args: ["anIRInstruction"],
  43760. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43761. referencedClasses: ["IRInlinedIfTrue"],
  43762. messageSends: ["inlinedSend:withBlock:", "new"]
  43763. }),
  43764. $globals.IRSendInliner);
  43765. $core.addMethod(
  43766. $core.method({
  43767. selector: "ifTrue:ifFalse:",
  43768. protocol: "inlining",
  43769. fn: function (anIRInstruction,anotherIRInstruction){
  43770. var self=this,$self=this;
  43771. return $core.withContext(function($ctx1) {
  43772. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43773. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43774. },
  43775. args: ["anIRInstruction", "anotherIRInstruction"],
  43776. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43777. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43778. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43779. }),
  43780. $globals.IRSendInliner);
  43781. $core.addMethod(
  43782. $core.method({
  43783. selector: "inlineClosure:",
  43784. protocol: "inlining",
  43785. fn: function (anIRClosure){
  43786. var self=this,$self=this;
  43787. var inlinedClosure,sequence,statements;
  43788. return $core.withContext(function($ctx1) {
  43789. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43790. inlinedClosure=$self._inlinedClosure();
  43791. $1=inlinedClosure;
  43792. $2=$recv(anIRClosure)._scope();
  43793. $ctx1.sendIdx["scope"]=1;
  43794. $recv($1)._scope_($2);
  43795. $ctx1.sendIdx["scope:"]=1;
  43796. $recv($1)._parent_($recv(anIRClosure)._parent());
  43797. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43798. return $core.withContext(function($ctx2) {
  43799. return $recv(inlinedClosure)._add_(each);
  43800. $ctx2.sendIdx["add:"]=1;
  43801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43802. }));
  43803. $ctx1.sendIdx["do:"]=1;
  43804. sequence=$self._inlinedSequence();
  43805. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43806. return $core.withContext(function($ctx2) {
  43807. $3=inlinedClosure;
  43808. $5=$recv($globals.IRTempDeclaration)._new();
  43809. $ctx2.sendIdx["new"]=1;
  43810. $recv($5)._name_(each);
  43811. $ctx2.sendIdx["name:"]=1;
  43812. $6=$recv($5)._yourself();
  43813. $ctx2.sendIdx["yourself"]=1;
  43814. $4=$6;
  43815. $recv($3)._add_($4);
  43816. $ctx2.sendIdx["add:"]=2;
  43817. $7=sequence;
  43818. $9=$recv($globals.IRAssignment)._new();
  43819. $ctx2.sendIdx["new"]=2;
  43820. $11=$recv($globals.IRVariable)._new();
  43821. $ctx2.sendIdx["new"]=3;
  43822. $13=$recv($globals.AliasVar)._new();
  43823. $ctx2.sendIdx["new"]=4;
  43824. $14=$recv(inlinedClosure)._scope();
  43825. $ctx2.sendIdx["scope"]=2;
  43826. $recv($13)._scope_($14);
  43827. $ctx2.sendIdx["scope:"]=2;
  43828. $recv($13)._name_(each);
  43829. $ctx2.sendIdx["name:"]=2;
  43830. $15=$recv($13)._yourself();
  43831. $ctx2.sendIdx["yourself"]=2;
  43832. $12=$15;
  43833. $10=$recv($11)._variable_($12);
  43834. $ctx2.sendIdx["variable:"]=1;
  43835. $recv($9)._add_($10);
  43836. $ctx2.sendIdx["add:"]=4;
  43837. $17=$recv($globals.IRVariable)._new();
  43838. $ctx2.sendIdx["new"]=5;
  43839. $19=$recv($globals.AliasVar)._new();
  43840. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43841. $recv($19)._name_("$receiver");
  43842. $20=$recv($19)._yourself();
  43843. $ctx2.sendIdx["yourself"]=3;
  43844. $18=$20;
  43845. $16=$recv($17)._variable_($18);
  43846. $recv($9)._add_($16);
  43847. $ctx2.sendIdx["add:"]=5;
  43848. $8=$recv($9)._yourself();
  43849. return $recv($7)._add_($8);
  43850. $ctx2.sendIdx["add:"]=3;
  43851. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43852. }));
  43853. $ctx1.sendIdx["do:"]=2;
  43854. $recv(inlinedClosure)._add_(sequence);
  43855. $ctx1.sendIdx["add:"]=6;
  43856. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43857. $recv(statements)._ifNotEmpty_((function(){
  43858. return $core.withContext(function($ctx2) {
  43859. $recv($recv(statements)._allButLast())._do_((function(each){
  43860. return $core.withContext(function($ctx3) {
  43861. return $recv(sequence)._add_(each);
  43862. $ctx3.sendIdx["add:"]=7;
  43863. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43864. }));
  43865. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43867. }));
  43868. return inlinedClosure;
  43869. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43870. },
  43871. args: ["anIRClosure"],
  43872. 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",
  43873. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43874. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43875. }),
  43876. $globals.IRSendInliner);
  43877. $core.addMethod(
  43878. $core.method({
  43879. selector: "inlineSend:",
  43880. protocol: "inlining",
  43881. fn: function (anIRSend){
  43882. var self=this,$self=this;
  43883. return $core.withContext(function($ctx1) {
  43884. var $2,$1;
  43885. $self._send_(anIRSend);
  43886. $2=$self._send();
  43887. $ctx1.sendIdx["send"]=1;
  43888. $1=$recv($2)._selector();
  43889. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43890. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43891. },
  43892. args: ["anIRSend"],
  43893. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43894. referencedClasses: [],
  43895. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43896. }),
  43897. $globals.IRSendInliner);
  43898. $core.addMethod(
  43899. $core.method({
  43900. selector: "inlineSend:andReplace:",
  43901. protocol: "private",
  43902. fn: function (anIRSend,anIRInstruction){
  43903. var self=this,$self=this;
  43904. return $core.withContext(function($ctx1) {
  43905. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43906. return $self._inlineSend_(anIRSend);
  43907. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43908. },
  43909. args: ["anIRSend", "anIRInstruction"],
  43910. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43911. referencedClasses: [],
  43912. messageSends: ["replaceWith:", "inlineSend:"]
  43913. }),
  43914. $globals.IRSendInliner);
  43915. $core.addMethod(
  43916. $core.method({
  43917. selector: "inlinedClosure",
  43918. protocol: "factory",
  43919. fn: function (){
  43920. var self=this,$self=this;
  43921. return $core.withContext(function($ctx1) {
  43922. return $recv($globals.IRInlinedClosure)._new();
  43923. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43924. },
  43925. args: [],
  43926. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43927. referencedClasses: ["IRInlinedClosure"],
  43928. messageSends: ["new"]
  43929. }),
  43930. $globals.IRSendInliner);
  43931. $core.addMethod(
  43932. $core.method({
  43933. selector: "inlinedSend:withBlock:",
  43934. protocol: "private",
  43935. fn: function (inlinedSend,anIRInstruction){
  43936. var self=this,$self=this;
  43937. var inlinedClosure;
  43938. return $core.withContext(function($ctx1) {
  43939. var $1,$2,$4,$3,$5;
  43940. $1=$recv(anIRInstruction)._isClosure();
  43941. if(!$core.assert($1)){
  43942. $self._inliningError_("Message argument should be a block");
  43943. $ctx1.sendIdx["inliningError:"]=1;
  43944. }
  43945. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43946. if(!$core.assert($2)){
  43947. $self._inliningError_("Inlined block should have zero argument");
  43948. }
  43949. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43950. $4=$self._send();
  43951. $ctx1.sendIdx["send"]=1;
  43952. $3=$recv($4)._receiver();
  43953. $recv(inlinedSend)._add_($3);
  43954. $ctx1.sendIdx["add:"]=1;
  43955. $recv(inlinedSend)._add_(inlinedClosure);
  43956. $recv($self._send())._replaceWith_(inlinedSend);
  43957. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43958. $ctx1.sendIdx["internalVariables"]=1;
  43959. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43960. return inlinedSend;
  43961. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43962. },
  43963. args: ["inlinedSend", "anIRInstruction"],
  43964. 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",
  43965. referencedClasses: [],
  43966. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43967. }),
  43968. $globals.IRSendInliner);
  43969. $core.addMethod(
  43970. $core.method({
  43971. selector: "inlinedSend:withBlock:withBlock:",
  43972. protocol: "private",
  43973. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43974. var self=this,$self=this;
  43975. var inlinedClosure1,inlinedClosure2;
  43976. return $core.withContext(function($ctx1) {
  43977. var $1,$2,$3,$4,$6,$5,$7;
  43978. $1=$recv(anIRInstruction)._isClosure();
  43979. $ctx1.sendIdx["isClosure"]=1;
  43980. if(!$core.assert($1)){
  43981. $self._inliningError_("Message argument should be a block");
  43982. $ctx1.sendIdx["inliningError:"]=1;
  43983. }
  43984. $2=$recv(anotherIRInstruction)._isClosure();
  43985. if(!$core.assert($2)){
  43986. $self._inliningError_("Message argument should be a block");
  43987. }
  43988. $3=$self._translator();
  43989. $ctx1.sendIdx["translator"]=1;
  43990. $4=$self._inlineClosure_(anIRInstruction);
  43991. $ctx1.sendIdx["inlineClosure:"]=1;
  43992. inlinedClosure1=$recv($3)._visit_($4);
  43993. $ctx1.sendIdx["visit:"]=1;
  43994. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43995. $6=$self._send();
  43996. $ctx1.sendIdx["send"]=1;
  43997. $5=$recv($6)._receiver();
  43998. $recv(inlinedSend)._add_($5);
  43999. $ctx1.sendIdx["add:"]=1;
  44000. $recv(inlinedSend)._add_(inlinedClosure1);
  44001. $ctx1.sendIdx["add:"]=2;
  44002. $recv(inlinedSend)._add_(inlinedClosure2);
  44003. $recv($self._send())._replaceWith_(inlinedSend);
  44004. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  44005. $ctx1.sendIdx["internalVariables"]=1;
  44006. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  44007. return inlinedSend;
  44008. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  44009. },
  44010. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  44011. 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",
  44012. referencedClasses: [],
  44013. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  44014. }),
  44015. $globals.IRSendInliner);
  44016. $core.addMethod(
  44017. $core.method({
  44018. selector: "inlinedSequence",
  44019. protocol: "factory",
  44020. fn: function (){
  44021. var self=this,$self=this;
  44022. return $core.withContext(function($ctx1) {
  44023. return $recv($globals.IRInlinedSequence)._new();
  44024. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  44025. },
  44026. args: [],
  44027. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  44028. referencedClasses: ["IRInlinedSequence"],
  44029. messageSends: ["new"]
  44030. }),
  44031. $globals.IRSendInliner);
  44032. $core.addMethod(
  44033. $core.method({
  44034. selector: "inliningError:",
  44035. protocol: "error handling",
  44036. fn: function (aString){
  44037. var self=this,$self=this;
  44038. return $core.withContext(function($ctx1) {
  44039. $recv($globals.InliningError)._signal_(aString);
  44040. return self;
  44041. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  44042. },
  44043. args: ["aString"],
  44044. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  44045. referencedClasses: ["InliningError"],
  44046. messageSends: ["signal:"]
  44047. }),
  44048. $globals.IRSendInliner);
  44049. $core.addMethod(
  44050. $core.method({
  44051. selector: "send",
  44052. protocol: "accessing",
  44053. fn: function (){
  44054. var self=this,$self=this;
  44055. return $self["@send"];
  44056. },
  44057. args: [],
  44058. source: "send\x0a\x09^ send",
  44059. referencedClasses: [],
  44060. messageSends: []
  44061. }),
  44062. $globals.IRSendInliner);
  44063. $core.addMethod(
  44064. $core.method({
  44065. selector: "send:",
  44066. protocol: "accessing",
  44067. fn: function (anIRSend){
  44068. var self=this,$self=this;
  44069. $self["@send"]=anIRSend;
  44070. return self;
  44071. },
  44072. args: ["anIRSend"],
  44073. source: "send: anIRSend\x0a\x09send := anIRSend",
  44074. referencedClasses: [],
  44075. messageSends: []
  44076. }),
  44077. $globals.IRSendInliner);
  44078. $core.addMethod(
  44079. $core.method({
  44080. selector: "translator",
  44081. protocol: "accessing",
  44082. fn: function (){
  44083. var self=this,$self=this;
  44084. return $self["@translator"];
  44085. },
  44086. args: [],
  44087. source: "translator\x0a\x09^ translator",
  44088. referencedClasses: [],
  44089. messageSends: []
  44090. }),
  44091. $globals.IRSendInliner);
  44092. $core.addMethod(
  44093. $core.method({
  44094. selector: "translator:",
  44095. protocol: "accessing",
  44096. fn: function (anASTTranslator){
  44097. var self=this,$self=this;
  44098. $self["@translator"]=anASTTranslator;
  44099. return self;
  44100. },
  44101. args: ["anASTTranslator"],
  44102. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  44103. referencedClasses: [],
  44104. messageSends: []
  44105. }),
  44106. $globals.IRSendInliner);
  44107. $core.addMethod(
  44108. $core.method({
  44109. selector: "inlinedSelectors",
  44110. protocol: "accessing",
  44111. fn: function (){
  44112. var self=this,$self=this;
  44113. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  44114. },
  44115. args: [],
  44116. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  44117. referencedClasses: [],
  44118. messageSends: []
  44119. }),
  44120. $globals.IRSendInliner.a$cls);
  44121. $core.addMethod(
  44122. $core.method({
  44123. selector: "shouldInline:",
  44124. protocol: "accessing",
  44125. fn: function (anIRSend){
  44126. var self=this,$self=this;
  44127. return $core.withContext(function($ctx1) {
  44128. var $1;
  44129. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  44130. if(!$core.assert($1)){
  44131. return false;
  44132. }
  44133. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  44134. return $core.withContext(function($ctx2) {
  44135. return $recv(each)._isClosure();
  44136. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44137. }));
  44138. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  44139. },
  44140. args: ["anIRSend"],
  44141. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  44142. referencedClasses: [],
  44143. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  44144. }),
  44145. $globals.IRSendInliner.a$cls);
  44146. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  44147. $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};";
  44148. $core.addMethod(
  44149. $core.method({
  44150. selector: "inlineAssignment:",
  44151. protocol: "inlining",
  44152. fn: function (anIRAssignment){
  44153. var self=this,$self=this;
  44154. return $core.withContext(function($ctx1) {
  44155. $self._target_($recv(anIRAssignment)._left());
  44156. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  44157. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  44158. },
  44159. args: ["anIRAssignment"],
  44160. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  44161. referencedClasses: [],
  44162. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  44163. }),
  44164. $globals.IRAssignmentInliner);
  44165. $core.addMethod(
  44166. $core.method({
  44167. selector: "inlineClosure:",
  44168. protocol: "inlining",
  44169. fn: function (anIRClosure){
  44170. var self=this,$self=this;
  44171. var closure,sequence,statements;
  44172. return $core.withContext(function($ctx1) {
  44173. var $1,$2,$3,$5,$4;
  44174. closure=(
  44175. $ctx1.supercall = true,
  44176. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44177. $ctx1.supercall = false;
  44178. sequence=$recv(closure)._sequence();
  44179. statements=$recv(sequence)._dagChildren();
  44180. $recv(statements)._ifNotEmpty_((function(){
  44181. var final;
  44182. return $core.withContext(function($ctx2) {
  44183. final=$recv(statements)._last();
  44184. $1=$recv(final)._yieldsValue();
  44185. if($core.assert($1)){
  44186. $2=sequence;
  44187. $3=final;
  44188. $5=$recv($globals.IRAssignment)._new();
  44189. $recv($5)._add_($self._target());
  44190. $ctx2.sendIdx["add:"]=1;
  44191. $recv($5)._add_($recv(final)._copy());
  44192. $4=$recv($5)._yourself();
  44193. return $recv($2)._replace_with_($3,$4);
  44194. }
  44195. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44196. }));
  44197. return closure;
  44198. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44199. },
  44200. args: ["anIRClosure"],
  44201. 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",
  44202. referencedClasses: ["IRAssignment"],
  44203. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44204. }),
  44205. $globals.IRAssignmentInliner);
  44206. $core.addMethod(
  44207. $core.method({
  44208. selector: "target",
  44209. protocol: "accessing",
  44210. fn: function (){
  44211. var self=this,$self=this;
  44212. return $self["@target"];
  44213. },
  44214. args: [],
  44215. source: "target\x0a\x09^ target",
  44216. referencedClasses: [],
  44217. messageSends: []
  44218. }),
  44219. $globals.IRAssignmentInliner);
  44220. $core.addMethod(
  44221. $core.method({
  44222. selector: "target:",
  44223. protocol: "accessing",
  44224. fn: function (anObject){
  44225. var self=this,$self=this;
  44226. $self["@target"]=anObject;
  44227. return self;
  44228. },
  44229. args: ["anObject"],
  44230. source: "target: anObject\x0a\x09target := anObject",
  44231. referencedClasses: [],
  44232. messageSends: []
  44233. }),
  44234. $globals.IRAssignmentInliner);
  44235. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44236. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44237. $core.addMethod(
  44238. $core.method({
  44239. selector: "inlineClosure:",
  44240. protocol: "inlining",
  44241. fn: function (anIRClosure){
  44242. var self=this,$self=this;
  44243. var closure,sequence,statements;
  44244. return $core.withContext(function($ctx1) {
  44245. var $1,$2,$3,$5,$4;
  44246. closure=(
  44247. $ctx1.supercall = true,
  44248. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44249. $ctx1.supercall = false;
  44250. sequence=$recv(closure)._sequence();
  44251. statements=$recv(sequence)._dagChildren();
  44252. $recv(statements)._ifNotEmpty_((function(){
  44253. var final;
  44254. return $core.withContext(function($ctx2) {
  44255. final=$recv(statements)._last();
  44256. $1=$recv(final)._yieldsValue();
  44257. if($core.assert($1)){
  44258. $2=sequence;
  44259. $3=final;
  44260. $5=$recv($globals.IRReturn)._new();
  44261. $recv($5)._add_($recv(final)._copy());
  44262. $4=$recv($5)._yourself();
  44263. return $recv($2)._replace_with_($3,$4);
  44264. }
  44265. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44266. }));
  44267. return closure;
  44268. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44269. },
  44270. args: ["anIRClosure"],
  44271. 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",
  44272. referencedClasses: ["IRReturn"],
  44273. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44274. }),
  44275. $globals.IRReturnInliner);
  44276. $core.addMethod(
  44277. $core.method({
  44278. selector: "inlineReturn:",
  44279. protocol: "inlining",
  44280. fn: function (anIRReturn){
  44281. var self=this,$self=this;
  44282. return $core.withContext(function($ctx1) {
  44283. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44284. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44285. },
  44286. args: ["anIRReturn"],
  44287. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44288. referencedClasses: [],
  44289. messageSends: ["inlineSend:andReplace:", "expression"]
  44290. }),
  44291. $globals.IRReturnInliner);
  44292. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44293. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44294. $core.addMethod(
  44295. $core.method({
  44296. selector: "inliner",
  44297. protocol: "compiling",
  44298. fn: function (){
  44299. var self=this,$self=this;
  44300. return $core.withContext(function($ctx1) {
  44301. return $recv($globals.IRInliner)._new();
  44302. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44303. },
  44304. args: [],
  44305. source: "inliner\x0a\x09^ IRInliner new",
  44306. referencedClasses: ["IRInliner"],
  44307. messageSends: ["new"]
  44308. }),
  44309. $globals.InliningCodeGenerator);
  44310. $core.addMethod(
  44311. $core.method({
  44312. selector: "irTranslatorClass",
  44313. protocol: "compiling",
  44314. fn: function (){
  44315. var self=this,$self=this;
  44316. return $globals.IRInliningJSTranslator;
  44317. },
  44318. args: [],
  44319. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44320. referencedClasses: ["IRInliningJSTranslator"],
  44321. messageSends: []
  44322. }),
  44323. $globals.InliningCodeGenerator);
  44324. $core.addMethod(
  44325. $core.method({
  44326. selector: "preInliner",
  44327. protocol: "compiling",
  44328. fn: function (){
  44329. var self=this,$self=this;
  44330. return $core.withContext(function($ctx1) {
  44331. return $recv($globals.ASTPreInliner)._new();
  44332. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44333. },
  44334. args: [],
  44335. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44336. referencedClasses: ["ASTPreInliner"],
  44337. messageSends: ["new"]
  44338. }),
  44339. $globals.InliningCodeGenerator);
  44340. $core.addMethod(
  44341. $core.method({
  44342. selector: "transformersDictionary",
  44343. protocol: "compiling",
  44344. fn: function (){
  44345. var self=this,$self=this;
  44346. return $core.withContext(function($ctx1) {
  44347. var $1,$2,$receiver;
  44348. $1=$self["@transformersDictionary"];
  44349. if(($receiver = $1) == null || $receiver.a$nil){
  44350. $2=(
  44351. $ctx1.supercall = true,
  44352. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44353. $ctx1.supercall = false;
  44354. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44355. $ctx1.sendIdx["at:put:"]=1;
  44356. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44357. $ctx1.sendIdx["at:put:"]=2;
  44358. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44359. $self["@transformersDictionary"]=$recv($2)._yourself();
  44360. return $self["@transformersDictionary"];
  44361. } else {
  44362. return $1;
  44363. }
  44364. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44365. },
  44366. args: [],
  44367. 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 ]",
  44368. referencedClasses: [],
  44369. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44370. }),
  44371. $globals.InliningCodeGenerator);
  44372. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44373. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44374. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44375. $core.addMethod(
  44376. $core.method({
  44377. selector: "visitSendNode:",
  44378. protocol: "visiting",
  44379. fn: function (aNode){
  44380. var self=this,$self=this;
  44381. return $core.withContext(function($ctx1) {
  44382. var $1,$2,$3,$receiver;
  44383. $1=$recv(aNode)._superSend();
  44384. if(!$core.assert($1)){
  44385. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44386. if($core.assert($2)){
  44387. $recv(aNode)._shouldBeInlined_(true);
  44388. $3=$recv(aNode)._receiver();
  44389. if(($receiver = $3) == null || $receiver.a$nil){
  44390. $3;
  44391. } else {
  44392. var receiver;
  44393. receiver=$receiver;
  44394. $recv(receiver)._shouldBeAliased_(true);
  44395. }
  44396. }
  44397. }
  44398. (
  44399. $ctx1.supercall = true,
  44400. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44401. $ctx1.supercall = false;
  44402. return self;
  44403. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44404. },
  44405. args: ["aNode"],
  44406. 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",
  44407. referencedClasses: ["IRSendInliner"],
  44408. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44409. }),
  44410. $globals.InliningSemanticAnalyzer);
  44411. $core.addMethod(
  44412. $core.method({
  44413. selector: "asInlinedBlockResult",
  44414. protocol: "*Compiler-Inlining",
  44415. fn: function (){
  44416. var self=this,$self=this;
  44417. return $core.withContext(function($ctx1) {
  44418. return $self._expression();
  44419. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44420. },
  44421. args: [],
  44422. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44423. referencedClasses: [],
  44424. messageSends: ["expression"]
  44425. }),
  44426. $globals.IRBlockReturn);
  44427. $core.addMethod(
  44428. $core.method({
  44429. selector: "asInlinedBlockResult",
  44430. protocol: "*Compiler-Inlining",
  44431. fn: function (){
  44432. var self=this,$self=this;
  44433. return self;
  44434. },
  44435. args: [],
  44436. source: "asInlinedBlockResult\x0a\x09^ self",
  44437. referencedClasses: [],
  44438. messageSends: []
  44439. }),
  44440. $globals.IRInstruction);
  44441. });
  44442. 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";
  44443. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44444. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44445. $core.addPackage("Compiler-Interpreter");
  44446. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  44447. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44448. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44449. $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`).";
  44450. $core.addMethod(
  44451. $core.method({
  44452. selector: "applyTo:arguments:",
  44453. protocol: "evaluating",
  44454. fn: function (anObject,aCollection){
  44455. var self=this,$self=this;
  44456. return $core.withContext(function($ctx1) {
  44457. $self._interpreterError();
  44458. return self;
  44459. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44460. },
  44461. args: ["anObject", "aCollection"],
  44462. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44463. referencedClasses: [],
  44464. messageSends: ["interpreterError"]
  44465. }),
  44466. $globals.AIBlockClosure);
  44467. $core.addMethod(
  44468. $core.method({
  44469. selector: "compiledSource",
  44470. protocol: "accessing",
  44471. fn: function (){
  44472. var self=this,$self=this;
  44473. return "[ AST Block closure ]";
  44474. },
  44475. args: [],
  44476. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44477. referencedClasses: [],
  44478. messageSends: []
  44479. }),
  44480. $globals.AIBlockClosure);
  44481. $core.addMethod(
  44482. $core.method({
  44483. selector: "currySelf",
  44484. protocol: "converting",
  44485. fn: function (){
  44486. var self=this,$self=this;
  44487. return $core.withContext(function($ctx1) {
  44488. $self._interpreterError();
  44489. return self;
  44490. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44491. },
  44492. args: [],
  44493. source: "currySelf\x0a\x09self interpreterError",
  44494. referencedClasses: [],
  44495. messageSends: ["interpreterError"]
  44496. }),
  44497. $globals.AIBlockClosure);
  44498. $core.addMethod(
  44499. $core.method({
  44500. selector: "initializeWithContext:node:",
  44501. protocol: "initialization",
  44502. fn: function (aContext,aNode){
  44503. var self=this,$self=this;
  44504. $self["@node"]=aNode;
  44505. $self["@outerContext"]=aContext;
  44506. return self;
  44507. },
  44508. args: ["aContext", "aNode"],
  44509. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44510. referencedClasses: [],
  44511. messageSends: []
  44512. }),
  44513. $globals.AIBlockClosure);
  44514. $core.addMethod(
  44515. $core.method({
  44516. selector: "interpreterError",
  44517. protocol: "error handling",
  44518. fn: function (){
  44519. var self=this,$self=this;
  44520. return $core.withContext(function($ctx1) {
  44521. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44522. return self;
  44523. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44524. },
  44525. args: [],
  44526. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44527. referencedClasses: ["ASTInterpreterError"],
  44528. messageSends: ["signal:"]
  44529. }),
  44530. $globals.AIBlockClosure);
  44531. $core.addMethod(
  44532. $core.method({
  44533. selector: "numArgs",
  44534. protocol: "accessing",
  44535. fn: function (){
  44536. var self=this,$self=this;
  44537. return $core.withContext(function($ctx1) {
  44538. return $recv($recv($self["@node"])._temps())._size();
  44539. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44540. },
  44541. args: [],
  44542. source: "numArgs\x0a\x09^ node temps size",
  44543. referencedClasses: [],
  44544. messageSends: ["size", "temps"]
  44545. }),
  44546. $globals.AIBlockClosure);
  44547. $core.addMethod(
  44548. $core.method({
  44549. selector: "value",
  44550. protocol: "evaluating",
  44551. fn: function (){
  44552. var self=this,$self=this;
  44553. return $core.withContext(function($ctx1) {
  44554. return $self._valueWithPossibleArguments_([]);
  44555. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44556. },
  44557. args: [],
  44558. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44559. referencedClasses: [],
  44560. messageSends: ["valueWithPossibleArguments:"]
  44561. }),
  44562. $globals.AIBlockClosure);
  44563. $core.addMethod(
  44564. $core.method({
  44565. selector: "value:",
  44566. protocol: "evaluating",
  44567. fn: function (anArgument){
  44568. var self=this,$self=this;
  44569. return $core.withContext(function($ctx1) {
  44570. return $self._valueWithPossibleArguments_([anArgument]);
  44571. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44572. },
  44573. args: ["anArgument"],
  44574. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44575. referencedClasses: [],
  44576. messageSends: ["valueWithPossibleArguments:"]
  44577. }),
  44578. $globals.AIBlockClosure);
  44579. $core.addMethod(
  44580. $core.method({
  44581. selector: "value:value:",
  44582. protocol: "evaluating",
  44583. fn: function (firstArgument,secondArgument){
  44584. var self=this,$self=this;
  44585. return $core.withContext(function($ctx1) {
  44586. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44587. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44588. },
  44589. args: ["firstArgument", "secondArgument"],
  44590. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44591. referencedClasses: [],
  44592. messageSends: ["valueWithPossibleArguments:"]
  44593. }),
  44594. $globals.AIBlockClosure);
  44595. $core.addMethod(
  44596. $core.method({
  44597. selector: "value:value:value:",
  44598. protocol: "evaluating",
  44599. fn: function (firstArgument,secondArgument,thirdArgument){
  44600. var self=this,$self=this;
  44601. return $core.withContext(function($ctx1) {
  44602. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44603. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44604. },
  44605. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44606. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44607. referencedClasses: [],
  44608. messageSends: ["valueWithPossibleArguments:"]
  44609. }),
  44610. $globals.AIBlockClosure);
  44611. $core.addMethod(
  44612. $core.method({
  44613. selector: "valueWithPossibleArguments:",
  44614. protocol: "evaluating",
  44615. fn: function (aCollection){
  44616. var self=this,$self=this;
  44617. var context,sequenceNode;
  44618. return $core.withContext(function($ctx1) {
  44619. var $1,$2,$3;
  44620. context=$recv($self["@outerContext"])._newInnerContext();
  44621. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44622. $recv($1)._parent_(nil);
  44623. sequenceNode=$recv($1)._yourself();
  44624. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44625. return $core.withContext(function($ctx2) {
  44626. return $recv(context)._defineLocal_(each);
  44627. $ctx2.sendIdx["defineLocal:"]=1;
  44628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44629. }));
  44630. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44631. return $core.withContext(function($ctx2) {
  44632. $recv(context)._defineLocal_(each);
  44633. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44634. return nil;
  44635. })));
  44636. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44637. }));
  44638. $2=$recv(context)._interpreter();
  44639. $ctx1.sendIdx["interpreter"]=1;
  44640. $recv($2)._node_(sequenceNode);
  44641. $recv($2)._enterNode();
  44642. $recv($2)._proceed();
  44643. $3=$recv($self["@outerContext"])._interpreter();
  44644. $ctx1.sendIdx["interpreter"]=2;
  44645. $recv($3)._setNonLocalReturnFromContext_(context);
  44646. return $recv($recv(context)._interpreter())._pop();
  44647. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44648. },
  44649. args: ["aCollection"],
  44650. 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",
  44651. referencedClasses: [],
  44652. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44653. }),
  44654. $globals.AIBlockClosure);
  44655. $core.addMethod(
  44656. $core.method({
  44657. selector: "forContext:node:",
  44658. protocol: "instance creation",
  44659. fn: function (aContext,aNode){
  44660. var self=this,$self=this;
  44661. return $core.withContext(function($ctx1) {
  44662. var $1;
  44663. $1=$self._new();
  44664. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44665. return $recv($1)._yourself();
  44666. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44667. },
  44668. args: ["aContext", "aNode"],
  44669. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44670. referencedClasses: [],
  44671. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44672. }),
  44673. $globals.AIBlockClosure.a$cls);
  44674. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44675. $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)";
  44676. $core.addMethod(
  44677. $core.method({
  44678. selector: "arguments",
  44679. protocol: "interpreting",
  44680. fn: function (){
  44681. var self=this,$self=this;
  44682. return $core.withContext(function($ctx1) {
  44683. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44684. return $core.withContext(function($ctx2) {
  44685. return $self._localAt_ifAbsent_(each,(function(){
  44686. return $core.withContext(function($ctx3) {
  44687. return $self._error_("Argument not in context");
  44688. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44689. }));
  44690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44691. }));
  44692. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44693. },
  44694. args: [],
  44695. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44696. referencedClasses: [],
  44697. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44698. }),
  44699. $globals.AIContext);
  44700. $core.addMethod(
  44701. $core.method({
  44702. selector: "ast",
  44703. protocol: "interpreting",
  44704. fn: function (){
  44705. var self=this,$self=this;
  44706. return $core.withContext(function($ctx1) {
  44707. var $1,$2,$3,$receiver;
  44708. $1=$self._isBlockContext();
  44709. if($core.assert($1)){
  44710. $2=$self._outerContext();
  44711. if(($receiver = $2) == null || $receiver.a$nil){
  44712. return $2;
  44713. } else {
  44714. var context;
  44715. context=$receiver;
  44716. return $recv(context)._ast();
  44717. }
  44718. }
  44719. $3=$self["@ast"];
  44720. if(($receiver = $3) == null || $receiver.a$nil){
  44721. $self._initializeAST();
  44722. } else {
  44723. $3;
  44724. }
  44725. return $self["@ast"];
  44726. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44727. },
  44728. args: [],
  44729. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44730. referencedClasses: [],
  44731. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44732. }),
  44733. $globals.AIContext);
  44734. $core.addMethod(
  44735. $core.method({
  44736. selector: "basicLocalAt:",
  44737. protocol: "private",
  44738. fn: function (aString){
  44739. var self=this,$self=this;
  44740. return $core.withContext(function($ctx1) {
  44741. return $recv($self._locals())._at_(aString);
  44742. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44743. },
  44744. args: ["aString"],
  44745. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44746. referencedClasses: [],
  44747. messageSends: ["at:", "locals"]
  44748. }),
  44749. $globals.AIContext);
  44750. $core.addMethod(
  44751. $core.method({
  44752. selector: "basicLocalAt:put:",
  44753. protocol: "private",
  44754. fn: function (aString,anObject){
  44755. var self=this,$self=this;
  44756. return $core.withContext(function($ctx1) {
  44757. $recv($self._locals())._at_put_(aString,anObject);
  44758. return self;
  44759. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44760. },
  44761. args: ["aString", "anObject"],
  44762. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44763. referencedClasses: [],
  44764. messageSends: ["at:put:", "locals"]
  44765. }),
  44766. $globals.AIContext);
  44767. $core.addMethod(
  44768. $core.method({
  44769. selector: "basicReceiver",
  44770. protocol: "interpreting",
  44771. fn: function (){
  44772. var self=this,$self=this;
  44773. return $core.withContext(function($ctx1) {
  44774. return $self._localAt_("self");
  44775. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44776. },
  44777. args: [],
  44778. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44779. referencedClasses: [],
  44780. messageSends: ["localAt:"]
  44781. }),
  44782. $globals.AIContext);
  44783. $core.addMethod(
  44784. $core.method({
  44785. selector: "defineLocal:",
  44786. protocol: "accessing",
  44787. fn: function (aString){
  44788. var self=this,$self=this;
  44789. return $core.withContext(function($ctx1) {
  44790. $recv($self._locals())._at_put_(aString,nil);
  44791. return self;
  44792. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44793. },
  44794. args: ["aString"],
  44795. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44796. referencedClasses: [],
  44797. messageSends: ["at:put:", "locals"]
  44798. }),
  44799. $globals.AIContext);
  44800. $core.addMethod(
  44801. $core.method({
  44802. selector: "evaluate:on:",
  44803. protocol: "evaluating",
  44804. fn: function (aString,anEvaluator){
  44805. var self=this,$self=this;
  44806. return $core.withContext(function($ctx1) {
  44807. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44808. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44809. },
  44810. args: ["aString", "anEvaluator"],
  44811. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44812. referencedClasses: [],
  44813. messageSends: ["evaluate:context:"]
  44814. }),
  44815. $globals.AIContext);
  44816. $core.addMethod(
  44817. $core.method({
  44818. selector: "evaluateNode:",
  44819. protocol: "evaluating",
  44820. fn: function (aNode){
  44821. var self=this,$self=this;
  44822. return $core.withContext(function($ctx1) {
  44823. var $1;
  44824. $1=$recv($globals.ASTInterpreter)._new();
  44825. $recv($1)._context_(self);
  44826. $recv($1)._node_(aNode);
  44827. $recv($1)._enterNode();
  44828. $recv($1)._proceed();
  44829. return $recv($1)._result();
  44830. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44831. },
  44832. args: ["aNode"],
  44833. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44834. referencedClasses: ["ASTInterpreter"],
  44835. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44836. }),
  44837. $globals.AIContext);
  44838. $core.addMethod(
  44839. $core.method({
  44840. selector: "evaluatedSelector",
  44841. protocol: "accessing",
  44842. fn: function (){
  44843. var self=this,$self=this;
  44844. return $self["@evaluatedSelector"];
  44845. },
  44846. args: [],
  44847. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44848. referencedClasses: [],
  44849. messageSends: []
  44850. }),
  44851. $globals.AIContext);
  44852. $core.addMethod(
  44853. $core.method({
  44854. selector: "evaluatedSelector:",
  44855. protocol: "accessing",
  44856. fn: function (aString){
  44857. var self=this,$self=this;
  44858. $self["@evaluatedSelector"]=aString;
  44859. return self;
  44860. },
  44861. args: ["aString"],
  44862. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44863. referencedClasses: [],
  44864. messageSends: []
  44865. }),
  44866. $globals.AIContext);
  44867. $core.addMethod(
  44868. $core.method({
  44869. selector: "index",
  44870. protocol: "accessing",
  44871. fn: function (){
  44872. var self=this,$self=this;
  44873. return $core.withContext(function($ctx1) {
  44874. var $1,$receiver;
  44875. $1=$self["@index"];
  44876. if(($receiver = $1) == null || $receiver.a$nil){
  44877. return (0);
  44878. } else {
  44879. return $1;
  44880. }
  44881. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44882. },
  44883. args: [],
  44884. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44885. referencedClasses: [],
  44886. messageSends: ["ifNil:"]
  44887. }),
  44888. $globals.AIContext);
  44889. $core.addMethod(
  44890. $core.method({
  44891. selector: "index:",
  44892. protocol: "accessing",
  44893. fn: function (anInteger){
  44894. var self=this,$self=this;
  44895. $self["@index"]=anInteger;
  44896. return self;
  44897. },
  44898. args: ["anInteger"],
  44899. source: "index: anInteger\x0a\x09index := anInteger",
  44900. referencedClasses: [],
  44901. messageSends: []
  44902. }),
  44903. $globals.AIContext);
  44904. $core.addMethod(
  44905. $core.method({
  44906. selector: "initializeAST",
  44907. protocol: "initialization",
  44908. fn: function (){
  44909. var self=this,$self=this;
  44910. return $core.withContext(function($ctx1) {
  44911. var $1;
  44912. $1=$self._method();
  44913. $ctx1.sendIdx["method"]=1;
  44914. $self["@ast"]=$recv($1)._ast();
  44915. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44916. return self;
  44917. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44918. },
  44919. args: [],
  44920. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44921. referencedClasses: ["SemanticAnalyzer"],
  44922. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44923. }),
  44924. $globals.AIContext);
  44925. $core.addMethod(
  44926. $core.method({
  44927. selector: "initializeFromMethodContext:",
  44928. protocol: "initialization",
  44929. fn: function (aMethodContext){
  44930. var self=this,$self=this;
  44931. return $core.withContext(function($ctx1) {
  44932. var $1,$2,$3,$receiver;
  44933. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44934. $self._index_($recv(aMethodContext)._index());
  44935. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44936. $self._receiver_($recv(aMethodContext)._receiver());
  44937. $self._supercall_($recv(aMethodContext)._supercall());
  44938. $self._selector_($recv(aMethodContext)._selector());
  44939. $1=$recv(aMethodContext)._outerContext();
  44940. $ctx1.sendIdx["outerContext"]=1;
  44941. if(($receiver = $1) == null || $receiver.a$nil){
  44942. $1;
  44943. } else {
  44944. var outer;
  44945. outer=$receiver;
  44946. $2=$recv(outer)._methodContext();
  44947. if(($receiver = $2) == null || $receiver.a$nil){
  44948. $2;
  44949. } else {
  44950. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44951. }
  44952. $3=$recv(aMethodContext)._locals();
  44953. $ctx1.sendIdx["locals"]=1;
  44954. $recv($3)._keysAndValuesDo_((function(key,value){
  44955. return $core.withContext(function($ctx2) {
  44956. return $recv($self._locals())._at_put_(key,value);
  44957. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44958. }));
  44959. }
  44960. return self;
  44961. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44962. },
  44963. args: ["aMethodContext"],
  44964. 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 ] ]",
  44965. referencedClasses: [],
  44966. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44967. }),
  44968. $globals.AIContext);
  44969. $core.addMethod(
  44970. $core.method({
  44971. selector: "initializeInterpreter",
  44972. protocol: "initialization",
  44973. fn: function (){
  44974. var self=this,$self=this;
  44975. return $core.withContext(function($ctx1) {
  44976. var $1,$2,$receiver;
  44977. $1=$recv($globals.ASTInterpreter)._new();
  44978. $recv($1)._context_(self);
  44979. $self["@interpreter"]=$recv($1)._yourself();
  44980. $2=$self._innerContext();
  44981. if(($receiver = $2) == null || $receiver.a$nil){
  44982. $2;
  44983. } else {
  44984. $self._setupInterpreter_($self["@interpreter"]);
  44985. }
  44986. return self;
  44987. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44988. },
  44989. args: [],
  44990. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44991. referencedClasses: ["ASTInterpreter"],
  44992. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44993. }),
  44994. $globals.AIContext);
  44995. $core.addMethod(
  44996. $core.method({
  44997. selector: "initializeLocals",
  44998. protocol: "initialization",
  44999. fn: function (){
  45000. var self=this,$self=this;
  45001. return $core.withContext(function($ctx1) {
  45002. $self["@locals"]=$recv($globals.Dictionary)._new();
  45003. $recv($self["@locals"])._at_put_("thisContext",self);
  45004. return self;
  45005. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  45006. },
  45007. args: [],
  45008. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  45009. referencedClasses: ["Dictionary"],
  45010. messageSends: ["new", "at:put:"]
  45011. }),
  45012. $globals.AIContext);
  45013. $core.addMethod(
  45014. $core.method({
  45015. selector: "innerContext",
  45016. protocol: "accessing",
  45017. fn: function (){
  45018. var self=this,$self=this;
  45019. return $self["@innerContext"];
  45020. },
  45021. args: [],
  45022. source: "innerContext\x0a\x09^ innerContext",
  45023. referencedClasses: [],
  45024. messageSends: []
  45025. }),
  45026. $globals.AIContext);
  45027. $core.addMethod(
  45028. $core.method({
  45029. selector: "innerContext:",
  45030. protocol: "accessing",
  45031. fn: function (anAIContext){
  45032. var self=this,$self=this;
  45033. $self["@innerContext"]=anAIContext;
  45034. return self;
  45035. },
  45036. args: ["anAIContext"],
  45037. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  45038. referencedClasses: [],
  45039. messageSends: []
  45040. }),
  45041. $globals.AIContext);
  45042. $core.addMethod(
  45043. $core.method({
  45044. selector: "interpreter",
  45045. protocol: "interpreting",
  45046. fn: function (){
  45047. var self=this,$self=this;
  45048. return $core.withContext(function($ctx1) {
  45049. var $1,$receiver;
  45050. $1=$self["@interpreter"];
  45051. if(($receiver = $1) == null || $receiver.a$nil){
  45052. $self._initializeInterpreter();
  45053. } else {
  45054. $1;
  45055. }
  45056. return $self["@interpreter"];
  45057. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  45058. },
  45059. args: [],
  45060. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  45061. referencedClasses: [],
  45062. messageSends: ["ifNil:", "initializeInterpreter"]
  45063. }),
  45064. $globals.AIContext);
  45065. $core.addMethod(
  45066. $core.method({
  45067. selector: "interpreter:",
  45068. protocol: "interpreting",
  45069. fn: function (anInterpreter){
  45070. var self=this,$self=this;
  45071. $self["@interpreter"]=anInterpreter;
  45072. return self;
  45073. },
  45074. args: ["anInterpreter"],
  45075. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  45076. referencedClasses: [],
  45077. messageSends: []
  45078. }),
  45079. $globals.AIContext);
  45080. $core.addMethod(
  45081. $core.method({
  45082. selector: "isTopContext",
  45083. protocol: "testing",
  45084. fn: function (){
  45085. var self=this,$self=this;
  45086. return $core.withContext(function($ctx1) {
  45087. return $recv($self._innerContext())._isNil();
  45088. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  45089. },
  45090. args: [],
  45091. source: "isTopContext\x0a\x09^ self innerContext isNil",
  45092. referencedClasses: [],
  45093. messageSends: ["isNil", "innerContext"]
  45094. }),
  45095. $globals.AIContext);
  45096. $core.addMethod(
  45097. $core.method({
  45098. selector: "localAt:",
  45099. protocol: "accessing",
  45100. fn: function (aString){
  45101. var self=this,$self=this;
  45102. var context;
  45103. return $core.withContext(function($ctx1) {
  45104. context=$self._lookupContextForLocal_(aString);
  45105. return $recv(context)._basicLocalAt_(aString);
  45106. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  45107. },
  45108. args: ["aString"],
  45109. 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",
  45110. referencedClasses: [],
  45111. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  45112. }),
  45113. $globals.AIContext);
  45114. $core.addMethod(
  45115. $core.method({
  45116. selector: "localAt:ifAbsent:",
  45117. protocol: "accessing",
  45118. fn: function (aString,aBlock){
  45119. var self=this,$self=this;
  45120. var context;
  45121. return $core.withContext(function($ctx1) {
  45122. var $early={};
  45123. try {
  45124. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  45125. return $core.withContext(function($ctx2) {
  45126. throw $early=[$recv(aBlock)._value()];
  45127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45128. }));
  45129. return $recv(context)._basicLocalAt_(aString);
  45130. }
  45131. catch(e) {if(e===$early)return e[0]; throw e}
  45132. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  45133. },
  45134. args: ["aString", "aBlock"],
  45135. 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",
  45136. referencedClasses: [],
  45137. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  45138. }),
  45139. $globals.AIContext);
  45140. $core.addMethod(
  45141. $core.method({
  45142. selector: "localAt:put:",
  45143. protocol: "accessing",
  45144. fn: function (aString,anObject){
  45145. var self=this,$self=this;
  45146. var context;
  45147. return $core.withContext(function($ctx1) {
  45148. context=$self._lookupContextForLocal_(aString);
  45149. $recv(context)._basicLocalAt_put_(aString,anObject);
  45150. return self;
  45151. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  45152. },
  45153. args: ["aString", "anObject"],
  45154. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  45155. referencedClasses: [],
  45156. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  45157. }),
  45158. $globals.AIContext);
  45159. $core.addMethod(
  45160. $core.method({
  45161. selector: "locals",
  45162. protocol: "accessing",
  45163. fn: function (){
  45164. var self=this,$self=this;
  45165. return $core.withContext(function($ctx1) {
  45166. var $1,$receiver;
  45167. $1=$self["@locals"];
  45168. if(($receiver = $1) == null || $receiver.a$nil){
  45169. $self._initializeLocals();
  45170. } else {
  45171. $1;
  45172. }
  45173. return $self["@locals"];
  45174. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  45175. },
  45176. args: [],
  45177. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  45178. referencedClasses: [],
  45179. messageSends: ["ifNil:", "initializeLocals"]
  45180. }),
  45181. $globals.AIContext);
  45182. $core.addMethod(
  45183. $core.method({
  45184. selector: "lookupContextForLocal:",
  45185. protocol: "private",
  45186. fn: function (aString){
  45187. var self=this,$self=this;
  45188. return $core.withContext(function($ctx1) {
  45189. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45190. return $core.withContext(function($ctx2) {
  45191. return $self._variableNotFound();
  45192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45193. }));
  45194. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45195. },
  45196. args: ["aString"],
  45197. 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 ]",
  45198. referencedClasses: [],
  45199. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45200. }),
  45201. $globals.AIContext);
  45202. $core.addMethod(
  45203. $core.method({
  45204. selector: "lookupContextForLocal:ifNone:",
  45205. protocol: "private",
  45206. fn: function (aString,aBlock){
  45207. var self=this,$self=this;
  45208. return $core.withContext(function($ctx1) {
  45209. var $1;
  45210. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45211. return self;
  45212. }),(function(){
  45213. return $core.withContext(function($ctx2) {
  45214. $1=$self._outerContext();
  45215. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45216. return $core.withContext(function($ctx3) {
  45217. return $recv(context)._lookupContextForLocal_(aString);
  45218. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45219. }));
  45220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45221. }));
  45222. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45223. },
  45224. args: ["aString", "aBlock"],
  45225. 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 ] ]",
  45226. referencedClasses: [],
  45227. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45228. }),
  45229. $globals.AIContext);
  45230. $core.addMethod(
  45231. $core.method({
  45232. selector: "newInnerContext",
  45233. protocol: "factory",
  45234. fn: function (){
  45235. var self=this,$self=this;
  45236. return $core.withContext(function($ctx1) {
  45237. var $1;
  45238. $1=$recv($self._class())._new();
  45239. $recv($1)._outerContext_(self);
  45240. return $recv($1)._yourself();
  45241. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45242. },
  45243. args: [],
  45244. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45245. referencedClasses: [],
  45246. messageSends: ["outerContext:", "new", "class", "yourself"]
  45247. }),
  45248. $globals.AIContext);
  45249. $core.addMethod(
  45250. $core.method({
  45251. selector: "outerContext",
  45252. protocol: "accessing",
  45253. fn: function (){
  45254. var self=this,$self=this;
  45255. return $self["@outerContext"];
  45256. },
  45257. args: [],
  45258. source: "outerContext\x0a\x09^ outerContext",
  45259. referencedClasses: [],
  45260. messageSends: []
  45261. }),
  45262. $globals.AIContext);
  45263. $core.addMethod(
  45264. $core.method({
  45265. selector: "outerContext:",
  45266. protocol: "accessing",
  45267. fn: function (anAIContext){
  45268. var self=this,$self=this;
  45269. return $core.withContext(function($ctx1) {
  45270. var $1,$receiver;
  45271. $self["@outerContext"]=anAIContext;
  45272. $1=$self["@outerContext"];
  45273. if(($receiver = $1) == null || $receiver.a$nil){
  45274. $1;
  45275. } else {
  45276. var context;
  45277. context=$receiver;
  45278. $recv(context)._innerContext_(self);
  45279. }
  45280. return self;
  45281. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45282. },
  45283. args: ["anAIContext"],
  45284. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45285. referencedClasses: [],
  45286. messageSends: ["ifNotNil:", "innerContext:"]
  45287. }),
  45288. $globals.AIContext);
  45289. $core.addMethod(
  45290. $core.method({
  45291. selector: "receiver:",
  45292. protocol: "interpreting",
  45293. fn: function (anObject){
  45294. var self=this,$self=this;
  45295. return $core.withContext(function($ctx1) {
  45296. $recv($self._locals())._at_put_("self",anObject);
  45297. return self;
  45298. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45299. },
  45300. args: ["anObject"],
  45301. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45302. referencedClasses: [],
  45303. messageSends: ["at:put:", "locals"]
  45304. }),
  45305. $globals.AIContext);
  45306. $core.addMethod(
  45307. $core.method({
  45308. selector: "selector",
  45309. protocol: "accessing",
  45310. fn: function (){
  45311. var self=this,$self=this;
  45312. return $self["@selector"];
  45313. },
  45314. args: [],
  45315. source: "selector\x0a\x09^ selector",
  45316. referencedClasses: [],
  45317. messageSends: []
  45318. }),
  45319. $globals.AIContext);
  45320. $core.addMethod(
  45321. $core.method({
  45322. selector: "selector:",
  45323. protocol: "accessing",
  45324. fn: function (aString){
  45325. var self=this,$self=this;
  45326. $self["@selector"]=aString;
  45327. return self;
  45328. },
  45329. args: ["aString"],
  45330. source: "selector: aString\x0a\x09selector := aString",
  45331. referencedClasses: [],
  45332. messageSends: []
  45333. }),
  45334. $globals.AIContext);
  45335. $core.addMethod(
  45336. $core.method({
  45337. selector: "sendIndexAt:",
  45338. protocol: "accessing",
  45339. fn: function (aString){
  45340. var self=this,$self=this;
  45341. return $core.withContext(function($ctx1) {
  45342. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45343. return (0);
  45344. }));
  45345. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45346. },
  45347. args: ["aString"],
  45348. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45349. referencedClasses: [],
  45350. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45351. }),
  45352. $globals.AIContext);
  45353. $core.addMethod(
  45354. $core.method({
  45355. selector: "sendIndexes",
  45356. protocol: "accessing",
  45357. fn: function (){
  45358. var self=this,$self=this;
  45359. return $core.withContext(function($ctx1) {
  45360. var $1,$receiver;
  45361. $1=$self["@sendIndexes"];
  45362. if(($receiver = $1) == null || $receiver.a$nil){
  45363. return $recv($globals.Dictionary)._new();
  45364. } else {
  45365. return $1;
  45366. }
  45367. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45368. },
  45369. args: [],
  45370. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45371. referencedClasses: ["Dictionary"],
  45372. messageSends: ["ifNil:", "new"]
  45373. }),
  45374. $globals.AIContext);
  45375. $core.addMethod(
  45376. $core.method({
  45377. selector: "sendIndexes:",
  45378. protocol: "accessing",
  45379. fn: function (aDictionary){
  45380. var self=this,$self=this;
  45381. $self["@sendIndexes"]=aDictionary;
  45382. return self;
  45383. },
  45384. args: ["aDictionary"],
  45385. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45386. referencedClasses: [],
  45387. messageSends: []
  45388. }),
  45389. $globals.AIContext);
  45390. $core.addMethod(
  45391. $core.method({
  45392. selector: "setupInterpreter:",
  45393. protocol: "interpreting",
  45394. fn: function (anInterpreter){
  45395. var self=this,$self=this;
  45396. var currentNode;
  45397. return $core.withContext(function($ctx1) {
  45398. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45399. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45400. $2=$self._evaluatedSelector();
  45401. $ctx1.sendIdx["evaluatedSelector"]=1;
  45402. $recv($1)._selector_($2);
  45403. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45404. $3=$self._ast();
  45405. $ctx1.sendIdx["ast"]=1;
  45406. $recv($1)._visit_($3);
  45407. currentNode=$recv($1)._currentNode();
  45408. $4=$recv($self._ast())._sequenceNode();
  45409. if(($receiver = $4) == null || $receiver.a$nil){
  45410. $4;
  45411. } else {
  45412. var sequence;
  45413. sequence=$receiver;
  45414. $recv($recv(sequence)._temps())._do_((function(each){
  45415. return $core.withContext(function($ctx2) {
  45416. return $self._defineLocal_(each);
  45417. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45418. }));
  45419. $ctx1.sendIdx["do:"]=1;
  45420. }
  45421. $recv(anInterpreter)._node_(currentNode);
  45422. $7=$self._innerContext();
  45423. $ctx1.sendIdx["innerContext"]=1;
  45424. $6=$recv($7)._arguments();
  45425. $5=$recv($6)._reversed();
  45426. $recv($5)._do_((function(each){
  45427. return $core.withContext(function($ctx2) {
  45428. return $recv(anInterpreter)._push_(each);
  45429. $ctx2.sendIdx["push:"]=1;
  45430. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45431. }));
  45432. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45433. return self;
  45434. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45435. },
  45436. args: ["anInterpreter"],
  45437. 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)",
  45438. referencedClasses: ["ASTPCNodeVisitor"],
  45439. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45440. }),
  45441. $globals.AIContext);
  45442. $core.addMethod(
  45443. $core.method({
  45444. selector: "supercall",
  45445. protocol: "interpreting",
  45446. fn: function (){
  45447. var self=this,$self=this;
  45448. return $core.withContext(function($ctx1) {
  45449. var $1,$receiver;
  45450. $1=$self["@supercall"];
  45451. if(($receiver = $1) == null || $receiver.a$nil){
  45452. return false;
  45453. } else {
  45454. return $1;
  45455. }
  45456. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45457. },
  45458. args: [],
  45459. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45460. referencedClasses: [],
  45461. messageSends: ["ifNil:"]
  45462. }),
  45463. $globals.AIContext);
  45464. $core.addMethod(
  45465. $core.method({
  45466. selector: "supercall:",
  45467. protocol: "interpreting",
  45468. fn: function (aBoolean){
  45469. var self=this,$self=this;
  45470. $self["@supercall"]=aBoolean;
  45471. return self;
  45472. },
  45473. args: ["aBoolean"],
  45474. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45475. referencedClasses: [],
  45476. messageSends: []
  45477. }),
  45478. $globals.AIContext);
  45479. $core.addMethod(
  45480. $core.method({
  45481. selector: "variableNotFound",
  45482. protocol: "error handling",
  45483. fn: function (){
  45484. var self=this,$self=this;
  45485. return $core.withContext(function($ctx1) {
  45486. $self._error_("Variable missing");
  45487. return self;
  45488. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45489. },
  45490. args: [],
  45491. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45492. referencedClasses: [],
  45493. messageSends: ["error:"]
  45494. }),
  45495. $globals.AIContext);
  45496. $core.addMethod(
  45497. $core.method({
  45498. selector: "fromMethodContext:",
  45499. protocol: "instance creation",
  45500. fn: function (aMethodContext){
  45501. var self=this,$self=this;
  45502. return $core.withContext(function($ctx1) {
  45503. var $1;
  45504. $1=$self._new();
  45505. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45506. return $recv($1)._yourself();
  45507. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45508. },
  45509. args: ["aMethodContext"],
  45510. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45511. referencedClasses: [],
  45512. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45513. }),
  45514. $globals.AIContext.a$cls);
  45515. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45516. $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.";
  45517. $core.addMethod(
  45518. $core.method({
  45519. selector: "context",
  45520. protocol: "accessing",
  45521. fn: function (){
  45522. var self=this,$self=this;
  45523. return $self["@context"];
  45524. },
  45525. args: [],
  45526. source: "context\x0a\x09^ context",
  45527. referencedClasses: [],
  45528. messageSends: []
  45529. }),
  45530. $globals.AISemanticAnalyzer);
  45531. $core.addMethod(
  45532. $core.method({
  45533. selector: "context:",
  45534. protocol: "accessing",
  45535. fn: function (anAIContext){
  45536. var self=this,$self=this;
  45537. $self["@context"]=anAIContext;
  45538. return self;
  45539. },
  45540. args: ["anAIContext"],
  45541. source: "context: anAIContext\x0a\x09context := anAIContext",
  45542. referencedClasses: [],
  45543. messageSends: []
  45544. }),
  45545. $globals.AISemanticAnalyzer);
  45546. $core.addMethod(
  45547. $core.method({
  45548. selector: "visitVariableNode:",
  45549. protocol: "visiting",
  45550. fn: function (aNode){
  45551. var self=this,$self=this;
  45552. return $core.withContext(function($ctx1) {
  45553. var $1;
  45554. var $early={};
  45555. try {
  45556. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45557. return $core.withContext(function($ctx2) {
  45558. $1=(
  45559. $ctx2.supercall = true,
  45560. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45561. $ctx2.supercall = false;
  45562. throw $early=[$1];
  45563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45564. }));
  45565. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45566. return self;
  45567. }
  45568. catch(e) {if(e===$early)return e[0]; throw e}
  45569. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45570. },
  45571. args: ["aNode"],
  45572. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45573. referencedClasses: ["ASTContextVar"],
  45574. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45575. }),
  45576. $globals.AISemanticAnalyzer);
  45577. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45578. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45579. $core.addMethod(
  45580. $core.method({
  45581. selector: "context",
  45582. protocol: "accessing",
  45583. fn: function (){
  45584. var self=this,$self=this;
  45585. return $self["@context"];
  45586. },
  45587. args: [],
  45588. source: "context\x0a\x09^ context",
  45589. referencedClasses: [],
  45590. messageSends: []
  45591. }),
  45592. $globals.ASTContextVar);
  45593. $core.addMethod(
  45594. $core.method({
  45595. selector: "context:",
  45596. protocol: "accessing",
  45597. fn: function (anObject){
  45598. var self=this,$self=this;
  45599. $self["@context"]=anObject;
  45600. return self;
  45601. },
  45602. args: ["anObject"],
  45603. source: "context: anObject\x0a\x09context := anObject",
  45604. referencedClasses: [],
  45605. messageSends: []
  45606. }),
  45607. $globals.ASTContextVar);
  45608. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45609. $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.";
  45610. $core.addMethod(
  45611. $core.method({
  45612. selector: "atEnd",
  45613. protocol: "testing",
  45614. fn: function (){
  45615. var self=this,$self=this;
  45616. return $core.withContext(function($ctx1) {
  45617. var $1,$receiver;
  45618. $1=$self._context();
  45619. $ctx1.sendIdx["context"]=1;
  45620. if(($receiver = $1) == null || $receiver.a$nil){
  45621. return true;
  45622. } else {
  45623. $1;
  45624. }
  45625. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45626. return $core.withContext(function($ctx2) {
  45627. return $recv($self._context())._isTopContext();
  45628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45629. }));
  45630. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45631. },
  45632. args: [],
  45633. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45634. referencedClasses: [],
  45635. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45636. }),
  45637. $globals.ASTDebugger);
  45638. $core.addMethod(
  45639. $core.method({
  45640. selector: "context",
  45641. protocol: "accessing",
  45642. fn: function (){
  45643. var self=this,$self=this;
  45644. return $self["@context"];
  45645. },
  45646. args: [],
  45647. source: "context\x0a\x09^ context",
  45648. referencedClasses: [],
  45649. messageSends: []
  45650. }),
  45651. $globals.ASTDebugger);
  45652. $core.addMethod(
  45653. $core.method({
  45654. selector: "context:",
  45655. protocol: "accessing",
  45656. fn: function (aContext){
  45657. var self=this,$self=this;
  45658. $self["@context"]=aContext;
  45659. return self;
  45660. },
  45661. args: ["aContext"],
  45662. source: "context: aContext\x0a\x09context := aContext",
  45663. referencedClasses: [],
  45664. messageSends: []
  45665. }),
  45666. $globals.ASTDebugger);
  45667. $core.addMethod(
  45668. $core.method({
  45669. selector: "flushInnerContexts",
  45670. protocol: "actions",
  45671. fn: function (){
  45672. var self=this,$self=this;
  45673. return $core.withContext(function($ctx1) {
  45674. var $1,$receiver;
  45675. $1=$self._context();
  45676. if(($receiver = $1) == null || $receiver.a$nil){
  45677. $1;
  45678. } else {
  45679. var cxt;
  45680. cxt=$receiver;
  45681. $recv(cxt)._innerContext_(nil);
  45682. }
  45683. return self;
  45684. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45685. },
  45686. args: [],
  45687. 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 ]",
  45688. referencedClasses: [],
  45689. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45690. }),
  45691. $globals.ASTDebugger);
  45692. $core.addMethod(
  45693. $core.method({
  45694. selector: "interpreter",
  45695. protocol: "accessing",
  45696. fn: function (){
  45697. var self=this,$self=this;
  45698. return $core.withContext(function($ctx1) {
  45699. var $1,$receiver;
  45700. $1=$self._context();
  45701. if(($receiver = $1) == null || $receiver.a$nil){
  45702. return $1;
  45703. } else {
  45704. var ctx;
  45705. ctx=$receiver;
  45706. return $recv(ctx)._interpreter();
  45707. }
  45708. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45709. },
  45710. args: [],
  45711. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45712. referencedClasses: [],
  45713. messageSends: ["ifNotNil:", "context", "interpreter"]
  45714. }),
  45715. $globals.ASTDebugger);
  45716. $core.addMethod(
  45717. $core.method({
  45718. selector: "method",
  45719. protocol: "accessing",
  45720. fn: function (){
  45721. var self=this,$self=this;
  45722. return $core.withContext(function($ctx1) {
  45723. return $recv($self._context())._method();
  45724. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45725. },
  45726. args: [],
  45727. source: "method\x0a\x09^ self context method",
  45728. referencedClasses: [],
  45729. messageSends: ["method", "context"]
  45730. }),
  45731. $globals.ASTDebugger);
  45732. $core.addMethod(
  45733. $core.method({
  45734. selector: "node",
  45735. protocol: "accessing",
  45736. fn: function (){
  45737. var self=this,$self=this;
  45738. return $core.withContext(function($ctx1) {
  45739. var $1,$receiver;
  45740. $1=$self._interpreter();
  45741. $ctx1.sendIdx["interpreter"]=1;
  45742. if(($receiver = $1) == null || $receiver.a$nil){
  45743. return $1;
  45744. } else {
  45745. return $recv($self._interpreter())._node();
  45746. }
  45747. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45748. },
  45749. args: [],
  45750. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45751. referencedClasses: [],
  45752. messageSends: ["ifNotNil:", "interpreter", "node"]
  45753. }),
  45754. $globals.ASTDebugger);
  45755. $core.addMethod(
  45756. $core.method({
  45757. selector: "onStep",
  45758. protocol: "private",
  45759. fn: function (){
  45760. var self=this,$self=this;
  45761. return $core.withContext(function($ctx1) {
  45762. var $1,$3,$2,$4,$6,$5,$receiver;
  45763. $1=$self._interpreter();
  45764. $ctx1.sendIdx["interpreter"]=1;
  45765. $self["@result"]=$recv($1)._result();
  45766. $3=$self._interpreter();
  45767. $ctx1.sendIdx["interpreter"]=2;
  45768. $2=$recv($3)._atEnd();
  45769. $ctx1.sendIdx["atEnd"]=1;
  45770. if($core.assert($2)){
  45771. $4=$recv($self._context())._outerContext();
  45772. if(($receiver = $4) == null || $receiver.a$nil){
  45773. $4;
  45774. } else {
  45775. var outerContext;
  45776. outerContext=$receiver;
  45777. $self._context_(outerContext);
  45778. }
  45779. $6=$self._interpreter();
  45780. $ctx1.sendIdx["interpreter"]=3;
  45781. $5=$recv($6)._atEnd();
  45782. if(!$core.assert($5)){
  45783. $recv($self._interpreter())._skip();
  45784. }
  45785. }
  45786. $self._flushInnerContexts();
  45787. return self;
  45788. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45789. },
  45790. args: [],
  45791. 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",
  45792. referencedClasses: [],
  45793. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45794. }),
  45795. $globals.ASTDebugger);
  45796. $core.addMethod(
  45797. $core.method({
  45798. selector: "proceed",
  45799. protocol: "stepping",
  45800. fn: function (){
  45801. var self=this,$self=this;
  45802. return $core.withContext(function($ctx1) {
  45803. $recv((function(){
  45804. return $core.withContext(function($ctx2) {
  45805. return $self._atEnd();
  45806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45807. }))._whileFalse_((function(){
  45808. return $core.withContext(function($ctx2) {
  45809. return $self._stepOver();
  45810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45811. }));
  45812. return self;
  45813. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45814. },
  45815. args: [],
  45816. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45817. referencedClasses: [],
  45818. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45819. }),
  45820. $globals.ASTDebugger);
  45821. $core.addMethod(
  45822. $core.method({
  45823. selector: "restart",
  45824. protocol: "stepping",
  45825. fn: function (){
  45826. var self=this,$self=this;
  45827. return $core.withContext(function($ctx1) {
  45828. $recv($self._interpreter())._restart();
  45829. $self._flushInnerContexts();
  45830. return self;
  45831. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45832. },
  45833. args: [],
  45834. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45835. referencedClasses: [],
  45836. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45837. }),
  45838. $globals.ASTDebugger);
  45839. $core.addMethod(
  45840. $core.method({
  45841. selector: "result",
  45842. protocol: "accessing",
  45843. fn: function (){
  45844. var self=this,$self=this;
  45845. return $self["@result"];
  45846. },
  45847. args: [],
  45848. source: "result\x0a\x09^ result",
  45849. referencedClasses: [],
  45850. messageSends: []
  45851. }),
  45852. $globals.ASTDebugger);
  45853. $core.addMethod(
  45854. $core.method({
  45855. selector: "stepInto",
  45856. protocol: "stepping",
  45857. fn: function (){
  45858. var self=this,$self=this;
  45859. return $core.withContext(function($ctx1) {
  45860. $self._shouldBeImplemented();
  45861. return self;
  45862. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45863. },
  45864. args: [],
  45865. source: "stepInto\x0a\x09self shouldBeImplemented",
  45866. referencedClasses: [],
  45867. messageSends: ["shouldBeImplemented"]
  45868. }),
  45869. $globals.ASTDebugger);
  45870. $core.addMethod(
  45871. $core.method({
  45872. selector: "stepOver",
  45873. protocol: "stepping",
  45874. fn: function (){
  45875. var self=this,$self=this;
  45876. return $core.withContext(function($ctx1) {
  45877. var $1,$2;
  45878. $1=$recv($self._context())._isTopContext();
  45879. if($core.assert($1)){
  45880. $recv($self._interpreter())._stepOver();
  45881. } else {
  45882. $2=$self._interpreter();
  45883. $ctx1.sendIdx["interpreter"]=1;
  45884. $recv($2)._skip();
  45885. }
  45886. $self._onStep();
  45887. return self;
  45888. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45889. },
  45890. args: [],
  45891. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45892. referencedClasses: [],
  45893. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45894. }),
  45895. $globals.ASTDebugger);
  45896. $core.addMethod(
  45897. $core.method({
  45898. selector: "context:",
  45899. protocol: "instance creation",
  45900. fn: function (aContext){
  45901. var self=this,$self=this;
  45902. return $core.withContext(function($ctx1) {
  45903. var $1;
  45904. $1=$self._new();
  45905. $recv($1)._context_(aContext);
  45906. return $recv($1)._yourself();
  45907. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45908. },
  45909. args: ["aContext"],
  45910. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45911. referencedClasses: [],
  45912. messageSends: ["context:", "new", "yourself"]
  45913. }),
  45914. $globals.ASTDebugger.a$cls);
  45915. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45916. $core.addMethod(
  45917. $core.method({
  45918. selector: "interpreter",
  45919. protocol: "accessing",
  45920. fn: function (){
  45921. var self=this,$self=this;
  45922. return $self["@interpreter"];
  45923. },
  45924. args: [],
  45925. source: "interpreter\x0a\x09^ interpreter",
  45926. referencedClasses: [],
  45927. messageSends: []
  45928. }),
  45929. $globals.ASTEnterNode);
  45930. $core.addMethod(
  45931. $core.method({
  45932. selector: "interpreter:",
  45933. protocol: "accessing",
  45934. fn: function (anObject){
  45935. var self=this,$self=this;
  45936. $self["@interpreter"]=anObject;
  45937. return self;
  45938. },
  45939. args: ["anObject"],
  45940. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45941. referencedClasses: [],
  45942. messageSends: []
  45943. }),
  45944. $globals.ASTEnterNode);
  45945. $core.addMethod(
  45946. $core.method({
  45947. selector: "visitBlockNode:",
  45948. protocol: "visiting",
  45949. fn: function (aNode){
  45950. var self=this,$self=this;
  45951. return aNode;
  45952. },
  45953. args: ["aNode"],
  45954. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45955. referencedClasses: [],
  45956. messageSends: []
  45957. }),
  45958. $globals.ASTEnterNode);
  45959. $core.addMethod(
  45960. $core.method({
  45961. selector: "visitDagNode:",
  45962. protocol: "visiting",
  45963. fn: function (aNode){
  45964. var self=this,$self=this;
  45965. return $core.withContext(function($ctx1) {
  45966. var $early={};
  45967. try {
  45968. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45969. throw $early=[aNode];
  45970. }),(function(nodes){
  45971. return $core.withContext(function($ctx2) {
  45972. throw $early=[$self._visit_($recv(nodes)._first())];
  45973. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45974. }));
  45975. return self;
  45976. }
  45977. catch(e) {if(e===$early)return e[0]; throw e}
  45978. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45979. },
  45980. args: ["aNode"],
  45981. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45982. referencedClasses: [],
  45983. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45984. }),
  45985. $globals.ASTEnterNode);
  45986. $core.addMethod(
  45987. $core.method({
  45988. selector: "visitSequenceNode:",
  45989. protocol: "visiting",
  45990. fn: function (aNode){
  45991. var self=this,$self=this;
  45992. return $core.withContext(function($ctx1) {
  45993. var $1;
  45994. $recv($recv(aNode)._temps())._do_((function(each){
  45995. return $core.withContext(function($ctx2) {
  45996. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45998. }));
  45999. $1=(
  46000. $ctx1.supercall = true,
  46001. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  46002. $ctx1.supercall = false;
  46003. return $1;
  46004. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  46005. },
  46006. args: ["aNode"],
  46007. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  46008. referencedClasses: [],
  46009. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  46010. }),
  46011. $globals.ASTEnterNode);
  46012. $core.addMethod(
  46013. $core.method({
  46014. selector: "on:",
  46015. protocol: "instance creation",
  46016. fn: function (anInterpreter){
  46017. var self=this,$self=this;
  46018. return $core.withContext(function($ctx1) {
  46019. var $1;
  46020. $1=$self._new();
  46021. $recv($1)._interpreter_(anInterpreter);
  46022. return $recv($1)._yourself();
  46023. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  46024. },
  46025. args: ["anInterpreter"],
  46026. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  46027. referencedClasses: [],
  46028. messageSends: ["interpreter:", "new", "yourself"]
  46029. }),
  46030. $globals.ASTEnterNode.a$cls);
  46031. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  46032. $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";
  46033. $core.addMethod(
  46034. $core.method({
  46035. selector: "assign:to:",
  46036. protocol: "private",
  46037. fn: function (aNode,anObject){
  46038. var self=this,$self=this;
  46039. return $core.withContext(function($ctx1) {
  46040. var $1,$3,$2,$4;
  46041. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  46042. if($core.assert($1)){
  46043. $3=$self._context();
  46044. $ctx1.sendIdx["context"]=1;
  46045. $2=$recv($3)._receiver();
  46046. $4=$recv(aNode)._value();
  46047. $ctx1.sendIdx["value"]=1;
  46048. $recv($2)._instVarAt_put_($4,anObject);
  46049. } else {
  46050. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  46051. }
  46052. return self;
  46053. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  46054. },
  46055. args: ["aNode", "anObject"],
  46056. 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 ]",
  46057. referencedClasses: [],
  46058. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  46059. }),
  46060. $globals.ASTInterpreter);
  46061. $core.addMethod(
  46062. $core.method({
  46063. selector: "atEnd",
  46064. protocol: "testing",
  46065. fn: function (){
  46066. var self=this,$self=this;
  46067. return $core.withContext(function($ctx1) {
  46068. var $1;
  46069. $1=$self["@forceAtEnd"];
  46070. if($core.assert($1)){
  46071. return true;
  46072. }
  46073. return $recv($self._hasReturned())._or_((function(){
  46074. return $core.withContext(function($ctx2) {
  46075. return $recv($self._node())._isNil();
  46076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46077. }));
  46078. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  46079. },
  46080. args: [],
  46081. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  46082. referencedClasses: [],
  46083. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  46084. }),
  46085. $globals.ASTInterpreter);
  46086. $core.addMethod(
  46087. $core.method({
  46088. selector: "context",
  46089. protocol: "accessing",
  46090. fn: function (){
  46091. var self=this,$self=this;
  46092. return $self["@context"];
  46093. },
  46094. args: [],
  46095. source: "context\x0a\x09^ context",
  46096. referencedClasses: [],
  46097. messageSends: []
  46098. }),
  46099. $globals.ASTInterpreter);
  46100. $core.addMethod(
  46101. $core.method({
  46102. selector: "context:",
  46103. protocol: "accessing",
  46104. fn: function (aContext){
  46105. var self=this,$self=this;
  46106. $self["@context"]=aContext;
  46107. return self;
  46108. },
  46109. args: ["aContext"],
  46110. source: "context: aContext\x0a\x09context := aContext",
  46111. referencedClasses: [],
  46112. messageSends: []
  46113. }),
  46114. $globals.ASTInterpreter);
  46115. $core.addMethod(
  46116. $core.method({
  46117. selector: "enterNode",
  46118. protocol: "interpreting",
  46119. fn: function (){
  46120. var self=this,$self=this;
  46121. return $core.withContext(function($ctx1) {
  46122. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  46123. return self;
  46124. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  46125. },
  46126. args: [],
  46127. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  46128. referencedClasses: ["ASTEnterNode"],
  46129. messageSends: ["node:", "visit:", "on:", "node"]
  46130. }),
  46131. $globals.ASTInterpreter);
  46132. $core.addMethod(
  46133. $core.method({
  46134. selector: "eval:",
  46135. protocol: "private",
  46136. fn: function (aString){
  46137. var self=this,$self=this;
  46138. var source,function_;
  46139. return $core.withContext(function($ctx1) {
  46140. var $3,$2,$1;
  46141. source=$recv($globals.String)._streamContents_((function(str){
  46142. return $core.withContext(function($ctx2) {
  46143. $recv(str)._nextPutAll_("0,(function(");
  46144. $ctx2.sendIdx["nextPutAll:"]=1;
  46145. $3=$self._context();
  46146. $ctx2.sendIdx["context"]=1;
  46147. $2=$recv($3)._locals();
  46148. $ctx2.sendIdx["locals"]=1;
  46149. $1=$recv($2)._keys();
  46150. $recv($1)._do_separatedBy_((function(each){
  46151. return $core.withContext(function($ctx3) {
  46152. return $recv(str)._nextPutAll_(each);
  46153. $ctx3.sendIdx["nextPutAll:"]=2;
  46154. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  46155. }),(function(){
  46156. return $core.withContext(function($ctx3) {
  46157. return $recv(str)._nextPutAll_(",");
  46158. $ctx3.sendIdx["nextPutAll:"]=3;
  46159. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46160. }));
  46161. $recv(str)._nextPutAll_("){ return (function() {");
  46162. $ctx2.sendIdx["nextPutAll:"]=4;
  46163. $recv(str)._nextPutAll_(aString);
  46164. $ctx2.sendIdx["nextPutAll:"]=5;
  46165. return $recv(str)._nextPutAll_("})()})");
  46166. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  46167. }));
  46168. function_=$recv($globals.Compiler)._eval_(source);
  46169. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  46170. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  46171. },
  46172. args: ["aString"],
  46173. 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",
  46174. referencedClasses: ["String", "Compiler"],
  46175. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  46176. }),
  46177. $globals.ASTInterpreter);
  46178. $core.addMethod(
  46179. $core.method({
  46180. selector: "hasReturned",
  46181. protocol: "testing",
  46182. fn: function (){
  46183. var self=this,$self=this;
  46184. return $core.withContext(function($ctx1) {
  46185. var $1,$receiver;
  46186. $1=$self["@returned"];
  46187. if(($receiver = $1) == null || $receiver.a$nil){
  46188. return false;
  46189. } else {
  46190. return $1;
  46191. }
  46192. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46193. },
  46194. args: [],
  46195. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46196. referencedClasses: [],
  46197. messageSends: ["ifNil:"]
  46198. }),
  46199. $globals.ASTInterpreter);
  46200. $core.addMethod(
  46201. $core.method({
  46202. selector: "initialize",
  46203. protocol: "initialization",
  46204. fn: function (){
  46205. var self=this,$self=this;
  46206. return $core.withContext(function($ctx1) {
  46207. (
  46208. $ctx1.supercall = true,
  46209. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46210. $ctx1.supercall = false;
  46211. $self["@forceAtEnd"]=false;
  46212. return self;
  46213. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46214. },
  46215. args: [],
  46216. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46217. referencedClasses: [],
  46218. messageSends: ["initialize"]
  46219. }),
  46220. $globals.ASTInterpreter);
  46221. $core.addMethod(
  46222. $core.method({
  46223. selector: "interpret",
  46224. protocol: "interpreting",
  46225. fn: function (){
  46226. var self=this,$self=this;
  46227. return $core.withContext(function($ctx1) {
  46228. $self._visit_($self._node());
  46229. return self;
  46230. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46231. },
  46232. args: [],
  46233. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46234. referencedClasses: [],
  46235. messageSends: ["visit:", "node"]
  46236. }),
  46237. $globals.ASTInterpreter);
  46238. $core.addMethod(
  46239. $core.method({
  46240. selector: "messageFromSendNode:arguments:",
  46241. protocol: "private",
  46242. fn: function (aSendNode,aCollection){
  46243. var self=this,$self=this;
  46244. return $core.withContext(function($ctx1) {
  46245. var $1;
  46246. $1=$recv($globals.Message)._new();
  46247. $recv($1)._selector_($recv(aSendNode)._selector());
  46248. $recv($1)._arguments_(aCollection);
  46249. return $recv($1)._yourself();
  46250. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46251. },
  46252. args: ["aSendNode", "aCollection"],
  46253. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46254. referencedClasses: ["Message"],
  46255. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46256. }),
  46257. $globals.ASTInterpreter);
  46258. $core.addMethod(
  46259. $core.method({
  46260. selector: "messageNotUnderstood:receiver:",
  46261. protocol: "private",
  46262. fn: function (aMessage,anObject){
  46263. var self=this,$self=this;
  46264. return $core.withContext(function($ctx1) {
  46265. var $1;
  46266. $1=$recv($globals.MessageNotUnderstood)._new();
  46267. $recv($1)._message_(aMessage);
  46268. $recv($1)._receiver_(anObject);
  46269. $recv($1)._signal();
  46270. return self;
  46271. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46272. },
  46273. args: ["aMessage", "anObject"],
  46274. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46275. referencedClasses: ["MessageNotUnderstood"],
  46276. messageSends: ["message:", "new", "receiver:", "signal"]
  46277. }),
  46278. $globals.ASTInterpreter);
  46279. $core.addMethod(
  46280. $core.method({
  46281. selector: "next",
  46282. protocol: "interpreting",
  46283. fn: function (){
  46284. var self=this,$self=this;
  46285. var nd,nextNode;
  46286. return $core.withContext(function($ctx1) {
  46287. var $1,$2,$receiver;
  46288. nd=$self._node();
  46289. $1=$recv(nd)._parent();
  46290. if(($receiver = $1) == null || $receiver.a$nil){
  46291. nextNode=$1;
  46292. } else {
  46293. var parent;
  46294. parent=$receiver;
  46295. $2=$recv(parent)._nextSiblingNode_(nd);
  46296. if(($receiver = $2) == null || $receiver.a$nil){
  46297. nextNode=parent;
  46298. } else {
  46299. var sibling;
  46300. sibling=$receiver;
  46301. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46302. }
  46303. }
  46304. $self._node_(nextNode);
  46305. return self;
  46306. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46307. },
  46308. args: [],
  46309. 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",
  46310. referencedClasses: ["ASTEnterNode"],
  46311. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46312. }),
  46313. $globals.ASTInterpreter);
  46314. $core.addMethod(
  46315. $core.method({
  46316. selector: "node",
  46317. protocol: "accessing",
  46318. fn: function (){
  46319. var self=this,$self=this;
  46320. return $self["@node"];
  46321. },
  46322. args: [],
  46323. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46324. referencedClasses: [],
  46325. messageSends: []
  46326. }),
  46327. $globals.ASTInterpreter);
  46328. $core.addMethod(
  46329. $core.method({
  46330. selector: "node:",
  46331. protocol: "accessing",
  46332. fn: function (aNode){
  46333. var self=this,$self=this;
  46334. $self["@node"]=aNode;
  46335. return self;
  46336. },
  46337. args: ["aNode"],
  46338. source: "node: aNode\x0a\x09node := aNode",
  46339. referencedClasses: [],
  46340. messageSends: []
  46341. }),
  46342. $globals.ASTInterpreter);
  46343. $core.addMethod(
  46344. $core.method({
  46345. selector: "peek",
  46346. protocol: "stack",
  46347. fn: function (){
  46348. var self=this,$self=this;
  46349. return $core.withContext(function($ctx1) {
  46350. var $1;
  46351. var $early={};
  46352. try {
  46353. $1=$self._stack();
  46354. $ctx1.sendIdx["stack"]=1;
  46355. $recv($1)._ifEmpty_((function(){
  46356. throw $early=[nil];
  46357. }));
  46358. return $recv($self._stack())._last();
  46359. }
  46360. catch(e) {if(e===$early)return e[0]; throw e}
  46361. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46362. },
  46363. args: [],
  46364. 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",
  46365. referencedClasses: [],
  46366. messageSends: ["ifEmpty:", "stack", "last"]
  46367. }),
  46368. $globals.ASTInterpreter);
  46369. $core.addMethod(
  46370. $core.method({
  46371. selector: "pop",
  46372. protocol: "stack",
  46373. fn: function (){
  46374. var self=this,$self=this;
  46375. var peekedValue;
  46376. return $core.withContext(function($ctx1) {
  46377. peekedValue=$self._peek();
  46378. $recv($self._stack())._removeLast();
  46379. return peekedValue;
  46380. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46381. },
  46382. args: [],
  46383. 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",
  46384. referencedClasses: [],
  46385. messageSends: ["peek", "removeLast", "stack"]
  46386. }),
  46387. $globals.ASTInterpreter);
  46388. $core.addMethod(
  46389. $core.method({
  46390. selector: "proceed",
  46391. protocol: "interpreting",
  46392. fn: function (){
  46393. var self=this,$self=this;
  46394. return $core.withContext(function($ctx1) {
  46395. $recv((function(){
  46396. return $core.withContext(function($ctx2) {
  46397. return $self._atEnd();
  46398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46399. }))._whileFalse_((function(){
  46400. return $core.withContext(function($ctx2) {
  46401. return $self._step();
  46402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46403. }));
  46404. return self;
  46405. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46406. },
  46407. args: [],
  46408. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46409. referencedClasses: [],
  46410. messageSends: ["whileFalse:", "atEnd", "step"]
  46411. }),
  46412. $globals.ASTInterpreter);
  46413. $core.addMethod(
  46414. $core.method({
  46415. selector: "push:",
  46416. protocol: "stack",
  46417. fn: function (anObject){
  46418. var self=this,$self=this;
  46419. return $core.withContext(function($ctx1) {
  46420. return $recv($self._stack())._add_(anObject);
  46421. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46422. },
  46423. args: ["anObject"],
  46424. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46425. referencedClasses: [],
  46426. messageSends: ["add:", "stack"]
  46427. }),
  46428. $globals.ASTInterpreter);
  46429. $core.addMethod(
  46430. $core.method({
  46431. selector: "restart",
  46432. protocol: "interpreting",
  46433. fn: function (){
  46434. var self=this,$self=this;
  46435. return $core.withContext(function($ctx1) {
  46436. $self._node_($recv($self._context())._ast());
  46437. $self._enterNode();
  46438. return self;
  46439. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46440. },
  46441. args: [],
  46442. source: "restart\x0a\x09self node: self context ast; enterNode",
  46443. referencedClasses: [],
  46444. messageSends: ["node:", "ast", "context", "enterNode"]
  46445. }),
  46446. $globals.ASTInterpreter);
  46447. $core.addMethod(
  46448. $core.method({
  46449. selector: "result",
  46450. protocol: "accessing",
  46451. fn: function (){
  46452. var self=this,$self=this;
  46453. return $core.withContext(function($ctx1) {
  46454. var $1;
  46455. $1=$self._hasReturned();
  46456. if($core.assert($1)){
  46457. return $self._returnValue();
  46458. } else {
  46459. return $recv($self._context())._receiver();
  46460. }
  46461. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46462. },
  46463. args: [],
  46464. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46465. referencedClasses: [],
  46466. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46467. }),
  46468. $globals.ASTInterpreter);
  46469. $core.addMethod(
  46470. $core.method({
  46471. selector: "returnValue",
  46472. protocol: "accessing",
  46473. fn: function (){
  46474. var self=this,$self=this;
  46475. return $self["@returnValue"];
  46476. },
  46477. args: [],
  46478. source: "returnValue\x0a\x09^ returnValue",
  46479. referencedClasses: [],
  46480. messageSends: []
  46481. }),
  46482. $globals.ASTInterpreter);
  46483. $core.addMethod(
  46484. $core.method({
  46485. selector: "returnValue:",
  46486. protocol: "accessing",
  46487. fn: function (anObject){
  46488. var self=this,$self=this;
  46489. $self["@returnValue"]=anObject;
  46490. return self;
  46491. },
  46492. args: ["anObject"],
  46493. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46494. referencedClasses: [],
  46495. messageSends: []
  46496. }),
  46497. $globals.ASTInterpreter);
  46498. $core.addMethod(
  46499. $core.method({
  46500. selector: "sendMessage:to:superSend:",
  46501. protocol: "private",
  46502. fn: function (aMessage,anObject,aBoolean){
  46503. var self=this,$self=this;
  46504. var method;
  46505. return $core.withContext(function($ctx1) {
  46506. var $2,$1,$3,$receiver;
  46507. var $early={};
  46508. try {
  46509. if(!$core.assert(aBoolean)){
  46510. return $recv(aMessage)._sendTo_(anObject);
  46511. }
  46512. $2=$recv(anObject)._class();
  46513. $ctx1.sendIdx["class"]=1;
  46514. $1=$recv($2)._superclass();
  46515. $ctx1.sendIdx["superclass"]=1;
  46516. if(($receiver = $1) == null || $receiver.a$nil){
  46517. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46518. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46519. return $3;
  46520. } else {
  46521. $1;
  46522. }
  46523. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46524. return $core.withContext(function($ctx2) {
  46525. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46527. }));
  46528. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46529. }
  46530. catch(e) {if(e===$early)return e[0]; throw e}
  46531. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46532. },
  46533. args: ["aMessage", "anObject", "aBoolean"],
  46534. 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",
  46535. referencedClasses: [],
  46536. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46537. }),
  46538. $globals.ASTInterpreter);
  46539. $core.addMethod(
  46540. $core.method({
  46541. selector: "setNonLocalReturnFromContext:",
  46542. protocol: "interpreting",
  46543. fn: function (aContext){
  46544. var self=this,$self=this;
  46545. return $core.withContext(function($ctx1) {
  46546. var $2,$1;
  46547. $2=$recv(aContext)._interpreter();
  46548. $ctx1.sendIdx["interpreter"]=1;
  46549. $1=$recv($2)._hasReturned();
  46550. if($core.assert($1)){
  46551. $self["@returned"]=true;
  46552. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46553. }
  46554. return self;
  46555. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46556. },
  46557. args: ["aContext"],
  46558. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46559. referencedClasses: [],
  46560. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46561. }),
  46562. $globals.ASTInterpreter);
  46563. $core.addMethod(
  46564. $core.method({
  46565. selector: "skip",
  46566. protocol: "interpreting",
  46567. fn: function (){
  46568. var self=this,$self=this;
  46569. return $core.withContext(function($ctx1) {
  46570. $self._next();
  46571. return self;
  46572. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46573. },
  46574. args: [],
  46575. source: "skip\x0a\x09self next",
  46576. referencedClasses: [],
  46577. messageSends: ["next"]
  46578. }),
  46579. $globals.ASTInterpreter);
  46580. $core.addMethod(
  46581. $core.method({
  46582. selector: "stack",
  46583. protocol: "accessing",
  46584. fn: function (){
  46585. var self=this,$self=this;
  46586. return $core.withContext(function($ctx1) {
  46587. var $1,$receiver;
  46588. $1=$self["@stack"];
  46589. if(($receiver = $1) == null || $receiver.a$nil){
  46590. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46591. return $self["@stack"];
  46592. } else {
  46593. return $1;
  46594. }
  46595. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46596. },
  46597. args: [],
  46598. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46599. referencedClasses: ["OrderedCollection"],
  46600. messageSends: ["ifNil:", "new"]
  46601. }),
  46602. $globals.ASTInterpreter);
  46603. $core.addMethod(
  46604. $core.method({
  46605. selector: "step",
  46606. protocol: "interpreting",
  46607. fn: function (){
  46608. var self=this,$self=this;
  46609. return $core.withContext(function($ctx1) {
  46610. $self._interpret();
  46611. $self._next();
  46612. return self;
  46613. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46614. },
  46615. args: [],
  46616. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46617. referencedClasses: [],
  46618. messageSends: ["interpret", "next"]
  46619. }),
  46620. $globals.ASTInterpreter);
  46621. $core.addMethod(
  46622. $core.method({
  46623. selector: "stepOver",
  46624. protocol: "interpreting",
  46625. fn: function (){
  46626. var self=this,$self=this;
  46627. return $core.withContext(function($ctx1) {
  46628. var $2,$1;
  46629. $self._step();
  46630. $ctx1.sendIdx["step"]=1;
  46631. $recv((function(){
  46632. return $core.withContext(function($ctx2) {
  46633. $2=$self._node();
  46634. $ctx2.sendIdx["node"]=1;
  46635. $1=$recv($2)._isNil();
  46636. return $recv($1)._or_((function(){
  46637. return $core.withContext(function($ctx3) {
  46638. return $recv($self._node())._isSteppingNode();
  46639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46640. }));
  46641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46642. }))._whileFalse_((function(){
  46643. return $core.withContext(function($ctx2) {
  46644. return $self._step();
  46645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46646. }));
  46647. return self;
  46648. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46649. },
  46650. args: [],
  46651. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46652. referencedClasses: [],
  46653. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46654. }),
  46655. $globals.ASTInterpreter);
  46656. $core.addMethod(
  46657. $core.method({
  46658. selector: "visit:",
  46659. protocol: "visiting",
  46660. fn: function (aNode){
  46661. var self=this,$self=this;
  46662. return $core.withContext(function($ctx1) {
  46663. var $1;
  46664. $1=$self._hasReturned();
  46665. if(!$core.assert($1)){
  46666. (
  46667. $ctx1.supercall = true,
  46668. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46669. $ctx1.supercall = false;
  46670. }
  46671. return self;
  46672. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46673. },
  46674. args: ["aNode"],
  46675. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46676. referencedClasses: [],
  46677. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46678. }),
  46679. $globals.ASTInterpreter);
  46680. $core.addMethod(
  46681. $core.method({
  46682. selector: "visitAssignmentNode:",
  46683. protocol: "visiting",
  46684. fn: function (aNode){
  46685. var self=this,$self=this;
  46686. var poppedValue;
  46687. return $core.withContext(function($ctx1) {
  46688. poppedValue=$self._pop();
  46689. $ctx1.sendIdx["pop"]=1;
  46690. $self._pop();
  46691. $self._push_(poppedValue);
  46692. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46693. return self;
  46694. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46695. },
  46696. args: ["aNode"],
  46697. 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",
  46698. referencedClasses: [],
  46699. messageSends: ["pop", "push:", "assign:to:", "left"]
  46700. }),
  46701. $globals.ASTInterpreter);
  46702. $core.addMethod(
  46703. $core.method({
  46704. selector: "visitBlockNode:",
  46705. protocol: "visiting",
  46706. fn: function (aNode){
  46707. var self=this,$self=this;
  46708. var block;
  46709. return $core.withContext(function($ctx1) {
  46710. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46711. $self._push_(block);
  46712. return self;
  46713. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46714. },
  46715. args: ["aNode"],
  46716. 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",
  46717. referencedClasses: ["AIBlockClosure"],
  46718. messageSends: ["forContext:node:", "context", "push:"]
  46719. }),
  46720. $globals.ASTInterpreter);
  46721. $core.addMethod(
  46722. $core.method({
  46723. selector: "visitBlockSequenceNode:",
  46724. protocol: "visiting",
  46725. fn: function (aNode){
  46726. var self=this,$self=this;
  46727. return $core.withContext(function($ctx1) {
  46728. (
  46729. $ctx1.supercall = true,
  46730. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46731. $ctx1.supercall = false;
  46732. $self["@forceAtEnd"]=true;
  46733. return self;
  46734. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46735. },
  46736. args: ["aNode"],
  46737. 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",
  46738. referencedClasses: [],
  46739. messageSends: ["visitBlockSequenceNode:"]
  46740. }),
  46741. $globals.ASTInterpreter);
  46742. $core.addMethod(
  46743. $core.method({
  46744. selector: "visitDagNode:",
  46745. protocol: "visiting",
  46746. fn: function (aNode){
  46747. var self=this,$self=this;
  46748. return self;
  46749. },
  46750. args: ["aNode"],
  46751. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46752. referencedClasses: [],
  46753. messageSends: []
  46754. }),
  46755. $globals.ASTInterpreter);
  46756. $core.addMethod(
  46757. $core.method({
  46758. selector: "visitDynamicArrayNode:",
  46759. protocol: "visiting",
  46760. fn: function (aNode){
  46761. var self=this,$self=this;
  46762. var array;
  46763. return $core.withContext(function($ctx1) {
  46764. array=[];
  46765. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46766. return $core.withContext(function($ctx2) {
  46767. return $recv(array)._addFirst_($self._pop());
  46768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46769. }));
  46770. $self._push_(array);
  46771. return self;
  46772. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46773. },
  46774. args: ["aNode"],
  46775. 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",
  46776. referencedClasses: [],
  46777. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46778. }),
  46779. $globals.ASTInterpreter);
  46780. $core.addMethod(
  46781. $core.method({
  46782. selector: "visitDynamicDictionaryNode:",
  46783. protocol: "visiting",
  46784. fn: function (aNode){
  46785. var self=this,$self=this;
  46786. var keyValueList;
  46787. return $core.withContext(function($ctx1) {
  46788. keyValueList=$recv($globals.OrderedCollection)._new();
  46789. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46790. return $core.withContext(function($ctx2) {
  46791. return $recv(keyValueList)._add_($self._pop());
  46792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46793. }));
  46794. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46795. return self;
  46796. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46797. },
  46798. args: ["aNode"],
  46799. 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)",
  46800. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46801. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46802. }),
  46803. $globals.ASTInterpreter);
  46804. $core.addMethod(
  46805. $core.method({
  46806. selector: "visitJSStatementNode:",
  46807. protocol: "visiting",
  46808. fn: function (aNode){
  46809. var self=this,$self=this;
  46810. return $core.withContext(function($ctx1) {
  46811. $self["@returned"]=true;
  46812. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46813. return self;
  46814. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46815. },
  46816. args: ["aNode"],
  46817. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46818. referencedClasses: [],
  46819. messageSends: ["returnValue:", "eval:", "source"]
  46820. }),
  46821. $globals.ASTInterpreter);
  46822. $core.addMethod(
  46823. $core.method({
  46824. selector: "visitReturnNode:",
  46825. protocol: "visiting",
  46826. fn: function (aNode){
  46827. var self=this,$self=this;
  46828. return $core.withContext(function($ctx1) {
  46829. $self["@returned"]=true;
  46830. $self._returnValue_($self._pop());
  46831. return self;
  46832. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46833. },
  46834. args: ["aNode"],
  46835. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46836. referencedClasses: [],
  46837. messageSends: ["returnValue:", "pop"]
  46838. }),
  46839. $globals.ASTInterpreter);
  46840. $core.addMethod(
  46841. $core.method({
  46842. selector: "visitSendNode:",
  46843. protocol: "visiting",
  46844. fn: function (aNode){
  46845. var self=this,$self=this;
  46846. var receiver,args,message,result;
  46847. return $core.withContext(function($ctx1) {
  46848. var $1;
  46849. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46850. return $core.withContext(function($ctx2) {
  46851. return $self._pop();
  46852. $ctx2.sendIdx["pop"]=1;
  46853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46854. }));
  46855. receiver=$self._peek();
  46856. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46857. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46858. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46859. return $core.withContext(function($ctx2) {
  46860. return $recv($recv(aNode)._isLastChild())._not();
  46861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46862. }));
  46863. if(!$core.assert($1)){
  46864. $self._pop();
  46865. $self._push_(result);
  46866. }
  46867. return self;
  46868. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46869. },
  46870. args: ["aNode"],
  46871. 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 ]",
  46872. referencedClasses: [],
  46873. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46874. }),
  46875. $globals.ASTInterpreter);
  46876. $core.addMethod(
  46877. $core.method({
  46878. selector: "visitValueNode:",
  46879. protocol: "visiting",
  46880. fn: function (aNode){
  46881. var self=this,$self=this;
  46882. return $core.withContext(function($ctx1) {
  46883. $self._push_($recv(aNode)._value());
  46884. return self;
  46885. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46886. },
  46887. args: ["aNode"],
  46888. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46889. referencedClasses: [],
  46890. messageSends: ["push:", "value"]
  46891. }),
  46892. $globals.ASTInterpreter);
  46893. $core.addMethod(
  46894. $core.method({
  46895. selector: "visitVariableNode:",
  46896. protocol: "visiting",
  46897. fn: function (aNode){
  46898. var self=this,$self=this;
  46899. return $core.withContext(function($ctx1) {
  46900. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46901. $2=$recv(aNode)._binding();
  46902. $ctx1.sendIdx["binding"]=1;
  46903. $1=$recv($2)._isUnknownVar();
  46904. if($core.assert($1)){
  46905. $5=$recv($globals.Platform)._globals();
  46906. $ctx1.sendIdx["globals"]=1;
  46907. $6=$recv(aNode)._value();
  46908. $ctx1.sendIdx["value"]=1;
  46909. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46910. return $core.withContext(function($ctx2) {
  46911. return $self._error_("Unknown variable");
  46912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46913. }));
  46914. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46915. $3=$self._push_($4);
  46916. $ctx1.sendIdx["push:"]=1;
  46917. return $3;
  46918. }
  46919. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46920. if($core.assert($8)){
  46921. $10=$self._context();
  46922. $ctx1.sendIdx["context"]=1;
  46923. $9=$recv($10)._receiver();
  46924. $11=$recv(aNode)._value();
  46925. $ctx1.sendIdx["value"]=2;
  46926. $7=$recv($9)._instVarAt_($11);
  46927. } else {
  46928. $12=$self._context();
  46929. $13=$recv(aNode)._value();
  46930. $ctx1.sendIdx["value"]=3;
  46931. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46932. return $core.withContext(function($ctx2) {
  46933. $15=$recv(aNode)._value();
  46934. $ctx2.sendIdx["value"]=4;
  46935. $14=$recv($15)._isCapitalized();
  46936. if($core.assert($14)){
  46937. $16=$recv($globals.Smalltalk)._globals();
  46938. $ctx2.sendIdx["globals"]=2;
  46939. $17=$recv(aNode)._value();
  46940. $ctx2.sendIdx["value"]=5;
  46941. return $recv($16)._at_ifAbsent_($17,(function(){
  46942. return $core.withContext(function($ctx3) {
  46943. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46944. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46945. }));
  46946. }
  46947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46948. }));
  46949. }
  46950. $self._push_($7);
  46951. return self;
  46952. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46953. },
  46954. args: ["aNode"],
  46955. 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 ] ] ] ])",
  46956. referencedClasses: ["Platform", "Smalltalk"],
  46957. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46958. }),
  46959. $globals.ASTInterpreter);
  46960. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46961. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46962. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46963. $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`";
  46964. $core.addMethod(
  46965. $core.method({
  46966. selector: "currentNode",
  46967. protocol: "accessing",
  46968. fn: function (){
  46969. var self=this,$self=this;
  46970. return $self["@currentNode"];
  46971. },
  46972. args: [],
  46973. source: "currentNode\x0a\x09^ currentNode",
  46974. referencedClasses: [],
  46975. messageSends: []
  46976. }),
  46977. $globals.ASTPCNodeVisitor);
  46978. $core.addMethod(
  46979. $core.method({
  46980. selector: "increaseTrackedIndex",
  46981. protocol: "accessing",
  46982. fn: function (){
  46983. var self=this,$self=this;
  46984. return $core.withContext(function($ctx1) {
  46985. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46986. return self;
  46987. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46988. },
  46989. args: [],
  46990. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46991. referencedClasses: [],
  46992. messageSends: ["+", "trackedIndex"]
  46993. }),
  46994. $globals.ASTPCNodeVisitor);
  46995. $core.addMethod(
  46996. $core.method({
  46997. selector: "index",
  46998. protocol: "accessing",
  46999. fn: function (){
  47000. var self=this,$self=this;
  47001. return $self["@index"];
  47002. },
  47003. args: [],
  47004. source: "index\x0a\x09^ index",
  47005. referencedClasses: [],
  47006. messageSends: []
  47007. }),
  47008. $globals.ASTPCNodeVisitor);
  47009. $core.addMethod(
  47010. $core.method({
  47011. selector: "index:",
  47012. protocol: "accessing",
  47013. fn: function (aNumber){
  47014. var self=this,$self=this;
  47015. $self["@index"]=aNumber;
  47016. return self;
  47017. },
  47018. args: ["aNumber"],
  47019. source: "index: aNumber\x0a\x09index := aNumber",
  47020. referencedClasses: [],
  47021. messageSends: []
  47022. }),
  47023. $globals.ASTPCNodeVisitor);
  47024. $core.addMethod(
  47025. $core.method({
  47026. selector: "selector",
  47027. protocol: "accessing",
  47028. fn: function (){
  47029. var self=this,$self=this;
  47030. return $self["@selector"];
  47031. },
  47032. args: [],
  47033. source: "selector\x0a\x09^ selector",
  47034. referencedClasses: [],
  47035. messageSends: []
  47036. }),
  47037. $globals.ASTPCNodeVisitor);
  47038. $core.addMethod(
  47039. $core.method({
  47040. selector: "selector:",
  47041. protocol: "accessing",
  47042. fn: function (aString){
  47043. var self=this,$self=this;
  47044. $self["@selector"]=aString;
  47045. return self;
  47046. },
  47047. args: ["aString"],
  47048. source: "selector: aString\x0a\x09selector := aString",
  47049. referencedClasses: [],
  47050. messageSends: []
  47051. }),
  47052. $globals.ASTPCNodeVisitor);
  47053. $core.addMethod(
  47054. $core.method({
  47055. selector: "trackedIndex",
  47056. protocol: "accessing",
  47057. fn: function (){
  47058. var self=this,$self=this;
  47059. return $core.withContext(function($ctx1) {
  47060. var $1,$receiver;
  47061. $1=$self["@trackedIndex"];
  47062. if(($receiver = $1) == null || $receiver.a$nil){
  47063. $self["@trackedIndex"]=(0);
  47064. return $self["@trackedIndex"];
  47065. } else {
  47066. return $1;
  47067. }
  47068. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  47069. },
  47070. args: [],
  47071. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  47072. referencedClasses: [],
  47073. messageSends: ["ifNil:"]
  47074. }),
  47075. $globals.ASTPCNodeVisitor);
  47076. $core.addMethod(
  47077. $core.method({
  47078. selector: "visitJSStatementNode:",
  47079. protocol: "visiting",
  47080. fn: function (aNode){
  47081. var self=this,$self=this;
  47082. $self["@currentNode"]=aNode;
  47083. return self;
  47084. },
  47085. args: ["aNode"],
  47086. 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",
  47087. referencedClasses: [],
  47088. messageSends: []
  47089. }),
  47090. $globals.ASTPCNodeVisitor);
  47091. $core.addMethod(
  47092. $core.method({
  47093. selector: "visitSendNode:",
  47094. protocol: "visiting",
  47095. fn: function (aNode){
  47096. var self=this,$self=this;
  47097. return $core.withContext(function($ctx1) {
  47098. var $2,$1,$3;
  47099. (
  47100. $ctx1.supercall = true,
  47101. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  47102. $ctx1.supercall = false;
  47103. $2=$self._selector();
  47104. $ctx1.sendIdx["selector"]=1;
  47105. $1=$recv($2).__eq($recv(aNode)._selector());
  47106. $ctx1.sendIdx["="]=1;
  47107. if($core.assert($1)){
  47108. $3=$recv($self._trackedIndex()).__eq($self._index());
  47109. if($core.assert($3)){
  47110. $self["@currentNode"]=aNode;
  47111. $self["@currentNode"];
  47112. }
  47113. $self._increaseTrackedIndex();
  47114. }
  47115. return self;
  47116. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  47117. },
  47118. args: ["aNode"],
  47119. 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 ]",
  47120. referencedClasses: [],
  47121. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  47122. }),
  47123. $globals.ASTPCNodeVisitor);
  47124. $core.addMethod(
  47125. $core.method({
  47126. selector: "isLastChild",
  47127. protocol: "*Compiler-Interpreter",
  47128. fn: function (){
  47129. var self=this,$self=this;
  47130. return $core.withContext(function($ctx1) {
  47131. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  47132. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  47133. },
  47134. args: [],
  47135. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  47136. referencedClasses: [],
  47137. messageSends: ["=", "last", "dagChildren", "parent"]
  47138. }),
  47139. $globals.ASTNode);
  47140. $core.addMethod(
  47141. $core.method({
  47142. selector: "isSteppingNode",
  47143. protocol: "*Compiler-Interpreter",
  47144. fn: function (){
  47145. var self=this,$self=this;
  47146. return false;
  47147. },
  47148. args: [],
  47149. source: "isSteppingNode\x0a\x09^ false",
  47150. referencedClasses: [],
  47151. messageSends: []
  47152. }),
  47153. $globals.ASTNode);
  47154. $core.addMethod(
  47155. $core.method({
  47156. selector: "nextSiblingNode:",
  47157. protocol: "*Compiler-Interpreter",
  47158. fn: function (aNode){
  47159. var self=this,$self=this;
  47160. return $core.withContext(function($ctx1) {
  47161. var $1;
  47162. var $early={};
  47163. try {
  47164. $1=$self._dagChildren();
  47165. $ctx1.sendIdx["dagChildren"]=1;
  47166. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  47167. throw $early=[nil];
  47168. }));
  47169. }
  47170. catch(e) {if(e===$early)return e[0]; throw e}
  47171. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  47172. },
  47173. args: ["aNode"],
  47174. 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 ]",
  47175. referencedClasses: [],
  47176. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  47177. }),
  47178. $globals.ASTNode);
  47179. $core.addMethod(
  47180. $core.method({
  47181. selector: "isSteppingNode",
  47182. protocol: "*Compiler-Interpreter",
  47183. fn: function (){
  47184. var self=this,$self=this;
  47185. return true;
  47186. },
  47187. args: [],
  47188. source: "isSteppingNode\x0a\x09^ true",
  47189. referencedClasses: [],
  47190. messageSends: []
  47191. }),
  47192. $globals.AssignmentNode);
  47193. $core.addMethod(
  47194. $core.method({
  47195. selector: "isSteppingNode",
  47196. protocol: "*Compiler-Interpreter",
  47197. fn: function (){
  47198. var self=this,$self=this;
  47199. return true;
  47200. },
  47201. args: [],
  47202. source: "isSteppingNode\x0a\x09^ true",
  47203. referencedClasses: [],
  47204. messageSends: []
  47205. }),
  47206. $globals.BlockNode);
  47207. $core.addMethod(
  47208. $core.method({
  47209. selector: "nextSiblingNode:",
  47210. protocol: "*Compiler-Interpreter",
  47211. fn: function (aNode){
  47212. var self=this,$self=this;
  47213. return nil;
  47214. },
  47215. args: ["aNode"],
  47216. 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",
  47217. referencedClasses: [],
  47218. messageSends: []
  47219. }),
  47220. $globals.BlockNode);
  47221. $core.addMethod(
  47222. $core.method({
  47223. selector: "isSteppingNode",
  47224. protocol: "*Compiler-Interpreter",
  47225. fn: function (){
  47226. var self=this,$self=this;
  47227. return true;
  47228. },
  47229. args: [],
  47230. source: "isSteppingNode\x0a\x09^ true",
  47231. referencedClasses: [],
  47232. messageSends: []
  47233. }),
  47234. $globals.DynamicArrayNode);
  47235. $core.addMethod(
  47236. $core.method({
  47237. selector: "isSteppingNode",
  47238. protocol: "*Compiler-Interpreter",
  47239. fn: function (){
  47240. var self=this,$self=this;
  47241. return true;
  47242. },
  47243. args: [],
  47244. source: "isSteppingNode\x0a\x09^ true",
  47245. referencedClasses: [],
  47246. messageSends: []
  47247. }),
  47248. $globals.DynamicDictionaryNode);
  47249. $core.addMethod(
  47250. $core.method({
  47251. selector: "isSteppingNode",
  47252. protocol: "*Compiler-Interpreter",
  47253. fn: function (){
  47254. var self=this,$self=this;
  47255. return true;
  47256. },
  47257. args: [],
  47258. source: "isSteppingNode\x0a\x09^ true",
  47259. referencedClasses: [],
  47260. messageSends: []
  47261. }),
  47262. $globals.JSStatementNode);
  47263. $core.addMethod(
  47264. $core.method({
  47265. selector: "isCascadeSendNode",
  47266. protocol: "*Compiler-Interpreter",
  47267. fn: function (){
  47268. var self=this,$self=this;
  47269. return $core.withContext(function($ctx1) {
  47270. return $recv($self._parent())._isCascadeNode();
  47271. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47272. },
  47273. args: [],
  47274. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47275. referencedClasses: [],
  47276. messageSends: ["isCascadeNode", "parent"]
  47277. }),
  47278. $globals.SendNode);
  47279. $core.addMethod(
  47280. $core.method({
  47281. selector: "isSteppingNode",
  47282. protocol: "*Compiler-Interpreter",
  47283. fn: function (){
  47284. var self=this,$self=this;
  47285. return true;
  47286. },
  47287. args: [],
  47288. source: "isSteppingNode\x0a\x09^ true",
  47289. referencedClasses: [],
  47290. messageSends: []
  47291. }),
  47292. $globals.SendNode);
  47293. });
  47294. define('amber/lang',[
  47295. './deploy',
  47296. './boot', // pre-fetch, dep of ./helpers
  47297. './helpers', // pre-fetch, dep of ./deploy
  47298. './parser',
  47299. // --- packages for the Amber reflection begin here ---
  47300. 'amber_core/Platform-ImportExport',
  47301. 'amber_core/Compiler-Core',
  47302. 'amber_core/Compiler-AST',
  47303. 'amber_core/Compiler-Semantic',
  47304. 'amber_core/Compiler-IR',
  47305. 'amber_core/Compiler-Inlining',
  47306. 'amber_core/Compiler-Interpreter'
  47307. // --- packages for the Amber reflection end here ---
  47308. ], function (amber) {
  47309. return amber;
  47310. });
  47311. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47312. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47313. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47314. $core.addPackage("Platform-DOM");
  47315. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  47316. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47317. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47318. $core.addMethod(
  47319. $core.method({
  47320. selector: "isDomNode:",
  47321. protocol: "testing",
  47322. fn: function (anObject){
  47323. var self=this,$self=this;
  47324. return $core.withContext(function($ctx1) {
  47325. return anObject.nodeType > 0 &&
  47326. Object.prototype.toString.call(anObject) !== "[object Object]";
  47327. return self;
  47328. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47329. },
  47330. args: ["anObject"],
  47331. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47332. referencedClasses: [],
  47333. messageSends: []
  47334. }),
  47335. $globals.PlatformDom.a$cls);
  47336. $core.addMethod(
  47337. $core.method({
  47338. selector: "isFeasible",
  47339. protocol: "testing",
  47340. fn: function (){
  47341. var self=this,$self=this;
  47342. return $core.withContext(function($ctx1) {
  47343. if (typeof document === "undefined") return false;
  47344. try {
  47345. var d = document.createElement("div"),
  47346. f = document.createDocumentFragment(),
  47347. t = document.createTextNode("Hello, Amber!");
  47348. f.appendChild(t);
  47349. d.insertBefore(f, null);
  47350. return d.innerHTML === "Hello, Amber!";
  47351. } catch (e) {
  47352. return false;
  47353. };
  47354. return self;
  47355. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47356. },
  47357. args: [],
  47358. 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'>",
  47359. referencedClasses: [],
  47360. messageSends: []
  47361. }),
  47362. $globals.PlatformDom.a$cls);
  47363. $core.addMethod(
  47364. $core.method({
  47365. selector: "newCustomEvent:detail:",
  47366. protocol: "creation",
  47367. fn: function (aString,anObject){
  47368. var self=this,$self=this;
  47369. return $core.withContext(function($ctx1) {
  47370. return new CustomEvent(aString, {detail: anObject});
  47371. return self;
  47372. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47373. },
  47374. args: ["aString", "anObject"],
  47375. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47376. referencedClasses: [],
  47377. messageSends: []
  47378. }),
  47379. $globals.PlatformDom.a$cls);
  47380. $core.addMethod(
  47381. $core.method({
  47382. selector: "toArray:",
  47383. protocol: "converting",
  47384. fn: function (aDomList){
  47385. var self=this,$self=this;
  47386. return $core.withContext(function($ctx1) {
  47387. return Array.prototype.slice.call(aDomList);
  47388. return self;
  47389. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47390. },
  47391. args: ["aDomList"],
  47392. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47393. referencedClasses: [],
  47394. messageSends: []
  47395. }),
  47396. $globals.PlatformDom.a$cls);
  47397. $core.addMethod(
  47398. $core.method({
  47399. selector: "asDomNode",
  47400. protocol: "*Platform-DOM",
  47401. fn: function (){
  47402. var self=this,$self=this;
  47403. return $core.withContext(function($ctx1) {
  47404. return $recv(document)._createTextNode_($self._asString());
  47405. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  47406. },
  47407. args: [],
  47408. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47409. referencedClasses: [],
  47410. messageSends: ["createTextNode:", "asString"]
  47411. }),
  47412. $globals.CharacterArray);
  47413. $core.addMethod(
  47414. $core.method({
  47415. selector: "asDomNode",
  47416. protocol: "*Platform-DOM",
  47417. fn: function (){
  47418. var self=this,$self=this;
  47419. var fragment;
  47420. return $core.withContext(function($ctx1) {
  47421. fragment=$recv(document)._createDocumentFragment();
  47422. $self._do_((function(each){
  47423. return $core.withContext(function($ctx2) {
  47424. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47426. }));
  47427. return fragment;
  47428. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47429. },
  47430. args: [],
  47431. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47432. referencedClasses: [],
  47433. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47434. }),
  47435. $globals.Collection);
  47436. $core.addMethod(
  47437. $core.method({
  47438. selector: "asDomNode",
  47439. protocol: "*Platform-DOM",
  47440. fn: function (){
  47441. var self=this,$self=this;
  47442. return $core.withContext(function($ctx1) {
  47443. var $1,$2;
  47444. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47445. if($core.assert($1)){
  47446. return $self["@jsObject"];
  47447. } else {
  47448. $2=(
  47449. $ctx1.supercall = true,
  47450. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47451. $ctx1.supercall = false;
  47452. return $2;
  47453. }
  47454. return self;
  47455. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47456. },
  47457. args: [],
  47458. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47459. referencedClasses: ["PlatformDom"],
  47460. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47461. }),
  47462. $globals.JSObjectProxy);
  47463. $core.addMethod(
  47464. $core.method({
  47465. selector: "htmlTextContent",
  47466. protocol: "*Platform-DOM",
  47467. fn: function (){
  47468. var self=this,$self=this;
  47469. return $core.withContext(function($ctx1) {
  47470. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47471. return self;
  47472. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47473. },
  47474. args: [],
  47475. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47476. referencedClasses: [],
  47477. messageSends: []
  47478. }),
  47479. $globals.String);
  47480. });
  47481. 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";
  47482. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47483. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47484. $core.addPackage("SUnit");
  47485. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  47486. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47487. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47488. $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.";
  47489. $core.addMethod(
  47490. $core.method({
  47491. selector: "result",
  47492. protocol: "accessing",
  47493. fn: function (){
  47494. var self=this,$self=this;
  47495. return $self["@result"];
  47496. },
  47497. args: [],
  47498. source: "result\x0a\x09^ result",
  47499. referencedClasses: [],
  47500. messageSends: []
  47501. }),
  47502. $globals.ResultAnnouncement);
  47503. $core.addMethod(
  47504. $core.method({
  47505. selector: "result:",
  47506. protocol: "accessing",
  47507. fn: function (aTestResult){
  47508. var self=this,$self=this;
  47509. $self["@result"]=aTestResult;
  47510. return self;
  47511. },
  47512. args: ["aTestResult"],
  47513. source: "result: aTestResult\x0a\x09result := aTestResult",
  47514. referencedClasses: [],
  47515. messageSends: []
  47516. }),
  47517. $globals.ResultAnnouncement);
  47518. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47519. $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.";
  47520. $core.addMethod(
  47521. $core.method({
  47522. selector: "assert:",
  47523. protocol: "testing",
  47524. fn: function (aBoolean){
  47525. var self=this,$self=this;
  47526. return $core.withContext(function($ctx1) {
  47527. $self._assert_description_(aBoolean,"Assertion failed");
  47528. return self;
  47529. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47530. },
  47531. args: ["aBoolean"],
  47532. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47533. referencedClasses: [],
  47534. messageSends: ["assert:description:"]
  47535. }),
  47536. $globals.TestCase);
  47537. $core.addMethod(
  47538. $core.method({
  47539. selector: "assert:description:",
  47540. protocol: "testing",
  47541. fn: function (aBoolean,aString){
  47542. var self=this,$self=this;
  47543. return $core.withContext(function($ctx1) {
  47544. if(!$core.assert(aBoolean)){
  47545. $self._signalFailure_(aString);
  47546. }
  47547. return self;
  47548. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47549. },
  47550. args: ["aBoolean", "aString"],
  47551. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47552. referencedClasses: [],
  47553. messageSends: ["ifFalse:", "signalFailure:"]
  47554. }),
  47555. $globals.TestCase);
  47556. $core.addMethod(
  47557. $core.method({
  47558. selector: "assert:equals:",
  47559. protocol: "testing",
  47560. fn: function (actual,expected){
  47561. var self=this,$self=this;
  47562. return $core.withContext(function($ctx1) {
  47563. var $1,$5,$4,$3,$2;
  47564. $1=$recv(actual).__eq(expected);
  47565. $5=$recv(expected)._printString();
  47566. $ctx1.sendIdx["printString"]=1;
  47567. $4="Expected: ".__comma($5);
  47568. $3=$recv($4).__comma(" but was: ");
  47569. $ctx1.sendIdx[","]=2;
  47570. $2=$recv($3).__comma($recv(actual)._printString());
  47571. $ctx1.sendIdx[","]=1;
  47572. return $self._assert_description_($1,$2);
  47573. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47574. },
  47575. args: ["actual", "expected"],
  47576. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47577. referencedClasses: [],
  47578. messageSends: ["assert:description:", "=", ",", "printString"]
  47579. }),
  47580. $globals.TestCase);
  47581. $core.addMethod(
  47582. $core.method({
  47583. selector: "async:",
  47584. protocol: "async",
  47585. fn: function (aBlock){
  47586. var self=this,$self=this;
  47587. var c;
  47588. return $core.withContext(function($ctx1) {
  47589. var $1;
  47590. $self._errorIfNotAsync_("#async");
  47591. c=$self["@context"];
  47592. return (function(){
  47593. return $core.withContext(function($ctx2) {
  47594. $1=$self._isAsync();
  47595. if($core.assert($1)){
  47596. return $recv(c)._execute_(aBlock);
  47597. }
  47598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47599. });
  47600. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47601. },
  47602. args: ["aBlock"],
  47603. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47604. referencedClasses: [],
  47605. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47606. }),
  47607. $globals.TestCase);
  47608. $core.addMethod(
  47609. $core.method({
  47610. selector: "context:",
  47611. protocol: "accessing",
  47612. fn: function (aRunningTestContext){
  47613. var self=this,$self=this;
  47614. $self["@context"]=aRunningTestContext;
  47615. return self;
  47616. },
  47617. args: ["aRunningTestContext"],
  47618. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47619. referencedClasses: [],
  47620. messageSends: []
  47621. }),
  47622. $globals.TestCase);
  47623. $core.addMethod(
  47624. $core.method({
  47625. selector: "deny:",
  47626. protocol: "testing",
  47627. fn: function (aBoolean){
  47628. var self=this,$self=this;
  47629. return $core.withContext(function($ctx1) {
  47630. $self._assert_($recv(aBoolean)._not());
  47631. return self;
  47632. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47633. },
  47634. args: ["aBoolean"],
  47635. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47636. referencedClasses: [],
  47637. messageSends: ["assert:", "not"]
  47638. }),
  47639. $globals.TestCase);
  47640. $core.addMethod(
  47641. $core.method({
  47642. selector: "errorIfNotAsync:",
  47643. protocol: "error handling",
  47644. fn: function (aString){
  47645. var self=this,$self=this;
  47646. return $core.withContext(function($ctx1) {
  47647. var $1;
  47648. $1=$self._isAsync();
  47649. if(!$core.assert($1)){
  47650. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47651. }
  47652. return self;
  47653. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47654. },
  47655. args: ["aString"],
  47656. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47657. referencedClasses: [],
  47658. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47659. }),
  47660. $globals.TestCase);
  47661. $core.addMethod(
  47662. $core.method({
  47663. selector: "finished",
  47664. protocol: "async",
  47665. fn: function (){
  47666. var self=this,$self=this;
  47667. return $core.withContext(function($ctx1) {
  47668. $self._errorIfNotAsync_("#finished");
  47669. $self["@asyncTimeout"]=nil;
  47670. return self;
  47671. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47672. },
  47673. args: [],
  47674. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47675. referencedClasses: [],
  47676. messageSends: ["errorIfNotAsync:"]
  47677. }),
  47678. $globals.TestCase);
  47679. $core.addMethod(
  47680. $core.method({
  47681. selector: "isAsync",
  47682. protocol: "testing",
  47683. fn: function (){
  47684. var self=this,$self=this;
  47685. return $core.withContext(function($ctx1) {
  47686. return $recv($self["@asyncTimeout"])._notNil();
  47687. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47688. },
  47689. args: [],
  47690. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47691. referencedClasses: [],
  47692. messageSends: ["notNil"]
  47693. }),
  47694. $globals.TestCase);
  47695. $core.addMethod(
  47696. $core.method({
  47697. selector: "performTest",
  47698. protocol: "running",
  47699. fn: function (){
  47700. var self=this,$self=this;
  47701. return $core.withContext(function($ctx1) {
  47702. $self["@asyncTimeout"]=nil;
  47703. $self._perform_($self._selector());
  47704. return self;
  47705. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47706. },
  47707. args: [],
  47708. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47709. referencedClasses: [],
  47710. messageSends: ["perform:", "selector"]
  47711. }),
  47712. $globals.TestCase);
  47713. $core.addMethod(
  47714. $core.method({
  47715. selector: "runCase",
  47716. protocol: "running",
  47717. fn: function (){
  47718. var self=this,$self=this;
  47719. return $core.withContext(function($ctx1) {
  47720. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47721. return self;
  47722. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47723. },
  47724. args: [],
  47725. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47726. referencedClasses: ["TestContext"],
  47727. messageSends: ["start", "testCase:"]
  47728. }),
  47729. $globals.TestCase);
  47730. $core.addMethod(
  47731. $core.method({
  47732. selector: "selector",
  47733. protocol: "accessing",
  47734. fn: function (){
  47735. var self=this,$self=this;
  47736. return $self["@testSelector"];
  47737. },
  47738. args: [],
  47739. source: "selector\x0a\x09^ testSelector",
  47740. referencedClasses: [],
  47741. messageSends: []
  47742. }),
  47743. $globals.TestCase);
  47744. $core.addMethod(
  47745. $core.method({
  47746. selector: "setTestSelector:",
  47747. protocol: "accessing",
  47748. fn: function (aSelector){
  47749. var self=this,$self=this;
  47750. $self["@testSelector"]=aSelector;
  47751. return self;
  47752. },
  47753. args: ["aSelector"],
  47754. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47755. referencedClasses: [],
  47756. messageSends: []
  47757. }),
  47758. $globals.TestCase);
  47759. $core.addMethod(
  47760. $core.method({
  47761. selector: "setUp",
  47762. protocol: "running",
  47763. fn: function (){
  47764. var self=this,$self=this;
  47765. return self;
  47766. },
  47767. args: [],
  47768. source: "setUp",
  47769. referencedClasses: [],
  47770. messageSends: []
  47771. }),
  47772. $globals.TestCase);
  47773. $core.addMethod(
  47774. $core.method({
  47775. selector: "should:",
  47776. protocol: "testing",
  47777. fn: function (aBlock){
  47778. var self=this,$self=this;
  47779. return $core.withContext(function($ctx1) {
  47780. $self._assert_($recv(aBlock)._value());
  47781. return self;
  47782. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47783. },
  47784. args: ["aBlock"],
  47785. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47786. referencedClasses: [],
  47787. messageSends: ["assert:", "value"]
  47788. }),
  47789. $globals.TestCase);
  47790. $core.addMethod(
  47791. $core.method({
  47792. selector: "should:raise:",
  47793. protocol: "testing",
  47794. fn: function (aBlock,anExceptionClass){
  47795. var self=this,$self=this;
  47796. return $core.withContext(function($ctx1) {
  47797. $self._assert_($recv((function(){
  47798. return $core.withContext(function($ctx2) {
  47799. $recv(aBlock)._value();
  47800. return false;
  47801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47802. }))._on_do_(anExceptionClass,(function(ex){
  47803. return true;
  47804. })));
  47805. return self;
  47806. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47807. },
  47808. args: ["aBlock", "anExceptionClass"],
  47809. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47810. referencedClasses: [],
  47811. messageSends: ["assert:", "on:do:", "value"]
  47812. }),
  47813. $globals.TestCase);
  47814. $core.addMethod(
  47815. $core.method({
  47816. selector: "shouldnt:raise:",
  47817. protocol: "testing",
  47818. fn: function (aBlock,anExceptionClass){
  47819. var self=this,$self=this;
  47820. return $core.withContext(function($ctx1) {
  47821. $self._assert_($recv((function(){
  47822. return $core.withContext(function($ctx2) {
  47823. $recv(aBlock)._value();
  47824. return true;
  47825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47826. }))._on_do_(anExceptionClass,(function(ex){
  47827. return false;
  47828. })));
  47829. return self;
  47830. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47831. },
  47832. args: ["aBlock", "anExceptionClass"],
  47833. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47834. referencedClasses: [],
  47835. messageSends: ["assert:", "on:do:", "value"]
  47836. }),
  47837. $globals.TestCase);
  47838. $core.addMethod(
  47839. $core.method({
  47840. selector: "signalFailure:",
  47841. protocol: "private",
  47842. fn: function (aString){
  47843. var self=this,$self=this;
  47844. return $core.withContext(function($ctx1) {
  47845. var $1;
  47846. $1=$recv($globals.TestFailure)._new();
  47847. $recv($1)._messageText_(aString);
  47848. $recv($1)._signal();
  47849. return self;
  47850. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47851. },
  47852. args: ["aString"],
  47853. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47854. referencedClasses: ["TestFailure"],
  47855. messageSends: ["messageText:", "new", "signal"]
  47856. }),
  47857. $globals.TestCase);
  47858. $core.addMethod(
  47859. $core.method({
  47860. selector: "tearDown",
  47861. protocol: "running",
  47862. fn: function (){
  47863. var self=this,$self=this;
  47864. return self;
  47865. },
  47866. args: [],
  47867. source: "tearDown",
  47868. referencedClasses: [],
  47869. messageSends: []
  47870. }),
  47871. $globals.TestCase);
  47872. $core.addMethod(
  47873. $core.method({
  47874. selector: "timeout:",
  47875. protocol: "async",
  47876. fn: function (aNumber){
  47877. var self=this,$self=this;
  47878. return $core.withContext(function($ctx1) {
  47879. var $1,$receiver;
  47880. $1=$self["@asyncTimeout"];
  47881. if(($receiver = $1) == null || $receiver.a$nil){
  47882. $1;
  47883. } else {
  47884. $recv($self["@asyncTimeout"])._clearTimeout();
  47885. }
  47886. $self["@asyncTimeout"]=(0);
  47887. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47888. return $core.withContext(function($ctx2) {
  47889. return $self._assert_description_(false,"SUnit grace time exhausted");
  47890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47891. })))._valueWithTimeout_(aNumber);
  47892. return self;
  47893. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47894. },
  47895. args: ["aNumber"],
  47896. 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",
  47897. referencedClasses: [],
  47898. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47899. }),
  47900. $globals.TestCase);
  47901. $core.addMethod(
  47902. $core.method({
  47903. selector: "allTestSelectors",
  47904. protocol: "accessing",
  47905. fn: function (){
  47906. var self=this,$self=this;
  47907. var selectors;
  47908. return $core.withContext(function($ctx1) {
  47909. var $1;
  47910. selectors=$self._testSelectors();
  47911. $1=$self._shouldInheritSelectors();
  47912. if($core.assert($1)){
  47913. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47914. }
  47915. return selectors;
  47916. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47917. },
  47918. args: [],
  47919. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47920. referencedClasses: [],
  47921. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47922. }),
  47923. $globals.TestCase.a$cls);
  47924. $core.addMethod(
  47925. $core.method({
  47926. selector: "buildSuite",
  47927. protocol: "accessing",
  47928. fn: function (){
  47929. var self=this,$self=this;
  47930. return $core.withContext(function($ctx1) {
  47931. return $recv($self._allTestSelectors())._collect_((function(each){
  47932. return $core.withContext(function($ctx2) {
  47933. return $self._selector_(each);
  47934. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47935. }));
  47936. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47937. },
  47938. args: [],
  47939. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47940. referencedClasses: [],
  47941. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47942. }),
  47943. $globals.TestCase.a$cls);
  47944. $core.addMethod(
  47945. $core.method({
  47946. selector: "classTag",
  47947. protocol: "accessing",
  47948. fn: function (){
  47949. var self=this,$self=this;
  47950. return "test";
  47951. },
  47952. args: [],
  47953. 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'",
  47954. referencedClasses: [],
  47955. messageSends: []
  47956. }),
  47957. $globals.TestCase.a$cls);
  47958. $core.addMethod(
  47959. $core.method({
  47960. selector: "isAbstract",
  47961. protocol: "testing",
  47962. fn: function (){
  47963. var self=this,$self=this;
  47964. return $core.withContext(function($ctx1) {
  47965. return $recv($self._name()).__eq("TestCase");
  47966. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47967. },
  47968. args: [],
  47969. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47970. referencedClasses: [],
  47971. messageSends: ["=", "name"]
  47972. }),
  47973. $globals.TestCase.a$cls);
  47974. $core.addMethod(
  47975. $core.method({
  47976. selector: "isTestClass",
  47977. protocol: "testing",
  47978. fn: function (){
  47979. var self=this,$self=this;
  47980. return $core.withContext(function($ctx1) {
  47981. return $recv($self._isAbstract())._not();
  47982. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47983. },
  47984. args: [],
  47985. source: "isTestClass\x0a\x09^ self isAbstract not",
  47986. referencedClasses: [],
  47987. messageSends: ["not", "isAbstract"]
  47988. }),
  47989. $globals.TestCase.a$cls);
  47990. $core.addMethod(
  47991. $core.method({
  47992. selector: "lookupHierarchyRoot",
  47993. protocol: "accessing",
  47994. fn: function (){
  47995. var self=this,$self=this;
  47996. return $globals.TestCase;
  47997. },
  47998. args: [],
  47999. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  48000. referencedClasses: ["TestCase"],
  48001. messageSends: []
  48002. }),
  48003. $globals.TestCase.a$cls);
  48004. $core.addMethod(
  48005. $core.method({
  48006. selector: "selector:",
  48007. protocol: "accessing",
  48008. fn: function (aSelector){
  48009. var self=this,$self=this;
  48010. return $core.withContext(function($ctx1) {
  48011. var $1;
  48012. $1=$self._new();
  48013. $recv($1)._setTestSelector_(aSelector);
  48014. return $recv($1)._yourself();
  48015. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  48016. },
  48017. args: ["aSelector"],
  48018. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  48019. referencedClasses: [],
  48020. messageSends: ["setTestSelector:", "new", "yourself"]
  48021. }),
  48022. $globals.TestCase.a$cls);
  48023. $core.addMethod(
  48024. $core.method({
  48025. selector: "shouldInheritSelectors",
  48026. protocol: "testing",
  48027. fn: function (){
  48028. var self=this,$self=this;
  48029. return $core.withContext(function($ctx1) {
  48030. return $self.__tild_eq($self._lookupHierarchyRoot());
  48031. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  48032. },
  48033. args: [],
  48034. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  48035. referencedClasses: [],
  48036. messageSends: ["~=", "lookupHierarchyRoot"]
  48037. }),
  48038. $globals.TestCase.a$cls);
  48039. $core.addMethod(
  48040. $core.method({
  48041. selector: "testSelectors",
  48042. protocol: "accessing",
  48043. fn: function (){
  48044. var self=this,$self=this;
  48045. return $core.withContext(function($ctx1) {
  48046. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  48047. return $core.withContext(function($ctx2) {
  48048. return $recv(each)._match_("^test");
  48049. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48050. }));
  48051. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  48052. },
  48053. args: [],
  48054. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  48055. referencedClasses: [],
  48056. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  48057. }),
  48058. $globals.TestCase.a$cls);
  48059. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  48060. $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).";
  48061. $core.addMethod(
  48062. $core.method({
  48063. selector: "execute:",
  48064. protocol: "running",
  48065. fn: function (aBlock){
  48066. var self=this,$self=this;
  48067. var failed;
  48068. return $core.withContext(function($ctx1) {
  48069. var $1,$2;
  48070. $recv($self["@testCase"])._context_(self);
  48071. $ctx1.sendIdx["context:"]=1;
  48072. $recv((function(){
  48073. return $core.withContext(function($ctx2) {
  48074. failed=true;
  48075. $recv(aBlock)._value();
  48076. failed=false;
  48077. return failed;
  48078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48079. }))._ensure_((function(){
  48080. return $core.withContext(function($ctx2) {
  48081. $recv($self["@testCase"])._context_(nil);
  48082. $1=$recv(failed)._and_((function(){
  48083. return $core.withContext(function($ctx3) {
  48084. return $recv($self["@testCase"])._isAsync();
  48085. $ctx3.sendIdx["isAsync"]=1;
  48086. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48087. }));
  48088. if($core.assert($1)){
  48089. $recv($self["@testCase"])._finished();
  48090. }
  48091. $2=$recv($self["@testCase"])._isAsync();
  48092. if(!$core.assert($2)){
  48093. return $recv($self["@testCase"])._tearDown();
  48094. }
  48095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48096. }));
  48097. return self;
  48098. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  48099. },
  48100. args: ["aBlock"],
  48101. 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 ] ]",
  48102. referencedClasses: [],
  48103. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  48104. }),
  48105. $globals.TestContext);
  48106. $core.addMethod(
  48107. $core.method({
  48108. selector: "start",
  48109. protocol: "running",
  48110. fn: function (){
  48111. var self=this,$self=this;
  48112. return $core.withContext(function($ctx1) {
  48113. $self._execute_((function(){
  48114. return $core.withContext(function($ctx2) {
  48115. $recv($self["@testCase"])._setUp();
  48116. return $recv($self["@testCase"])._performTest();
  48117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48118. }));
  48119. return self;
  48120. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  48121. },
  48122. args: [],
  48123. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  48124. referencedClasses: [],
  48125. messageSends: ["execute:", "setUp", "performTest"]
  48126. }),
  48127. $globals.TestContext);
  48128. $core.addMethod(
  48129. $core.method({
  48130. selector: "testCase:",
  48131. protocol: "accessing",
  48132. fn: function (aTestCase){
  48133. var self=this,$self=this;
  48134. $self["@testCase"]=aTestCase;
  48135. return self;
  48136. },
  48137. args: ["aTestCase"],
  48138. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  48139. referencedClasses: [],
  48140. messageSends: []
  48141. }),
  48142. $globals.TestContext);
  48143. $core.addMethod(
  48144. $core.method({
  48145. selector: "testCase:",
  48146. protocol: "instance creation",
  48147. fn: function (aTestCase){
  48148. var self=this,$self=this;
  48149. return $core.withContext(function($ctx1) {
  48150. var $1;
  48151. $1=$self._new();
  48152. $recv($1)._testCase_(aTestCase);
  48153. return $recv($1)._yourself();
  48154. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  48155. },
  48156. args: ["aTestCase"],
  48157. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  48158. referencedClasses: [],
  48159. messageSends: ["testCase:", "new", "yourself"]
  48160. }),
  48161. $globals.TestContext.a$cls);
  48162. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  48163. $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`.";
  48164. $core.addMethod(
  48165. $core.method({
  48166. selector: "execute:",
  48167. protocol: "running",
  48168. fn: function (aBlock){
  48169. var self=this,$self=this;
  48170. return $core.withContext(function($ctx1) {
  48171. var $1;
  48172. $recv((function(){
  48173. return $core.withContext(function($ctx2) {
  48174. return $self._withErrorReporting_((function(){
  48175. return $core.withContext(function($ctx3) {
  48176. return (
  48177. $ctx3.supercall = true,
  48178. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  48179. $ctx3.supercall = false;
  48180. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48181. }));
  48182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48183. }))._ensure_((function(){
  48184. return $core.withContext(function($ctx2) {
  48185. $1=$recv($self["@testCase"])._isAsync();
  48186. if(!$core.assert($1)){
  48187. $recv($self["@result"])._increaseRuns();
  48188. return $recv($self["@finished"])._value();
  48189. }
  48190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48191. }));
  48192. return self;
  48193. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48194. },
  48195. args: ["aBlock"],
  48196. 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 ] ]",
  48197. referencedClasses: [],
  48198. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48199. }),
  48200. $globals.ReportingTestContext);
  48201. $core.addMethod(
  48202. $core.method({
  48203. selector: "finished:",
  48204. protocol: "accessing",
  48205. fn: function (aBlock){
  48206. var self=this,$self=this;
  48207. $self["@finished"]=aBlock;
  48208. return self;
  48209. },
  48210. args: ["aBlock"],
  48211. source: "finished: aBlock\x0a\x09finished := aBlock",
  48212. referencedClasses: [],
  48213. messageSends: []
  48214. }),
  48215. $globals.ReportingTestContext);
  48216. $core.addMethod(
  48217. $core.method({
  48218. selector: "result:",
  48219. protocol: "accessing",
  48220. fn: function (aTestResult){
  48221. var self=this,$self=this;
  48222. $self["@result"]=aTestResult;
  48223. return self;
  48224. },
  48225. args: ["aTestResult"],
  48226. source: "result: aTestResult\x0a\x09result := aTestResult",
  48227. referencedClasses: [],
  48228. messageSends: []
  48229. }),
  48230. $globals.ReportingTestContext);
  48231. $core.addMethod(
  48232. $core.method({
  48233. selector: "withErrorReporting:",
  48234. protocol: "private",
  48235. fn: function (aBlock){
  48236. var self=this,$self=this;
  48237. return $core.withContext(function($ctx1) {
  48238. $recv((function(){
  48239. return $core.withContext(function($ctx2) {
  48240. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48241. return $core.withContext(function($ctx3) {
  48242. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48243. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48244. }));
  48245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48246. }))._on_do_($globals.Error,(function(ex){
  48247. return $core.withContext(function($ctx2) {
  48248. return $recv($self["@result"])._addError_($self["@testCase"]);
  48249. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48250. }));
  48251. $ctx1.sendIdx["on:do:"]=1;
  48252. return self;
  48253. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48254. },
  48255. args: ["aBlock"],
  48256. 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 ]",
  48257. referencedClasses: ["TestFailure", "Error"],
  48258. messageSends: ["on:do:", "addFailure:", "addError:"]
  48259. }),
  48260. $globals.ReportingTestContext);
  48261. $core.addMethod(
  48262. $core.method({
  48263. selector: "testCase:result:finished:",
  48264. protocol: "instance creation",
  48265. fn: function (aTestCase,aTestResult,aBlock){
  48266. var self=this,$self=this;
  48267. return $core.withContext(function($ctx1) {
  48268. var $1;
  48269. $1=(
  48270. $ctx1.supercall = true,
  48271. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48272. $ctx1.supercall = false;
  48273. $recv($1)._result_(aTestResult);
  48274. $recv($1)._finished_(aBlock);
  48275. return $recv($1)._yourself();
  48276. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48277. },
  48278. args: ["aTestCase", "aTestResult", "aBlock"],
  48279. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48280. referencedClasses: [],
  48281. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48282. }),
  48283. $globals.ReportingTestContext.a$cls);
  48284. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48285. $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.";
  48286. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48287. $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";
  48288. $core.addMethod(
  48289. $core.method({
  48290. selector: "addError:",
  48291. protocol: "accessing",
  48292. fn: function (anError){
  48293. var self=this,$self=this;
  48294. return $core.withContext(function($ctx1) {
  48295. $recv($self._errors())._add_(anError);
  48296. return self;
  48297. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48298. },
  48299. args: ["anError"],
  48300. source: "addError: anError\x0a\x09self errors add: anError",
  48301. referencedClasses: [],
  48302. messageSends: ["add:", "errors"]
  48303. }),
  48304. $globals.TestResult);
  48305. $core.addMethod(
  48306. $core.method({
  48307. selector: "addFailure:",
  48308. protocol: "accessing",
  48309. fn: function (aFailure){
  48310. var self=this,$self=this;
  48311. return $core.withContext(function($ctx1) {
  48312. $recv($self._failures())._add_(aFailure);
  48313. return self;
  48314. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48315. },
  48316. args: ["aFailure"],
  48317. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48318. referencedClasses: [],
  48319. messageSends: ["add:", "failures"]
  48320. }),
  48321. $globals.TestResult);
  48322. $core.addMethod(
  48323. $core.method({
  48324. selector: "errors",
  48325. protocol: "accessing",
  48326. fn: function (){
  48327. var self=this,$self=this;
  48328. return $self["@errors"];
  48329. },
  48330. args: [],
  48331. source: "errors\x0a\x09^ errors",
  48332. referencedClasses: [],
  48333. messageSends: []
  48334. }),
  48335. $globals.TestResult);
  48336. $core.addMethod(
  48337. $core.method({
  48338. selector: "failures",
  48339. protocol: "accessing",
  48340. fn: function (){
  48341. var self=this,$self=this;
  48342. return $self["@failures"];
  48343. },
  48344. args: [],
  48345. source: "failures\x0a\x09^ failures",
  48346. referencedClasses: [],
  48347. messageSends: []
  48348. }),
  48349. $globals.TestResult);
  48350. $core.addMethod(
  48351. $core.method({
  48352. selector: "increaseRuns",
  48353. protocol: "accessing",
  48354. fn: function (){
  48355. var self=this,$self=this;
  48356. return $core.withContext(function($ctx1) {
  48357. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48358. return self;
  48359. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48360. },
  48361. args: [],
  48362. source: "increaseRuns\x0a\x09runs := runs + 1",
  48363. referencedClasses: [],
  48364. messageSends: ["+"]
  48365. }),
  48366. $globals.TestResult);
  48367. $core.addMethod(
  48368. $core.method({
  48369. selector: "initialize",
  48370. protocol: "initialization",
  48371. fn: function (){
  48372. var self=this,$self=this;
  48373. return $core.withContext(function($ctx1) {
  48374. (
  48375. $ctx1.supercall = true,
  48376. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48377. $ctx1.supercall = false;
  48378. $self["@timestamp"]=$recv($globals.Date)._now();
  48379. $self["@runs"]=(0);
  48380. $self["@errors"]=$recv($globals.Array)._new();
  48381. $ctx1.sendIdx["new"]=1;
  48382. $self["@failures"]=$recv($globals.Array)._new();
  48383. $self["@total"]=(0);
  48384. return self;
  48385. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48386. },
  48387. args: [],
  48388. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48389. referencedClasses: ["Date", "Array"],
  48390. messageSends: ["initialize", "now", "new"]
  48391. }),
  48392. $globals.TestResult);
  48393. $core.addMethod(
  48394. $core.method({
  48395. selector: "nextRunDo:",
  48396. protocol: "running",
  48397. fn: function (aBlock){
  48398. var self=this,$self=this;
  48399. return $core.withContext(function($ctx1) {
  48400. var $2,$1;
  48401. $2=$self._runs();
  48402. $ctx1.sendIdx["runs"]=1;
  48403. $1=$recv($2).__eq_eq($self._total());
  48404. if(!$core.assert($1)){
  48405. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48406. }
  48407. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48408. },
  48409. args: ["aBlock"],
  48410. 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 ]",
  48411. referencedClasses: [],
  48412. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48413. }),
  48414. $globals.TestResult);
  48415. $core.addMethod(
  48416. $core.method({
  48417. selector: "runCase:",
  48418. protocol: "running",
  48419. fn: function (aTestCase){
  48420. var self=this,$self=this;
  48421. return $core.withContext(function($ctx1) {
  48422. $recv((function(){
  48423. return $core.withContext(function($ctx2) {
  48424. return $recv((function(){
  48425. return $core.withContext(function($ctx3) {
  48426. $self._increaseRuns();
  48427. return $recv(aTestCase)._runCase();
  48428. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48429. }))._on_do_($globals.TestFailure,(function(ex){
  48430. return $core.withContext(function($ctx3) {
  48431. return $self._addFailure_(aTestCase);
  48432. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48433. }));
  48434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48435. }))._on_do_($globals.Error,(function(ex){
  48436. return $core.withContext(function($ctx2) {
  48437. return $self._addError_(aTestCase);
  48438. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48439. }));
  48440. $ctx1.sendIdx["on:do:"]=1;
  48441. return self;
  48442. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48443. },
  48444. args: ["aTestCase"],
  48445. 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 ]",
  48446. referencedClasses: ["TestFailure", "Error"],
  48447. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48448. }),
  48449. $globals.TestResult);
  48450. $core.addMethod(
  48451. $core.method({
  48452. selector: "runs",
  48453. protocol: "accessing",
  48454. fn: function (){
  48455. var self=this,$self=this;
  48456. return $self["@runs"];
  48457. },
  48458. args: [],
  48459. source: "runs\x0a\x09^ runs",
  48460. referencedClasses: [],
  48461. messageSends: []
  48462. }),
  48463. $globals.TestResult);
  48464. $core.addMethod(
  48465. $core.method({
  48466. selector: "status",
  48467. protocol: "accessing",
  48468. fn: function (){
  48469. var self=this,$self=this;
  48470. return $core.withContext(function($ctx1) {
  48471. var $1;
  48472. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48473. return "error";
  48474. }),(function(){
  48475. return $core.withContext(function($ctx2) {
  48476. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48477. return "failure";
  48478. }),(function(){
  48479. return "success";
  48480. }));
  48481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48482. }));
  48483. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48484. return $1;
  48485. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48486. },
  48487. args: [],
  48488. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48489. referencedClasses: [],
  48490. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48491. }),
  48492. $globals.TestResult);
  48493. $core.addMethod(
  48494. $core.method({
  48495. selector: "timestamp",
  48496. protocol: "accessing",
  48497. fn: function (){
  48498. var self=this,$self=this;
  48499. return $self["@timestamp"];
  48500. },
  48501. args: [],
  48502. source: "timestamp\x0a\x09^ timestamp",
  48503. referencedClasses: [],
  48504. messageSends: []
  48505. }),
  48506. $globals.TestResult);
  48507. $core.addMethod(
  48508. $core.method({
  48509. selector: "total",
  48510. protocol: "accessing",
  48511. fn: function (){
  48512. var self=this,$self=this;
  48513. return $self["@total"];
  48514. },
  48515. args: [],
  48516. source: "total\x0a\x09^ total",
  48517. referencedClasses: [],
  48518. messageSends: []
  48519. }),
  48520. $globals.TestResult);
  48521. $core.addMethod(
  48522. $core.method({
  48523. selector: "total:",
  48524. protocol: "accessing",
  48525. fn: function (aNumber){
  48526. var self=this,$self=this;
  48527. $self["@total"]=aNumber;
  48528. return self;
  48529. },
  48530. args: ["aNumber"],
  48531. source: "total: aNumber\x0a\x09total := aNumber",
  48532. referencedClasses: [],
  48533. messageSends: []
  48534. }),
  48535. $globals.TestResult);
  48536. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48537. $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`.";
  48538. $core.addMethod(
  48539. $core.method({
  48540. selector: "announcer",
  48541. protocol: "accessing",
  48542. fn: function (){
  48543. var self=this,$self=this;
  48544. return $self["@announcer"];
  48545. },
  48546. args: [],
  48547. source: "announcer\x0a\x09^ announcer",
  48548. referencedClasses: [],
  48549. messageSends: []
  48550. }),
  48551. $globals.TestSuiteRunner);
  48552. $core.addMethod(
  48553. $core.method({
  48554. selector: "contextOf:",
  48555. protocol: "private",
  48556. fn: function (anInteger){
  48557. var self=this,$self=this;
  48558. return $core.withContext(function($ctx1) {
  48559. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48560. return $core.withContext(function($ctx2) {
  48561. return $self._resume();
  48562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48563. }));
  48564. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48565. },
  48566. args: ["anInteger"],
  48567. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48568. referencedClasses: ["ReportingTestContext"],
  48569. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48570. }),
  48571. $globals.TestSuiteRunner);
  48572. $core.addMethod(
  48573. $core.method({
  48574. selector: "initialize",
  48575. protocol: "initialization",
  48576. fn: function (){
  48577. var self=this,$self=this;
  48578. return $core.withContext(function($ctx1) {
  48579. var $1;
  48580. (
  48581. $ctx1.supercall = true,
  48582. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48583. $ctx1.supercall = false;
  48584. $self["@announcer"]=$recv($globals.Announcer)._new();
  48585. $ctx1.sendIdx["new"]=1;
  48586. $self["@result"]=$recv($globals.TestResult)._new();
  48587. $self["@runNextTest"]=(function(){
  48588. var runs;
  48589. return $core.withContext(function($ctx2) {
  48590. runs=$recv($self["@result"])._runs();
  48591. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48592. if($core.assert($1)){
  48593. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48594. }
  48595. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48596. });
  48597. return self;
  48598. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48599. },
  48600. args: [],
  48601. 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 ] ].",
  48602. referencedClasses: ["Announcer", "TestResult"],
  48603. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48604. }),
  48605. $globals.TestSuiteRunner);
  48606. $core.addMethod(
  48607. $core.method({
  48608. selector: "result",
  48609. protocol: "accessing",
  48610. fn: function (){
  48611. var self=this,$self=this;
  48612. return $self["@result"];
  48613. },
  48614. args: [],
  48615. source: "result\x0a\x09^ result",
  48616. referencedClasses: [],
  48617. messageSends: []
  48618. }),
  48619. $globals.TestSuiteRunner);
  48620. $core.addMethod(
  48621. $core.method({
  48622. selector: "resume",
  48623. protocol: "actions",
  48624. fn: function (){
  48625. var self=this,$self=this;
  48626. return $core.withContext(function($ctx1) {
  48627. $recv($self["@runNextTest"])._fork();
  48628. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48629. return self;
  48630. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48631. },
  48632. args: [],
  48633. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48634. referencedClasses: ["ResultAnnouncement"],
  48635. messageSends: ["fork", "announce:", "result:", "new"]
  48636. }),
  48637. $globals.TestSuiteRunner);
  48638. $core.addMethod(
  48639. $core.method({
  48640. selector: "run",
  48641. protocol: "actions",
  48642. fn: function (){
  48643. var self=this,$self=this;
  48644. return $core.withContext(function($ctx1) {
  48645. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48646. $self._resume();
  48647. return self;
  48648. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48649. },
  48650. args: [],
  48651. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48652. referencedClasses: [],
  48653. messageSends: ["total:", "size", "resume"]
  48654. }),
  48655. $globals.TestSuiteRunner);
  48656. $core.addMethod(
  48657. $core.method({
  48658. selector: "suite:",
  48659. protocol: "accessing",
  48660. fn: function (aCollection){
  48661. var self=this,$self=this;
  48662. $self["@suite"]=aCollection;
  48663. return self;
  48664. },
  48665. args: ["aCollection"],
  48666. source: "suite: aCollection\x0a\x09suite := aCollection",
  48667. referencedClasses: [],
  48668. messageSends: []
  48669. }),
  48670. $globals.TestSuiteRunner);
  48671. $core.addMethod(
  48672. $core.method({
  48673. selector: "new",
  48674. protocol: "instance creation",
  48675. fn: function (){
  48676. var self=this,$self=this;
  48677. return $core.withContext(function($ctx1) {
  48678. $self._shouldNotImplement();
  48679. return self;
  48680. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48681. },
  48682. args: [],
  48683. source: "new\x0a\x09self shouldNotImplement",
  48684. referencedClasses: [],
  48685. messageSends: ["shouldNotImplement"]
  48686. }),
  48687. $globals.TestSuiteRunner.a$cls);
  48688. $core.addMethod(
  48689. $core.method({
  48690. selector: "on:",
  48691. protocol: "instance creation",
  48692. fn: function (aCollection){
  48693. var self=this,$self=this;
  48694. return $core.withContext(function($ctx1) {
  48695. var $1;
  48696. $1=(
  48697. $ctx1.supercall = true,
  48698. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48699. $ctx1.supercall = false;
  48700. return $recv($1)._suite_(aCollection);
  48701. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48702. },
  48703. args: ["aCollection"],
  48704. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48705. referencedClasses: [],
  48706. messageSends: ["suite:", "new"]
  48707. }),
  48708. $globals.TestSuiteRunner.a$cls);
  48709. $core.addMethod(
  48710. $core.method({
  48711. selector: "isTestPackage",
  48712. protocol: "*SUnit",
  48713. fn: function (){
  48714. var self=this,$self=this;
  48715. return $core.withContext(function($ctx1) {
  48716. return $recv($self._classes())._anySatisfy_((function(each){
  48717. return $core.withContext(function($ctx2) {
  48718. return $recv(each)._isTestClass();
  48719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48720. }));
  48721. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48722. },
  48723. args: [],
  48724. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48725. referencedClasses: [],
  48726. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48727. }),
  48728. $globals.Package);
  48729. $core.addMethod(
  48730. $core.method({
  48731. selector: "isTestClass",
  48732. protocol: "*SUnit",
  48733. fn: function (){
  48734. var self=this,$self=this;
  48735. return false;
  48736. },
  48737. args: [],
  48738. source: "isTestClass\x0a\x09^ false",
  48739. referencedClasses: [],
  48740. messageSends: []
  48741. }),
  48742. $globals.TBehaviorDefaults);
  48743. });
  48744. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48745. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48746. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48747. $core.addPackage("Compiler-Tests");
  48748. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48749. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48750. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48751. $core.addMethod(
  48752. $core.method({
  48753. selector: "parse:forClass:",
  48754. protocol: "parsing",
  48755. fn: function (aString,aClass){
  48756. var self=this,$self=this;
  48757. return $core.withContext(function($ctx1) {
  48758. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48759. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48760. },
  48761. args: ["aString", "aClass"],
  48762. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48763. referencedClasses: ["Compiler"],
  48764. messageSends: ["ast:forClass:protocol:", "new"]
  48765. }),
  48766. $globals.ASTParsingTest);
  48767. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48768. $core.addMethod(
  48769. $core.method({
  48770. selector: "astPCNodeVisitor",
  48771. protocol: "factory",
  48772. fn: function (){
  48773. var self=this,$self=this;
  48774. return $core.withContext(function($ctx1) {
  48775. var $1;
  48776. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48777. $recv($1)._index_((0));
  48778. return $recv($1)._yourself();
  48779. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48780. },
  48781. args: [],
  48782. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48783. referencedClasses: ["ASTPCNodeVisitor"],
  48784. messageSends: ["index:", "new", "yourself"]
  48785. }),
  48786. $globals.ASTPCNodeVisitorTest);
  48787. $core.addMethod(
  48788. $core.method({
  48789. selector: "astPCNodeVisitorForSelector:",
  48790. protocol: "factory",
  48791. fn: function (aString){
  48792. var self=this,$self=this;
  48793. return $core.withContext(function($ctx1) {
  48794. var $1;
  48795. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48796. $recv($1)._selector_(aString);
  48797. $recv($1)._index_((0));
  48798. return $recv($1)._yourself();
  48799. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48800. },
  48801. args: ["aString"],
  48802. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48803. referencedClasses: ["ASTPCNodeVisitor"],
  48804. messageSends: ["selector:", "new", "index:", "yourself"]
  48805. }),
  48806. $globals.ASTPCNodeVisitorTest);
  48807. $core.addMethod(
  48808. $core.method({
  48809. selector: "testJSStatementNode",
  48810. protocol: "tests",
  48811. fn: function (){
  48812. var self=this,$self=this;
  48813. var ast,visitor;
  48814. return $core.withContext(function($ctx1) {
  48815. var $3,$2,$1;
  48816. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48817. $3=$self._astPCNodeVisitor();
  48818. $recv($3)._visit_(ast);
  48819. $2=$recv($3)._currentNode();
  48820. $1=$recv($2)._isJSStatementNode();
  48821. $self._assert_($1);
  48822. return self;
  48823. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48824. },
  48825. args: [],
  48826. 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",
  48827. referencedClasses: ["Object"],
  48828. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48829. }),
  48830. $globals.ASTPCNodeVisitorTest);
  48831. $core.addMethod(
  48832. $core.method({
  48833. selector: "testMessageSend",
  48834. protocol: "tests",
  48835. fn: function (){
  48836. var self=this,$self=this;
  48837. var ast;
  48838. return $core.withContext(function($ctx1) {
  48839. var $3,$2,$1;
  48840. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48841. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48842. $recv($3)._visit_(ast);
  48843. $2=$recv($3)._currentNode();
  48844. $1=$recv($2)._selector();
  48845. $self._assert_equals_($1,"yourself");
  48846. return self;
  48847. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48848. },
  48849. args: [],
  48850. 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'",
  48851. referencedClasses: ["Object"],
  48852. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48853. }),
  48854. $globals.ASTPCNodeVisitorTest);
  48855. $core.addMethod(
  48856. $core.method({
  48857. selector: "testMessageSendWithBlocks",
  48858. protocol: "tests",
  48859. fn: function (){
  48860. var self=this,$self=this;
  48861. var ast;
  48862. return $core.withContext(function($ctx1) {
  48863. var $3,$2,$1;
  48864. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48865. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48866. $recv($3)._visit_(ast);
  48867. $2=$recv($3)._currentNode();
  48868. $1=$recv($2)._selector();
  48869. $self._assert_equals_($1,"yourself");
  48870. return self;
  48871. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48872. },
  48873. args: [],
  48874. 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'",
  48875. referencedClasses: ["Object"],
  48876. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48877. }),
  48878. $globals.ASTPCNodeVisitorTest);
  48879. $core.addMethod(
  48880. $core.method({
  48881. selector: "testMessageSendWithInlining",
  48882. protocol: "tests",
  48883. fn: function (){
  48884. var self=this,$self=this;
  48885. var ast;
  48886. return $core.withContext(function($ctx1) {
  48887. var $3,$4,$2,$1,$7,$6,$5;
  48888. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48889. $ctx1.sendIdx["parse:forClass:"]=1;
  48890. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48891. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48892. $recv($3)._visit_(ast);
  48893. $ctx1.sendIdx["visit:"]=1;
  48894. $4=$recv($3)._currentNode();
  48895. $ctx1.sendIdx["currentNode"]=1;
  48896. $2=$4;
  48897. $1=$recv($2)._selector();
  48898. $ctx1.sendIdx["selector"]=1;
  48899. $self._assert_equals_($1,"yourself");
  48900. $ctx1.sendIdx["assert:equals:"]=1;
  48901. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48902. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48903. $recv($7)._visit_(ast);
  48904. $6=$recv($7)._currentNode();
  48905. $5=$recv($6)._selector();
  48906. $self._assert_equals_($5,"asBoolean");
  48907. return self;
  48908. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48909. },
  48910. args: [],
  48911. 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'",
  48912. referencedClasses: ["Object"],
  48913. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48914. }),
  48915. $globals.ASTPCNodeVisitorTest);
  48916. $core.addMethod(
  48917. $core.method({
  48918. selector: "testNoMessageSend",
  48919. protocol: "tests",
  48920. fn: function (){
  48921. var self=this,$self=this;
  48922. var ast;
  48923. return $core.withContext(function($ctx1) {
  48924. var $3,$2,$1;
  48925. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48926. $3=$self._astPCNodeVisitor();
  48927. $recv($3)._visit_(ast);
  48928. $2=$recv($3)._currentNode();
  48929. $1=$recv($2)._isNil();
  48930. $self._assert_($1);
  48931. return self;
  48932. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48933. },
  48934. args: [],
  48935. 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",
  48936. referencedClasses: ["Object"],
  48937. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48938. }),
  48939. $globals.ASTPCNodeVisitorTest);
  48940. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48941. $core.addMethod(
  48942. $core.method({
  48943. selector: "testNodeAtPosition",
  48944. protocol: "tests",
  48945. fn: function (){
  48946. var self=this,$self=this;
  48947. var node;
  48948. return $core.withContext(function($ctx1) {
  48949. var $3,$4,$2,$1,$7,$8,$6,$5;
  48950. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  48951. $ctx1.sendIdx["parse:forClass:"]=1;
  48952. $3=node;
  48953. $4=(2).__at((4));
  48954. $ctx1.sendIdx["@"]=1;
  48955. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48956. return nil;
  48957. }));
  48958. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48959. $1=$recv($2)._source();
  48960. $self._assert_equals_($1,"self");
  48961. $ctx1.sendIdx["assert:equals:"]=1;
  48962. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48963. $ctx1.sendIdx["parse:forClass:"]=2;
  48964. $7=node;
  48965. $8=(2).__at((7));
  48966. $ctx1.sendIdx["@"]=2;
  48967. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48968. return nil;
  48969. }));
  48970. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48971. $5=$recv($6)._selector();
  48972. $ctx1.sendIdx["selector"]=1;
  48973. $self._assert_equals_($5,"ifTrue:");
  48974. $ctx1.sendIdx["assert:equals:"]=2;
  48975. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  48976. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48977. return nil;
  48978. })))._selector(),"foo");
  48979. return self;
  48980. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48981. },
  48982. args: [],
  48983. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48984. referencedClasses: ["Object"],
  48985. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48986. }),
  48987. $globals.ASTPositionTest);
  48988. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48989. $core.addMethod(
  48990. $core.method({
  48991. selector: "codeGeneratorClass",
  48992. protocol: "accessing",
  48993. fn: function (){
  48994. var self=this,$self=this;
  48995. return $globals.CodeGenerator;
  48996. },
  48997. args: [],
  48998. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48999. referencedClasses: ["CodeGenerator"],
  49000. messageSends: []
  49001. }),
  49002. $globals.CodeGeneratorTest);
  49003. $core.addMethod(
  49004. $core.method({
  49005. selector: "compiler",
  49006. protocol: "factory",
  49007. fn: function (){
  49008. var self=this,$self=this;
  49009. return $core.withContext(function($ctx1) {
  49010. var $1;
  49011. $1=$recv($globals.Compiler)._new();
  49012. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  49013. return $recv($1)._yourself();
  49014. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  49015. },
  49016. args: [],
  49017. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  49018. referencedClasses: ["Compiler"],
  49019. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  49020. }),
  49021. $globals.CodeGeneratorTest);
  49022. $core.addMethod(
  49023. $core.method({
  49024. selector: "setUp",
  49025. protocol: "initialization",
  49026. fn: function (){
  49027. var self=this,$self=this;
  49028. return $core.withContext(function($ctx1) {
  49029. $self["@receiver"]=$recv($globals.DoIt)._new();
  49030. return self;
  49031. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  49032. },
  49033. args: [],
  49034. source: "setUp\x0a\x09receiver := DoIt new",
  49035. referencedClasses: ["DoIt"],
  49036. messageSends: ["new"]
  49037. }),
  49038. $globals.CodeGeneratorTest);
  49039. $core.addMethod(
  49040. $core.method({
  49041. selector: "should:receiver:raise:",
  49042. protocol: "testing",
  49043. fn: function (aString,anObject,anErrorClass){
  49044. var self=this,$self=this;
  49045. var method,result;
  49046. return $core.withContext(function($ctx1) {
  49047. var $1,$2,$3,$receiver;
  49048. $self["@receiver"]=anObject;
  49049. $recv((function(){
  49050. return $core.withContext(function($ctx2) {
  49051. return $self._should_raise_((function(){
  49052. return $core.withContext(function($ctx3) {
  49053. $1=$self._compiler();
  49054. $2=$recv(anObject)._class();
  49055. $ctx3.sendIdx["class"]=1;
  49056. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  49057. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  49058. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49059. }),anErrorClass);
  49060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49061. }))._ensure_((function(){
  49062. return $core.withContext(function($ctx2) {
  49063. $3=method;
  49064. if(($receiver = $3) == null || $receiver.a$nil){
  49065. return $3;
  49066. } else {
  49067. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  49068. }
  49069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49070. }));
  49071. return self;
  49072. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  49073. },
  49074. args: ["aString", "anObject", "anErrorClass"],
  49075. 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 ] ]",
  49076. referencedClasses: [],
  49077. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  49078. }),
  49079. $globals.CodeGeneratorTest);
  49080. $core.addMethod(
  49081. $core.method({
  49082. selector: "should:receiver:return:",
  49083. protocol: "testing",
  49084. fn: function (aString,anObject,aResult){
  49085. var self=this,$self=this;
  49086. var method,result;
  49087. return $core.withContext(function($ctx1) {
  49088. var $1,$2;
  49089. $self["@receiver"]=anObject;
  49090. $1=$self._compiler();
  49091. $2=$recv(anObject)._class();
  49092. $ctx1.sendIdx["class"]=1;
  49093. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  49094. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  49095. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  49096. $self._assert_equals_(aResult,result);
  49097. return self;
  49098. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  49099. },
  49100. args: ["aString", "anObject", "aResult"],
  49101. 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",
  49102. referencedClasses: [],
  49103. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  49104. }),
  49105. $globals.CodeGeneratorTest);
  49106. $core.addMethod(
  49107. $core.method({
  49108. selector: "should:return:",
  49109. protocol: "testing",
  49110. fn: function (aString,anObject){
  49111. var self=this,$self=this;
  49112. return $core.withContext(function($ctx1) {
  49113. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  49114. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  49115. },
  49116. args: ["aString", "anObject"],
  49117. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  49118. referencedClasses: [],
  49119. messageSends: ["should:receiver:return:"]
  49120. }),
  49121. $globals.CodeGeneratorTest);
  49122. $core.addMethod(
  49123. $core.method({
  49124. selector: "tearDown",
  49125. protocol: "initialization",
  49126. fn: function (){
  49127. var self=this,$self=this;
  49128. return self;
  49129. },
  49130. args: [],
  49131. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  49132. referencedClasses: [],
  49133. messageSends: []
  49134. }),
  49135. $globals.CodeGeneratorTest);
  49136. $core.addMethod(
  49137. $core.method({
  49138. selector: "testAssignment",
  49139. protocol: "tests",
  49140. fn: function (){
  49141. var self=this,$self=this;
  49142. return $core.withContext(function($ctx1) {
  49143. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  49144. $ctx1.sendIdx["should:return:"]=1;
  49145. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  49146. $ctx1.sendIdx["should:return:"]=2;
  49147. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  49148. return self;
  49149. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  49150. },
  49151. args: [],
  49152. 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",
  49153. referencedClasses: [],
  49154. messageSends: ["should:return:"]
  49155. }),
  49156. $globals.CodeGeneratorTest);
  49157. $core.addMethod(
  49158. $core.method({
  49159. selector: "testBackslashSelectors",
  49160. protocol: "tests",
  49161. fn: function (){
  49162. var self=this,$self=this;
  49163. return $core.withContext(function($ctx1) {
  49164. $self._should_return_("\x5c arg ^ 4",(4));
  49165. $ctx1.sendIdx["should:return:"]=1;
  49166. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  49167. return self;
  49168. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  49169. },
  49170. args: [],
  49171. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  49172. referencedClasses: [],
  49173. messageSends: ["should:return:"]
  49174. }),
  49175. $globals.CodeGeneratorTest);
  49176. $core.addMethod(
  49177. $core.method({
  49178. selector: "testBlockReturn",
  49179. protocol: "tests",
  49180. fn: function (){
  49181. var self=this,$self=this;
  49182. return $core.withContext(function($ctx1) {
  49183. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  49184. $ctx1.sendIdx["should:return:"]=1;
  49185. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  49186. $ctx1.sendIdx["should:return:"]=2;
  49187. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  49188. return self;
  49189. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49190. },
  49191. args: [],
  49192. 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).",
  49193. referencedClasses: [],
  49194. messageSends: ["should:return:"]
  49195. }),
  49196. $globals.CodeGeneratorTest);
  49197. $core.addMethod(
  49198. $core.method({
  49199. selector: "testCascades",
  49200. protocol: "tests",
  49201. fn: function (){
  49202. var self=this,$self=this;
  49203. return $core.withContext(function($ctx1) {
  49204. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49205. return self;
  49206. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49207. },
  49208. args: [],
  49209. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49210. referencedClasses: [],
  49211. messageSends: ["should:return:"]
  49212. }),
  49213. $globals.CodeGeneratorTest);
  49214. $core.addMethod(
  49215. $core.method({
  49216. selector: "testCascadesInDynamicArray",
  49217. protocol: "tests",
  49218. fn: function (){
  49219. var self=this,$self=this;
  49220. return $core.withContext(function($ctx1) {
  49221. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49222. return self;
  49223. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49224. },
  49225. args: [],
  49226. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49227. referencedClasses: [],
  49228. messageSends: ["should:return:"]
  49229. }),
  49230. $globals.CodeGeneratorTest);
  49231. $core.addMethod(
  49232. $core.method({
  49233. selector: "testCascadesInDynamicDictioary",
  49234. protocol: "tests",
  49235. fn: function (){
  49236. var self=this,$self=this;
  49237. return $core.withContext(function($ctx1) {
  49238. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49239. return self;
  49240. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49241. },
  49242. args: [],
  49243. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49244. referencedClasses: [],
  49245. messageSends: ["should:return:"]
  49246. }),
  49247. $globals.CodeGeneratorTest);
  49248. $core.addMethod(
  49249. $core.method({
  49250. selector: "testCascadesInSend",
  49251. protocol: "tests",
  49252. fn: function (){
  49253. var self=this,$self=this;
  49254. return $core.withContext(function($ctx1) {
  49255. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49256. return self;
  49257. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49258. },
  49259. args: [],
  49260. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49261. referencedClasses: [],
  49262. messageSends: ["should:return:"]
  49263. }),
  49264. $globals.CodeGeneratorTest);
  49265. $core.addMethod(
  49266. $core.method({
  49267. selector: "testCascadesWithInlining",
  49268. protocol: "tests",
  49269. fn: function (){
  49270. var self=this,$self=this;
  49271. return $core.withContext(function($ctx1) {
  49272. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49273. $ctx1.sendIdx["should:return:"]=1;
  49274. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49275. return self;
  49276. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49277. },
  49278. args: [],
  49279. 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",
  49280. referencedClasses: [],
  49281. messageSends: ["should:return:"]
  49282. }),
  49283. $globals.CodeGeneratorTest);
  49284. $core.addMethod(
  49285. $core.method({
  49286. selector: "testDynamicArrayElementsOrdered",
  49287. protocol: "tests",
  49288. fn: function (){
  49289. var self=this,$self=this;
  49290. return $core.withContext(function($ctx1) {
  49291. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49292. $ctx1.sendIdx["should:return:"]=1;
  49293. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49294. return self;
  49295. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49296. },
  49297. args: [],
  49298. 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).",
  49299. referencedClasses: [],
  49300. messageSends: ["should:return:"]
  49301. }),
  49302. $globals.CodeGeneratorTest);
  49303. $core.addMethod(
  49304. $core.method({
  49305. selector: "testDynamicDictionaryElementsOrdered",
  49306. protocol: "tests",
  49307. fn: function (){
  49308. var self=this,$self=this;
  49309. return $core.withContext(function($ctx1) {
  49310. $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)]));
  49311. return self;
  49312. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49313. },
  49314. args: [],
  49315. 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}.",
  49316. referencedClasses: [],
  49317. messageSends: ["should:return:"]
  49318. }),
  49319. $globals.CodeGeneratorTest);
  49320. $core.addMethod(
  49321. $core.method({
  49322. selector: "testDynamicDictionaryWithMoreArrows",
  49323. protocol: "tests",
  49324. fn: function (){
  49325. var self=this,$self=this;
  49326. return $core.withContext(function($ctx1) {
  49327. var $2,$1;
  49328. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49329. $ctx1.sendIdx["->"]=1;
  49330. $1=$recv($globals.HashedCollection)._with_($2);
  49331. $self._should_return_("foo ^ #{1->2->3}",$1);
  49332. return self;
  49333. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49334. },
  49335. args: [],
  49336. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49337. referencedClasses: ["HashedCollection"],
  49338. messageSends: ["should:return:", "with:", "->"]
  49339. }),
  49340. $globals.CodeGeneratorTest);
  49341. $core.addMethod(
  49342. $core.method({
  49343. selector: "testGlobalVar",
  49344. protocol: "tests",
  49345. fn: function (){
  49346. var self=this,$self=this;
  49347. return $core.withContext(function($ctx1) {
  49348. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49349. $ctx1.sendIdx["should:return:"]=1;
  49350. $self._should_return_("foo ^ Math cos: 0",(1));
  49351. $ctx1.sendIdx["should:return:"]=2;
  49352. $self._should_return_("foo ^ NonExistingVar",nil);
  49353. return self;
  49354. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49355. },
  49356. args: [],
  49357. 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",
  49358. referencedClasses: ["BlockClosure"],
  49359. messageSends: ["should:return:"]
  49360. }),
  49361. $globals.CodeGeneratorTest);
  49362. $core.addMethod(
  49363. $core.method({
  49364. selector: "testInnerTemporalDependentElementsOrdered",
  49365. protocol: "tests",
  49366. fn: function (){
  49367. var self=this,$self=this;
  49368. return $core.withContext(function($ctx1) {
  49369. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49370. $2="foo".__minus_gt($globals.Array);
  49371. $ctx1.sendIdx["->"]=1;
  49372. $3="bar".__minus_gt((2));
  49373. $ctx1.sendIdx["->"]=2;
  49374. $1=[$2,$3];
  49375. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49376. $ctx1.sendIdx["should:return:"]=1;
  49377. $5="foo".__minus_gt($globals.Array);
  49378. $ctx1.sendIdx["->"]=3;
  49379. $6="bar".__minus_gt((2));
  49380. $ctx1.sendIdx["->"]=4;
  49381. $4=[$5,$6];
  49382. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49383. $ctx1.sendIdx["should:return:"]=2;
  49384. $8="foo".__minus_gt((1));
  49385. $ctx1.sendIdx["->"]=5;
  49386. $9="bar".__minus_gt((2));
  49387. $ctx1.sendIdx["->"]=6;
  49388. $7=[$8,$9];
  49389. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49390. $ctx1.sendIdx["should:return:"]=3;
  49391. $11="foo".__minus_gt((1));
  49392. $ctx1.sendIdx["->"]=7;
  49393. $10=[$11,"bar".__minus_gt((2))];
  49394. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49395. $ctx1.sendIdx["should:return:"]=4;
  49396. $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)]));
  49397. return self;
  49398. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49399. },
  49400. args: [],
  49401. 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}.",
  49402. referencedClasses: ["Array"],
  49403. messageSends: ["should:return:", "->"]
  49404. }),
  49405. $globals.CodeGeneratorTest);
  49406. $core.addMethod(
  49407. $core.method({
  49408. selector: "testLexicalScope",
  49409. protocol: "tests",
  49410. fn: function (){
  49411. var self=this,$self=this;
  49412. return $core.withContext(function($ctx1) {
  49413. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49414. return self;
  49415. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49416. },
  49417. args: [],
  49418. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49419. referencedClasses: [],
  49420. messageSends: ["should:return:"]
  49421. }),
  49422. $globals.CodeGeneratorTest);
  49423. $core.addMethod(
  49424. $core.method({
  49425. selector: "testLiterals",
  49426. protocol: "tests",
  49427. fn: function (){
  49428. var self=this,$self=this;
  49429. return $core.withContext(function($ctx1) {
  49430. $self._should_return_("foo ^ 1",(1));
  49431. $ctx1.sendIdx["should:return:"]=1;
  49432. $self._should_return_("foo ^ 'hello'","hello");
  49433. $ctx1.sendIdx["should:return:"]=2;
  49434. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49435. $ctx1.sendIdx["should:return:"]=3;
  49436. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49437. $ctx1.sendIdx["should:return:"]=4;
  49438. $self._should_return_("foo ^ true",true);
  49439. $ctx1.sendIdx["should:return:"]=5;
  49440. $self._should_return_("foo ^ false",false);
  49441. $ctx1.sendIdx["should:return:"]=6;
  49442. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49443. $ctx1.sendIdx["should:return:"]=7;
  49444. $self._should_return_("foo ^ #hello","hello");
  49445. $ctx1.sendIdx["should:return:"]=8;
  49446. $self._should_return_("foo ^ $h","h");
  49447. $ctx1.sendIdx["should:return:"]=9;
  49448. $self._should_return_("foo ^ -123.456",(-123.456));
  49449. $ctx1.sendIdx["should:return:"]=10;
  49450. $self._should_return_("foo ^ -2.5e4",(-25000));
  49451. return self;
  49452. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49453. },
  49454. args: [],
  49455. 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.",
  49456. referencedClasses: [],
  49457. messageSends: ["should:return:"]
  49458. }),
  49459. $globals.CodeGeneratorTest);
  49460. $core.addMethod(
  49461. $core.method({
  49462. selector: "testLocalReturn",
  49463. protocol: "tests",
  49464. fn: function (){
  49465. var self=this,$self=this;
  49466. return $core.withContext(function($ctx1) {
  49467. $self._should_return_("foo ^ 1",(1));
  49468. $ctx1.sendIdx["should:return:"]=1;
  49469. $self._should_return_("foo ^ 1 + 1",(2));
  49470. $ctx1.sendIdx["should:return:"]=2;
  49471. $self._should_return_("foo ",$self["@receiver"]);
  49472. $ctx1.sendIdx["should:return:"]=3;
  49473. $self._should_return_("foo self asString",$self["@receiver"]);
  49474. $ctx1.sendIdx["should:return:"]=4;
  49475. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49476. return self;
  49477. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49478. },
  49479. args: [],
  49480. 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",
  49481. referencedClasses: [],
  49482. messageSends: ["should:return:"]
  49483. }),
  49484. $globals.CodeGeneratorTest);
  49485. $core.addMethod(
  49486. $core.method({
  49487. selector: "testMessageSends",
  49488. protocol: "tests",
  49489. fn: function (){
  49490. var self=this,$self=this;
  49491. return $core.withContext(function($ctx1) {
  49492. $self._should_return_("foo ^ 1 asString","1");
  49493. $ctx1.sendIdx["should:return:"]=1;
  49494. $self._should_return_("foo ^ 1 + 1",(2));
  49495. $ctx1.sendIdx["should:return:"]=2;
  49496. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49497. $ctx1.sendIdx["should:return:"]=3;
  49498. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49499. $ctx1.sendIdx["should:return:"]=4;
  49500. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49501. return self;
  49502. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49503. },
  49504. args: [],
  49505. 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)",
  49506. referencedClasses: [],
  49507. messageSends: ["should:return:"]
  49508. }),
  49509. $globals.CodeGeneratorTest);
  49510. $core.addMethod(
  49511. $core.method({
  49512. selector: "testMistypedPragmaJSStatement",
  49513. protocol: "tests",
  49514. fn: function (){
  49515. var self=this,$self=this;
  49516. return $core.withContext(function($ctx1) {
  49517. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49518. return self;
  49519. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49520. },
  49521. args: [],
  49522. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49523. referencedClasses: ["ParseError"],
  49524. messageSends: ["should:receiver:raise:"]
  49525. }),
  49526. $globals.CodeGeneratorTest);
  49527. $core.addMethod(
  49528. $core.method({
  49529. selector: "testMultipleSequences",
  49530. protocol: "tests",
  49531. fn: function (){
  49532. var self=this,$self=this;
  49533. return $core.withContext(function($ctx1) {
  49534. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49535. return self;
  49536. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49537. },
  49538. args: [],
  49539. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49540. referencedClasses: [],
  49541. messageSends: ["should:return:"]
  49542. }),
  49543. $globals.CodeGeneratorTest);
  49544. $core.addMethod(
  49545. $core.method({
  49546. selector: "testMutableLiterals",
  49547. protocol: "tests",
  49548. fn: function (){
  49549. var self=this,$self=this;
  49550. return $core.withContext(function($ctx1) {
  49551. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49552. return self;
  49553. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49554. },
  49555. args: [],
  49556. 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)",
  49557. referencedClasses: [],
  49558. messageSends: ["should:return:"]
  49559. }),
  49560. $globals.CodeGeneratorTest);
  49561. $core.addMethod(
  49562. $core.method({
  49563. selector: "testNestedIfTrue",
  49564. protocol: "tests",
  49565. fn: function (){
  49566. var self=this,$self=this;
  49567. return $core.withContext(function($ctx1) {
  49568. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49569. $ctx1.sendIdx["should:return:"]=1;
  49570. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49571. $ctx1.sendIdx["should:return:"]=2;
  49572. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49573. $ctx1.sendIdx["should:return:"]=3;
  49574. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49575. return self;
  49576. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49577. },
  49578. args: [],
  49579. 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.",
  49580. referencedClasses: [],
  49581. messageSends: ["should:return:"]
  49582. }),
  49583. $globals.CodeGeneratorTest);
  49584. $core.addMethod(
  49585. $core.method({
  49586. selector: "testNestedSends",
  49587. protocol: "tests",
  49588. fn: function (){
  49589. var self=this,$self=this;
  49590. return $core.withContext(function($ctx1) {
  49591. $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());
  49592. return self;
  49593. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49594. },
  49595. args: [],
  49596. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49597. referencedClasses: ["Point"],
  49598. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49599. }),
  49600. $globals.CodeGeneratorTest);
  49601. $core.addMethod(
  49602. $core.method({
  49603. selector: "testNonLocalReturn",
  49604. protocol: "tests",
  49605. fn: function (){
  49606. var self=this,$self=this;
  49607. return $core.withContext(function($ctx1) {
  49608. $self._should_return_("foo [ ^ 1 ] value",(1));
  49609. $ctx1.sendIdx["should:return:"]=1;
  49610. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49611. $ctx1.sendIdx["should:return:"]=2;
  49612. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49613. $ctx1.sendIdx["should:return:"]=3;
  49614. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49615. return self;
  49616. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49617. },
  49618. args: [],
  49619. 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",
  49620. referencedClasses: [],
  49621. messageSends: ["should:return:"]
  49622. }),
  49623. $globals.CodeGeneratorTest);
  49624. $core.addMethod(
  49625. $core.method({
  49626. selector: "testPascalCaseGlobal",
  49627. protocol: "tests",
  49628. fn: function (){
  49629. var self=this,$self=this;
  49630. return $core.withContext(function($ctx1) {
  49631. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49632. $ctx1.sendIdx["should:return:"]=1;
  49633. $self._should_return_("foo ^NonExistent",nil);
  49634. return self;
  49635. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49636. },
  49637. args: [],
  49638. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49639. referencedClasses: ["Smalltalk"],
  49640. messageSends: ["should:return:", "at:", "globals"]
  49641. }),
  49642. $globals.CodeGeneratorTest);
  49643. $core.addMethod(
  49644. $core.method({
  49645. selector: "testPragmaInBlock",
  49646. protocol: "tests",
  49647. fn: function (){
  49648. var self=this,$self=this;
  49649. return $core.withContext(function($ctx1) {
  49650. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self["@receiver"],$globals.CompilerError);
  49651. return self;
  49652. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49653. },
  49654. args: [],
  49655. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49656. referencedClasses: ["CompilerError"],
  49657. messageSends: ["should:receiver:raise:"]
  49658. }),
  49659. $globals.CodeGeneratorTest);
  49660. $core.addMethod(
  49661. $core.method({
  49662. selector: "testPragmaJSStatement",
  49663. protocol: "tests",
  49664. fn: function (){
  49665. var self=this,$self=this;
  49666. return $core.withContext(function($ctx1) {
  49667. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49668. return self;
  49669. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49670. },
  49671. args: [],
  49672. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49673. referencedClasses: [],
  49674. messageSends: ["should:return:"]
  49675. }),
  49676. $globals.CodeGeneratorTest);
  49677. $core.addMethod(
  49678. $core.method({
  49679. selector: "testRootSuperSend",
  49680. protocol: "tests",
  49681. fn: function (){
  49682. var self=this,$self=this;
  49683. return $core.withContext(function($ctx1) {
  49684. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49685. return self;
  49686. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49687. },
  49688. args: [],
  49689. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49690. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49691. messageSends: ["should:receiver:raise:", "new"]
  49692. }),
  49693. $globals.CodeGeneratorTest);
  49694. $core.addMethod(
  49695. $core.method({
  49696. selector: "testSendReceiverAndArgumentsOrdered",
  49697. protocol: "tests",
  49698. fn: function (){
  49699. var self=this,$self=this;
  49700. return $core.withContext(function($ctx1) {
  49701. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49702. $ctx1.sendIdx["should:return:"]=1;
  49703. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49704. return self;
  49705. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49706. },
  49707. args: [],
  49708. 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}.",
  49709. referencedClasses: ["Array"],
  49710. messageSends: ["should:return:"]
  49711. }),
  49712. $globals.CodeGeneratorTest);
  49713. $core.addMethod(
  49714. $core.method({
  49715. selector: "testSuperSend",
  49716. protocol: "tests",
  49717. fn: function (){
  49718. var self=this,$self=this;
  49719. return $core.withContext(function($ctx1) {
  49720. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49721. return self;
  49722. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49723. },
  49724. args: [],
  49725. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49726. referencedClasses: [],
  49727. messageSends: ["should:receiver:return:"]
  49728. }),
  49729. $globals.CodeGeneratorTest);
  49730. $core.addMethod(
  49731. $core.method({
  49732. selector: "testTempVariables",
  49733. protocol: "tests",
  49734. fn: function (){
  49735. var self=this,$self=this;
  49736. return $core.withContext(function($ctx1) {
  49737. $self._should_return_("foo | a | ^ a",nil);
  49738. $ctx1.sendIdx["should:return:"]=1;
  49739. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49740. $ctx1.sendIdx["should:return:"]=2;
  49741. $self._should_return_("foo | a b c | ^ c",nil);
  49742. $ctx1.sendIdx["should:return:"]=3;
  49743. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49744. $ctx1.sendIdx["should:return:"]=4;
  49745. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49746. $ctx1.sendIdx["should:return:"]=5;
  49747. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49748. return self;
  49749. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49750. },
  49751. args: [],
  49752. 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.",
  49753. referencedClasses: [],
  49754. messageSends: ["should:return:"]
  49755. }),
  49756. $globals.CodeGeneratorTest);
  49757. $core.addMethod(
  49758. $core.method({
  49759. selector: "testThisContext",
  49760. protocol: "tests",
  49761. fn: function (){
  49762. var self=this,$self=this;
  49763. return $core.withContext(function($ctx1) {
  49764. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49765. return self;
  49766. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49767. },
  49768. args: [],
  49769. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49770. referencedClasses: [],
  49771. messageSends: ["should:return:"]
  49772. }),
  49773. $globals.CodeGeneratorTest);
  49774. $core.addMethod(
  49775. $core.method({
  49776. selector: "testUnknownPragma",
  49777. protocol: "tests",
  49778. fn: function (){
  49779. var self=this,$self=this;
  49780. return $core.withContext(function($ctx1) {
  49781. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49782. $ctx1.sendIdx["should:return:"]=1;
  49783. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49784. return self;
  49785. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49786. },
  49787. args: [],
  49788. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  49789. referencedClasses: [],
  49790. messageSends: ["should:return:"]
  49791. }),
  49792. $globals.CodeGeneratorTest);
  49793. $core.addMethod(
  49794. $core.method({
  49795. selector: "testifFalse",
  49796. protocol: "tests",
  49797. fn: function (){
  49798. var self=this,$self=this;
  49799. return $core.withContext(function($ctx1) {
  49800. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49801. $ctx1.sendIdx["should:return:"]=1;
  49802. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49803. $ctx1.sendIdx["should:return:"]=2;
  49804. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49805. $ctx1.sendIdx["should:return:"]=3;
  49806. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49807. return self;
  49808. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49809. },
  49810. args: [],
  49811. 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.",
  49812. referencedClasses: [],
  49813. messageSends: ["should:return:"]
  49814. }),
  49815. $globals.CodeGeneratorTest);
  49816. $core.addMethod(
  49817. $core.method({
  49818. selector: "testifFalseIfTrue",
  49819. protocol: "tests",
  49820. fn: function (){
  49821. var self=this,$self=this;
  49822. return $core.withContext(function($ctx1) {
  49823. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49824. $ctx1.sendIdx["should:return:"]=1;
  49825. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49826. $ctx1.sendIdx["should:return:"]=2;
  49827. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49828. $ctx1.sendIdx["should:return:"]=3;
  49829. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49830. return self;
  49831. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49832. },
  49833. args: [],
  49834. 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.",
  49835. referencedClasses: [],
  49836. messageSends: ["should:return:"]
  49837. }),
  49838. $globals.CodeGeneratorTest);
  49839. $core.addMethod(
  49840. $core.method({
  49841. selector: "testifNil",
  49842. protocol: "tests",
  49843. fn: function (){
  49844. var self=this,$self=this;
  49845. return $core.withContext(function($ctx1) {
  49846. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49847. $ctx1.sendIdx["should:return:"]=1;
  49848. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49849. $ctx1.sendIdx["should:return:"]=2;
  49850. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49851. $ctx1.sendIdx["should:return:"]=3;
  49852. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49853. return self;
  49854. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49855. },
  49856. args: [],
  49857. 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.",
  49858. referencedClasses: [],
  49859. messageSends: ["should:return:"]
  49860. }),
  49861. $globals.CodeGeneratorTest);
  49862. $core.addMethod(
  49863. $core.method({
  49864. selector: "testifNilIfNotNil",
  49865. protocol: "tests",
  49866. fn: function (){
  49867. var self=this,$self=this;
  49868. return $core.withContext(function($ctx1) {
  49869. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49870. $ctx1.sendIdx["should:return:"]=1;
  49871. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49872. $ctx1.sendIdx["should:return:"]=2;
  49873. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49874. $ctx1.sendIdx["should:return:"]=3;
  49875. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49876. return self;
  49877. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49878. },
  49879. args: [],
  49880. 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.",
  49881. referencedClasses: [],
  49882. messageSends: ["should:return:"]
  49883. }),
  49884. $globals.CodeGeneratorTest);
  49885. $core.addMethod(
  49886. $core.method({
  49887. selector: "testifNotNil",
  49888. protocol: "tests",
  49889. fn: function (){
  49890. var self=this,$self=this;
  49891. return $core.withContext(function($ctx1) {
  49892. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49893. $ctx1.sendIdx["should:return:"]=1;
  49894. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49895. $ctx1.sendIdx["should:return:"]=2;
  49896. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49897. $ctx1.sendIdx["should:return:"]=3;
  49898. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49899. return self;
  49900. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49901. },
  49902. args: [],
  49903. 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.",
  49904. referencedClasses: [],
  49905. messageSends: ["should:return:"]
  49906. }),
  49907. $globals.CodeGeneratorTest);
  49908. $core.addMethod(
  49909. $core.method({
  49910. selector: "testifNotNilWithArgument",
  49911. protocol: "tests",
  49912. fn: function (){
  49913. var self=this,$self=this;
  49914. return $core.withContext(function($ctx1) {
  49915. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49916. $ctx1.sendIdx["should:return:"]=1;
  49917. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49918. $ctx1.sendIdx["should:return:"]=2;
  49919. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49920. $ctx1.sendIdx["should:return:"]=3;
  49921. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49922. $ctx1.sendIdx["should:return:"]=4;
  49923. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49924. $ctx1.sendIdx["should:return:"]=5;
  49925. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49926. return self;
  49927. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49928. },
  49929. args: [],
  49930. 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",
  49931. referencedClasses: [],
  49932. messageSends: ["should:return:"]
  49933. }),
  49934. $globals.CodeGeneratorTest);
  49935. $core.addMethod(
  49936. $core.method({
  49937. selector: "testifTrue",
  49938. protocol: "tests",
  49939. fn: function (){
  49940. var self=this,$self=this;
  49941. return $core.withContext(function($ctx1) {
  49942. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49943. $ctx1.sendIdx["should:return:"]=1;
  49944. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49945. $ctx1.sendIdx["should:return:"]=2;
  49946. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49947. $ctx1.sendIdx["should:return:"]=3;
  49948. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49949. return self;
  49950. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49951. },
  49952. args: [],
  49953. 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.",
  49954. referencedClasses: [],
  49955. messageSends: ["should:return:"]
  49956. }),
  49957. $globals.CodeGeneratorTest);
  49958. $core.addMethod(
  49959. $core.method({
  49960. selector: "testifTrueIfFalse",
  49961. protocol: "tests",
  49962. fn: function (){
  49963. var self=this,$self=this;
  49964. return $core.withContext(function($ctx1) {
  49965. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49966. $ctx1.sendIdx["should:return:"]=1;
  49967. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49968. $ctx1.sendIdx["should:return:"]=2;
  49969. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49970. $ctx1.sendIdx["should:return:"]=3;
  49971. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49972. return self;
  49973. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49974. },
  49975. args: [],
  49976. 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.",
  49977. referencedClasses: [],
  49978. messageSends: ["should:return:"]
  49979. }),
  49980. $globals.CodeGeneratorTest);
  49981. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49982. $core.addMethod(
  49983. $core.method({
  49984. selector: "interpret:receiver:withArguments:",
  49985. protocol: "private",
  49986. fn: function (aString,anObject,aDictionary){
  49987. var self=this,$self=this;
  49988. var ctx,ast,interpreter;
  49989. return $core.withContext(function($ctx1) {
  49990. var $1,$2,$3,$receiver;
  49991. interpreter=$recv($globals.ASTInterpreter)._new();
  49992. $ctx1.sendIdx["new"]=1;
  49993. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49994. $1=$recv($globals.AIContext)._new();
  49995. $recv($1)._receiver_(anObject);
  49996. $recv($1)._interpreter_(interpreter);
  49997. ctx=$recv($1)._yourself();
  49998. $2=$recv(ast)._sequenceNode();
  49999. if(($receiver = $2) == null || $receiver.a$nil){
  50000. $2;
  50001. } else {
  50002. var sequence;
  50003. sequence=$receiver;
  50004. $recv($recv(sequence)._temps())._do_((function(each){
  50005. return $core.withContext(function($ctx2) {
  50006. return $recv(ctx)._defineLocal_(each);
  50007. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50008. }));
  50009. }
  50010. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  50011. return $core.withContext(function($ctx2) {
  50012. return $recv(ctx)._localAt_put_(key,value);
  50013. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  50014. }));
  50015. $3=interpreter;
  50016. $recv($3)._context_(ctx);
  50017. $recv($3)._node_(ast);
  50018. $recv($3)._enterNode();
  50019. $recv($3)._proceed();
  50020. return $recv($3)._result();
  50021. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  50022. },
  50023. args: ["aString", "anObject", "aDictionary"],
  50024. 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",
  50025. referencedClasses: ["ASTInterpreter", "AIContext"],
  50026. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  50027. }),
  50028. $globals.ASTInterpreterTest);
  50029. $core.addMethod(
  50030. $core.method({
  50031. selector: "should:receiver:return:",
  50032. protocol: "testing",
  50033. fn: function (aString,anObject,aResult){
  50034. var self=this,$self=this;
  50035. return $core.withContext(function($ctx1) {
  50036. $self["@receiver"]=anObject;
  50037. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  50038. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  50039. },
  50040. args: ["aString", "anObject", "aResult"],
  50041. 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",
  50042. referencedClasses: [],
  50043. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  50044. }),
  50045. $globals.ASTInterpreterTest);
  50046. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  50047. $core.addMethod(
  50048. $core.method({
  50049. selector: "interpret:receiver:withArguments:",
  50050. protocol: "private",
  50051. fn: function (aString,anObject,aDictionary){
  50052. var self=this,$self=this;
  50053. var ctx,ast,debugger_;
  50054. return $core.withContext(function($ctx1) {
  50055. var $1,$2,$3,$4,$5,$receiver;
  50056. $1=$recv($globals.AIContext)._new();
  50057. $ctx1.sendIdx["new"]=1;
  50058. $recv($1)._receiver_(anObject);
  50059. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  50060. ctx=$recv($1)._yourself();
  50061. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  50062. $2=$recv(ast)._sequenceNode();
  50063. if(($receiver = $2) == null || $receiver.a$nil){
  50064. $2;
  50065. } else {
  50066. var sequence;
  50067. sequence=$receiver;
  50068. $recv($recv(sequence)._temps())._do_((function(each){
  50069. return $core.withContext(function($ctx2) {
  50070. return $recv(ctx)._defineLocal_(each);
  50071. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50072. }));
  50073. }
  50074. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  50075. return $core.withContext(function($ctx2) {
  50076. return $recv(ctx)._localAt_put_(key,value);
  50077. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  50078. }));
  50079. $3=$recv(ctx)._interpreter();
  50080. $ctx1.sendIdx["interpreter"]=1;
  50081. $recv($3)._context_(ctx);
  50082. $ctx1.sendIdx["context:"]=1;
  50083. $4=$recv(ctx)._interpreter();
  50084. $recv($4)._node_(ast);
  50085. $recv($4)._enterNode();
  50086. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  50087. $5=debugger_;
  50088. $recv($5)._proceed();
  50089. return $recv($5)._result();
  50090. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  50091. },
  50092. args: ["aString", "anObject", "aDictionary"],
  50093. 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",
  50094. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  50095. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  50096. }),
  50097. $globals.ASTDebuggerTest);
  50098. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  50099. $core.addMethod(
  50100. $core.method({
  50101. selector: "codeGeneratorClass",
  50102. protocol: "accessing",
  50103. fn: function (){
  50104. var self=this,$self=this;
  50105. return $globals.InliningCodeGenerator;
  50106. },
  50107. args: [],
  50108. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  50109. referencedClasses: ["InliningCodeGenerator"],
  50110. messageSends: []
  50111. }),
  50112. $globals.InliningCodeGeneratorTest);
  50113. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  50114. $core.addMethod(
  50115. $core.method({
  50116. selector: "testClassRefVar",
  50117. protocol: "tests",
  50118. fn: function (){
  50119. var self=this,$self=this;
  50120. var node;
  50121. return $core.withContext(function($ctx1) {
  50122. var $1,$2;
  50123. $1=$recv($globals.VariableNode)._new();
  50124. $ctx1.sendIdx["new"]=1;
  50125. $recv($1)._value_("Object");
  50126. node=$recv($1)._yourself();
  50127. $2=$recv($globals.SemanticAnalyzer)._new();
  50128. $ctx1.sendIdx["new"]=2;
  50129. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  50130. $recv($2)._visit_(node);
  50131. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  50132. return self;
  50133. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  50134. },
  50135. args: [],
  50136. 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",
  50137. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  50138. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  50139. }),
  50140. $globals.ScopeVarTest);
  50141. $core.addMethod(
  50142. $core.method({
  50143. selector: "testInstanceVar",
  50144. protocol: "tests",
  50145. fn: function (){
  50146. var self=this,$self=this;
  50147. var node,scope;
  50148. return $core.withContext(function($ctx1) {
  50149. var $1;
  50150. $1=$recv($globals.VariableNode)._new();
  50151. $ctx1.sendIdx["new"]=1;
  50152. $recv($1)._value_("bzzz");
  50153. node=$recv($1)._yourself();
  50154. scope=$recv($globals.MethodLexicalScope)._new();
  50155. $recv(scope)._addIVar_("bzzz");
  50156. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  50157. return self;
  50158. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50159. },
  50160. args: [],
  50161. 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",
  50162. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50163. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  50164. }),
  50165. $globals.ScopeVarTest);
  50166. $core.addMethod(
  50167. $core.method({
  50168. selector: "testPseudoVar",
  50169. protocol: "tests",
  50170. fn: function (){
  50171. var self=this,$self=this;
  50172. var node,pseudoVars;
  50173. return $core.withContext(function($ctx1) {
  50174. var $1;
  50175. pseudoVars=["self", "super", "true", "false", "nil"];
  50176. $recv(pseudoVars)._do_((function(each){
  50177. return $core.withContext(function($ctx2) {
  50178. $1=$recv($globals.VariableNode)._new();
  50179. $ctx2.sendIdx["new"]=1;
  50180. $recv($1)._value_(each);
  50181. node=$recv($1)._yourself();
  50182. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  50183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50184. }));
  50185. return self;
  50186. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  50187. },
  50188. args: [],
  50189. 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]",
  50190. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50191. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50192. }),
  50193. $globals.ScopeVarTest);
  50194. $core.addMethod(
  50195. $core.method({
  50196. selector: "testTempVar",
  50197. protocol: "tests",
  50198. fn: function (){
  50199. var self=this,$self=this;
  50200. var node,scope;
  50201. return $core.withContext(function($ctx1) {
  50202. var $1;
  50203. $1=$recv($globals.VariableNode)._new();
  50204. $ctx1.sendIdx["new"]=1;
  50205. $recv($1)._value_("bzzz");
  50206. node=$recv($1)._yourself();
  50207. scope=$recv($globals.MethodLexicalScope)._new();
  50208. $recv(scope)._addTemp_("bzzz");
  50209. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50210. return self;
  50211. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50212. },
  50213. args: [],
  50214. 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",
  50215. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50216. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50217. }),
  50218. $globals.ScopeVarTest);
  50219. $core.addMethod(
  50220. $core.method({
  50221. selector: "testUnknownVar",
  50222. protocol: "tests",
  50223. fn: function (){
  50224. var self=this,$self=this;
  50225. var node;
  50226. return $core.withContext(function($ctx1) {
  50227. var $1;
  50228. $1=$recv($globals.VariableNode)._new();
  50229. $ctx1.sendIdx["new"]=1;
  50230. $recv($1)._value_("bzzz");
  50231. node=$recv($1)._yourself();
  50232. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50233. return self;
  50234. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50235. },
  50236. args: [],
  50237. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50238. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50239. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50240. }),
  50241. $globals.ScopeVarTest);
  50242. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50243. $core.addMethod(
  50244. $core.method({
  50245. selector: "setUp",
  50246. protocol: "running",
  50247. fn: function (){
  50248. var self=this,$self=this;
  50249. return $core.withContext(function($ctx1) {
  50250. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50251. return self;
  50252. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50253. },
  50254. args: [],
  50255. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50256. referencedClasses: ["SemanticAnalyzer", "Object"],
  50257. messageSends: ["on:"]
  50258. }),
  50259. $globals.SemanticAnalyzerTest);
  50260. $core.addMethod(
  50261. $core.method({
  50262. selector: "testAssignment",
  50263. protocol: "tests",
  50264. fn: function (){
  50265. var self=this,$self=this;
  50266. var src,ast;
  50267. return $core.withContext(function($ctx1) {
  50268. src="foo self := 1";
  50269. ast=$recv($globals.Smalltalk)._parse_(src);
  50270. $self._should_raise_((function(){
  50271. return $core.withContext(function($ctx2) {
  50272. return $recv($self["@analyzer"])._visit_(ast);
  50273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50274. }),$globals.InvalidAssignmentError);
  50275. return self;
  50276. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50277. },
  50278. args: [],
  50279. 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",
  50280. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50281. messageSends: ["parse:", "should:raise:", "visit:"]
  50282. }),
  50283. $globals.SemanticAnalyzerTest);
  50284. $core.addMethod(
  50285. $core.method({
  50286. selector: "testNonLocalReturn",
  50287. protocol: "tests",
  50288. fn: function (){
  50289. var self=this,$self=this;
  50290. var src,ast;
  50291. return $core.withContext(function($ctx1) {
  50292. src="foo | a | a + 1. ^ a";
  50293. ast=$recv($globals.Smalltalk)._parse_(src);
  50294. $recv($self["@analyzer"])._visit_(ast);
  50295. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50296. return self;
  50297. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50298. },
  50299. args: [],
  50300. 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",
  50301. referencedClasses: ["Smalltalk"],
  50302. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50303. }),
  50304. $globals.SemanticAnalyzerTest);
  50305. $core.addMethod(
  50306. $core.method({
  50307. selector: "testNonLocalReturn2",
  50308. protocol: "tests",
  50309. fn: function (){
  50310. var self=this,$self=this;
  50311. var src,ast;
  50312. return $core.withContext(function($ctx1) {
  50313. src="foo | a | a + 1. [ [ ^ a] ]";
  50314. ast=$recv($globals.Smalltalk)._parse_(src);
  50315. $recv($self["@analyzer"])._visit_(ast);
  50316. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50317. return self;
  50318. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50319. },
  50320. args: [],
  50321. 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",
  50322. referencedClasses: ["Smalltalk"],
  50323. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50324. }),
  50325. $globals.SemanticAnalyzerTest);
  50326. $core.addMethod(
  50327. $core.method({
  50328. selector: "testScope",
  50329. protocol: "tests",
  50330. fn: function (){
  50331. var self=this,$self=this;
  50332. var src,ast;
  50333. return $core.withContext(function($ctx1) {
  50334. var $4,$3,$2,$1;
  50335. src="foo | a | a + 1. [ | b | b := a ]";
  50336. ast=$recv($globals.Smalltalk)._parse_(src);
  50337. $recv($self["@analyzer"])._visit_(ast);
  50338. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50339. $ctx1.sendIdx["dagChildren"]=1;
  50340. $3=$recv($4)._last();
  50341. $2=$recv($3)._scope();
  50342. $ctx1.sendIdx["scope"]=1;
  50343. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50344. $self._deny_($1);
  50345. return self;
  50346. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50347. },
  50348. args: [],
  50349. 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.",
  50350. referencedClasses: ["Smalltalk"],
  50351. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50352. }),
  50353. $globals.SemanticAnalyzerTest);
  50354. $core.addMethod(
  50355. $core.method({
  50356. selector: "testScope2",
  50357. protocol: "tests",
  50358. fn: function (){
  50359. var self=this,$self=this;
  50360. var src,ast;
  50361. return $core.withContext(function($ctx1) {
  50362. var $8,$7,$6,$5,$4,$3,$2,$1;
  50363. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50364. ast=$recv($globals.Smalltalk)._parse_(src);
  50365. $recv($self["@analyzer"])._visit_(ast);
  50366. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50367. $ctx1.sendIdx["dagChildren"]=3;
  50368. $7=$recv($8)._last();
  50369. $6=$recv($7)._dagChildren();
  50370. $ctx1.sendIdx["dagChildren"]=2;
  50371. $5=$recv($6)._first();
  50372. $ctx1.sendIdx["first"]=2;
  50373. $4=$recv($5)._dagChildren();
  50374. $ctx1.sendIdx["dagChildren"]=1;
  50375. $3=$recv($4)._first();
  50376. $ctx1.sendIdx["first"]=1;
  50377. $2=$recv($3)._scope();
  50378. $ctx1.sendIdx["scope"]=1;
  50379. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50380. $self._deny_($1);
  50381. return self;
  50382. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50383. },
  50384. args: [],
  50385. 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.",
  50386. referencedClasses: ["Smalltalk"],
  50387. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50388. }),
  50389. $globals.SemanticAnalyzerTest);
  50390. $core.addMethod(
  50391. $core.method({
  50392. selector: "testScopeLevel",
  50393. protocol: "tests",
  50394. fn: function (){
  50395. var self=this,$self=this;
  50396. var src,ast;
  50397. return $core.withContext(function($ctx1) {
  50398. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50399. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50400. ast=$recv($globals.Smalltalk)._parse_(src);
  50401. $recv($self["@analyzer"])._visit_(ast);
  50402. $2=$recv(ast)._scope();
  50403. $ctx1.sendIdx["scope"]=1;
  50404. $1=$recv($2)._scopeLevel();
  50405. $ctx1.sendIdx["scopeLevel"]=1;
  50406. $self._assert_equals_($1,(1));
  50407. $ctx1.sendIdx["assert:equals:"]=1;
  50408. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50409. $ctx1.sendIdx["dagChildren"]=3;
  50410. $9=$recv($10)._last();
  50411. $8=$recv($9)._dagChildren();
  50412. $ctx1.sendIdx["dagChildren"]=2;
  50413. $7=$recv($8)._first();
  50414. $ctx1.sendIdx["first"]=2;
  50415. $6=$recv($7)._dagChildren();
  50416. $ctx1.sendIdx["dagChildren"]=1;
  50417. $5=$recv($6)._first();
  50418. $ctx1.sendIdx["first"]=1;
  50419. $4=$recv($5)._scope();
  50420. $3=$recv($4)._scopeLevel();
  50421. $self._assert_equals_($3,(3));
  50422. return self;
  50423. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50424. },
  50425. args: [],
  50426. 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",
  50427. referencedClasses: ["Smalltalk"],
  50428. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50429. }),
  50430. $globals.SemanticAnalyzerTest);
  50431. $core.addMethod(
  50432. $core.method({
  50433. selector: "testUnknownVariables",
  50434. protocol: "tests",
  50435. fn: function (){
  50436. var self=this,$self=this;
  50437. var src,ast;
  50438. return $core.withContext(function($ctx1) {
  50439. src="foo | a | b + a";
  50440. ast=$recv($globals.Smalltalk)._parse_(src);
  50441. $self._should_raise_((function(){
  50442. return $core.withContext(function($ctx2) {
  50443. return $recv($self["@analyzer"])._visit_(ast);
  50444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50445. }),$globals.UnknownVariableError);
  50446. return self;
  50447. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50448. },
  50449. args: [],
  50450. 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",
  50451. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50452. messageSends: ["parse:", "should:raise:", "visit:"]
  50453. }),
  50454. $globals.SemanticAnalyzerTest);
  50455. $core.addMethod(
  50456. $core.method({
  50457. selector: "testUnknownVariablesWithScope",
  50458. protocol: "tests",
  50459. fn: function (){
  50460. var self=this,$self=this;
  50461. var src,ast;
  50462. return $core.withContext(function($ctx1) {
  50463. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50464. ast=$recv($globals.Smalltalk)._parse_(src);
  50465. $self._should_raise_((function(){
  50466. return $core.withContext(function($ctx2) {
  50467. return $recv($self["@analyzer"])._visit_(ast);
  50468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50469. }),$globals.UnknownVariableError);
  50470. return self;
  50471. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50472. },
  50473. args: [],
  50474. 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",
  50475. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50476. messageSends: ["parse:", "should:raise:", "visit:"]
  50477. }),
  50478. $globals.SemanticAnalyzerTest);
  50479. $core.addMethod(
  50480. $core.method({
  50481. selector: "testVariableShadowing",
  50482. protocol: "tests",
  50483. fn: function (){
  50484. var self=this,$self=this;
  50485. var src,ast;
  50486. return $core.withContext(function($ctx1) {
  50487. src="foo | a | a + 1";
  50488. ast=$recv($globals.Smalltalk)._parse_(src);
  50489. $recv($self["@analyzer"])._visit_(ast);
  50490. return self;
  50491. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50492. },
  50493. args: [],
  50494. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50495. referencedClasses: ["Smalltalk"],
  50496. messageSends: ["parse:", "visit:"]
  50497. }),
  50498. $globals.SemanticAnalyzerTest);
  50499. $core.addMethod(
  50500. $core.method({
  50501. selector: "testVariableShadowing2",
  50502. protocol: "tests",
  50503. fn: function (){
  50504. var self=this,$self=this;
  50505. var src,ast;
  50506. return $core.withContext(function($ctx1) {
  50507. src="foo | a | a + 1. [ | a | a := 2 ]";
  50508. ast=$recv($globals.Smalltalk)._parse_(src);
  50509. $self._should_raise_((function(){
  50510. return $core.withContext(function($ctx2) {
  50511. return $recv($self["@analyzer"])._visit_(ast);
  50512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50513. }),$globals.ShadowingVariableError);
  50514. return self;
  50515. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50516. },
  50517. args: [],
  50518. 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",
  50519. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50520. messageSends: ["parse:", "should:raise:", "visit:"]
  50521. }),
  50522. $globals.SemanticAnalyzerTest);
  50523. $core.addMethod(
  50524. $core.method({
  50525. selector: "testVariableShadowing3",
  50526. protocol: "tests",
  50527. fn: function (){
  50528. var self=this,$self=this;
  50529. var src,ast;
  50530. return $core.withContext(function($ctx1) {
  50531. src="foo | a | a + 1. [ | b | b := 2 ]";
  50532. ast=$recv($globals.Smalltalk)._parse_(src);
  50533. $recv($self["@analyzer"])._visit_(ast);
  50534. return self;
  50535. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50536. },
  50537. args: [],
  50538. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50539. referencedClasses: ["Smalltalk"],
  50540. messageSends: ["parse:", "visit:"]
  50541. }),
  50542. $globals.SemanticAnalyzerTest);
  50543. $core.addMethod(
  50544. $core.method({
  50545. selector: "testVariableShadowing4",
  50546. protocol: "tests",
  50547. fn: function (){
  50548. var self=this,$self=this;
  50549. var src,ast;
  50550. return $core.withContext(function($ctx1) {
  50551. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50552. ast=$recv($globals.Smalltalk)._parse_(src);
  50553. $recv($self["@analyzer"])._visit_(ast);
  50554. return self;
  50555. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50556. },
  50557. args: [],
  50558. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50559. referencedClasses: ["Smalltalk"],
  50560. messageSends: ["parse:", "visit:"]
  50561. }),
  50562. $globals.SemanticAnalyzerTest);
  50563. $core.addMethod(
  50564. $core.method({
  50565. selector: "testVariableShadowing5",
  50566. protocol: "tests",
  50567. fn: function (){
  50568. var self=this,$self=this;
  50569. var src,ast;
  50570. return $core.withContext(function($ctx1) {
  50571. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50572. ast=$recv($globals.Smalltalk)._parse_(src);
  50573. $self._should_raise_((function(){
  50574. return $core.withContext(function($ctx2) {
  50575. return $recv($self["@analyzer"])._visit_(ast);
  50576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50577. }),$globals.ShadowingVariableError);
  50578. return self;
  50579. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50580. },
  50581. args: [],
  50582. 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",
  50583. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50584. messageSends: ["parse:", "should:raise:", "visit:"]
  50585. }),
  50586. $globals.SemanticAnalyzerTest);
  50587. $core.addMethod(
  50588. $core.method({
  50589. selector: "testVariablesLookup",
  50590. protocol: "tests",
  50591. fn: function (){
  50592. var self=this,$self=this;
  50593. var src,ast;
  50594. return $core.withContext(function($ctx1) {
  50595. 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;
  50596. src="foo | a | a + 1. [ | b | b := a ]";
  50597. ast=$recv($globals.Smalltalk)._parse_(src);
  50598. $recv($self["@analyzer"])._visit_(ast);
  50599. $7=$recv(ast)._dagChildren();
  50600. $ctx1.sendIdx["dagChildren"]=2;
  50601. $6=$recv($7)._first();
  50602. $ctx1.sendIdx["first"]=2;
  50603. $5=$recv($6)._dagChildren();
  50604. $ctx1.sendIdx["dagChildren"]=1;
  50605. $4=$recv($5)._first();
  50606. $ctx1.sendIdx["first"]=1;
  50607. $3=$recv($4)._receiver();
  50608. $ctx1.sendIdx["receiver"]=1;
  50609. $2=$recv($3)._binding();
  50610. $ctx1.sendIdx["binding"]=1;
  50611. $1=$recv($2)._isTempVar();
  50612. $ctx1.sendIdx["isTempVar"]=1;
  50613. $self._assert_($1);
  50614. $ctx1.sendIdx["assert:"]=1;
  50615. $15=$recv(ast)._dagChildren();
  50616. $ctx1.sendIdx["dagChildren"]=4;
  50617. $14=$recv($15)._first();
  50618. $ctx1.sendIdx["first"]=4;
  50619. $13=$recv($14)._dagChildren();
  50620. $ctx1.sendIdx["dagChildren"]=3;
  50621. $12=$recv($13)._first();
  50622. $ctx1.sendIdx["first"]=3;
  50623. $11=$recv($12)._receiver();
  50624. $10=$recv($11)._binding();
  50625. $ctx1.sendIdx["binding"]=2;
  50626. $9=$recv($10)._scope();
  50627. $ctx1.sendIdx["scope"]=1;
  50628. $16=$recv(ast)._scope();
  50629. $ctx1.sendIdx["scope"]=2;
  50630. $8=$recv($9).__eq_eq($16);
  50631. $ctx1.sendIdx["=="]=1;
  50632. $self._assert_($8);
  50633. $ctx1.sendIdx["assert:"]=2;
  50634. $27=$recv(ast)._dagChildren();
  50635. $ctx1.sendIdx["dagChildren"]=8;
  50636. $26=$recv($27)._first();
  50637. $ctx1.sendIdx["first"]=7;
  50638. $25=$recv($26)._dagChildren();
  50639. $ctx1.sendIdx["dagChildren"]=7;
  50640. $24=$recv($25)._last();
  50641. $ctx1.sendIdx["last"]=1;
  50642. $23=$recv($24)._dagChildren();
  50643. $ctx1.sendIdx["dagChildren"]=6;
  50644. $22=$recv($23)._first();
  50645. $ctx1.sendIdx["first"]=6;
  50646. $21=$recv($22)._dagChildren();
  50647. $ctx1.sendIdx["dagChildren"]=5;
  50648. $20=$recv($21)._first();
  50649. $ctx1.sendIdx["first"]=5;
  50650. $19=$recv($20)._left();
  50651. $ctx1.sendIdx["left"]=1;
  50652. $18=$recv($19)._binding();
  50653. $ctx1.sendIdx["binding"]=3;
  50654. $17=$recv($18)._isTempVar();
  50655. $self._assert_($17);
  50656. $ctx1.sendIdx["assert:"]=3;
  50657. $39=$recv(ast)._dagChildren();
  50658. $ctx1.sendIdx["dagChildren"]=12;
  50659. $38=$recv($39)._first();
  50660. $ctx1.sendIdx["first"]=10;
  50661. $37=$recv($38)._dagChildren();
  50662. $ctx1.sendIdx["dagChildren"]=11;
  50663. $36=$recv($37)._last();
  50664. $ctx1.sendIdx["last"]=2;
  50665. $35=$recv($36)._dagChildren();
  50666. $ctx1.sendIdx["dagChildren"]=10;
  50667. $34=$recv($35)._first();
  50668. $ctx1.sendIdx["first"]=9;
  50669. $33=$recv($34)._dagChildren();
  50670. $ctx1.sendIdx["dagChildren"]=9;
  50671. $32=$recv($33)._first();
  50672. $ctx1.sendIdx["first"]=8;
  50673. $31=$recv($32)._left();
  50674. $30=$recv($31)._binding();
  50675. $29=$recv($30)._scope();
  50676. $ctx1.sendIdx["scope"]=3;
  50677. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50678. $ctx1.sendIdx["dagChildren"]=13;
  50679. $41=$recv($42)._last();
  50680. $40=$recv($41)._scope();
  50681. $28=$recv($29).__eq_eq($40);
  50682. $self._assert_($28);
  50683. return self;
  50684. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50685. },
  50686. args: [],
  50687. 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.",
  50688. referencedClasses: ["Smalltalk"],
  50689. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50690. }),
  50691. $globals.SemanticAnalyzerTest);
  50692. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50693. $core.addMethod(
  50694. $core.method({
  50695. selector: "setUp",
  50696. protocol: "running",
  50697. fn: function (){
  50698. var self=this,$self=this;
  50699. return $core.withContext(function($ctx1) {
  50700. var $1,$3,$4,$2;
  50701. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50702. $3=$recv($globals.AIContext)._new();
  50703. $recv($3)._defineLocal_("local");
  50704. $recv($3)._localAt_put_("local",(3));
  50705. $4=$recv($3)._yourself();
  50706. $ctx1.sendIdx["yourself"]=1;
  50707. $2=$4;
  50708. $recv($1)._context_($2);
  50709. $self["@analyzer"]=$recv($1)._yourself();
  50710. return self;
  50711. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50712. },
  50713. args: [],
  50714. 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",
  50715. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50716. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50717. }),
  50718. $globals.AISemanticAnalyzerTest);
  50719. $core.addMethod(
  50720. $core.method({
  50721. selector: "testContextVariables",
  50722. protocol: "tests",
  50723. fn: function (){
  50724. var self=this,$self=this;
  50725. var src,ast;
  50726. return $core.withContext(function($ctx1) {
  50727. src="foo | a | local + a";
  50728. ast=$recv($globals.Smalltalk)._parse_(src);
  50729. $self._shouldnt_raise_((function(){
  50730. return $core.withContext(function($ctx2) {
  50731. return $recv($self["@analyzer"])._visit_(ast);
  50732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50733. }),$globals.UnknownVariableError);
  50734. return self;
  50735. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50736. },
  50737. args: [],
  50738. 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",
  50739. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50740. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50741. }),
  50742. $globals.AISemanticAnalyzerTest);
  50743. });
  50744. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50745. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50746. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50747. $core.addPackage("Kernel-Tests");
  50748. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50749. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50750. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50751. $core.addMethod(
  50752. $core.method({
  50753. selector: "testAddExtensionMethod",
  50754. protocol: "tests",
  50755. fn: function (){
  50756. var self=this,$self=this;
  50757. var method,dirty;
  50758. return $core.withContext(function($ctx1) {
  50759. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50760. $2=$self._class();
  50761. $ctx1.sendIdx["class"]=1;
  50762. $1=$recv($2)._package();
  50763. $ctx1.sendIdx["package"]=1;
  50764. dirty=$recv($1)._isDirty();
  50765. $ctx1.sendIdx["isDirty"]=1;
  50766. $4=$self._class();
  50767. $ctx1.sendIdx["class"]=2;
  50768. $3=$recv($4)._package();
  50769. $ctx1.sendIdx["package"]=2;
  50770. $recv($3)._beClean();
  50771. $5=$self._class();
  50772. $ctx1.sendIdx["class"]=3;
  50773. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50774. $8=$self._class();
  50775. $ctx1.sendIdx["class"]=4;
  50776. $7=$recv($8)._package();
  50777. $ctx1.sendIdx["package"]=3;
  50778. $6=$recv($7)._isDirty();
  50779. $self._deny_($6);
  50780. $9=$self._class();
  50781. $ctx1.sendIdx["class"]=5;
  50782. $recv($9)._removeCompiledMethod_(method);
  50783. $10=dirty;
  50784. if($core.assert($10)){
  50785. $recv($recv($self._class())._package())._beDirty();
  50786. }
  50787. return self;
  50788. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50789. },
  50790. args: [],
  50791. 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 ]",
  50792. referencedClasses: [],
  50793. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50794. }),
  50795. $globals.AnnouncementSubscriptionTest);
  50796. $core.addMethod(
  50797. $core.method({
  50798. selector: "testHandlesAnnouncement",
  50799. protocol: "tests",
  50800. fn: function (){
  50801. var self=this,$self=this;
  50802. var subscription,announcementClass1,announcementClass2,classBuilder;
  50803. return $core.withContext(function($ctx1) {
  50804. var $1,$2;
  50805. classBuilder=$recv($globals.ClassBuilder)._new();
  50806. $ctx1.sendIdx["new"]=1;
  50807. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50808. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50809. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50810. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50811. $self._assert_equals_($1,true);
  50812. $ctx1.sendIdx["assert:equals:"]=1;
  50813. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50814. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50815. $self._assert_equals_($2,true);
  50816. $ctx1.sendIdx["assert:equals:"]=2;
  50817. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50818. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50819. return self;
  50820. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50821. },
  50822. args: [],
  50823. 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.",
  50824. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50825. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50826. }),
  50827. $globals.AnnouncementSubscriptionTest);
  50828. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50829. $core.addMethod(
  50830. $core.method({
  50831. selector: "testOnDo",
  50832. protocol: "tests",
  50833. fn: function (){
  50834. var self=this,$self=this;
  50835. var counter,announcer;
  50836. return $core.withContext(function($ctx1) {
  50837. var $1,$2;
  50838. counter=(0);
  50839. announcer=$recv($globals.Announcer)._new();
  50840. $ctx1.sendIdx["new"]=1;
  50841. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50842. return $core.withContext(function($ctx2) {
  50843. counter=$recv(counter).__plus((1));
  50844. return counter;
  50845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50846. }));
  50847. $1=announcer;
  50848. $2=$recv($globals.SystemAnnouncement)._new();
  50849. $ctx1.sendIdx["new"]=2;
  50850. $recv($1)._announce_($2);
  50851. $ctx1.sendIdx["announce:"]=1;
  50852. $self._assert_equals_(counter,(1));
  50853. $ctx1.sendIdx["assert:equals:"]=1;
  50854. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50855. $self._assert_equals_(counter,(2));
  50856. return self;
  50857. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50858. },
  50859. args: [],
  50860. 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.",
  50861. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50862. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50863. }),
  50864. $globals.AnnouncerTest);
  50865. $core.addMethod(
  50866. $core.method({
  50867. selector: "testOnDoFor",
  50868. protocol: "tests",
  50869. fn: function (){
  50870. var self=this,$self=this;
  50871. var counter,announcer;
  50872. return $core.withContext(function($ctx1) {
  50873. var $1,$2,$3,$4;
  50874. counter=(0);
  50875. announcer=$recv($globals.Announcer)._new();
  50876. $ctx1.sendIdx["new"]=1;
  50877. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50878. return $core.withContext(function($ctx2) {
  50879. counter=$recv(counter).__plus((1));
  50880. return counter;
  50881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50882. }),self);
  50883. $1=announcer;
  50884. $2=$recv($globals.SystemAnnouncement)._new();
  50885. $ctx1.sendIdx["new"]=2;
  50886. $recv($1)._announce_($2);
  50887. $ctx1.sendIdx["announce:"]=1;
  50888. $self._assert_equals_(counter,(1));
  50889. $ctx1.sendIdx["assert:equals:"]=1;
  50890. $3=announcer;
  50891. $4=$recv($globals.SystemAnnouncement)._new();
  50892. $ctx1.sendIdx["new"]=3;
  50893. $recv($3)._announce_($4);
  50894. $ctx1.sendIdx["announce:"]=2;
  50895. $self._assert_equals_(counter,(2));
  50896. $ctx1.sendIdx["assert:equals:"]=2;
  50897. $recv(announcer)._unsubscribe_(self);
  50898. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50899. $self._assert_equals_(counter,(2));
  50900. return self;
  50901. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50902. },
  50903. args: [],
  50904. 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.",
  50905. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50906. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50907. }),
  50908. $globals.AnnouncerTest);
  50909. $core.addMethod(
  50910. $core.method({
  50911. selector: "testOnDoOnce",
  50912. protocol: "tests",
  50913. fn: function (){
  50914. var self=this,$self=this;
  50915. var counter,announcer;
  50916. return $core.withContext(function($ctx1) {
  50917. var $1,$2;
  50918. counter=(0);
  50919. announcer=$recv($globals.Announcer)._new();
  50920. $ctx1.sendIdx["new"]=1;
  50921. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50922. return $core.withContext(function($ctx2) {
  50923. counter=$recv(counter).__plus((1));
  50924. return counter;
  50925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50926. }));
  50927. $1=announcer;
  50928. $2=$recv($globals.SystemAnnouncement)._new();
  50929. $ctx1.sendIdx["new"]=2;
  50930. $recv($1)._announce_($2);
  50931. $ctx1.sendIdx["announce:"]=1;
  50932. $self._assert_equals_(counter,(1));
  50933. $ctx1.sendIdx["assert:equals:"]=1;
  50934. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50935. $self._assert_equals_(counter,(1));
  50936. return self;
  50937. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50938. },
  50939. args: [],
  50940. 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.",
  50941. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50942. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50943. }),
  50944. $globals.AnnouncerTest);
  50945. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50946. $core.addMethod(
  50947. $core.method({
  50948. selector: "localReturnOnDoCatch",
  50949. protocol: "fixture",
  50950. fn: function (){
  50951. var self=this,$self=this;
  50952. return $core.withContext(function($ctx1) {
  50953. var $early={};
  50954. try {
  50955. $recv((function(){
  50956. throw $early=[(2)];
  50957. }))._on_do_($globals.Error,(function(){
  50958. }));
  50959. return (3);
  50960. }
  50961. catch(e) {if(e===$early)return e[0]; throw e}
  50962. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50963. },
  50964. args: [],
  50965. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50966. referencedClasses: ["Error"],
  50967. messageSends: ["on:do:"]
  50968. }),
  50969. $globals.BlockClosureTest);
  50970. $core.addMethod(
  50971. $core.method({
  50972. selector: "localReturnOnDoMiss",
  50973. protocol: "fixture",
  50974. fn: function (){
  50975. var self=this,$self=this;
  50976. return $core.withContext(function($ctx1) {
  50977. var $early={};
  50978. try {
  50979. $recv((function(){
  50980. throw $early=[(2)];
  50981. }))._on_do_($globals.Class,(function(){
  50982. }));
  50983. return (3);
  50984. }
  50985. catch(e) {if(e===$early)return e[0]; throw e}
  50986. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50987. },
  50988. args: [],
  50989. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50990. referencedClasses: ["Class"],
  50991. messageSends: ["on:do:"]
  50992. }),
  50993. $globals.BlockClosureTest);
  50994. $core.addMethod(
  50995. $core.method({
  50996. selector: "testCanClearInterval",
  50997. protocol: "tests",
  50998. fn: function (){
  50999. var self=this,$self=this;
  51000. return $core.withContext(function($ctx1) {
  51001. $self._shouldnt_raise_((function(){
  51002. return $core.withContext(function($ctx2) {
  51003. return $recv($recv((function(){
  51004. return $core.withContext(function($ctx3) {
  51005. return $recv($recv($globals.Error)._new())._signal();
  51006. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51007. }))._valueWithInterval_((0)))._clearInterval();
  51008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51009. }),$globals.Error);
  51010. return self;
  51011. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  51012. },
  51013. args: [],
  51014. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  51015. referencedClasses: ["Error"],
  51016. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  51017. }),
  51018. $globals.BlockClosureTest);
  51019. $core.addMethod(
  51020. $core.method({
  51021. selector: "testCanClearTimeout",
  51022. protocol: "tests",
  51023. fn: function (){
  51024. var self=this,$self=this;
  51025. return $core.withContext(function($ctx1) {
  51026. $self._shouldnt_raise_((function(){
  51027. return $core.withContext(function($ctx2) {
  51028. return $recv($recv((function(){
  51029. return $core.withContext(function($ctx3) {
  51030. return $recv($recv($globals.Error)._new())._signal();
  51031. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51032. }))._valueWithTimeout_((0)))._clearTimeout();
  51033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51034. }),$globals.Error);
  51035. return self;
  51036. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  51037. },
  51038. args: [],
  51039. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  51040. referencedClasses: ["Error"],
  51041. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  51042. }),
  51043. $globals.BlockClosureTest);
  51044. $core.addMethod(
  51045. $core.method({
  51046. selector: "testCompiledSource",
  51047. protocol: "tests",
  51048. fn: function (){
  51049. var self=this,$self=this;
  51050. return $core.withContext(function($ctx1) {
  51051. $self._assert_($recv($recv((function(){
  51052. return $core.withContext(function($ctx2) {
  51053. return (1).__plus((1));
  51054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51055. }))._compiledSource())._includesSubString_("function"));
  51056. return self;
  51057. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  51058. },
  51059. args: [],
  51060. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  51061. referencedClasses: [],
  51062. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  51063. }),
  51064. $globals.BlockClosureTest);
  51065. $core.addMethod(
  51066. $core.method({
  51067. selector: "testCurrySelf",
  51068. protocol: "tests",
  51069. fn: function (){
  51070. var self=this,$self=this;
  51071. var curriedMethod,array;
  51072. return $core.withContext(function($ctx1) {
  51073. curriedMethod=$recv($recv((function(selfarg,x){
  51074. return $core.withContext(function($ctx2) {
  51075. return $recv(selfarg)._at_(x);
  51076. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  51077. }))._currySelf())._asCompiledMethod_("foo:");
  51078. array=[(3), (1), (4)];
  51079. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  51080. $recv((function(){
  51081. return $core.withContext(function($ctx2) {
  51082. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  51083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51084. }))._ensure_((function(){
  51085. return $core.withContext(function($ctx2) {
  51086. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  51087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51088. }));
  51089. return self;
  51090. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  51091. },
  51092. args: [],
  51093. 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 ]",
  51094. referencedClasses: ["ClassBuilder", "Array"],
  51095. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  51096. }),
  51097. $globals.BlockClosureTest);
  51098. $core.addMethod(
  51099. $core.method({
  51100. selector: "testEnsure",
  51101. protocol: "tests",
  51102. fn: function (){
  51103. var self=this,$self=this;
  51104. return $core.withContext(function($ctx1) {
  51105. $self._assert_equals_($recv((function(){
  51106. return (3);
  51107. }))._ensure_((function(){
  51108. return (4);
  51109. })),(3));
  51110. return self;
  51111. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  51112. },
  51113. args: [],
  51114. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  51115. referencedClasses: [],
  51116. messageSends: ["assert:equals:", "ensure:"]
  51117. }),
  51118. $globals.BlockClosureTest);
  51119. $core.addMethod(
  51120. $core.method({
  51121. selector: "testEnsureRaises",
  51122. protocol: "tests",
  51123. fn: function (){
  51124. var self=this,$self=this;
  51125. return $core.withContext(function($ctx1) {
  51126. $self._should_raise_((function(){
  51127. return $core.withContext(function($ctx2) {
  51128. return $recv((function(){
  51129. return $core.withContext(function($ctx3) {
  51130. return $recv($recv($globals.Error)._new())._signal();
  51131. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51132. }))._ensure_((function(){
  51133. return true;
  51134. }));
  51135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51136. }),$globals.Error);
  51137. return self;
  51138. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  51139. },
  51140. args: [],
  51141. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  51142. referencedClasses: ["Error"],
  51143. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  51144. }),
  51145. $globals.BlockClosureTest);
  51146. $core.addMethod(
  51147. $core.method({
  51148. selector: "testExceptionSemantics",
  51149. protocol: "tests",
  51150. fn: function (){
  51151. var self=this,$self=this;
  51152. return $core.withContext(function($ctx1) {
  51153. $self._timeout_((100));
  51154. $recv($self._async_((function(){
  51155. return $core.withContext(function($ctx2) {
  51156. return $recv((function(){
  51157. return $core.withContext(function($ctx3) {
  51158. $self._assert_(true);
  51159. $recv($globals.Error)._signal();
  51160. $self._deny_(true);
  51161. return $self._finished();
  51162. $ctx3.sendIdx["finished"]=1;
  51163. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51164. }))._on_do_($globals.Error,(function(ex){
  51165. return $core.withContext(function($ctx3) {
  51166. return $self._finished();
  51167. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  51168. }));
  51169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51170. })))._valueWithTimeout_((0));
  51171. return self;
  51172. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  51173. },
  51174. args: [],
  51175. 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",
  51176. referencedClasses: ["Error"],
  51177. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  51178. }),
  51179. $globals.BlockClosureTest);
  51180. $core.addMethod(
  51181. $core.method({
  51182. selector: "testLocalReturnOnDoCatch",
  51183. protocol: "tests",
  51184. fn: function (){
  51185. var self=this,$self=this;
  51186. return $core.withContext(function($ctx1) {
  51187. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51188. return self;
  51189. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51190. },
  51191. args: [],
  51192. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51193. referencedClasses: [],
  51194. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51195. }),
  51196. $globals.BlockClosureTest);
  51197. $core.addMethod(
  51198. $core.method({
  51199. selector: "testLocalReturnOnDoMiss",
  51200. protocol: "tests",
  51201. fn: function (){
  51202. var self=this,$self=this;
  51203. return $core.withContext(function($ctx1) {
  51204. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51205. return self;
  51206. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51207. },
  51208. args: [],
  51209. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51210. referencedClasses: [],
  51211. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51212. }),
  51213. $globals.BlockClosureTest);
  51214. $core.addMethod(
  51215. $core.method({
  51216. selector: "testNewWithValues",
  51217. protocol: "tests",
  51218. fn: function (){
  51219. var self=this,$self=this;
  51220. return $core.withContext(function($ctx1) {
  51221. function TestConstructor(arg1, arg2, arg3) {}
  51222. TestConstructor.prototype.name = "theTestPrototype";
  51223. var wrappedConstructor = $recv(TestConstructor);
  51224. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51225. $self._assert_(result instanceof TestConstructor);
  51226. $self._assert_equals_(result.name, "theTestPrototype");
  51227. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51228. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51229. return self;
  51230. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51231. },
  51232. args: [],
  51233. 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'>",
  51234. referencedClasses: [],
  51235. messageSends: []
  51236. }),
  51237. $globals.BlockClosureTest);
  51238. $core.addMethod(
  51239. $core.method({
  51240. selector: "testNumArgs",
  51241. protocol: "tests",
  51242. fn: function (){
  51243. var self=this,$self=this;
  51244. return $core.withContext(function($ctx1) {
  51245. var $1;
  51246. $1=$recv((function(){
  51247. }))._numArgs();
  51248. $ctx1.sendIdx["numArgs"]=1;
  51249. $self._assert_equals_($1,(0));
  51250. $ctx1.sendIdx["assert:equals:"]=1;
  51251. $self._assert_equals_($recv((function(a,b){
  51252. }))._numArgs(),(2));
  51253. return self;
  51254. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51255. },
  51256. args: [],
  51257. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51258. referencedClasses: [],
  51259. messageSends: ["assert:equals:", "numArgs"]
  51260. }),
  51261. $globals.BlockClosureTest);
  51262. $core.addMethod(
  51263. $core.method({
  51264. selector: "testOnDo",
  51265. protocol: "tests",
  51266. fn: function (){
  51267. var self=this,$self=this;
  51268. return $core.withContext(function($ctx1) {
  51269. $self._assert_($recv((function(){
  51270. return $core.withContext(function($ctx2) {
  51271. return $recv($recv($globals.Error)._new())._signal();
  51272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51273. }))._on_do_($globals.Error,(function(ex){
  51274. return true;
  51275. })));
  51276. return self;
  51277. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51278. },
  51279. args: [],
  51280. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51281. referencedClasses: ["Error"],
  51282. messageSends: ["assert:", "on:do:", "signal", "new"]
  51283. }),
  51284. $globals.BlockClosureTest);
  51285. $core.addMethod(
  51286. $core.method({
  51287. selector: "testValue",
  51288. protocol: "tests",
  51289. fn: function (){
  51290. var self=this,$self=this;
  51291. return $core.withContext(function($ctx1) {
  51292. var $1;
  51293. $1=$recv((function(){
  51294. return $core.withContext(function($ctx2) {
  51295. return (1).__plus((1));
  51296. $ctx2.sendIdx["+"]=1;
  51297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51298. }))._value();
  51299. $ctx1.sendIdx["value"]=1;
  51300. $self._assert_equals_($1,(2));
  51301. $ctx1.sendIdx["assert:equals:"]=1;
  51302. $self._assert_equals_($recv((function(x){
  51303. return $core.withContext(function($ctx2) {
  51304. return $recv(x).__plus((1));
  51305. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51306. }))._value_((2)),(3));
  51307. $ctx1.sendIdx["assert:equals:"]=2;
  51308. $self._assert_equals_($recv((function(x,y){
  51309. return $core.withContext(function($ctx2) {
  51310. return $recv(x).__star(y);
  51311. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51312. }))._value_value_((2),(4)),(8));
  51313. $ctx1.sendIdx["assert:equals:"]=3;
  51314. $self._assert_equals_($recv((function(a,b,c){
  51315. return (1);
  51316. }))._value(),(1));
  51317. return self;
  51318. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51319. },
  51320. args: [],
  51321. 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",
  51322. referencedClasses: [],
  51323. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51324. }),
  51325. $globals.BlockClosureTest);
  51326. $core.addMethod(
  51327. $core.method({
  51328. selector: "testValueWithPossibleArguments",
  51329. protocol: "tests",
  51330. fn: function (){
  51331. var self=this,$self=this;
  51332. return $core.withContext(function($ctx1) {
  51333. var $1,$2;
  51334. $1=$recv((function(){
  51335. return (1);
  51336. }))._valueWithPossibleArguments_([(3), (4)]);
  51337. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51338. $self._assert_equals_($1,(1));
  51339. $ctx1.sendIdx["assert:equals:"]=1;
  51340. $2=$recv((function(a){
  51341. return $core.withContext(function($ctx2) {
  51342. return $recv(a).__plus((4));
  51343. $ctx2.sendIdx["+"]=1;
  51344. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51345. }))._valueWithPossibleArguments_([(3), (4)]);
  51346. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51347. $self._assert_equals_($2,(7));
  51348. $ctx1.sendIdx["assert:equals:"]=2;
  51349. $self._assert_equals_($recv((function(a,b){
  51350. return $core.withContext(function($ctx2) {
  51351. return $recv(a).__plus(b);
  51352. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51353. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51354. return self;
  51355. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51356. },
  51357. args: [],
  51358. 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.",
  51359. referencedClasses: [],
  51360. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51361. }),
  51362. $globals.BlockClosureTest);
  51363. $core.addMethod(
  51364. $core.method({
  51365. selector: "testWhileFalse",
  51366. protocol: "tests",
  51367. fn: function (){
  51368. var self=this,$self=this;
  51369. var i;
  51370. return $core.withContext(function($ctx1) {
  51371. i=(0);
  51372. $recv((function(){
  51373. return $core.withContext(function($ctx2) {
  51374. return $recv(i).__gt((5));
  51375. $ctx2.sendIdx[">"]=1;
  51376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51377. }))._whileFalse_((function(){
  51378. return $core.withContext(function($ctx2) {
  51379. i=$recv(i).__plus((1));
  51380. $ctx2.sendIdx["+"]=1;
  51381. return i;
  51382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51383. }));
  51384. $self._assert_equals_(i,(6));
  51385. $ctx1.sendIdx["assert:equals:"]=1;
  51386. i=(0);
  51387. $recv((function(){
  51388. return $core.withContext(function($ctx2) {
  51389. i=$recv(i).__plus((1));
  51390. return $recv(i).__gt((5));
  51391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51392. }))._whileFalse();
  51393. $self._assert_equals_(i,(6));
  51394. return self;
  51395. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51396. },
  51397. args: [],
  51398. 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",
  51399. referencedClasses: [],
  51400. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51401. }),
  51402. $globals.BlockClosureTest);
  51403. $core.addMethod(
  51404. $core.method({
  51405. selector: "testWhileTrue",
  51406. protocol: "tests",
  51407. fn: function (){
  51408. var self=this,$self=this;
  51409. var i;
  51410. return $core.withContext(function($ctx1) {
  51411. i=(0);
  51412. $recv((function(){
  51413. return $core.withContext(function($ctx2) {
  51414. return $recv(i).__lt((5));
  51415. $ctx2.sendIdx["<"]=1;
  51416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51417. }))._whileTrue_((function(){
  51418. return $core.withContext(function($ctx2) {
  51419. i=$recv(i).__plus((1));
  51420. $ctx2.sendIdx["+"]=1;
  51421. return i;
  51422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51423. }));
  51424. $self._assert_equals_(i,(5));
  51425. $ctx1.sendIdx["assert:equals:"]=1;
  51426. i=(0);
  51427. $recv((function(){
  51428. return $core.withContext(function($ctx2) {
  51429. i=$recv(i).__plus((1));
  51430. return $recv(i).__lt((5));
  51431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51432. }))._whileTrue();
  51433. $self._assert_equals_(i,(5));
  51434. return self;
  51435. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51436. },
  51437. args: [],
  51438. 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",
  51439. referencedClasses: [],
  51440. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51441. }),
  51442. $globals.BlockClosureTest);
  51443. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51444. $core.addMethod(
  51445. $core.method({
  51446. selector: "testEquality",
  51447. protocol: "tests",
  51448. fn: function (){
  51449. var self=this,$self=this;
  51450. return $core.withContext(function($ctx1) {
  51451. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51452. $1=(0).__eq(false);
  51453. $ctx1.sendIdx["="]=1;
  51454. $self._deny_($1);
  51455. $ctx1.sendIdx["deny:"]=1;
  51456. $2=false.__eq((0));
  51457. $ctx1.sendIdx["="]=2;
  51458. $self._deny_($2);
  51459. $ctx1.sendIdx["deny:"]=2;
  51460. $3="".__eq(false);
  51461. $ctx1.sendIdx["="]=3;
  51462. $self._deny_($3);
  51463. $ctx1.sendIdx["deny:"]=3;
  51464. $4=false.__eq("");
  51465. $ctx1.sendIdx["="]=4;
  51466. $self._deny_($4);
  51467. $ctx1.sendIdx["deny:"]=4;
  51468. $5=true.__eq(true);
  51469. $ctx1.sendIdx["="]=5;
  51470. $self._assert_($5);
  51471. $ctx1.sendIdx["assert:"]=1;
  51472. $6=false.__eq(true);
  51473. $ctx1.sendIdx["="]=6;
  51474. $self._deny_($6);
  51475. $ctx1.sendIdx["deny:"]=5;
  51476. $7=true.__eq(false);
  51477. $ctx1.sendIdx["="]=7;
  51478. $self._deny_($7);
  51479. $8=false.__eq(false);
  51480. $ctx1.sendIdx["="]=8;
  51481. $self._assert_($8);
  51482. $ctx1.sendIdx["assert:"]=2;
  51483. $10=true._yourself();
  51484. $ctx1.sendIdx["yourself"]=1;
  51485. $9=$recv($10).__eq(true);
  51486. $ctx1.sendIdx["="]=9;
  51487. $self._assert_($9);
  51488. $ctx1.sendIdx["assert:"]=3;
  51489. $12=true._yourself();
  51490. $ctx1.sendIdx["yourself"]=2;
  51491. $11=$recv($12).__eq(true._yourself());
  51492. $self._assert_($11);
  51493. return self;
  51494. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51495. },
  51496. args: [],
  51497. 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)",
  51498. referencedClasses: [],
  51499. messageSends: ["deny:", "=", "assert:", "yourself"]
  51500. }),
  51501. $globals.BooleanTest);
  51502. $core.addMethod(
  51503. $core.method({
  51504. selector: "testIdentity",
  51505. protocol: "tests",
  51506. fn: function (){
  51507. var self=this,$self=this;
  51508. return $core.withContext(function($ctx1) {
  51509. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51510. $1=(0).__eq_eq(false);
  51511. $ctx1.sendIdx["=="]=1;
  51512. $self._deny_($1);
  51513. $ctx1.sendIdx["deny:"]=1;
  51514. $2=false.__eq_eq((0));
  51515. $ctx1.sendIdx["=="]=2;
  51516. $self._deny_($2);
  51517. $ctx1.sendIdx["deny:"]=2;
  51518. $3="".__eq_eq(false);
  51519. $ctx1.sendIdx["=="]=3;
  51520. $self._deny_($3);
  51521. $ctx1.sendIdx["deny:"]=3;
  51522. $4=false.__eq_eq("");
  51523. $ctx1.sendIdx["=="]=4;
  51524. $self._deny_($4);
  51525. $ctx1.sendIdx["deny:"]=4;
  51526. $5=true.__eq_eq(true);
  51527. $ctx1.sendIdx["=="]=5;
  51528. $self._assert_($5);
  51529. $ctx1.sendIdx["assert:"]=1;
  51530. $6=false.__eq_eq(true);
  51531. $ctx1.sendIdx["=="]=6;
  51532. $self._deny_($6);
  51533. $ctx1.sendIdx["deny:"]=5;
  51534. $7=true.__eq_eq(false);
  51535. $ctx1.sendIdx["=="]=7;
  51536. $self._deny_($7);
  51537. $8=false.__eq_eq(false);
  51538. $ctx1.sendIdx["=="]=8;
  51539. $self._assert_($8);
  51540. $ctx1.sendIdx["assert:"]=2;
  51541. $10=true._yourself();
  51542. $ctx1.sendIdx["yourself"]=1;
  51543. $9=$recv($10).__eq_eq(true);
  51544. $ctx1.sendIdx["=="]=9;
  51545. $self._assert_($9);
  51546. $ctx1.sendIdx["assert:"]=3;
  51547. $12=true._yourself();
  51548. $ctx1.sendIdx["yourself"]=2;
  51549. $11=$recv($12).__eq_eq(true._yourself());
  51550. $self._assert_($11);
  51551. return self;
  51552. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51553. },
  51554. args: [],
  51555. 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",
  51556. referencedClasses: [],
  51557. messageSends: ["deny:", "==", "assert:", "yourself"]
  51558. }),
  51559. $globals.BooleanTest);
  51560. $core.addMethod(
  51561. $core.method({
  51562. selector: "testIfTrueIfFalse",
  51563. protocol: "tests",
  51564. fn: function (){
  51565. var self=this,$self=this;
  51566. return $core.withContext(function($ctx1) {
  51567. var $1,$2,$3,$4,$5,$6,$7,$8;
  51568. if($core.assert(true)){
  51569. $1="alternative block";
  51570. }
  51571. $self._assert_equals_($1,"alternative block");
  51572. $ctx1.sendIdx["assert:equals:"]=1;
  51573. if(!$core.assert(true)){
  51574. $2="alternative block";
  51575. }
  51576. $self._assert_equals_($2,nil);
  51577. $ctx1.sendIdx["assert:equals:"]=2;
  51578. if($core.assert(false)){
  51579. $3="alternative block";
  51580. }
  51581. $self._assert_equals_($3,nil);
  51582. $ctx1.sendIdx["assert:equals:"]=3;
  51583. if(!$core.assert(false)){
  51584. $4="alternative block";
  51585. }
  51586. $self._assert_equals_($4,"alternative block");
  51587. $ctx1.sendIdx["assert:equals:"]=4;
  51588. if($core.assert(false)){
  51589. $5="alternative block";
  51590. } else {
  51591. $5="alternative block2";
  51592. }
  51593. $self._assert_equals_($5,"alternative block2");
  51594. $ctx1.sendIdx["assert:equals:"]=5;
  51595. if($core.assert(false)){
  51596. $6="alternative block2";
  51597. } else {
  51598. $6="alternative block";
  51599. }
  51600. $self._assert_equals_($6,"alternative block");
  51601. $ctx1.sendIdx["assert:equals:"]=6;
  51602. if($core.assert(true)){
  51603. $7="alternative block";
  51604. } else {
  51605. $7="alternative block2";
  51606. }
  51607. $self._assert_equals_($7,"alternative block");
  51608. $ctx1.sendIdx["assert:equals:"]=7;
  51609. if($core.assert(true)){
  51610. $8="alternative block2";
  51611. } else {
  51612. $8="alternative block";
  51613. }
  51614. $self._assert_equals_($8,"alternative block2");
  51615. return self;
  51616. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51617. },
  51618. args: [],
  51619. 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'.",
  51620. referencedClasses: [],
  51621. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51622. }),
  51623. $globals.BooleanTest);
  51624. $core.addMethod(
  51625. $core.method({
  51626. selector: "testIfTrueIfFalseWithBoxing",
  51627. protocol: "tests",
  51628. fn: function (){
  51629. var self=this,$self=this;
  51630. return $core.withContext(function($ctx1) {
  51631. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51632. $2=true._yourself();
  51633. $ctx1.sendIdx["yourself"]=1;
  51634. if($core.assert($2)){
  51635. $1="alternative block";
  51636. }
  51637. $self._assert_equals_($1,"alternative block");
  51638. $ctx1.sendIdx["assert:equals:"]=1;
  51639. $4=true._yourself();
  51640. $ctx1.sendIdx["yourself"]=2;
  51641. if(!$core.assert($4)){
  51642. $3="alternative block";
  51643. }
  51644. $self._assert_equals_($3,nil);
  51645. $ctx1.sendIdx["assert:equals:"]=2;
  51646. $6=false._yourself();
  51647. $ctx1.sendIdx["yourself"]=3;
  51648. if($core.assert($6)){
  51649. $5="alternative block";
  51650. }
  51651. $self._assert_equals_($5,nil);
  51652. $ctx1.sendIdx["assert:equals:"]=3;
  51653. $8=false._yourself();
  51654. $ctx1.sendIdx["yourself"]=4;
  51655. if(!$core.assert($8)){
  51656. $7="alternative block";
  51657. }
  51658. $self._assert_equals_($7,"alternative block");
  51659. $ctx1.sendIdx["assert:equals:"]=4;
  51660. $10=false._yourself();
  51661. $ctx1.sendIdx["yourself"]=5;
  51662. if($core.assert($10)){
  51663. $9="alternative block";
  51664. } else {
  51665. $9="alternative block2";
  51666. }
  51667. $self._assert_equals_($9,"alternative block2");
  51668. $ctx1.sendIdx["assert:equals:"]=5;
  51669. $12=false._yourself();
  51670. $ctx1.sendIdx["yourself"]=6;
  51671. if($core.assert($12)){
  51672. $11="alternative block2";
  51673. } else {
  51674. $11="alternative block";
  51675. }
  51676. $self._assert_equals_($11,"alternative block");
  51677. $ctx1.sendIdx["assert:equals:"]=6;
  51678. $14=true._yourself();
  51679. $ctx1.sendIdx["yourself"]=7;
  51680. if($core.assert($14)){
  51681. $13="alternative block";
  51682. } else {
  51683. $13="alternative block2";
  51684. }
  51685. $self._assert_equals_($13,"alternative block");
  51686. $ctx1.sendIdx["assert:equals:"]=7;
  51687. $16=true._yourself();
  51688. if($core.assert($16)){
  51689. $15="alternative block2";
  51690. } else {
  51691. $15="alternative block";
  51692. }
  51693. $self._assert_equals_($15,"alternative block2");
  51694. return self;
  51695. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51696. },
  51697. args: [],
  51698. 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'.",
  51699. referencedClasses: [],
  51700. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51701. }),
  51702. $globals.BooleanTest);
  51703. $core.addMethod(
  51704. $core.method({
  51705. selector: "testLogic",
  51706. protocol: "tests",
  51707. fn: function (){
  51708. var self=this,$self=this;
  51709. return $core.withContext(function($ctx1) {
  51710. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51711. $1=true.__and(true);
  51712. $ctx1.sendIdx["&"]=1;
  51713. $self._assert_($1);
  51714. $ctx1.sendIdx["assert:"]=1;
  51715. $2=true.__and(false);
  51716. $ctx1.sendIdx["&"]=2;
  51717. $self._deny_($2);
  51718. $ctx1.sendIdx["deny:"]=1;
  51719. $3=false.__and(true);
  51720. $ctx1.sendIdx["&"]=3;
  51721. $self._deny_($3);
  51722. $ctx1.sendIdx["deny:"]=2;
  51723. $5=false.__and(false);
  51724. $ctx1.sendIdx["&"]=4;
  51725. $4=$self._deny_($5);
  51726. $ctx1.sendIdx["deny:"]=3;
  51727. $6=true.__or(true);
  51728. $ctx1.sendIdx["|"]=1;
  51729. $self._assert_($6);
  51730. $ctx1.sendIdx["assert:"]=2;
  51731. $7=true.__or(false);
  51732. $ctx1.sendIdx["|"]=2;
  51733. $self._assert_($7);
  51734. $ctx1.sendIdx["assert:"]=3;
  51735. $8=false.__or(true);
  51736. $ctx1.sendIdx["|"]=3;
  51737. $self._assert_($8);
  51738. $ctx1.sendIdx["assert:"]=4;
  51739. $10=false.__or(false);
  51740. $ctx1.sendIdx["|"]=4;
  51741. $9=$self._deny_($10);
  51742. $ctx1.sendIdx["deny:"]=4;
  51743. $12=(1).__gt((0));
  51744. $ctx1.sendIdx[">"]=1;
  51745. $11=true.__and($12);
  51746. $ctx1.sendIdx["&"]=5;
  51747. $self._assert_($11);
  51748. $ctx1.sendIdx["assert:"]=5;
  51749. $14=(1).__gt((0));
  51750. $ctx1.sendIdx[">"]=2;
  51751. $13=$recv($14).__and(false);
  51752. $ctx1.sendIdx["&"]=6;
  51753. $self._deny_($13);
  51754. $ctx1.sendIdx["deny:"]=5;
  51755. $16=(1).__gt((0));
  51756. $ctx1.sendIdx[">"]=3;
  51757. $17=(1).__gt((2));
  51758. $ctx1.sendIdx[">"]=4;
  51759. $15=$recv($16).__and($17);
  51760. $self._deny_($15);
  51761. $19=(1).__gt((0));
  51762. $ctx1.sendIdx[">"]=5;
  51763. $18=false.__or($19);
  51764. $ctx1.sendIdx["|"]=5;
  51765. $self._assert_($18);
  51766. $ctx1.sendIdx["assert:"]=6;
  51767. $21=(1).__gt((0));
  51768. $ctx1.sendIdx[">"]=6;
  51769. $20=$recv($21).__or(false);
  51770. $ctx1.sendIdx["|"]=6;
  51771. $self._assert_($20);
  51772. $ctx1.sendIdx["assert:"]=7;
  51773. $23=(1).__gt((0));
  51774. $ctx1.sendIdx[">"]=7;
  51775. $22=$recv($23).__or((1).__gt((2)));
  51776. $self._assert_($22);
  51777. return self;
  51778. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51779. },
  51780. args: [],
  51781. 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))",
  51782. referencedClasses: [],
  51783. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51784. }),
  51785. $globals.BooleanTest);
  51786. $core.addMethod(
  51787. $core.method({
  51788. selector: "testLogicKeywords",
  51789. protocol: "tests",
  51790. fn: function (){
  51791. var self=this,$self=this;
  51792. return $core.withContext(function($ctx1) {
  51793. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51794. $1=true._and_((function(){
  51795. return true;
  51796. }));
  51797. $ctx1.sendIdx["and:"]=1;
  51798. $self._assert_($1);
  51799. $ctx1.sendIdx["assert:"]=1;
  51800. $2=true._and_((function(){
  51801. return false;
  51802. }));
  51803. $ctx1.sendIdx["and:"]=2;
  51804. $self._deny_($2);
  51805. $ctx1.sendIdx["deny:"]=1;
  51806. $3=false._and_((function(){
  51807. return true;
  51808. }));
  51809. $ctx1.sendIdx["and:"]=3;
  51810. $self._deny_($3);
  51811. $ctx1.sendIdx["deny:"]=2;
  51812. $5=false._and_((function(){
  51813. return false;
  51814. }));
  51815. $ctx1.sendIdx["and:"]=4;
  51816. $4=$self._deny_($5);
  51817. $ctx1.sendIdx["deny:"]=3;
  51818. $6=true._or_((function(){
  51819. return true;
  51820. }));
  51821. $ctx1.sendIdx["or:"]=1;
  51822. $self._assert_($6);
  51823. $ctx1.sendIdx["assert:"]=2;
  51824. $7=true._or_((function(){
  51825. return false;
  51826. }));
  51827. $ctx1.sendIdx["or:"]=2;
  51828. $self._assert_($7);
  51829. $ctx1.sendIdx["assert:"]=3;
  51830. $8=false._or_((function(){
  51831. return true;
  51832. }));
  51833. $ctx1.sendIdx["or:"]=3;
  51834. $self._assert_($8);
  51835. $ctx1.sendIdx["assert:"]=4;
  51836. $10=false._or_((function(){
  51837. return false;
  51838. }));
  51839. $ctx1.sendIdx["or:"]=4;
  51840. $9=$self._deny_($10);
  51841. $ctx1.sendIdx["deny:"]=4;
  51842. $11=true._and_((function(){
  51843. return $core.withContext(function($ctx2) {
  51844. return (1).__gt((0));
  51845. $ctx2.sendIdx[">"]=1;
  51846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51847. }));
  51848. $ctx1.sendIdx["and:"]=5;
  51849. $self._assert_($11);
  51850. $ctx1.sendIdx["assert:"]=5;
  51851. $13=(1).__gt((0));
  51852. $ctx1.sendIdx[">"]=2;
  51853. $12=$recv($13)._and_((function(){
  51854. return false;
  51855. }));
  51856. $ctx1.sendIdx["and:"]=6;
  51857. $self._deny_($12);
  51858. $ctx1.sendIdx["deny:"]=5;
  51859. $15=(1).__gt((0));
  51860. $ctx1.sendIdx[">"]=3;
  51861. $14=$recv($15)._and_((function(){
  51862. return $core.withContext(function($ctx2) {
  51863. return (1).__gt((2));
  51864. $ctx2.sendIdx[">"]=4;
  51865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51866. }));
  51867. $self._deny_($14);
  51868. $16=false._or_((function(){
  51869. return $core.withContext(function($ctx2) {
  51870. return (1).__gt((0));
  51871. $ctx2.sendIdx[">"]=5;
  51872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51873. }));
  51874. $ctx1.sendIdx["or:"]=5;
  51875. $self._assert_($16);
  51876. $ctx1.sendIdx["assert:"]=6;
  51877. $18=(1).__gt((0));
  51878. $ctx1.sendIdx[">"]=6;
  51879. $17=$recv($18)._or_((function(){
  51880. return false;
  51881. }));
  51882. $ctx1.sendIdx["or:"]=6;
  51883. $self._assert_($17);
  51884. $ctx1.sendIdx["assert:"]=7;
  51885. $20=(1).__gt((0));
  51886. $ctx1.sendIdx[">"]=7;
  51887. $19=$recv($20)._or_((function(){
  51888. return $core.withContext(function($ctx2) {
  51889. return (1).__gt((2));
  51890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51891. }));
  51892. $self._assert_($19);
  51893. return self;
  51894. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51895. },
  51896. args: [],
  51897. 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 ])",
  51898. referencedClasses: [],
  51899. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51900. }),
  51901. $globals.BooleanTest);
  51902. $core.addMethod(
  51903. $core.method({
  51904. selector: "testNonBooleanError",
  51905. protocol: "tests",
  51906. fn: function (){
  51907. var self=this,$self=this;
  51908. return $core.withContext(function($ctx1) {
  51909. $self._should_raise_((function(){
  51910. return $core.withContext(function($ctx2) {
  51911. if($core.assert("")){
  51912. } else {
  51913. }
  51914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51915. }),$globals.NonBooleanReceiver);
  51916. return self;
  51917. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51918. },
  51919. args: [],
  51920. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51921. referencedClasses: ["NonBooleanReceiver"],
  51922. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51923. }),
  51924. $globals.BooleanTest);
  51925. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51926. $core.addMethod(
  51927. $core.method({
  51928. selector: "setUp",
  51929. protocol: "running",
  51930. fn: function (){
  51931. var self=this,$self=this;
  51932. return $core.withContext(function($ctx1) {
  51933. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51934. return self;
  51935. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51936. },
  51937. args: [],
  51938. source: "setUp\x0a\x09builder := ClassBuilder new",
  51939. referencedClasses: ["ClassBuilder"],
  51940. messageSends: ["new"]
  51941. }),
  51942. $globals.ClassBuilderTest);
  51943. $core.addMethod(
  51944. $core.method({
  51945. selector: "tearDown",
  51946. protocol: "running",
  51947. fn: function (){
  51948. var self=this,$self=this;
  51949. return $core.withContext(function($ctx1) {
  51950. var $1,$receiver;
  51951. $1=$self["@theClass"];
  51952. if(($receiver = $1) == null || $receiver.a$nil){
  51953. $1;
  51954. } else {
  51955. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51956. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51957. $self["@theClass"]=nil;
  51958. $self["@theClass"];
  51959. }
  51960. return self;
  51961. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51962. },
  51963. args: [],
  51964. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51965. referencedClasses: ["Smalltalk"],
  51966. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51967. }),
  51968. $globals.ClassBuilderTest);
  51969. $core.addMethod(
  51970. $core.method({
  51971. selector: "testAddTrait",
  51972. protocol: "tests",
  51973. fn: function (){
  51974. var self=this,$self=this;
  51975. return $core.withContext(function($ctx1) {
  51976. var $3,$2,$1,$4;
  51977. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51978. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51979. $ctx1.sendIdx["assert:equals:"]=1;
  51980. $3=$recv($self["@theClass"])._package();
  51981. $ctx1.sendIdx["package"]=1;
  51982. $2=$recv($3)._classes();
  51983. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51984. $self._assert_equals_($1,(1));
  51985. $ctx1.sendIdx["assert:equals:"]=2;
  51986. $4=$recv($self["@theClass"])._package();
  51987. $ctx1.sendIdx["package"]=2;
  51988. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51989. return self;
  51990. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51991. },
  51992. args: [],
  51993. 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",
  51994. referencedClasses: ["ObjectMock"],
  51995. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51996. }),
  51997. $globals.ClassBuilderTest);
  51998. $core.addMethod(
  51999. $core.method({
  52000. selector: "testClassCopy",
  52001. protocol: "tests",
  52002. fn: function (){
  52003. var self=this,$self=this;
  52004. return $core.withContext(function($ctx1) {
  52005. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  52006. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52007. $2=$recv($self["@theClass"])._superclass();
  52008. $ctx1.sendIdx["superclass"]=1;
  52009. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52010. $ctx1.sendIdx["=="]=1;
  52011. $self._assert_($1);
  52012. $ctx1.sendIdx["assert:"]=1;
  52013. $4=$recv($self["@theClass"])._instanceVariableNames();
  52014. $ctx1.sendIdx["instanceVariableNames"]=1;
  52015. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52016. $ctx1.sendIdx["=="]=2;
  52017. $self._assert_($3);
  52018. $ctx1.sendIdx["assert:"]=2;
  52019. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52020. $ctx1.sendIdx["assert:equals:"]=1;
  52021. $6=$recv($self["@theClass"])._package();
  52022. $ctx1.sendIdx["package"]=1;
  52023. $7=$recv($globals.ObjectMock)._package();
  52024. $ctx1.sendIdx["package"]=2;
  52025. $5=$recv($6).__eq_eq($7);
  52026. $self._assert_($5);
  52027. $ctx1.sendIdx["assert:"]=3;
  52028. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  52029. $9=$recv($self["@theClass"])._methodDictionary();
  52030. $ctx1.sendIdx["methodDictionary"]=1;
  52031. $8=$recv($9)._keys();
  52032. $ctx1.sendIdx["keys"]=1;
  52033. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52034. return self;
  52035. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  52036. },
  52037. args: [],
  52038. 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",
  52039. referencedClasses: ["ObjectMock"],
  52040. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  52041. }),
  52042. $globals.ClassBuilderTest);
  52043. $core.addMethod(
  52044. $core.method({
  52045. selector: "testClassMigration",
  52046. protocol: "tests",
  52047. fn: function (){
  52048. var self=this,$self=this;
  52049. var instance,oldClass;
  52050. return $core.withContext(function($ctx1) {
  52051. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  52052. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52053. $2=$recv($globals.Smalltalk)._globals();
  52054. $ctx1.sendIdx["globals"]=1;
  52055. $1=$recv($2)._at_("ObjectMock2");
  52056. $ctx1.sendIdx["at:"]=1;
  52057. instance=$recv($1)._new();
  52058. $4=$recv($globals.Smalltalk)._globals();
  52059. $ctx1.sendIdx["globals"]=2;
  52060. $3=$recv($4)._at_("ObjectMock2");
  52061. $ctx1.sendIdx["at:"]=2;
  52062. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  52063. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  52064. $ctx1.sendIdx["=="]=1;
  52065. $self._deny_($5);
  52066. $ctx1.sendIdx["deny:"]=1;
  52067. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  52068. $ctx1.sendIdx["=="]=2;
  52069. $self._assert_($6);
  52070. $ctx1.sendIdx["assert:"]=1;
  52071. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  52072. $ctx1.sendIdx["assert:"]=2;
  52073. $7=$recv($globals.ObjectMock2)._selectors();
  52074. $ctx1.sendIdx["selectors"]=1;
  52075. $self._assert_equals_($7,$recv(oldClass)._selectors());
  52076. $ctx1.sendIdx["assert:equals:"]=1;
  52077. $8=$recv($globals.ObjectMock2)._comment();
  52078. $ctx1.sendIdx["comment"]=1;
  52079. $self._assert_equals_($8,$recv(oldClass)._comment());
  52080. $ctx1.sendIdx["assert:equals:"]=2;
  52081. $10=$recv($globals.ObjectMock2)._package();
  52082. $ctx1.sendIdx["package"]=1;
  52083. $9=$recv($10)._name();
  52084. $ctx1.sendIdx["name"]=1;
  52085. $self._assert_equals_($9,"Kernel-Tests");
  52086. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  52087. $ctx1.sendIdx["assert:"]=3;
  52088. $12=$recv(instance)._class();
  52089. $ctx1.sendIdx["class"]=1;
  52090. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  52091. $self._deny_($11);
  52092. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  52093. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52094. return self;
  52095. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  52096. },
  52097. args: [],
  52098. 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",
  52099. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  52100. 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:"]
  52101. }),
  52102. $globals.ClassBuilderTest);
  52103. $core.addMethod(
  52104. $core.method({
  52105. selector: "testClassMigrationWithClassInstanceVariables",
  52106. protocol: "tests",
  52107. fn: function (){
  52108. var self=this,$self=this;
  52109. return $core.withContext(function($ctx1) {
  52110. var $1;
  52111. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52112. $1=$recv($globals.ObjectMock2)._class();
  52113. $ctx1.sendIdx["class"]=1;
  52114. $recv($1)._instanceVariableNames_("foo bar");
  52115. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52116. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  52117. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52118. return self;
  52119. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  52120. },
  52121. args: [],
  52122. 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",
  52123. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  52124. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  52125. }),
  52126. $globals.ClassBuilderTest);
  52127. $core.addMethod(
  52128. $core.method({
  52129. selector: "testClassMigrationWithSubclasses",
  52130. protocol: "tests",
  52131. fn: function (){
  52132. var self=this,$self=this;
  52133. return $core.withContext(function($ctx1) {
  52134. var $2,$1,$4,$3;
  52135. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52136. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  52137. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  52138. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  52139. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  52140. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52141. $2=$recv($globals.ObjectMock)._subclasses();
  52142. $ctx1.sendIdx["subclasses"]=1;
  52143. $1=$recv($2)._includes_($globals.ObjectMock2);
  52144. $ctx1.sendIdx["includes:"]=1;
  52145. $self._assert_($1);
  52146. $ctx1.sendIdx["assert:"]=1;
  52147. $4=$recv($globals.ObjectMock2)._subclasses();
  52148. $ctx1.sendIdx["subclasses"]=2;
  52149. $3=$recv($4)._includes_($globals.ObjectMock3);
  52150. $ctx1.sendIdx["includes:"]=2;
  52151. $self._assert_($3);
  52152. $ctx1.sendIdx["assert:"]=2;
  52153. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  52154. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  52155. return $core.withContext(function($ctx2) {
  52156. return $recv($globals.Smalltalk)._removeClass_(each);
  52157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52158. }));
  52159. return self;
  52160. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  52161. },
  52162. args: [],
  52163. 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 ]",
  52164. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  52165. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  52166. }),
  52167. $globals.ClassBuilderTest);
  52168. $core.addMethod(
  52169. $core.method({
  52170. selector: "testInstanceVariableNames",
  52171. protocol: "tests",
  52172. fn: function (){
  52173. var self=this,$self=this;
  52174. return $core.withContext(function($ctx1) {
  52175. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  52176. return self;
  52177. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  52178. },
  52179. args: [],
  52180. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  52181. referencedClasses: [],
  52182. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  52183. }),
  52184. $globals.ClassBuilderTest);
  52185. $core.addMethod(
  52186. $core.method({
  52187. selector: "testSubclass",
  52188. protocol: "tests",
  52189. fn: function (){
  52190. var self=this,$self=this;
  52191. return $core.withContext(function($ctx1) {
  52192. var $3,$2,$1,$4;
  52193. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  52194. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  52195. $ctx1.sendIdx["assert:equals:"]=1;
  52196. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  52197. $ctx1.sendIdx["assert:equals:"]=2;
  52198. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52199. $ctx1.sendIdx["assert:equals:"]=3;
  52200. $3=$recv($self["@theClass"])._package();
  52201. $ctx1.sendIdx["package"]=1;
  52202. $2=$recv($3)._classes();
  52203. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  52204. $self._assert_equals_($1,(1));
  52205. $ctx1.sendIdx["assert:equals:"]=4;
  52206. $4=$recv($self["@theClass"])._package();
  52207. $ctx1.sendIdx["package"]=2;
  52208. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52209. $ctx1.sendIdx["assert:equals:"]=5;
  52210. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52211. return self;
  52212. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52213. },
  52214. args: [],
  52215. 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",
  52216. referencedClasses: ["ObjectMock"],
  52217. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52218. }),
  52219. $globals.ClassBuilderTest);
  52220. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52221. $core.addMethod(
  52222. $core.method({
  52223. selector: "jsConstructor",
  52224. protocol: "running",
  52225. fn: function (){
  52226. var self=this,$self=this;
  52227. return $core.withContext(function($ctx1) {
  52228. function Foo(){}
  52229. Foo.prototype.valueOf = function () {return 4;};
  52230. return Foo;
  52231. ;
  52232. return self;
  52233. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52234. },
  52235. args: [],
  52236. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52237. referencedClasses: [],
  52238. messageSends: []
  52239. }),
  52240. $globals.ClassTest);
  52241. $core.addMethod(
  52242. $core.method({
  52243. selector: "setUp",
  52244. protocol: "running",
  52245. fn: function (){
  52246. var self=this,$self=this;
  52247. return $core.withContext(function($ctx1) {
  52248. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52249. return self;
  52250. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52251. },
  52252. args: [],
  52253. source: "setUp\x0a\x09builder := ClassBuilder new",
  52254. referencedClasses: ["ClassBuilder"],
  52255. messageSends: ["new"]
  52256. }),
  52257. $globals.ClassTest);
  52258. $core.addMethod(
  52259. $core.method({
  52260. selector: "tearDown",
  52261. protocol: "running",
  52262. fn: function (){
  52263. var self=this,$self=this;
  52264. return $core.withContext(function($ctx1) {
  52265. var $1,$receiver;
  52266. $1=$self["@theClass"];
  52267. if(($receiver = $1) == null || $receiver.a$nil){
  52268. $1;
  52269. } else {
  52270. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52271. return $core.withContext(function($ctx2) {
  52272. return $recv($globals.Smalltalk)._removeClass_(each);
  52273. $ctx2.sendIdx["removeClass:"]=1;
  52274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52275. }));
  52276. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52277. $self["@theClass"]=nil;
  52278. $self["@theClass"];
  52279. }
  52280. return self;
  52281. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52282. },
  52283. args: [],
  52284. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52285. referencedClasses: ["Smalltalk"],
  52286. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52287. }),
  52288. $globals.ClassTest);
  52289. $core.addMethod(
  52290. $core.method({
  52291. selector: "testAllSubclasses",
  52292. protocol: "tests",
  52293. fn: function (){
  52294. var self=this,$self=this;
  52295. var subclasses,index;
  52296. return $core.withContext(function($ctx1) {
  52297. subclasses=$recv($globals.Object)._subclasses();
  52298. $ctx1.sendIdx["subclasses"]=1;
  52299. index=(1);
  52300. $recv((function(){
  52301. return $core.withContext(function($ctx2) {
  52302. return $recv(index).__gt($recv(subclasses)._size());
  52303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52304. }))._whileFalse_((function(){
  52305. return $core.withContext(function($ctx2) {
  52306. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52307. index=$recv(index).__plus((1));
  52308. return index;
  52309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52310. }));
  52311. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52312. return self;
  52313. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52314. },
  52315. args: [],
  52316. 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",
  52317. referencedClasses: ["Object"],
  52318. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52319. }),
  52320. $globals.ClassTest);
  52321. $core.addMethod(
  52322. $core.method({
  52323. selector: "testMetaclassSubclasses",
  52324. protocol: "tests",
  52325. fn: function (){
  52326. var self=this,$self=this;
  52327. var subclasses;
  52328. return $core.withContext(function($ctx1) {
  52329. var $4,$3,$2,$1;
  52330. $4=$recv($globals.Object)._class();
  52331. $ctx1.sendIdx["class"]=1;
  52332. $3=$recv($4)._instanceClass();
  52333. $2=$recv($3)._subclasses();
  52334. $ctx1.sendIdx["subclasses"]=1;
  52335. $1=$recv($2)._select_((function(each){
  52336. return $core.withContext(function($ctx2) {
  52337. return $recv($recv(each)._isMetaclass())._not();
  52338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52339. }));
  52340. subclasses=$recv($1)._collect_((function(each){
  52341. return $core.withContext(function($ctx2) {
  52342. return $recv(each)._theMetaClass();
  52343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52344. }));
  52345. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52346. return self;
  52347. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52348. },
  52349. args: [],
  52350. 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",
  52351. referencedClasses: ["Object"],
  52352. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52353. }),
  52354. $globals.ClassTest);
  52355. $core.addMethod(
  52356. $core.method({
  52357. selector: "testSetJavaScriptConstructor",
  52358. protocol: "tests",
  52359. fn: function (){
  52360. var self=this,$self=this;
  52361. var instance;
  52362. return $core.withContext(function($ctx1) {
  52363. var $2,$1,$4,$3,$6,$5,$8,$7;
  52364. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52365. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52366. $2=$recv($self["@theClass"])._superclass();
  52367. $ctx1.sendIdx["superclass"]=1;
  52368. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52369. $ctx1.sendIdx["=="]=1;
  52370. $self._assert_($1);
  52371. $ctx1.sendIdx["assert:"]=1;
  52372. $4=$recv($self["@theClass"])._instanceVariableNames();
  52373. $ctx1.sendIdx["instanceVariableNames"]=1;
  52374. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52375. $ctx1.sendIdx["=="]=2;
  52376. $self._assert_($3);
  52377. $ctx1.sendIdx["assert:"]=2;
  52378. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52379. $ctx1.sendIdx["assert:equals:"]=1;
  52380. $6=$recv($self["@theClass"])._package();
  52381. $ctx1.sendIdx["package"]=1;
  52382. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52383. $ctx1.sendIdx["=="]=3;
  52384. $self._assert_($5);
  52385. $ctx1.sendIdx["assert:"]=3;
  52386. $8=$recv($self["@theClass"])._methodDictionary();
  52387. $ctx1.sendIdx["methodDictionary"]=1;
  52388. $7=$recv($8)._keys();
  52389. $ctx1.sendIdx["keys"]=1;
  52390. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52391. $ctx1.sendIdx["assert:equals:"]=2;
  52392. instance=$recv($self["@theClass"])._new();
  52393. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52394. $self._assert_equals_($recv(instance)._value(),(4));
  52395. $ctx1.sendIdx["assert:equals:"]=3;
  52396. $self._shouldnt_raise_((function(){
  52397. return $core.withContext(function($ctx2) {
  52398. return $recv(instance)._foo_((9));
  52399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52400. }),$globals.Error);
  52401. $self._assert_equals_($recv(instance)._foo(),(9));
  52402. return self;
  52403. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52404. },
  52405. args: [],
  52406. 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",
  52407. referencedClasses: ["ObjectMock", "Error"],
  52408. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52409. }),
  52410. $globals.ClassTest);
  52411. $core.addMethod(
  52412. $core.method({
  52413. selector: "testTrickySetJavaScriptConstructor",
  52414. protocol: "tests",
  52415. fn: function (){
  52416. var self=this,$self=this;
  52417. var instance;
  52418. return $core.withContext(function($ctx1) {
  52419. var $2,$1,$4,$3,$6,$5,$8,$7;
  52420. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52421. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52422. $2=$recv($self["@theClass"])._superclass();
  52423. $ctx1.sendIdx["superclass"]=1;
  52424. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52425. $ctx1.sendIdx["=="]=1;
  52426. $self._assert_($1);
  52427. $ctx1.sendIdx["assert:"]=1;
  52428. $4=$recv($self["@theClass"])._instanceVariableNames();
  52429. $ctx1.sendIdx["instanceVariableNames"]=1;
  52430. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52431. $ctx1.sendIdx["=="]=2;
  52432. $self._assert_($3);
  52433. $ctx1.sendIdx["assert:"]=2;
  52434. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52435. $ctx1.sendIdx["assert:equals:"]=1;
  52436. $6=$recv($self["@theClass"])._package();
  52437. $ctx1.sendIdx["package"]=1;
  52438. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52439. $ctx1.sendIdx["=="]=3;
  52440. $self._assert_($5);
  52441. $ctx1.sendIdx["assert:"]=3;
  52442. $8=$recv($self["@theClass"])._methodDictionary();
  52443. $ctx1.sendIdx["methodDictionary"]=1;
  52444. $7=$recv($8)._keys();
  52445. $ctx1.sendIdx["keys"]=1;
  52446. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52447. $ctx1.sendIdx["assert:equals:"]=2;
  52448. instance=$recv($self["@theClass"])._new();
  52449. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52450. $self._assert_equals_($recv(instance)._value(),(4));
  52451. $ctx1.sendIdx["assert:equals:"]=3;
  52452. $self._shouldnt_raise_((function(){
  52453. return $core.withContext(function($ctx2) {
  52454. return $recv(instance)._foo_((9));
  52455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52456. }),$globals.Error);
  52457. $self._assert_equals_($recv(instance)._foo(),(9));
  52458. return self;
  52459. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52460. },
  52461. args: [],
  52462. 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",
  52463. referencedClasses: ["ObjectMock", "Error"],
  52464. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52465. }),
  52466. $globals.ClassTest);
  52467. $core.addMethod(
  52468. $core.method({
  52469. selector: "trickyJsConstructor",
  52470. protocol: "running",
  52471. fn: function (){
  52472. var self=this,$self=this;
  52473. return $core.withContext(function($ctx1) {
  52474. function Foo(){}
  52475. Foo.prototype.valueOf = function () {return 4;};
  52476. Foo.prototype._foo = function () {return "bar";};
  52477. return Foo;
  52478. ;
  52479. return self;
  52480. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52481. },
  52482. args: [],
  52483. 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'>",
  52484. referencedClasses: [],
  52485. messageSends: []
  52486. }),
  52487. $globals.ClassTest);
  52488. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52489. $core.addMethod(
  52490. $core.method({
  52491. selector: "assertSameContents:as:",
  52492. protocol: "convenience",
  52493. fn: function (aCollection,anotherCollection){
  52494. var self=this,$self=this;
  52495. return $core.withContext(function($ctx1) {
  52496. var $2,$1,$4,$3;
  52497. $2=$recv(aCollection)._size();
  52498. $ctx1.sendIdx["size"]=1;
  52499. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52500. $ctx1.sendIdx["="]=1;
  52501. $self._assert_($1);
  52502. $ctx1.sendIdx["assert:"]=1;
  52503. $recv(aCollection)._do_((function(each){
  52504. return $core.withContext(function($ctx2) {
  52505. $4=$recv(aCollection)._occurrencesOf_(each);
  52506. $ctx2.sendIdx["occurrencesOf:"]=1;
  52507. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52508. return $self._assert_($3);
  52509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52510. }));
  52511. return self;
  52512. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52513. },
  52514. args: ["aCollection", "anotherCollection"],
  52515. 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)) ]",
  52516. referencedClasses: [],
  52517. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52518. }),
  52519. $globals.CollectionTest);
  52520. $core.addMethod(
  52521. $core.method({
  52522. selector: "collection",
  52523. protocol: "fixture",
  52524. fn: function (){
  52525. var self=this,$self=this;
  52526. return $core.withContext(function($ctx1) {
  52527. $self._subclassResponsibility();
  52528. return self;
  52529. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52530. },
  52531. args: [],
  52532. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52533. referencedClasses: [],
  52534. messageSends: ["subclassResponsibility"]
  52535. }),
  52536. $globals.CollectionTest);
  52537. $core.addMethod(
  52538. $core.method({
  52539. selector: "collectionClass",
  52540. protocol: "fixture",
  52541. fn: function (){
  52542. var self=this,$self=this;
  52543. return $core.withContext(function($ctx1) {
  52544. return $recv($self._class())._collectionClass();
  52545. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52546. },
  52547. args: [],
  52548. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52549. referencedClasses: [],
  52550. messageSends: ["collectionClass", "class"]
  52551. }),
  52552. $globals.CollectionTest);
  52553. $core.addMethod(
  52554. $core.method({
  52555. selector: "collectionOfPrintStrings",
  52556. protocol: "fixture",
  52557. fn: function (){
  52558. var self=this,$self=this;
  52559. return $core.withContext(function($ctx1) {
  52560. $self._subclassResponsibility();
  52561. return self;
  52562. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52563. },
  52564. args: [],
  52565. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52566. referencedClasses: [],
  52567. messageSends: ["subclassResponsibility"]
  52568. }),
  52569. $globals.CollectionTest);
  52570. $core.addMethod(
  52571. $core.method({
  52572. selector: "collectionSize",
  52573. protocol: "fixture",
  52574. fn: function (){
  52575. var self=this,$self=this;
  52576. return $core.withContext(function($ctx1) {
  52577. $self._subclassResponsibility();
  52578. return self;
  52579. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52580. },
  52581. args: [],
  52582. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52583. referencedClasses: [],
  52584. messageSends: ["subclassResponsibility"]
  52585. }),
  52586. $globals.CollectionTest);
  52587. $core.addMethod(
  52588. $core.method({
  52589. selector: "collectionWithDuplicates",
  52590. protocol: "fixture",
  52591. fn: function (){
  52592. var self=this,$self=this;
  52593. return $core.withContext(function($ctx1) {
  52594. $self._subclassResponsibility();
  52595. return self;
  52596. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52597. },
  52598. args: [],
  52599. 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",
  52600. referencedClasses: [],
  52601. messageSends: ["subclassResponsibility"]
  52602. }),
  52603. $globals.CollectionTest);
  52604. $core.addMethod(
  52605. $core.method({
  52606. selector: "collectionWithNewValue",
  52607. protocol: "fixture",
  52608. fn: function (){
  52609. var self=this,$self=this;
  52610. return $core.withContext(function($ctx1) {
  52611. $self._subclassResponsibility();
  52612. return self;
  52613. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52614. },
  52615. args: [],
  52616. 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",
  52617. referencedClasses: [],
  52618. messageSends: ["subclassResponsibility"]
  52619. }),
  52620. $globals.CollectionTest);
  52621. $core.addMethod(
  52622. $core.method({
  52623. selector: "initialize",
  52624. protocol: "initialization",
  52625. fn: function (){
  52626. var self=this,$self=this;
  52627. return $core.withContext(function($ctx1) {
  52628. (
  52629. $ctx1.supercall = true,
  52630. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52631. $ctx1.supercall = false;
  52632. $self["@sampleBlock"]=(function(){
  52633. });
  52634. return self;
  52635. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52636. },
  52637. args: [],
  52638. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52639. referencedClasses: [],
  52640. messageSends: ["initialize"]
  52641. }),
  52642. $globals.CollectionTest);
  52643. $core.addMethod(
  52644. $core.method({
  52645. selector: "sampleNewValue",
  52646. protocol: "fixture",
  52647. fn: function (){
  52648. var self=this,$self=this;
  52649. return "N";
  52650. },
  52651. args: [],
  52652. 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'",
  52653. referencedClasses: [],
  52654. messageSends: []
  52655. }),
  52656. $globals.CollectionTest);
  52657. $core.addMethod(
  52658. $core.method({
  52659. selector: "sampleNewValueAsCollection",
  52660. protocol: "fixture",
  52661. fn: function (){
  52662. var self=this,$self=this;
  52663. return $core.withContext(function($ctx1) {
  52664. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52665. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52666. },
  52667. args: [],
  52668. 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",
  52669. referencedClasses: [],
  52670. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52671. }),
  52672. $globals.CollectionTest);
  52673. $core.addMethod(
  52674. $core.method({
  52675. selector: "testAddAll",
  52676. protocol: "tests",
  52677. fn: function (){
  52678. var self=this,$self=this;
  52679. return $core.withContext(function($ctx1) {
  52680. 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;
  52681. $2=$self._collection();
  52682. $ctx1.sendIdx["collection"]=1;
  52683. $4=$self._collectionClass();
  52684. $ctx1.sendIdx["collectionClass"]=1;
  52685. $3=$recv($4)._new();
  52686. $ctx1.sendIdx["new"]=1;
  52687. $recv($2)._addAll_($3);
  52688. $ctx1.sendIdx["addAll:"]=1;
  52689. $5=$recv($2)._yourself();
  52690. $ctx1.sendIdx["yourself"]=1;
  52691. $1=$5;
  52692. $6=$self._collection();
  52693. $ctx1.sendIdx["collection"]=2;
  52694. $self._assert_equals_($1,$6);
  52695. $ctx1.sendIdx["assert:equals:"]=1;
  52696. $9=$self._collectionClass();
  52697. $ctx1.sendIdx["collectionClass"]=2;
  52698. $8=$recv($9)._new();
  52699. $ctx1.sendIdx["new"]=2;
  52700. $10=$self._collection();
  52701. $ctx1.sendIdx["collection"]=3;
  52702. $recv($8)._addAll_($10);
  52703. $ctx1.sendIdx["addAll:"]=2;
  52704. $11=$recv($8)._yourself();
  52705. $ctx1.sendIdx["yourself"]=2;
  52706. $7=$11;
  52707. $12=$self._collection();
  52708. $ctx1.sendIdx["collection"]=4;
  52709. $self._assert_equals_($7,$12);
  52710. $ctx1.sendIdx["assert:equals:"]=2;
  52711. $15=$self._collectionClass();
  52712. $ctx1.sendIdx["collectionClass"]=3;
  52713. $14=$recv($15)._new();
  52714. $ctx1.sendIdx["new"]=3;
  52715. $17=$self._collectionClass();
  52716. $ctx1.sendIdx["collectionClass"]=4;
  52717. $16=$recv($17)._new();
  52718. $ctx1.sendIdx["new"]=4;
  52719. $recv($14)._addAll_($16);
  52720. $ctx1.sendIdx["addAll:"]=3;
  52721. $18=$recv($14)._yourself();
  52722. $ctx1.sendIdx["yourself"]=3;
  52723. $13=$18;
  52724. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52725. $ctx1.sendIdx["assert:equals:"]=3;
  52726. $20=$self._collection();
  52727. $ctx1.sendIdx["collection"]=5;
  52728. $21=$self._sampleNewValueAsCollection();
  52729. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52730. $recv($20)._addAll_($21);
  52731. $ctx1.sendIdx["addAll:"]=4;
  52732. $22=$recv($20)._yourself();
  52733. $ctx1.sendIdx["yourself"]=4;
  52734. $19=$22;
  52735. $23=$self._collectionWithNewValue();
  52736. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52737. $self._assert_equals_($19,$23);
  52738. $25=$self._sampleNewValueAsCollection();
  52739. $recv($25)._addAll_($self._collection());
  52740. $24=$recv($25)._yourself();
  52741. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52742. return self;
  52743. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52744. },
  52745. args: [],
  52746. 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",
  52747. referencedClasses: [],
  52748. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52749. }),
  52750. $globals.CollectionTest);
  52751. $core.addMethod(
  52752. $core.method({
  52753. selector: "testAllSatisfy",
  52754. protocol: "tests",
  52755. fn: function (){
  52756. var self=this,$self=this;
  52757. var collection,anyOne;
  52758. return $core.withContext(function($ctx1) {
  52759. var $1;
  52760. collection=$self._collection();
  52761. anyOne=$recv(collection)._anyOne();
  52762. $1=$recv(collection)._allSatisfy_((function(each){
  52763. return $core.withContext(function($ctx2) {
  52764. return $recv(collection)._includes_(each);
  52765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52766. }));
  52767. $ctx1.sendIdx["allSatisfy:"]=1;
  52768. $self._assert_($1);
  52769. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52770. return $core.withContext(function($ctx2) {
  52771. return $recv(each).__tild_eq(anyOne);
  52772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52773. })));
  52774. return self;
  52775. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52776. },
  52777. args: [],
  52778. 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 ])",
  52779. referencedClasses: [],
  52780. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52781. }),
  52782. $globals.CollectionTest);
  52783. $core.addMethod(
  52784. $core.method({
  52785. selector: "testAnyOne",
  52786. protocol: "tests",
  52787. fn: function (){
  52788. var self=this,$self=this;
  52789. return $core.withContext(function($ctx1) {
  52790. var $2,$1;
  52791. $self._should_raise_((function(){
  52792. return $core.withContext(function($ctx2) {
  52793. return $recv($recv($self._collectionClass())._new())._anyOne();
  52794. $ctx2.sendIdx["anyOne"]=1;
  52795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52796. }),$globals.Error);
  52797. $2=$self._collection();
  52798. $ctx1.sendIdx["collection"]=1;
  52799. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52800. $self._assert_($1);
  52801. return self;
  52802. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52803. },
  52804. args: [],
  52805. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52806. referencedClasses: ["Error"],
  52807. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52808. }),
  52809. $globals.CollectionTest);
  52810. $core.addMethod(
  52811. $core.method({
  52812. selector: "testAnySatisfy",
  52813. protocol: "tests",
  52814. fn: function (){
  52815. var self=this,$self=this;
  52816. var anyOne;
  52817. return $core.withContext(function($ctx1) {
  52818. var $1,$3,$2;
  52819. $1=$self._collection();
  52820. $ctx1.sendIdx["collection"]=1;
  52821. anyOne=$recv($1)._anyOne();
  52822. $3=$self._collection();
  52823. $ctx1.sendIdx["collection"]=2;
  52824. $2=$recv($3)._anySatisfy_((function(each){
  52825. return $core.withContext(function($ctx2) {
  52826. return $recv(each).__eq(anyOne);
  52827. $ctx2.sendIdx["="]=1;
  52828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52829. }));
  52830. $ctx1.sendIdx["anySatisfy:"]=1;
  52831. $self._assert_($2);
  52832. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52833. return $core.withContext(function($ctx2) {
  52834. return $recv(each).__eq($recv($globals.Object)._new());
  52835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52836. })));
  52837. return self;
  52838. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52839. },
  52840. args: [],
  52841. 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 ])",
  52842. referencedClasses: ["Object"],
  52843. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52844. }),
  52845. $globals.CollectionTest);
  52846. $core.addMethod(
  52847. $core.method({
  52848. selector: "testAsArray",
  52849. protocol: "tests",
  52850. fn: function (){
  52851. var self=this,$self=this;
  52852. return $core.withContext(function($ctx1) {
  52853. var $1;
  52854. $1=$self._collection();
  52855. $ctx1.sendIdx["collection"]=1;
  52856. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52857. return self;
  52858. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52859. },
  52860. args: [],
  52861. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52862. referencedClasses: [],
  52863. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52864. }),
  52865. $globals.CollectionTest);
  52866. $core.addMethod(
  52867. $core.method({
  52868. selector: "testAsOrderedCollection",
  52869. protocol: "tests",
  52870. fn: function (){
  52871. var self=this,$self=this;
  52872. return $core.withContext(function($ctx1) {
  52873. var $1;
  52874. $1=$self._collection();
  52875. $ctx1.sendIdx["collection"]=1;
  52876. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52877. return self;
  52878. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52879. },
  52880. args: [],
  52881. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52882. referencedClasses: [],
  52883. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52884. }),
  52885. $globals.CollectionTest);
  52886. $core.addMethod(
  52887. $core.method({
  52888. selector: "testAsSet",
  52889. protocol: "tests",
  52890. fn: function (){
  52891. var self=this,$self=this;
  52892. var c,set;
  52893. return $core.withContext(function($ctx1) {
  52894. c=$self._collectionWithDuplicates();
  52895. set=$recv(c)._asSet();
  52896. $self._assert_equals_($recv(set)._size(),(6));
  52897. $recv(c)._do_((function(each){
  52898. return $core.withContext(function($ctx2) {
  52899. return $self._assert_($recv(set)._includes_(each));
  52900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52901. }));
  52902. return self;
  52903. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52904. },
  52905. args: [],
  52906. 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) ]",
  52907. referencedClasses: [],
  52908. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52909. }),
  52910. $globals.CollectionTest);
  52911. $core.addMethod(
  52912. $core.method({
  52913. selector: "testCollect",
  52914. protocol: "tests",
  52915. fn: function (){
  52916. var self=this,$self=this;
  52917. return $core.withContext(function($ctx1) {
  52918. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52919. $2=$self._collection();
  52920. $ctx1.sendIdx["collection"]=1;
  52921. $1=$recv($2)._collect_((function(each){
  52922. return each;
  52923. }));
  52924. $ctx1.sendIdx["collect:"]=1;
  52925. $3=$self._collection();
  52926. $ctx1.sendIdx["collection"]=2;
  52927. $self._assert_equals_($1,$3);
  52928. $ctx1.sendIdx["assert:equals:"]=1;
  52929. $5=$self._collectionWithNewValue();
  52930. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52931. $4=$recv($5)._collect_((function(each){
  52932. return each;
  52933. }));
  52934. $ctx1.sendIdx["collect:"]=2;
  52935. $self._assert_equals_($4,$self._collectionWithNewValue());
  52936. $ctx1.sendIdx["assert:equals:"]=2;
  52937. $8=$self._collectionClass();
  52938. $ctx1.sendIdx["collectionClass"]=1;
  52939. $7=$recv($8)._new();
  52940. $ctx1.sendIdx["new"]=1;
  52941. $6=$recv($7)._collect_((function(each){
  52942. return $core.withContext(function($ctx2) {
  52943. return $recv(each)._printString();
  52944. $ctx2.sendIdx["printString"]=1;
  52945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52946. }));
  52947. $ctx1.sendIdx["collect:"]=3;
  52948. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52949. $ctx1.sendIdx["assert:equals:"]=3;
  52950. $11=$self._collection();
  52951. $ctx1.sendIdx["collection"]=3;
  52952. $10=$recv($11)._collect_((function(){
  52953. return $core.withContext(function($ctx2) {
  52954. return $self._sampleNewValue();
  52955. $ctx2.sendIdx["sampleNewValue"]=1;
  52956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52957. }));
  52958. $ctx1.sendIdx["collect:"]=4;
  52959. $9=$recv($10)._detect_((function(){
  52960. return true;
  52961. }));
  52962. $self._assert_equals_($9,$self._sampleNewValue());
  52963. $ctx1.sendIdx["assert:equals:"]=4;
  52964. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52965. return $core.withContext(function($ctx2) {
  52966. return $recv(each)._printString();
  52967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52968. })),$self._collectionOfPrintStrings());
  52969. return self;
  52970. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52971. },
  52972. args: [],
  52973. 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",
  52974. referencedClasses: [],
  52975. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52976. }),
  52977. $globals.CollectionTest);
  52978. $core.addMethod(
  52979. $core.method({
  52980. selector: "testComma",
  52981. protocol: "tests",
  52982. fn: function (){
  52983. var self=this,$self=this;
  52984. return $core.withContext(function($ctx1) {
  52985. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52986. $2=$self._collection();
  52987. $ctx1.sendIdx["collection"]=1;
  52988. $4=$self._collectionClass();
  52989. $ctx1.sendIdx["collectionClass"]=1;
  52990. $3=$recv($4)._new();
  52991. $ctx1.sendIdx["new"]=1;
  52992. $1=$recv($2).__comma($3);
  52993. $ctx1.sendIdx[","]=1;
  52994. $5=$self._collection();
  52995. $ctx1.sendIdx["collection"]=2;
  52996. $self._assert_equals_($1,$5);
  52997. $ctx1.sendIdx["assert:equals:"]=1;
  52998. $8=$self._collectionClass();
  52999. $ctx1.sendIdx["collectionClass"]=2;
  53000. $7=$recv($8)._new();
  53001. $ctx1.sendIdx["new"]=2;
  53002. $9=$self._collection();
  53003. $ctx1.sendIdx["collection"]=3;
  53004. $6=$recv($7).__comma($9);
  53005. $ctx1.sendIdx[","]=2;
  53006. $10=$self._collection();
  53007. $ctx1.sendIdx["collection"]=4;
  53008. $self._assert_equals_($6,$10);
  53009. $ctx1.sendIdx["assert:equals:"]=2;
  53010. $13=$self._collectionClass();
  53011. $ctx1.sendIdx["collectionClass"]=3;
  53012. $12=$recv($13)._new();
  53013. $ctx1.sendIdx["new"]=3;
  53014. $15=$self._collectionClass();
  53015. $ctx1.sendIdx["collectionClass"]=4;
  53016. $14=$recv($15)._new();
  53017. $ctx1.sendIdx["new"]=4;
  53018. $11=$recv($12).__comma($14);
  53019. $ctx1.sendIdx[","]=3;
  53020. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  53021. $ctx1.sendIdx["assert:equals:"]=3;
  53022. $17=$self._collection();
  53023. $ctx1.sendIdx["collection"]=5;
  53024. $18=$self._sampleNewValueAsCollection();
  53025. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  53026. $16=$recv($17).__comma($18);
  53027. $ctx1.sendIdx[","]=4;
  53028. $19=$self._collectionWithNewValue();
  53029. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53030. $self._assert_equals_($16,$19);
  53031. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  53032. return self;
  53033. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  53034. },
  53035. args: [],
  53036. 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",
  53037. referencedClasses: [],
  53038. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  53039. }),
  53040. $globals.CollectionTest);
  53041. $core.addMethod(
  53042. $core.method({
  53043. selector: "testCopy",
  53044. protocol: "tests",
  53045. fn: function (){
  53046. var self=this,$self=this;
  53047. return $core.withContext(function($ctx1) {
  53048. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  53049. $3=$self._collectionClass();
  53050. $ctx1.sendIdx["collectionClass"]=1;
  53051. $2=$recv($3)._new();
  53052. $ctx1.sendIdx["new"]=1;
  53053. $1=$recv($2)._copy();
  53054. $ctx1.sendIdx["copy"]=1;
  53055. $5=$self._collectionClass();
  53056. $ctx1.sendIdx["collectionClass"]=2;
  53057. $4=$recv($5)._new();
  53058. $ctx1.sendIdx["new"]=2;
  53059. $self._assert_equals_($1,$4);
  53060. $ctx1.sendIdx["assert:equals:"]=1;
  53061. $7=$self._collection();
  53062. $ctx1.sendIdx["collection"]=1;
  53063. $6=$recv($7)._copy();
  53064. $ctx1.sendIdx["copy"]=2;
  53065. $8=$self._collection();
  53066. $ctx1.sendIdx["collection"]=2;
  53067. $self._assert_equals_($6,$8);
  53068. $ctx1.sendIdx["assert:equals:"]=2;
  53069. $10=$self._collectionWithNewValue();
  53070. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53071. $9=$recv($10)._copy();
  53072. $ctx1.sendIdx["copy"]=3;
  53073. $11=$self._collectionWithNewValue();
  53074. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53075. $self._assert_equals_($9,$11);
  53076. $15=$self._collectionClass();
  53077. $ctx1.sendIdx["collectionClass"]=3;
  53078. $14=$recv($15)._new();
  53079. $ctx1.sendIdx["new"]=3;
  53080. $13=$recv($14)._copy();
  53081. $ctx1.sendIdx["copy"]=4;
  53082. $16=$self._collection();
  53083. $ctx1.sendIdx["collection"]=3;
  53084. $12=$recv($13).__eq($16);
  53085. $ctx1.sendIdx["="]=1;
  53086. $self._deny_($12);
  53087. $ctx1.sendIdx["deny:"]=1;
  53088. $19=$self._collection();
  53089. $ctx1.sendIdx["collection"]=4;
  53090. $18=$recv($19)._copy();
  53091. $ctx1.sendIdx["copy"]=5;
  53092. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  53093. $ctx1.sendIdx["="]=2;
  53094. $self._deny_($17);
  53095. $ctx1.sendIdx["deny:"]=2;
  53096. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  53097. return self;
  53098. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  53099. },
  53100. args: [],
  53101. 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",
  53102. referencedClasses: [],
  53103. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53104. }),
  53105. $globals.CollectionTest);
  53106. $core.addMethod(
  53107. $core.method({
  53108. selector: "testCopySeparates",
  53109. protocol: "tests",
  53110. fn: function (){
  53111. var self=this,$self=this;
  53112. var original,copy;
  53113. return $core.withContext(function($ctx1) {
  53114. original=$self._collection();
  53115. $ctx1.sendIdx["collection"]=1;
  53116. copy=$recv(original)._copy();
  53117. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  53118. $self._assert_($recv(original).__eq($self._collection()));
  53119. return self;
  53120. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  53121. },
  53122. args: [],
  53123. 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",
  53124. referencedClasses: [],
  53125. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  53126. }),
  53127. $globals.CollectionTest);
  53128. $core.addMethod(
  53129. $core.method({
  53130. selector: "testDetect",
  53131. protocol: "tests",
  53132. fn: function (){
  53133. var self=this,$self=this;
  53134. return $core.withContext(function($ctx1) {
  53135. var $1,$2,$3,$4,$6,$5,$7;
  53136. $self._shouldnt_raise_((function(){
  53137. return $core.withContext(function($ctx2) {
  53138. $1=$self._collection();
  53139. $ctx2.sendIdx["collection"]=1;
  53140. return $recv($1)._detect_((function(){
  53141. return true;
  53142. }));
  53143. $ctx2.sendIdx["detect:"]=1;
  53144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53145. }),$globals.Error);
  53146. $self._should_raise_((function(){
  53147. return $core.withContext(function($ctx2) {
  53148. $2=$self._collection();
  53149. $ctx2.sendIdx["collection"]=2;
  53150. return $recv($2)._detect_((function(){
  53151. return false;
  53152. }));
  53153. $ctx2.sendIdx["detect:"]=2;
  53154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53155. }),$globals.Error);
  53156. $ctx1.sendIdx["should:raise:"]=1;
  53157. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  53158. return true;
  53159. }));
  53160. $ctx1.sendIdx["detect:"]=3;
  53161. $4=$self._sampleNewValue();
  53162. $ctx1.sendIdx["sampleNewValue"]=1;
  53163. $self._assert_equals_($3,$4);
  53164. $ctx1.sendIdx["assert:equals:"]=1;
  53165. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  53166. return $core.withContext(function($ctx2) {
  53167. $6=$self._sampleNewValue();
  53168. $ctx2.sendIdx["sampleNewValue"]=2;
  53169. return $recv(each).__eq($6);
  53170. $ctx2.sendIdx["="]=1;
  53171. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53172. }));
  53173. $ctx1.sendIdx["detect:"]=4;
  53174. $7=$self._sampleNewValue();
  53175. $ctx1.sendIdx["sampleNewValue"]=3;
  53176. $self._assert_equals_($5,$7);
  53177. $self._should_raise_((function(){
  53178. return $core.withContext(function($ctx2) {
  53179. return $recv($self._collection())._detect_((function(each){
  53180. return $core.withContext(function($ctx3) {
  53181. return $recv(each).__eq($self._sampleNewValue());
  53182. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  53183. }));
  53184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53185. }),$globals.Error);
  53186. return self;
  53187. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53188. },
  53189. args: [],
  53190. 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",
  53191. referencedClasses: ["Error"],
  53192. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53193. }),
  53194. $globals.CollectionTest);
  53195. $core.addMethod(
  53196. $core.method({
  53197. selector: "testDetectIfNone",
  53198. protocol: "tests",
  53199. fn: function (){
  53200. var self=this,$self=this;
  53201. var sentinel;
  53202. return $core.withContext(function($ctx1) {
  53203. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53204. sentinel=$recv($globals.Object)._new();
  53205. $3=$self._collection();
  53206. $ctx1.sendIdx["collection"]=1;
  53207. $2=$recv($3)._detect_ifNone_((function(){
  53208. return true;
  53209. }),(function(){
  53210. return sentinel;
  53211. }));
  53212. $ctx1.sendIdx["detect:ifNone:"]=1;
  53213. $1=$recv($2).__tild_eq(sentinel);
  53214. $self._assert_($1);
  53215. $5=$self._collection();
  53216. $ctx1.sendIdx["collection"]=2;
  53217. $4=$recv($5)._detect_ifNone_((function(){
  53218. return false;
  53219. }),(function(){
  53220. return sentinel;
  53221. }));
  53222. $ctx1.sendIdx["detect:ifNone:"]=2;
  53223. $self._assert_equals_($4,sentinel);
  53224. $ctx1.sendIdx["assert:equals:"]=1;
  53225. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53226. return true;
  53227. }),(function(){
  53228. return sentinel;
  53229. }));
  53230. $ctx1.sendIdx["detect:ifNone:"]=3;
  53231. $7=$self._sampleNewValue();
  53232. $ctx1.sendIdx["sampleNewValue"]=1;
  53233. $self._assert_equals_($6,$7);
  53234. $ctx1.sendIdx["assert:equals:"]=2;
  53235. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53236. return $core.withContext(function($ctx2) {
  53237. $9=$self._sampleNewValue();
  53238. $ctx2.sendIdx["sampleNewValue"]=2;
  53239. return $recv(each).__eq($9);
  53240. $ctx2.sendIdx["="]=1;
  53241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53242. }),(function(){
  53243. return sentinel;
  53244. }));
  53245. $ctx1.sendIdx["detect:ifNone:"]=4;
  53246. $10=$self._sampleNewValue();
  53247. $ctx1.sendIdx["sampleNewValue"]=3;
  53248. $self._assert_equals_($8,$10);
  53249. $ctx1.sendIdx["assert:equals:"]=3;
  53250. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53251. return $core.withContext(function($ctx2) {
  53252. return $recv(each).__eq($self._sampleNewValue());
  53253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53254. }),(function(){
  53255. return sentinel;
  53256. })),sentinel);
  53257. return self;
  53258. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53259. },
  53260. args: [],
  53261. 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",
  53262. referencedClasses: ["Object"],
  53263. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53264. }),
  53265. $globals.CollectionTest);
  53266. $core.addMethod(
  53267. $core.method({
  53268. selector: "testDo",
  53269. protocol: "tests",
  53270. fn: function (){
  53271. var self=this,$self=this;
  53272. var newCollection;
  53273. return $core.withContext(function($ctx1) {
  53274. var $1,$2;
  53275. newCollection=$recv($globals.OrderedCollection)._new();
  53276. $ctx1.sendIdx["new"]=1;
  53277. $1=$self._collection();
  53278. $ctx1.sendIdx["collection"]=1;
  53279. $recv($1)._do_((function(each){
  53280. return $core.withContext(function($ctx2) {
  53281. return $recv(newCollection)._add_(each);
  53282. $ctx2.sendIdx["add:"]=1;
  53283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53284. }));
  53285. $ctx1.sendIdx["do:"]=1;
  53286. $self._assertSameContents_as_($self._collection(),newCollection);
  53287. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53288. newCollection=$recv($globals.OrderedCollection)._new();
  53289. $2=$self._collectionWithDuplicates();
  53290. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53291. $recv($2)._do_((function(each){
  53292. return $core.withContext(function($ctx2) {
  53293. return $recv(newCollection)._add_(each);
  53294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53295. }));
  53296. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53297. return self;
  53298. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53299. },
  53300. args: [],
  53301. 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",
  53302. referencedClasses: ["OrderedCollection"],
  53303. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53304. }),
  53305. $globals.CollectionTest);
  53306. $core.addMethod(
  53307. $core.method({
  53308. selector: "testEquality",
  53309. protocol: "tests",
  53310. fn: function (){
  53311. var self=this,$self=this;
  53312. return $core.withContext(function($ctx1) {
  53313. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53314. $2=$self._collectionClass();
  53315. $ctx1.sendIdx["collectionClass"]=1;
  53316. $1=$recv($2)._new();
  53317. $ctx1.sendIdx["new"]=1;
  53318. $4=$self._collectionClass();
  53319. $ctx1.sendIdx["collectionClass"]=2;
  53320. $3=$recv($4)._new();
  53321. $ctx1.sendIdx["new"]=2;
  53322. $self._assert_equals_($1,$3);
  53323. $ctx1.sendIdx["assert:equals:"]=1;
  53324. $5=$self._collection();
  53325. $ctx1.sendIdx["collection"]=1;
  53326. $6=$self._collection();
  53327. $ctx1.sendIdx["collection"]=2;
  53328. $self._assert_equals_($5,$6);
  53329. $ctx1.sendIdx["assert:equals:"]=2;
  53330. $7=$self._collectionWithNewValue();
  53331. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53332. $8=$self._collectionWithNewValue();
  53333. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53334. $self._assert_equals_($7,$8);
  53335. $11=$self._collectionClass();
  53336. $ctx1.sendIdx["collectionClass"]=3;
  53337. $10=$recv($11)._new();
  53338. $ctx1.sendIdx["new"]=3;
  53339. $12=$self._collection();
  53340. $ctx1.sendIdx["collection"]=3;
  53341. $9=$recv($10).__eq($12);
  53342. $ctx1.sendIdx["="]=1;
  53343. $self._deny_($9);
  53344. $ctx1.sendIdx["deny:"]=1;
  53345. $14=$self._collection();
  53346. $ctx1.sendIdx["collection"]=4;
  53347. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53348. $ctx1.sendIdx["="]=2;
  53349. $self._deny_($13);
  53350. $ctx1.sendIdx["deny:"]=2;
  53351. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53352. return self;
  53353. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53354. },
  53355. args: [],
  53356. 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",
  53357. referencedClasses: [],
  53358. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53359. }),
  53360. $globals.CollectionTest);
  53361. $core.addMethod(
  53362. $core.method({
  53363. selector: "testIfEmptyFamily",
  53364. protocol: "tests",
  53365. fn: function (){
  53366. var self=this,$self=this;
  53367. return $core.withContext(function($ctx1) {
  53368. 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;
  53369. $3=$self._collectionClass();
  53370. $ctx1.sendIdx["collectionClass"]=1;
  53371. $2=$recv($3)._new();
  53372. $ctx1.sendIdx["new"]=1;
  53373. $1=$recv($2)._ifEmpty_((function(){
  53374. return (42);
  53375. }));
  53376. $ctx1.sendIdx["ifEmpty:"]=1;
  53377. $self._assert_equals_($1,(42));
  53378. $ctx1.sendIdx["assert:equals:"]=1;
  53379. $5=$self._collection();
  53380. $ctx1.sendIdx["collection"]=1;
  53381. $4=$recv($5)._ifEmpty_((function(){
  53382. return (42);
  53383. }));
  53384. $6=$self._collection();
  53385. $ctx1.sendIdx["collection"]=2;
  53386. $self._assert_equals_($4,$6);
  53387. $ctx1.sendIdx["assert:equals:"]=2;
  53388. $9=$self._collectionClass();
  53389. $ctx1.sendIdx["collectionClass"]=2;
  53390. $8=$recv($9)._new();
  53391. $ctx1.sendIdx["new"]=2;
  53392. $7=$recv($8)._ifNotEmpty_((function(){
  53393. return (42);
  53394. }));
  53395. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53396. $11=$self._collectionClass();
  53397. $ctx1.sendIdx["collectionClass"]=3;
  53398. $10=$recv($11)._new();
  53399. $ctx1.sendIdx["new"]=3;
  53400. $self._assert_equals_($7,$10);
  53401. $ctx1.sendIdx["assert:equals:"]=3;
  53402. $13=$self._collection();
  53403. $ctx1.sendIdx["collection"]=3;
  53404. $12=$recv($13)._ifNotEmpty_((function(){
  53405. return (42);
  53406. }));
  53407. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53408. $self._assert_equals_($12,(42));
  53409. $ctx1.sendIdx["assert:equals:"]=4;
  53410. $15=$self._collection();
  53411. $ctx1.sendIdx["collection"]=4;
  53412. $14=$recv($15)._ifNotEmpty_((function(col){
  53413. return col;
  53414. }));
  53415. $16=$self._collection();
  53416. $ctx1.sendIdx["collection"]=5;
  53417. $self._assert_equals_($14,$16);
  53418. $ctx1.sendIdx["assert:equals:"]=5;
  53419. $19=$self._collectionClass();
  53420. $ctx1.sendIdx["collectionClass"]=4;
  53421. $18=$recv($19)._new();
  53422. $ctx1.sendIdx["new"]=4;
  53423. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53424. return (42);
  53425. }),(function(){
  53426. return (999);
  53427. }));
  53428. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53429. $self._assert_equals_($17,(42));
  53430. $ctx1.sendIdx["assert:equals:"]=6;
  53431. $21=$self._collection();
  53432. $ctx1.sendIdx["collection"]=6;
  53433. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53434. return (42);
  53435. }),(function(){
  53436. return (999);
  53437. }));
  53438. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53439. $self._assert_equals_($20,(999));
  53440. $ctx1.sendIdx["assert:equals:"]=7;
  53441. $23=$self._collection();
  53442. $ctx1.sendIdx["collection"]=7;
  53443. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53444. return (42);
  53445. }),(function(col){
  53446. return col;
  53447. }));
  53448. $24=$self._collection();
  53449. $ctx1.sendIdx["collection"]=8;
  53450. $self._assert_equals_($22,$24);
  53451. $ctx1.sendIdx["assert:equals:"]=8;
  53452. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53453. return (42);
  53454. }),(function(){
  53455. return (999);
  53456. }));
  53457. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53458. $self._assert_equals_($25,(999));
  53459. $ctx1.sendIdx["assert:equals:"]=9;
  53460. $27=$self._collection();
  53461. $ctx1.sendIdx["collection"]=9;
  53462. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53463. return (42);
  53464. }),(function(){
  53465. return (999);
  53466. }));
  53467. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53468. $self._assert_equals_($26,(42));
  53469. $ctx1.sendIdx["assert:equals:"]=10;
  53470. $29=$self._collection();
  53471. $ctx1.sendIdx["collection"]=10;
  53472. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53473. return col;
  53474. }),(function(){
  53475. return (999);
  53476. }));
  53477. $self._assert_equals_($28,$self._collection());
  53478. return self;
  53479. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53480. },
  53481. args: [],
  53482. 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.",
  53483. referencedClasses: [],
  53484. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53485. }),
  53486. $globals.CollectionTest);
  53487. $core.addMethod(
  53488. $core.method({
  53489. selector: "testIsEmpty",
  53490. protocol: "tests",
  53491. fn: function (){
  53492. var self=this,$self=this;
  53493. return $core.withContext(function($ctx1) {
  53494. var $1;
  53495. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53496. $ctx1.sendIdx["isEmpty"]=1;
  53497. $self._assert_($1);
  53498. $self._deny_($recv($self._collection())._isEmpty());
  53499. return self;
  53500. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53501. },
  53502. args: [],
  53503. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53504. referencedClasses: [],
  53505. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53506. }),
  53507. $globals.CollectionTest);
  53508. $core.addMethod(
  53509. $core.method({
  53510. selector: "testNoneSatisfy",
  53511. protocol: "tests",
  53512. fn: function (){
  53513. var self=this,$self=this;
  53514. var anyOne;
  53515. return $core.withContext(function($ctx1) {
  53516. var $1,$3,$2;
  53517. $1=$self._collection();
  53518. $ctx1.sendIdx["collection"]=1;
  53519. anyOne=$recv($1)._anyOne();
  53520. $3=$self._collection();
  53521. $ctx1.sendIdx["collection"]=2;
  53522. $2=$recv($3)._noneSatisfy_((function(each){
  53523. return $core.withContext(function($ctx2) {
  53524. return $recv(each).__eq(anyOne);
  53525. $ctx2.sendIdx["="]=1;
  53526. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53527. }));
  53528. $ctx1.sendIdx["noneSatisfy:"]=1;
  53529. $self._deny_($2);
  53530. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53531. return $core.withContext(function($ctx2) {
  53532. return $recv(each).__eq($recv($globals.Object)._new());
  53533. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53534. })));
  53535. return self;
  53536. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53537. },
  53538. args: [],
  53539. 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 ])",
  53540. referencedClasses: ["Object"],
  53541. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53542. }),
  53543. $globals.CollectionTest);
  53544. $core.addMethod(
  53545. $core.method({
  53546. selector: "testRegression1224",
  53547. protocol: "tests",
  53548. fn: function (){
  53549. var self=this,$self=this;
  53550. return $core.withContext(function($ctx1) {
  53551. var $3,$2,$1;
  53552. $3=$recv($self._collectionClass())._new();
  53553. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53554. }));
  53555. $2=$recv($3)._yourself();
  53556. $1=$recv($2)._size();
  53557. $self._assert_equals_($1,(0));
  53558. return self;
  53559. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53560. },
  53561. args: [],
  53562. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53563. referencedClasses: [],
  53564. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53565. }),
  53566. $globals.CollectionTest);
  53567. $core.addMethod(
  53568. $core.method({
  53569. selector: "testRemoveAll",
  53570. protocol: "tests",
  53571. fn: function (){
  53572. var self=this,$self=this;
  53573. return $core.withContext(function($ctx1) {
  53574. var $2,$1;
  53575. $2=$self._collection();
  53576. $recv($2)._removeAll();
  53577. $1=$recv($2)._yourself();
  53578. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53579. return self;
  53580. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53581. },
  53582. args: [],
  53583. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53584. referencedClasses: [],
  53585. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53586. }),
  53587. $globals.CollectionTest);
  53588. $core.addMethod(
  53589. $core.method({
  53590. selector: "testSelect",
  53591. protocol: "tests",
  53592. fn: function (){
  53593. var self=this,$self=this;
  53594. return $core.withContext(function($ctx1) {
  53595. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53596. $2=$self._collection();
  53597. $ctx1.sendIdx["collection"]=1;
  53598. $1=$recv($2)._select_((function(){
  53599. return false;
  53600. }));
  53601. $ctx1.sendIdx["select:"]=1;
  53602. $4=$self._collectionClass();
  53603. $ctx1.sendIdx["collectionClass"]=1;
  53604. $3=$recv($4)._new();
  53605. $ctx1.sendIdx["new"]=1;
  53606. $self._assert_equals_($1,$3);
  53607. $ctx1.sendIdx["assert:equals:"]=1;
  53608. $6=$self._collection();
  53609. $ctx1.sendIdx["collection"]=2;
  53610. $5=$recv($6)._select_((function(){
  53611. return true;
  53612. }));
  53613. $ctx1.sendIdx["select:"]=2;
  53614. $7=$self._collection();
  53615. $ctx1.sendIdx["collection"]=3;
  53616. $self._assert_equals_($5,$7);
  53617. $ctx1.sendIdx["assert:equals:"]=2;
  53618. $9=$self._collectionWithNewValue();
  53619. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53620. $8=$recv($9)._select_((function(each){
  53621. return $core.withContext(function($ctx2) {
  53622. $10=$self._sampleNewValue();
  53623. $ctx2.sendIdx["sampleNewValue"]=1;
  53624. return $recv(each).__eq($10);
  53625. $ctx2.sendIdx["="]=1;
  53626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53627. }));
  53628. $ctx1.sendIdx["select:"]=3;
  53629. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53630. $ctx1.sendIdx["assert:equals:"]=3;
  53631. $12=$self._collectionWithNewValue();
  53632. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53633. $11=$recv($12)._select_((function(each){
  53634. return $core.withContext(function($ctx2) {
  53635. $13=$self._sampleNewValue();
  53636. $ctx2.sendIdx["sampleNewValue"]=2;
  53637. return $recv(each).__tild_eq($13);
  53638. $ctx2.sendIdx["~="]=1;
  53639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53640. }));
  53641. $ctx1.sendIdx["select:"]=4;
  53642. $14=$self._collection();
  53643. $ctx1.sendIdx["collection"]=4;
  53644. $self._assert_equals_($11,$14);
  53645. $ctx1.sendIdx["assert:equals:"]=4;
  53646. $16=$self._collection();
  53647. $ctx1.sendIdx["collection"]=5;
  53648. $15=$recv($16)._select_((function(each){
  53649. return $core.withContext(function($ctx2) {
  53650. $17=$self._sampleNewValue();
  53651. $ctx2.sendIdx["sampleNewValue"]=3;
  53652. return $recv(each).__eq($17);
  53653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53654. }));
  53655. $ctx1.sendIdx["select:"]=5;
  53656. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53657. $ctx1.sendIdx["assert:equals:"]=5;
  53658. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53659. return $core.withContext(function($ctx2) {
  53660. return $recv(each).__tild_eq($self._sampleNewValue());
  53661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53662. })),$self._collection());
  53663. return self;
  53664. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53665. },
  53666. args: [],
  53667. 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",
  53668. referencedClasses: [],
  53669. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53670. }),
  53671. $globals.CollectionTest);
  53672. $core.addMethod(
  53673. $core.method({
  53674. selector: "testSelectThenCollect",
  53675. protocol: "tests",
  53676. fn: function (){
  53677. var self=this,$self=this;
  53678. return $core.withContext(function($ctx1) {
  53679. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53680. $2=$self._collection();
  53681. $ctx1.sendIdx["collection"]=1;
  53682. $1=$recv($2)._select_thenCollect_((function(){
  53683. return false;
  53684. }),"isString");
  53685. $ctx1.sendIdx["select:thenCollect:"]=1;
  53686. $4=$self._collectionClass();
  53687. $ctx1.sendIdx["collectionClass"]=1;
  53688. $3=$recv($4)._new();
  53689. $ctx1.sendIdx["new"]=1;
  53690. $self._assert_equals_($1,$3);
  53691. $ctx1.sendIdx["assert:equals:"]=1;
  53692. $6=$self._collection();
  53693. $ctx1.sendIdx["collection"]=2;
  53694. $5=$recv($6)._select_thenCollect_((function(){
  53695. return true;
  53696. }),(function(x){
  53697. return x;
  53698. }));
  53699. $ctx1.sendIdx["select:thenCollect:"]=2;
  53700. $7=$self._collection();
  53701. $ctx1.sendIdx["collection"]=3;
  53702. $self._assert_equals_($5,$7);
  53703. $ctx1.sendIdx["assert:equals:"]=2;
  53704. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53705. return $core.withContext(function($ctx2) {
  53706. $9=$self._sampleNewValue();
  53707. $ctx2.sendIdx["sampleNewValue"]=1;
  53708. return $recv(each).__eq($9);
  53709. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53710. }),(function(x){
  53711. return x;
  53712. }));
  53713. $ctx1.sendIdx["select:thenCollect:"]=3;
  53714. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53715. $ctx1.sendIdx["assert:equals:"]=3;
  53716. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53717. return $core.withContext(function($ctx2) {
  53718. return $recv(each).__tild_eq($self._sampleNewValue());
  53719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53720. }),"printString"),$self._collectionOfPrintStrings());
  53721. return self;
  53722. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53723. },
  53724. args: [],
  53725. 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",
  53726. referencedClasses: [],
  53727. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53728. }),
  53729. $globals.CollectionTest);
  53730. $core.addMethod(
  53731. $core.method({
  53732. selector: "testSingle",
  53733. protocol: "tests",
  53734. fn: function (){
  53735. var self=this,$self=this;
  53736. return $core.withContext(function($ctx1) {
  53737. $self._should_raise_((function(){
  53738. return $core.withContext(function($ctx2) {
  53739. return $recv($recv($self._collectionClass())._new())._single();
  53740. $ctx2.sendIdx["single"]=1;
  53741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53742. }),$globals.Error);
  53743. $ctx1.sendIdx["should:raise:"]=1;
  53744. $self._should_raise_((function(){
  53745. return $core.withContext(function($ctx2) {
  53746. return $recv($self._collection())._single();
  53747. $ctx2.sendIdx["single"]=2;
  53748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53749. }),$globals.Error);
  53750. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53751. return self;
  53752. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53753. },
  53754. args: [],
  53755. 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",
  53756. referencedClasses: ["Error"],
  53757. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53758. }),
  53759. $globals.CollectionTest);
  53760. $core.addMethod(
  53761. $core.method({
  53762. selector: "testSize",
  53763. protocol: "tests",
  53764. fn: function (){
  53765. var self=this,$self=this;
  53766. return $core.withContext(function($ctx1) {
  53767. var $1,$2;
  53768. $1=$recv($recv($self._collectionClass())._new())._size();
  53769. $ctx1.sendIdx["size"]=1;
  53770. $self._assert_equals_($1,(0));
  53771. $ctx1.sendIdx["assert:equals:"]=1;
  53772. $2=$recv($self._sampleNewValueAsCollection())._size();
  53773. $ctx1.sendIdx["size"]=2;
  53774. $self._assert_equals_($2,(1));
  53775. $ctx1.sendIdx["assert:equals:"]=2;
  53776. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53777. return self;
  53778. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53779. },
  53780. args: [],
  53781. 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",
  53782. referencedClasses: [],
  53783. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53784. }),
  53785. $globals.CollectionTest);
  53786. $core.addMethod(
  53787. $core.method({
  53788. selector: "collectionClass",
  53789. protocol: "fixture",
  53790. fn: function (){
  53791. var self=this,$self=this;
  53792. return nil;
  53793. },
  53794. args: [],
  53795. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53796. referencedClasses: [],
  53797. messageSends: []
  53798. }),
  53799. $globals.CollectionTest.a$cls);
  53800. $core.addMethod(
  53801. $core.method({
  53802. selector: "isAbstract",
  53803. protocol: "testing",
  53804. fn: function (){
  53805. var self=this,$self=this;
  53806. return $core.withContext(function($ctx1) {
  53807. return $recv($self._collectionClass())._isNil();
  53808. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53809. },
  53810. args: [],
  53811. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53812. referencedClasses: [],
  53813. messageSends: ["isNil", "collectionClass"]
  53814. }),
  53815. $globals.CollectionTest.a$cls);
  53816. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53817. $core.addMethod(
  53818. $core.method({
  53819. selector: "collectionWithNewValue",
  53820. protocol: "fixture",
  53821. fn: function (){
  53822. var self=this,$self=this;
  53823. return $core.withContext(function($ctx1) {
  53824. $self._subclassResponsibility();
  53825. return self;
  53826. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53827. },
  53828. args: [],
  53829. 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",
  53830. referencedClasses: [],
  53831. messageSends: ["subclassResponsibility"]
  53832. }),
  53833. $globals.IndexableCollectionTest);
  53834. $core.addMethod(
  53835. $core.method({
  53836. selector: "nonIndexesDo:",
  53837. protocol: "fixture",
  53838. fn: function (aBlock){
  53839. var self=this,$self=this;
  53840. return $core.withContext(function($ctx1) {
  53841. $self._subclassResponsibility();
  53842. return self;
  53843. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53844. },
  53845. args: ["aBlock"],
  53846. 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",
  53847. referencedClasses: [],
  53848. messageSends: ["subclassResponsibility"]
  53849. }),
  53850. $globals.IndexableCollectionTest);
  53851. $core.addMethod(
  53852. $core.method({
  53853. selector: "sampleNewIndex",
  53854. protocol: "fixture",
  53855. fn: function (){
  53856. var self=this,$self=this;
  53857. return $core.withContext(function($ctx1) {
  53858. $self._subclassResponsibility();
  53859. return self;
  53860. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53861. },
  53862. args: [],
  53863. 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",
  53864. referencedClasses: [],
  53865. messageSends: ["subclassResponsibility"]
  53866. }),
  53867. $globals.IndexableCollectionTest);
  53868. $core.addMethod(
  53869. $core.method({
  53870. selector: "samplesDo:",
  53871. protocol: "fixture",
  53872. fn: function (aBlock){
  53873. var self=this,$self=this;
  53874. return $core.withContext(function($ctx1) {
  53875. $self._subclassResponsibility();
  53876. return self;
  53877. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53878. },
  53879. args: ["aBlock"],
  53880. 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",
  53881. referencedClasses: [],
  53882. messageSends: ["subclassResponsibility"]
  53883. }),
  53884. $globals.IndexableCollectionTest);
  53885. $core.addMethod(
  53886. $core.method({
  53887. selector: "testAt",
  53888. protocol: "tests",
  53889. fn: function (){
  53890. var self=this,$self=this;
  53891. return $core.withContext(function($ctx1) {
  53892. var $1;
  53893. $self._nonIndexesDo_((function(each){
  53894. return $core.withContext(function($ctx2) {
  53895. return $self._should_raise_((function(){
  53896. return $core.withContext(function($ctx3) {
  53897. $1=$self._collection();
  53898. $ctx3.sendIdx["collection"]=1;
  53899. return $recv($1)._at_(each);
  53900. $ctx3.sendIdx["at:"]=1;
  53901. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53902. }),$globals.Error);
  53903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53904. }));
  53905. $self._samplesDo_((function(index,value){
  53906. return $core.withContext(function($ctx2) {
  53907. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53908. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53909. }));
  53910. return self;
  53911. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53912. },
  53913. args: [],
  53914. 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 ]",
  53915. referencedClasses: ["Error"],
  53916. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53917. }),
  53918. $globals.IndexableCollectionTest);
  53919. $core.addMethod(
  53920. $core.method({
  53921. selector: "testAtIfAbsent",
  53922. protocol: "tests",
  53923. fn: function (){
  53924. var self=this,$self=this;
  53925. return $core.withContext(function($ctx1) {
  53926. var $2,$1,$3;
  53927. $self._nonIndexesDo_((function(each){
  53928. return $core.withContext(function($ctx2) {
  53929. $2=$self._collection();
  53930. $ctx2.sendIdx["collection"]=1;
  53931. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53932. return $core.withContext(function($ctx3) {
  53933. return $self._sampleNewValue();
  53934. $ctx3.sendIdx["sampleNewValue"]=1;
  53935. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53936. }));
  53937. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53938. $3=$self._sampleNewValue();
  53939. $ctx2.sendIdx["sampleNewValue"]=2;
  53940. return $self._assert_equals_($1,$3);
  53941. $ctx2.sendIdx["assert:equals:"]=1;
  53942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53943. }));
  53944. $self._samplesDo_((function(index,value){
  53945. return $core.withContext(function($ctx2) {
  53946. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53947. return $core.withContext(function($ctx3) {
  53948. return $self._sampleNewValue();
  53949. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53950. })),value);
  53951. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53952. }));
  53953. return self;
  53954. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53955. },
  53956. args: [],
  53957. 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 ].",
  53958. referencedClasses: [],
  53959. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53960. }),
  53961. $globals.IndexableCollectionTest);
  53962. $core.addMethod(
  53963. $core.method({
  53964. selector: "testAtIfAbsentPut",
  53965. protocol: "tests",
  53966. fn: function (){
  53967. var self=this,$self=this;
  53968. var newCollection;
  53969. return $core.withContext(function($ctx1) {
  53970. var $1;
  53971. newCollection=$self._collection();
  53972. $ctx1.sendIdx["collection"]=1;
  53973. $self._samplesDo_((function(index,value){
  53974. return $core.withContext(function($ctx2) {
  53975. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53976. return $core.withContext(function($ctx3) {
  53977. return $self._sampleNewValue();
  53978. $ctx3.sendIdx["sampleNewValue"]=1;
  53979. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53980. }));
  53981. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53982. return $self._assert_equals_($1,value);
  53983. $ctx2.sendIdx["assert:equals:"]=1;
  53984. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53985. }));
  53986. $self._assert_equals_(newCollection,$self._collection());
  53987. $ctx1.sendIdx["assert:equals:"]=2;
  53988. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53989. return $core.withContext(function($ctx2) {
  53990. return $self._sampleNewValue();
  53991. $ctx2.sendIdx["sampleNewValue"]=2;
  53992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53993. })),$self._sampleNewValue());
  53994. $ctx1.sendIdx["assert:equals:"]=3;
  53995. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53996. return self;
  53997. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53998. },
  53999. args: [],
  54000. 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",
  54001. referencedClasses: [],
  54002. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  54003. }),
  54004. $globals.IndexableCollectionTest);
  54005. $core.addMethod(
  54006. $core.method({
  54007. selector: "testAtIfPresent",
  54008. protocol: "tests",
  54009. fn: function (){
  54010. var self=this,$self=this;
  54011. var visited,sentinel;
  54012. return $core.withContext(function($ctx1) {
  54013. var $2,$1,$4,$3;
  54014. sentinel=$recv($globals.Object)._new();
  54015. $self._nonIndexesDo_((function(each){
  54016. return $core.withContext(function($ctx2) {
  54017. visited=nil;
  54018. $2=$self._collection();
  54019. $ctx2.sendIdx["collection"]=1;
  54020. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  54021. visited=value1;
  54022. return sentinel;
  54023. }));
  54024. $ctx2.sendIdx["at:ifPresent:"]=1;
  54025. $self._assert_equals_($1,nil);
  54026. $ctx2.sendIdx["assert:equals:"]=1;
  54027. return $self._assert_($recv(visited)._isNil());
  54028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54029. }));
  54030. $self._samplesDo_((function(index,value){
  54031. return $core.withContext(function($ctx2) {
  54032. visited=nil;
  54033. $4=$self._collection();
  54034. $ctx2.sendIdx["collection"]=2;
  54035. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  54036. visited=value2;
  54037. return sentinel;
  54038. }));
  54039. $self._assert_equals_($3,sentinel);
  54040. $ctx2.sendIdx["assert:equals:"]=2;
  54041. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  54042. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  54043. }));
  54044. return self;
  54045. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  54046. },
  54047. args: [],
  54048. 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) ]",
  54049. referencedClasses: ["Object"],
  54050. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  54051. }),
  54052. $globals.IndexableCollectionTest);
  54053. $core.addMethod(
  54054. $core.method({
  54055. selector: "testAtIfPresentIfAbsent",
  54056. protocol: "tests",
  54057. fn: function (){
  54058. var self=this,$self=this;
  54059. var visited,sentinel;
  54060. return $core.withContext(function($ctx1) {
  54061. var $2,$1,$3,$5,$4;
  54062. sentinel=$recv($globals.Object)._new();
  54063. $self._nonIndexesDo_((function(each){
  54064. return $core.withContext(function($ctx2) {
  54065. visited=nil;
  54066. $2=$self._collection();
  54067. $ctx2.sendIdx["collection"]=1;
  54068. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  54069. visited=value1;
  54070. return sentinel;
  54071. }),(function(){
  54072. return $core.withContext(function($ctx3) {
  54073. return $self._sampleNewValue();
  54074. $ctx3.sendIdx["sampleNewValue"]=1;
  54075. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  54076. }));
  54077. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54078. $3=$self._sampleNewValue();
  54079. $ctx2.sendIdx["sampleNewValue"]=2;
  54080. $self._assert_equals_($1,$3);
  54081. $ctx2.sendIdx["assert:equals:"]=1;
  54082. return $self._assert_($recv(visited)._isNil());
  54083. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54084. }));
  54085. $self._samplesDo_((function(index,value){
  54086. return $core.withContext(function($ctx2) {
  54087. visited=nil;
  54088. $5=$self._collection();
  54089. $ctx2.sendIdx["collection"]=2;
  54090. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  54091. visited=value2;
  54092. return sentinel;
  54093. }),(function(){
  54094. return $core.withContext(function($ctx3) {
  54095. return $self._sampleNewValue();
  54096. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  54097. }));
  54098. $self._assert_equals_($4,sentinel);
  54099. $ctx2.sendIdx["assert:equals:"]=2;
  54100. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  54101. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  54102. }));
  54103. return self;
  54104. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  54105. },
  54106. args: [],
  54107. 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) ]",
  54108. referencedClasses: ["Object"],
  54109. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  54110. }),
  54111. $globals.IndexableCollectionTest);
  54112. $core.addMethod(
  54113. $core.method({
  54114. selector: "testAtPut",
  54115. protocol: "tests",
  54116. fn: function (){
  54117. var self=this,$self=this;
  54118. var newCollection;
  54119. return $core.withContext(function($ctx1) {
  54120. newCollection=$self._collection();
  54121. $ctx1.sendIdx["collection"]=1;
  54122. $self._samplesDo_((function(index,value){
  54123. return $core.withContext(function($ctx2) {
  54124. return $recv(newCollection)._at_put_(index,value);
  54125. $ctx2.sendIdx["at:put:"]=1;
  54126. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54127. }));
  54128. $self._assert_equals_(newCollection,$self._collection());
  54129. $ctx1.sendIdx["assert:equals:"]=1;
  54130. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  54131. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  54132. return self;
  54133. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  54134. },
  54135. args: [],
  54136. 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",
  54137. referencedClasses: [],
  54138. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  54139. }),
  54140. $globals.IndexableCollectionTest);
  54141. $core.addMethod(
  54142. $core.method({
  54143. selector: "testIndexOf",
  54144. protocol: "tests",
  54145. fn: function (){
  54146. var self=this,$self=this;
  54147. return $core.withContext(function($ctx1) {
  54148. var $1;
  54149. $self._should_raise_((function(){
  54150. return $core.withContext(function($ctx2) {
  54151. $1=$self._collection();
  54152. $ctx2.sendIdx["collection"]=1;
  54153. return $recv($1)._indexOf_($self._sampleNewValue());
  54154. $ctx2.sendIdx["indexOf:"]=1;
  54155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54156. }),$globals.Error);
  54157. $self._samplesDo_((function(index,value){
  54158. return $core.withContext(function($ctx2) {
  54159. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  54160. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  54161. }));
  54162. return self;
  54163. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  54164. },
  54165. args: [],
  54166. 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 ]",
  54167. referencedClasses: ["Error"],
  54168. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  54169. }),
  54170. $globals.IndexableCollectionTest);
  54171. $core.addMethod(
  54172. $core.method({
  54173. selector: "testIndexOfWithNull",
  54174. protocol: "tests",
  54175. fn: function (){
  54176. var self=this,$self=this;
  54177. var jsNull;
  54178. return $core.withContext(function($ctx1) {
  54179. var $2,$1;
  54180. jsNull=$recv($globals.JSON)._parse_("null");
  54181. $self._samplesDo_((function(index,value){
  54182. return $core.withContext(function($ctx2) {
  54183. $2=$self._collection();
  54184. $recv($2)._at_put_(index,jsNull);
  54185. $1=$recv($2)._indexOf_(jsNull);
  54186. return $self._assert_equals_($1,index);
  54187. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54188. }));
  54189. return self;
  54190. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54191. },
  54192. args: [],
  54193. 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 ]",
  54194. referencedClasses: ["JSON"],
  54195. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54196. }),
  54197. $globals.IndexableCollectionTest);
  54198. $core.addMethod(
  54199. $core.method({
  54200. selector: "testWithIndexDo",
  54201. protocol: "tests",
  54202. fn: function (){
  54203. var self=this,$self=this;
  54204. var collection;
  54205. return $core.withContext(function($ctx1) {
  54206. collection=$self._collection();
  54207. $ctx1.sendIdx["collection"]=1;
  54208. $recv($self._collection())._withIndexDo_((function(each,index){
  54209. return $core.withContext(function($ctx2) {
  54210. return $self._assert_equals_($recv(collection)._at_(index),each);
  54211. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54212. }));
  54213. return self;
  54214. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54215. },
  54216. args: [],
  54217. 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 ]",
  54218. referencedClasses: [],
  54219. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54220. }),
  54221. $globals.IndexableCollectionTest);
  54222. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54223. $core.addMethod(
  54224. $core.method({
  54225. selector: "collectionKeys",
  54226. protocol: "fixture",
  54227. fn: function (){
  54228. var self=this,$self=this;
  54229. return $core.withContext(function($ctx1) {
  54230. $self._subclassResponsibility();
  54231. return self;
  54232. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54233. },
  54234. args: [],
  54235. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54236. referencedClasses: [],
  54237. messageSends: ["subclassResponsibility"]
  54238. }),
  54239. $globals.AssociativeCollectionTest);
  54240. $core.addMethod(
  54241. $core.method({
  54242. selector: "collectionValues",
  54243. protocol: "fixture",
  54244. fn: function (){
  54245. var self=this,$self=this;
  54246. return $core.withContext(function($ctx1) {
  54247. $self._subclassResponsibility();
  54248. return self;
  54249. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54250. },
  54251. args: [],
  54252. source: "collectionValues\x0a\x09self subclassResponsibility",
  54253. referencedClasses: [],
  54254. messageSends: ["subclassResponsibility"]
  54255. }),
  54256. $globals.AssociativeCollectionTest);
  54257. $core.addMethod(
  54258. $core.method({
  54259. selector: "nonIndexesDo:",
  54260. protocol: "fixture",
  54261. fn: function (aBlock){
  54262. var self=this,$self=this;
  54263. return $core.withContext(function($ctx1) {
  54264. $recv(aBlock)._value_((5));
  54265. $ctx1.sendIdx["value:"]=1;
  54266. $recv(aBlock)._value_((function(){
  54267. }));
  54268. $ctx1.sendIdx["value:"]=2;
  54269. $recv(aBlock)._value_($recv($globals.Object)._new());
  54270. $ctx1.sendIdx["value:"]=3;
  54271. $recv(aBlock)._value_("z");
  54272. return self;
  54273. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54274. },
  54275. args: ["aBlock"],
  54276. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54277. referencedClasses: ["Object"],
  54278. messageSends: ["value:", "new"]
  54279. }),
  54280. $globals.AssociativeCollectionTest);
  54281. $core.addMethod(
  54282. $core.method({
  54283. selector: "sampleNewIndex",
  54284. protocol: "fixture",
  54285. fn: function (){
  54286. var self=this,$self=this;
  54287. return "new";
  54288. },
  54289. args: [],
  54290. source: "sampleNewIndex\x0a\x09^ 'new'",
  54291. referencedClasses: [],
  54292. messageSends: []
  54293. }),
  54294. $globals.AssociativeCollectionTest);
  54295. $core.addMethod(
  54296. $core.method({
  54297. selector: "samplesDo:",
  54298. protocol: "fixture",
  54299. fn: function (aBlock){
  54300. var self=this,$self=this;
  54301. return $core.withContext(function($ctx1) {
  54302. $recv(aBlock)._value_value_("a",(2));
  54303. return self;
  54304. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54305. },
  54306. args: ["aBlock"],
  54307. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54308. referencedClasses: [],
  54309. messageSends: ["value:value:"]
  54310. }),
  54311. $globals.AssociativeCollectionTest);
  54312. $core.addMethod(
  54313. $core.method({
  54314. selector: "testAddAll",
  54315. protocol: "tests",
  54316. fn: function (){
  54317. var self=this,$self=this;
  54318. return $core.withContext(function($ctx1) {
  54319. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54320. (
  54321. $ctx1.supercall = true,
  54322. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54323. $ctx1.supercall = false;
  54324. $2=$self._collection();
  54325. $ctx1.sendIdx["collection"]=1;
  54326. $3=$self._collection();
  54327. $ctx1.sendIdx["collection"]=2;
  54328. $recv($2)._addAll_($3);
  54329. $ctx1.sendIdx["addAll:"]=1;
  54330. $4=$recv($2)._yourself();
  54331. $ctx1.sendIdx["yourself"]=1;
  54332. $1=$4;
  54333. $5=$self._collection();
  54334. $ctx1.sendIdx["collection"]=3;
  54335. $self._assert_equals_($1,$5);
  54336. $ctx1.sendIdx["assert:equals:"]=1;
  54337. $7=$self._collection();
  54338. $ctx1.sendIdx["collection"]=4;
  54339. $8=$self._collectionWithNewValue();
  54340. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54341. $recv($7)._addAll_($8);
  54342. $ctx1.sendIdx["addAll:"]=2;
  54343. $9=$recv($7)._yourself();
  54344. $ctx1.sendIdx["yourself"]=2;
  54345. $6=$9;
  54346. $10=$self._collectionWithNewValue();
  54347. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54348. $self._assert_equals_($6,$10);
  54349. $ctx1.sendIdx["assert:equals:"]=2;
  54350. $12=$self._collectionWithNewValue();
  54351. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54352. $recv($12)._addAll_($self._collection());
  54353. $11=$recv($12)._yourself();
  54354. $self._assert_equals_($11,$self._collectionWithNewValue());
  54355. return self;
  54356. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54357. },
  54358. args: [],
  54359. 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",
  54360. referencedClasses: [],
  54361. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54362. }),
  54363. $globals.AssociativeCollectionTest);
  54364. $core.addMethod(
  54365. $core.method({
  54366. selector: "testAsDictionary",
  54367. protocol: "tests",
  54368. fn: function (){
  54369. var self=this,$self=this;
  54370. return $core.withContext(function($ctx1) {
  54371. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54372. return self;
  54373. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54374. },
  54375. args: [],
  54376. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54377. referencedClasses: ["Dictionary"],
  54378. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54379. }),
  54380. $globals.AssociativeCollectionTest);
  54381. $core.addMethod(
  54382. $core.method({
  54383. selector: "testAsHashedCollection",
  54384. protocol: "tests",
  54385. fn: function (){
  54386. var self=this,$self=this;
  54387. return $core.withContext(function($ctx1) {
  54388. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54389. return self;
  54390. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54391. },
  54392. args: [],
  54393. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54394. referencedClasses: ["HashedCollection"],
  54395. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54396. }),
  54397. $globals.AssociativeCollectionTest);
  54398. $core.addMethod(
  54399. $core.method({
  54400. selector: "testComma",
  54401. protocol: "tests",
  54402. fn: function (){
  54403. var self=this,$self=this;
  54404. return $core.withContext(function($ctx1) {
  54405. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54406. (
  54407. $ctx1.supercall = true,
  54408. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54409. $ctx1.supercall = false;
  54410. $2=$self._collection();
  54411. $ctx1.sendIdx["collection"]=1;
  54412. $3=$self._collection();
  54413. $ctx1.sendIdx["collection"]=2;
  54414. $1=$recv($2).__comma($3);
  54415. $ctx1.sendIdx[","]=1;
  54416. $4=$self._collection();
  54417. $ctx1.sendIdx["collection"]=3;
  54418. $self._assert_equals_($1,$4);
  54419. $ctx1.sendIdx["assert:equals:"]=1;
  54420. $6=$self._collection();
  54421. $ctx1.sendIdx["collection"]=4;
  54422. $7=$self._collectionWithNewValue();
  54423. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54424. $5=$recv($6).__comma($7);
  54425. $ctx1.sendIdx[","]=2;
  54426. $8=$self._collectionWithNewValue();
  54427. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54428. $self._assert_equals_($5,$8);
  54429. $ctx1.sendIdx["assert:equals:"]=2;
  54430. $10=$self._collectionWithNewValue();
  54431. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54432. $9=$recv($10).__comma($self._collection());
  54433. $self._assert_equals_($9,$self._collectionWithNewValue());
  54434. return self;
  54435. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54436. },
  54437. args: [],
  54438. 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",
  54439. referencedClasses: [],
  54440. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54441. }),
  54442. $globals.AssociativeCollectionTest);
  54443. $core.addMethod(
  54444. $core.method({
  54445. selector: "testFrom",
  54446. protocol: "tests",
  54447. fn: function (){
  54448. var self=this,$self=this;
  54449. var associations;
  54450. return $core.withContext(function($ctx1) {
  54451. var $1;
  54452. $1="a".__minus_gt((1));
  54453. $ctx1.sendIdx["->"]=1;
  54454. associations=[$1,"b".__minus_gt((2))];
  54455. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54456. return self;
  54457. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54458. },
  54459. args: [],
  54460. 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 }.",
  54461. referencedClasses: [],
  54462. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54463. }),
  54464. $globals.AssociativeCollectionTest);
  54465. $core.addMethod(
  54466. $core.method({
  54467. selector: "testKeys",
  54468. protocol: "tests",
  54469. fn: function (){
  54470. var self=this,$self=this;
  54471. return $core.withContext(function($ctx1) {
  54472. var $2,$1,$3,$4;
  54473. $2=$recv($recv($self._collectionClass())._new())._keys();
  54474. $ctx1.sendIdx["keys"]=1;
  54475. $1=$recv($2)._isEmpty();
  54476. $self._assert_($1);
  54477. $3=$recv($self._collection())._keys();
  54478. $ctx1.sendIdx["keys"]=2;
  54479. $4=$self._collectionKeys();
  54480. $ctx1.sendIdx["collectionKeys"]=1;
  54481. $self._assertSameContents_as_($3,$4);
  54482. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54483. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54484. return self;
  54485. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54486. },
  54487. args: [],
  54488. 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 }",
  54489. referencedClasses: [],
  54490. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54491. }),
  54492. $globals.AssociativeCollectionTest);
  54493. $core.addMethod(
  54494. $core.method({
  54495. selector: "testNewFromPairs",
  54496. protocol: "tests",
  54497. fn: function (){
  54498. var self=this,$self=this;
  54499. var flattenedAssociations;
  54500. return $core.withContext(function($ctx1) {
  54501. flattenedAssociations=["a",(1),"b",(2)];
  54502. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54503. return self;
  54504. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54505. },
  54506. args: [],
  54507. 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 }.",
  54508. referencedClasses: [],
  54509. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54510. }),
  54511. $globals.AssociativeCollectionTest);
  54512. $core.addMethod(
  54513. $core.method({
  54514. selector: "testPrintString",
  54515. protocol: "tests",
  54516. fn: function (){
  54517. var self=this,$self=this;
  54518. return $core.withContext(function($ctx1) {
  54519. var $3,$2,$1,$4;
  54520. $3=$self._collectionClass();
  54521. $ctx1.sendIdx["collectionClass"]=1;
  54522. $2=$recv($3)._new();
  54523. $recv($2)._at_put_("firstname","James");
  54524. $ctx1.sendIdx["at:put:"]=1;
  54525. $recv($2)._at_put_("lastname","Bond");
  54526. $1=$recv($2)._printString();
  54527. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54528. $ctx1.sendIdx[","]=1;
  54529. $self._assert_equals_($1,$4);
  54530. return self;
  54531. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54532. },
  54533. args: [],
  54534. 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'')'",
  54535. referencedClasses: [],
  54536. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54537. }),
  54538. $globals.AssociativeCollectionTest);
  54539. $core.addMethod(
  54540. $core.method({
  54541. selector: "testRemoveKey",
  54542. protocol: "tests",
  54543. fn: function (){
  54544. var self=this,$self=this;
  54545. return $core.withContext(function($ctx1) {
  54546. var $1,$2,$3,$5,$6,$4,$8,$7;
  54547. $self._nonIndexesDo_((function(each){
  54548. var collection;
  54549. return $core.withContext(function($ctx2) {
  54550. collection=$self._collection();
  54551. $ctx2.sendIdx["collection"]=1;
  54552. $self._should_raise_((function(){
  54553. return $core.withContext(function($ctx3) {
  54554. return $recv(collection)._removeKey_(each);
  54555. $ctx3.sendIdx["removeKey:"]=1;
  54556. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54557. }),$globals.Error);
  54558. $1=collection;
  54559. $2=$self._collection();
  54560. $ctx2.sendIdx["collection"]=2;
  54561. return $self._assert_equals_($1,$2);
  54562. $ctx2.sendIdx["assert:equals:"]=1;
  54563. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54564. }));
  54565. $self._samplesDo_((function(index,value){
  54566. var collection;
  54567. return $core.withContext(function($ctx2) {
  54568. collection=$self._collection();
  54569. $ctx2.sendIdx["collection"]=3;
  54570. $3=$recv(collection)._removeKey_(index);
  54571. $ctx2.sendIdx["removeKey:"]=2;
  54572. $self._assert_equals_($3,value);
  54573. $ctx2.sendIdx["assert:equals:"]=2;
  54574. $5=collection;
  54575. $6=$self._collection();
  54576. $ctx2.sendIdx["collection"]=4;
  54577. $4=$recv($5).__eq($6);
  54578. return $self._deny_($4);
  54579. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54580. }));
  54581. $8=$self._collectionWithNewValue();
  54582. $recv($8)._removeKey_($self._sampleNewIndex());
  54583. $7=$recv($8)._yourself();
  54584. $self._assert_equals_($7,$self._collection());
  54585. return self;
  54586. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54587. },
  54588. args: [],
  54589. 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",
  54590. referencedClasses: ["Error"],
  54591. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54592. }),
  54593. $globals.AssociativeCollectionTest);
  54594. $core.addMethod(
  54595. $core.method({
  54596. selector: "testRemoveKeyIfAbsent",
  54597. protocol: "tests",
  54598. fn: function (){
  54599. var self=this,$self=this;
  54600. return $core.withContext(function($ctx1) {
  54601. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54602. $self._nonIndexesDo_((function(each){
  54603. var collection;
  54604. return $core.withContext(function($ctx2) {
  54605. collection=$self._collection();
  54606. $ctx2.sendIdx["collection"]=1;
  54607. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54608. return $core.withContext(function($ctx3) {
  54609. return $self._sampleNewValue();
  54610. $ctx3.sendIdx["sampleNewValue"]=1;
  54611. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54612. }));
  54613. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54614. $2=$self._sampleNewValue();
  54615. $ctx2.sendIdx["sampleNewValue"]=2;
  54616. $self._assert_equals_($1,$2);
  54617. $ctx2.sendIdx["assert:equals:"]=1;
  54618. $3=collection;
  54619. $4=$self._collection();
  54620. $ctx2.sendIdx["collection"]=2;
  54621. return $self._assert_equals_($3,$4);
  54622. $ctx2.sendIdx["assert:equals:"]=2;
  54623. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54624. }));
  54625. $self._samplesDo_((function(index,value){
  54626. var collection;
  54627. return $core.withContext(function($ctx2) {
  54628. collection=$self._collection();
  54629. $ctx2.sendIdx["collection"]=3;
  54630. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54631. return $core.withContext(function($ctx3) {
  54632. return $self._sampleNewValue();
  54633. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54634. }));
  54635. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54636. $self._assert_equals_($5,value);
  54637. $ctx2.sendIdx["assert:equals:"]=3;
  54638. $7=collection;
  54639. $8=$self._collection();
  54640. $ctx2.sendIdx["collection"]=4;
  54641. $6=$recv($7).__eq($8);
  54642. return $self._deny_($6);
  54643. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54644. }));
  54645. $10=$self._collectionWithNewValue();
  54646. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54647. return $core.withContext(function($ctx2) {
  54648. return $self._assert_(false);
  54649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54650. }));
  54651. $9=$recv($10)._yourself();
  54652. $self._assert_equals_($9,$self._collection());
  54653. return self;
  54654. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54655. },
  54656. args: [],
  54657. 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",
  54658. referencedClasses: [],
  54659. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54660. }),
  54661. $globals.AssociativeCollectionTest);
  54662. $core.addMethod(
  54663. $core.method({
  54664. selector: "testValues",
  54665. protocol: "tests",
  54666. fn: function (){
  54667. var self=this,$self=this;
  54668. return $core.withContext(function($ctx1) {
  54669. var $2,$1,$3,$4;
  54670. $2=$recv($recv($self._collectionClass())._new())._values();
  54671. $ctx1.sendIdx["values"]=1;
  54672. $1=$recv($2)._isEmpty();
  54673. $self._assert_($1);
  54674. $3=$recv($self._collection())._values();
  54675. $ctx1.sendIdx["values"]=2;
  54676. $4=$self._collectionValues();
  54677. $ctx1.sendIdx["collectionValues"]=1;
  54678. $self._assertSameContents_as_($3,$4);
  54679. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54680. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54681. return self;
  54682. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54683. },
  54684. args: [],
  54685. 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 }",
  54686. referencedClasses: [],
  54687. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54688. }),
  54689. $globals.AssociativeCollectionTest);
  54690. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54691. $core.addMethod(
  54692. $core.method({
  54693. selector: "collection",
  54694. protocol: "fixture",
  54695. fn: function (){
  54696. var self=this,$self=this;
  54697. return $core.withContext(function($ctx1) {
  54698. var $1;
  54699. $1=$recv($globals.Dictionary)._new();
  54700. $recv($1)._at_put_((1),(1));
  54701. $ctx1.sendIdx["at:put:"]=1;
  54702. $recv($1)._at_put_("a",(2));
  54703. $ctx1.sendIdx["at:put:"]=2;
  54704. $recv($1)._at_put_(true,(3));
  54705. $ctx1.sendIdx["at:put:"]=3;
  54706. $recv($1)._at_put_((1).__at((3)),(-4));
  54707. $ctx1.sendIdx["at:put:"]=4;
  54708. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54709. return $recv($1)._yourself();
  54710. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54711. },
  54712. args: [],
  54713. 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",
  54714. referencedClasses: ["Dictionary"],
  54715. messageSends: ["at:put:", "new", "@", "yourself"]
  54716. }),
  54717. $globals.DictionaryTest);
  54718. $core.addMethod(
  54719. $core.method({
  54720. selector: "collectionKeys",
  54721. protocol: "fixture",
  54722. fn: function (){
  54723. var self=this,$self=this;
  54724. return $core.withContext(function($ctx1) {
  54725. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54726. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54727. },
  54728. args: [],
  54729. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54730. referencedClasses: [],
  54731. messageSends: ["@"]
  54732. }),
  54733. $globals.DictionaryTest);
  54734. $core.addMethod(
  54735. $core.method({
  54736. selector: "collectionOfPrintStrings",
  54737. protocol: "fixture",
  54738. fn: function (){
  54739. var self=this,$self=this;
  54740. return $core.withContext(function($ctx1) {
  54741. var $1;
  54742. $1=$recv($globals.Dictionary)._new();
  54743. $recv($1)._at_put_((1),"1");
  54744. $ctx1.sendIdx["at:put:"]=1;
  54745. $recv($1)._at_put_("a","2");
  54746. $ctx1.sendIdx["at:put:"]=2;
  54747. $recv($1)._at_put_(true,"3");
  54748. $ctx1.sendIdx["at:put:"]=3;
  54749. $recv($1)._at_put_((1).__at((3)),"-4");
  54750. $ctx1.sendIdx["at:put:"]=4;
  54751. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54752. return $recv($1)._yourself();
  54753. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54754. },
  54755. args: [],
  54756. 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",
  54757. referencedClasses: ["Dictionary"],
  54758. messageSends: ["at:put:", "new", "@", "yourself"]
  54759. }),
  54760. $globals.DictionaryTest);
  54761. $core.addMethod(
  54762. $core.method({
  54763. selector: "collectionSize",
  54764. protocol: "fixture",
  54765. fn: function (){
  54766. var self=this,$self=this;
  54767. return (5);
  54768. },
  54769. args: [],
  54770. source: "collectionSize\x0a\x09^ 5",
  54771. referencedClasses: [],
  54772. messageSends: []
  54773. }),
  54774. $globals.DictionaryTest);
  54775. $core.addMethod(
  54776. $core.method({
  54777. selector: "collectionValues",
  54778. protocol: "fixture",
  54779. fn: function (){
  54780. var self=this,$self=this;
  54781. return [(1),(2),(3),(-4),(9)];
  54782. },
  54783. args: [],
  54784. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54785. referencedClasses: [],
  54786. messageSends: []
  54787. }),
  54788. $globals.DictionaryTest);
  54789. $core.addMethod(
  54790. $core.method({
  54791. selector: "collectionWithDuplicates",
  54792. protocol: "fixture",
  54793. fn: function (){
  54794. var self=this,$self=this;
  54795. return $core.withContext(function($ctx1) {
  54796. var $1;
  54797. $1=$recv($globals.Dictionary)._new();
  54798. $recv($1)._at_put_((1),(1));
  54799. $ctx1.sendIdx["at:put:"]=1;
  54800. $recv($1)._at_put_("a",(2));
  54801. $ctx1.sendIdx["at:put:"]=2;
  54802. $recv($1)._at_put_(true,(3));
  54803. $ctx1.sendIdx["at:put:"]=3;
  54804. $recv($1)._at_put_((4),(-4));
  54805. $ctx1.sendIdx["at:put:"]=4;
  54806. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54807. $ctx1.sendIdx["at:put:"]=5;
  54808. $recv($1)._at_put_("b",(1));
  54809. $ctx1.sendIdx["at:put:"]=6;
  54810. $recv($1)._at_put_((3),(3));
  54811. $ctx1.sendIdx["at:put:"]=7;
  54812. $recv($1)._at_put_(false,(12));
  54813. return $recv($1)._yourself();
  54814. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54815. },
  54816. args: [],
  54817. 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",
  54818. referencedClasses: ["Dictionary"],
  54819. messageSends: ["at:put:", "new", "yourself"]
  54820. }),
  54821. $globals.DictionaryTest);
  54822. $core.addMethod(
  54823. $core.method({
  54824. selector: "collectionWithNewValue",
  54825. protocol: "fixture",
  54826. fn: function (){
  54827. var self=this,$self=this;
  54828. return $core.withContext(function($ctx1) {
  54829. var $1;
  54830. $1=$recv($globals.Dictionary)._new();
  54831. $recv($1)._at_put_((1),(1));
  54832. $ctx1.sendIdx["at:put:"]=1;
  54833. $recv($1)._at_put_("a",(2));
  54834. $ctx1.sendIdx["at:put:"]=2;
  54835. $recv($1)._at_put_(true,(3));
  54836. $ctx1.sendIdx["at:put:"]=3;
  54837. $recv($1)._at_put_((1).__at((3)),(-4));
  54838. $ctx1.sendIdx["at:put:"]=4;
  54839. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54840. $ctx1.sendIdx["at:put:"]=5;
  54841. $recv($1)._at_put_("new","N");
  54842. return $recv($1)._yourself();
  54843. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54844. },
  54845. args: [],
  54846. 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",
  54847. referencedClasses: ["Dictionary"],
  54848. messageSends: ["at:put:", "new", "@", "yourself"]
  54849. }),
  54850. $globals.DictionaryTest);
  54851. $core.addMethod(
  54852. $core.method({
  54853. selector: "sampleNewValueAsCollection",
  54854. protocol: "fixture",
  54855. fn: function (){
  54856. var self=this,$self=this;
  54857. return $core.withContext(function($ctx1) {
  54858. var $1;
  54859. $1=$recv($globals.Dictionary)._new();
  54860. $recv($1)._at_put_("new","N");
  54861. return $recv($1)._yourself();
  54862. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54863. },
  54864. args: [],
  54865. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54866. referencedClasses: ["Dictionary"],
  54867. messageSends: ["at:put:", "new", "yourself"]
  54868. }),
  54869. $globals.DictionaryTest);
  54870. $core.addMethod(
  54871. $core.method({
  54872. selector: "samplesDo:",
  54873. protocol: "fixture",
  54874. fn: function (aBlock){
  54875. var self=this,$self=this;
  54876. return $core.withContext(function($ctx1) {
  54877. (
  54878. $ctx1.supercall = true,
  54879. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54880. $ctx1.supercall = false;
  54881. $recv(aBlock)._value_value_(true,(3));
  54882. $ctx1.sendIdx["value:value:"]=1;
  54883. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54884. $ctx1.sendIdx["value:value:"]=2;
  54885. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54886. return self;
  54887. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54888. },
  54889. args: ["aBlock"],
  54890. 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",
  54891. referencedClasses: [],
  54892. messageSends: ["samplesDo:", "value:value:", "@"]
  54893. }),
  54894. $globals.DictionaryTest);
  54895. $core.addMethod(
  54896. $core.method({
  54897. selector: "testAccessing",
  54898. protocol: "tests",
  54899. fn: function (){
  54900. var self=this,$self=this;
  54901. var d;
  54902. return $core.withContext(function($ctx1) {
  54903. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54904. d=$recv($globals.Dictionary)._new();
  54905. $recv(d)._at_put_("hello","world");
  54906. $ctx1.sendIdx["at:put:"]=1;
  54907. $1=$recv(d)._at_("hello");
  54908. $ctx1.sendIdx["at:"]=1;
  54909. $self._assert_equals_($1,"world");
  54910. $ctx1.sendIdx["assert:equals:"]=1;
  54911. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54912. return nil;
  54913. }));
  54914. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54915. $self._assert_equals_($2,"world");
  54916. $ctx1.sendIdx["assert:equals:"]=2;
  54917. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54918. return nil;
  54919. }))).__eq("world"));
  54920. $ctx1.sendIdx["deny:"]=1;
  54921. $3=$recv(d)._includesKey_("hello");
  54922. $ctx1.sendIdx["includesKey:"]=1;
  54923. $self._assert_($3);
  54924. $ctx1.sendIdx["assert:"]=1;
  54925. $4=$recv(d)._includesKey_("foo");
  54926. $ctx1.sendIdx["includesKey:"]=2;
  54927. $self._deny_($4);
  54928. $ctx1.sendIdx["deny:"]=2;
  54929. $recv(d)._at_put_((1),(2));
  54930. $ctx1.sendIdx["at:put:"]=2;
  54931. $5=$recv(d)._at_((1));
  54932. $ctx1.sendIdx["at:"]=2;
  54933. $self._assert_equals_($5,(2));
  54934. $ctx1.sendIdx["assert:equals:"]=3;
  54935. $6=d;
  54936. $7=(1).__at((3));
  54937. $ctx1.sendIdx["@"]=1;
  54938. $recv($6)._at_put_($7,(3));
  54939. $9=d;
  54940. $10=(1).__at((3));
  54941. $ctx1.sendIdx["@"]=2;
  54942. $8=$recv($9)._at_($10);
  54943. $self._assert_equals_($8,(3));
  54944. $12=d;
  54945. $13=(1).__at((3));
  54946. $ctx1.sendIdx["@"]=3;
  54947. $11=$recv($12)._includesKey_($13);
  54948. $ctx1.sendIdx["includesKey:"]=3;
  54949. $self._assert_($11);
  54950. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54951. return self;
  54952. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54953. },
  54954. args: [],
  54955. 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)",
  54956. referencedClasses: ["Dictionary"],
  54957. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54958. }),
  54959. $globals.DictionaryTest);
  54960. $core.addMethod(
  54961. $core.method({
  54962. selector: "testDynamicDictionaries",
  54963. protocol: "tests",
  54964. fn: function (){
  54965. var self=this,$self=this;
  54966. return $core.withContext(function($ctx1) {
  54967. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54968. return self;
  54969. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54970. },
  54971. args: [],
  54972. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54973. referencedClasses: ["Dictionary"],
  54974. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54975. }),
  54976. $globals.DictionaryTest);
  54977. $core.addMethod(
  54978. $core.method({
  54979. selector: "collectionClass",
  54980. protocol: "fixture",
  54981. fn: function (){
  54982. var self=this,$self=this;
  54983. return $globals.Dictionary;
  54984. },
  54985. args: [],
  54986. source: "collectionClass\x0a\x09^ Dictionary",
  54987. referencedClasses: ["Dictionary"],
  54988. messageSends: []
  54989. }),
  54990. $globals.DictionaryTest.a$cls);
  54991. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54992. $core.addMethod(
  54993. $core.method({
  54994. selector: "collection",
  54995. protocol: "fixture",
  54996. fn: function (){
  54997. var self=this,$self=this;
  54998. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54999. },
  55000. args: [],
  55001. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  55002. referencedClasses: [],
  55003. messageSends: []
  55004. }),
  55005. $globals.HashedCollectionTest);
  55006. $core.addMethod(
  55007. $core.method({
  55008. selector: "collectionKeys",
  55009. protocol: "fixture",
  55010. fn: function (){
  55011. var self=this,$self=this;
  55012. return ["b","a","c","d"];
  55013. },
  55014. args: [],
  55015. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  55016. referencedClasses: [],
  55017. messageSends: []
  55018. }),
  55019. $globals.HashedCollectionTest);
  55020. $core.addMethod(
  55021. $core.method({
  55022. selector: "collectionOfPrintStrings",
  55023. protocol: "fixture",
  55024. fn: function (){
  55025. var self=this,$self=this;
  55026. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  55027. },
  55028. args: [],
  55029. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  55030. referencedClasses: [],
  55031. messageSends: []
  55032. }),
  55033. $globals.HashedCollectionTest);
  55034. $core.addMethod(
  55035. $core.method({
  55036. selector: "collectionSize",
  55037. protocol: "fixture",
  55038. fn: function (){
  55039. var self=this,$self=this;
  55040. return (4);
  55041. },
  55042. args: [],
  55043. source: "collectionSize\x0a\x09^ 4",
  55044. referencedClasses: [],
  55045. messageSends: []
  55046. }),
  55047. $globals.HashedCollectionTest);
  55048. $core.addMethod(
  55049. $core.method({
  55050. selector: "collectionValues",
  55051. protocol: "fixture",
  55052. fn: function (){
  55053. var self=this,$self=this;
  55054. return [(1),(2),(3),(-4)];
  55055. },
  55056. args: [],
  55057. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  55058. referencedClasses: [],
  55059. messageSends: []
  55060. }),
  55061. $globals.HashedCollectionTest);
  55062. $core.addMethod(
  55063. $core.method({
  55064. selector: "collectionWithDuplicates",
  55065. protocol: "fixture",
  55066. fn: function (){
  55067. var self=this,$self=this;
  55068. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  55069. },
  55070. args: [],
  55071. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  55072. referencedClasses: [],
  55073. messageSends: []
  55074. }),
  55075. $globals.HashedCollectionTest);
  55076. $core.addMethod(
  55077. $core.method({
  55078. selector: "collectionWithNewValue",
  55079. protocol: "fixture",
  55080. fn: function (){
  55081. var self=this,$self=this;
  55082. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  55083. },
  55084. args: [],
  55085. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  55086. referencedClasses: [],
  55087. messageSends: []
  55088. }),
  55089. $globals.HashedCollectionTest);
  55090. $core.addMethod(
  55091. $core.method({
  55092. selector: "sampleNewValueAsCollection",
  55093. protocol: "fixture",
  55094. fn: function (){
  55095. var self=this,$self=this;
  55096. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  55097. },
  55098. args: [],
  55099. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  55100. referencedClasses: [],
  55101. messageSends: []
  55102. }),
  55103. $globals.HashedCollectionTest);
  55104. $core.addMethod(
  55105. $core.method({
  55106. selector: "testDynamicDictionaries",
  55107. protocol: "tests",
  55108. fn: function (){
  55109. var self=this,$self=this;
  55110. return $core.withContext(function($ctx1) {
  55111. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  55112. return self;
  55113. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  55114. },
  55115. args: [],
  55116. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  55117. referencedClasses: ["HashedCollection"],
  55118. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  55119. }),
  55120. $globals.HashedCollectionTest);
  55121. $core.addMethod(
  55122. $core.method({
  55123. selector: "collectionClass",
  55124. protocol: "fixture",
  55125. fn: function (){
  55126. var self=this,$self=this;
  55127. return $globals.HashedCollection;
  55128. },
  55129. args: [],
  55130. source: "collectionClass\x0a\x09^ HashedCollection",
  55131. referencedClasses: ["HashedCollection"],
  55132. messageSends: []
  55133. }),
  55134. $globals.HashedCollectionTest.a$cls);
  55135. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  55136. $core.addMethod(
  55137. $core.method({
  55138. selector: "collectionFirst",
  55139. protocol: "fixture",
  55140. fn: function (){
  55141. var self=this,$self=this;
  55142. return $core.withContext(function($ctx1) {
  55143. $self._subclassResponsibility();
  55144. return self;
  55145. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  55146. },
  55147. args: [],
  55148. source: "collectionFirst\x0a\x09self subclassResponsibility",
  55149. referencedClasses: [],
  55150. messageSends: ["subclassResponsibility"]
  55151. }),
  55152. $globals.SequenceableCollectionTest);
  55153. $core.addMethod(
  55154. $core.method({
  55155. selector: "collectionFirstTwo",
  55156. protocol: "fixture",
  55157. fn: function (){
  55158. var self=this,$self=this;
  55159. return $core.withContext(function($ctx1) {
  55160. $self._subclassResponsibility();
  55161. return self;
  55162. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  55163. },
  55164. args: [],
  55165. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  55166. referencedClasses: [],
  55167. messageSends: ["subclassResponsibility"]
  55168. }),
  55169. $globals.SequenceableCollectionTest);
  55170. $core.addMethod(
  55171. $core.method({
  55172. selector: "collectionLast",
  55173. protocol: "fixture",
  55174. fn: function (){
  55175. var self=this,$self=this;
  55176. return $core.withContext(function($ctx1) {
  55177. $self._subclassResponsibility();
  55178. return self;
  55179. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  55180. },
  55181. args: [],
  55182. source: "collectionLast\x0a\x09self subclassResponsibility",
  55183. referencedClasses: [],
  55184. messageSends: ["subclassResponsibility"]
  55185. }),
  55186. $globals.SequenceableCollectionTest);
  55187. $core.addMethod(
  55188. $core.method({
  55189. selector: "collectionLastTwo",
  55190. protocol: "fixture",
  55191. fn: function (){
  55192. var self=this,$self=this;
  55193. return $core.withContext(function($ctx1) {
  55194. $self._subclassResponsibility();
  55195. return self;
  55196. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55197. },
  55198. args: [],
  55199. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55200. referencedClasses: [],
  55201. messageSends: ["subclassResponsibility"]
  55202. }),
  55203. $globals.SequenceableCollectionTest);
  55204. $core.addMethod(
  55205. $core.method({
  55206. selector: "nonIndexesDo:",
  55207. protocol: "fixture",
  55208. fn: function (aBlock){
  55209. var self=this,$self=this;
  55210. return $core.withContext(function($ctx1) {
  55211. $recv(aBlock)._value_((0));
  55212. $ctx1.sendIdx["value:"]=1;
  55213. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55214. $ctx1.sendIdx["value:"]=2;
  55215. $recv(aBlock)._value_("z");
  55216. return self;
  55217. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55218. },
  55219. args: ["aBlock"],
  55220. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55221. referencedClasses: [],
  55222. messageSends: ["value:", "+", "collectionSize"]
  55223. }),
  55224. $globals.SequenceableCollectionTest);
  55225. $core.addMethod(
  55226. $core.method({
  55227. selector: "samplesDo:",
  55228. protocol: "fixture",
  55229. fn: function (aBlock){
  55230. var self=this,$self=this;
  55231. return $core.withContext(function($ctx1) {
  55232. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55233. $ctx1.sendIdx["value:value:"]=1;
  55234. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55235. return self;
  55236. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55237. },
  55238. args: ["aBlock"],
  55239. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55240. referencedClasses: [],
  55241. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55242. }),
  55243. $globals.SequenceableCollectionTest);
  55244. $core.addMethod(
  55245. $core.method({
  55246. selector: "testBeginsWith",
  55247. protocol: "tests",
  55248. fn: function (){
  55249. var self=this,$self=this;
  55250. return $core.withContext(function($ctx1) {
  55251. var $2,$1,$4,$5,$3,$7,$6;
  55252. $2=$self._collection();
  55253. $ctx1.sendIdx["collection"]=1;
  55254. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55255. $ctx1.sendIdx["beginsWith:"]=1;
  55256. $self._assert_($1);
  55257. $ctx1.sendIdx["assert:"]=1;
  55258. $4=$self._collection();
  55259. $ctx1.sendIdx["collection"]=2;
  55260. $5=$self._collection();
  55261. $ctx1.sendIdx["collection"]=3;
  55262. $3=$recv($4)._beginsWith_($5);
  55263. $ctx1.sendIdx["beginsWith:"]=2;
  55264. $self._assert_($3);
  55265. $ctx1.sendIdx["assert:"]=2;
  55266. $7=$self._collection();
  55267. $ctx1.sendIdx["collection"]=4;
  55268. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55269. $ctx1.sendIdx["beginsWith:"]=3;
  55270. $self._assert_($6);
  55271. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55272. return self;
  55273. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55274. },
  55275. args: [],
  55276. 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)",
  55277. referencedClasses: [],
  55278. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55279. }),
  55280. $globals.SequenceableCollectionTest);
  55281. $core.addMethod(
  55282. $core.method({
  55283. selector: "testEndsWith",
  55284. protocol: "tests",
  55285. fn: function (){
  55286. var self=this,$self=this;
  55287. return $core.withContext(function($ctx1) {
  55288. var $2,$1,$4,$5,$3,$7,$6;
  55289. $2=$self._collection();
  55290. $ctx1.sendIdx["collection"]=1;
  55291. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55292. $ctx1.sendIdx["endsWith:"]=1;
  55293. $self._assert_($1);
  55294. $ctx1.sendIdx["assert:"]=1;
  55295. $4=$self._collection();
  55296. $ctx1.sendIdx["collection"]=2;
  55297. $5=$self._collection();
  55298. $ctx1.sendIdx["collection"]=3;
  55299. $3=$recv($4)._endsWith_($5);
  55300. $ctx1.sendIdx["endsWith:"]=2;
  55301. $self._assert_($3);
  55302. $ctx1.sendIdx["assert:"]=2;
  55303. $7=$self._collection();
  55304. $ctx1.sendIdx["collection"]=4;
  55305. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55306. $ctx1.sendIdx["endsWith:"]=3;
  55307. $self._assert_($6);
  55308. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55309. return self;
  55310. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55311. },
  55312. args: [],
  55313. 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)",
  55314. referencedClasses: [],
  55315. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55316. }),
  55317. $globals.SequenceableCollectionTest);
  55318. $core.addMethod(
  55319. $core.method({
  55320. selector: "testFirst",
  55321. protocol: "tests",
  55322. fn: function (){
  55323. var self=this,$self=this;
  55324. return $core.withContext(function($ctx1) {
  55325. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55326. return self;
  55327. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55328. },
  55329. args: [],
  55330. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55331. referencedClasses: [],
  55332. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55333. }),
  55334. $globals.SequenceableCollectionTest);
  55335. $core.addMethod(
  55336. $core.method({
  55337. selector: "testFirstN",
  55338. protocol: "tests",
  55339. fn: function (){
  55340. var self=this,$self=this;
  55341. return $core.withContext(function($ctx1) {
  55342. var $2,$1,$4,$3,$6,$5,$7;
  55343. $2=$self._collection();
  55344. $ctx1.sendIdx["collection"]=1;
  55345. $1=$recv($2)._first_((2));
  55346. $ctx1.sendIdx["first:"]=1;
  55347. $self._assert_equals_($1,$self._collectionFirstTwo());
  55348. $ctx1.sendIdx["assert:equals:"]=1;
  55349. $4=$self._collection();
  55350. $ctx1.sendIdx["collection"]=2;
  55351. $3=$recv($4)._first_((0));
  55352. $ctx1.sendIdx["first:"]=2;
  55353. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55354. $ctx1.sendIdx["assert:equals:"]=2;
  55355. $6=$self._collection();
  55356. $ctx1.sendIdx["collection"]=3;
  55357. $5=$recv($6)._first_($self._collectionSize());
  55358. $ctx1.sendIdx["first:"]=3;
  55359. $7=$self._collection();
  55360. $ctx1.sendIdx["collection"]=4;
  55361. $self._assert_equals_($5,$7);
  55362. $self._should_raise_((function(){
  55363. return $core.withContext(function($ctx2) {
  55364. return $recv($self._collection())._first_((33));
  55365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55366. }),$globals.Error);
  55367. return self;
  55368. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55369. },
  55370. args: [],
  55371. 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",
  55372. referencedClasses: ["Error"],
  55373. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55374. }),
  55375. $globals.SequenceableCollectionTest);
  55376. $core.addMethod(
  55377. $core.method({
  55378. selector: "testFourth",
  55379. protocol: "tests",
  55380. fn: function (){
  55381. var self=this,$self=this;
  55382. return $core.withContext(function($ctx1) {
  55383. var $2,$1;
  55384. $2=$self._collection();
  55385. $ctx1.sendIdx["collection"]=1;
  55386. $1=$recv($2)._fourth();
  55387. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55388. return self;
  55389. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55390. },
  55391. args: [],
  55392. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55393. referencedClasses: [],
  55394. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55395. }),
  55396. $globals.SequenceableCollectionTest);
  55397. $core.addMethod(
  55398. $core.method({
  55399. selector: "testIndexOfStartingAt",
  55400. protocol: "tests",
  55401. fn: function (){
  55402. var self=this,$self=this;
  55403. var jsNull;
  55404. return $core.withContext(function($ctx1) {
  55405. var $2,$1,$4,$3;
  55406. jsNull=$recv($globals.JSON)._parse_("null");
  55407. $self._samplesDo_((function(index,value){
  55408. return $core.withContext(function($ctx2) {
  55409. $2=$self._collection();
  55410. $ctx2.sendIdx["collection"]=1;
  55411. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55412. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55413. $self._assert_equals_($1,index);
  55414. $ctx2.sendIdx["assert:equals:"]=1;
  55415. $4=$self._collection();
  55416. $ctx2.sendIdx["collection"]=2;
  55417. $3=$recv($4)._indexOf_startingAt_(value,index);
  55418. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55419. $self._assert_equals_($3,index);
  55420. $ctx2.sendIdx["assert:equals:"]=2;
  55421. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55422. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55423. }));
  55424. return self;
  55425. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55426. },
  55427. args: [],
  55428. 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 ]",
  55429. referencedClasses: ["JSON"],
  55430. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55431. }),
  55432. $globals.SequenceableCollectionTest);
  55433. $core.addMethod(
  55434. $core.method({
  55435. selector: "testIndexOfStartingAtWithNull",
  55436. protocol: "tests",
  55437. fn: function (){
  55438. var self=this,$self=this;
  55439. var jsNull;
  55440. return $core.withContext(function($ctx1) {
  55441. var $1,$2;
  55442. jsNull=$recv($globals.JSON)._parse_("null");
  55443. $self._samplesDo_((function(index,value){
  55444. var collection;
  55445. return $core.withContext(function($ctx2) {
  55446. collection=$self._collection();
  55447. $recv(collection)._at_put_(index,jsNull);
  55448. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55449. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55450. $self._assert_equals_($1,index);
  55451. $ctx2.sendIdx["assert:equals:"]=1;
  55452. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55453. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55454. $self._assert_equals_($2,index);
  55455. $ctx2.sendIdx["assert:equals:"]=2;
  55456. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55457. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55458. }));
  55459. return self;
  55460. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55461. },
  55462. args: [],
  55463. 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 ]",
  55464. referencedClasses: ["JSON"],
  55465. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55466. }),
  55467. $globals.SequenceableCollectionTest);
  55468. $core.addMethod(
  55469. $core.method({
  55470. selector: "testLast",
  55471. protocol: "tests",
  55472. fn: function (){
  55473. var self=this,$self=this;
  55474. return $core.withContext(function($ctx1) {
  55475. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55476. return self;
  55477. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55478. },
  55479. args: [],
  55480. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55481. referencedClasses: [],
  55482. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55483. }),
  55484. $globals.SequenceableCollectionTest);
  55485. $core.addMethod(
  55486. $core.method({
  55487. selector: "testLastN",
  55488. protocol: "tests",
  55489. fn: function (){
  55490. var self=this,$self=this;
  55491. return $core.withContext(function($ctx1) {
  55492. var $2,$1,$4,$3,$6,$5,$7;
  55493. $2=$self._collection();
  55494. $ctx1.sendIdx["collection"]=1;
  55495. $1=$recv($2)._last_((2));
  55496. $ctx1.sendIdx["last:"]=1;
  55497. $self._assert_equals_($1,$self._collectionLastTwo());
  55498. $ctx1.sendIdx["assert:equals:"]=1;
  55499. $4=$self._collection();
  55500. $ctx1.sendIdx["collection"]=2;
  55501. $3=$recv($4)._last_((0));
  55502. $ctx1.sendIdx["last:"]=2;
  55503. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55504. $ctx1.sendIdx["assert:equals:"]=2;
  55505. $6=$self._collection();
  55506. $ctx1.sendIdx["collection"]=3;
  55507. $5=$recv($6)._last_($self._collectionSize());
  55508. $ctx1.sendIdx["last:"]=3;
  55509. $7=$self._collection();
  55510. $ctx1.sendIdx["collection"]=4;
  55511. $self._assert_equals_($5,$7);
  55512. $self._should_raise_((function(){
  55513. return $core.withContext(function($ctx2) {
  55514. return $recv($self._collection())._last_((33));
  55515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55516. }),$globals.Error);
  55517. return self;
  55518. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55519. },
  55520. args: [],
  55521. 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",
  55522. referencedClasses: ["Error"],
  55523. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55524. }),
  55525. $globals.SequenceableCollectionTest);
  55526. $core.addMethod(
  55527. $core.method({
  55528. selector: "testSecond",
  55529. protocol: "tests",
  55530. fn: function (){
  55531. var self=this,$self=this;
  55532. return $core.withContext(function($ctx1) {
  55533. var $2,$1;
  55534. $2=$self._collection();
  55535. $ctx1.sendIdx["collection"]=1;
  55536. $1=$recv($2)._second();
  55537. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55538. return self;
  55539. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55540. },
  55541. args: [],
  55542. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55543. referencedClasses: [],
  55544. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55545. }),
  55546. $globals.SequenceableCollectionTest);
  55547. $core.addMethod(
  55548. $core.method({
  55549. selector: "testThird",
  55550. protocol: "tests",
  55551. fn: function (){
  55552. var self=this,$self=this;
  55553. return $core.withContext(function($ctx1) {
  55554. var $2,$1;
  55555. $2=$self._collection();
  55556. $ctx1.sendIdx["collection"]=1;
  55557. $1=$recv($2)._third();
  55558. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55559. return self;
  55560. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55561. },
  55562. args: [],
  55563. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55564. referencedClasses: [],
  55565. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55566. }),
  55567. $globals.SequenceableCollectionTest);
  55568. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55569. $core.addMethod(
  55570. $core.method({
  55571. selector: "collection",
  55572. protocol: "fixture",
  55573. fn: function (){
  55574. var self=this,$self=this;
  55575. return [(1), (2), (3), (-4)];
  55576. },
  55577. args: [],
  55578. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55579. referencedClasses: [],
  55580. messageSends: []
  55581. }),
  55582. $globals.ArrayTest);
  55583. $core.addMethod(
  55584. $core.method({
  55585. selector: "collectionFirst",
  55586. protocol: "fixture",
  55587. fn: function (){
  55588. var self=this,$self=this;
  55589. return (1);
  55590. },
  55591. args: [],
  55592. source: "collectionFirst\x0a\x09^ 1",
  55593. referencedClasses: [],
  55594. messageSends: []
  55595. }),
  55596. $globals.ArrayTest);
  55597. $core.addMethod(
  55598. $core.method({
  55599. selector: "collectionFirstTwo",
  55600. protocol: "fixture",
  55601. fn: function (){
  55602. var self=this,$self=this;
  55603. return [(1), (2)];
  55604. },
  55605. args: [],
  55606. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55607. referencedClasses: [],
  55608. messageSends: []
  55609. }),
  55610. $globals.ArrayTest);
  55611. $core.addMethod(
  55612. $core.method({
  55613. selector: "collectionLast",
  55614. protocol: "fixture",
  55615. fn: function (){
  55616. var self=this,$self=this;
  55617. return (-4);
  55618. },
  55619. args: [],
  55620. source: "collectionLast\x0a\x09^ -4",
  55621. referencedClasses: [],
  55622. messageSends: []
  55623. }),
  55624. $globals.ArrayTest);
  55625. $core.addMethod(
  55626. $core.method({
  55627. selector: "collectionLastTwo",
  55628. protocol: "fixture",
  55629. fn: function (){
  55630. var self=this,$self=this;
  55631. return [(3), (-4)];
  55632. },
  55633. args: [],
  55634. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55635. referencedClasses: [],
  55636. messageSends: []
  55637. }),
  55638. $globals.ArrayTest);
  55639. $core.addMethod(
  55640. $core.method({
  55641. selector: "collectionOfPrintStrings",
  55642. protocol: "fixture",
  55643. fn: function (){
  55644. var self=this,$self=this;
  55645. return ["1", "2", "3", "-4"];
  55646. },
  55647. args: [],
  55648. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55649. referencedClasses: [],
  55650. messageSends: []
  55651. }),
  55652. $globals.ArrayTest);
  55653. $core.addMethod(
  55654. $core.method({
  55655. selector: "collectionSize",
  55656. protocol: "fixture",
  55657. fn: function (){
  55658. var self=this,$self=this;
  55659. return (4);
  55660. },
  55661. args: [],
  55662. source: "collectionSize\x0a\x09^ 4",
  55663. referencedClasses: [],
  55664. messageSends: []
  55665. }),
  55666. $globals.ArrayTest);
  55667. $core.addMethod(
  55668. $core.method({
  55669. selector: "collectionWithDuplicates",
  55670. protocol: "fixture",
  55671. fn: function (){
  55672. var self=this,$self=this;
  55673. return ["a", "b", "c", (1), (2), (1), "a", []];
  55674. },
  55675. args: [],
  55676. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55677. referencedClasses: [],
  55678. messageSends: []
  55679. }),
  55680. $globals.ArrayTest);
  55681. $core.addMethod(
  55682. $core.method({
  55683. selector: "collectionWithNewValue",
  55684. protocol: "fixture",
  55685. fn: function (){
  55686. var self=this,$self=this;
  55687. return [(1), (2), (3), (-4), "N"];
  55688. },
  55689. args: [],
  55690. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55691. referencedClasses: [],
  55692. messageSends: []
  55693. }),
  55694. $globals.ArrayTest);
  55695. $core.addMethod(
  55696. $core.method({
  55697. selector: "sampleNewIndex",
  55698. protocol: "fixture",
  55699. fn: function (){
  55700. var self=this,$self=this;
  55701. return (5);
  55702. },
  55703. args: [],
  55704. source: "sampleNewIndex\x0a\x09^ 5",
  55705. referencedClasses: [],
  55706. messageSends: []
  55707. }),
  55708. $globals.ArrayTest);
  55709. $core.addMethod(
  55710. $core.method({
  55711. selector: "samplesDo:",
  55712. protocol: "fixture",
  55713. fn: function (aBlock){
  55714. var self=this,$self=this;
  55715. return $core.withContext(function($ctx1) {
  55716. (
  55717. $ctx1.supercall = true,
  55718. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55719. $ctx1.supercall = false;
  55720. $recv(aBlock)._value_value_((3),(3));
  55721. return self;
  55722. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55723. },
  55724. args: ["aBlock"],
  55725. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55726. referencedClasses: [],
  55727. messageSends: ["samplesDo:", "value:value:"]
  55728. }),
  55729. $globals.ArrayTest);
  55730. $core.addMethod(
  55731. $core.method({
  55732. selector: "testAdd",
  55733. protocol: "tests",
  55734. fn: function (){
  55735. var self=this,$self=this;
  55736. var array;
  55737. return $core.withContext(function($ctx1) {
  55738. array=$self._collection();
  55739. $recv(array)._add_((6));
  55740. $self._assert_equals_($recv(array)._last(),(6));
  55741. return self;
  55742. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55743. },
  55744. args: [],
  55745. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55746. referencedClasses: [],
  55747. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55748. }),
  55749. $globals.ArrayTest);
  55750. $core.addMethod(
  55751. $core.method({
  55752. selector: "testAddFirst",
  55753. protocol: "tests",
  55754. fn: function (){
  55755. var self=this,$self=this;
  55756. return $core.withContext(function($ctx1) {
  55757. var $3,$2,$1;
  55758. $3=$self._collection();
  55759. $recv($3)._addFirst_((0));
  55760. $2=$recv($3)._yourself();
  55761. $1=$recv($2)._first();
  55762. $self._assert_equals_($1,(0));
  55763. return self;
  55764. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55765. },
  55766. args: [],
  55767. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55768. referencedClasses: [],
  55769. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55770. }),
  55771. $globals.ArrayTest);
  55772. $core.addMethod(
  55773. $core.method({
  55774. selector: "testPrintString",
  55775. protocol: "tests",
  55776. fn: function (){
  55777. var self=this,$self=this;
  55778. var array;
  55779. return $core.withContext(function($ctx1) {
  55780. var $1,$2,$3,$4,$5,$6,$7,$8;
  55781. array=$recv($globals.Array)._new();
  55782. $1=$recv(array)._printString();
  55783. $ctx1.sendIdx["printString"]=1;
  55784. $self._assert_equals_($1,"an Array ()");
  55785. $ctx1.sendIdx["assert:equals:"]=1;
  55786. $2=array;
  55787. $recv($2)._add_((1));
  55788. $ctx1.sendIdx["add:"]=1;
  55789. $3=$recv($2)._add_((3));
  55790. $ctx1.sendIdx["add:"]=2;
  55791. $4=$recv(array)._printString();
  55792. $ctx1.sendIdx["printString"]=2;
  55793. $self._assert_equals_($4,"an Array (1 3)");
  55794. $ctx1.sendIdx["assert:equals:"]=2;
  55795. $recv(array)._add_("foo");
  55796. $5=$recv(array)._printString();
  55797. $ctx1.sendIdx["printString"]=3;
  55798. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55799. $ctx1.sendIdx["assert:equals:"]=3;
  55800. $6=array;
  55801. $recv($6)._remove_((1));
  55802. $ctx1.sendIdx["remove:"]=1;
  55803. $recv($6)._remove_((3));
  55804. $7=$recv(array)._printString();
  55805. $ctx1.sendIdx["printString"]=4;
  55806. $self._assert_equals_($7,"an Array ('foo')");
  55807. $ctx1.sendIdx["assert:equals:"]=4;
  55808. $recv(array)._addLast_((3));
  55809. $ctx1.sendIdx["addLast:"]=1;
  55810. $8=$recv(array)._printString();
  55811. $ctx1.sendIdx["printString"]=5;
  55812. $self._assert_equals_($8,"an Array ('foo' 3)");
  55813. $ctx1.sendIdx["assert:equals:"]=5;
  55814. $recv(array)._addLast_((3));
  55815. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55816. return self;
  55817. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55818. },
  55819. args: [],
  55820. 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)'.",
  55821. referencedClasses: ["Array"],
  55822. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55823. }),
  55824. $globals.ArrayTest);
  55825. $core.addMethod(
  55826. $core.method({
  55827. selector: "testRemove",
  55828. protocol: "tests",
  55829. fn: function (){
  55830. var self=this,$self=this;
  55831. var array;
  55832. return $core.withContext(function($ctx1) {
  55833. array=[(1), (2), (3), (4), (5)];
  55834. $recv(array)._remove_((3));
  55835. $ctx1.sendIdx["remove:"]=1;
  55836. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55837. $self._should_raise_((function(){
  55838. return $core.withContext(function($ctx2) {
  55839. return $recv(array)._remove_((3));
  55840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55841. }),$globals.Error);
  55842. return self;
  55843. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55844. },
  55845. args: [],
  55846. 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",
  55847. referencedClasses: ["Error"],
  55848. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55849. }),
  55850. $globals.ArrayTest);
  55851. $core.addMethod(
  55852. $core.method({
  55853. selector: "testRemoveFromTo",
  55854. protocol: "tests",
  55855. fn: function (){
  55856. var self=this,$self=this;
  55857. return $core.withContext(function($ctx1) {
  55858. var $1,$2;
  55859. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55860. $ctx1.sendIdx["removeFrom:to:"]=1;
  55861. $self._assert_equals_($1,[(4)]);
  55862. $ctx1.sendIdx["assert:equals:"]=1;
  55863. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55864. $ctx1.sendIdx["removeFrom:to:"]=2;
  55865. $self._assert_equals_($2,[(1), (4)]);
  55866. $ctx1.sendIdx["assert:equals:"]=2;
  55867. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55868. return self;
  55869. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55870. },
  55871. args: [],
  55872. 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)",
  55873. referencedClasses: [],
  55874. messageSends: ["assert:equals:", "removeFrom:to:"]
  55875. }),
  55876. $globals.ArrayTest);
  55877. $core.addMethod(
  55878. $core.method({
  55879. selector: "testRemoveIndex",
  55880. protocol: "tests",
  55881. fn: function (){
  55882. var self=this,$self=this;
  55883. return $core.withContext(function($ctx1) {
  55884. var $1,$2;
  55885. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55886. $ctx1.sendIdx["removeIndex:"]=1;
  55887. $self._assert_equals_($1,[(1), (3), (4)]);
  55888. $ctx1.sendIdx["assert:equals:"]=1;
  55889. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55890. $ctx1.sendIdx["removeIndex:"]=2;
  55891. $self._assert_equals_($2,[(2), (3), (4)]);
  55892. $ctx1.sendIdx["assert:equals:"]=2;
  55893. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55894. return self;
  55895. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55896. },
  55897. args: [],
  55898. 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: #()",
  55899. referencedClasses: [],
  55900. messageSends: ["assert:equals:", "removeIndex:"]
  55901. }),
  55902. $globals.ArrayTest);
  55903. $core.addMethod(
  55904. $core.method({
  55905. selector: "testRemoveLast",
  55906. protocol: "tests",
  55907. fn: function (){
  55908. var self=this,$self=this;
  55909. var array;
  55910. return $core.withContext(function($ctx1) {
  55911. array=[(1), (2)];
  55912. $recv(array)._removeLast();
  55913. $self._assert_equals_($recv(array)._last(),(1));
  55914. return self;
  55915. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55916. },
  55917. args: [],
  55918. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55919. referencedClasses: [],
  55920. messageSends: ["removeLast", "assert:equals:", "last"]
  55921. }),
  55922. $globals.ArrayTest);
  55923. $core.addMethod(
  55924. $core.method({
  55925. selector: "testReversed",
  55926. protocol: "tests",
  55927. fn: function (){
  55928. var self=this,$self=this;
  55929. var array;
  55930. return $core.withContext(function($ctx1) {
  55931. array=[(5), (4), (3), (2), (1)];
  55932. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55933. return self;
  55934. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55935. },
  55936. args: [],
  55937. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55938. referencedClasses: [],
  55939. messageSends: ["assert:equals:", "reversed"]
  55940. }),
  55941. $globals.ArrayTest);
  55942. $core.addMethod(
  55943. $core.method({
  55944. selector: "testSort",
  55945. protocol: "tests",
  55946. fn: function (){
  55947. var self=this,$self=this;
  55948. var array;
  55949. return $core.withContext(function($ctx1) {
  55950. array=[(10), (1), (5)];
  55951. $recv(array)._sort();
  55952. $self._assert_equals_(array,[(1), (5), (10)]);
  55953. return self;
  55954. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55955. },
  55956. args: [],
  55957. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55958. referencedClasses: [],
  55959. messageSends: ["sort", "assert:equals:"]
  55960. }),
  55961. $globals.ArrayTest);
  55962. $core.addMethod(
  55963. $core.method({
  55964. selector: "collectionClass",
  55965. protocol: "fixture",
  55966. fn: function (){
  55967. var self=this,$self=this;
  55968. return $globals.Array;
  55969. },
  55970. args: [],
  55971. source: "collectionClass\x0a\x09^ Array",
  55972. referencedClasses: ["Array"],
  55973. messageSends: []
  55974. }),
  55975. $globals.ArrayTest.a$cls);
  55976. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55977. $core.addMethod(
  55978. $core.method({
  55979. selector: "collection",
  55980. protocol: "fixture",
  55981. fn: function (){
  55982. var self=this,$self=this;
  55983. return "helLo";
  55984. },
  55985. args: [],
  55986. source: "collection\x0a\x09^ 'helLo'",
  55987. referencedClasses: [],
  55988. messageSends: []
  55989. }),
  55990. $globals.StringTest);
  55991. $core.addMethod(
  55992. $core.method({
  55993. selector: "collectionFirst",
  55994. protocol: "fixture",
  55995. fn: function (){
  55996. var self=this,$self=this;
  55997. return "h";
  55998. },
  55999. args: [],
  56000. source: "collectionFirst\x0a\x09^ 'h'",
  56001. referencedClasses: [],
  56002. messageSends: []
  56003. }),
  56004. $globals.StringTest);
  56005. $core.addMethod(
  56006. $core.method({
  56007. selector: "collectionFirstTwo",
  56008. protocol: "fixture",
  56009. fn: function (){
  56010. var self=this,$self=this;
  56011. return "he";
  56012. },
  56013. args: [],
  56014. source: "collectionFirstTwo\x0a\x09^ 'he'",
  56015. referencedClasses: [],
  56016. messageSends: []
  56017. }),
  56018. $globals.StringTest);
  56019. $core.addMethod(
  56020. $core.method({
  56021. selector: "collectionLast",
  56022. protocol: "fixture",
  56023. fn: function (){
  56024. var self=this,$self=this;
  56025. return "o";
  56026. },
  56027. args: [],
  56028. source: "collectionLast\x0a\x09^ 'o'",
  56029. referencedClasses: [],
  56030. messageSends: []
  56031. }),
  56032. $globals.StringTest);
  56033. $core.addMethod(
  56034. $core.method({
  56035. selector: "collectionLastTwo",
  56036. protocol: "fixture",
  56037. fn: function (){
  56038. var self=this,$self=this;
  56039. return "Lo";
  56040. },
  56041. args: [],
  56042. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  56043. referencedClasses: [],
  56044. messageSends: []
  56045. }),
  56046. $globals.StringTest);
  56047. $core.addMethod(
  56048. $core.method({
  56049. selector: "collectionOfPrintStrings",
  56050. protocol: "fixture",
  56051. fn: function (){
  56052. var self=this,$self=this;
  56053. return "'h''e''l''L''o'";
  56054. },
  56055. args: [],
  56056. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  56057. referencedClasses: [],
  56058. messageSends: []
  56059. }),
  56060. $globals.StringTest);
  56061. $core.addMethod(
  56062. $core.method({
  56063. selector: "collectionSize",
  56064. protocol: "fixture",
  56065. fn: function (){
  56066. var self=this,$self=this;
  56067. return (5);
  56068. },
  56069. args: [],
  56070. source: "collectionSize\x0a\x09^ 5",
  56071. referencedClasses: [],
  56072. messageSends: []
  56073. }),
  56074. $globals.StringTest);
  56075. $core.addMethod(
  56076. $core.method({
  56077. selector: "collectionWithDuplicates",
  56078. protocol: "fixture",
  56079. fn: function (){
  56080. var self=this,$self=this;
  56081. return "abbaerten";
  56082. },
  56083. args: [],
  56084. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  56085. referencedClasses: [],
  56086. messageSends: []
  56087. }),
  56088. $globals.StringTest);
  56089. $core.addMethod(
  56090. $core.method({
  56091. selector: "collectionWithNewValue",
  56092. protocol: "fixture",
  56093. fn: function (){
  56094. var self=this,$self=this;
  56095. return "helLoN";
  56096. },
  56097. args: [],
  56098. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  56099. referencedClasses: [],
  56100. messageSends: []
  56101. }),
  56102. $globals.StringTest);
  56103. $core.addMethod(
  56104. $core.method({
  56105. selector: "sampleNewValueAsCollection",
  56106. protocol: "fixture",
  56107. fn: function (){
  56108. var self=this,$self=this;
  56109. return "N";
  56110. },
  56111. args: [],
  56112. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  56113. referencedClasses: [],
  56114. messageSends: []
  56115. }),
  56116. $globals.StringTest);
  56117. $core.addMethod(
  56118. $core.method({
  56119. selector: "samplesDo:",
  56120. protocol: "fixture",
  56121. fn: function (aBlock){
  56122. var self=this,$self=this;
  56123. return $core.withContext(function($ctx1) {
  56124. (
  56125. $ctx1.supercall = true,
  56126. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  56127. $ctx1.supercall = false;
  56128. $recv(aBlock)._value_value_((3),"l");
  56129. return self;
  56130. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  56131. },
  56132. args: ["aBlock"],
  56133. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  56134. referencedClasses: [],
  56135. messageSends: ["samplesDo:", "value:value:"]
  56136. }),
  56137. $globals.StringTest);
  56138. $core.addMethod(
  56139. $core.method({
  56140. selector: "testAddAll",
  56141. protocol: "tests",
  56142. fn: function (){
  56143. var self=this,$self=this;
  56144. return $core.withContext(function($ctx1) {
  56145. var $1;
  56146. $self._should_raise_((function(){
  56147. return $core.withContext(function($ctx2) {
  56148. $1=$self._collection();
  56149. $ctx2.sendIdx["collection"]=1;
  56150. return $recv($1)._addAll_($self._collection());
  56151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56152. }),$globals.Error);
  56153. return self;
  56154. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  56155. },
  56156. args: [],
  56157. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  56158. referencedClasses: ["Error"],
  56159. messageSends: ["should:raise:", "addAll:", "collection"]
  56160. }),
  56161. $globals.StringTest);
  56162. $core.addMethod(
  56163. $core.method({
  56164. selector: "testAddRemove",
  56165. protocol: "tests",
  56166. fn: function (){
  56167. var self=this,$self=this;
  56168. return $core.withContext(function($ctx1) {
  56169. $self._should_raise_((function(){
  56170. return $core.withContext(function($ctx2) {
  56171. return "hello"._add_("a");
  56172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56173. }),$globals.Error);
  56174. $ctx1.sendIdx["should:raise:"]=1;
  56175. $self._should_raise_((function(){
  56176. return $core.withContext(function($ctx2) {
  56177. return "hello"._remove_("h");
  56178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56179. }),$globals.Error);
  56180. return self;
  56181. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  56182. },
  56183. args: [],
  56184. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56185. referencedClasses: ["Error"],
  56186. messageSends: ["should:raise:", "add:", "remove:"]
  56187. }),
  56188. $globals.StringTest);
  56189. $core.addMethod(
  56190. $core.method({
  56191. selector: "testAsArray",
  56192. protocol: "tests",
  56193. fn: function (){
  56194. var self=this,$self=this;
  56195. return $core.withContext(function($ctx1) {
  56196. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56197. return self;
  56198. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56199. },
  56200. args: [],
  56201. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56202. referencedClasses: [],
  56203. messageSends: ["assert:equals:", "asArray"]
  56204. }),
  56205. $globals.StringTest);
  56206. $core.addMethod(
  56207. $core.method({
  56208. selector: "testAsLowerCase",
  56209. protocol: "tests",
  56210. fn: function (){
  56211. var self=this,$self=this;
  56212. return $core.withContext(function($ctx1) {
  56213. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56214. return self;
  56215. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56216. },
  56217. args: [],
  56218. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56219. referencedClasses: [],
  56220. messageSends: ["assert:equals:", "asLowercase"]
  56221. }),
  56222. $globals.StringTest);
  56223. $core.addMethod(
  56224. $core.method({
  56225. selector: "testAsNumber",
  56226. protocol: "tests",
  56227. fn: function (){
  56228. var self=this,$self=this;
  56229. return $core.withContext(function($ctx1) {
  56230. var $1,$2;
  56231. $1="3"._asNumber();
  56232. $ctx1.sendIdx["asNumber"]=1;
  56233. $self._assert_equals_($1,(3));
  56234. $ctx1.sendIdx["assert:equals:"]=1;
  56235. $2="-3"._asNumber();
  56236. $ctx1.sendIdx["asNumber"]=2;
  56237. $self._assert_equals_($2,(-3));
  56238. $ctx1.sendIdx["assert:equals:"]=2;
  56239. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56240. return self;
  56241. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56242. },
  56243. args: [],
  56244. 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.",
  56245. referencedClasses: [],
  56246. messageSends: ["assert:equals:", "asNumber"]
  56247. }),
  56248. $globals.StringTest);
  56249. $core.addMethod(
  56250. $core.method({
  56251. selector: "testAsUpperCase",
  56252. protocol: "tests",
  56253. fn: function (){
  56254. var self=this,$self=this;
  56255. return $core.withContext(function($ctx1) {
  56256. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56257. return self;
  56258. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56259. },
  56260. args: [],
  56261. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56262. referencedClasses: [],
  56263. messageSends: ["assert:equals:", "asUppercase"]
  56264. }),
  56265. $globals.StringTest);
  56266. $core.addMethod(
  56267. $core.method({
  56268. selector: "testAsciiValue",
  56269. protocol: "tests",
  56270. fn: function (){
  56271. var self=this,$self=this;
  56272. var characterA,characterU;
  56273. return $core.withContext(function($ctx1) {
  56274. var $1;
  56275. characterA="A";
  56276. characterU="U";
  56277. $1=$recv(characterA)._asciiValue();
  56278. $ctx1.sendIdx["asciiValue"]=1;
  56279. $self._assert_equals_($1,(65));
  56280. $ctx1.sendIdx["assert:equals:"]=1;
  56281. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56282. return self;
  56283. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56284. },
  56285. args: [],
  56286. 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",
  56287. referencedClasses: [],
  56288. messageSends: ["assert:equals:", "asciiValue"]
  56289. }),
  56290. $globals.StringTest);
  56291. $core.addMethod(
  56292. $core.method({
  56293. selector: "testAtIfAbsentPut",
  56294. protocol: "tests",
  56295. fn: function (){
  56296. var self=this,$self=this;
  56297. return $core.withContext(function($ctx1) {
  56298. $self._should_raise_((function(){
  56299. return $core.withContext(function($ctx2) {
  56300. return "hello"._at_ifAbsentPut_((6),(function(){
  56301. return "a";
  56302. }));
  56303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56304. }),$globals.Error);
  56305. return self;
  56306. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56307. },
  56308. args: [],
  56309. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56310. referencedClasses: ["Error"],
  56311. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56312. }),
  56313. $globals.StringTest);
  56314. $core.addMethod(
  56315. $core.method({
  56316. selector: "testAtPut",
  56317. protocol: "tests",
  56318. fn: function (){
  56319. var self=this,$self=this;
  56320. return $core.withContext(function($ctx1) {
  56321. $self._should_raise_((function(){
  56322. return $core.withContext(function($ctx2) {
  56323. return "hello"._at_put_((1),"a");
  56324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56325. }),$globals.Error);
  56326. return self;
  56327. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56328. },
  56329. args: [],
  56330. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56331. referencedClasses: ["Error"],
  56332. messageSends: ["should:raise:", "at:put:"]
  56333. }),
  56334. $globals.StringTest);
  56335. $core.addMethod(
  56336. $core.method({
  56337. selector: "testCapitalized",
  56338. protocol: "tests",
  56339. fn: function (){
  56340. var self=this,$self=this;
  56341. return $core.withContext(function($ctx1) {
  56342. var $1,$2,$3;
  56343. $1="test"._capitalized();
  56344. $ctx1.sendIdx["capitalized"]=1;
  56345. $self._assert_equals_($1,"Test");
  56346. $ctx1.sendIdx["assert:equals:"]=1;
  56347. $2="Test"._capitalized();
  56348. $ctx1.sendIdx["capitalized"]=2;
  56349. $self._assert_equals_($2,"Test");
  56350. $ctx1.sendIdx["assert:equals:"]=2;
  56351. $self._assert_equals_(""._capitalized(),"");
  56352. $ctx1.sendIdx["assert:equals:"]=3;
  56353. $3="Test"._isCapitalized();
  56354. $ctx1.sendIdx["isCapitalized"]=1;
  56355. $self._assert_equals_($3,true);
  56356. $ctx1.sendIdx["assert:equals:"]=4;
  56357. $self._assert_equals_("test"._isCapitalized(),false);
  56358. return self;
  56359. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56360. },
  56361. args: [],
  56362. 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.",
  56363. referencedClasses: [],
  56364. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56365. }),
  56366. $globals.StringTest);
  56367. $core.addMethod(
  56368. $core.method({
  56369. selector: "testCharCodeAt",
  56370. protocol: "tests",
  56371. fn: function (){
  56372. var self=this,$self=this;
  56373. return $core.withContext(function($ctx1) {
  56374. var $1,$2,$3,$4,$5;
  56375. $1="jackie"._charCodeAt_((1));
  56376. $ctx1.sendIdx["charCodeAt:"]=1;
  56377. $self._assert_equals_($1,(106));
  56378. $ctx1.sendIdx["assert:equals:"]=1;
  56379. $2="jackie"._charCodeAt_((2));
  56380. $ctx1.sendIdx["charCodeAt:"]=2;
  56381. $self._assert_equals_($2,(97));
  56382. $ctx1.sendIdx["assert:equals:"]=2;
  56383. $3="jackie"._charCodeAt_((3));
  56384. $ctx1.sendIdx["charCodeAt:"]=3;
  56385. $self._assert_equals_($3,(99));
  56386. $ctx1.sendIdx["assert:equals:"]=3;
  56387. $4="jackie"._charCodeAt_((4));
  56388. $ctx1.sendIdx["charCodeAt:"]=4;
  56389. $self._assert_equals_($4,(107));
  56390. $ctx1.sendIdx["assert:equals:"]=4;
  56391. $5="jackie"._charCodeAt_((5));
  56392. $ctx1.sendIdx["charCodeAt:"]=5;
  56393. $self._assert_equals_($5,(105));
  56394. $ctx1.sendIdx["assert:equals:"]=5;
  56395. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56396. return self;
  56397. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56398. },
  56399. args: [],
  56400. 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",
  56401. referencedClasses: [],
  56402. messageSends: ["assert:equals:", "charCodeAt:"]
  56403. }),
  56404. $globals.StringTest);
  56405. $core.addMethod(
  56406. $core.method({
  56407. selector: "testCopyFromTo",
  56408. protocol: "tests",
  56409. fn: function (){
  56410. var self=this,$self=this;
  56411. return $core.withContext(function($ctx1) {
  56412. var $1;
  56413. $1="jackie"._copyFrom_to_((1),(3));
  56414. $ctx1.sendIdx["copyFrom:to:"]=1;
  56415. $self._assert_equals_($1,"jac");
  56416. $ctx1.sendIdx["assert:equals:"]=1;
  56417. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56418. return self;
  56419. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56420. },
  56421. args: [],
  56422. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56423. referencedClasses: [],
  56424. messageSends: ["assert:equals:", "copyFrom:to:"]
  56425. }),
  56426. $globals.StringTest);
  56427. $core.addMethod(
  56428. $core.method({
  56429. selector: "testCopySeparates",
  56430. protocol: "tests",
  56431. fn: function (){
  56432. var self=this,$self=this;
  56433. return $core.withContext(function($ctx1) {
  56434. var $3,$2,$1;
  56435. $3=$self._collection();
  56436. $ctx1.sendIdx["collection"]=1;
  56437. $2=$recv($3)._copy();
  56438. $1=$recv($2).__eq_eq($self._collection());
  56439. $self._assert_($1);
  56440. return self;
  56441. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56442. },
  56443. args: [],
  56444. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56445. referencedClasses: [],
  56446. messageSends: ["assert:", "==", "copy", "collection"]
  56447. }),
  56448. $globals.StringTest);
  56449. $core.addMethod(
  56450. $core.method({
  56451. selector: "testCopyWithoutAll",
  56452. protocol: "tests",
  56453. fn: function (){
  56454. var self=this,$self=this;
  56455. return $core.withContext(function($ctx1) {
  56456. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56457. return self;
  56458. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56459. },
  56460. args: [],
  56461. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56462. referencedClasses: [],
  56463. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56464. }),
  56465. $globals.StringTest);
  56466. $core.addMethod(
  56467. $core.method({
  56468. selector: "testEquality",
  56469. protocol: "tests",
  56470. fn: function (){
  56471. var self=this,$self=this;
  56472. return $core.withContext(function($ctx1) {
  56473. var $1,$2,$3;
  56474. $self._assert_equals_("hello","hello");
  56475. $ctx1.sendIdx["assert:equals:"]=1;
  56476. $1="hello".__eq("world");
  56477. $ctx1.sendIdx["="]=1;
  56478. $self._deny_($1);
  56479. $ctx1.sendIdx["deny:"]=1;
  56480. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56481. })));
  56482. $ctx1.sendIdx["="]=2;
  56483. $self._deny_($2);
  56484. $ctx1.sendIdx["deny:"]=2;
  56485. $3="hello"._yourself();
  56486. $ctx1.sendIdx["yourself"]=1;
  56487. $self._assert_equals_("hello",$3);
  56488. $ctx1.sendIdx["assert:equals:"]=2;
  56489. $self._assert_equals_("hello"._yourself(),"hello");
  56490. $self._deny_("".__eq((0)));
  56491. return self;
  56492. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56493. },
  56494. args: [],
  56495. 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",
  56496. referencedClasses: [],
  56497. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56498. }),
  56499. $globals.StringTest);
  56500. $core.addMethod(
  56501. $core.method({
  56502. selector: "testIdentity",
  56503. protocol: "tests",
  56504. fn: function (){
  56505. var self=this,$self=this;
  56506. return $core.withContext(function($ctx1) {
  56507. var $1,$2,$4,$3,$5;
  56508. $1="hello".__eq_eq("hello");
  56509. $ctx1.sendIdx["=="]=1;
  56510. $self._assert_($1);
  56511. $ctx1.sendIdx["assert:"]=1;
  56512. $2="hello".__eq_eq("world");
  56513. $ctx1.sendIdx["=="]=2;
  56514. $self._deny_($2);
  56515. $ctx1.sendIdx["deny:"]=1;
  56516. $4="hello"._yourself();
  56517. $ctx1.sendIdx["yourself"]=1;
  56518. $3="hello".__eq_eq($4);
  56519. $ctx1.sendIdx["=="]=3;
  56520. $self._assert_($3);
  56521. $ctx1.sendIdx["assert:"]=2;
  56522. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56523. $ctx1.sendIdx["=="]=4;
  56524. $self._assert_($5);
  56525. $self._deny_("".__eq_eq((0)));
  56526. return self;
  56527. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56528. },
  56529. args: [],
  56530. 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",
  56531. referencedClasses: [],
  56532. messageSends: ["assert:", "==", "deny:", "yourself"]
  56533. }),
  56534. $globals.StringTest);
  56535. $core.addMethod(
  56536. $core.method({
  56537. selector: "testIncludesSubString",
  56538. protocol: "tests",
  56539. fn: function (){
  56540. var self=this,$self=this;
  56541. return $core.withContext(function($ctx1) {
  56542. var $1;
  56543. $1="amber"._includesSubString_("ber");
  56544. $ctx1.sendIdx["includesSubString:"]=1;
  56545. $self._assert_($1);
  56546. $self._deny_("amber"._includesSubString_("zork"));
  56547. return self;
  56548. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56549. },
  56550. args: [],
  56551. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56552. referencedClasses: [],
  56553. messageSends: ["assert:", "includesSubString:", "deny:"]
  56554. }),
  56555. $globals.StringTest);
  56556. $core.addMethod(
  56557. $core.method({
  56558. selector: "testIndexOfStartingAtWithNull",
  56559. protocol: "tests",
  56560. fn: function (){
  56561. var self=this,$self=this;
  56562. return self;
  56563. },
  56564. args: [],
  56565. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56566. referencedClasses: [],
  56567. messageSends: []
  56568. }),
  56569. $globals.StringTest);
  56570. $core.addMethod(
  56571. $core.method({
  56572. selector: "testIndexOfWithNull",
  56573. protocol: "tests",
  56574. fn: function (){
  56575. var self=this,$self=this;
  56576. return self;
  56577. },
  56578. args: [],
  56579. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56580. referencedClasses: [],
  56581. messageSends: []
  56582. }),
  56583. $globals.StringTest);
  56584. $core.addMethod(
  56585. $core.method({
  56586. selector: "testIsVowel",
  56587. protocol: "tests",
  56588. fn: function (){
  56589. var self=this,$self=this;
  56590. var vowel,consonant;
  56591. return $core.withContext(function($ctx1) {
  56592. var $1;
  56593. vowel="u";
  56594. consonant="z";
  56595. $1=$recv(vowel)._isVowel();
  56596. $ctx1.sendIdx["isVowel"]=1;
  56597. $self._assert_equals_($1,true);
  56598. $ctx1.sendIdx["assert:equals:"]=1;
  56599. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56600. return self;
  56601. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56602. },
  56603. args: [],
  56604. 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",
  56605. referencedClasses: [],
  56606. messageSends: ["assert:equals:", "isVowel"]
  56607. }),
  56608. $globals.StringTest);
  56609. $core.addMethod(
  56610. $core.method({
  56611. selector: "testJoin",
  56612. protocol: "tests",
  56613. fn: function (){
  56614. var self=this,$self=this;
  56615. return $core.withContext(function($ctx1) {
  56616. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56617. return self;
  56618. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56619. },
  56620. args: [],
  56621. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56622. referencedClasses: [],
  56623. messageSends: ["assert:equals:", "join:"]
  56624. }),
  56625. $globals.StringTest);
  56626. $core.addMethod(
  56627. $core.method({
  56628. selector: "testRegression1224",
  56629. protocol: "tests",
  56630. fn: function (){
  56631. var self=this,$self=this;
  56632. return $core.withContext(function($ctx1) {
  56633. var $2,$1;
  56634. $self._should_raise_((function(){
  56635. return $core.withContext(function($ctx2) {
  56636. $2=$recv($self._collectionClass())._new();
  56637. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56638. }));
  56639. $1=$recv($2)._yourself();
  56640. return $recv($1)._size();
  56641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56642. }),$globals.Error);
  56643. return self;
  56644. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56645. },
  56646. args: [],
  56647. 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",
  56648. referencedClasses: ["Error"],
  56649. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56650. }),
  56651. $globals.StringTest);
  56652. $core.addMethod(
  56653. $core.method({
  56654. selector: "testRemoveAll",
  56655. protocol: "tests",
  56656. fn: function (){
  56657. var self=this,$self=this;
  56658. return $core.withContext(function($ctx1) {
  56659. $self._should_raise_((function(){
  56660. return $core.withContext(function($ctx2) {
  56661. return $recv($self._collection())._removeAll();
  56662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56663. }),$globals.Error);
  56664. return self;
  56665. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56666. },
  56667. args: [],
  56668. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56669. referencedClasses: ["Error"],
  56670. messageSends: ["should:raise:", "removeAll", "collection"]
  56671. }),
  56672. $globals.StringTest);
  56673. $core.addMethod(
  56674. $core.method({
  56675. selector: "testReversed",
  56676. protocol: "tests",
  56677. fn: function (){
  56678. var self=this,$self=this;
  56679. return $core.withContext(function($ctx1) {
  56680. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56681. return self;
  56682. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56683. },
  56684. args: [],
  56685. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56686. referencedClasses: [],
  56687. messageSends: ["assert:equals:", "reversed"]
  56688. }),
  56689. $globals.StringTest);
  56690. $core.addMethod(
  56691. $core.method({
  56692. selector: "testStreamContents",
  56693. protocol: "tests",
  56694. fn: function (){
  56695. var self=this,$self=this;
  56696. return $core.withContext(function($ctx1) {
  56697. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56698. return $core.withContext(function($ctx2) {
  56699. $recv(aStream)._nextPutAll_("hello");
  56700. $ctx2.sendIdx["nextPutAll:"]=1;
  56701. $recv(aStream)._space();
  56702. return $recv(aStream)._nextPutAll_("world");
  56703. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56704. })),"hello world");
  56705. return self;
  56706. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56707. },
  56708. args: [],
  56709. 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'",
  56710. referencedClasses: ["String"],
  56711. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56712. }),
  56713. $globals.StringTest);
  56714. $core.addMethod(
  56715. $core.method({
  56716. selector: "testSubStrings",
  56717. protocol: "tests",
  56718. fn: function (){
  56719. var self=this,$self=this;
  56720. return $core.withContext(function($ctx1) {
  56721. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56722. return self;
  56723. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56724. },
  56725. args: [],
  56726. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56727. referencedClasses: [],
  56728. messageSends: ["assert:equals:", "subStrings:"]
  56729. }),
  56730. $globals.StringTest);
  56731. $core.addMethod(
  56732. $core.method({
  56733. selector: "testTrim",
  56734. protocol: "tests",
  56735. fn: function (){
  56736. var self=this,$self=this;
  56737. return $core.withContext(function($ctx1) {
  56738. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56739. $ctx1.sendIdx["assert:equals:"]=1;
  56740. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56741. return self;
  56742. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56743. },
  56744. args: [],
  56745. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56746. referencedClasses: [],
  56747. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56748. }),
  56749. $globals.StringTest);
  56750. $core.addMethod(
  56751. $core.method({
  56752. selector: "testValue",
  56753. protocol: "tests",
  56754. fn: function (){
  56755. var self=this,$self=this;
  56756. return $core.withContext(function($ctx1) {
  56757. $self._assert_equals_("asString"._value_((1)),"1");
  56758. $ctx1.sendIdx["assert:equals:"]=1;
  56759. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56760. return self;
  56761. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56762. },
  56763. args: [],
  56764. 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')",
  56765. referencedClasses: [],
  56766. messageSends: ["assert:equals:", "value:", "collect:"]
  56767. }),
  56768. $globals.StringTest);
  56769. $core.addMethod(
  56770. $core.method({
  56771. selector: "collectionClass",
  56772. protocol: "fixture",
  56773. fn: function (){
  56774. var self=this,$self=this;
  56775. return $globals.String;
  56776. },
  56777. args: [],
  56778. source: "collectionClass\x0a\x09^ String",
  56779. referencedClasses: ["String"],
  56780. messageSends: []
  56781. }),
  56782. $globals.StringTest.a$cls);
  56783. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56784. $core.addMethod(
  56785. $core.method({
  56786. selector: "collection",
  56787. protocol: "fixture",
  56788. fn: function (){
  56789. var self=this,$self=this;
  56790. return $core.withContext(function($ctx1) {
  56791. var $1;
  56792. $1=$recv($globals.Set)._new();
  56793. $recv($1)._add_($globals.Smalltalk);
  56794. $ctx1.sendIdx["add:"]=1;
  56795. $recv($1)._add_(nil);
  56796. $ctx1.sendIdx["add:"]=2;
  56797. $recv($1)._add_((3).__at((3)));
  56798. $ctx1.sendIdx["add:"]=3;
  56799. $recv($1)._add_(false);
  56800. $ctx1.sendIdx["add:"]=4;
  56801. $recv($1)._add_($self["@sampleBlock"]);
  56802. return $recv($1)._yourself();
  56803. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56804. },
  56805. args: [],
  56806. 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",
  56807. referencedClasses: ["Set", "Smalltalk"],
  56808. messageSends: ["add:", "new", "@", "yourself"]
  56809. }),
  56810. $globals.SetTest);
  56811. $core.addMethod(
  56812. $core.method({
  56813. selector: "collectionOfPrintStrings",
  56814. protocol: "fixture",
  56815. fn: function (){
  56816. var self=this,$self=this;
  56817. return $core.withContext(function($ctx1) {
  56818. var $1;
  56819. $1=$recv($globals.Set)._new();
  56820. $recv($1)._add_("a SmalltalkImage");
  56821. $ctx1.sendIdx["add:"]=1;
  56822. $recv($1)._add_("nil");
  56823. $ctx1.sendIdx["add:"]=2;
  56824. $recv($1)._add_("3@3");
  56825. $ctx1.sendIdx["add:"]=3;
  56826. $recv($1)._add_("false");
  56827. $ctx1.sendIdx["add:"]=4;
  56828. $recv($1)._add_("a BlockClosure");
  56829. return $recv($1)._yourself();
  56830. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56831. },
  56832. args: [],
  56833. 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",
  56834. referencedClasses: ["Set"],
  56835. messageSends: ["add:", "new", "yourself"]
  56836. }),
  56837. $globals.SetTest);
  56838. $core.addMethod(
  56839. $core.method({
  56840. selector: "collectionSize",
  56841. protocol: "fixture",
  56842. fn: function (){
  56843. var self=this,$self=this;
  56844. return (5);
  56845. },
  56846. args: [],
  56847. source: "collectionSize\x0a\x09^ 5",
  56848. referencedClasses: [],
  56849. messageSends: []
  56850. }),
  56851. $globals.SetTest);
  56852. $core.addMethod(
  56853. $core.method({
  56854. selector: "collectionWithDuplicates",
  56855. protocol: "fixture",
  56856. fn: function (){
  56857. var self=this,$self=this;
  56858. return $core.withContext(function($ctx1) {
  56859. var $1;
  56860. $1=$self._collection();
  56861. $recv($1)._add_((0));
  56862. return $recv($1)._yourself();
  56863. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56864. },
  56865. args: [],
  56866. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56867. referencedClasses: [],
  56868. messageSends: ["add:", "collection", "yourself"]
  56869. }),
  56870. $globals.SetTest);
  56871. $core.addMethod(
  56872. $core.method({
  56873. selector: "collectionWithNewValue",
  56874. protocol: "fixture",
  56875. fn: function (){
  56876. var self=this,$self=this;
  56877. return $core.withContext(function($ctx1) {
  56878. var $1;
  56879. $1=$recv($globals.Set)._new();
  56880. $recv($1)._add_($globals.Smalltalk);
  56881. $ctx1.sendIdx["add:"]=1;
  56882. $recv($1)._add_(nil);
  56883. $ctx1.sendIdx["add:"]=2;
  56884. $recv($1)._add_((3).__at((3)));
  56885. $ctx1.sendIdx["add:"]=3;
  56886. $recv($1)._add_("N");
  56887. $ctx1.sendIdx["add:"]=4;
  56888. $recv($1)._add_(false);
  56889. $ctx1.sendIdx["add:"]=5;
  56890. $recv($1)._add_($self["@sampleBlock"]);
  56891. return $recv($1)._yourself();
  56892. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56893. },
  56894. args: [],
  56895. 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",
  56896. referencedClasses: ["Set", "Smalltalk"],
  56897. messageSends: ["add:", "new", "@", "yourself"]
  56898. }),
  56899. $globals.SetTest);
  56900. $core.addMethod(
  56901. $core.method({
  56902. selector: "testAddAll",
  56903. protocol: "tests",
  56904. fn: function (){
  56905. var self=this,$self=this;
  56906. return $core.withContext(function($ctx1) {
  56907. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56908. (
  56909. $ctx1.supercall = true,
  56910. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56911. $ctx1.supercall = false;
  56912. $2=$self._collection();
  56913. $ctx1.sendIdx["collection"]=1;
  56914. $3=$self._collection();
  56915. $ctx1.sendIdx["collection"]=2;
  56916. $recv($2)._addAll_($3);
  56917. $ctx1.sendIdx["addAll:"]=1;
  56918. $4=$recv($2)._yourself();
  56919. $ctx1.sendIdx["yourself"]=1;
  56920. $1=$4;
  56921. $5=$self._collection();
  56922. $ctx1.sendIdx["collection"]=3;
  56923. $self._assert_equals_($1,$5);
  56924. $ctx1.sendIdx["assert:equals:"]=1;
  56925. $7=$self._collection();
  56926. $ctx1.sendIdx["collection"]=4;
  56927. $8=$self._collectionWithNewValue();
  56928. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56929. $recv($7)._addAll_($8);
  56930. $ctx1.sendIdx["addAll:"]=2;
  56931. $9=$recv($7)._yourself();
  56932. $ctx1.sendIdx["yourself"]=2;
  56933. $6=$9;
  56934. $10=$self._collectionWithNewValue();
  56935. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56936. $self._assert_equals_($6,$10);
  56937. $ctx1.sendIdx["assert:equals:"]=2;
  56938. $12=$self._collectionWithNewValue();
  56939. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56940. $recv($12)._addAll_($self._collection());
  56941. $11=$recv($12)._yourself();
  56942. $self._assert_equals_($11,$self._collectionWithNewValue());
  56943. return self;
  56944. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56945. },
  56946. args: [],
  56947. 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",
  56948. referencedClasses: [],
  56949. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56950. }),
  56951. $globals.SetTest);
  56952. $core.addMethod(
  56953. $core.method({
  56954. selector: "testAddRemove",
  56955. protocol: "tests",
  56956. fn: function (){
  56957. var self=this,$self=this;
  56958. var set;
  56959. return $core.withContext(function($ctx1) {
  56960. var $1,$2;
  56961. set=$recv($globals.Set)._new();
  56962. $self._assert_($recv(set)._isEmpty());
  56963. $ctx1.sendIdx["assert:"]=1;
  56964. $recv(set)._add_((3));
  56965. $ctx1.sendIdx["add:"]=1;
  56966. $1=$recv(set)._includes_((3));
  56967. $ctx1.sendIdx["includes:"]=1;
  56968. $self._assert_($1);
  56969. $ctx1.sendIdx["assert:"]=2;
  56970. $recv(set)._add_((5));
  56971. $2=$recv(set)._includes_((5));
  56972. $ctx1.sendIdx["includes:"]=2;
  56973. $self._assert_($2);
  56974. $recv(set)._remove_((3));
  56975. $self._deny_($recv(set)._includes_((3)));
  56976. return self;
  56977. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56978. },
  56979. args: [],
  56980. 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)",
  56981. referencedClasses: ["Set"],
  56982. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56983. }),
  56984. $globals.SetTest);
  56985. $core.addMethod(
  56986. $core.method({
  56987. selector: "testAt",
  56988. protocol: "tests",
  56989. fn: function (){
  56990. var self=this,$self=this;
  56991. return $core.withContext(function($ctx1) {
  56992. $self._should_raise_((function(){
  56993. return $core.withContext(function($ctx2) {
  56994. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56996. }),$globals.Error);
  56997. return self;
  56998. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56999. },
  57000. args: [],
  57001. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  57002. referencedClasses: ["Set", "Error"],
  57003. messageSends: ["should:raise:", "at:put:", "new"]
  57004. }),
  57005. $globals.SetTest);
  57006. $core.addMethod(
  57007. $core.method({
  57008. selector: "testCollect",
  57009. protocol: "tests",
  57010. fn: function (){
  57011. var self=this,$self=this;
  57012. return $core.withContext(function($ctx1) {
  57013. var $2,$1;
  57014. (
  57015. $ctx1.supercall = true,
  57016. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  57017. $ctx1.supercall = false;
  57018. $2=[(5), (6), (8)]._asSet();
  57019. $ctx1.sendIdx["asSet"]=1;
  57020. $1=$recv($2)._collect_((function(x){
  57021. return $core.withContext(function($ctx2) {
  57022. return $recv(x).__backslash_backslash((3));
  57023. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57024. }));
  57025. $self._assert_equals_($1,[(0), (2)]._asSet());
  57026. return self;
  57027. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  57028. },
  57029. args: [],
  57030. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  57031. referencedClasses: [],
  57032. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  57033. }),
  57034. $globals.SetTest);
  57035. $core.addMethod(
  57036. $core.method({
  57037. selector: "testComma",
  57038. protocol: "tests",
  57039. fn: function (){
  57040. var self=this,$self=this;
  57041. return $core.withContext(function($ctx1) {
  57042. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  57043. (
  57044. $ctx1.supercall = true,
  57045. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  57046. $ctx1.supercall = false;
  57047. $2=$self._collection();
  57048. $ctx1.sendIdx["collection"]=1;
  57049. $3=$self._collection();
  57050. $ctx1.sendIdx["collection"]=2;
  57051. $1=$recv($2).__comma($3);
  57052. $ctx1.sendIdx[","]=1;
  57053. $4=$self._collection();
  57054. $ctx1.sendIdx["collection"]=3;
  57055. $self._assert_equals_($1,$4);
  57056. $ctx1.sendIdx["assert:equals:"]=1;
  57057. $6=$self._collection();
  57058. $ctx1.sendIdx["collection"]=4;
  57059. $7=$self._collectionWithNewValue();
  57060. $ctx1.sendIdx["collectionWithNewValue"]=1;
  57061. $5=$recv($6).__comma($7);
  57062. $ctx1.sendIdx[","]=2;
  57063. $8=$self._collectionWithNewValue();
  57064. $ctx1.sendIdx["collectionWithNewValue"]=2;
  57065. $self._assert_equals_($5,$8);
  57066. $ctx1.sendIdx["assert:equals:"]=2;
  57067. $10=$self._collectionWithNewValue();
  57068. $ctx1.sendIdx["collectionWithNewValue"]=3;
  57069. $9=$recv($10).__comma($self._collection());
  57070. $self._assert_equals_($9,$self._collectionWithNewValue());
  57071. return self;
  57072. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  57073. },
  57074. args: [],
  57075. 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",
  57076. referencedClasses: [],
  57077. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  57078. }),
  57079. $globals.SetTest);
  57080. $core.addMethod(
  57081. $core.method({
  57082. selector: "testComparing",
  57083. protocol: "tests",
  57084. fn: function (){
  57085. var self=this,$self=this;
  57086. return $core.withContext(function($ctx1) {
  57087. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  57088. $1=[(0), (2)]._asSet();
  57089. $ctx1.sendIdx["asSet"]=1;
  57090. $2=[(0), (2)]._asSet();
  57091. $ctx1.sendIdx["asSet"]=2;
  57092. $self._assert_equals_($1,$2);
  57093. $ctx1.sendIdx["assert:equals:"]=1;
  57094. $3=[(2), (0)]._asSet();
  57095. $ctx1.sendIdx["asSet"]=3;
  57096. $4=[(0), (2)]._asSet();
  57097. $ctx1.sendIdx["asSet"]=4;
  57098. $self._assert_equals_($3,$4);
  57099. $6=[(0), (2), (3)]._asSet();
  57100. $ctx1.sendIdx["asSet"]=5;
  57101. $7=[(0), (2)]._asSet();
  57102. $ctx1.sendIdx["asSet"]=6;
  57103. $5=$recv($6).__eq($7);
  57104. $ctx1.sendIdx["="]=1;
  57105. $self._deny_($5);
  57106. $ctx1.sendIdx["deny:"]=1;
  57107. $9=[(1), (2)]._asSet();
  57108. $ctx1.sendIdx["asSet"]=7;
  57109. $8=$recv($9).__eq([(0), (2)]._asSet());
  57110. $self._deny_($8);
  57111. return self;
  57112. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  57113. },
  57114. args: [],
  57115. 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",
  57116. referencedClasses: [],
  57117. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  57118. }),
  57119. $globals.SetTest);
  57120. $core.addMethod(
  57121. $core.method({
  57122. selector: "testPrintString",
  57123. protocol: "tests",
  57124. fn: function (){
  57125. var self=this,$self=this;
  57126. var set;
  57127. return $core.withContext(function($ctx1) {
  57128. var $1,$2,$3,$4,$5,$6,$7,$8;
  57129. set=$recv($globals.Set)._new();
  57130. $1=$recv(set)._printString();
  57131. $ctx1.sendIdx["printString"]=1;
  57132. $self._assert_equals_($1,"a Set ()");
  57133. $ctx1.sendIdx["assert:equals:"]=1;
  57134. $2=set;
  57135. $recv($2)._add_((1));
  57136. $ctx1.sendIdx["add:"]=1;
  57137. $3=$recv($2)._add_((3));
  57138. $ctx1.sendIdx["add:"]=2;
  57139. $4=$recv(set)._printString();
  57140. $ctx1.sendIdx["printString"]=2;
  57141. $self._assert_equals_($4,"a Set (1 3)");
  57142. $ctx1.sendIdx["assert:equals:"]=2;
  57143. $recv(set)._add_("foo");
  57144. $ctx1.sendIdx["add:"]=3;
  57145. $5=$recv(set)._printString();
  57146. $ctx1.sendIdx["printString"]=3;
  57147. $self._assert_equals_($5,"a Set (1 3 'foo')");
  57148. $ctx1.sendIdx["assert:equals:"]=3;
  57149. $6=set;
  57150. $recv($6)._remove_((1));
  57151. $ctx1.sendIdx["remove:"]=1;
  57152. $recv($6)._remove_((3));
  57153. $7=$recv(set)._printString();
  57154. $ctx1.sendIdx["printString"]=4;
  57155. $self._assert_equals_($7,"a Set ('foo')");
  57156. $ctx1.sendIdx["assert:equals:"]=4;
  57157. $recv(set)._add_((3));
  57158. $ctx1.sendIdx["add:"]=4;
  57159. $8=$recv(set)._printString();
  57160. $ctx1.sendIdx["printString"]=5;
  57161. $self._assert_equals_($8,"a Set (3 'foo')");
  57162. $ctx1.sendIdx["assert:equals:"]=5;
  57163. $recv(set)._add_((3));
  57164. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  57165. return self;
  57166. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  57167. },
  57168. args: [],
  57169. 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'')'",
  57170. referencedClasses: ["Set"],
  57171. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  57172. }),
  57173. $globals.SetTest);
  57174. $core.addMethod(
  57175. $core.method({
  57176. selector: "testUnboxedObjects",
  57177. protocol: "tests",
  57178. fn: function (){
  57179. var self=this,$self=this;
  57180. return $core.withContext(function($ctx1) {
  57181. var $4,$3,$2,$1;
  57182. $4="foo"._yourself();
  57183. $ctx1.sendIdx["yourself"]=1;
  57184. $3=[$4,"foo"._yourself()];
  57185. $2=$recv($3)._asSet();
  57186. $1=$recv($2)._asArray();
  57187. $self._assert_equals_($1,["foo"]);
  57188. return self;
  57189. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57190. },
  57191. args: [],
  57192. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57193. referencedClasses: [],
  57194. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57195. }),
  57196. $globals.SetTest);
  57197. $core.addMethod(
  57198. $core.method({
  57199. selector: "testUnicity",
  57200. protocol: "tests",
  57201. fn: function (){
  57202. var self=this,$self=this;
  57203. var set;
  57204. return $core.withContext(function($ctx1) {
  57205. var $1;
  57206. set=$recv($globals.Set)._new();
  57207. $recv(set)._add_((21));
  57208. $ctx1.sendIdx["add:"]=1;
  57209. $recv(set)._add_("hello");
  57210. $ctx1.sendIdx["add:"]=2;
  57211. $recv(set)._add_((21));
  57212. $ctx1.sendIdx["add:"]=3;
  57213. $1=$recv(set)._size();
  57214. $ctx1.sendIdx["size"]=1;
  57215. $self._assert_equals_($1,(2));
  57216. $ctx1.sendIdx["assert:equals:"]=1;
  57217. $recv(set)._add_("hello");
  57218. $self._assert_equals_($recv(set)._size(),(2));
  57219. $ctx1.sendIdx["assert:equals:"]=2;
  57220. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57221. return self;
  57222. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57223. },
  57224. args: [],
  57225. 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')",
  57226. referencedClasses: ["Set"],
  57227. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57228. }),
  57229. $globals.SetTest);
  57230. $core.addMethod(
  57231. $core.method({
  57232. selector: "collectionClass",
  57233. protocol: "fixture",
  57234. fn: function (){
  57235. var self=this,$self=this;
  57236. return $globals.Set;
  57237. },
  57238. args: [],
  57239. source: "collectionClass\x0a\x09^ Set",
  57240. referencedClasses: ["Set"],
  57241. messageSends: []
  57242. }),
  57243. $globals.SetTest.a$cls);
  57244. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57245. $core.addMethod(
  57246. $core.method({
  57247. selector: "testShow",
  57248. protocol: "tests",
  57249. fn: function (){
  57250. var self=this,$self=this;
  57251. var originalTranscript;
  57252. return $core.withContext(function($ctx1) {
  57253. originalTranscript=$recv($globals.Transcript)._current();
  57254. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57255. $ctx1.sendIdx["register:"]=1;
  57256. $self._shouldnt_raise_((function(){
  57257. return $core.withContext(function($ctx2) {
  57258. return $recv($globals.Transcript)._show_("Hello console!");
  57259. $ctx2.sendIdx["show:"]=1;
  57260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57261. }),$globals.Error);
  57262. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57263. $self._shouldnt_raise_((function(){
  57264. return $core.withContext(function($ctx2) {
  57265. return $recv($globals.Transcript)._show_(console);
  57266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57267. }),$globals.Error);
  57268. $recv($globals.Transcript)._register_(originalTranscript);
  57269. return self;
  57270. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57271. },
  57272. args: [],
  57273. 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.",
  57274. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57275. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57276. }),
  57277. $globals.ConsoleTranscriptTest);
  57278. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57279. $core.addMethod(
  57280. $core.method({
  57281. selector: "testEquality",
  57282. protocol: "tests",
  57283. fn: function (){
  57284. var self=this,$self=this;
  57285. var now;
  57286. return $core.withContext(function($ctx1) {
  57287. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57288. now=$recv($globals.Date)._new();
  57289. $1=$recv(now).__eq(now);
  57290. $ctx1.sendIdx["="]=1;
  57291. $self._assert_($1);
  57292. $ctx1.sendIdx["assert:"]=1;
  57293. $3=now;
  57294. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57295. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57296. $2=$recv($3).__eq($4);
  57297. $ctx1.sendIdx["="]=2;
  57298. $self._deny_($2);
  57299. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57300. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57301. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57302. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57303. $5=$recv($6).__eq($7);
  57304. $ctx1.sendIdx["="]=3;
  57305. $self._assert_($5);
  57306. $ctx1.sendIdx["assert:"]=2;
  57307. $9=now;
  57308. $11=$recv(now)._asMilliseconds();
  57309. $ctx1.sendIdx["asMilliseconds"]=1;
  57310. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57311. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57312. $8=$recv($9).__eq($10);
  57313. $ctx1.sendIdx["="]=4;
  57314. $self._assert_($8);
  57315. $ctx1.sendIdx["assert:"]=3;
  57316. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57317. return self;
  57318. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57319. },
  57320. args: [],
  57321. 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",
  57322. referencedClasses: ["Date"],
  57323. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57324. }),
  57325. $globals.DateTest);
  57326. $core.addMethod(
  57327. $core.method({
  57328. selector: "testIdentity",
  57329. protocol: "tests",
  57330. fn: function (){
  57331. var self=this,$self=this;
  57332. var now;
  57333. return $core.withContext(function($ctx1) {
  57334. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57335. now=$recv($globals.Date)._new();
  57336. $1=$recv(now).__eq_eq(now);
  57337. $ctx1.sendIdx["=="]=1;
  57338. $self._assert_($1);
  57339. $3=now;
  57340. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57341. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57342. $2=$recv($3).__eq_eq($4);
  57343. $ctx1.sendIdx["=="]=2;
  57344. $self._deny_($2);
  57345. $ctx1.sendIdx["deny:"]=1;
  57346. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57347. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57348. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57349. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57350. $5=$recv($6).__eq_eq($7);
  57351. $ctx1.sendIdx["=="]=3;
  57352. $self._deny_($5);
  57353. $ctx1.sendIdx["deny:"]=2;
  57354. $9=now;
  57355. $11=$recv(now)._asMilliseconds();
  57356. $ctx1.sendIdx["asMilliseconds"]=1;
  57357. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57358. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57359. $8=$recv($9).__eq_eq($10);
  57360. $ctx1.sendIdx["=="]=4;
  57361. $self._deny_($8);
  57362. $ctx1.sendIdx["deny:"]=3;
  57363. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57364. return self;
  57365. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57366. },
  57367. args: [],
  57368. 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",
  57369. referencedClasses: ["Date"],
  57370. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57371. }),
  57372. $globals.DateTest);
  57373. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57374. $core.addMethod(
  57375. $core.method({
  57376. selector: "jsObject",
  57377. protocol: "accessing",
  57378. fn: function (){
  57379. var self=this,$self=this;
  57380. return $core.withContext(function($ctx1) {
  57381. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57382. return self;
  57383. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57384. },
  57385. args: [],
  57386. 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}'>",
  57387. referencedClasses: [],
  57388. messageSends: []
  57389. }),
  57390. $globals.JSObjectProxyTest);
  57391. $core.addMethod(
  57392. $core.method({
  57393. selector: "jsUndefined",
  57394. protocol: "accessing",
  57395. fn: function (){
  57396. var self=this,$self=this;
  57397. return $core.withContext(function($ctx1) {
  57398. return;
  57399. return self;
  57400. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57401. },
  57402. args: [],
  57403. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57404. referencedClasses: [],
  57405. messageSends: []
  57406. }),
  57407. $globals.JSObjectProxyTest);
  57408. $core.addMethod(
  57409. $core.method({
  57410. selector: "testAtIfAbsent",
  57411. protocol: "tests",
  57412. fn: function (){
  57413. var self=this,$self=this;
  57414. var testObject;
  57415. return $core.withContext(function($ctx1) {
  57416. var $1,$2,$3;
  57417. testObject=$self._jsObject();
  57418. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57419. return "Property does not exist";
  57420. }));
  57421. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57422. $self._assert_equals_($1,"Property does not exist");
  57423. $ctx1.sendIdx["assert:equals:"]=1;
  57424. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57425. return "Property does not exist";
  57426. }));
  57427. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57428. $self._assert_equals_($2,nil);
  57429. $ctx1.sendIdx["assert:equals:"]=2;
  57430. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57431. return "Property does not exist";
  57432. }));
  57433. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57434. $self._assert_equals_($3,(1));
  57435. $ctx1.sendIdx["assert:equals:"]=3;
  57436. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57437. return "Property does not exist";
  57438. })),nil);
  57439. return self;
  57440. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57441. },
  57442. args: [],
  57443. 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.",
  57444. referencedClasses: [],
  57445. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57446. }),
  57447. $globals.JSObjectProxyTest);
  57448. $core.addMethod(
  57449. $core.method({
  57450. selector: "testAtIfPresent",
  57451. protocol: "tests",
  57452. fn: function (){
  57453. var self=this,$self=this;
  57454. var testObject;
  57455. return $core.withContext(function($ctx1) {
  57456. var $2,$1,$4,$3,$6,$5;
  57457. testObject=$self._jsObject();
  57458. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57459. return $core.withContext(function($ctx2) {
  57460. $2=$recv(x)._asString();
  57461. $ctx2.sendIdx["asString"]=1;
  57462. return "hello ".__comma($2);
  57463. $ctx2.sendIdx[","]=1;
  57464. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57465. }));
  57466. $ctx1.sendIdx["at:ifPresent:"]=1;
  57467. $self._assert_equals_($1,nil);
  57468. $ctx1.sendIdx["assert:equals:"]=1;
  57469. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57470. return $core.withContext(function($ctx2) {
  57471. $4=$recv(x)._asString();
  57472. $ctx2.sendIdx["asString"]=2;
  57473. return "hello ".__comma($4);
  57474. $ctx2.sendIdx[","]=2;
  57475. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57476. }));
  57477. $ctx1.sendIdx["at:ifPresent:"]=2;
  57478. $self._assert_equals_($3,"hello nil");
  57479. $ctx1.sendIdx["assert:equals:"]=2;
  57480. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57481. return $core.withContext(function($ctx2) {
  57482. $6=$recv(x)._asString();
  57483. $ctx2.sendIdx["asString"]=3;
  57484. return "hello ".__comma($6);
  57485. $ctx2.sendIdx[","]=3;
  57486. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57487. }));
  57488. $ctx1.sendIdx["at:ifPresent:"]=3;
  57489. $self._assert_equals_($5,"hello 1");
  57490. $ctx1.sendIdx["assert:equals:"]=3;
  57491. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57492. return $core.withContext(function($ctx2) {
  57493. return "hello ".__comma($recv(x)._asString());
  57494. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57495. })),"hello nil");
  57496. return self;
  57497. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57498. },
  57499. args: [],
  57500. 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'.",
  57501. referencedClasses: [],
  57502. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57503. }),
  57504. $globals.JSObjectProxyTest);
  57505. $core.addMethod(
  57506. $core.method({
  57507. selector: "testAtIfPresentIfAbsent",
  57508. protocol: "tests",
  57509. fn: function (){
  57510. var self=this,$self=this;
  57511. var testObject;
  57512. return $core.withContext(function($ctx1) {
  57513. var $2,$1,$4,$3,$6,$5;
  57514. testObject=$self._jsObject();
  57515. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57516. return $core.withContext(function($ctx2) {
  57517. $2=$recv(x)._asString();
  57518. $ctx2.sendIdx["asString"]=1;
  57519. return "hello ".__comma($2);
  57520. $ctx2.sendIdx[","]=1;
  57521. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57522. }),(function(){
  57523. return "not present";
  57524. }));
  57525. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57526. $self._assert_equals_($1,"not present");
  57527. $ctx1.sendIdx["assert:equals:"]=1;
  57528. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57529. return $core.withContext(function($ctx2) {
  57530. $4=$recv(x)._asString();
  57531. $ctx2.sendIdx["asString"]=2;
  57532. return "hello ".__comma($4);
  57533. $ctx2.sendIdx[","]=2;
  57534. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57535. }),(function(){
  57536. return "not present";
  57537. }));
  57538. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57539. $self._assert_equals_($3,"hello nil");
  57540. $ctx1.sendIdx["assert:equals:"]=2;
  57541. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57542. return $core.withContext(function($ctx2) {
  57543. $6=$recv(x)._asString();
  57544. $ctx2.sendIdx["asString"]=3;
  57545. return "hello ".__comma($6);
  57546. $ctx2.sendIdx[","]=3;
  57547. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57548. }),(function(){
  57549. return "not present";
  57550. }));
  57551. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57552. $self._assert_equals_($5,"hello 1");
  57553. $ctx1.sendIdx["assert:equals:"]=3;
  57554. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57555. return $core.withContext(function($ctx2) {
  57556. return "hello ".__comma($recv(x)._asString());
  57557. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57558. }),(function(){
  57559. return "not present";
  57560. })),"hello nil");
  57561. return self;
  57562. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57563. },
  57564. args: [],
  57565. 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'.",
  57566. referencedClasses: [],
  57567. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57568. }),
  57569. $globals.JSObjectProxyTest);
  57570. $core.addMethod(
  57571. $core.method({
  57572. selector: "testAtPut",
  57573. protocol: "tests",
  57574. fn: function (){
  57575. var self=this,$self=this;
  57576. var testObject;
  57577. return $core.withContext(function($ctx1) {
  57578. var $2,$1;
  57579. testObject=$self._jsObject();
  57580. $2=$recv(testObject)._at_("abc");
  57581. $ctx1.sendIdx["at:"]=1;
  57582. $1=$recv($2).__tild_eq("xyz");
  57583. $self._assert_($1);
  57584. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57585. $ctx1.sendIdx["assert:equals:"]=1;
  57586. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57587. return self;
  57588. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57589. },
  57590. args: [],
  57591. 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'",
  57592. referencedClasses: [],
  57593. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57594. }),
  57595. $globals.JSObjectProxyTest);
  57596. $core.addMethod(
  57597. $core.method({
  57598. selector: "testComparison",
  57599. protocol: "tests",
  57600. fn: function (){
  57601. var self=this,$self=this;
  57602. return $core.withContext(function($ctx1) {
  57603. var $1,$2;
  57604. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57605. $1=$recv(console).__eq(console);
  57606. $ctx1.sendIdx["="]=1;
  57607. $self._assert_($1);
  57608. $2=$recv(console).__eq($recv($globals.Object)._new());
  57609. $ctx1.sendIdx["="]=2;
  57610. $self._deny_($2);
  57611. $ctx1.sendIdx["deny:"]=1;
  57612. $self._deny_($recv(console).__eq($self._jsObject()));
  57613. return self;
  57614. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57615. },
  57616. args: [],
  57617. 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",
  57618. referencedClasses: ["Object"],
  57619. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57620. }),
  57621. $globals.JSObjectProxyTest);
  57622. $core.addMethod(
  57623. $core.method({
  57624. selector: "testDNU",
  57625. protocol: "tests",
  57626. fn: function (){
  57627. var self=this,$self=this;
  57628. return $core.withContext(function($ctx1) {
  57629. $self._should_raise_((function(){
  57630. return $core.withContext(function($ctx2) {
  57631. return $recv($self._jsObject())._foo();
  57632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57633. }),$globals.MessageNotUnderstood);
  57634. return self;
  57635. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57636. },
  57637. args: [],
  57638. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57639. referencedClasses: ["MessageNotUnderstood"],
  57640. messageSends: ["should:raise:", "foo", "jsObject"]
  57641. }),
  57642. $globals.JSObjectProxyTest);
  57643. $core.addMethod(
  57644. $core.method({
  57645. selector: "testDNUWithAllowJavaScriptCalls",
  57646. protocol: "tests",
  57647. fn: function (){
  57648. var self=this,$self=this;
  57649. var jsObject;
  57650. return $core.withContext(function($ctx1) {
  57651. jsObject=[];
  57652. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57653. $self._should_raise_((function(){
  57654. return $core.withContext(function($ctx2) {
  57655. return $recv(jsObject)._foo();
  57656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57657. }),$globals.MessageNotUnderstood);
  57658. return self;
  57659. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57660. },
  57661. args: [],
  57662. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57663. referencedClasses: ["MessageNotUnderstood"],
  57664. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57665. }),
  57666. $globals.JSObjectProxyTest);
  57667. $core.addMethod(
  57668. $core.method({
  57669. selector: "testMessageSend",
  57670. protocol: "tests",
  57671. fn: function (){
  57672. var self=this,$self=this;
  57673. return $core.withContext(function($ctx1) {
  57674. var $2,$1,$4,$3;
  57675. $2=$self._jsObject();
  57676. $ctx1.sendIdx["jsObject"]=1;
  57677. $1=$recv($2)._a();
  57678. $self._assert_equals_($1,(1));
  57679. $ctx1.sendIdx["assert:equals:"]=1;
  57680. $4=$self._jsObject();
  57681. $ctx1.sendIdx["jsObject"]=2;
  57682. $3=$recv($4)._b();
  57683. $self._assert_equals_($3,(2));
  57684. $ctx1.sendIdx["assert:equals:"]=2;
  57685. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57686. return self;
  57687. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57688. },
  57689. args: [],
  57690. 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",
  57691. referencedClasses: [],
  57692. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57693. }),
  57694. $globals.JSObjectProxyTest);
  57695. $core.addMethod(
  57696. $core.method({
  57697. selector: "testMethodWithArguments",
  57698. protocol: "tests",
  57699. fn: function (){
  57700. var self=this,$self=this;
  57701. return $core.withContext(function($ctx1) {
  57702. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57703. return self;
  57704. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57705. },
  57706. args: [],
  57707. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57708. referencedClasses: [],
  57709. messageSends: ["assert:equals:", "c:", "jsObject"]
  57710. }),
  57711. $globals.JSObjectProxyTest);
  57712. $core.addMethod(
  57713. $core.method({
  57714. selector: "testNull",
  57715. protocol: "tests",
  57716. fn: function (){
  57717. var self=this,$self=this;
  57718. return $core.withContext(function($ctx1) {
  57719. var $2,$1;
  57720. $2=$recv($globals.JSObjectProxy)._null();
  57721. $ctx1.sendIdx["null"]=1;
  57722. $1=$recv($2)._isNil();
  57723. $self._assert_($1);
  57724. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57725. return self;
  57726. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57727. },
  57728. args: [],
  57729. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57730. referencedClasses: ["JSObjectProxy", "JSON"],
  57731. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57732. }),
  57733. $globals.JSObjectProxyTest);
  57734. $core.addMethod(
  57735. $core.method({
  57736. selector: "testPrinting",
  57737. protocol: "tests",
  57738. fn: function (){
  57739. var self=this,$self=this;
  57740. return $core.withContext(function($ctx1) {
  57741. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57742. return self;
  57743. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57744. },
  57745. args: [],
  57746. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57747. referencedClasses: [],
  57748. messageSends: ["assert:equals:", "printString", "jsObject"]
  57749. }),
  57750. $globals.JSObjectProxyTest);
  57751. $core.addMethod(
  57752. $core.method({
  57753. selector: "testPropertyThatReturnsEmptyString",
  57754. protocol: "tests",
  57755. fn: function (){
  57756. var self=this,$self=this;
  57757. var object;
  57758. return $core.withContext(function($ctx1) {
  57759. var $1;
  57760. object=$self._jsObject();
  57761. $1=$recv(object)._d();
  57762. $ctx1.sendIdx["d"]=1;
  57763. $self._assert_equals_($1,"");
  57764. $ctx1.sendIdx["assert:equals:"]=1;
  57765. $recv(object)._d_("hello");
  57766. $self._assert_equals_($recv(object)._d(),"hello");
  57767. return self;
  57768. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57769. },
  57770. args: [],
  57771. 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'",
  57772. referencedClasses: [],
  57773. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57774. }),
  57775. $globals.JSObjectProxyTest);
  57776. $core.addMethod(
  57777. $core.method({
  57778. selector: "testPropertyThatReturnsUndefined",
  57779. protocol: "tests",
  57780. fn: function (){
  57781. var self=this,$self=this;
  57782. var object;
  57783. return $core.withContext(function($ctx1) {
  57784. object=$self._jsObject();
  57785. $self._shouldnt_raise_((function(){
  57786. return $core.withContext(function($ctx2) {
  57787. return $recv(object)._e();
  57788. $ctx2.sendIdx["e"]=1;
  57789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57790. }),$globals.MessageNotUnderstood);
  57791. $self._assert_($recv($recv(object)._e())._isNil());
  57792. return self;
  57793. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57794. },
  57795. args: [],
  57796. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57797. referencedClasses: ["MessageNotUnderstood"],
  57798. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57799. }),
  57800. $globals.JSObjectProxyTest);
  57801. $core.addMethod(
  57802. $core.method({
  57803. selector: "testSetPropertyWithFalsyValue",
  57804. protocol: "tests",
  57805. fn: function (){
  57806. var self=this,$self=this;
  57807. var jsObject;
  57808. return $core.withContext(function($ctx1) {
  57809. var $1,$2,$3,$4,$5;
  57810. jsObject=$self._jsObject();
  57811. $1=$recv(jsObject)._a();
  57812. $ctx1.sendIdx["a"]=1;
  57813. $self._assert_equals_($1,(1));
  57814. $ctx1.sendIdx["assert:equals:"]=1;
  57815. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57816. $ctx1.sendIdx["a:"]=1;
  57817. $2=$recv(jsObject)._a();
  57818. $ctx1.sendIdx["a"]=2;
  57819. $self._assert_equals_($2,nil);
  57820. $ctx1.sendIdx["assert:equals:"]=2;
  57821. $recv(jsObject)._a_((0));
  57822. $ctx1.sendIdx["a:"]=2;
  57823. $3=$recv(jsObject)._a();
  57824. $ctx1.sendIdx["a"]=3;
  57825. $self._assert_equals_($3,(0));
  57826. $ctx1.sendIdx["assert:equals:"]=3;
  57827. $recv(jsObject)._a_($self._jsUndefined());
  57828. $ctx1.sendIdx["a:"]=3;
  57829. $4=$recv(jsObject)._a();
  57830. $ctx1.sendIdx["a"]=4;
  57831. $self._assert_equals_($4,nil);
  57832. $ctx1.sendIdx["assert:equals:"]=4;
  57833. $recv(jsObject)._a_("");
  57834. $ctx1.sendIdx["a:"]=4;
  57835. $5=$recv(jsObject)._a();
  57836. $ctx1.sendIdx["a"]=5;
  57837. $self._assert_equals_($5,"");
  57838. $ctx1.sendIdx["assert:equals:"]=5;
  57839. $recv(jsObject)._a_(false);
  57840. $self._assert_equals_($recv(jsObject)._a(),false);
  57841. return self;
  57842. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57843. },
  57844. args: [],
  57845. 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",
  57846. referencedClasses: ["JSObjectProxy"],
  57847. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57848. }),
  57849. $globals.JSObjectProxyTest);
  57850. $core.addMethod(
  57851. $core.method({
  57852. selector: "testUndefined",
  57853. protocol: "tests",
  57854. fn: function (){
  57855. var self=this,$self=this;
  57856. return $core.withContext(function($ctx1) {
  57857. var $2,$1;
  57858. $2=$recv($globals.JSObjectProxy)._undefined();
  57859. $ctx1.sendIdx["undefined"]=1;
  57860. $1=$recv($2)._isNil();
  57861. $self._assert_($1);
  57862. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57863. return self;
  57864. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57865. },
  57866. args: [],
  57867. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57868. referencedClasses: ["JSObjectProxy", "JSON"],
  57869. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57870. }),
  57871. $globals.JSObjectProxyTest);
  57872. $core.addMethod(
  57873. $core.method({
  57874. selector: "testValue",
  57875. protocol: "tests",
  57876. fn: function (){
  57877. var self=this,$self=this;
  57878. var testObject;
  57879. return $core.withContext(function($ctx1) {
  57880. testObject=$self._jsObject();
  57881. $recv(testObject)._at_put_("value","aValue");
  57882. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57883. return self;
  57884. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57885. },
  57886. args: [],
  57887. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57888. referencedClasses: [],
  57889. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57890. }),
  57891. $globals.JSObjectProxyTest);
  57892. $core.addMethod(
  57893. $core.method({
  57894. selector: "testYourself",
  57895. protocol: "tests",
  57896. fn: function (){
  57897. var self=this,$self=this;
  57898. var object;
  57899. return $core.withContext(function($ctx1) {
  57900. var $1;
  57901. $1=$self._jsObject();
  57902. $recv($1)._d_("test");
  57903. object=$recv($1)._yourself();
  57904. $self._assert_equals_($recv(object)._d(),"test");
  57905. return self;
  57906. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57907. },
  57908. args: [],
  57909. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57910. referencedClasses: [],
  57911. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57912. }),
  57913. $globals.JSObjectProxyTest);
  57914. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57915. $core.addMethod(
  57916. $core.method({
  57917. selector: "testCatchingException",
  57918. protocol: "tests",
  57919. fn: function (){
  57920. var self=this,$self=this;
  57921. return $core.withContext(function($ctx1) {
  57922. $recv((function(){
  57923. return $core.withContext(function($ctx2) {
  57924. return $self._throwException();
  57925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57926. }))._on_do_($globals.Error,(function(error){
  57927. return $core.withContext(function($ctx2) {
  57928. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57929. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57930. }));
  57931. return self;
  57932. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57933. },
  57934. args: [],
  57935. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57936. referencedClasses: ["Error"],
  57937. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57938. }),
  57939. $globals.JavaScriptExceptionTest);
  57940. $core.addMethod(
  57941. $core.method({
  57942. selector: "testRaisingException",
  57943. protocol: "tests",
  57944. fn: function (){
  57945. var self=this,$self=this;
  57946. return $core.withContext(function($ctx1) {
  57947. $self._should_raise_((function(){
  57948. return $core.withContext(function($ctx2) {
  57949. return $self._throwException();
  57950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57951. }),$globals.JavaScriptException);
  57952. return self;
  57953. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57954. },
  57955. args: [],
  57956. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57957. referencedClasses: ["JavaScriptException"],
  57958. messageSends: ["should:raise:", "throwException"]
  57959. }),
  57960. $globals.JavaScriptExceptionTest);
  57961. $core.addMethod(
  57962. $core.method({
  57963. selector: "throwException",
  57964. protocol: "helpers",
  57965. fn: function (){
  57966. var self=this,$self=this;
  57967. return $core.withContext(function($ctx1) {
  57968. throw "test";
  57969. return self;
  57970. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57971. },
  57972. args: [],
  57973. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57974. referencedClasses: [],
  57975. messageSends: []
  57976. }),
  57977. $globals.JavaScriptExceptionTest);
  57978. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57979. $core.addMethod(
  57980. $core.method({
  57981. selector: "testValue",
  57982. protocol: "tests",
  57983. fn: function (){
  57984. var self=this,$self=this;
  57985. var messageSend;
  57986. return $core.withContext(function($ctx1) {
  57987. var $1;
  57988. $1=$recv($globals.MessageSend)._new();
  57989. $ctx1.sendIdx["new"]=1;
  57990. $recv($1)._receiver_($recv($globals.Object)._new());
  57991. $recv($1)._selector_("asString");
  57992. messageSend=$recv($1)._yourself();
  57993. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57994. return self;
  57995. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57996. },
  57997. args: [],
  57998. 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'",
  57999. referencedClasses: ["MessageSend", "Object"],
  58000. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  58001. }),
  58002. $globals.MessageSendTest);
  58003. $core.addMethod(
  58004. $core.method({
  58005. selector: "testValueWithArguments",
  58006. protocol: "tests",
  58007. fn: function (){
  58008. var self=this,$self=this;
  58009. var messageSend;
  58010. return $core.withContext(function($ctx1) {
  58011. var $1;
  58012. $1=$recv($globals.MessageSend)._new();
  58013. $recv($1)._receiver_((2));
  58014. $recv($1)._selector_("+");
  58015. messageSend=$recv($1)._yourself();
  58016. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  58017. $ctx1.sendIdx["assert:equals:"]=1;
  58018. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  58019. return self;
  58020. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  58021. },
  58022. args: [],
  58023. 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",
  58024. referencedClasses: ["MessageSend"],
  58025. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  58026. }),
  58027. $globals.MessageSendTest);
  58028. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  58029. $core.addMethod(
  58030. $core.method({
  58031. selector: "codeGeneratorClass",
  58032. protocol: "accessing",
  58033. fn: function (){
  58034. var self=this,$self=this;
  58035. return $globals.CodeGenerator;
  58036. },
  58037. args: [],
  58038. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  58039. referencedClasses: ["CodeGenerator"],
  58040. messageSends: []
  58041. }),
  58042. $globals.MethodInheritanceTest);
  58043. $core.addMethod(
  58044. $core.method({
  58045. selector: "compiler",
  58046. protocol: "factory",
  58047. fn: function (){
  58048. var self=this,$self=this;
  58049. return $core.withContext(function($ctx1) {
  58050. var $1;
  58051. $1=$recv($globals.Compiler)._new();
  58052. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  58053. return $recv($1)._yourself();
  58054. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  58055. },
  58056. args: [],
  58057. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  58058. referencedClasses: ["Compiler"],
  58059. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  58060. }),
  58061. $globals.MethodInheritanceTest);
  58062. $core.addMethod(
  58063. $core.method({
  58064. selector: "deinstallBottom",
  58065. protocol: "testing",
  58066. fn: function (){
  58067. var self=this,$self=this;
  58068. return $core.withContext(function($ctx1) {
  58069. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  58070. return self;
  58071. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  58072. },
  58073. args: [],
  58074. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  58075. referencedClasses: [],
  58076. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  58077. }),
  58078. $globals.MethodInheritanceTest);
  58079. $core.addMethod(
  58080. $core.method({
  58081. selector: "deinstallMiddle",
  58082. protocol: "testing",
  58083. fn: function (){
  58084. var self=this,$self=this;
  58085. return $core.withContext(function($ctx1) {
  58086. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  58087. return self;
  58088. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  58089. },
  58090. args: [],
  58091. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  58092. referencedClasses: [],
  58093. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  58094. }),
  58095. $globals.MethodInheritanceTest);
  58096. $core.addMethod(
  58097. $core.method({
  58098. selector: "deinstallTop",
  58099. protocol: "testing",
  58100. fn: function (){
  58101. var self=this,$self=this;
  58102. return $core.withContext(function($ctx1) {
  58103. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  58104. return self;
  58105. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  58106. },
  58107. args: [],
  58108. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  58109. referencedClasses: [],
  58110. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58111. }),
  58112. $globals.MethodInheritanceTest);
  58113. $core.addMethod(
  58114. $core.method({
  58115. selector: "installBottom:",
  58116. protocol: "testing",
  58117. fn: function (aString){
  58118. var self=this,$self=this;
  58119. return $core.withContext(function($ctx1) {
  58120. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58121. return self;
  58122. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58123. },
  58124. args: ["aString"],
  58125. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58126. referencedClasses: [],
  58127. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58128. }),
  58129. $globals.MethodInheritanceTest);
  58130. $core.addMethod(
  58131. $core.method({
  58132. selector: "installMiddle:",
  58133. protocol: "testing",
  58134. fn: function (aString){
  58135. var self=this,$self=this;
  58136. return $core.withContext(function($ctx1) {
  58137. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58138. return self;
  58139. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58140. },
  58141. args: ["aString"],
  58142. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58143. referencedClasses: [],
  58144. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58145. }),
  58146. $globals.MethodInheritanceTest);
  58147. $core.addMethod(
  58148. $core.method({
  58149. selector: "installTop:",
  58150. protocol: "testing",
  58151. fn: function (aString){
  58152. var self=this,$self=this;
  58153. return $core.withContext(function($ctx1) {
  58154. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58155. return self;
  58156. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58157. },
  58158. args: ["aString"],
  58159. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58160. referencedClasses: [],
  58161. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58162. }),
  58163. $globals.MethodInheritanceTest);
  58164. $core.addMethod(
  58165. $core.method({
  58166. selector: "setUp",
  58167. protocol: "initialization",
  58168. fn: function (){
  58169. var self=this,$self=this;
  58170. return $core.withContext(function($ctx1) {
  58171. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  58172. $ctx1.sendIdx["new"]=1;
  58173. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  58174. $ctx1.sendIdx["new"]=2;
  58175. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  58176. $self["@method"]=nil;
  58177. $self["@performBlock"]=(function(){
  58178. return $core.withContext(function($ctx2) {
  58179. return $self._error_("performBlock not initialized");
  58180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58181. });
  58182. return self;
  58183. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58184. },
  58185. args: [],
  58186. 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' ]",
  58187. referencedClasses: [],
  58188. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58189. }),
  58190. $globals.MethodInheritanceTest);
  58191. $core.addMethod(
  58192. $core.method({
  58193. selector: "shouldMNU",
  58194. protocol: "testing",
  58195. fn: function (){
  58196. var self=this,$self=this;
  58197. return $core.withContext(function($ctx1) {
  58198. $self._shouldMNUTop();
  58199. $self._shouldMNUMiddle();
  58200. $self._shouldMNUBottom();
  58201. return self;
  58202. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58203. },
  58204. args: [],
  58205. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58206. referencedClasses: [],
  58207. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58208. }),
  58209. $globals.MethodInheritanceTest);
  58210. $core.addMethod(
  58211. $core.method({
  58212. selector: "shouldMNUBottom",
  58213. protocol: "testing",
  58214. fn: function (){
  58215. var self=this,$self=this;
  58216. return $core.withContext(function($ctx1) {
  58217. $self._should_raise_((function(){
  58218. return $core.withContext(function($ctx2) {
  58219. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58221. }),$globals.MessageNotUnderstood);
  58222. return self;
  58223. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58224. },
  58225. args: [],
  58226. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58227. referencedClasses: ["MessageNotUnderstood"],
  58228. messageSends: ["should:raise:", "value:"]
  58229. }),
  58230. $globals.MethodInheritanceTest);
  58231. $core.addMethod(
  58232. $core.method({
  58233. selector: "shouldMNUMiddle",
  58234. protocol: "testing",
  58235. fn: function (){
  58236. var self=this,$self=this;
  58237. return $core.withContext(function($ctx1) {
  58238. $self._should_raise_((function(){
  58239. return $core.withContext(function($ctx2) {
  58240. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58242. }),$globals.MessageNotUnderstood);
  58243. return self;
  58244. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58245. },
  58246. args: [],
  58247. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58248. referencedClasses: ["MessageNotUnderstood"],
  58249. messageSends: ["should:raise:", "value:"]
  58250. }),
  58251. $globals.MethodInheritanceTest);
  58252. $core.addMethod(
  58253. $core.method({
  58254. selector: "shouldMNUTop",
  58255. protocol: "testing",
  58256. fn: function (){
  58257. var self=this,$self=this;
  58258. return $core.withContext(function($ctx1) {
  58259. $self._should_raise_((function(){
  58260. return $core.withContext(function($ctx2) {
  58261. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58263. }),$globals.MessageNotUnderstood);
  58264. return self;
  58265. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58266. },
  58267. args: [],
  58268. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58269. referencedClasses: ["MessageNotUnderstood"],
  58270. messageSends: ["should:raise:", "value:"]
  58271. }),
  58272. $globals.MethodInheritanceTest);
  58273. $core.addMethod(
  58274. $core.method({
  58275. selector: "shouldReturn:",
  58276. protocol: "testing",
  58277. fn: function (anObject){
  58278. var self=this,$self=this;
  58279. var result;
  58280. return $core.withContext(function($ctx1) {
  58281. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58282. $ctx1.sendIdx["value:"]=1;
  58283. $self._assert_equals_(["top",anObject],["top",result]);
  58284. $ctx1.sendIdx["assert:equals:"]=1;
  58285. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58286. $ctx1.sendIdx["value:"]=2;
  58287. $self._assert_equals_(["middle",anObject],["middle",result]);
  58288. $ctx1.sendIdx["assert:equals:"]=2;
  58289. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58290. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58291. return self;
  58292. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58293. },
  58294. args: ["anObject"],
  58295. 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 }",
  58296. referencedClasses: [],
  58297. messageSends: ["value:", "assert:equals:"]
  58298. }),
  58299. $globals.MethodInheritanceTest);
  58300. $core.addMethod(
  58301. $core.method({
  58302. selector: "shouldReturn:and:and:",
  58303. protocol: "testing",
  58304. fn: function (anObject,anObject2,anObject3){
  58305. var self=this,$self=this;
  58306. var result;
  58307. return $core.withContext(function($ctx1) {
  58308. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58309. $ctx1.sendIdx["value:"]=1;
  58310. $self._assert_equals_(["top",anObject],["top",result]);
  58311. $ctx1.sendIdx["assert:equals:"]=1;
  58312. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58313. $ctx1.sendIdx["value:"]=2;
  58314. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58315. $ctx1.sendIdx["assert:equals:"]=2;
  58316. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58317. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58318. return self;
  58319. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58320. },
  58321. args: ["anObject", "anObject2", "anObject3"],
  58322. 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 }",
  58323. referencedClasses: [],
  58324. messageSends: ["value:", "assert:equals:"]
  58325. }),
  58326. $globals.MethodInheritanceTest);
  58327. $core.addMethod(
  58328. $core.method({
  58329. selector: "targetClassBottom",
  58330. protocol: "accessing",
  58331. fn: function (){
  58332. var self=this,$self=this;
  58333. return $globals.JavaScriptException;
  58334. },
  58335. args: [],
  58336. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58337. referencedClasses: ["JavaScriptException"],
  58338. messageSends: []
  58339. }),
  58340. $globals.MethodInheritanceTest);
  58341. $core.addMethod(
  58342. $core.method({
  58343. selector: "targetClassMiddle",
  58344. protocol: "accessing",
  58345. fn: function (){
  58346. var self=this,$self=this;
  58347. return $globals.Error;
  58348. },
  58349. args: [],
  58350. source: "targetClassMiddle\x0a\x09^ Error",
  58351. referencedClasses: ["Error"],
  58352. messageSends: []
  58353. }),
  58354. $globals.MethodInheritanceTest);
  58355. $core.addMethod(
  58356. $core.method({
  58357. selector: "targetClassTop",
  58358. protocol: "accessing",
  58359. fn: function (){
  58360. var self=this,$self=this;
  58361. return $globals.Object;
  58362. },
  58363. args: [],
  58364. source: "targetClassTop\x0a\x09^ Object",
  58365. referencedClasses: ["Object"],
  58366. messageSends: []
  58367. }),
  58368. $globals.MethodInheritanceTest);
  58369. $core.addMethod(
  58370. $core.method({
  58371. selector: "tearDown",
  58372. protocol: "initialization",
  58373. fn: function (){
  58374. var self=this,$self=this;
  58375. return $core.withContext(function($ctx1) {
  58376. $recv((function(){
  58377. return $core.withContext(function($ctx2) {
  58378. return $self._deinstallTop();
  58379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58380. }))._on_do_($globals.Error,(function(){
  58381. }));
  58382. $ctx1.sendIdx["on:do:"]=1;
  58383. $recv((function(){
  58384. return $core.withContext(function($ctx2) {
  58385. return $self._deinstallMiddle();
  58386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58387. }))._on_do_($globals.Error,(function(){
  58388. }));
  58389. $ctx1.sendIdx["on:do:"]=2;
  58390. $recv((function(){
  58391. return $core.withContext(function($ctx2) {
  58392. return $self._deinstallBottom();
  58393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58394. }))._on_do_($globals.Error,(function(){
  58395. }));
  58396. return self;
  58397. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58398. },
  58399. args: [],
  58400. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58401. referencedClasses: ["Error"],
  58402. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58403. }),
  58404. $globals.MethodInheritanceTest);
  58405. $core.addMethod(
  58406. $core.method({
  58407. selector: "testMNU11",
  58408. protocol: "tests",
  58409. fn: function (){
  58410. var self=this,$self=this;
  58411. return $core.withContext(function($ctx1) {
  58412. $self["@performBlock"]=(function(x){
  58413. return $core.withContext(function($ctx2) {
  58414. return $recv(x)._foo();
  58415. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58416. });
  58417. $self._shouldMNU();
  58418. $ctx1.sendIdx["shouldMNU"]=1;
  58419. $self._installTop_("foo ^ false");
  58420. $ctx1.sendIdx["installTop:"]=1;
  58421. $self._installTop_("foo ^ true");
  58422. $self._deinstallTop();
  58423. $self._shouldMNU();
  58424. return self;
  58425. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58426. },
  58427. args: [],
  58428. 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",
  58429. referencedClasses: [],
  58430. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58431. }),
  58432. $globals.MethodInheritanceTest);
  58433. $core.addMethod(
  58434. $core.method({
  58435. selector: "testMNU22",
  58436. protocol: "tests",
  58437. fn: function (){
  58438. var self=this,$self=this;
  58439. return $core.withContext(function($ctx1) {
  58440. $self["@performBlock"]=(function(x){
  58441. return $core.withContext(function($ctx2) {
  58442. return $recv(x)._foo();
  58443. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58444. });
  58445. $self._shouldMNU();
  58446. $ctx1.sendIdx["shouldMNU"]=1;
  58447. $self._installMiddle_("foo ^ false");
  58448. $ctx1.sendIdx["installMiddle:"]=1;
  58449. $self._installMiddle_("foo ^ true");
  58450. $self._deinstallMiddle();
  58451. $self._shouldMNU();
  58452. return self;
  58453. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58454. },
  58455. args: [],
  58456. 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",
  58457. referencedClasses: [],
  58458. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58459. }),
  58460. $globals.MethodInheritanceTest);
  58461. $core.addMethod(
  58462. $core.method({
  58463. selector: "testReturns1",
  58464. protocol: "tests",
  58465. fn: function (){
  58466. var self=this,$self=this;
  58467. return $core.withContext(function($ctx1) {
  58468. $self["@performBlock"]=(function(x){
  58469. return $core.withContext(function($ctx2) {
  58470. return $recv(x)._foo();
  58471. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58472. });
  58473. $self._installTop_("foo ^ false");
  58474. $ctx1.sendIdx["installTop:"]=1;
  58475. $self._shouldReturn_(false);
  58476. $ctx1.sendIdx["shouldReturn:"]=1;
  58477. $self._installTop_("foo ^ true");
  58478. $self._shouldReturn_(true);
  58479. return self;
  58480. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58481. },
  58482. args: [],
  58483. 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",
  58484. referencedClasses: [],
  58485. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58486. }),
  58487. $globals.MethodInheritanceTest);
  58488. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58489. $core.addMethod(
  58490. $core.method({
  58491. selector: "testAbs",
  58492. protocol: "tests",
  58493. fn: function (){
  58494. var self=this,$self=this;
  58495. return $core.withContext(function($ctx1) {
  58496. var $1;
  58497. $1=(4)._abs();
  58498. $ctx1.sendIdx["abs"]=1;
  58499. $self._assert_equals_($1,(4));
  58500. $ctx1.sendIdx["assert:equals:"]=1;
  58501. $self._assert_equals_((-4)._abs(),(4));
  58502. return self;
  58503. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58504. },
  58505. args: [],
  58506. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58507. referencedClasses: [],
  58508. messageSends: ["assert:equals:", "abs"]
  58509. }),
  58510. $globals.NumberTest);
  58511. $core.addMethod(
  58512. $core.method({
  58513. selector: "testArithmetic",
  58514. protocol: "tests",
  58515. fn: function (){
  58516. var self=this,$self=this;
  58517. return $core.withContext(function($ctx1) {
  58518. var $1,$2,$3,$5,$4;
  58519. $1=(1.5).__plus((1));
  58520. $ctx1.sendIdx["+"]=1;
  58521. $self._assert_equals_($1,(2.5));
  58522. $ctx1.sendIdx["assert:equals:"]=1;
  58523. $2=(2).__minus((1));
  58524. $ctx1.sendIdx["-"]=1;
  58525. $self._assert_equals_($2,(1));
  58526. $ctx1.sendIdx["assert:equals:"]=2;
  58527. $self._assert_equals_((-2).__minus((1)),(-3));
  58528. $ctx1.sendIdx["assert:equals:"]=3;
  58529. $self._assert_equals_((12).__slash((2)),(6));
  58530. $ctx1.sendIdx["assert:equals:"]=4;
  58531. $3=(3).__star((4));
  58532. $ctx1.sendIdx["*"]=1;
  58533. $self._assert_equals_($3,(12));
  58534. $ctx1.sendIdx["assert:equals:"]=5;
  58535. $self._assert_equals_((7).__slash_slash((2)),(3));
  58536. $ctx1.sendIdx["assert:equals:"]=6;
  58537. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58538. $ctx1.sendIdx["assert:equals:"]=7;
  58539. $5=(1).__plus((2));
  58540. $ctx1.sendIdx["+"]=2;
  58541. $4=$recv($5).__star((3));
  58542. $ctx1.sendIdx["*"]=2;
  58543. $self._assert_equals_($4,(9));
  58544. $ctx1.sendIdx["assert:equals:"]=8;
  58545. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58546. return self;
  58547. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58548. },
  58549. args: [],
  58550. 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",
  58551. referencedClasses: [],
  58552. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58553. }),
  58554. $globals.NumberTest);
  58555. $core.addMethod(
  58556. $core.method({
  58557. selector: "testAsNumber",
  58558. protocol: "tests",
  58559. fn: function (){
  58560. var self=this,$self=this;
  58561. return $core.withContext(function($ctx1) {
  58562. $self._assert_equals_((3)._asNumber(),(3));
  58563. return self;
  58564. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58565. },
  58566. args: [],
  58567. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58568. referencedClasses: [],
  58569. messageSends: ["assert:equals:", "asNumber"]
  58570. }),
  58571. $globals.NumberTest);
  58572. $core.addMethod(
  58573. $core.method({
  58574. selector: "testBetweenAnd",
  58575. protocol: "tests",
  58576. fn: function (){
  58577. var self=this,$self=this;
  58578. return $core.withContext(function($ctx1) {
  58579. var $1,$3,$2,$5,$4;
  58580. $1=(4)._between_and_((3),(5));
  58581. $ctx1.sendIdx["between:and:"]=1;
  58582. $self._assert_($1);
  58583. $ctx1.sendIdx["assert:"]=1;
  58584. $3=(1)._between_and_((5),(6));
  58585. $ctx1.sendIdx["between:and:"]=2;
  58586. $2=$recv($3)._not();
  58587. $ctx1.sendIdx["not"]=1;
  58588. $self._assert_($2);
  58589. $ctx1.sendIdx["assert:"]=2;
  58590. $5=(90)._between_and_((67),(87));
  58591. $ctx1.sendIdx["between:and:"]=3;
  58592. $4=$recv($5)._not();
  58593. $self._assert_($4);
  58594. $ctx1.sendIdx["assert:"]=3;
  58595. $self._assert_((1)._between_and_((1),(1)));
  58596. return self;
  58597. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58598. },
  58599. args: [],
  58600. 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).",
  58601. referencedClasses: [],
  58602. messageSends: ["assert:", "between:and:", "not"]
  58603. }),
  58604. $globals.NumberTest);
  58605. $core.addMethod(
  58606. $core.method({
  58607. selector: "testBitAnd",
  58608. protocol: "tests",
  58609. fn: function (){
  58610. var self=this,$self=this;
  58611. return $core.withContext(function($ctx1) {
  58612. var $1,$2;
  58613. $1=(15)._bitAnd_((2));
  58614. $ctx1.sendIdx["bitAnd:"]=1;
  58615. $self._assert_equals_($1,(2));
  58616. $ctx1.sendIdx["assert:equals:"]=1;
  58617. $2=(15)._bitAnd_((15));
  58618. $ctx1.sendIdx["bitAnd:"]=2;
  58619. $self._assert_equals_($2,(15));
  58620. $ctx1.sendIdx["assert:equals:"]=2;
  58621. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58622. return self;
  58623. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58624. },
  58625. args: [],
  58626. 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",
  58627. referencedClasses: [],
  58628. messageSends: ["assert:equals:", "bitAnd:"]
  58629. }),
  58630. $globals.NumberTest);
  58631. $core.addMethod(
  58632. $core.method({
  58633. selector: "testBitNot",
  58634. protocol: "tests",
  58635. fn: function (){
  58636. var self=this,$self=this;
  58637. return $core.withContext(function($ctx1) {
  58638. var $1,$2;
  58639. $1=(2)._bitNot();
  58640. $ctx1.sendIdx["bitNot"]=1;
  58641. $self._assert_equals_($1,(-3));
  58642. $ctx1.sendIdx["assert:equals:"]=1;
  58643. $2=(-1)._bitNot();
  58644. $ctx1.sendIdx["bitNot"]=2;
  58645. $self._assert_equals_($2,(0));
  58646. $ctx1.sendIdx["assert:equals:"]=2;
  58647. $self._assert_equals_((-1022)._bitNot(),(1021));
  58648. return self;
  58649. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58650. },
  58651. args: [],
  58652. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58653. referencedClasses: [],
  58654. messageSends: ["assert:equals:", "bitNot"]
  58655. }),
  58656. $globals.NumberTest);
  58657. $core.addMethod(
  58658. $core.method({
  58659. selector: "testBitOr",
  58660. protocol: "tests",
  58661. fn: function (){
  58662. var self=this,$self=this;
  58663. return $core.withContext(function($ctx1) {
  58664. var $1,$2;
  58665. $1=(2)._bitOr_((4));
  58666. $ctx1.sendIdx["bitOr:"]=1;
  58667. $self._assert_equals_($1,(6));
  58668. $ctx1.sendIdx["assert:equals:"]=1;
  58669. $2=(7)._bitOr_((2));
  58670. $ctx1.sendIdx["bitOr:"]=2;
  58671. $self._assert_equals_($2,(7));
  58672. $ctx1.sendIdx["assert:equals:"]=2;
  58673. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58674. return self;
  58675. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58676. },
  58677. args: [],
  58678. 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",
  58679. referencedClasses: [],
  58680. messageSends: ["assert:equals:", "bitOr:"]
  58681. }),
  58682. $globals.NumberTest);
  58683. $core.addMethod(
  58684. $core.method({
  58685. selector: "testBitXor",
  58686. protocol: "tests",
  58687. fn: function (){
  58688. var self=this,$self=this;
  58689. return $core.withContext(function($ctx1) {
  58690. var $1,$2,$3;
  58691. $1=(2)._bitXor_((4));
  58692. $ctx1.sendIdx["bitXor:"]=1;
  58693. $self._assert_equals_($1,(6));
  58694. $ctx1.sendIdx["assert:equals:"]=1;
  58695. $2=(7)._bitXor_((2));
  58696. $ctx1.sendIdx["bitXor:"]=2;
  58697. $self._assert_equals_($2,(5));
  58698. $ctx1.sendIdx["assert:equals:"]=2;
  58699. $3=(-1)._bitXor_((1021));
  58700. $ctx1.sendIdx["bitXor:"]=3;
  58701. $self._assert_equals_($3,(-1022));
  58702. $ctx1.sendIdx["assert:equals:"]=3;
  58703. $self._assert_equals_((91)._bitXor_((91)),(0));
  58704. return self;
  58705. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58706. },
  58707. args: [],
  58708. 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",
  58709. referencedClasses: [],
  58710. messageSends: ["assert:equals:", "bitXor:"]
  58711. }),
  58712. $globals.NumberTest);
  58713. $core.addMethod(
  58714. $core.method({
  58715. selector: "testCeiling",
  58716. protocol: "tests",
  58717. fn: function (){
  58718. var self=this,$self=this;
  58719. return $core.withContext(function($ctx1) {
  58720. var $1,$2;
  58721. $1=(1.2)._ceiling();
  58722. $ctx1.sendIdx["ceiling"]=1;
  58723. $self._assert_equals_($1,(2));
  58724. $ctx1.sendIdx["assert:equals:"]=1;
  58725. $2=(-1.2)._ceiling();
  58726. $ctx1.sendIdx["ceiling"]=2;
  58727. $self._assert_equals_($2,(-1));
  58728. $ctx1.sendIdx["assert:equals:"]=2;
  58729. $self._assert_equals_((1)._ceiling(),(1));
  58730. return self;
  58731. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58732. },
  58733. args: [],
  58734. 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.",
  58735. referencedClasses: [],
  58736. messageSends: ["assert:equals:", "ceiling"]
  58737. }),
  58738. $globals.NumberTest);
  58739. $core.addMethod(
  58740. $core.method({
  58741. selector: "testComparison",
  58742. protocol: "tests",
  58743. fn: function (){
  58744. var self=this,$self=this;
  58745. return $core.withContext(function($ctx1) {
  58746. var $1,$2,$3,$4;
  58747. $1=(3).__gt((2));
  58748. $ctx1.sendIdx[">"]=1;
  58749. $self._assert_($1);
  58750. $ctx1.sendIdx["assert:"]=1;
  58751. $2=(2).__lt((3));
  58752. $ctx1.sendIdx["<"]=1;
  58753. $self._assert_($2);
  58754. $ctx1.sendIdx["assert:"]=2;
  58755. $self._deny_((3).__lt((2)));
  58756. $ctx1.sendIdx["deny:"]=1;
  58757. $self._deny_((2).__gt((3)));
  58758. $3=(3).__gt_eq((3));
  58759. $ctx1.sendIdx[">="]=1;
  58760. $self._assert_($3);
  58761. $ctx1.sendIdx["assert:"]=3;
  58762. $self._assert_((3.1).__gt_eq((3)));
  58763. $ctx1.sendIdx["assert:"]=4;
  58764. $4=(3).__lt_eq((3));
  58765. $ctx1.sendIdx["<="]=1;
  58766. $self._assert_($4);
  58767. $ctx1.sendIdx["assert:"]=5;
  58768. $self._assert_((3).__lt_eq((3.1)));
  58769. return self;
  58770. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58771. },
  58772. args: [],
  58773. 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",
  58774. referencedClasses: [],
  58775. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58776. }),
  58777. $globals.NumberTest);
  58778. $core.addMethod(
  58779. $core.method({
  58780. selector: "testCopying",
  58781. protocol: "tests",
  58782. fn: function (){
  58783. var self=this,$self=this;
  58784. return $core.withContext(function($ctx1) {
  58785. var $1;
  58786. $1=$recv((1)._copy()).__eq_eq((1));
  58787. $ctx1.sendIdx["=="]=1;
  58788. $self._assert_($1);
  58789. $ctx1.sendIdx["assert:"]=1;
  58790. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58791. return self;
  58792. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58793. },
  58794. args: [],
  58795. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58796. referencedClasses: [],
  58797. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58798. }),
  58799. $globals.NumberTest);
  58800. $core.addMethod(
  58801. $core.method({
  58802. selector: "testDegreesToRadians",
  58803. protocol: "tests",
  58804. fn: function (){
  58805. var self=this,$self=this;
  58806. return $core.withContext(function($ctx1) {
  58807. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58808. return self;
  58809. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58810. },
  58811. args: [],
  58812. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58813. referencedClasses: ["Number"],
  58814. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58815. }),
  58816. $globals.NumberTest);
  58817. $core.addMethod(
  58818. $core.method({
  58819. selector: "testEquality",
  58820. protocol: "tests",
  58821. fn: function (){
  58822. var self=this,$self=this;
  58823. return $core.withContext(function($ctx1) {
  58824. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58825. $1=(1).__eq((1));
  58826. $ctx1.sendIdx["="]=1;
  58827. $self._assert_($1);
  58828. $ctx1.sendIdx["assert:"]=1;
  58829. $2=(0).__eq((0));
  58830. $ctx1.sendIdx["="]=2;
  58831. $self._assert_($2);
  58832. $ctx1.sendIdx["assert:"]=2;
  58833. $3=(1).__eq((0));
  58834. $ctx1.sendIdx["="]=3;
  58835. $self._deny_($3);
  58836. $ctx1.sendIdx["deny:"]=1;
  58837. $5=(1)._yourself();
  58838. $ctx1.sendIdx["yourself"]=1;
  58839. $4=$recv($5).__eq((1));
  58840. $ctx1.sendIdx["="]=4;
  58841. $self._assert_($4);
  58842. $ctx1.sendIdx["assert:"]=3;
  58843. $7=(1)._yourself();
  58844. $ctx1.sendIdx["yourself"]=2;
  58845. $6=(1).__eq($7);
  58846. $ctx1.sendIdx["="]=5;
  58847. $self._assert_($6);
  58848. $ctx1.sendIdx["assert:"]=4;
  58849. $9=(1)._yourself();
  58850. $ctx1.sendIdx["yourself"]=3;
  58851. $8=$recv($9).__eq((1)._yourself());
  58852. $ctx1.sendIdx["="]=6;
  58853. $self._assert_($8);
  58854. $10=(0).__eq(false);
  58855. $ctx1.sendIdx["="]=7;
  58856. $self._deny_($10);
  58857. $ctx1.sendIdx["deny:"]=2;
  58858. $11=false.__eq((0));
  58859. $ctx1.sendIdx["="]=8;
  58860. $self._deny_($11);
  58861. $ctx1.sendIdx["deny:"]=3;
  58862. $12="".__eq((0));
  58863. $ctx1.sendIdx["="]=9;
  58864. $self._deny_($12);
  58865. $ctx1.sendIdx["deny:"]=4;
  58866. $self._deny_((0).__eq(""));
  58867. return self;
  58868. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58869. },
  58870. args: [],
  58871. 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 = ''",
  58872. referencedClasses: [],
  58873. messageSends: ["assert:", "=", "deny:", "yourself"]
  58874. }),
  58875. $globals.NumberTest);
  58876. $core.addMethod(
  58877. $core.method({
  58878. selector: "testFloor",
  58879. protocol: "tests",
  58880. fn: function (){
  58881. var self=this,$self=this;
  58882. return $core.withContext(function($ctx1) {
  58883. var $1,$2;
  58884. $1=(1.2)._floor();
  58885. $ctx1.sendIdx["floor"]=1;
  58886. $self._assert_equals_($1,(1));
  58887. $ctx1.sendIdx["assert:equals:"]=1;
  58888. $2=(-1.2)._floor();
  58889. $ctx1.sendIdx["floor"]=2;
  58890. $self._assert_equals_($2,(-2));
  58891. $ctx1.sendIdx["assert:equals:"]=2;
  58892. $self._assert_equals_((1)._floor(),(1));
  58893. return self;
  58894. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58895. },
  58896. args: [],
  58897. 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.",
  58898. referencedClasses: [],
  58899. messageSends: ["assert:equals:", "floor"]
  58900. }),
  58901. $globals.NumberTest);
  58902. $core.addMethod(
  58903. $core.method({
  58904. selector: "testHexNumbers",
  58905. protocol: "tests",
  58906. fn: function (){
  58907. var self=this,$self=this;
  58908. return $core.withContext(function($ctx1) {
  58909. var $1,$2,$3,$4,$5;
  58910. $self._assert_equals_((9),(9));
  58911. $ctx1.sendIdx["assert:equals:"]=1;
  58912. $1=(10)._truncated();
  58913. $ctx1.sendIdx["truncated"]=1;
  58914. $self._assert_equals_($1,(10));
  58915. $ctx1.sendIdx["assert:equals:"]=2;
  58916. $2=(11)._truncated();
  58917. $ctx1.sendIdx["truncated"]=2;
  58918. $self._assert_equals_($2,(11));
  58919. $ctx1.sendIdx["assert:equals:"]=3;
  58920. $3=(12)._truncated();
  58921. $ctx1.sendIdx["truncated"]=3;
  58922. $self._assert_equals_($3,(12));
  58923. $ctx1.sendIdx["assert:equals:"]=4;
  58924. $4=(13)._truncated();
  58925. $ctx1.sendIdx["truncated"]=4;
  58926. $self._assert_equals_($4,(13));
  58927. $ctx1.sendIdx["assert:equals:"]=5;
  58928. $5=(14)._truncated();
  58929. $ctx1.sendIdx["truncated"]=5;
  58930. $self._assert_equals_($5,(14));
  58931. $ctx1.sendIdx["assert:equals:"]=6;
  58932. $self._assert_equals_((15)._truncated(),(15));
  58933. return self;
  58934. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58935. },
  58936. args: [],
  58937. 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",
  58938. referencedClasses: [],
  58939. messageSends: ["assert:equals:", "truncated"]
  58940. }),
  58941. $globals.NumberTest);
  58942. $core.addMethod(
  58943. $core.method({
  58944. selector: "testIdentity",
  58945. protocol: "tests",
  58946. fn: function (){
  58947. var self=this,$self=this;
  58948. return $core.withContext(function($ctx1) {
  58949. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58950. $1=(1).__eq_eq((1));
  58951. $ctx1.sendIdx["=="]=1;
  58952. $self._assert_($1);
  58953. $ctx1.sendIdx["assert:"]=1;
  58954. $2=(0).__eq_eq((0));
  58955. $ctx1.sendIdx["=="]=2;
  58956. $self._assert_($2);
  58957. $ctx1.sendIdx["assert:"]=2;
  58958. $3=(1).__eq_eq((0));
  58959. $ctx1.sendIdx["=="]=3;
  58960. $self._deny_($3);
  58961. $ctx1.sendIdx["deny:"]=1;
  58962. $5=(1)._yourself();
  58963. $ctx1.sendIdx["yourself"]=1;
  58964. $4=$recv($5).__eq_eq((1));
  58965. $ctx1.sendIdx["=="]=4;
  58966. $self._assert_($4);
  58967. $ctx1.sendIdx["assert:"]=3;
  58968. $7=(1)._yourself();
  58969. $ctx1.sendIdx["yourself"]=2;
  58970. $6=(1).__eq_eq($7);
  58971. $ctx1.sendIdx["=="]=5;
  58972. $self._assert_($6);
  58973. $ctx1.sendIdx["assert:"]=4;
  58974. $9=(1)._yourself();
  58975. $ctx1.sendIdx["yourself"]=3;
  58976. $8=$recv($9).__eq_eq((1)._yourself());
  58977. $ctx1.sendIdx["=="]=6;
  58978. $self._assert_($8);
  58979. $self._deny_((1).__eq_eq((2)));
  58980. return self;
  58981. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58982. },
  58983. args: [],
  58984. 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",
  58985. referencedClasses: [],
  58986. messageSends: ["assert:", "==", "deny:", "yourself"]
  58987. }),
  58988. $globals.NumberTest);
  58989. $core.addMethod(
  58990. $core.method({
  58991. selector: "testInvalidHexNumbers",
  58992. protocol: "tests",
  58993. fn: function (){
  58994. var self=this,$self=this;
  58995. return $core.withContext(function($ctx1) {
  58996. $self._should_raise_((function(){
  58997. return $core.withContext(function($ctx2) {
  58998. return (16)._rG();
  58999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59000. }),$globals.MessageNotUnderstood);
  59001. $ctx1.sendIdx["should:raise:"]=1;
  59002. $self._should_raise_((function(){
  59003. return $core.withContext(function($ctx2) {
  59004. return (16)._rg();
  59005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59006. }),$globals.MessageNotUnderstood);
  59007. $ctx1.sendIdx["should:raise:"]=2;
  59008. $self._should_raise_((function(){
  59009. return $core.withContext(function($ctx2) {
  59010. return (16)._rH();
  59011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59012. }),$globals.MessageNotUnderstood);
  59013. $ctx1.sendIdx["should:raise:"]=3;
  59014. $self._should_raise_((function(){
  59015. return $core.withContext(function($ctx2) {
  59016. return (16)._rh();
  59017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  59018. }),$globals.MessageNotUnderstood);
  59019. $ctx1.sendIdx["should:raise:"]=4;
  59020. $self._should_raise_((function(){
  59021. return $core.withContext(function($ctx2) {
  59022. return (16)._rI();
  59023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59024. }),$globals.MessageNotUnderstood);
  59025. $ctx1.sendIdx["should:raise:"]=5;
  59026. $self._should_raise_((function(){
  59027. return $core.withContext(function($ctx2) {
  59028. return (16)._ri();
  59029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  59030. }),$globals.MessageNotUnderstood);
  59031. $ctx1.sendIdx["should:raise:"]=6;
  59032. $self._should_raise_((function(){
  59033. return $core.withContext(function($ctx2) {
  59034. return (16)._rJ();
  59035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  59036. }),$globals.MessageNotUnderstood);
  59037. $ctx1.sendIdx["should:raise:"]=7;
  59038. $self._should_raise_((function(){
  59039. return $core.withContext(function($ctx2) {
  59040. return (16)._rj();
  59041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  59042. }),$globals.MessageNotUnderstood);
  59043. $ctx1.sendIdx["should:raise:"]=8;
  59044. $self._should_raise_((function(){
  59045. return $core.withContext(function($ctx2) {
  59046. return (16)._rK();
  59047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  59048. }),$globals.MessageNotUnderstood);
  59049. $ctx1.sendIdx["should:raise:"]=9;
  59050. $self._should_raise_((function(){
  59051. return $core.withContext(function($ctx2) {
  59052. return (16)._rk();
  59053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  59054. }),$globals.MessageNotUnderstood);
  59055. $ctx1.sendIdx["should:raise:"]=10;
  59056. $self._should_raise_((function(){
  59057. return $core.withContext(function($ctx2) {
  59058. return (16)._rL();
  59059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  59060. }),$globals.MessageNotUnderstood);
  59061. $ctx1.sendIdx["should:raise:"]=11;
  59062. $self._should_raise_((function(){
  59063. return $core.withContext(function($ctx2) {
  59064. return (16)._rl();
  59065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  59066. }),$globals.MessageNotUnderstood);
  59067. $ctx1.sendIdx["should:raise:"]=12;
  59068. $self._should_raise_((function(){
  59069. return $core.withContext(function($ctx2) {
  59070. return (16)._rM();
  59071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  59072. }),$globals.MessageNotUnderstood);
  59073. $ctx1.sendIdx["should:raise:"]=13;
  59074. $self._should_raise_((function(){
  59075. return $core.withContext(function($ctx2) {
  59076. return (16)._rm();
  59077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  59078. }),$globals.MessageNotUnderstood);
  59079. $ctx1.sendIdx["should:raise:"]=14;
  59080. $self._should_raise_((function(){
  59081. return $core.withContext(function($ctx2) {
  59082. return (16)._rN();
  59083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  59084. }),$globals.MessageNotUnderstood);
  59085. $ctx1.sendIdx["should:raise:"]=15;
  59086. $self._should_raise_((function(){
  59087. return $core.withContext(function($ctx2) {
  59088. return (16)._rn();
  59089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  59090. }),$globals.MessageNotUnderstood);
  59091. $ctx1.sendIdx["should:raise:"]=16;
  59092. $self._should_raise_((function(){
  59093. return $core.withContext(function($ctx2) {
  59094. return (16)._rO();
  59095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  59096. }),$globals.MessageNotUnderstood);
  59097. $ctx1.sendIdx["should:raise:"]=17;
  59098. $self._should_raise_((function(){
  59099. return $core.withContext(function($ctx2) {
  59100. return (16)._ro();
  59101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  59102. }),$globals.MessageNotUnderstood);
  59103. $ctx1.sendIdx["should:raise:"]=18;
  59104. $self._should_raise_((function(){
  59105. return $core.withContext(function($ctx2) {
  59106. return (16)._rP();
  59107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  59108. }),$globals.MessageNotUnderstood);
  59109. $ctx1.sendIdx["should:raise:"]=19;
  59110. $self._should_raise_((function(){
  59111. return $core.withContext(function($ctx2) {
  59112. return (16)._rp();
  59113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59114. }),$globals.MessageNotUnderstood);
  59115. $ctx1.sendIdx["should:raise:"]=20;
  59116. $self._should_raise_((function(){
  59117. return $core.withContext(function($ctx2) {
  59118. return (16)._rQ();
  59119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59120. }),$globals.MessageNotUnderstood);
  59121. $ctx1.sendIdx["should:raise:"]=21;
  59122. $self._should_raise_((function(){
  59123. return $core.withContext(function($ctx2) {
  59124. return (16)._rq();
  59125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59126. }),$globals.MessageNotUnderstood);
  59127. $ctx1.sendIdx["should:raise:"]=22;
  59128. $self._should_raise_((function(){
  59129. return $core.withContext(function($ctx2) {
  59130. return (16)._rR();
  59131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59132. }),$globals.MessageNotUnderstood);
  59133. $ctx1.sendIdx["should:raise:"]=23;
  59134. $self._should_raise_((function(){
  59135. return $core.withContext(function($ctx2) {
  59136. return (16)._rr();
  59137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59138. }),$globals.MessageNotUnderstood);
  59139. $ctx1.sendIdx["should:raise:"]=24;
  59140. $self._should_raise_((function(){
  59141. return $core.withContext(function($ctx2) {
  59142. return (16)._rS();
  59143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59144. }),$globals.MessageNotUnderstood);
  59145. $ctx1.sendIdx["should:raise:"]=25;
  59146. $self._should_raise_((function(){
  59147. return $core.withContext(function($ctx2) {
  59148. return (16)._rs();
  59149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59150. }),$globals.MessageNotUnderstood);
  59151. $ctx1.sendIdx["should:raise:"]=26;
  59152. $self._should_raise_((function(){
  59153. return $core.withContext(function($ctx2) {
  59154. return (16)._rT();
  59155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59156. }),$globals.MessageNotUnderstood);
  59157. $ctx1.sendIdx["should:raise:"]=27;
  59158. $self._should_raise_((function(){
  59159. return $core.withContext(function($ctx2) {
  59160. return (16)._rt();
  59161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59162. }),$globals.MessageNotUnderstood);
  59163. $ctx1.sendIdx["should:raise:"]=28;
  59164. $self._should_raise_((function(){
  59165. return $core.withContext(function($ctx2) {
  59166. return (16)._rU();
  59167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59168. }),$globals.MessageNotUnderstood);
  59169. $ctx1.sendIdx["should:raise:"]=29;
  59170. $self._should_raise_((function(){
  59171. return $core.withContext(function($ctx2) {
  59172. return (16)._ru();
  59173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59174. }),$globals.MessageNotUnderstood);
  59175. $ctx1.sendIdx["should:raise:"]=30;
  59176. $self._should_raise_((function(){
  59177. return $core.withContext(function($ctx2) {
  59178. return (16)._rV();
  59179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59180. }),$globals.MessageNotUnderstood);
  59181. $ctx1.sendIdx["should:raise:"]=31;
  59182. $self._should_raise_((function(){
  59183. return $core.withContext(function($ctx2) {
  59184. return (16)._rv();
  59185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59186. }),$globals.MessageNotUnderstood);
  59187. $ctx1.sendIdx["should:raise:"]=32;
  59188. $self._should_raise_((function(){
  59189. return $core.withContext(function($ctx2) {
  59190. return (16)._rW();
  59191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59192. }),$globals.MessageNotUnderstood);
  59193. $ctx1.sendIdx["should:raise:"]=33;
  59194. $self._should_raise_((function(){
  59195. return $core.withContext(function($ctx2) {
  59196. return (16)._rw();
  59197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59198. }),$globals.MessageNotUnderstood);
  59199. $ctx1.sendIdx["should:raise:"]=34;
  59200. $self._should_raise_((function(){
  59201. return $core.withContext(function($ctx2) {
  59202. return (16)._rX();
  59203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59204. }),$globals.MessageNotUnderstood);
  59205. $ctx1.sendIdx["should:raise:"]=35;
  59206. $self._should_raise_((function(){
  59207. return $core.withContext(function($ctx2) {
  59208. return (16)._rx();
  59209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59210. }),$globals.MessageNotUnderstood);
  59211. $ctx1.sendIdx["should:raise:"]=36;
  59212. $self._should_raise_((function(){
  59213. return $core.withContext(function($ctx2) {
  59214. return (16)._rY();
  59215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59216. }),$globals.MessageNotUnderstood);
  59217. $ctx1.sendIdx["should:raise:"]=37;
  59218. $self._should_raise_((function(){
  59219. return $core.withContext(function($ctx2) {
  59220. return (16)._ry();
  59221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59222. }),$globals.MessageNotUnderstood);
  59223. $ctx1.sendIdx["should:raise:"]=38;
  59224. $self._should_raise_((function(){
  59225. return $core.withContext(function($ctx2) {
  59226. return (16)._rZ();
  59227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59228. }),$globals.MessageNotUnderstood);
  59229. $ctx1.sendIdx["should:raise:"]=39;
  59230. $self._should_raise_((function(){
  59231. return $core.withContext(function($ctx2) {
  59232. return (16)._rz();
  59233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59234. }),$globals.MessageNotUnderstood);
  59235. $ctx1.sendIdx["should:raise:"]=40;
  59236. $self._should_raise_((function(){
  59237. return $core.withContext(function($ctx2) {
  59238. return (11259375)._Z();
  59239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59240. }),$globals.MessageNotUnderstood);
  59241. return self;
  59242. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59243. },
  59244. args: [],
  59245. 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.",
  59246. referencedClasses: ["MessageNotUnderstood"],
  59247. 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"]
  59248. }),
  59249. $globals.NumberTest);
  59250. $core.addMethod(
  59251. $core.method({
  59252. selector: "testLog",
  59253. protocol: "tests",
  59254. fn: function (){
  59255. var self=this,$self=this;
  59256. return $core.withContext(function($ctx1) {
  59257. $self._assert_equals_((10000)._log(),(4));
  59258. $ctx1.sendIdx["assert:equals:"]=1;
  59259. $self._assert_equals_((512)._log_((2)),(9));
  59260. $ctx1.sendIdx["assert:equals:"]=2;
  59261. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59262. return self;
  59263. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59264. },
  59265. args: [],
  59266. 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.",
  59267. referencedClasses: ["Number"],
  59268. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59269. }),
  59270. $globals.NumberTest);
  59271. $core.addMethod(
  59272. $core.method({
  59273. selector: "testMinMax",
  59274. protocol: "tests",
  59275. fn: function (){
  59276. var self=this,$self=this;
  59277. return $core.withContext(function($ctx1) {
  59278. var $1,$2;
  59279. $self._assert_equals_((2)._max_((5)),(5));
  59280. $ctx1.sendIdx["assert:equals:"]=1;
  59281. $self._assert_equals_((2)._min_((5)),(2));
  59282. $ctx1.sendIdx["assert:equals:"]=2;
  59283. $1=(2)._min_max_((5),(3));
  59284. $ctx1.sendIdx["min:max:"]=1;
  59285. $self._assert_equals_($1,(3));
  59286. $ctx1.sendIdx["assert:equals:"]=3;
  59287. $2=(7)._min_max_((5),(3));
  59288. $ctx1.sendIdx["min:max:"]=2;
  59289. $self._assert_equals_($2,(5));
  59290. $ctx1.sendIdx["assert:equals:"]=4;
  59291. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59292. return self;
  59293. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59294. },
  59295. args: [],
  59296. 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.",
  59297. referencedClasses: [],
  59298. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59299. }),
  59300. $globals.NumberTest);
  59301. $core.addMethod(
  59302. $core.method({
  59303. selector: "testNegated",
  59304. protocol: "tests",
  59305. fn: function (){
  59306. var self=this,$self=this;
  59307. return $core.withContext(function($ctx1) {
  59308. var $1;
  59309. $1=(3)._negated();
  59310. $ctx1.sendIdx["negated"]=1;
  59311. $self._assert_equals_($1,(-3));
  59312. $ctx1.sendIdx["assert:equals:"]=1;
  59313. $self._assert_equals_((-3)._negated(),(3));
  59314. return self;
  59315. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59316. },
  59317. args: [],
  59318. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59319. referencedClasses: [],
  59320. messageSends: ["assert:equals:", "negated"]
  59321. }),
  59322. $globals.NumberTest);
  59323. $core.addMethod(
  59324. $core.method({
  59325. selector: "testPrintShowingDecimalPlaces",
  59326. protocol: "tests",
  59327. fn: function (){
  59328. var self=this,$self=this;
  59329. return $core.withContext(function($ctx1) {
  59330. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59331. $1=(23)._printShowingDecimalPlaces_((2));
  59332. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59333. $self._assert_equals_($1,"23.00");
  59334. $ctx1.sendIdx["assert:equals:"]=1;
  59335. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59336. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59337. $self._assert_equals_($2,"23.57");
  59338. $ctx1.sendIdx["assert:equals:"]=2;
  59339. $4=(234.567)._negated();
  59340. $ctx1.sendIdx["negated"]=1;
  59341. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59342. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59343. $self._assert_equals_($3,"-234.56700");
  59344. $ctx1.sendIdx["assert:equals:"]=3;
  59345. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59346. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59347. $self._assert_equals_($5,"23");
  59348. $ctx1.sendIdx["assert:equals:"]=4;
  59349. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59350. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59351. $self._assert_equals_($6,"24");
  59352. $ctx1.sendIdx["assert:equals:"]=5;
  59353. $8=(23.4567)._negated();
  59354. $ctx1.sendIdx["negated"]=2;
  59355. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59356. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59357. $self._assert_equals_($7,"-23");
  59358. $ctx1.sendIdx["assert:equals:"]=6;
  59359. $10=(23.5567)._negated();
  59360. $ctx1.sendIdx["negated"]=3;
  59361. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59362. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59363. $self._assert_equals_($9,"-24");
  59364. $ctx1.sendIdx["assert:equals:"]=7;
  59365. $11=(100000000)._printShowingDecimalPlaces_((1));
  59366. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59367. $self._assert_equals_($11,"100000000.0");
  59368. $ctx1.sendIdx["assert:equals:"]=8;
  59369. $12=(0.98)._printShowingDecimalPlaces_((5));
  59370. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59371. $self._assert_equals_($12,"0.98000");
  59372. $ctx1.sendIdx["assert:equals:"]=9;
  59373. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59374. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59375. $self._assert_equals_($13,"-0.98");
  59376. $ctx1.sendIdx["assert:equals:"]=10;
  59377. $14=(2.567)._printShowingDecimalPlaces_((2));
  59378. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59379. $self._assert_equals_($14,"2.57");
  59380. $ctx1.sendIdx["assert:equals:"]=11;
  59381. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59382. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59383. $self._assert_equals_($15,"-2.57");
  59384. $ctx1.sendIdx["assert:equals:"]=12;
  59385. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59386. return self;
  59387. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59388. },
  59389. args: [],
  59390. 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'.",
  59391. referencedClasses: [],
  59392. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59393. }),
  59394. $globals.NumberTest);
  59395. $core.addMethod(
  59396. $core.method({
  59397. selector: "testPrintStringBase",
  59398. protocol: "tests",
  59399. fn: function (){
  59400. var self=this,$self=this;
  59401. return $core.withContext(function($ctx1) {
  59402. var $1,$2,$3;
  59403. $1=(15)._printStringBase_((2));
  59404. $ctx1.sendIdx["printStringBase:"]=1;
  59405. $self._assert_equals_($1,"1111");
  59406. $ctx1.sendIdx["assert:equals:"]=1;
  59407. $2=(15)._printStringBase_((16));
  59408. $ctx1.sendIdx["printStringBase:"]=2;
  59409. $self._assert_equals_($2,"f");
  59410. $ctx1.sendIdx["assert:equals:"]=2;
  59411. $3=(256)._printStringBase_((16));
  59412. $ctx1.sendIdx["printStringBase:"]=3;
  59413. $self._assert_equals_($3,"100");
  59414. $ctx1.sendIdx["assert:equals:"]=3;
  59415. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59416. return self;
  59417. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59418. },
  59419. args: [],
  59420. 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'",
  59421. referencedClasses: [],
  59422. messageSends: ["assert:equals:", "printStringBase:"]
  59423. }),
  59424. $globals.NumberTest);
  59425. $core.addMethod(
  59426. $core.method({
  59427. selector: "testRadiansToDegrees",
  59428. protocol: "tests",
  59429. fn: function (){
  59430. var self=this,$self=this;
  59431. return $core.withContext(function($ctx1) {
  59432. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59433. return self;
  59434. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59435. },
  59436. args: [],
  59437. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59438. referencedClasses: ["Number"],
  59439. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59440. }),
  59441. $globals.NumberTest);
  59442. $core.addMethod(
  59443. $core.method({
  59444. selector: "testRaisedTo",
  59445. protocol: "tests",
  59446. fn: function (){
  59447. var self=this,$self=this;
  59448. return $core.withContext(function($ctx1) {
  59449. var $1,$2,$3;
  59450. $1=(2)._raisedTo_((4));
  59451. $ctx1.sendIdx["raisedTo:"]=1;
  59452. $self._assert_equals_($1,(16));
  59453. $ctx1.sendIdx["assert:equals:"]=1;
  59454. $2=(2)._raisedTo_((0));
  59455. $ctx1.sendIdx["raisedTo:"]=2;
  59456. $self._assert_equals_($2,(1));
  59457. $ctx1.sendIdx["assert:equals:"]=2;
  59458. $3=(2)._raisedTo_((-3));
  59459. $ctx1.sendIdx["raisedTo:"]=3;
  59460. $self._assert_equals_($3,(0.125));
  59461. $ctx1.sendIdx["assert:equals:"]=3;
  59462. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59463. $ctx1.sendIdx["assert:equals:"]=4;
  59464. $self._assert_equals_((2).__star_star((4)),(16));
  59465. return self;
  59466. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59467. },
  59468. args: [],
  59469. 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.",
  59470. referencedClasses: [],
  59471. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59472. }),
  59473. $globals.NumberTest);
  59474. $core.addMethod(
  59475. $core.method({
  59476. selector: "testRounded",
  59477. protocol: "tests",
  59478. fn: function (){
  59479. var self=this,$self=this;
  59480. return $core.withContext(function($ctx1) {
  59481. var $1,$2;
  59482. $1=(3)._rounded();
  59483. $ctx1.sendIdx["rounded"]=1;
  59484. $self._assert_equals_($1,(3));
  59485. $ctx1.sendIdx["assert:equals:"]=1;
  59486. $2=(3.212)._rounded();
  59487. $ctx1.sendIdx["rounded"]=2;
  59488. $self._assert_equals_($2,(3));
  59489. $ctx1.sendIdx["assert:equals:"]=2;
  59490. $self._assert_equals_((3.51)._rounded(),(4));
  59491. return self;
  59492. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59493. },
  59494. args: [],
  59495. 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",
  59496. referencedClasses: [],
  59497. messageSends: ["assert:equals:", "rounded"]
  59498. }),
  59499. $globals.NumberTest);
  59500. $core.addMethod(
  59501. $core.method({
  59502. selector: "testSign",
  59503. protocol: "tests",
  59504. fn: function (){
  59505. var self=this,$self=this;
  59506. return $core.withContext(function($ctx1) {
  59507. var $1,$2;
  59508. $1=(5)._sign();
  59509. $ctx1.sendIdx["sign"]=1;
  59510. $self._assert_equals_($1,(1));
  59511. $ctx1.sendIdx["assert:equals:"]=1;
  59512. $2=(0)._sign();
  59513. $ctx1.sendIdx["sign"]=2;
  59514. $self._assert_equals_($2,(0));
  59515. $ctx1.sendIdx["assert:equals:"]=2;
  59516. $self._assert_equals_((-1.4)._sign(),(-1));
  59517. return self;
  59518. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59519. },
  59520. args: [],
  59521. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59522. referencedClasses: [],
  59523. messageSends: ["assert:equals:", "sign"]
  59524. }),
  59525. $globals.NumberTest);
  59526. $core.addMethod(
  59527. $core.method({
  59528. selector: "testSqrt",
  59529. protocol: "tests",
  59530. fn: function (){
  59531. var self=this,$self=this;
  59532. return $core.withContext(function($ctx1) {
  59533. var $1;
  59534. $1=(4)._sqrt();
  59535. $ctx1.sendIdx["sqrt"]=1;
  59536. $self._assert_equals_($1,(2));
  59537. $ctx1.sendIdx["assert:equals:"]=1;
  59538. $self._assert_equals_((16)._sqrt(),(4));
  59539. return self;
  59540. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59541. },
  59542. args: [],
  59543. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59544. referencedClasses: [],
  59545. messageSends: ["assert:equals:", "sqrt"]
  59546. }),
  59547. $globals.NumberTest);
  59548. $core.addMethod(
  59549. $core.method({
  59550. selector: "testSquared",
  59551. protocol: "tests",
  59552. fn: function (){
  59553. var self=this,$self=this;
  59554. return $core.withContext(function($ctx1) {
  59555. $self._assert_equals_((4)._squared(),(16));
  59556. return self;
  59557. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59558. },
  59559. args: [],
  59560. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59561. referencedClasses: [],
  59562. messageSends: ["assert:equals:", "squared"]
  59563. }),
  59564. $globals.NumberTest);
  59565. $core.addMethod(
  59566. $core.method({
  59567. selector: "testTimesRepeat",
  59568. protocol: "tests",
  59569. fn: function (){
  59570. var self=this,$self=this;
  59571. var i;
  59572. return $core.withContext(function($ctx1) {
  59573. i=(0);
  59574. (0)._timesRepeat_((function(){
  59575. return $core.withContext(function($ctx2) {
  59576. i=$recv(i).__plus((1));
  59577. $ctx2.sendIdx["+"]=1;
  59578. return i;
  59579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59580. }));
  59581. $ctx1.sendIdx["timesRepeat:"]=1;
  59582. $self._assert_equals_(i,(0));
  59583. $ctx1.sendIdx["assert:equals:"]=1;
  59584. (5)._timesRepeat_((function(){
  59585. return $core.withContext(function($ctx2) {
  59586. i=$recv(i).__plus((1));
  59587. return i;
  59588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59589. }));
  59590. $self._assert_equals_(i,(5));
  59591. return self;
  59592. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59593. },
  59594. args: [],
  59595. 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",
  59596. referencedClasses: [],
  59597. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59598. }),
  59599. $globals.NumberTest);
  59600. $core.addMethod(
  59601. $core.method({
  59602. selector: "testTo",
  59603. protocol: "tests",
  59604. fn: function (){
  59605. var self=this,$self=this;
  59606. return $core.withContext(function($ctx1) {
  59607. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59608. return self;
  59609. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59610. },
  59611. args: [],
  59612. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59613. referencedClasses: [],
  59614. messageSends: ["assert:equals:", "to:"]
  59615. }),
  59616. $globals.NumberTest);
  59617. $core.addMethod(
  59618. $core.method({
  59619. selector: "testToBy",
  59620. protocol: "tests",
  59621. fn: function (){
  59622. var self=this,$self=this;
  59623. return $core.withContext(function($ctx1) {
  59624. var $1;
  59625. $1=(0)._to_by_((6),(2));
  59626. $ctx1.sendIdx["to:by:"]=1;
  59627. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59628. $self._should_raise_((function(){
  59629. return $core.withContext(function($ctx2) {
  59630. return (1)._to_by_((4),(0));
  59631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59632. }),$globals.Error);
  59633. return self;
  59634. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59635. },
  59636. args: [],
  59637. 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",
  59638. referencedClasses: ["Error"],
  59639. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59640. }),
  59641. $globals.NumberTest);
  59642. $core.addMethod(
  59643. $core.method({
  59644. selector: "testTrigonometry",
  59645. protocol: "tests",
  59646. fn: function (){
  59647. var self=this,$self=this;
  59648. return $core.withContext(function($ctx1) {
  59649. var $1;
  59650. $self._assert_equals_((0)._cos(),(1));
  59651. $ctx1.sendIdx["assert:equals:"]=1;
  59652. $self._assert_equals_((0)._sin(),(0));
  59653. $ctx1.sendIdx["assert:equals:"]=2;
  59654. $self._assert_equals_((0)._tan(),(0));
  59655. $ctx1.sendIdx["assert:equals:"]=3;
  59656. $self._assert_equals_((1)._arcCos(),(0));
  59657. $ctx1.sendIdx["assert:equals:"]=4;
  59658. $self._assert_equals_((0)._arcSin(),(0));
  59659. $ctx1.sendIdx["assert:equals:"]=5;
  59660. $self._assert_equals_((0)._arcTan(),(0));
  59661. $ctx1.sendIdx["assert:equals:"]=6;
  59662. $1=(0)._arcTan_((1));
  59663. $ctx1.sendIdx["arcTan:"]=1;
  59664. $self._assert_equals_($1,(0));
  59665. $ctx1.sendIdx["assert:equals:"]=7;
  59666. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59667. return self;
  59668. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59669. },
  59670. args: [],
  59671. 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)",
  59672. referencedClasses: ["Number"],
  59673. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59674. }),
  59675. $globals.NumberTest);
  59676. $core.addMethod(
  59677. $core.method({
  59678. selector: "testTruncated",
  59679. protocol: "tests",
  59680. fn: function (){
  59681. var self=this,$self=this;
  59682. return $core.withContext(function($ctx1) {
  59683. var $1,$2;
  59684. $1=(3)._truncated();
  59685. $ctx1.sendIdx["truncated"]=1;
  59686. $self._assert_equals_($1,(3));
  59687. $ctx1.sendIdx["assert:equals:"]=1;
  59688. $2=(3.212)._truncated();
  59689. $ctx1.sendIdx["truncated"]=2;
  59690. $self._assert_equals_($2,(3));
  59691. $ctx1.sendIdx["assert:equals:"]=2;
  59692. $self._assert_equals_((3.51)._truncated(),(3));
  59693. return self;
  59694. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59695. },
  59696. args: [],
  59697. 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",
  59698. referencedClasses: [],
  59699. messageSends: ["assert:equals:", "truncated"]
  59700. }),
  59701. $globals.NumberTest);
  59702. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59703. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59704. $core.addMethod(
  59705. $core.method({
  59706. selector: "foo",
  59707. protocol: "not yet classified",
  59708. fn: function (){
  59709. var self=this,$self=this;
  59710. return $self["@foo"];
  59711. },
  59712. args: [],
  59713. source: "foo\x0a\x09^ foo",
  59714. referencedClasses: [],
  59715. messageSends: []
  59716. }),
  59717. $globals.ObjectMock);
  59718. $core.addMethod(
  59719. $core.method({
  59720. selector: "foo:",
  59721. protocol: "not yet classified",
  59722. fn: function (anObject){
  59723. var self=this,$self=this;
  59724. $self["@foo"]=anObject;
  59725. return self;
  59726. },
  59727. args: ["anObject"],
  59728. source: "foo: anObject\x0a\x09foo := anObject",
  59729. referencedClasses: [],
  59730. messageSends: []
  59731. }),
  59732. $globals.ObjectMock);
  59733. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59734. $core.addMethod(
  59735. $core.method({
  59736. selector: "notDefined",
  59737. protocol: "tests",
  59738. fn: function (){
  59739. var self=this,$self=this;
  59740. return $core.withContext(function($ctx1) {
  59741. return void 0;;
  59742. return self;
  59743. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59744. },
  59745. args: [],
  59746. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59747. referencedClasses: [],
  59748. messageSends: []
  59749. }),
  59750. $globals.ObjectTest);
  59751. $core.addMethod(
  59752. $core.method({
  59753. selector: "testBasicAccess",
  59754. protocol: "tests",
  59755. fn: function (){
  59756. var self=this,$self=this;
  59757. var o;
  59758. return $core.withContext(function($ctx1) {
  59759. var $1;
  59760. o=$recv($globals.Object)._new();
  59761. $recv(o)._basicAt_put_("a",(1));
  59762. $1=$recv(o)._basicAt_("a");
  59763. $ctx1.sendIdx["basicAt:"]=1;
  59764. $self._assert_equals_($1,(1));
  59765. $ctx1.sendIdx["assert:equals:"]=1;
  59766. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59767. return self;
  59768. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59769. },
  59770. args: [],
  59771. 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",
  59772. referencedClasses: ["Object"],
  59773. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59774. }),
  59775. $globals.ObjectTest);
  59776. $core.addMethod(
  59777. $core.method({
  59778. selector: "testBasicPerform",
  59779. protocol: "tests",
  59780. fn: function (){
  59781. var self=this,$self=this;
  59782. var o;
  59783. return $core.withContext(function($ctx1) {
  59784. o=$recv($globals.Object)._new();
  59785. $recv(o)._basicAt_put_("func",(function(){
  59786. return "hello";
  59787. }));
  59788. $ctx1.sendIdx["basicAt:put:"]=1;
  59789. $recv(o)._basicAt_put_("func2",(function(a){
  59790. return $core.withContext(function($ctx2) {
  59791. return $recv(a).__plus((1));
  59792. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59793. }));
  59794. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59795. $ctx1.sendIdx["assert:equals:"]=1;
  59796. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59797. return self;
  59798. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59799. },
  59800. args: [],
  59801. 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",
  59802. referencedClasses: ["Object"],
  59803. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59804. }),
  59805. $globals.ObjectTest);
  59806. $core.addMethod(
  59807. $core.method({
  59808. selector: "testDNU",
  59809. protocol: "tests",
  59810. fn: function (){
  59811. var self=this,$self=this;
  59812. return $core.withContext(function($ctx1) {
  59813. $self._should_raise_((function(){
  59814. return $core.withContext(function($ctx2) {
  59815. return $recv($recv($globals.Object)._new())._foo();
  59816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59817. }),$globals.MessageNotUnderstood);
  59818. return self;
  59819. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59820. },
  59821. args: [],
  59822. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59823. referencedClasses: ["Object", "MessageNotUnderstood"],
  59824. messageSends: ["should:raise:", "foo", "new"]
  59825. }),
  59826. $globals.ObjectTest);
  59827. $core.addMethod(
  59828. $core.method({
  59829. selector: "testEquality",
  59830. protocol: "tests",
  59831. fn: function (){
  59832. var self=this,$self=this;
  59833. var o;
  59834. return $core.withContext(function($ctx1) {
  59835. var $1,$2,$4,$3;
  59836. o=$recv($globals.Object)._new();
  59837. $ctx1.sendIdx["new"]=1;
  59838. $1=$recv(o).__eq($recv($globals.Object)._new());
  59839. $ctx1.sendIdx["="]=1;
  59840. $self._deny_($1);
  59841. $2=$recv(o).__eq(o);
  59842. $ctx1.sendIdx["="]=2;
  59843. $self._assert_($2);
  59844. $ctx1.sendIdx["assert:"]=1;
  59845. $4=$recv(o)._yourself();
  59846. $ctx1.sendIdx["yourself"]=1;
  59847. $3=$recv($4).__eq(o);
  59848. $ctx1.sendIdx["="]=3;
  59849. $self._assert_($3);
  59850. $ctx1.sendIdx["assert:"]=2;
  59851. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59852. return self;
  59853. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59854. },
  59855. args: [],
  59856. 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)",
  59857. referencedClasses: ["Object"],
  59858. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59859. }),
  59860. $globals.ObjectTest);
  59861. $core.addMethod(
  59862. $core.method({
  59863. selector: "testHalt",
  59864. protocol: "tests",
  59865. fn: function (){
  59866. var self=this,$self=this;
  59867. return $core.withContext(function($ctx1) {
  59868. $self._should_raise_((function(){
  59869. return $core.withContext(function($ctx2) {
  59870. return $recv($recv($globals.Object)._new())._halt();
  59871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59872. }),$globals.Error);
  59873. return self;
  59874. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59875. },
  59876. args: [],
  59877. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59878. referencedClasses: ["Object", "Error"],
  59879. messageSends: ["should:raise:", "halt", "new"]
  59880. }),
  59881. $globals.ObjectTest);
  59882. $core.addMethod(
  59883. $core.method({
  59884. selector: "testIdentity",
  59885. protocol: "tests",
  59886. fn: function (){
  59887. var self=this,$self=this;
  59888. var o;
  59889. return $core.withContext(function($ctx1) {
  59890. var $1,$2,$4,$3;
  59891. o=$recv($globals.Object)._new();
  59892. $ctx1.sendIdx["new"]=1;
  59893. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59894. $ctx1.sendIdx["=="]=1;
  59895. $self._deny_($1);
  59896. $2=$recv(o).__eq_eq(o);
  59897. $ctx1.sendIdx["=="]=2;
  59898. $self._assert_($2);
  59899. $ctx1.sendIdx["assert:"]=1;
  59900. $4=$recv(o)._yourself();
  59901. $ctx1.sendIdx["yourself"]=1;
  59902. $3=$recv($4).__eq_eq(o);
  59903. $ctx1.sendIdx["=="]=3;
  59904. $self._assert_($3);
  59905. $ctx1.sendIdx["assert:"]=2;
  59906. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59907. return self;
  59908. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59909. },
  59910. args: [],
  59911. 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",
  59912. referencedClasses: ["Object"],
  59913. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59914. }),
  59915. $globals.ObjectTest);
  59916. $core.addMethod(
  59917. $core.method({
  59918. selector: "testIfNil",
  59919. protocol: "tests",
  59920. fn: function (){
  59921. var self=this,$self=this;
  59922. return $core.withContext(function($ctx1) {
  59923. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59924. $2=$recv($globals.Object)._new();
  59925. $ctx1.sendIdx["new"]=1;
  59926. $1=$recv($2)._isNil();
  59927. $self._deny_($1);
  59928. $ctx1.sendIdx["deny:"]=1;
  59929. $5=$recv($globals.Object)._new();
  59930. $ctx1.sendIdx["new"]=2;
  59931. if(($receiver = $5) == null || $receiver.a$nil){
  59932. $4=true;
  59933. } else {
  59934. $4=$5;
  59935. }
  59936. $3=$recv($4).__eq(true);
  59937. $self._deny_($3);
  59938. $7=$recv($globals.Object)._new();
  59939. $ctx1.sendIdx["new"]=3;
  59940. if(($receiver = $7) == null || $receiver.a$nil){
  59941. $6=$7;
  59942. } else {
  59943. $6=true;
  59944. }
  59945. $self._assert_equals_($6,true);
  59946. $ctx1.sendIdx["assert:equals:"]=1;
  59947. $9=$recv($globals.Object)._new();
  59948. $ctx1.sendIdx["new"]=4;
  59949. if(($receiver = $9) == null || $receiver.a$nil){
  59950. $8=false;
  59951. } else {
  59952. $8=true;
  59953. }
  59954. $self._assert_equals_($8,true);
  59955. $ctx1.sendIdx["assert:equals:"]=2;
  59956. $11=$recv($globals.Object)._new();
  59957. if(($receiver = $11) == null || $receiver.a$nil){
  59958. $10=false;
  59959. } else {
  59960. $10=true;
  59961. }
  59962. $self._assert_equals_($10,true);
  59963. return self;
  59964. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59965. },
  59966. args: [],
  59967. 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",
  59968. referencedClasses: ["Object"],
  59969. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59970. }),
  59971. $globals.ObjectTest);
  59972. $core.addMethod(
  59973. $core.method({
  59974. selector: "testInstVars",
  59975. protocol: "tests",
  59976. fn: function (){
  59977. var self=this,$self=this;
  59978. var o;
  59979. return $core.withContext(function($ctx1) {
  59980. var $1,$2;
  59981. o=$recv($globals.ObjectMock)._new();
  59982. $1=$recv(o)._instVarAt_("foo");
  59983. $ctx1.sendIdx["instVarAt:"]=1;
  59984. $self._assert_equals_($1,nil);
  59985. $ctx1.sendIdx["assert:equals:"]=1;
  59986. $recv(o)._instVarAt_put_("foo",(1));
  59987. $2=$recv(o)._instVarAt_("foo");
  59988. $ctx1.sendIdx["instVarAt:"]=2;
  59989. $self._assert_equals_($2,(1));
  59990. $ctx1.sendIdx["assert:equals:"]=2;
  59991. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59992. return self;
  59993. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59994. },
  59995. args: [],
  59996. 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",
  59997. referencedClasses: ["ObjectMock"],
  59998. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59999. }),
  60000. $globals.ObjectTest);
  60001. $core.addMethod(
  60002. $core.method({
  60003. selector: "testNilUndefined",
  60004. protocol: "tests",
  60005. fn: function (){
  60006. var self=this,$self=this;
  60007. return $core.withContext(function($ctx1) {
  60008. $self._assert_equals_($self._notDefined(),nil);
  60009. return self;
  60010. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  60011. },
  60012. args: [],
  60013. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  60014. referencedClasses: [],
  60015. messageSends: ["assert:equals:", "notDefined"]
  60016. }),
  60017. $globals.ObjectTest);
  60018. $core.addMethod(
  60019. $core.method({
  60020. selector: "testYourself",
  60021. protocol: "tests",
  60022. fn: function (){
  60023. var self=this,$self=this;
  60024. var o;
  60025. return $core.withContext(function($ctx1) {
  60026. o=$recv($globals.ObjectMock)._new();
  60027. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  60028. return self;
  60029. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  60030. },
  60031. args: [],
  60032. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  60033. referencedClasses: ["ObjectMock"],
  60034. messageSends: ["new", "assert:", "==", "yourself"]
  60035. }),
  60036. $globals.ObjectTest);
  60037. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  60038. $core.addMethod(
  60039. $core.method({
  60040. selector: "testAccessing",
  60041. protocol: "tests",
  60042. fn: function (){
  60043. var self=this,$self=this;
  60044. return $core.withContext(function($ctx1) {
  60045. var $2,$1,$3,$6,$5,$4;
  60046. $2=$recv($globals.Point)._x_y_((3),(4));
  60047. $ctx1.sendIdx["x:y:"]=1;
  60048. $1=$recv($2)._x();
  60049. $ctx1.sendIdx["x"]=1;
  60050. $self._assert_equals_($1,(3));
  60051. $ctx1.sendIdx["assert:equals:"]=1;
  60052. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  60053. $ctx1.sendIdx["y"]=1;
  60054. $self._assert_equals_($3,(4));
  60055. $ctx1.sendIdx["assert:equals:"]=2;
  60056. $6=$recv($globals.Point)._new();
  60057. $ctx1.sendIdx["new"]=1;
  60058. $5=$recv($6)._x_((3));
  60059. $4=$recv($5)._x();
  60060. $self._assert_equals_($4,(3));
  60061. $ctx1.sendIdx["assert:equals:"]=3;
  60062. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  60063. return self;
  60064. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  60065. },
  60066. args: [],
  60067. 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",
  60068. referencedClasses: ["Point"],
  60069. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  60070. }),
  60071. $globals.PointTest);
  60072. $core.addMethod(
  60073. $core.method({
  60074. selector: "testAngle",
  60075. protocol: "tests",
  60076. fn: function (){
  60077. var self=this,$self=this;
  60078. return $core.withContext(function($ctx1) {
  60079. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  60080. return self;
  60081. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  60082. },
  60083. args: [],
  60084. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  60085. referencedClasses: ["Number"],
  60086. messageSends: ["assert:equals:", "angle", "@", "pi"]
  60087. }),
  60088. $globals.PointTest);
  60089. $core.addMethod(
  60090. $core.method({
  60091. selector: "testArithmetic",
  60092. protocol: "tests",
  60093. fn: function (){
  60094. var self=this,$self=this;
  60095. return $core.withContext(function($ctx1) {
  60096. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  60097. $2=(3).__at((4));
  60098. $ctx1.sendIdx["@"]=1;
  60099. $3=(3).__at((4));
  60100. $ctx1.sendIdx["@"]=2;
  60101. $1=$recv($2).__star($3);
  60102. $4=$recv($globals.Point)._x_y_((9),(16));
  60103. $ctx1.sendIdx["x:y:"]=1;
  60104. $self._assert_equals_($1,$4);
  60105. $ctx1.sendIdx["assert:equals:"]=1;
  60106. $6=(3).__at((4));
  60107. $ctx1.sendIdx["@"]=3;
  60108. $7=(3).__at((4));
  60109. $ctx1.sendIdx["@"]=4;
  60110. $5=$recv($6).__plus($7);
  60111. $8=$recv($globals.Point)._x_y_((6),(8));
  60112. $ctx1.sendIdx["x:y:"]=2;
  60113. $self._assert_equals_($5,$8);
  60114. $ctx1.sendIdx["assert:equals:"]=2;
  60115. $10=(3).__at((4));
  60116. $ctx1.sendIdx["@"]=5;
  60117. $11=(3).__at((4));
  60118. $ctx1.sendIdx["@"]=6;
  60119. $9=$recv($10).__minus($11);
  60120. $12=$recv($globals.Point)._x_y_((0),(0));
  60121. $ctx1.sendIdx["x:y:"]=3;
  60122. $self._assert_equals_($9,$12);
  60123. $ctx1.sendIdx["assert:equals:"]=3;
  60124. $14=(6).__at((8));
  60125. $ctx1.sendIdx["@"]=7;
  60126. $13=$recv($14).__slash((3).__at((4)));
  60127. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60128. return self;
  60129. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60130. },
  60131. args: [],
  60132. 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)",
  60133. referencedClasses: ["Point"],
  60134. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60135. }),
  60136. $globals.PointTest);
  60137. $core.addMethod(
  60138. $core.method({
  60139. selector: "testAt",
  60140. protocol: "tests",
  60141. fn: function (){
  60142. var self=this,$self=this;
  60143. return $core.withContext(function($ctx1) {
  60144. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60145. return self;
  60146. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60147. },
  60148. args: [],
  60149. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60150. referencedClasses: ["Point"],
  60151. messageSends: ["assert:equals:", "@", "x:y:"]
  60152. }),
  60153. $globals.PointTest);
  60154. $core.addMethod(
  60155. $core.method({
  60156. selector: "testComparison",
  60157. protocol: "tests",
  60158. fn: function (){
  60159. var self=this,$self=this;
  60160. return $core.withContext(function($ctx1) {
  60161. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60162. $2=(3).__at((4));
  60163. $ctx1.sendIdx["@"]=1;
  60164. $3=(4).__at((5));
  60165. $ctx1.sendIdx["@"]=2;
  60166. $1=$recv($2).__lt($3);
  60167. $ctx1.sendIdx["<"]=1;
  60168. $self._assert_($1);
  60169. $ctx1.sendIdx["assert:"]=1;
  60170. $5=(3).__at((4));
  60171. $ctx1.sendIdx["@"]=3;
  60172. $6=(4).__at((4));
  60173. $ctx1.sendIdx["@"]=4;
  60174. $4=$recv($5).__lt($6);
  60175. $self._deny_($4);
  60176. $ctx1.sendIdx["deny:"]=1;
  60177. $8=(4).__at((5));
  60178. $ctx1.sendIdx["@"]=5;
  60179. $9=(4).__at((5));
  60180. $ctx1.sendIdx["@"]=6;
  60181. $7=$recv($8).__lt_eq($9);
  60182. $ctx1.sendIdx["<="]=1;
  60183. $self._assert_($7);
  60184. $ctx1.sendIdx["assert:"]=2;
  60185. $11=(4).__at((5));
  60186. $ctx1.sendIdx["@"]=7;
  60187. $12=(3).__at((5));
  60188. $ctx1.sendIdx["@"]=8;
  60189. $10=$recv($11).__lt_eq($12);
  60190. $self._deny_($10);
  60191. $ctx1.sendIdx["deny:"]=2;
  60192. $14=(5).__at((6));
  60193. $ctx1.sendIdx["@"]=9;
  60194. $15=(4).__at((5));
  60195. $ctx1.sendIdx["@"]=10;
  60196. $13=$recv($14).__gt($15);
  60197. $ctx1.sendIdx[">"]=1;
  60198. $self._assert_($13);
  60199. $ctx1.sendIdx["assert:"]=3;
  60200. $17=(5).__at((6));
  60201. $ctx1.sendIdx["@"]=11;
  60202. $18=(6).__at((6));
  60203. $ctx1.sendIdx["@"]=12;
  60204. $16=$recv($17).__gt($18);
  60205. $self._deny_($16);
  60206. $ctx1.sendIdx["deny:"]=3;
  60207. $20=(4).__at((5));
  60208. $ctx1.sendIdx["@"]=13;
  60209. $21=(4).__at((5));
  60210. $ctx1.sendIdx["@"]=14;
  60211. $19=$recv($20).__gt_eq($21);
  60212. $ctx1.sendIdx[">="]=1;
  60213. $self._assert_($19);
  60214. $23=(4).__at((5));
  60215. $ctx1.sendIdx["@"]=15;
  60216. $22=$recv($23).__gt_eq((5).__at((5)));
  60217. $self._deny_($22);
  60218. return self;
  60219. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60220. },
  60221. args: [],
  60222. 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)",
  60223. referencedClasses: [],
  60224. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60225. }),
  60226. $globals.PointTest);
  60227. $core.addMethod(
  60228. $core.method({
  60229. selector: "testDotProduct",
  60230. protocol: "tests",
  60231. fn: function (){
  60232. var self=this,$self=this;
  60233. return $core.withContext(function($ctx1) {
  60234. var $2,$1;
  60235. $2=(2).__at((3));
  60236. $ctx1.sendIdx["@"]=1;
  60237. $1=$recv($2)._dotProduct_((3).__at((7)));
  60238. $self._assert_equals_($1,(27));
  60239. return self;
  60240. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60241. },
  60242. args: [],
  60243. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60244. referencedClasses: [],
  60245. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60246. }),
  60247. $globals.PointTest);
  60248. $core.addMethod(
  60249. $core.method({
  60250. selector: "testEgality",
  60251. protocol: "tests",
  60252. fn: function (){
  60253. var self=this,$self=this;
  60254. return $core.withContext(function($ctx1) {
  60255. var $2,$3,$1,$5,$4;
  60256. $2=(3).__at((4));
  60257. $ctx1.sendIdx["@"]=1;
  60258. $3=(3).__at((4));
  60259. $ctx1.sendIdx["@"]=2;
  60260. $1=$recv($2).__eq($3);
  60261. $ctx1.sendIdx["="]=1;
  60262. $self._assert_($1);
  60263. $5=(3).__at((5));
  60264. $ctx1.sendIdx["@"]=3;
  60265. $4=$recv($5).__eq((3).__at((6)));
  60266. $self._deny_($4);
  60267. return self;
  60268. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60269. },
  60270. args: [],
  60271. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60272. referencedClasses: [],
  60273. messageSends: ["assert:", "=", "@", "deny:"]
  60274. }),
  60275. $globals.PointTest);
  60276. $core.addMethod(
  60277. $core.method({
  60278. selector: "testNew",
  60279. protocol: "tests",
  60280. fn: function (){
  60281. var self=this,$self=this;
  60282. return $core.withContext(function($ctx1) {
  60283. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60284. $3=$recv($globals.Point)._new();
  60285. $ctx1.sendIdx["new"]=1;
  60286. $2=$recv($3)._x_((3));
  60287. $ctx1.sendIdx["x:"]=1;
  60288. $1=$recv($2)._y();
  60289. $ctx1.sendIdx["y"]=1;
  60290. $self._assert_equals_($1,nil);
  60291. $ctx1.sendIdx["assert:equals:"]=1;
  60292. $7=$recv($globals.Point)._new();
  60293. $ctx1.sendIdx["new"]=2;
  60294. $6=$recv($7)._x_((3));
  60295. $5=$recv($6)._x();
  60296. $ctx1.sendIdx["x"]=1;
  60297. $4=$recv($5).__eq((0));
  60298. $ctx1.sendIdx["="]=1;
  60299. $self._deny_($4);
  60300. $ctx1.sendIdx["deny:"]=1;
  60301. $10=$recv($globals.Point)._new();
  60302. $ctx1.sendIdx["new"]=3;
  60303. $9=$recv($10)._y_((4));
  60304. $ctx1.sendIdx["y:"]=1;
  60305. $8=$recv($9)._x();
  60306. $self._assert_equals_($8,nil);
  60307. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60308. return self;
  60309. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60310. },
  60311. args: [],
  60312. 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",
  60313. referencedClasses: ["Point"],
  60314. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60315. }),
  60316. $globals.PointTest);
  60317. $core.addMethod(
  60318. $core.method({
  60319. selector: "testNormal",
  60320. protocol: "tests",
  60321. fn: function (){
  60322. var self=this,$self=this;
  60323. return $core.withContext(function($ctx1) {
  60324. var $2,$1;
  60325. $2=(1).__at((0));
  60326. $ctx1.sendIdx["@"]=1;
  60327. $1=$recv($2)._normal();
  60328. $self._assert_equals_($1,(0).__at((1)));
  60329. return self;
  60330. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60331. },
  60332. args: [],
  60333. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60334. referencedClasses: [],
  60335. messageSends: ["assert:equals:", "normal", "@"]
  60336. }),
  60337. $globals.PointTest);
  60338. $core.addMethod(
  60339. $core.method({
  60340. selector: "testNormalized",
  60341. protocol: "tests",
  60342. fn: function (){
  60343. var self=this,$self=this;
  60344. return $core.withContext(function($ctx1) {
  60345. var $2,$1,$3,$5,$4;
  60346. $2=(0).__at((2));
  60347. $ctx1.sendIdx["@"]=1;
  60348. $1=$recv($2)._normalized();
  60349. $ctx1.sendIdx["normalized"]=1;
  60350. $3=(0).__at((1));
  60351. $ctx1.sendIdx["@"]=2;
  60352. $self._assert_equals_($1,$3);
  60353. $ctx1.sendIdx["assert:equals:"]=1;
  60354. $5=(0).__at((0));
  60355. $ctx1.sendIdx["@"]=3;
  60356. $4=$recv($5)._normalized();
  60357. $self._assert_equals_($4,(0).__at((0)));
  60358. return self;
  60359. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60360. },
  60361. args: [],
  60362. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60363. referencedClasses: [],
  60364. messageSends: ["assert:equals:", "normalized", "@"]
  60365. }),
  60366. $globals.PointTest);
  60367. $core.addMethod(
  60368. $core.method({
  60369. selector: "testPolarCoordinates",
  60370. protocol: "tests",
  60371. fn: function (){
  60372. var self=this,$self=this;
  60373. return $core.withContext(function($ctx1) {
  60374. var $2,$1;
  60375. $2=(1).__at((0));
  60376. $ctx1.sendIdx["@"]=1;
  60377. $1=$recv($2)._r();
  60378. $ctx1.sendIdx["r"]=1;
  60379. $self._assert_equals_($1,(1));
  60380. $ctx1.sendIdx["assert:equals:"]=1;
  60381. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60382. return self;
  60383. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60384. },
  60385. args: [],
  60386. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60387. referencedClasses: [],
  60388. messageSends: ["assert:equals:", "r", "@"]
  60389. }),
  60390. $globals.PointTest);
  60391. $core.addMethod(
  60392. $core.method({
  60393. selector: "testRectangleCreation",
  60394. protocol: "tests",
  60395. fn: function (){
  60396. var self=this,$self=this;
  60397. return $core.withContext(function($ctx1) {
  60398. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60399. $2=(1).__at((1));
  60400. $ctx1.sendIdx["@"]=1;
  60401. $3=(2).__at((2));
  60402. $ctx1.sendIdx["@"]=2;
  60403. $1=$recv($2)._corner_($3);
  60404. $5=(1).__at((1));
  60405. $ctx1.sendIdx["@"]=3;
  60406. $6=(2).__at((2));
  60407. $ctx1.sendIdx["@"]=4;
  60408. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60409. $self._assert_equals_($1,$4);
  60410. $ctx1.sendIdx["assert:equals:"]=1;
  60411. $8=(1).__at((1));
  60412. $ctx1.sendIdx["@"]=5;
  60413. $9=(2).__at((2));
  60414. $ctx1.sendIdx["@"]=6;
  60415. $7=$recv($8)._rectangle_($9);
  60416. $11=(1).__at((1));
  60417. $ctx1.sendIdx["@"]=7;
  60418. $12=(2).__at((2));
  60419. $ctx1.sendIdx["@"]=8;
  60420. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60421. $self._assert_equals_($7,$10);
  60422. $ctx1.sendIdx["assert:equals:"]=2;
  60423. $14=(1).__at((1));
  60424. $ctx1.sendIdx["@"]=9;
  60425. $15=(2).__at((2));
  60426. $ctx1.sendIdx["@"]=10;
  60427. $13=$recv($14)._extent_($15);
  60428. $17=(1).__at((1));
  60429. $ctx1.sendIdx["@"]=11;
  60430. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60431. $self._assert_equals_($13,$16);
  60432. return self;
  60433. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60434. },
  60435. args: [],
  60436. 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)",
  60437. referencedClasses: ["Rectangle"],
  60438. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60439. }),
  60440. $globals.PointTest);
  60441. $core.addMethod(
  60442. $core.method({
  60443. selector: "testTranslateBy",
  60444. protocol: "tests",
  60445. fn: function (){
  60446. var self=this,$self=this;
  60447. return $core.withContext(function($ctx1) {
  60448. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60449. $2=(3).__at((3));
  60450. $ctx1.sendIdx["@"]=1;
  60451. $3=(0).__at((1));
  60452. $ctx1.sendIdx["@"]=2;
  60453. $1=$recv($2)._translateBy_($3);
  60454. $ctx1.sendIdx["translateBy:"]=1;
  60455. $4=(3).__at((4));
  60456. $ctx1.sendIdx["@"]=3;
  60457. $self._assert_equals_($1,$4);
  60458. $ctx1.sendIdx["assert:equals:"]=1;
  60459. $6=(3).__at((3));
  60460. $ctx1.sendIdx["@"]=4;
  60461. $8=(1)._negated();
  60462. $ctx1.sendIdx["negated"]=1;
  60463. $7=(0).__at($8);
  60464. $ctx1.sendIdx["@"]=5;
  60465. $5=$recv($6)._translateBy_($7);
  60466. $ctx1.sendIdx["translateBy:"]=2;
  60467. $9=(3).__at((2));
  60468. $ctx1.sendIdx["@"]=6;
  60469. $self._assert_equals_($5,$9);
  60470. $ctx1.sendIdx["assert:equals:"]=2;
  60471. $11=(3).__at((3));
  60472. $ctx1.sendIdx["@"]=7;
  60473. $12=(2).__at((3));
  60474. $ctx1.sendIdx["@"]=8;
  60475. $10=$recv($11)._translateBy_($12);
  60476. $ctx1.sendIdx["translateBy:"]=3;
  60477. $13=(5).__at((6));
  60478. $ctx1.sendIdx["@"]=9;
  60479. $self._assert_equals_($10,$13);
  60480. $ctx1.sendIdx["assert:equals:"]=3;
  60481. $15=(3).__at((3));
  60482. $ctx1.sendIdx["@"]=10;
  60483. $16=$recv((3)._negated()).__at((0));
  60484. $ctx1.sendIdx["@"]=11;
  60485. $14=$recv($15)._translateBy_($16);
  60486. $self._assert_equals_($14,(0).__at((3)));
  60487. return self;
  60488. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60489. },
  60490. args: [],
  60491. 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.",
  60492. referencedClasses: [],
  60493. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60494. }),
  60495. $globals.PointTest);
  60496. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60497. $core.addMethod(
  60498. $core.method({
  60499. selector: "testNextIfAbsent",
  60500. protocol: "tests",
  60501. fn: function (){
  60502. var self=this,$self=this;
  60503. var queue;
  60504. return $core.withContext(function($ctx1) {
  60505. var $2,$1;
  60506. queue=$recv($globals.Queue)._new();
  60507. $recv(queue)._nextPut_("index1");
  60508. $2=$recv(queue)._nextIfAbsent_("empty");
  60509. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60510. $1=$recv($2).__eq("index1");
  60511. $ctx1.sendIdx["="]=1;
  60512. $self._assert_($1);
  60513. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60514. return self;
  60515. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60516. },
  60517. args: [],
  60518. 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'",
  60519. referencedClasses: ["Queue"],
  60520. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60521. }),
  60522. $globals.QueueTest);
  60523. $core.addMethod(
  60524. $core.method({
  60525. selector: "testQueueNext",
  60526. protocol: "tests",
  60527. fn: function (){
  60528. var self=this,$self=this;
  60529. var queue;
  60530. return $core.withContext(function($ctx1) {
  60531. var $1,$3,$2,$5,$4;
  60532. queue=$recv($globals.Queue)._new();
  60533. $1=queue;
  60534. $recv($1)._nextPut_("index1");
  60535. $ctx1.sendIdx["nextPut:"]=1;
  60536. $recv($1)._nextPut_("index2");
  60537. $3=$recv(queue)._next();
  60538. $ctx1.sendIdx["next"]=1;
  60539. $2=$recv($3).__eq("index1");
  60540. $ctx1.sendIdx["="]=1;
  60541. $self._assert_($2);
  60542. $5=$recv(queue)._next();
  60543. $ctx1.sendIdx["next"]=2;
  60544. $4=$recv($5).__eq("index");
  60545. $self._deny_($4);
  60546. $self._should_raise_((function(){
  60547. return $core.withContext(function($ctx2) {
  60548. return $recv(queue)._next();
  60549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60550. }),$globals.Error);
  60551. return self;
  60552. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60553. },
  60554. args: [],
  60555. 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",
  60556. referencedClasses: ["Queue", "Error"],
  60557. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60558. }),
  60559. $globals.QueueTest);
  60560. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60561. $core.addMethod(
  60562. $core.method({
  60563. selector: "testAtRandomNumber",
  60564. protocol: "tests",
  60565. fn: function (){
  60566. var self=this,$self=this;
  60567. var val;
  60568. return $core.withContext(function($ctx1) {
  60569. (100)._timesRepeat_((function(){
  60570. return $core.withContext(function($ctx2) {
  60571. val=(10)._atRandom();
  60572. $self._assert_($recv(val).__gt((0)));
  60573. $ctx2.sendIdx["assert:"]=1;
  60574. return $self._assert_($recv(val).__lt((11)));
  60575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60576. }));
  60577. return self;
  60578. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60579. },
  60580. args: [],
  60581. 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]",
  60582. referencedClasses: [],
  60583. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60584. }),
  60585. $globals.RandomTest);
  60586. $core.addMethod(
  60587. $core.method({
  60588. selector: "testAtRandomSequenceableCollection",
  60589. protocol: "tests",
  60590. fn: function (){
  60591. var self=this,$self=this;
  60592. var val;
  60593. return $core.withContext(function($ctx1) {
  60594. var $3,$4,$2,$1;
  60595. (100)._timesRepeat_((function(){
  60596. return $core.withContext(function($ctx2) {
  60597. val="abc"._atRandom();
  60598. $3=$recv(val).__eq("a");
  60599. $ctx2.sendIdx["="]=1;
  60600. $4=$recv(val).__eq("b");
  60601. $ctx2.sendIdx["="]=2;
  60602. $2=$recv($3).__or($4);
  60603. $1=$recv($2).__or($recv(val).__eq("c"));
  60604. $ctx2.sendIdx["|"]=1;
  60605. return $self._assert_($1);
  60606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60607. }));
  60608. return self;
  60609. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60610. },
  60611. args: [],
  60612. 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].",
  60613. referencedClasses: [],
  60614. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60615. }),
  60616. $globals.RandomTest);
  60617. $core.addMethod(
  60618. $core.method({
  60619. selector: "textNext",
  60620. protocol: "tests",
  60621. fn: function (){
  60622. var self=this,$self=this;
  60623. return $core.withContext(function($ctx1) {
  60624. var $1;
  60625. (10000)._timesRepeat_((function(){
  60626. var current,next;
  60627. return $core.withContext(function($ctx2) {
  60628. next=$recv($recv($globals.Random)._new())._next();
  60629. $self._assert_($recv(next).__gt_eq((0)));
  60630. $ctx2.sendIdx["assert:"]=1;
  60631. $self._assert_($recv(next).__lt((1)));
  60632. $1=$recv(current).__eq(next);
  60633. $ctx2.sendIdx["="]=1;
  60634. $self._deny_($1);
  60635. return $recv(next).__eq(current);
  60636. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60637. }));
  60638. return self;
  60639. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60640. },
  60641. args: [],
  60642. 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 ]",
  60643. referencedClasses: ["Random"],
  60644. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60645. }),
  60646. $globals.RandomTest);
  60647. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60648. $core.addMethod(
  60649. $core.method({
  60650. selector: "testContainsPoint",
  60651. protocol: "tests",
  60652. fn: function (){
  60653. var self=this,$self=this;
  60654. var rect;
  60655. return $core.withContext(function($ctx1) {
  60656. var $1,$2,$4,$5,$3;
  60657. $1=(0).__at((0));
  60658. $ctx1.sendIdx["@"]=1;
  60659. $2=(4).__at((4));
  60660. $ctx1.sendIdx["@"]=2;
  60661. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60662. $4=rect;
  60663. $5=(1).__at((2));
  60664. $ctx1.sendIdx["@"]=3;
  60665. $3=$recv($4)._containsPoint_($5);
  60666. $ctx1.sendIdx["containsPoint:"]=1;
  60667. $self._assert_($3);
  60668. $ctx1.sendIdx["assert:"]=1;
  60669. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60670. return self;
  60671. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60672. },
  60673. args: [],
  60674. 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.",
  60675. referencedClasses: ["Rectangle"],
  60676. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60677. }),
  60678. $globals.RectangleTest);
  60679. $core.addMethod(
  60680. $core.method({
  60681. selector: "testContainsRect",
  60682. protocol: "tests",
  60683. fn: function (){
  60684. var self=this,$self=this;
  60685. return $core.withContext(function($ctx1) {
  60686. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60687. $3=(0).__at((0));
  60688. $ctx1.sendIdx["@"]=1;
  60689. $4=(6).__at((6));
  60690. $ctx1.sendIdx["@"]=2;
  60691. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60692. $ctx1.sendIdx["origin:corner:"]=1;
  60693. $6=(1).__at((1));
  60694. $ctx1.sendIdx["@"]=3;
  60695. $7=(5).__at((5));
  60696. $ctx1.sendIdx["@"]=4;
  60697. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60698. $ctx1.sendIdx["origin:corner:"]=2;
  60699. $1=$recv($2)._containsRect_($5);
  60700. $ctx1.sendIdx["containsRect:"]=1;
  60701. $self._assert_($1);
  60702. $ctx1.sendIdx["assert:"]=1;
  60703. $11=(0).__at((0));
  60704. $ctx1.sendIdx["@"]=5;
  60705. $12=(6).__at((6));
  60706. $ctx1.sendIdx["@"]=6;
  60707. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60708. $ctx1.sendIdx["origin:corner:"]=3;
  60709. $14=(1).__at((-1));
  60710. $ctx1.sendIdx["@"]=7;
  60711. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60712. $9=$recv($10)._containsRect_($13);
  60713. $8=$recv($9)._not();
  60714. $self._assert_($8);
  60715. return self;
  60716. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60717. },
  60718. args: [],
  60719. 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.",
  60720. referencedClasses: ["Rectangle"],
  60721. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60722. }),
  60723. $globals.RectangleTest);
  60724. $core.addMethod(
  60725. $core.method({
  60726. selector: "testOriginExtent",
  60727. protocol: "tests",
  60728. fn: function (){
  60729. var self=this,$self=this;
  60730. var rectangle;
  60731. return $core.withContext(function($ctx1) {
  60732. var $1,$2,$3,$4;
  60733. $1=(3).__at((4));
  60734. $ctx1.sendIdx["@"]=1;
  60735. $2=(7).__at((8));
  60736. $ctx1.sendIdx["@"]=2;
  60737. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60738. $3=$recv(rectangle)._origin();
  60739. $4=(3).__at((4));
  60740. $ctx1.sendIdx["@"]=3;
  60741. $self._assert_equals_($3,$4);
  60742. $ctx1.sendIdx["assert:equals:"]=1;
  60743. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60744. return self;
  60745. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60746. },
  60747. args: [],
  60748. 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.",
  60749. referencedClasses: ["Rectangle"],
  60750. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60751. }),
  60752. $globals.RectangleTest);
  60753. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60754. $core.addMethod(
  60755. $core.method({
  60756. selector: "collectionClass",
  60757. protocol: "accessing",
  60758. fn: function (){
  60759. var self=this,$self=this;
  60760. return $core.withContext(function($ctx1) {
  60761. return $recv($self._class())._collectionClass();
  60762. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60763. },
  60764. args: [],
  60765. source: "collectionClass\x0a\x09^ self class collectionClass",
  60766. referencedClasses: [],
  60767. messageSends: ["collectionClass", "class"]
  60768. }),
  60769. $globals.StreamTest);
  60770. $core.addMethod(
  60771. $core.method({
  60772. selector: "newCollection",
  60773. protocol: "accessing",
  60774. fn: function (){
  60775. var self=this,$self=this;
  60776. return $core.withContext(function($ctx1) {
  60777. return $recv($self._collectionClass())._new();
  60778. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60779. },
  60780. args: [],
  60781. source: "newCollection\x0a\x09^ self collectionClass new",
  60782. referencedClasses: [],
  60783. messageSends: ["new", "collectionClass"]
  60784. }),
  60785. $globals.StreamTest);
  60786. $core.addMethod(
  60787. $core.method({
  60788. selector: "newStream",
  60789. protocol: "accessing",
  60790. fn: function (){
  60791. var self=this,$self=this;
  60792. return $core.withContext(function($ctx1) {
  60793. return $recv($recv($self._collectionClass())._new())._stream();
  60794. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60795. },
  60796. args: [],
  60797. source: "newStream\x0a\x09^ self collectionClass new stream",
  60798. referencedClasses: [],
  60799. messageSends: ["stream", "new", "collectionClass"]
  60800. }),
  60801. $globals.StreamTest);
  60802. $core.addMethod(
  60803. $core.method({
  60804. selector: "testAtStartAtEnd",
  60805. protocol: "tests",
  60806. fn: function (){
  60807. var self=this,$self=this;
  60808. var stream;
  60809. return $core.withContext(function($ctx1) {
  60810. var $1,$2,$3,$4;
  60811. stream=$self._newStream();
  60812. $1=$recv(stream)._atStart();
  60813. $ctx1.sendIdx["atStart"]=1;
  60814. $self._assert_($1);
  60815. $ctx1.sendIdx["assert:"]=1;
  60816. $2=$recv(stream)._atEnd();
  60817. $ctx1.sendIdx["atEnd"]=1;
  60818. $self._assert_($2);
  60819. $ctx1.sendIdx["assert:"]=2;
  60820. $recv(stream)._nextPutAll_($self._newCollection());
  60821. $3=$recv(stream)._atEnd();
  60822. $ctx1.sendIdx["atEnd"]=2;
  60823. $self._assert_($3);
  60824. $4=$recv(stream)._atStart();
  60825. $ctx1.sendIdx["atStart"]=2;
  60826. $self._deny_($4);
  60827. $ctx1.sendIdx["deny:"]=1;
  60828. $recv(stream)._position_((1));
  60829. $self._deny_($recv(stream)._atEnd());
  60830. $ctx1.sendIdx["deny:"]=2;
  60831. $self._deny_($recv(stream)._atStart());
  60832. return self;
  60833. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60834. },
  60835. args: [],
  60836. 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",
  60837. referencedClasses: [],
  60838. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60839. }),
  60840. $globals.StreamTest);
  60841. $core.addMethod(
  60842. $core.method({
  60843. selector: "testContents",
  60844. protocol: "tests",
  60845. fn: function (){
  60846. var self=this,$self=this;
  60847. var stream;
  60848. return $core.withContext(function($ctx1) {
  60849. var $1,$2;
  60850. stream=$self._newStream();
  60851. $1=stream;
  60852. $2=$self._newCollection();
  60853. $ctx1.sendIdx["newCollection"]=1;
  60854. $recv($1)._nextPutAll_($2);
  60855. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60856. return self;
  60857. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60858. },
  60859. args: [],
  60860. 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",
  60861. referencedClasses: [],
  60862. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60863. }),
  60864. $globals.StreamTest);
  60865. $core.addMethod(
  60866. $core.method({
  60867. selector: "testIsEmpty",
  60868. protocol: "tests",
  60869. fn: function (){
  60870. var self=this,$self=this;
  60871. var stream;
  60872. return $core.withContext(function($ctx1) {
  60873. var $1;
  60874. stream=$self._newStream();
  60875. $1=$recv(stream)._isEmpty();
  60876. $ctx1.sendIdx["isEmpty"]=1;
  60877. $self._assert_($1);
  60878. $recv(stream)._nextPutAll_($self._newCollection());
  60879. $self._deny_($recv(stream)._isEmpty());
  60880. return self;
  60881. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60882. },
  60883. args: [],
  60884. 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",
  60885. referencedClasses: [],
  60886. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60887. }),
  60888. $globals.StreamTest);
  60889. $core.addMethod(
  60890. $core.method({
  60891. selector: "testPosition",
  60892. protocol: "tests",
  60893. fn: function (){
  60894. var self=this,$self=this;
  60895. var collection,stream;
  60896. return $core.withContext(function($ctx1) {
  60897. var $1,$2,$3;
  60898. collection=$self._newCollection();
  60899. stream=$self._newStream();
  60900. $recv(stream)._nextPutAll_(collection);
  60901. $1=$recv(stream)._position();
  60902. $ctx1.sendIdx["position"]=1;
  60903. $self._assert_equals_($1,$recv(collection)._size());
  60904. $ctx1.sendIdx["assert:equals:"]=1;
  60905. $recv(stream)._position_((0));
  60906. $2=$recv(stream)._position();
  60907. $ctx1.sendIdx["position"]=2;
  60908. $self._assert_equals_($2,(0));
  60909. $ctx1.sendIdx["assert:equals:"]=2;
  60910. $recv(stream)._next();
  60911. $ctx1.sendIdx["next"]=1;
  60912. $3=$recv(stream)._position();
  60913. $ctx1.sendIdx["position"]=3;
  60914. $self._assert_equals_($3,(1));
  60915. $ctx1.sendIdx["assert:equals:"]=3;
  60916. $recv(stream)._next();
  60917. $self._assert_equals_($recv(stream)._position(),(2));
  60918. return self;
  60919. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60920. },
  60921. args: [],
  60922. 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",
  60923. referencedClasses: [],
  60924. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60925. }),
  60926. $globals.StreamTest);
  60927. $core.addMethod(
  60928. $core.method({
  60929. selector: "testReading",
  60930. protocol: "tests",
  60931. fn: function (){
  60932. var self=this,$self=this;
  60933. var stream,collection;
  60934. return $core.withContext(function($ctx1) {
  60935. var $1,$2;
  60936. collection=$self._newCollection();
  60937. stream=$self._newStream();
  60938. $1=stream;
  60939. $recv($1)._nextPutAll_(collection);
  60940. $recv($1)._position_((0));
  60941. $recv(collection)._do_((function(each){
  60942. return $core.withContext(function($ctx2) {
  60943. $2=$recv(stream)._next();
  60944. $ctx2.sendIdx["next"]=1;
  60945. return $self._assert_equals_($2,each);
  60946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60947. }));
  60948. $self._assert_($recv($recv(stream)._next())._isNil());
  60949. return self;
  60950. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60951. },
  60952. args: [],
  60953. 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",
  60954. referencedClasses: [],
  60955. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60956. }),
  60957. $globals.StreamTest);
  60958. $core.addMethod(
  60959. $core.method({
  60960. selector: "testStreamContents",
  60961. protocol: "tests",
  60962. fn: function (){
  60963. var self=this,$self=this;
  60964. return self;
  60965. },
  60966. args: [],
  60967. source: "testStreamContents",
  60968. referencedClasses: [],
  60969. messageSends: []
  60970. }),
  60971. $globals.StreamTest);
  60972. $core.addMethod(
  60973. $core.method({
  60974. selector: "testWrite",
  60975. protocol: "tests",
  60976. fn: function (){
  60977. var self=this,$self=this;
  60978. var stream,collection;
  60979. return $core.withContext(function($ctx1) {
  60980. collection=$self._newCollection();
  60981. stream=$self._newStream();
  60982. $recv(collection)._do_((function(each){
  60983. return $core.withContext(function($ctx2) {
  60984. return $recv(stream).__lt_lt(each);
  60985. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60986. }));
  60987. $self._assert_equals_($recv(stream)._contents(),collection);
  60988. return self;
  60989. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60990. },
  60991. args: [],
  60992. 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",
  60993. referencedClasses: [],
  60994. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60995. }),
  60996. $globals.StreamTest);
  60997. $core.addMethod(
  60998. $core.method({
  60999. selector: "testWriting",
  61000. protocol: "tests",
  61001. fn: function (){
  61002. var self=this,$self=this;
  61003. var stream,collection;
  61004. return $core.withContext(function($ctx1) {
  61005. var $1;
  61006. collection=$self._newCollection();
  61007. stream=$self._newStream();
  61008. $ctx1.sendIdx["newStream"]=1;
  61009. $recv(collection)._do_((function(each){
  61010. return $core.withContext(function($ctx2) {
  61011. return $recv(stream)._nextPut_(each);
  61012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61013. }));
  61014. $1=$recv(stream)._contents();
  61015. $ctx1.sendIdx["contents"]=1;
  61016. $self._assert_equals_($1,collection);
  61017. $ctx1.sendIdx["assert:equals:"]=1;
  61018. stream=$self._newStream();
  61019. $recv(stream)._nextPutAll_(collection);
  61020. $self._assert_equals_($recv(stream)._contents(),collection);
  61021. return self;
  61022. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  61023. },
  61024. args: [],
  61025. 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",
  61026. referencedClasses: [],
  61027. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  61028. }),
  61029. $globals.StreamTest);
  61030. $core.addMethod(
  61031. $core.method({
  61032. selector: "collectionClass",
  61033. protocol: "accessing",
  61034. fn: function (){
  61035. var self=this,$self=this;
  61036. return nil;
  61037. },
  61038. args: [],
  61039. source: "collectionClass\x0a\x09^ nil",
  61040. referencedClasses: [],
  61041. messageSends: []
  61042. }),
  61043. $globals.StreamTest.a$cls);
  61044. $core.addMethod(
  61045. $core.method({
  61046. selector: "isAbstract",
  61047. protocol: "testing",
  61048. fn: function (){
  61049. var self=this,$self=this;
  61050. return $core.withContext(function($ctx1) {
  61051. return $recv($self._collectionClass())._isNil();
  61052. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  61053. },
  61054. args: [],
  61055. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  61056. referencedClasses: [],
  61057. messageSends: ["isNil", "collectionClass"]
  61058. }),
  61059. $globals.StreamTest.a$cls);
  61060. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61061. $core.addMethod(
  61062. $core.method({
  61063. selector: "newCollection",
  61064. protocol: "accessing",
  61065. fn: function (){
  61066. var self=this,$self=this;
  61067. return $core.withContext(function($ctx1) {
  61068. return [true,(1),(3).__at((4)),"foo"];
  61069. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  61070. },
  61071. args: [],
  61072. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  61073. referencedClasses: [],
  61074. messageSends: ["@"]
  61075. }),
  61076. $globals.ArrayStreamTest);
  61077. $core.addMethod(
  61078. $core.method({
  61079. selector: "collectionClass",
  61080. protocol: "accessing",
  61081. fn: function (){
  61082. var self=this,$self=this;
  61083. return $globals.Array;
  61084. },
  61085. args: [],
  61086. source: "collectionClass\x0a\x09^ Array",
  61087. referencedClasses: ["Array"],
  61088. messageSends: []
  61089. }),
  61090. $globals.ArrayStreamTest.a$cls);
  61091. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61092. $core.addMethod(
  61093. $core.method({
  61094. selector: "newCollection",
  61095. protocol: "accessing",
  61096. fn: function (){
  61097. var self=this,$self=this;
  61098. return "hello world";
  61099. },
  61100. args: [],
  61101. source: "newCollection\x0a\x09^ 'hello world'",
  61102. referencedClasses: [],
  61103. messageSends: []
  61104. }),
  61105. $globals.StringStreamTest);
  61106. $core.addMethod(
  61107. $core.method({
  61108. selector: "collectionClass",
  61109. protocol: "accessing",
  61110. fn: function (){
  61111. var self=this,$self=this;
  61112. return $globals.String;
  61113. },
  61114. args: [],
  61115. source: "collectionClass\x0a\x09^ String",
  61116. referencedClasses: ["String"],
  61117. messageSends: []
  61118. }),
  61119. $globals.StringStreamTest.a$cls);
  61120. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61121. $core.addMethod(
  61122. $core.method({
  61123. selector: "testCopying",
  61124. protocol: "tests",
  61125. fn: function (){
  61126. var self=this,$self=this;
  61127. return $core.withContext(function($ctx1) {
  61128. $self._assert_equals_(nil._copy(),nil);
  61129. return self;
  61130. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61131. },
  61132. args: [],
  61133. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61134. referencedClasses: [],
  61135. messageSends: ["assert:equals:", "copy"]
  61136. }),
  61137. $globals.UndefinedTest);
  61138. $core.addMethod(
  61139. $core.method({
  61140. selector: "testDeepCopy",
  61141. protocol: "tests",
  61142. fn: function (){
  61143. var self=this,$self=this;
  61144. return $core.withContext(function($ctx1) {
  61145. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61146. return self;
  61147. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61148. },
  61149. args: [],
  61150. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61151. referencedClasses: [],
  61152. messageSends: ["assert:", "=", "deepCopy"]
  61153. }),
  61154. $globals.UndefinedTest);
  61155. $core.addMethod(
  61156. $core.method({
  61157. selector: "testIfNil",
  61158. protocol: "tests",
  61159. fn: function (){
  61160. var self=this,$self=this;
  61161. return $core.withContext(function($ctx1) {
  61162. var $1,$3,$2,$4,$6,$5,$receiver;
  61163. if(($receiver = nil) == null || $receiver.a$nil){
  61164. $1=true;
  61165. } else {
  61166. $1=nil;
  61167. }
  61168. $self._assert_equals_($1,true);
  61169. $ctx1.sendIdx["assert:equals:"]=1;
  61170. if(($receiver = nil) == null || $receiver.a$nil){
  61171. $3=nil;
  61172. } else {
  61173. $3=true;
  61174. }
  61175. $2=$recv($3).__eq(true);
  61176. $ctx1.sendIdx["="]=1;
  61177. $self._deny_($2);
  61178. $ctx1.sendIdx["deny:"]=1;
  61179. if(($receiver = nil) == null || $receiver.a$nil){
  61180. $4=true;
  61181. } else {
  61182. $4=false;
  61183. }
  61184. $self._assert_equals_($4,true);
  61185. if(($receiver = nil) == null || $receiver.a$nil){
  61186. $6=false;
  61187. } else {
  61188. $6=true;
  61189. }
  61190. $5=$recv($6).__eq(true);
  61191. $self._deny_($5);
  61192. return self;
  61193. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61194. },
  61195. args: [],
  61196. 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",
  61197. referencedClasses: [],
  61198. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61199. }),
  61200. $globals.UndefinedTest);
  61201. $core.addMethod(
  61202. $core.method({
  61203. selector: "testIsNil",
  61204. protocol: "tests",
  61205. fn: function (){
  61206. var self=this,$self=this;
  61207. return $core.withContext(function($ctx1) {
  61208. $self._assert_(nil._isNil());
  61209. $self._deny_(nil._notNil());
  61210. return self;
  61211. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61212. },
  61213. args: [],
  61214. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61215. referencedClasses: [],
  61216. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61217. }),
  61218. $globals.UndefinedTest);
  61219. });
  61220. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61221. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61222. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61223. $core.addPackage("Platform-DOM-Tests");
  61224. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  61225. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61226. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61227. $core.addMethod(
  61228. $core.method({
  61229. selector: "testEntityConversion",
  61230. protocol: "testing",
  61231. fn: function (){
  61232. var self=this,$self=this;
  61233. return $core.withContext(function($ctx1) {
  61234. var $1;
  61235. $1=$recv($globals.PlatformDom)._isFeasible();
  61236. if($core.assert($1)){
  61237. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61238. }
  61239. return self;
  61240. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61241. },
  61242. args: [],
  61243. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61244. referencedClasses: ["PlatformDom"],
  61245. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61246. }),
  61247. $globals.PlatformDomTest);
  61248. $core.addMethod(
  61249. $core.method({
  61250. selector: "testTextContentDoesNotRunScript",
  61251. protocol: "testing",
  61252. fn: function (){
  61253. var self=this,$self=this;
  61254. return $core.withContext(function($ctx1) {
  61255. var $1;
  61256. $1=$recv($globals.PlatformDom)._isFeasible();
  61257. if($core.assert($1)){
  61258. $self._shouldnt_raise_((function(){
  61259. return $core.withContext(function($ctx2) {
  61260. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61262. }),$globals.Error);
  61263. }
  61264. return self;
  61265. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61266. },
  61267. args: [],
  61268. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61269. referencedClasses: ["PlatformDom", "Error"],
  61270. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61271. }),
  61272. $globals.PlatformDomTest);
  61273. });
  61274. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61275. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61276. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61277. $core.addPackage("SUnit-Tests");
  61278. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  61279. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61280. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61281. $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.";
  61282. $core.addMethod(
  61283. $core.method({
  61284. selector: "setUp",
  61285. protocol: "running",
  61286. fn: function (){
  61287. var self=this,$self=this;
  61288. return $core.withContext(function($ctx1) {
  61289. $self["@empty"]=$recv($globals.Set)._new();
  61290. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61291. return self;
  61292. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61293. },
  61294. args: [],
  61295. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61296. referencedClasses: ["Set"],
  61297. messageSends: ["new", "with:with:"]
  61298. }),
  61299. $globals.ExampleSetTest);
  61300. $core.addMethod(
  61301. $core.method({
  61302. selector: "testAdd",
  61303. protocol: "tests",
  61304. fn: function (){
  61305. var self=this,$self=this;
  61306. return $core.withContext(function($ctx1) {
  61307. $recv($self["@empty"])._add_((5));
  61308. $self._assert_($recv($self["@empty"])._includes_((5)));
  61309. return self;
  61310. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61311. },
  61312. args: [],
  61313. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61314. referencedClasses: [],
  61315. messageSends: ["add:", "assert:", "includes:"]
  61316. }),
  61317. $globals.ExampleSetTest);
  61318. $core.addMethod(
  61319. $core.method({
  61320. selector: "testGrow",
  61321. protocol: "tests",
  61322. fn: function (){
  61323. var self=this,$self=this;
  61324. return $core.withContext(function($ctx1) {
  61325. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61326. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61327. return self;
  61328. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61329. },
  61330. args: [],
  61331. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61332. referencedClasses: [],
  61333. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61334. }),
  61335. $globals.ExampleSetTest);
  61336. $core.addMethod(
  61337. $core.method({
  61338. selector: "testIllegal",
  61339. protocol: "tests",
  61340. fn: function (){
  61341. var self=this,$self=this;
  61342. return $core.withContext(function($ctx1) {
  61343. $self._should_raise_((function(){
  61344. return $core.withContext(function($ctx2) {
  61345. return $recv($self["@empty"])._at_((5));
  61346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61347. }),$globals.Error);
  61348. $ctx1.sendIdx["should:raise:"]=1;
  61349. $self._should_raise_((function(){
  61350. return $core.withContext(function($ctx2) {
  61351. return $recv($self["@empty"])._at_put_((5),"abc");
  61352. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61353. }),$globals.Error);
  61354. return self;
  61355. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61356. },
  61357. args: [],
  61358. 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",
  61359. referencedClasses: ["Error"],
  61360. messageSends: ["should:raise:", "at:", "at:put:"]
  61361. }),
  61362. $globals.ExampleSetTest);
  61363. $core.addMethod(
  61364. $core.method({
  61365. selector: "testIncludes",
  61366. protocol: "tests",
  61367. fn: function (){
  61368. var self=this,$self=this;
  61369. return $core.withContext(function($ctx1) {
  61370. var $1;
  61371. $1=$recv($self["@full"])._includes_((5));
  61372. $ctx1.sendIdx["includes:"]=1;
  61373. $self._assert_($1);
  61374. $ctx1.sendIdx["assert:"]=1;
  61375. $self._assert_($recv($self["@full"])._includes_("abc"));
  61376. return self;
  61377. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61378. },
  61379. args: [],
  61380. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61381. referencedClasses: [],
  61382. messageSends: ["assert:", "includes:"]
  61383. }),
  61384. $globals.ExampleSetTest);
  61385. $core.addMethod(
  61386. $core.method({
  61387. selector: "testOccurrences",
  61388. protocol: "tests",
  61389. fn: function (){
  61390. var self=this,$self=this;
  61391. return $core.withContext(function($ctx1) {
  61392. var $1,$2;
  61393. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61394. $ctx1.sendIdx["occurrencesOf:"]=1;
  61395. $self._assert_equals_($1,(0));
  61396. $ctx1.sendIdx["assert:equals:"]=1;
  61397. $2=$recv($self["@full"])._occurrencesOf_((5));
  61398. $ctx1.sendIdx["occurrencesOf:"]=2;
  61399. $self._assert_equals_($2,(1));
  61400. $ctx1.sendIdx["assert:equals:"]=2;
  61401. $recv($self["@full"])._add_((5));
  61402. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61403. return self;
  61404. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61405. },
  61406. args: [],
  61407. 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",
  61408. referencedClasses: [],
  61409. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61410. }),
  61411. $globals.ExampleSetTest);
  61412. $core.addMethod(
  61413. $core.method({
  61414. selector: "testRemove",
  61415. protocol: "tests",
  61416. fn: function (){
  61417. var self=this,$self=this;
  61418. return $core.withContext(function($ctx1) {
  61419. var $1;
  61420. $recv($self["@full"])._remove_((5));
  61421. $1=$recv($self["@full"])._includes_("abc");
  61422. $ctx1.sendIdx["includes:"]=1;
  61423. $self._assert_($1);
  61424. $self._deny_($recv($self["@full"])._includes_((5)));
  61425. return self;
  61426. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61427. },
  61428. args: [],
  61429. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61430. referencedClasses: [],
  61431. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61432. }),
  61433. $globals.ExampleSetTest);
  61434. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61435. $core.addMethod(
  61436. $core.method({
  61437. selector: "fakeError",
  61438. protocol: "helpers",
  61439. fn: function (){
  61440. var self=this,$self=this;
  61441. return $core.withContext(function($ctx1) {
  61442. $self["@flag"]="bad";
  61443. $self._timeout_((30));
  61444. $self["@flag"]=$recv($self._async_((function(){
  61445. return $core.withContext(function($ctx2) {
  61446. $self["@flag"]="ok";
  61447. return $self._error_("Intentional");
  61448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61449. })))._valueWithTimeout_((20));
  61450. return self;
  61451. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61452. },
  61453. args: [],
  61454. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61455. referencedClasses: [],
  61456. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61457. }),
  61458. $globals.SUnitAsyncTest);
  61459. $core.addMethod(
  61460. $core.method({
  61461. selector: "fakeErrorFailingInTearDown",
  61462. protocol: "helpers",
  61463. fn: function (){
  61464. var self=this,$self=this;
  61465. return $core.withContext(function($ctx1) {
  61466. $self["@flag"]="bad";
  61467. $self._timeout_((30));
  61468. $self["@flag"]=$recv($self._async_((function(){
  61469. return $core.withContext(function($ctx2) {
  61470. return $self._error_("Intentional");
  61471. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61472. })))._valueWithTimeout_((20));
  61473. return self;
  61474. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61475. },
  61476. args: [],
  61477. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61478. referencedClasses: [],
  61479. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61480. }),
  61481. $globals.SUnitAsyncTest);
  61482. $core.addMethod(
  61483. $core.method({
  61484. selector: "fakeFailure",
  61485. protocol: "helpers",
  61486. fn: function (){
  61487. var self=this,$self=this;
  61488. return $core.withContext(function($ctx1) {
  61489. $self["@flag"]="bad";
  61490. $self._timeout_((30));
  61491. $self["@flag"]=$recv($self._async_((function(){
  61492. return $core.withContext(function($ctx2) {
  61493. $self["@flag"]="ok";
  61494. return $self._assert_(false);
  61495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61496. })))._valueWithTimeout_((20));
  61497. return self;
  61498. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61499. },
  61500. args: [],
  61501. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61502. referencedClasses: [],
  61503. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61504. }),
  61505. $globals.SUnitAsyncTest);
  61506. $core.addMethod(
  61507. $core.method({
  61508. selector: "fakeMultipleTimeoutFailing",
  61509. protocol: "helpers",
  61510. fn: function (){
  61511. var self=this,$self=this;
  61512. return $core.withContext(function($ctx1) {
  61513. var $1;
  61514. $self._timeout_((100));
  61515. $ctx1.sendIdx["timeout:"]=1;
  61516. $1=$self._async_((function(){
  61517. return $core.withContext(function($ctx2) {
  61518. $self._timeout_((20));
  61519. return $recv($self._async_((function(){
  61520. return $core.withContext(function($ctx3) {
  61521. return $self._finished();
  61522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61523. })))._valueWithTimeout_((30));
  61524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61525. }));
  61526. $ctx1.sendIdx["async:"]=1;
  61527. $recv($1)._valueWithTimeout_((20));
  61528. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61529. return self;
  61530. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61531. },
  61532. args: [],
  61533. 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",
  61534. referencedClasses: [],
  61535. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61536. }),
  61537. $globals.SUnitAsyncTest);
  61538. $core.addMethod(
  61539. $core.method({
  61540. selector: "fakeMultipleTimeoutPassing",
  61541. protocol: "helpers",
  61542. fn: function (){
  61543. var self=this,$self=this;
  61544. return $core.withContext(function($ctx1) {
  61545. var $1;
  61546. $self._timeout_((20));
  61547. $ctx1.sendIdx["timeout:"]=1;
  61548. $1=$self._async_((function(){
  61549. return $core.withContext(function($ctx2) {
  61550. $self._timeout_((40));
  61551. return $recv($self._async_((function(){
  61552. return $core.withContext(function($ctx3) {
  61553. return $self._finished();
  61554. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61555. })))._valueWithTimeout_((20));
  61556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61557. }));
  61558. $ctx1.sendIdx["async:"]=1;
  61559. $recv($1)._valueWithTimeout_((10));
  61560. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61561. return self;
  61562. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61563. },
  61564. args: [],
  61565. 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",
  61566. referencedClasses: [],
  61567. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61568. }),
  61569. $globals.SUnitAsyncTest);
  61570. $core.addMethod(
  61571. $core.method({
  61572. selector: "fakeTimeout",
  61573. protocol: "helpers",
  61574. fn: function (){
  61575. var self=this,$self=this;
  61576. return $core.withContext(function($ctx1) {
  61577. $self._timeout_((10));
  61578. $recv($self._async_((function(){
  61579. return $core.withContext(function($ctx2) {
  61580. return $self._finished();
  61581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61582. })))._valueWithTimeout_((20));
  61583. return self;
  61584. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61585. },
  61586. args: [],
  61587. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61588. referencedClasses: [],
  61589. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61590. }),
  61591. $globals.SUnitAsyncTest);
  61592. $core.addMethod(
  61593. $core.method({
  61594. selector: "selectorSetOf:",
  61595. protocol: "private",
  61596. fn: function (aCollection){
  61597. var self=this,$self=this;
  61598. return $core.withContext(function($ctx1) {
  61599. return $recv($recv(aCollection)._collect_((function(each){
  61600. return $core.withContext(function($ctx2) {
  61601. return $recv(each)._selector();
  61602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61603. })))._asSet();
  61604. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61605. },
  61606. args: ["aCollection"],
  61607. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61608. referencedClasses: [],
  61609. messageSends: ["asSet", "collect:", "selector"]
  61610. }),
  61611. $globals.SUnitAsyncTest);
  61612. $core.addMethod(
  61613. $core.method({
  61614. selector: "setUp",
  61615. protocol: "running",
  61616. fn: function (){
  61617. var self=this,$self=this;
  61618. $self["@flag"]="ok";
  61619. return self;
  61620. },
  61621. args: [],
  61622. source: "setUp\x0a\x09flag := 'ok'",
  61623. referencedClasses: [],
  61624. messageSends: []
  61625. }),
  61626. $globals.SUnitAsyncTest);
  61627. $core.addMethod(
  61628. $core.method({
  61629. selector: "tearDown",
  61630. protocol: "running",
  61631. fn: function (){
  61632. var self=this,$self=this;
  61633. return $core.withContext(function($ctx1) {
  61634. $self._assert_equals_("ok",$self["@flag"]);
  61635. return self;
  61636. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61637. },
  61638. args: [],
  61639. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61640. referencedClasses: [],
  61641. messageSends: ["assert:equals:"]
  61642. }),
  61643. $globals.SUnitAsyncTest);
  61644. $core.addMethod(
  61645. $core.method({
  61646. selector: "testAsyncErrorsAndFailures",
  61647. protocol: "tests",
  61648. fn: function (){
  61649. var self=this,$self=this;
  61650. var suite,runner,result,assertBlock;
  61651. return $core.withContext(function($ctx1) {
  61652. var $1,$2,$3,$4;
  61653. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61654. return $core.withContext(function($ctx2) {
  61655. return $recv($self._class())._selector_(each);
  61656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61657. }));
  61658. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61659. $self._timeout_((200));
  61660. result=$recv(runner)._result();
  61661. $ctx1.sendIdx["result"]=1;
  61662. assertBlock=$self._async_((function(){
  61663. return $core.withContext(function($ctx2) {
  61664. $1=$self._selectorSetOf_($recv(result)._errors());
  61665. $ctx2.sendIdx["selectorSetOf:"]=1;
  61666. $2=["fakeError"]._asSet();
  61667. $ctx2.sendIdx["asSet"]=1;
  61668. $self._assert_equals_($1,$2);
  61669. $ctx2.sendIdx["assert:equals:"]=1;
  61670. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61671. return $self._finished();
  61672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61673. }));
  61674. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61675. return $core.withContext(function($ctx2) {
  61676. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61677. if($core.assert($3)){
  61678. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61679. return $recv($4)._ifTrue_(assertBlock);
  61680. }
  61681. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61682. }));
  61683. $recv(runner)._run();
  61684. return self;
  61685. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61686. },
  61687. args: [],
  61688. 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",
  61689. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61690. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61691. }),
  61692. $globals.SUnitAsyncTest);
  61693. $core.addMethod(
  61694. $core.method({
  61695. selector: "testAsyncNeedsTimeout",
  61696. protocol: "tests",
  61697. fn: function (){
  61698. var self=this,$self=this;
  61699. return $core.withContext(function($ctx1) {
  61700. $self._should_raise_((function(){
  61701. return $core.withContext(function($ctx2) {
  61702. return $self._async_((function(){
  61703. }));
  61704. $ctx2.sendIdx["async:"]=1;
  61705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61706. }),$globals.Error);
  61707. $self._timeout_((0));
  61708. $self._shouldnt_raise_((function(){
  61709. return $core.withContext(function($ctx2) {
  61710. return $self._async_((function(){
  61711. }));
  61712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61713. }),$globals.Error);
  61714. $self._finished();
  61715. return self;
  61716. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61717. },
  61718. args: [],
  61719. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61720. referencedClasses: ["Error"],
  61721. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61722. }),
  61723. $globals.SUnitAsyncTest);
  61724. $core.addMethod(
  61725. $core.method({
  61726. selector: "testFinishedNeedsTimeout",
  61727. protocol: "tests",
  61728. fn: function (){
  61729. var self=this,$self=this;
  61730. return $core.withContext(function($ctx1) {
  61731. $self._should_raise_((function(){
  61732. return $core.withContext(function($ctx2) {
  61733. return $self._finished();
  61734. $ctx2.sendIdx["finished"]=1;
  61735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61736. }),$globals.Error);
  61737. $self._timeout_((0));
  61738. $self._shouldnt_raise_((function(){
  61739. return $core.withContext(function($ctx2) {
  61740. return $self._finished();
  61741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61742. }),$globals.Error);
  61743. return self;
  61744. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61745. },
  61746. args: [],
  61747. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61748. referencedClasses: ["Error"],
  61749. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61750. }),
  61751. $globals.SUnitAsyncTest);
  61752. $core.addMethod(
  61753. $core.method({
  61754. selector: "testIsAsyncReturnsCorrectValues",
  61755. protocol: "tests",
  61756. fn: function (){
  61757. var self=this,$self=this;
  61758. return $core.withContext(function($ctx1) {
  61759. var $1,$2;
  61760. $1=$self._isAsync();
  61761. $ctx1.sendIdx["isAsync"]=1;
  61762. $self._deny_($1);
  61763. $ctx1.sendIdx["deny:"]=1;
  61764. $self._timeout_((0));
  61765. $2=$self._isAsync();
  61766. $ctx1.sendIdx["isAsync"]=2;
  61767. $self._assert_($2);
  61768. $self._finished();
  61769. $self._deny_($self._isAsync());
  61770. return self;
  61771. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61772. },
  61773. args: [],
  61774. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61775. referencedClasses: [],
  61776. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61777. }),
  61778. $globals.SUnitAsyncTest);
  61779. $core.addMethod(
  61780. $core.method({
  61781. selector: "testPass",
  61782. protocol: "tests",
  61783. fn: function (){
  61784. var self=this,$self=this;
  61785. return $core.withContext(function($ctx1) {
  61786. $self["@flag"]="bad";
  61787. $self._timeout_((10));
  61788. $self["@flag"]=$recv($self._async_((function(){
  61789. return $core.withContext(function($ctx2) {
  61790. $self._assert_(true);
  61791. $self._finished();
  61792. $self["@flag"]="ok";
  61793. return $self["@flag"];
  61794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61795. })))._valueWithTimeout_((5));
  61796. return self;
  61797. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61798. },
  61799. args: [],
  61800. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61801. referencedClasses: [],
  61802. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61803. }),
  61804. $globals.SUnitAsyncTest);
  61805. $core.addMethod(
  61806. $core.method({
  61807. selector: "testTimeouts",
  61808. protocol: "tests",
  61809. fn: function (){
  61810. var self=this,$self=this;
  61811. var suite,runner,result,assertBlock;
  61812. return $core.withContext(function($ctx1) {
  61813. var $1,$2,$3;
  61814. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61815. return $core.withContext(function($ctx2) {
  61816. return $recv($self._class())._selector_(each);
  61817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61818. }));
  61819. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61820. $self._timeout_((200));
  61821. result=$recv(runner)._result();
  61822. $ctx1.sendIdx["result"]=1;
  61823. assertBlock=$self._async_((function(){
  61824. return $core.withContext(function($ctx2) {
  61825. $1=$self._selectorSetOf_($recv(result)._errors());
  61826. $ctx2.sendIdx["selectorSetOf:"]=1;
  61827. $self._assert_equals_($1,$recv($globals.Set)._new());
  61828. $ctx2.sendIdx["assert:equals:"]=1;
  61829. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61830. return $self._finished();
  61831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61832. }));
  61833. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61834. return $core.withContext(function($ctx2) {
  61835. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61836. if($core.assert($2)){
  61837. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61838. return $recv($3)._ifTrue_(assertBlock);
  61839. }
  61840. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61841. }));
  61842. $recv(runner)._run();
  61843. return self;
  61844. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61845. },
  61846. args: [],
  61847. 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",
  61848. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61849. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61850. }),
  61851. $globals.SUnitAsyncTest);
  61852. $core.addMethod(
  61853. $core.method({
  61854. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61855. protocol: "tests",
  61856. fn: function (){
  61857. var self=this,$self=this;
  61858. var x;
  61859. return $core.withContext(function($ctx1) {
  61860. var $1;
  61861. $self["@flag"]="bad";
  61862. $self._timeout_((10));
  61863. x=(0);
  61864. $1=$self._async_((function(){
  61865. return $core.withContext(function($ctx2) {
  61866. $self._finished();
  61867. $ctx2.sendIdx["finished"]=1;
  61868. $self["@flag"]="ok";
  61869. x=$recv(x).__plus((1));
  61870. $ctx2.sendIdx["+"]=1;
  61871. return $self._assert_equals_(x,(1));
  61872. $ctx2.sendIdx["assert:equals:"]=1;
  61873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61874. }));
  61875. $ctx1.sendIdx["async:"]=1;
  61876. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61877. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61878. $self["@flag"]=$recv($self._async_((function(){
  61879. return $core.withContext(function($ctx2) {
  61880. $self._finished();
  61881. $self["@flag"]="ok";
  61882. x=$recv(x).__plus((1));
  61883. return $self._assert_equals_(x,(1));
  61884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61885. })))._valueWithTimeout_((0));
  61886. return self;
  61887. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61888. },
  61889. args: [],
  61890. 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.",
  61891. referencedClasses: [],
  61892. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61893. }),
  61894. $globals.SUnitAsyncTest);
  61895. });
  61896. define('amber/devel',[
  61897. './lang',
  61898. './brikz', // pre-fetch, dep of ./boot
  61899. './kernel-checks', // pre-fetch, dep of ./boot
  61900. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61901. './kernel-language', // pre-fetch, dep of ./boot
  61902. './boot', // pre-fetch, class loader
  61903. './deploy', // pre-fetch, dep of ./lang
  61904. // --- packages of the development only Amber begin here ---
  61905. 'amber_core/Platform-DOM',
  61906. 'amber_core/SUnit',
  61907. 'amber_core/Compiler-Tests',
  61908. 'amber_core/Kernel-Tests',
  61909. 'amber_core/Platform-DOM-Tests',
  61910. 'amber_core/SUnit-Tests'
  61911. // --- packages of the development only Amber end here ---
  61912. ], function (amber) {
  61913. return amber;
  61914. });
  61915. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61916. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61917. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61918. $core.addPackage("Platform-Node");
  61919. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61920. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61921. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61922. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61923. $core.addMethod(
  61924. $core.method({
  61925. selector: "globals",
  61926. protocol: "accessing",
  61927. fn: function (){
  61928. var self=this,$self=this;
  61929. return global;
  61930. },
  61931. args: [],
  61932. source: "globals\x0a\x09^ global",
  61933. referencedClasses: [],
  61934. messageSends: []
  61935. }),
  61936. $globals.NodePlatform);
  61937. $core.addMethod(
  61938. $core.method({
  61939. selector: "newXhr",
  61940. protocol: "accessing",
  61941. fn: function (){
  61942. var self=this,$self=this;
  61943. return $core.withContext(function($ctx1) {
  61944. var $receiver;
  61945. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61946. $self._error_("XMLHttpRequest not available.");
  61947. } else {
  61948. return $recv($globals.XMLHttpRequest)._new();
  61949. }
  61950. return self;
  61951. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61952. },
  61953. args: [],
  61954. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61955. referencedClasses: ["XMLHttpRequest"],
  61956. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61957. }),
  61958. $globals.NodePlatform);
  61959. $core.addMethod(
  61960. $core.method({
  61961. selector: "initialize",
  61962. protocol: "testing",
  61963. fn: function (){
  61964. var self=this,$self=this;
  61965. return $core.withContext(function($ctx1) {
  61966. var $1;
  61967. $1=$self._isFeasible();
  61968. if($core.assert($1)){
  61969. $recv($globals.Platform)._registerIfNone_($self._new());
  61970. }
  61971. return self;
  61972. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61973. },
  61974. args: [],
  61975. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61976. referencedClasses: ["Platform"],
  61977. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61978. }),
  61979. $globals.NodePlatform.a$cls);
  61980. $core.addMethod(
  61981. $core.method({
  61982. selector: "isFeasible",
  61983. protocol: "testing",
  61984. fn: function (){
  61985. var self=this,$self=this;
  61986. return $core.withContext(function($ctx1) {
  61987. return typeof global !== "undefined";
  61988. return self;
  61989. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61990. },
  61991. args: [],
  61992. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61993. referencedClasses: [],
  61994. messageSends: []
  61995. }),
  61996. $globals.NodePlatform.a$cls);
  61997. });
  61998. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61999. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  62000. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  62001. $core.addPackage("AmberCli");
  62002. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  62003. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  62004. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  62005. $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.";
  62006. $core.addMethod(
  62007. $core.method({
  62008. selector: "commandLineSwitches",
  62009. protocol: "commandline",
  62010. fn: function (){
  62011. var self=this,$self=this;
  62012. var switches;
  62013. return $core.withContext(function($ctx1) {
  62014. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  62015. return $core.withContext(function($ctx2) {
  62016. return $recv(each)._selector();
  62017. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62018. }));
  62019. $ctx1.sendIdx["collect:"]=1;
  62020. switches=$recv(switches)._select_((function(each){
  62021. return $core.withContext(function($ctx2) {
  62022. return $recv(each)._match_("^[^:]*:$");
  62023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62024. }));
  62025. switches=$recv(switches)._collect_((function(each){
  62026. return $core.withContext(function($ctx2) {
  62027. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  62028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62029. }));
  62030. return switches;
  62031. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  62032. },
  62033. args: [],
  62034. 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",
  62035. referencedClasses: [],
  62036. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  62037. }),
  62038. $globals.AmberCli.a$cls);
  62039. $core.addMethod(
  62040. $core.method({
  62041. selector: "config:",
  62042. protocol: "commands",
  62043. fn: function (args){
  62044. var self=this,$self=this;
  62045. return $core.withContext(function($ctx1) {
  62046. $recv($recv($globals.Configurator)._new())._start();
  62047. return self;
  62048. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  62049. },
  62050. args: ["args"],
  62051. source: "config: args\x0a\x09Configurator new start",
  62052. referencedClasses: ["Configurator"],
  62053. messageSends: ["start", "new"]
  62054. }),
  62055. $globals.AmberCli.a$cls);
  62056. $core.addMethod(
  62057. $core.method({
  62058. selector: "handleArguments:",
  62059. protocol: "commandline",
  62060. fn: function (args){
  62061. var self=this,$self=this;
  62062. var selector;
  62063. return $core.withContext(function($ctx1) {
  62064. var $1;
  62065. $1=$recv(args)._first();
  62066. $ctx1.sendIdx["first"]=1;
  62067. selector=$self._selectorForCommandLineSwitch_($1);
  62068. $recv(args)._remove_($recv(args)._first());
  62069. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  62070. return self;
  62071. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  62072. },
  62073. args: ["args"],
  62074. 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)",
  62075. referencedClasses: ["Array"],
  62076. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  62077. }),
  62078. $globals.AmberCli.a$cls);
  62079. $core.addMethod(
  62080. $core.method({
  62081. selector: "help:",
  62082. protocol: "commands",
  62083. fn: function (args){
  62084. var self=this,$self=this;
  62085. return $core.withContext(function($ctx1) {
  62086. $recv($globals.Transcript)._show_("Available commands");
  62087. $recv($self._commandLineSwitches())._do_((function(each){
  62088. return $core.withContext(function($ctx2) {
  62089. return $recv(console)._log_(each);
  62090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62091. }));
  62092. return self;
  62093. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  62094. },
  62095. args: ["args"],
  62096. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  62097. referencedClasses: ["Transcript"],
  62098. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  62099. }),
  62100. $globals.AmberCli.a$cls);
  62101. $core.addMethod(
  62102. $core.method({
  62103. selector: "init:",
  62104. protocol: "commands",
  62105. fn: function (args){
  62106. var self=this,$self=this;
  62107. return $core.withContext(function($ctx1) {
  62108. $recv($recv($globals.Initer)._new())._start();
  62109. return self;
  62110. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62111. },
  62112. args: ["args"],
  62113. source: "init: args\x0a\x09Initer new start",
  62114. referencedClasses: ["Initer"],
  62115. messageSends: ["start", "new"]
  62116. }),
  62117. $globals.AmberCli.a$cls);
  62118. $core.addMethod(
  62119. $core.method({
  62120. selector: "main",
  62121. protocol: "startup",
  62122. fn: function (){
  62123. var self=this,$self=this;
  62124. var args,packageJSON;
  62125. return $core.withContext(function($ctx1) {
  62126. var $7,$6,$5,$4,$3,$2,$1;
  62127. var $early={};
  62128. try {
  62129. packageJSON=$recv(require)._value_("../package.json");
  62130. $7=$recv(packageJSON)._version();
  62131. $ctx1.sendIdx["version"]=1;
  62132. $6="Welcome to Amber CLI version ".__comma($7);
  62133. $5=$recv($6).__comma(" (Amber ");
  62134. $ctx1.sendIdx[","]=5;
  62135. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62136. $ctx1.sendIdx[","]=4;
  62137. $3=$recv($4).__comma(", NodeJS ");
  62138. $ctx1.sendIdx[","]=3;
  62139. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62140. $ctx1.sendIdx[","]=2;
  62141. $1=$recv($2).__comma(").");
  62142. $ctx1.sendIdx[","]=1;
  62143. $recv($globals.Transcript)._show_($1);
  62144. args=$recv(process)._argv();
  62145. $recv(args)._removeFrom_to_((1),(2));
  62146. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62147. return $core.withContext(function($ctx2) {
  62148. return $self._help_(nil);
  62149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62150. }),(function(){
  62151. return $core.withContext(function($ctx2) {
  62152. throw $early=[$self._handleArguments_(args)];
  62153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62154. }));
  62155. return self;
  62156. }
  62157. catch(e) {if(e===$early)return e[0]; throw e}
  62158. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62159. },
  62160. args: [],
  62161. 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]",
  62162. referencedClasses: ["Transcript", "Smalltalk"],
  62163. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62164. }),
  62165. $globals.AmberCli.a$cls);
  62166. $core.addMethod(
  62167. $core.method({
  62168. selector: "repl:",
  62169. protocol: "commands",
  62170. fn: function (args){
  62171. var self=this,$self=this;
  62172. return $core.withContext(function($ctx1) {
  62173. return $recv($recv($globals.Repl)._new())._createInterface();
  62174. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62175. },
  62176. args: ["args"],
  62177. source: "repl: args\x0a\x09^ Repl new createInterface",
  62178. referencedClasses: ["Repl"],
  62179. messageSends: ["createInterface", "new"]
  62180. }),
  62181. $globals.AmberCli.a$cls);
  62182. $core.addMethod(
  62183. $core.method({
  62184. selector: "selectorForCommandLineSwitch:",
  62185. protocol: "commandline",
  62186. fn: function (aSwitch){
  62187. var self=this,$self=this;
  62188. var command,selector;
  62189. return $core.withContext(function($ctx1) {
  62190. var $1;
  62191. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62192. if($core.assert($1)){
  62193. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62194. return $core.withContext(function($ctx2) {
  62195. return $recv($recv(each)._second())._asUppercase();
  62196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62197. }))).__comma(":");
  62198. selector;
  62199. } else {
  62200. selector="help:";
  62201. selector;
  62202. }
  62203. return selector;
  62204. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62205. },
  62206. args: ["aSwitch"],
  62207. 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",
  62208. referencedClasses: [],
  62209. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62210. }),
  62211. $globals.AmberCli.a$cls);
  62212. $core.addMethod(
  62213. $core.method({
  62214. selector: "serve:",
  62215. protocol: "commands",
  62216. fn: function (args){
  62217. var self=this,$self=this;
  62218. return $core.withContext(function($ctx1) {
  62219. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62220. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62221. },
  62222. args: ["args"],
  62223. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62224. referencedClasses: ["FileServer"],
  62225. messageSends: ["start", "createServerWithArguments:"]
  62226. }),
  62227. $globals.AmberCli.a$cls);
  62228. $core.addMethod(
  62229. $core.method({
  62230. selector: "version:",
  62231. protocol: "commands",
  62232. fn: function (arguments_){
  62233. var self=this,$self=this;
  62234. return self;
  62235. },
  62236. args: ["arguments"],
  62237. source: "version: arguments",
  62238. referencedClasses: [],
  62239. messageSends: []
  62240. }),
  62241. $globals.AmberCli.a$cls);
  62242. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62243. $core.addMethod(
  62244. $core.method({
  62245. selector: "dirname",
  62246. protocol: "private",
  62247. fn: function (){
  62248. var self=this,$self=this;
  62249. return $core.withContext(function($ctx1) {
  62250. return __dirname;
  62251. return self;
  62252. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62253. },
  62254. args: [],
  62255. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62256. referencedClasses: [],
  62257. messageSends: []
  62258. }),
  62259. $globals.BaseFileManipulator);
  62260. $core.addMethod(
  62261. $core.method({
  62262. selector: "initialize",
  62263. protocol: "initialization",
  62264. fn: function (){
  62265. var self=this,$self=this;
  62266. return $core.withContext(function($ctx1) {
  62267. (
  62268. $ctx1.supercall = true,
  62269. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62270. $ctx1.supercall = false;
  62271. $self["@path"]=$recv(require)._value_("path");
  62272. $ctx1.sendIdx["value:"]=1;
  62273. $self["@fs"]=$recv(require)._value_("fs");
  62274. return self;
  62275. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62276. },
  62277. args: [],
  62278. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62279. referencedClasses: [],
  62280. messageSends: ["initialize", "value:"]
  62281. }),
  62282. $globals.BaseFileManipulator);
  62283. $core.addMethod(
  62284. $core.method({
  62285. selector: "rootDirname",
  62286. protocol: "private",
  62287. fn: function (){
  62288. var self=this,$self=this;
  62289. return $core.withContext(function($ctx1) {
  62290. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62291. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62292. },
  62293. args: [],
  62294. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62295. referencedClasses: [],
  62296. messageSends: ["join:with:", "dirname"]
  62297. }),
  62298. $globals.BaseFileManipulator);
  62299. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62300. $core.addMethod(
  62301. $core.method({
  62302. selector: "initialize",
  62303. protocol: "initialization",
  62304. fn: function (){
  62305. var self=this,$self=this;
  62306. return $core.withContext(function($ctx1) {
  62307. (
  62308. $ctx1.supercall = true,
  62309. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62310. $ctx1.supercall = false;
  62311. return self;
  62312. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62313. },
  62314. args: [],
  62315. source: "initialize\x0a\x09super initialize",
  62316. referencedClasses: [],
  62317. messageSends: ["initialize"]
  62318. }),
  62319. $globals.Configurator);
  62320. $core.addMethod(
  62321. $core.method({
  62322. selector: "start",
  62323. protocol: "action",
  62324. fn: function (){
  62325. var self=this,$self=this;
  62326. return $core.withContext(function($ctx1) {
  62327. var $receiver;
  62328. $self._writeConfigThenDo_((function(err){
  62329. return $core.withContext(function($ctx2) {
  62330. if(($receiver = err) == null || $receiver.a$nil){
  62331. return $recv(process)._exit();
  62332. } else {
  62333. return $recv(process)._exit_((111));
  62334. }
  62335. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62336. }));
  62337. return self;
  62338. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62339. },
  62340. args: [],
  62341. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62342. referencedClasses: [],
  62343. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62344. }),
  62345. $globals.Configurator);
  62346. $core.addMethod(
  62347. $core.method({
  62348. selector: "writeConfigThenDo:",
  62349. protocol: "action",
  62350. fn: function (aBlock){
  62351. var self=this,$self=this;
  62352. return $core.withContext(function($ctx1) {
  62353. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62354. return self;
  62355. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62356. },
  62357. args: ["aBlock"],
  62358. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62359. referencedClasses: [],
  62360. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62361. }),
  62362. $globals.Configurator);
  62363. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62364. $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.";
  62365. $core.addMethod(
  62366. $core.method({
  62367. selector: "base64Decode:",
  62368. protocol: "private",
  62369. fn: function (aString){
  62370. var self=this,$self=this;
  62371. return $core.withContext(function($ctx1) {
  62372. return (new Buffer(aString, "base64").toString());
  62373. return self;
  62374. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62375. },
  62376. args: ["aString"],
  62377. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62378. referencedClasses: [],
  62379. messageSends: []
  62380. }),
  62381. $globals.FileServer);
  62382. $core.addMethod(
  62383. $core.method({
  62384. selector: "basePath",
  62385. protocol: "accessing",
  62386. fn: function (){
  62387. var self=this,$self=this;
  62388. return $core.withContext(function($ctx1) {
  62389. var $1,$receiver;
  62390. $1=$self["@basePath"];
  62391. if(($receiver = $1) == null || $receiver.a$nil){
  62392. return $recv($self._class())._defaultBasePath();
  62393. } else {
  62394. return $1;
  62395. }
  62396. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62397. },
  62398. args: [],
  62399. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62400. referencedClasses: [],
  62401. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62402. }),
  62403. $globals.FileServer);
  62404. $core.addMethod(
  62405. $core.method({
  62406. selector: "basePath:",
  62407. protocol: "accessing",
  62408. fn: function (aString){
  62409. var self=this,$self=this;
  62410. return $core.withContext(function($ctx1) {
  62411. $self["@basePath"]=aString;
  62412. $self._validateBasePath();
  62413. return self;
  62414. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62415. },
  62416. args: ["aString"],
  62417. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62418. referencedClasses: [],
  62419. messageSends: ["validateBasePath"]
  62420. }),
  62421. $globals.FileServer);
  62422. $core.addMethod(
  62423. $core.method({
  62424. selector: "checkDirectoryLayout",
  62425. protocol: "initialization",
  62426. fn: function (){
  62427. var self=this,$self=this;
  62428. return $core.withContext(function($ctx1) {
  62429. var $1;
  62430. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62431. if(!$core.assert($1)){
  62432. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62433. $ctx1.sendIdx["warn:"]=1;
  62434. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62435. $ctx1.sendIdx["warn:"]=2;
  62436. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62437. $ctx1.sendIdx["warn:"]=3;
  62438. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62439. }
  62440. return self;
  62441. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62442. },
  62443. args: [],
  62444. 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.'].",
  62445. referencedClasses: [],
  62446. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62447. }),
  62448. $globals.FileServer);
  62449. $core.addMethod(
  62450. $core.method({
  62451. selector: "fallbackPage",
  62452. protocol: "accessing",
  62453. fn: function (){
  62454. var self=this,$self=this;
  62455. return $self["@fallbackPage"];
  62456. },
  62457. args: [],
  62458. source: "fallbackPage\x0a\x09^ fallbackPage",
  62459. referencedClasses: [],
  62460. messageSends: []
  62461. }),
  62462. $globals.FileServer);
  62463. $core.addMethod(
  62464. $core.method({
  62465. selector: "fallbackPage:",
  62466. protocol: "accessing",
  62467. fn: function (aString){
  62468. var self=this,$self=this;
  62469. $self["@fallbackPage"]=aString;
  62470. return self;
  62471. },
  62472. args: ["aString"],
  62473. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62474. referencedClasses: [],
  62475. messageSends: []
  62476. }),
  62477. $globals.FileServer);
  62478. $core.addMethod(
  62479. $core.method({
  62480. selector: "handleGETRequest:respondTo:",
  62481. protocol: "request handling",
  62482. fn: function (aRequest,aResponse){
  62483. var self=this,$self=this;
  62484. var uri,filename;
  62485. return $core.withContext(function($ctx1) {
  62486. var $1;
  62487. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62488. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62489. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62490. return $core.withContext(function($ctx2) {
  62491. if($core.assert(aBoolean)){
  62492. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62493. if($core.assert($1)){
  62494. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62495. } else {
  62496. return $self._respondFileNamed_to_(filename,aResponse);
  62497. }
  62498. } else {
  62499. return $self._respondNotFoundTo_(aResponse);
  62500. }
  62501. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62502. }));
  62503. return self;
  62504. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62505. },
  62506. args: ["aRequest", "aResponse"],
  62507. 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]]]",
  62508. referencedClasses: [],
  62509. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62510. }),
  62511. $globals.FileServer);
  62512. $core.addMethod(
  62513. $core.method({
  62514. selector: "handleOPTIONSRequest:respondTo:",
  62515. protocol: "request handling",
  62516. fn: function (aRequest,aResponse){
  62517. var self=this,$self=this;
  62518. return $core.withContext(function($ctx1) {
  62519. $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)]));
  62520. $recv(aResponse)._end();
  62521. return self;
  62522. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62523. },
  62524. args: ["aRequest", "aResponse"],
  62525. 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",
  62526. referencedClasses: [],
  62527. messageSends: ["writeHead:options:", "end"]
  62528. }),
  62529. $globals.FileServer);
  62530. $core.addMethod(
  62531. $core.method({
  62532. selector: "handlePUTRequest:respondTo:",
  62533. protocol: "request handling",
  62534. fn: function (aRequest,aResponse){
  62535. var self=this,$self=this;
  62536. var file,stream;
  62537. return $core.withContext(function($ctx1) {
  62538. var $1,$2,$3,$4;
  62539. $1=$self._isAuthenticated_(aRequest);
  62540. if(!$core.assert($1)){
  62541. $self._respondAuthenticationRequiredTo_(aResponse);
  62542. return nil;
  62543. }
  62544. file=".".__comma($recv(aRequest)._url());
  62545. $ctx1.sendIdx[","]=1;
  62546. stream=$recv($self["@fs"])._createWriteStream_(file);
  62547. $recv(stream)._on_do_("error",(function(error){
  62548. return $core.withContext(function($ctx2) {
  62549. $2=console;
  62550. $3="Error creating WriteStream for file ".__comma(file);
  62551. $ctx2.sendIdx[","]=2;
  62552. $recv($2)._warn_($3);
  62553. $ctx2.sendIdx["warn:"]=1;
  62554. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62555. $ctx2.sendIdx["warn:"]=2;
  62556. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62557. return $self._respondNotCreatedTo_(aResponse);
  62558. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62559. }));
  62560. $ctx1.sendIdx["on:do:"]=1;
  62561. $recv(stream)._on_do_("close",(function(){
  62562. return $core.withContext(function($ctx2) {
  62563. return $self._respondCreatedTo_(aResponse);
  62564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62565. }));
  62566. $ctx1.sendIdx["on:do:"]=2;
  62567. $recv(aRequest)._setEncoding_("utf8");
  62568. $recv(aRequest)._on_do_("data",(function(data){
  62569. return $core.withContext(function($ctx2) {
  62570. return $recv(stream)._write_(data);
  62571. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62572. }));
  62573. $ctx1.sendIdx["on:do:"]=3;
  62574. $recv(aRequest)._on_do_("end",(function(){
  62575. return $core.withContext(function($ctx2) {
  62576. $4=$recv(stream)._writable();
  62577. if($core.assert($4)){
  62578. return $recv(stream)._end();
  62579. }
  62580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62581. }));
  62582. return self;
  62583. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62584. },
  62585. args: ["aRequest", "aResponse"],
  62586. 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]]",
  62587. referencedClasses: [],
  62588. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62589. }),
  62590. $globals.FileServer);
  62591. $core.addMethod(
  62592. $core.method({
  62593. selector: "handleRequest:respondTo:",
  62594. protocol: "request handling",
  62595. fn: function (aRequest,aResponse){
  62596. var self=this,$self=this;
  62597. return $core.withContext(function($ctx1) {
  62598. var $2,$1,$4,$3,$5;
  62599. $2=$recv(aRequest)._method();
  62600. $ctx1.sendIdx["method"]=1;
  62601. $1=$recv($2).__eq("PUT");
  62602. $ctx1.sendIdx["="]=1;
  62603. if($core.assert($1)){
  62604. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62605. }
  62606. $4=$recv(aRequest)._method();
  62607. $ctx1.sendIdx["method"]=2;
  62608. $3=$recv($4).__eq("GET");
  62609. $ctx1.sendIdx["="]=2;
  62610. if($core.assert($3)){
  62611. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62612. }
  62613. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62614. if($core.assert($5)){
  62615. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62616. }
  62617. return self;
  62618. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62619. },
  62620. args: ["aRequest", "aResponse"],
  62621. 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]",
  62622. referencedClasses: [],
  62623. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62624. }),
  62625. $globals.FileServer);
  62626. $core.addMethod(
  62627. $core.method({
  62628. selector: "host",
  62629. protocol: "accessing",
  62630. fn: function (){
  62631. var self=this,$self=this;
  62632. return $self["@host"];
  62633. },
  62634. args: [],
  62635. source: "host\x0a\x09^ host",
  62636. referencedClasses: [],
  62637. messageSends: []
  62638. }),
  62639. $globals.FileServer);
  62640. $core.addMethod(
  62641. $core.method({
  62642. selector: "host:",
  62643. protocol: "accessing",
  62644. fn: function (hostname){
  62645. var self=this,$self=this;
  62646. $self["@host"]=hostname;
  62647. return self;
  62648. },
  62649. args: ["hostname"],
  62650. source: "host: hostname\x0a\x09host := hostname",
  62651. referencedClasses: [],
  62652. messageSends: []
  62653. }),
  62654. $globals.FileServer);
  62655. $core.addMethod(
  62656. $core.method({
  62657. selector: "initialize",
  62658. protocol: "initialization",
  62659. fn: function (){
  62660. var self=this,$self=this;
  62661. return $core.withContext(function($ctx1) {
  62662. var $1;
  62663. (
  62664. $ctx1.supercall = true,
  62665. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62666. $ctx1.supercall = false;
  62667. $self["@http"]=$self._require_("http");
  62668. $ctx1.sendIdx["require:"]=1;
  62669. $self["@util"]=$self._require_("util");
  62670. $ctx1.sendIdx["require:"]=2;
  62671. $self["@url"]=$self._require_("url");
  62672. $1=$self._class();
  62673. $ctx1.sendIdx["class"]=1;
  62674. $self["@host"]=$recv($1)._defaultHost();
  62675. $self["@port"]=$recv($self._class())._defaultPort();
  62676. $self["@username"]=nil;
  62677. $self["@password"]=nil;
  62678. $self["@fallbackPage"]=nil;
  62679. return self;
  62680. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62681. },
  62682. args: [],
  62683. 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.",
  62684. referencedClasses: [],
  62685. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62686. }),
  62687. $globals.FileServer);
  62688. $core.addMethod(
  62689. $core.method({
  62690. selector: "isAuthenticated:",
  62691. protocol: "private",
  62692. fn: function (aRequest){
  62693. var self=this,$self=this;
  62694. var header,token,auth,parts;
  62695. return $core.withContext(function($ctx1) {
  62696. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62697. var $early={};
  62698. try {
  62699. $2=$recv($self["@username"])._isNil();
  62700. $ctx1.sendIdx["isNil"]=1;
  62701. $1=$recv($2)._and_((function(){
  62702. return $core.withContext(function($ctx2) {
  62703. return $recv($self["@password"])._isNil();
  62704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62705. }));
  62706. $ctx1.sendIdx["and:"]=1;
  62707. if($core.assert($1)){
  62708. return true;
  62709. }
  62710. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62711. $ctx1.sendIdx["at:"]=1;
  62712. if(($receiver = $3) == null || $receiver.a$nil){
  62713. header="";
  62714. } else {
  62715. header=$3;
  62716. }
  62717. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62718. throw $early=[false];
  62719. }),(function(){
  62720. return $core.withContext(function($ctx2) {
  62721. $4=$recv(header)._tokenize_(" ");
  62722. $ctx2.sendIdx["tokenize:"]=1;
  62723. if(($receiver = $4) == null || $receiver.a$nil){
  62724. token="";
  62725. } else {
  62726. token=$4;
  62727. }
  62728. $5=$recv(token)._at_((2));
  62729. $ctx2.sendIdx["at:"]=2;
  62730. auth=$self._base64Decode_($5);
  62731. parts=$recv(auth)._tokenize_(":");
  62732. $8=$self["@username"];
  62733. $9=$recv(parts)._at_((1));
  62734. $ctx2.sendIdx["at:"]=3;
  62735. $7=$recv($8).__eq($9);
  62736. $ctx2.sendIdx["="]=1;
  62737. $6=$recv($7)._and_((function(){
  62738. return $core.withContext(function($ctx3) {
  62739. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62741. }));
  62742. if($core.assert($6)){
  62743. throw $early=[true];
  62744. } else {
  62745. throw $early=[false];
  62746. }
  62747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62748. }));
  62749. return self;
  62750. }
  62751. catch(e) {if(e===$early)return e[0]; throw e}
  62752. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62753. },
  62754. args: ["aRequest"],
  62755. 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].",
  62756. referencedClasses: [],
  62757. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62758. }),
  62759. $globals.FileServer);
  62760. $core.addMethod(
  62761. $core.method({
  62762. selector: "password:",
  62763. protocol: "accessing",
  62764. fn: function (aPassword){
  62765. var self=this,$self=this;
  62766. $self["@password"]=aPassword;
  62767. return self;
  62768. },
  62769. args: ["aPassword"],
  62770. source: "password: aPassword\x0a\x09password := aPassword.",
  62771. referencedClasses: [],
  62772. messageSends: []
  62773. }),
  62774. $globals.FileServer);
  62775. $core.addMethod(
  62776. $core.method({
  62777. selector: "port",
  62778. protocol: "accessing",
  62779. fn: function (){
  62780. var self=this,$self=this;
  62781. return $self["@port"];
  62782. },
  62783. args: [],
  62784. source: "port\x0a\x09^ port",
  62785. referencedClasses: [],
  62786. messageSends: []
  62787. }),
  62788. $globals.FileServer);
  62789. $core.addMethod(
  62790. $core.method({
  62791. selector: "port:",
  62792. protocol: "accessing",
  62793. fn: function (aNumber){
  62794. var self=this,$self=this;
  62795. $self["@port"]=aNumber;
  62796. return self;
  62797. },
  62798. args: ["aNumber"],
  62799. source: "port: aNumber\x0a\x09port := aNumber",
  62800. referencedClasses: [],
  62801. messageSends: []
  62802. }),
  62803. $globals.FileServer);
  62804. $core.addMethod(
  62805. $core.method({
  62806. selector: "require:",
  62807. protocol: "private",
  62808. fn: function (aModuleString){
  62809. var self=this,$self=this;
  62810. return $core.withContext(function($ctx1) {
  62811. return $recv(require)._value_(aModuleString);
  62812. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62813. },
  62814. args: ["aModuleString"],
  62815. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62816. referencedClasses: [],
  62817. messageSends: ["value:"]
  62818. }),
  62819. $globals.FileServer);
  62820. $core.addMethod(
  62821. $core.method({
  62822. selector: "respondAuthenticationRequiredTo:",
  62823. protocol: "request handling",
  62824. fn: function (aResponse){
  62825. var self=this,$self=this;
  62826. return $core.withContext(function($ctx1) {
  62827. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62828. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62829. $recv(aResponse)._end();
  62830. return self;
  62831. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62832. },
  62833. args: ["aResponse"],
  62834. 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.",
  62835. referencedClasses: [],
  62836. messageSends: ["writeHead:options:", "write:", "end"]
  62837. }),
  62838. $globals.FileServer);
  62839. $core.addMethod(
  62840. $core.method({
  62841. selector: "respondCreatedTo:",
  62842. protocol: "request handling",
  62843. fn: function (aResponse){
  62844. var self=this,$self=this;
  62845. return $core.withContext(function($ctx1) {
  62846. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62847. $recv(aResponse)._end();
  62848. return self;
  62849. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62850. },
  62851. args: ["aResponse"],
  62852. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62853. referencedClasses: [],
  62854. messageSends: ["writeHead:options:", "end"]
  62855. }),
  62856. $globals.FileServer);
  62857. $core.addMethod(
  62858. $core.method({
  62859. selector: "respondDirectoryNamed:from:to:",
  62860. protocol: "request handling",
  62861. fn: function (aDirname,aUrl,aResponse){
  62862. var self=this,$self=this;
  62863. return $core.withContext(function($ctx1) {
  62864. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62865. $2=$recv(aUrl)._pathname();
  62866. $ctx1.sendIdx["pathname"]=1;
  62867. $1=$recv($2)._endsWith_("/");
  62868. if($core.assert($1)){
  62869. $3=$recv(aDirname).__comma("index.html");
  62870. $ctx1.sendIdx[","]=1;
  62871. $self._respondFileNamed_to_($3,aResponse);
  62872. } else {
  62873. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62874. $7=$recv(aUrl)._search();
  62875. if(($receiver = $7) == null || $receiver.a$nil){
  62876. $6="";
  62877. } else {
  62878. $6=$7;
  62879. }
  62880. $4=$recv($5).__comma($6);
  62881. $ctx1.sendIdx[","]=2;
  62882. $self._respondRedirect_to_($4,aResponse);
  62883. }
  62884. return self;
  62885. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62886. },
  62887. args: ["aDirname", "aUrl", "aResponse"],
  62888. 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]",
  62889. referencedClasses: [],
  62890. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62891. }),
  62892. $globals.FileServer);
  62893. $core.addMethod(
  62894. $core.method({
  62895. selector: "respondFileNamed:to:",
  62896. protocol: "request handling",
  62897. fn: function (aFilename,aResponse){
  62898. var self=this,$self=this;
  62899. var type,filename;
  62900. return $core.withContext(function($ctx1) {
  62901. var $1,$2,$3,$4;
  62902. filename=aFilename;
  62903. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62904. return $core.withContext(function($ctx2) {
  62905. $1=$recv(ex)._notNil();
  62906. if($core.assert($1)){
  62907. $2=console;
  62908. $3=$recv(filename).__comma(" does not exist");
  62909. $ctx2.sendIdx[","]=1;
  62910. $recv($2)._log_($3);
  62911. return $self._respondNotFoundTo_(aResponse);
  62912. } else {
  62913. type=$recv($self._class())._mimeTypeFor_(filename);
  62914. $4=$recv(type).__eq("application/javascript");
  62915. if($core.assert($4)){
  62916. type=$recv(type).__comma(";charset=utf-8");
  62917. type;
  62918. }
  62919. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62920. $recv(aResponse)._write_encoding_(file,"binary");
  62921. return $recv(aResponse)._end();
  62922. }
  62923. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62924. }));
  62925. return self;
  62926. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62927. },
  62928. args: ["aFilename", "aResponse"],
  62929. 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]]",
  62930. referencedClasses: [],
  62931. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62932. }),
  62933. $globals.FileServer);
  62934. $core.addMethod(
  62935. $core.method({
  62936. selector: "respondInternalErrorTo:",
  62937. protocol: "request handling",
  62938. fn: function (aResponse){
  62939. var self=this,$self=this;
  62940. return $core.withContext(function($ctx1) {
  62941. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62942. $recv(aResponse)._write_("500 Internal server error");
  62943. $recv(aResponse)._end();
  62944. return self;
  62945. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62946. },
  62947. args: ["aResponse"],
  62948. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62949. referencedClasses: [],
  62950. messageSends: ["writeHead:options:", "write:", "end"]
  62951. }),
  62952. $globals.FileServer);
  62953. $core.addMethod(
  62954. $core.method({
  62955. selector: "respondNotCreatedTo:",
  62956. protocol: "request handling",
  62957. fn: function (aResponse){
  62958. var self=this,$self=this;
  62959. return $core.withContext(function($ctx1) {
  62960. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62961. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62962. $recv(aResponse)._end();
  62963. return self;
  62964. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62965. },
  62966. args: ["aResponse"],
  62967. 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.",
  62968. referencedClasses: [],
  62969. messageSends: ["writeHead:options:", "write:", "end"]
  62970. }),
  62971. $globals.FileServer);
  62972. $core.addMethod(
  62973. $core.method({
  62974. selector: "respondNotFoundTo:",
  62975. protocol: "request handling",
  62976. fn: function (aResponse){
  62977. var self=this,$self=this;
  62978. return $core.withContext(function($ctx1) {
  62979. var $2,$1;
  62980. $2=$self._fallbackPage();
  62981. $ctx1.sendIdx["fallbackPage"]=1;
  62982. $1=$recv($2)._isNil();
  62983. if(!$core.assert($1)){
  62984. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62985. }
  62986. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62987. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62988. $ctx1.sendIdx["write:"]=1;
  62989. $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>");
  62990. $ctx1.sendIdx["write:"]=2;
  62991. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62992. $ctx1.sendIdx["write:"]=3;
  62993. $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>");
  62994. $ctx1.sendIdx["write:"]=4;
  62995. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62996. $ctx1.sendIdx["write:"]=5;
  62997. $recv(aResponse)._write_("</ul></p></body></html>");
  62998. $recv(aResponse)._end();
  62999. return self;
  63000. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  63001. },
  63002. args: ["aResponse"],
  63003. 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",
  63004. referencedClasses: [],
  63005. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  63006. }),
  63007. $globals.FileServer);
  63008. $core.addMethod(
  63009. $core.method({
  63010. selector: "respondOKTo:",
  63011. protocol: "request handling",
  63012. fn: function (aResponse){
  63013. var self=this,$self=this;
  63014. return $core.withContext(function($ctx1) {
  63015. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  63016. $recv(aResponse)._end();
  63017. return self;
  63018. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  63019. },
  63020. args: ["aResponse"],
  63021. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  63022. referencedClasses: [],
  63023. messageSends: ["writeHead:options:", "end"]
  63024. }),
  63025. $globals.FileServer);
  63026. $core.addMethod(
  63027. $core.method({
  63028. selector: "respondRedirect:to:",
  63029. protocol: "request handling",
  63030. fn: function (aString,aResponse){
  63031. var self=this,$self=this;
  63032. return $core.withContext(function($ctx1) {
  63033. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  63034. $recv(aResponse)._end();
  63035. return self;
  63036. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  63037. },
  63038. args: ["aString", "aResponse"],
  63039. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  63040. referencedClasses: [],
  63041. messageSends: ["writeHead:options:", "end"]
  63042. }),
  63043. $globals.FileServer);
  63044. $core.addMethod(
  63045. $core.method({
  63046. selector: "start",
  63047. protocol: "starting",
  63048. fn: function (){
  63049. var self=this,$self=this;
  63050. return $core.withContext(function($ctx1) {
  63051. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  63052. $self._checkDirectoryLayout();
  63053. $1=$recv($self["@http"])._createServer_((function(request,response){
  63054. return $core.withContext(function($ctx2) {
  63055. return $self._handleRequest_respondTo_(request,response);
  63056. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  63057. }));
  63058. $recv($1)._on_do_("error",(function(error){
  63059. return $core.withContext(function($ctx2) {
  63060. $2=console;
  63061. $3="Error starting server: ".__comma(error);
  63062. $ctx2.sendIdx[","]=1;
  63063. return $recv($2)._log_($3);
  63064. $ctx2.sendIdx["log:"]=1;
  63065. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  63066. }));
  63067. $ctx1.sendIdx["on:do:"]=1;
  63068. $recv($1)._on_do_("listening",(function(){
  63069. return $core.withContext(function($ctx2) {
  63070. $4=console;
  63071. $8=$self._host();
  63072. $ctx2.sendIdx["host"]=1;
  63073. $7="Starting file server on http://".__comma($8);
  63074. $6=$recv($7).__comma(":");
  63075. $ctx2.sendIdx[","]=3;
  63076. $10=$self._port();
  63077. $ctx2.sendIdx["port"]=1;
  63078. $9=$recv($10)._asString();
  63079. $5=$recv($6).__comma($9);
  63080. $ctx2.sendIdx[","]=2;
  63081. return $recv($4)._log_($5);
  63082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63083. }));
  63084. $recv($1)._listen_host_($self._port(),$self._host());
  63085. return self;
  63086. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  63087. },
  63088. args: [],
  63089. 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.",
  63090. referencedClasses: [],
  63091. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  63092. }),
  63093. $globals.FileServer);
  63094. $core.addMethod(
  63095. $core.method({
  63096. selector: "startOn:",
  63097. protocol: "starting",
  63098. fn: function (aPort){
  63099. var self=this,$self=this;
  63100. return $core.withContext(function($ctx1) {
  63101. $self._port_(aPort);
  63102. $self._start();
  63103. return self;
  63104. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  63105. },
  63106. args: ["aPort"],
  63107. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  63108. referencedClasses: [],
  63109. messageSends: ["port:", "start"]
  63110. }),
  63111. $globals.FileServer);
  63112. $core.addMethod(
  63113. $core.method({
  63114. selector: "username:",
  63115. protocol: "accessing",
  63116. fn: function (aUsername){
  63117. var self=this,$self=this;
  63118. $self["@username"]=aUsername;
  63119. return self;
  63120. },
  63121. args: ["aUsername"],
  63122. source: "username: aUsername\x0a\x09username := aUsername.",
  63123. referencedClasses: [],
  63124. messageSends: []
  63125. }),
  63126. $globals.FileServer);
  63127. $core.addMethod(
  63128. $core.method({
  63129. selector: "validateBasePath",
  63130. protocol: "private",
  63131. fn: function (){
  63132. var self=this,$self=this;
  63133. return $core.withContext(function($ctx1) {
  63134. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63135. $1=$self["@fs"];
  63136. $2=$self._basePath();
  63137. $ctx1.sendIdx["basePath"]=1;
  63138. $recv($1)._stat_then_($2,(function(err,stat){
  63139. return $core.withContext(function($ctx2) {
  63140. if(($receiver = err) == null || $receiver.a$nil){
  63141. $3=$recv(stat)._isDirectory();
  63142. if(!$core.assert($3)){
  63143. $4=console;
  63144. $7=$self._basePath();
  63145. $ctx2.sendIdx["basePath"]=2;
  63146. $6="Warning: --base-path parameter ".__comma($7);
  63147. $ctx2.sendIdx[","]=2;
  63148. $5=$recv($6).__comma(" is not a directory.");
  63149. $ctx2.sendIdx[","]=1;
  63150. return $recv($4)._warn_($5);
  63151. $ctx2.sendIdx["warn:"]=1;
  63152. }
  63153. } else {
  63154. $8=console;
  63155. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63156. $ctx2.sendIdx[","]=3;
  63157. return $recv($8)._warn_($9);
  63158. }
  63159. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63160. }));
  63161. return self;
  63162. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63163. },
  63164. args: [],
  63165. 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.' ]].",
  63166. referencedClasses: [],
  63167. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63168. }),
  63169. $globals.FileServer);
  63170. $core.addMethod(
  63171. $core.method({
  63172. selector: "withBasePath:",
  63173. protocol: "private",
  63174. fn: function (aBaseRelativePath){
  63175. var self=this,$self=this;
  63176. return $core.withContext(function($ctx1) {
  63177. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  63178. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63179. },
  63180. args: ["aBaseRelativePath"],
  63181. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63182. referencedClasses: [],
  63183. messageSends: ["join:with:", "basePath"]
  63184. }),
  63185. $globals.FileServer);
  63186. $core.addMethod(
  63187. $core.method({
  63188. selector: "writeData:toFileNamed:",
  63189. protocol: "private",
  63190. fn: function (data,aFilename){
  63191. var self=this,$self=this;
  63192. return $core.withContext(function($ctx1) {
  63193. $recv(console)._log_(aFilename);
  63194. return self;
  63195. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63196. },
  63197. args: ["data", "aFilename"],
  63198. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63199. referencedClasses: [],
  63200. messageSends: ["log:"]
  63201. }),
  63202. $globals.FileServer);
  63203. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  63204. $core.addMethod(
  63205. $core.method({
  63206. selector: "commandLineSwitches",
  63207. protocol: "accessing",
  63208. fn: function (){
  63209. var self=this,$self=this;
  63210. var switches;
  63211. return $core.withContext(function($ctx1) {
  63212. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63213. return $core.withContext(function($ctx2) {
  63214. return $recv(each)._selector();
  63215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63216. }));
  63217. $ctx1.sendIdx["collect:"]=1;
  63218. switches=$recv(switches)._select_((function(each){
  63219. return $core.withContext(function($ctx2) {
  63220. return $recv(each)._match_("^[^:]*:$");
  63221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63222. }));
  63223. switches=$recv(switches)._collect_((function(each){
  63224. return $core.withContext(function($ctx2) {
  63225. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63226. $ctx2.sendIdx["replace:with:"]=1;
  63227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63228. }));
  63229. return switches;
  63230. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63231. },
  63232. args: [],
  63233. 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",
  63234. referencedClasses: [],
  63235. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63236. }),
  63237. $globals.FileServer.a$cls);
  63238. $core.addMethod(
  63239. $core.method({
  63240. selector: "createServerWithArguments:",
  63241. protocol: "initialization",
  63242. fn: function (options){
  63243. var self=this,$self=this;
  63244. var server,popFront,front,optionName,optionValue,switches;
  63245. return $core.withContext(function($ctx1) {
  63246. var $1,$2,$3,$4,$5,$6,$7,$8;
  63247. var $early={};
  63248. try {
  63249. switches=$self._commandLineSwitches();
  63250. server=$self._new();
  63251. $recv(options)._ifEmpty_((function(){
  63252. throw $early=[server];
  63253. }));
  63254. $1=$recv($recv(options)._size())._even();
  63255. if(!$core.assert($1)){
  63256. $recv(console)._log_("Using default parameters.");
  63257. $ctx1.sendIdx["log:"]=1;
  63258. $2=console;
  63259. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63260. $ctx1.sendIdx[","]=1;
  63261. $recv($2)._log_($3);
  63262. $ctx1.sendIdx["log:"]=2;
  63263. $4=console;
  63264. $5="Use any of the following ones: ".__comma(switches);
  63265. $ctx1.sendIdx[","]=2;
  63266. $recv($4)._log_($5);
  63267. $ctx1.sendIdx["log:"]=3;
  63268. return server;
  63269. }
  63270. popFront=(function(args){
  63271. return $core.withContext(function($ctx2) {
  63272. front=$recv(args)._first();
  63273. $recv(args)._remove_(front);
  63274. return front;
  63275. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63276. });
  63277. $recv((function(){
  63278. return $core.withContext(function($ctx2) {
  63279. return $recv(options)._notEmpty();
  63280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63281. }))._whileTrue_((function(){
  63282. return $core.withContext(function($ctx2) {
  63283. optionName=$recv(popFront)._value_(options);
  63284. $ctx2.sendIdx["value:"]=1;
  63285. optionValue=$recv(popFront)._value_(options);
  63286. $6=$recv(switches)._includes_(optionName);
  63287. if($core.assert($6)){
  63288. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63289. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63290. } else {
  63291. $7=console;
  63292. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63293. $ctx2.sendIdx[","]=3;
  63294. $recv($7)._log_($8);
  63295. $ctx2.sendIdx["log:"]=4;
  63296. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63297. }
  63298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63299. }));
  63300. return server;
  63301. }
  63302. catch(e) {if(e===$early)return e[0]; throw e}
  63303. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63304. },
  63305. args: ["options"],
  63306. 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.",
  63307. referencedClasses: ["Array"],
  63308. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63309. }),
  63310. $globals.FileServer.a$cls);
  63311. $core.addMethod(
  63312. $core.method({
  63313. selector: "defaultBasePath",
  63314. protocol: "accessing",
  63315. fn: function (){
  63316. var self=this,$self=this;
  63317. return "./";
  63318. },
  63319. args: [],
  63320. source: "defaultBasePath\x0a\x09^ './'",
  63321. referencedClasses: [],
  63322. messageSends: []
  63323. }),
  63324. $globals.FileServer.a$cls);
  63325. $core.addMethod(
  63326. $core.method({
  63327. selector: "defaultHost",
  63328. protocol: "accessing",
  63329. fn: function (){
  63330. var self=this,$self=this;
  63331. return "127.0.0.1";
  63332. },
  63333. args: [],
  63334. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63335. referencedClasses: [],
  63336. messageSends: []
  63337. }),
  63338. $globals.FileServer.a$cls);
  63339. $core.addMethod(
  63340. $core.method({
  63341. selector: "defaultMimeTypes",
  63342. protocol: "accessing",
  63343. fn: function (){
  63344. var self=this,$self=this;
  63345. 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"]);
  63346. },
  63347. args: [],
  63348. 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}",
  63349. referencedClasses: [],
  63350. messageSends: []
  63351. }),
  63352. $globals.FileServer.a$cls);
  63353. $core.addMethod(
  63354. $core.method({
  63355. selector: "defaultPort",
  63356. protocol: "accessing",
  63357. fn: function (){
  63358. var self=this,$self=this;
  63359. return (4000);
  63360. },
  63361. args: [],
  63362. source: "defaultPort\x0a\x09^ 4000",
  63363. referencedClasses: [],
  63364. messageSends: []
  63365. }),
  63366. $globals.FileServer.a$cls);
  63367. $core.addMethod(
  63368. $core.method({
  63369. selector: "main",
  63370. protocol: "initialization",
  63371. fn: function (){
  63372. var self=this,$self=this;
  63373. var fileServer,args;
  63374. return $core.withContext(function($ctx1) {
  63375. var $1;
  63376. var $early={};
  63377. try {
  63378. args=$recv(process)._argv();
  63379. $recv(args)._removeFrom_to_((1),(3));
  63380. $recv(args)._detect_ifNone_((function(each){
  63381. return $core.withContext(function($ctx2) {
  63382. $1=$recv(each).__eq("--help");
  63383. if($core.assert($1)){
  63384. return $recv($globals.FileServer)._printHelp();
  63385. }
  63386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63387. }),(function(){
  63388. return $core.withContext(function($ctx2) {
  63389. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63390. throw $early=[$recv(fileServer)._start()];
  63391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63392. }));
  63393. return self;
  63394. }
  63395. catch(e) {if(e===$early)return e[0]; throw e}
  63396. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63397. },
  63398. args: [],
  63399. 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]",
  63400. referencedClasses: ["FileServer"],
  63401. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63402. }),
  63403. $globals.FileServer.a$cls);
  63404. $core.addMethod(
  63405. $core.method({
  63406. selector: "mimeTypeFor:",
  63407. protocol: "accessing",
  63408. fn: function (aString){
  63409. var self=this,$self=this;
  63410. return $core.withContext(function($ctx1) {
  63411. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63412. return "text/plain";
  63413. }));
  63414. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63415. },
  63416. args: ["aString"],
  63417. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63418. referencedClasses: [],
  63419. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63420. }),
  63421. $globals.FileServer.a$cls);
  63422. $core.addMethod(
  63423. $core.method({
  63424. selector: "mimeTypes",
  63425. protocol: "accessing",
  63426. fn: function (){
  63427. var self=this,$self=this;
  63428. return $core.withContext(function($ctx1) {
  63429. var $1,$receiver;
  63430. $1=$self["@mimeTypes"];
  63431. if(($receiver = $1) == null || $receiver.a$nil){
  63432. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63433. return $self["@mimeTypes"];
  63434. } else {
  63435. return $1;
  63436. }
  63437. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63438. },
  63439. args: [],
  63440. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63441. referencedClasses: [],
  63442. messageSends: ["ifNil:", "defaultMimeTypes"]
  63443. }),
  63444. $globals.FileServer.a$cls);
  63445. $core.addMethod(
  63446. $core.method({
  63447. selector: "printHelp",
  63448. protocol: "accessing",
  63449. fn: function (){
  63450. var self=this,$self=this;
  63451. return $core.withContext(function($ctx1) {
  63452. $recv(console)._log_("Available commandline options are:");
  63453. $ctx1.sendIdx["log:"]=1;
  63454. $recv(console)._log_("--help");
  63455. $ctx1.sendIdx["log:"]=2;
  63456. $recv($self._commandLineSwitches())._do_((function(each){
  63457. return $core.withContext(function($ctx2) {
  63458. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63460. }));
  63461. return self;
  63462. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63463. },
  63464. args: [],
  63465. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63466. referencedClasses: [],
  63467. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63468. }),
  63469. $globals.FileServer.a$cls);
  63470. $core.addMethod(
  63471. $core.method({
  63472. selector: "selectorForCommandLineSwitch:",
  63473. protocol: "accessing",
  63474. fn: function (aSwitch){
  63475. var self=this,$self=this;
  63476. return $core.withContext(function($ctx1) {
  63477. var $1;
  63478. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63479. return $core.withContext(function($ctx2) {
  63480. return $recv($recv(each)._second())._asUppercase();
  63481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63482. }));
  63483. $ctx1.sendIdx["replace:with:"]=1;
  63484. return $recv($1).__comma(":");
  63485. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63486. },
  63487. args: ["aSwitch"],
  63488. 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 ]), ':'",
  63489. referencedClasses: [],
  63490. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63491. }),
  63492. $globals.FileServer.a$cls);
  63493. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63494. $core.addMethod(
  63495. $core.method({
  63496. selector: "bowerInstallThenDo:",
  63497. protocol: "action",
  63498. fn: function (aBlock){
  63499. var self=this,$self=this;
  63500. var child;
  63501. return $core.withContext(function($ctx1) {
  63502. var $1,$3,$2;
  63503. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  63504. $1=child;
  63505. $recv($1)._on_do_("error",aBlock);
  63506. $ctx1.sendIdx["on:do:"]=1;
  63507. $recv($1)._on_do_("close",(function(code){
  63508. return $core.withContext(function($ctx2) {
  63509. $3=$recv(code).__eq((0));
  63510. if($core.assert($3)){
  63511. $2=nil;
  63512. } else {
  63513. $2=code;
  63514. }
  63515. return $recv(aBlock)._value_($2);
  63516. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63517. }));
  63518. return self;
  63519. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63520. },
  63521. args: ["aBlock"],
  63522. 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 ]) ]",
  63523. referencedClasses: [],
  63524. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63525. }),
  63526. $globals.Initer);
  63527. $core.addMethod(
  63528. $core.method({
  63529. selector: "finishMessage",
  63530. protocol: "action",
  63531. fn: function (){
  63532. var self=this,$self=this;
  63533. return $core.withContext(function($ctx1) {
  63534. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63535. $recv((function(){
  63536. }))._valueWithTimeout_((600));
  63537. return self;
  63538. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63539. },
  63540. args: [],
  63541. 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",
  63542. referencedClasses: ["String"],
  63543. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63544. }),
  63545. $globals.Initer);
  63546. $core.addMethod(
  63547. $core.method({
  63548. selector: "gruntInitThenDo:",
  63549. protocol: "action",
  63550. fn: function (aBlock){
  63551. var self=this,$self=this;
  63552. var child,sanitizedTemplatePath;
  63553. return $core.withContext(function($ctx1) {
  63554. var $1,$3,$2;
  63555. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63556. $ctx1.sendIdx["replace:with:"]=1;
  63557. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63558. $1=child;
  63559. $recv($1)._on_do_("error",aBlock);
  63560. $ctx1.sendIdx["on:do:"]=1;
  63561. $recv($1)._on_do_("close",(function(code){
  63562. return $core.withContext(function($ctx2) {
  63563. $3=$recv(code).__eq((0));
  63564. if($core.assert($3)){
  63565. $2=nil;
  63566. } else {
  63567. $2=code;
  63568. }
  63569. return $recv(aBlock)._value_($2);
  63570. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63571. }));
  63572. return self;
  63573. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63574. },
  63575. args: ["aBlock"],
  63576. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63577. referencedClasses: [],
  63578. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63579. }),
  63580. $globals.Initer);
  63581. $core.addMethod(
  63582. $core.method({
  63583. selector: "gruntThenDo:",
  63584. protocol: "action",
  63585. fn: function (aBlock){
  63586. var self=this,$self=this;
  63587. var child;
  63588. return $core.withContext(function($ctx1) {
  63589. var $1,$3,$2;
  63590. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  63591. $1=child;
  63592. $recv($1)._on_do_("error",aBlock);
  63593. $ctx1.sendIdx["on:do:"]=1;
  63594. $recv($1)._on_do_("close",(function(code){
  63595. return $core.withContext(function($ctx2) {
  63596. $3=$recv(code).__eq((0));
  63597. if($core.assert($3)){
  63598. $2=nil;
  63599. } else {
  63600. $2=code;
  63601. }
  63602. return $recv(aBlock)._value_($2);
  63603. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63604. }));
  63605. return self;
  63606. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63607. },
  63608. args: ["aBlock"],
  63609. 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 ]) ]",
  63610. referencedClasses: [],
  63611. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63612. }),
  63613. $globals.Initer);
  63614. $core.addMethod(
  63615. $core.method({
  63616. selector: "initialize",
  63617. protocol: "initialization",
  63618. fn: function (){
  63619. var self=this,$self=this;
  63620. return $core.withContext(function($ctx1) {
  63621. (
  63622. $ctx1.supercall = true,
  63623. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63624. $ctx1.supercall = false;
  63625. $self["@childProcess"]=$recv(require)._value_("child_process");
  63626. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63627. return self;
  63628. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63629. },
  63630. args: [],
  63631. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63632. referencedClasses: [],
  63633. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63634. }),
  63635. $globals.Initer);
  63636. $core.addMethod(
  63637. $core.method({
  63638. selector: "npmInstallThenDo:",
  63639. protocol: "action",
  63640. fn: function (aBlock){
  63641. var self=this,$self=this;
  63642. var child;
  63643. return $core.withContext(function($ctx1) {
  63644. var $1;
  63645. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  63646. $1=$recv(child)._stdout();
  63647. $ctx1.sendIdx["stdout"]=1;
  63648. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63649. return self;
  63650. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63651. },
  63652. args: ["aBlock"],
  63653. 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 }",
  63654. referencedClasses: [],
  63655. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63656. }),
  63657. $globals.Initer);
  63658. $core.addMethod(
  63659. $core.method({
  63660. selector: "npmScriptForModule:named:",
  63661. protocol: "npm",
  63662. fn: function (aString,anotherString){
  63663. var self=this,$self=this;
  63664. var modulePath,packageJson,binSection,scriptPath;
  63665. return $core.withContext(function($ctx1) {
  63666. var $1,$3,$4,$2,$5;
  63667. $1=$self["@path"];
  63668. $3=$recv(require)._provided();
  63669. $4=$recv(aString).__comma("/package.json");
  63670. $ctx1.sendIdx[","]=1;
  63671. $2=$recv($3)._resolve_($4);
  63672. modulePath=$recv($1)._dirname_($2);
  63673. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63674. binSection=$recv(packageJson)._at_("bin");
  63675. $ctx1.sendIdx["at:"]=1;
  63676. $5=$recv(binSection)._isString();
  63677. if($core.assert($5)){
  63678. scriptPath=binSection;
  63679. } else {
  63680. scriptPath=$recv(binSection)._at_(anotherString);
  63681. }
  63682. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63683. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63684. },
  63685. args: ["aString", "anotherString"],
  63686. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09require provided resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  63687. referencedClasses: ["Smalltalk"],
  63688. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63689. }),
  63690. $globals.Initer);
  63691. $core.addMethod(
  63692. $core.method({
  63693. selector: "start",
  63694. protocol: "action",
  63695. fn: function (){
  63696. var self=this,$self=this;
  63697. return $core.withContext(function($ctx1) {
  63698. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63699. $self._gruntInitThenDo_((function(error){
  63700. return $core.withContext(function($ctx2) {
  63701. if(($receiver = error) == null || $receiver.a$nil){
  63702. return $self._bowerInstallThenDo_((function(error2){
  63703. return $core.withContext(function($ctx3) {
  63704. if(($receiver = error2) == null || $receiver.a$nil){
  63705. return $self._npmInstallThenDo_((function(error3){
  63706. return $core.withContext(function($ctx4) {
  63707. if(($receiver = error3) == null || $receiver.a$nil){
  63708. return $self._gruntThenDo_((function(error4){
  63709. return $core.withContext(function($ctx5) {
  63710. if(($receiver = error4) == null || $receiver.a$nil){
  63711. $self._finishMessage();
  63712. return $recv(process)._exit();
  63713. } else {
  63714. $7=console;
  63715. $recv($7)._log_("grunt exec error:");
  63716. $ctx5.sendIdx["log:"]=7;
  63717. $recv($7)._log_(error4);
  63718. return $recv(process)._exit_((104));
  63719. }
  63720. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63721. }));
  63722. } else {
  63723. $5=console;
  63724. $recv($5)._log_("npm install exec error:");
  63725. $ctx4.sendIdx["log:"]=5;
  63726. $6=$recv($5)._log_(error3);
  63727. $ctx4.sendIdx["log:"]=6;
  63728. return $recv(process)._exit_((103));
  63729. $ctx4.sendIdx["exit:"]=3;
  63730. }
  63731. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63732. }));
  63733. } else {
  63734. $3=console;
  63735. $recv($3)._log_("bower install exec error:");
  63736. $ctx3.sendIdx["log:"]=3;
  63737. $4=$recv($3)._log_(error2);
  63738. $ctx3.sendIdx["log:"]=4;
  63739. return $recv(process)._exit_((102));
  63740. $ctx3.sendIdx["exit:"]=2;
  63741. }
  63742. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63743. }));
  63744. } else {
  63745. $1=console;
  63746. $recv($1)._log_("grunt-init exec error:");
  63747. $ctx2.sendIdx["log:"]=1;
  63748. $2=$recv($1)._log_(error);
  63749. $ctx2.sendIdx["log:"]=2;
  63750. return $recv(process)._exit_((101));
  63751. $ctx2.sendIdx["exit:"]=1;
  63752. }
  63753. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63754. }));
  63755. return self;
  63756. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63757. },
  63758. args: [],
  63759. 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 ]]]]]]]]",
  63760. referencedClasses: [],
  63761. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63762. }),
  63763. $globals.Initer);
  63764. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63765. $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.";
  63766. $core.addMethod(
  63767. $core.method({
  63768. selector: "addVariableNamed:to:",
  63769. protocol: "private",
  63770. fn: function (aString,anObject){
  63771. var self=this,$self=this;
  63772. var newClass,newObject;
  63773. return $core.withContext(function($ctx1) {
  63774. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63775. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63776. newObject=$recv(newClass)._new();
  63777. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63778. return newObject;
  63779. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63780. },
  63781. args: ["aString", "anObject"],
  63782. 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",
  63783. referencedClasses: [],
  63784. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63785. }),
  63786. $globals.Repl);
  63787. $core.addMethod(
  63788. $core.method({
  63789. selector: "assignNewVariable:do:",
  63790. protocol: "private",
  63791. fn: function (buffer,aBlock){
  63792. var self=this,$self=this;
  63793. return $core.withContext(function($ctx1) {
  63794. var $2,$3,$1,$receiver;
  63795. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63796. var varName,value;
  63797. return $core.withContext(function($ctx2) {
  63798. if(($receiver = name) == null || $receiver.a$nil){
  63799. varName=$self._nextResultName();
  63800. } else {
  63801. varName=name;
  63802. }
  63803. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63804. $recv((function(){
  63805. return $core.withContext(function($ctx3) {
  63806. $2=$recv(varName).__comma(" := ");
  63807. if(($receiver = expr) == null || $receiver.a$nil){
  63808. $3=buffer;
  63809. } else {
  63810. $3=expr;
  63811. }
  63812. $1=$recv($2).__comma($3);
  63813. $ctx3.sendIdx[","]=1;
  63814. value=$self._eval_on_($1,$self["@session"]);
  63815. return value;
  63816. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63817. }))._on_do_($globals.Error,(function(e){
  63818. return $core.withContext(function($ctx3) {
  63819. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63820. value=nil;
  63821. return value;
  63822. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63823. }));
  63824. return $recv(aBlock)._value_value_(varName,value);
  63825. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63826. }));
  63827. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63828. },
  63829. args: ["buffer", "aBlock"],
  63830. 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]",
  63831. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63832. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63833. }),
  63834. $globals.Repl);
  63835. $core.addMethod(
  63836. $core.method({
  63837. selector: "clearScreen",
  63838. protocol: "actions",
  63839. fn: function (){
  63840. var self=this,$self=this;
  63841. var esc,cls;
  63842. return $core.withContext(function($ctx1) {
  63843. var $1;
  63844. esc=$recv($globals.String)._fromCharCode_((27));
  63845. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63846. $ctx1.sendIdx[","]=2;
  63847. cls=$recv($1).__comma("[0;0f");
  63848. $ctx1.sendIdx[","]=1;
  63849. $recv($recv(process)._stdout())._write_(cls);
  63850. $recv($self["@interface"])._prompt();
  63851. return self;
  63852. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63853. },
  63854. args: [],
  63855. 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",
  63856. referencedClasses: ["String"],
  63857. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63858. }),
  63859. $globals.Repl);
  63860. $core.addMethod(
  63861. $core.method({
  63862. selector: "close",
  63863. protocol: "actions",
  63864. fn: function (){
  63865. var self=this,$self=this;
  63866. return $core.withContext(function($ctx1) {
  63867. $recv($recv(process)._stdin())._destroy();
  63868. return self;
  63869. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63870. },
  63871. args: [],
  63872. source: "close\x0a\x09process stdin destroy",
  63873. referencedClasses: [],
  63874. messageSends: ["destroy", "stdin"]
  63875. }),
  63876. $globals.Repl);
  63877. $core.addMethod(
  63878. $core.method({
  63879. selector: "commands",
  63880. protocol: "accessing",
  63881. fn: function (){
  63882. var self=this,$self=this;
  63883. return $self["@commands"];
  63884. },
  63885. args: [],
  63886. source: "commands\x0a\x09^ commands",
  63887. referencedClasses: [],
  63888. messageSends: []
  63889. }),
  63890. $globals.Repl);
  63891. $core.addMethod(
  63892. $core.method({
  63893. selector: "createInterface",
  63894. protocol: "actions",
  63895. fn: function (){
  63896. var self=this,$self=this;
  63897. return $core.withContext(function($ctx1) {
  63898. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63899. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63900. return $core.withContext(function($ctx2) {
  63901. return $self._processLine_(buffer);
  63902. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63903. }));
  63904. $ctx1.sendIdx["on:do:"]=1;
  63905. $recv($self["@interface"])._on_do_("close",(function(){
  63906. return $core.withContext(function($ctx2) {
  63907. return $self._close();
  63908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63909. }));
  63910. $self._printWelcome();
  63911. $self._setupHotkeys();
  63912. $self._setPrompt();
  63913. $recv($self["@interface"])._prompt();
  63914. return self;
  63915. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63916. },
  63917. args: [],
  63918. 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",
  63919. referencedClasses: [],
  63920. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63921. }),
  63922. $globals.Repl);
  63923. $core.addMethod(
  63924. $core.method({
  63925. selector: "encapsulateVariable:withValue:in:",
  63926. protocol: "private",
  63927. fn: function (aString,anObject,aClass){
  63928. var self=this,$self=this;
  63929. var compiler;
  63930. return $core.withContext(function($ctx1) {
  63931. var $1,$4,$3,$2,$5,$6;
  63932. compiler=$recv($globals.Compiler)._new();
  63933. $1=compiler;
  63934. $4=$recv(aString).__comma(": anObject ^ ");
  63935. $ctx1.sendIdx[","]=3;
  63936. $3=$recv($4).__comma(aString);
  63937. $ctx1.sendIdx[","]=2;
  63938. $2=$recv($3).__comma(" := anObject");
  63939. $ctx1.sendIdx[","]=1;
  63940. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63941. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63942. $5=compiler;
  63943. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63944. $ctx1.sendIdx[","]=4;
  63945. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63946. return self;
  63947. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63948. },
  63949. args: ["aString", "anObject", "aClass"],
  63950. 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'.",
  63951. referencedClasses: ["Compiler"],
  63952. messageSends: ["new", "install:forClass:protocol:", ","]
  63953. }),
  63954. $globals.Repl);
  63955. $core.addMethod(
  63956. $core.method({
  63957. selector: "eval:",
  63958. protocol: "actions",
  63959. fn: function (buffer){
  63960. var self=this,$self=this;
  63961. return $core.withContext(function($ctx1) {
  63962. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63963. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63964. },
  63965. args: ["buffer"],
  63966. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63967. referencedClasses: ["DoIt"],
  63968. messageSends: ["eval:on:", "new"]
  63969. }),
  63970. $globals.Repl);
  63971. $core.addMethod(
  63972. $core.method({
  63973. selector: "eval:on:",
  63974. protocol: "actions",
  63975. fn: function (buffer,anObject){
  63976. var self=this,$self=this;
  63977. var result;
  63978. return $core.withContext(function($ctx1) {
  63979. var $1;
  63980. $recv(buffer)._ifNotEmpty_((function(){
  63981. return $core.withContext(function($ctx2) {
  63982. return $recv((function(){
  63983. return $core.withContext(function($ctx3) {
  63984. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63985. return result;
  63986. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63987. }))._tryCatch_((function(e){
  63988. return $core.withContext(function($ctx3) {
  63989. $1=$recv(e)._isSmalltalkError();
  63990. if($core.assert($1)){
  63991. return $recv(e)._pass();
  63992. } else {
  63993. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63994. }
  63995. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63996. }));
  63997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63998. }));
  63999. return result;
  64000. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  64001. },
  64002. args: ["buffer", "anObject"],
  64003. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e pass ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  64004. referencedClasses: ["Compiler"],
  64005. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  64006. }),
  64007. $globals.Repl);
  64008. $core.addMethod(
  64009. $core.method({
  64010. selector: "executeCommand:",
  64011. protocol: "private",
  64012. fn: function (aString){
  64013. var self=this,$self=this;
  64014. return $core.withContext(function($ctx1) {
  64015. var $1;
  64016. var $early={};
  64017. try {
  64018. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  64019. return $core.withContext(function($ctx2) {
  64020. $1=$recv(names)._includes_(aString);
  64021. if($core.assert($1)){
  64022. $recv(cmd)._value();
  64023. throw $early=[true];
  64024. }
  64025. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  64026. }));
  64027. return false;
  64028. }
  64029. catch(e) {if(e===$early)return e[0]; throw e}
  64030. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  64031. },
  64032. args: ["aString"],
  64033. 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",
  64034. referencedClasses: [],
  64035. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  64036. }),
  64037. $globals.Repl);
  64038. $core.addMethod(
  64039. $core.method({
  64040. selector: "initialize",
  64041. protocol: "initialization",
  64042. fn: function (){
  64043. var self=this,$self=this;
  64044. return $core.withContext(function($ctx1) {
  64045. (
  64046. $ctx1.supercall = true,
  64047. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  64048. $ctx1.supercall = false;
  64049. $self["@session"]=$recv($globals.DoIt)._new();
  64050. $self["@readline"]=$recv(require)._value_("readline");
  64051. $ctx1.sendIdx["value:"]=1;
  64052. $self["@util"]=$recv(require)._value_("util");
  64053. $self._setupCommands();
  64054. return self;
  64055. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  64056. },
  64057. args: [],
  64058. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  64059. referencedClasses: ["DoIt"],
  64060. messageSends: ["initialize", "new", "value:", "setupCommands"]
  64061. }),
  64062. $globals.Repl);
  64063. $core.addMethod(
  64064. $core.method({
  64065. selector: "instanceVariableNamesFor:",
  64066. protocol: "private",
  64067. fn: function (aClass){
  64068. var self=this,$self=this;
  64069. return $core.withContext(function($ctx1) {
  64070. var $1,$2,$receiver;
  64071. $1=$recv(aClass)._superclass();
  64072. $ctx1.sendIdx["superclass"]=1;
  64073. if(($receiver = $1) == null || $receiver.a$nil){
  64074. return $recv(aClass)._instanceVariableNames();
  64075. } else {
  64076. $2=$recv(aClass)._instanceVariableNames();
  64077. $ctx1.sendIdx["instanceVariableNames"]=1;
  64078. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  64079. }
  64080. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  64081. },
  64082. args: ["aClass"],
  64083. 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]",
  64084. referencedClasses: [],
  64085. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  64086. }),
  64087. $globals.Repl);
  64088. $core.addMethod(
  64089. $core.method({
  64090. selector: "isIdentifier:",
  64091. protocol: "private",
  64092. fn: function (aString){
  64093. var self=this,$self=this;
  64094. return $core.withContext(function($ctx1) {
  64095. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  64096. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  64097. },
  64098. args: ["aString"],
  64099. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  64100. referencedClasses: [],
  64101. messageSends: ["match:", "asRegexp"]
  64102. }),
  64103. $globals.Repl);
  64104. $core.addMethod(
  64105. $core.method({
  64106. selector: "isVariableDefined:",
  64107. protocol: "private",
  64108. fn: function (aString){
  64109. var self=this,$self=this;
  64110. return $core.withContext(function($ctx1) {
  64111. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  64112. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  64113. },
  64114. args: ["aString"],
  64115. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  64116. referencedClasses: [],
  64117. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  64118. }),
  64119. $globals.Repl);
  64120. $core.addMethod(
  64121. $core.method({
  64122. selector: "nextResultName",
  64123. protocol: "private",
  64124. fn: function (){
  64125. var self=this,$self=this;
  64126. return $core.withContext(function($ctx1) {
  64127. var $1,$receiver;
  64128. $1=$self["@resultCount"];
  64129. if(($receiver = $1) == null || $receiver.a$nil){
  64130. $self["@resultCount"]=(1);
  64131. } else {
  64132. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  64133. }
  64134. return "res".__comma($recv($self["@resultCount"])._asString());
  64135. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  64136. },
  64137. args: [],
  64138. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  64139. referencedClasses: [],
  64140. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  64141. }),
  64142. $globals.Repl);
  64143. $core.addMethod(
  64144. $core.method({
  64145. selector: "onKeyPress:",
  64146. protocol: "private",
  64147. fn: function (key){
  64148. var self=this,$self=this;
  64149. return $core.withContext(function($ctx1) {
  64150. var $1;
  64151. $1=$recv($recv(key)._ctrl())._and_((function(){
  64152. return $core.withContext(function($ctx2) {
  64153. return $recv($recv(key)._name()).__eq("l");
  64154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64155. }));
  64156. if($core.assert($1)){
  64157. $self._clearScreen();
  64158. }
  64159. return self;
  64160. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  64161. },
  64162. args: ["key"],
  64163. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  64164. referencedClasses: [],
  64165. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  64166. }),
  64167. $globals.Repl);
  64168. $core.addMethod(
  64169. $core.method({
  64170. selector: "parseAssignment:do:",
  64171. protocol: "private",
  64172. fn: function (aString,aBlock){
  64173. var self=this,$self=this;
  64174. var assignment;
  64175. return $core.withContext(function($ctx1) {
  64176. var $2,$1;
  64177. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  64178. return $core.withContext(function($ctx2) {
  64179. return $recv(s)._trimBoth();
  64180. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  64181. }));
  64182. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  64183. return $core.withContext(function($ctx2) {
  64184. $2=$recv(assignment)._first();
  64185. $ctx2.sendIdx["first"]=1;
  64186. return $self._isIdentifier_($2);
  64187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64188. }));
  64189. if($core.assert($1)){
  64190. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  64191. $ctx1.sendIdx["value:value:"]=1;
  64192. } else {
  64193. return $recv(aBlock)._value_value_(nil,nil);
  64194. }
  64195. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  64196. },
  64197. args: ["aString", "aBlock"],
  64198. 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 ]",
  64199. referencedClasses: [],
  64200. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  64201. }),
  64202. $globals.Repl);
  64203. $core.addMethod(
  64204. $core.method({
  64205. selector: "presentResultNamed:withValue:",
  64206. protocol: "private",
  64207. fn: function (varName,value){
  64208. var self=this,$self=this;
  64209. return $core.withContext(function($ctx1) {
  64210. var $3,$2,$1;
  64211. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64212. $ctx1.sendIdx[","]=3;
  64213. $2=$recv($3).__comma(" = ");
  64214. $ctx1.sendIdx[","]=2;
  64215. $1=$recv($2).__comma($recv(value)._asString());
  64216. $ctx1.sendIdx[","]=1;
  64217. $recv($globals.Transcript)._show_($1);
  64218. $recv($globals.Transcript)._cr();
  64219. $recv($self["@interface"])._prompt();
  64220. return self;
  64221. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64222. },
  64223. args: ["varName", "value"],
  64224. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64225. referencedClasses: ["Transcript"],
  64226. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64227. }),
  64228. $globals.Repl);
  64229. $core.addMethod(
  64230. $core.method({
  64231. selector: "printWelcome",
  64232. protocol: "actions",
  64233. fn: function (){
  64234. var self=this,$self=this;
  64235. return $core.withContext(function($ctx1) {
  64236. $recv($globals.Transcript)._show_("Type :q to exit.");
  64237. $recv($globals.Transcript)._cr();
  64238. return self;
  64239. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64240. },
  64241. args: [],
  64242. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64243. referencedClasses: ["Transcript"],
  64244. messageSends: ["show:", "cr"]
  64245. }),
  64246. $globals.Repl);
  64247. $core.addMethod(
  64248. $core.method({
  64249. selector: "processLine:",
  64250. protocol: "private",
  64251. fn: function (buffer){
  64252. var self=this,$self=this;
  64253. var show;
  64254. return $core.withContext(function($ctx1) {
  64255. var $1,$2;
  64256. show=(function(varName,value){
  64257. return $core.withContext(function($ctx2) {
  64258. return $self._presentResultNamed_withValue_(varName,value);
  64259. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64260. });
  64261. $1=$self._executeCommand_(buffer);
  64262. if(!$core.assert($1)){
  64263. $2=$self._isVariableDefined_(buffer);
  64264. if($core.assert($2)){
  64265. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64266. } else {
  64267. $self._assignNewVariable_do_(buffer,show);
  64268. }
  64269. }
  64270. return self;
  64271. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64272. },
  64273. args: ["buffer"],
  64274. 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]]",
  64275. referencedClasses: [],
  64276. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64277. }),
  64278. $globals.Repl);
  64279. $core.addMethod(
  64280. $core.method({
  64281. selector: "prompt",
  64282. protocol: "accessing",
  64283. fn: function (){
  64284. var self=this,$self=this;
  64285. return "amber >> ";
  64286. },
  64287. args: [],
  64288. source: "prompt\x0a\x09^ 'amber >> '",
  64289. referencedClasses: [],
  64290. messageSends: []
  64291. }),
  64292. $globals.Repl);
  64293. $core.addMethod(
  64294. $core.method({
  64295. selector: "setPreviousVariablesFor:from:",
  64296. protocol: "private",
  64297. fn: function (newObject,oldObject){
  64298. var self=this,$self=this;
  64299. return $core.withContext(function($ctx1) {
  64300. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64301. return $core.withContext(function($ctx2) {
  64302. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64304. }));
  64305. return self;
  64306. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64307. },
  64308. args: ["newObject", "oldObject"],
  64309. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64310. referencedClasses: [],
  64311. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64312. }),
  64313. $globals.Repl);
  64314. $core.addMethod(
  64315. $core.method({
  64316. selector: "setPrompt",
  64317. protocol: "actions",
  64318. fn: function (){
  64319. var self=this,$self=this;
  64320. return $core.withContext(function($ctx1) {
  64321. $recv($self["@interface"])._setPrompt_($self._prompt());
  64322. return self;
  64323. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64324. },
  64325. args: [],
  64326. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64327. referencedClasses: [],
  64328. messageSends: ["setPrompt:", "prompt"]
  64329. }),
  64330. $globals.Repl);
  64331. $core.addMethod(
  64332. $core.method({
  64333. selector: "setupCommands",
  64334. protocol: "initialization",
  64335. fn: function (){
  64336. var self=this,$self=this;
  64337. return $core.withContext(function($ctx1) {
  64338. var $2,$1;
  64339. $2=$recv([":q"]).__minus_gt((function(){
  64340. return $core.withContext(function($ctx2) {
  64341. return $recv(process)._exit();
  64342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64343. }));
  64344. $ctx1.sendIdx["->"]=1;
  64345. $1=[$2,$recv([""]).__minus_gt((function(){
  64346. return $core.withContext(function($ctx2) {
  64347. return $recv($self["@interface"])._prompt();
  64348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64349. }))];
  64350. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64351. return self;
  64352. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64353. },
  64354. args: [],
  64355. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64356. referencedClasses: ["Dictionary"],
  64357. messageSends: ["from:", "->", "exit", "prompt"]
  64358. }),
  64359. $globals.Repl);
  64360. $core.addMethod(
  64361. $core.method({
  64362. selector: "setupHotkeys",
  64363. protocol: "initialization",
  64364. fn: function (){
  64365. var self=this,$self=this;
  64366. return $core.withContext(function($ctx1) {
  64367. var $receiver;
  64368. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64369. return $core.withContext(function($ctx2) {
  64370. if(($receiver = key) == null || $receiver.a$nil){
  64371. return key;
  64372. } else {
  64373. return $self._onKeyPress_(key);
  64374. }
  64375. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64376. }));
  64377. return self;
  64378. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64379. },
  64380. args: [],
  64381. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64382. referencedClasses: [],
  64383. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64384. }),
  64385. $globals.Repl);
  64386. $core.addMethod(
  64387. $core.method({
  64388. selector: "subclass:withVariable:",
  64389. protocol: "private",
  64390. fn: function (aClass,varName){
  64391. var self=this,$self=this;
  64392. return $core.withContext(function($ctx1) {
  64393. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64394. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64395. },
  64396. args: ["aClass", "varName"],
  64397. 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'",
  64398. referencedClasses: ["ClassBuilder"],
  64399. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64400. }),
  64401. $globals.Repl);
  64402. $core.addMethod(
  64403. $core.method({
  64404. selector: "subclassNameFor:",
  64405. protocol: "private",
  64406. fn: function (aClass){
  64407. var self=this,$self=this;
  64408. return $core.withContext(function($ctx1) {
  64409. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64410. $2=$recv(aClass)._name();
  64411. $ctx1.sendIdx["name"]=1;
  64412. $1=$recv($2)._matchesOf_("\x5cd+$");
  64413. $ctx1.sendIdx["matchesOf:"]=1;
  64414. if(($receiver = $1) == null || $receiver.a$nil){
  64415. return $recv($recv(aClass)._name()).__comma("2");
  64416. } else {
  64417. var counter;
  64418. $6=$recv(aClass)._name();
  64419. $ctx1.sendIdx["name"]=2;
  64420. $5=$recv($6)._matchesOf_("\x5cd+$");
  64421. $4=$recv($5)._first();
  64422. $3=$recv($4)._asNumber();
  64423. counter=$recv($3).__plus((1));
  64424. $7=$recv(aClass)._name();
  64425. $ctx1.sendIdx["name"]=3;
  64426. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64427. }
  64428. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64429. },
  64430. args: ["aClass"],
  64431. 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'].",
  64432. referencedClasses: [],
  64433. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64434. }),
  64435. $globals.Repl);
  64436. $core.addMethod(
  64437. $core.method({
  64438. selector: "main",
  64439. protocol: "initialization",
  64440. fn: function (){
  64441. var self=this,$self=this;
  64442. return $core.withContext(function($ctx1) {
  64443. $recv($self._new())._createInterface();
  64444. return self;
  64445. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64446. },
  64447. args: [],
  64448. source: "main\x0a\x09self new createInterface",
  64449. referencedClasses: [],
  64450. messageSends: ["createInterface", "new"]
  64451. }),
  64452. $globals.Repl.a$cls);
  64453. });
  64454. (function () {
  64455. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64456. amber.initialize().then(function () {
  64457. amber.globals.AmberCli._main();
  64458. });
  64459. });
  64460. }());
  64461. require(["app"]);
  64462. });
  64463. define.require('__wrap__');
  64464. }((function amdefine(module, requireFn) {
  64465. 'use strict';
  64466. var defineCache = {},
  64467. loaderCache = {},
  64468. alreadyCalled = false,
  64469. path = require('path'),
  64470. makeRequire, stringRequire;
  64471. /**
  64472. * Trims the . and .. from an array of path segments.
  64473. * It will keep a leading path segment if a .. will become
  64474. * the first path segment, to help with module name lookups,
  64475. * which act like paths, but can be remapped. But the end result,
  64476. * all paths that use this function should look normalized.
  64477. * NOTE: this method MODIFIES the input array.
  64478. * @param {Array} ary the array of path segments.
  64479. */
  64480. function trimDots(ary) {
  64481. var i, part;
  64482. for (i = 0; ary[i]; i+= 1) {
  64483. part = ary[i];
  64484. if (part === '.') {
  64485. ary.splice(i, 1);
  64486. i -= 1;
  64487. } else if (part === '..') {
  64488. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64489. //End of the line. Keep at least one non-dot
  64490. //path segment at the front so it can be mapped
  64491. //correctly to disk. Otherwise, there is likely
  64492. //no path mapping for a path starting with '..'.
  64493. //This can still fail, but catches the most reasonable
  64494. //uses of ..
  64495. break;
  64496. } else if (i > 0) {
  64497. ary.splice(i - 1, 2);
  64498. i -= 2;
  64499. }
  64500. }
  64501. }
  64502. }
  64503. function normalize(name, baseName) {
  64504. var baseParts;
  64505. //Adjust any relative paths.
  64506. if (name && name.charAt(0) === '.') {
  64507. //If have a base name, try to normalize against it,
  64508. //otherwise, assume it is a top-level require that will
  64509. //be relative to baseUrl in the end.
  64510. if (baseName) {
  64511. baseParts = baseName.split('/');
  64512. baseParts = baseParts.slice(0, baseParts.length - 1);
  64513. baseParts = baseParts.concat(name.split('/'));
  64514. trimDots(baseParts);
  64515. name = baseParts.join('/');
  64516. }
  64517. }
  64518. return name;
  64519. }
  64520. /**
  64521. * Create the normalize() function passed to a loader plugin's
  64522. * normalize method.
  64523. */
  64524. function makeNormalize(relName) {
  64525. return function (name) {
  64526. return normalize(name, relName);
  64527. };
  64528. }
  64529. function makeLoad(id) {
  64530. function load(value) {
  64531. loaderCache[id] = value;
  64532. }
  64533. load.fromText = function (id, text) {
  64534. //This one is difficult because the text can/probably uses
  64535. //define, and any relative paths and requires should be relative
  64536. //to that id was it would be found on disk. But this would require
  64537. //bootstrapping a module/require fairly deeply from node core.
  64538. //Not sure how best to go about that yet.
  64539. throw new Error('amdefine does not implement load.fromText');
  64540. };
  64541. return load;
  64542. }
  64543. makeRequire = function (systemRequire, exports, module, relId) {
  64544. function amdRequire(deps, callback) {
  64545. if (typeof deps === 'string') {
  64546. //Synchronous, single module require('')
  64547. return stringRequire(systemRequire, exports, module, deps, relId);
  64548. } else {
  64549. //Array of dependencies with a callback.
  64550. //Convert the dependencies to modules.
  64551. deps = deps.map(function (depName) {
  64552. return stringRequire(systemRequire, exports, module, depName, relId);
  64553. });
  64554. //Wait for next tick to call back the require call.
  64555. if (callback) {
  64556. process.nextTick(function () {
  64557. callback.apply(null, deps);
  64558. });
  64559. }
  64560. }
  64561. }
  64562. amdRequire.toUrl = function (filePath) {
  64563. if (filePath.indexOf('.') === 0) {
  64564. return normalize(filePath, path.dirname(module.filename));
  64565. } else {
  64566. return filePath;
  64567. }
  64568. };
  64569. return amdRequire;
  64570. };
  64571. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64572. requireFn = requireFn || function req() {
  64573. return module.require.apply(module, arguments);
  64574. };
  64575. function runFactory(id, deps, factory) {
  64576. var r, e, m, result;
  64577. if (id) {
  64578. e = loaderCache[id] = {};
  64579. m = {
  64580. id: id,
  64581. uri: __filename,
  64582. exports: e
  64583. };
  64584. r = makeRequire(requireFn, e, m, id);
  64585. } else {
  64586. //Only support one define call per file
  64587. if (alreadyCalled) {
  64588. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64589. }
  64590. alreadyCalled = true;
  64591. //Use the real variables from node
  64592. //Use module.exports for exports, since
  64593. //the exports in here is amdefine exports.
  64594. e = module.exports;
  64595. m = module;
  64596. r = makeRequire(requireFn, e, m, module.id);
  64597. }
  64598. //If there are dependencies, they are strings, so need
  64599. //to convert them to dependency values.
  64600. if (deps) {
  64601. deps = deps.map(function (depName) {
  64602. return r(depName);
  64603. });
  64604. }
  64605. //Call the factory with the right dependencies.
  64606. if (typeof factory === 'function') {
  64607. result = factory.apply(m.exports, deps);
  64608. } else {
  64609. result = factory;
  64610. }
  64611. if (result !== undefined) {
  64612. m.exports = result;
  64613. if (id) {
  64614. loaderCache[id] = m.exports;
  64615. }
  64616. }
  64617. }
  64618. stringRequire = function (systemRequire, exports, module, id, relId) {
  64619. //Split the ID by a ! so that
  64620. var index = id.indexOf('!'),
  64621. originalId = id,
  64622. prefix, plugin;
  64623. if (index === -1) {
  64624. id = normalize(id, relId);
  64625. //Straight module lookup. If it is one of the special dependencies,
  64626. //deal with it, otherwise, delegate to node.
  64627. if (id === 'require') {
  64628. return makeRequire(systemRequire, exports, module, relId);
  64629. } else if (id === 'exports') {
  64630. return exports;
  64631. } else if (id === 'module') {
  64632. return module;
  64633. } else if (loaderCache.hasOwnProperty(id)) {
  64634. return loaderCache[id];
  64635. } else if (defineCache[id]) {
  64636. runFactory.apply(null, defineCache[id]);
  64637. return loaderCache[id];
  64638. } else {
  64639. if(systemRequire) {
  64640. return systemRequire(originalId);
  64641. } else {
  64642. throw new Error('No module with ID: ' + id);
  64643. }
  64644. }
  64645. } else {
  64646. //There is a plugin in play.
  64647. prefix = id.substring(0, index);
  64648. id = id.substring(index + 1, id.length);
  64649. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64650. if (plugin.normalize) {
  64651. id = plugin.normalize(id, makeNormalize(relId));
  64652. } else {
  64653. //Normalize the ID normally.
  64654. id = normalize(id, relId);
  64655. }
  64656. if (loaderCache[id]) {
  64657. return loaderCache[id];
  64658. } else {
  64659. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64660. return loaderCache[id];
  64661. }
  64662. }
  64663. };
  64664. //Create a define function specific to the module asking for amdefine.
  64665. function define(id, deps, factory) {
  64666. if (Array.isArray(id)) {
  64667. factory = deps;
  64668. deps = id;
  64669. id = undefined;
  64670. } else if (typeof id !== 'string') {
  64671. factory = id;
  64672. id = deps = undefined;
  64673. }
  64674. if (deps && !Array.isArray(deps)) {
  64675. factory = deps;
  64676. deps = undefined;
  64677. }
  64678. if (!deps) {
  64679. deps = ['require', 'exports', 'module'];
  64680. }
  64681. //Set up properties for this module. If an ID, then use
  64682. //internal cache. If no ID, then use the external variables
  64683. //for this node module.
  64684. if (id) {
  64685. //Put the module in deep freeze until there is a
  64686. //require call for it.
  64687. defineCache[id] = [id, deps, factory];
  64688. } else {
  64689. runFactory(id, deps, factory);
  64690. }
  64691. }
  64692. //define.require, which has access to all the values in the
  64693. //cache. Useful for AMD modules that all have IDs in the file,
  64694. //but need to finally export a value to node based on one of those
  64695. //IDs.
  64696. define.require = function (id) {
  64697. if (loaderCache[id]) {
  64698. return loaderCache[id];
  64699. }
  64700. if (defineCache[id]) {
  64701. runFactory.apply(null, defineCache[id]);
  64702. return loaderCache[id];
  64703. }
  64704. };
  64705. define.amd = {};
  64706. return define;
  64707. }(module)), require));