amber-cli.js 2.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version 3.3.1
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. return typeof x === 'function' || typeof x === 'object' && x !== null;
  21. }
  22. function isFunction(x) {
  23. return typeof x === 'function';
  24. }
  25. var _isArray = undefined;
  26. if (!Array.isArray) {
  27. _isArray = function (x) {
  28. return Object.prototype.toString.call(x) === '[object Array]';
  29. };
  30. } else {
  31. _isArray = Array.isArray;
  32. }
  33. var isArray = _isArray;
  34. var len = 0;
  35. var vertxNext = undefined;
  36. var customSchedulerFn = undefined;
  37. var asap = function asap(callback, arg) {
  38. queue[len] = callback;
  39. queue[len + 1] = arg;
  40. len += 2;
  41. if (len === 2) {
  42. // If len is 2, that means that we need to schedule an async flush.
  43. // If additional callbacks are queued before the queue is flushed, they
  44. // will be processed by this flush that we are scheduling.
  45. if (customSchedulerFn) {
  46. customSchedulerFn(flush);
  47. } else {
  48. scheduleFlush();
  49. }
  50. }
  51. };
  52. function setScheduler(scheduleFn) {
  53. customSchedulerFn = scheduleFn;
  54. }
  55. function setAsap(asapFn) {
  56. asap = asapFn;
  57. }
  58. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  59. var browserGlobal = browserWindow || {};
  60. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  61. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  62. // test for web worker but not in IE10
  63. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  64. // node
  65. function useNextTick() {
  66. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  67. // see https://github.com/cujojs/when/issues/410 for details
  68. return function () {
  69. return process.nextTick(flush);
  70. };
  71. }
  72. // vertx
  73. function useVertxTimer() {
  74. return function () {
  75. vertxNext(flush);
  76. };
  77. }
  78. function useMutationObserver() {
  79. var iterations = 0;
  80. var observer = new BrowserMutationObserver(flush);
  81. var node = document.createTextNode('');
  82. observer.observe(node, { characterData: true });
  83. return function () {
  84. node.data = iterations = ++iterations % 2;
  85. };
  86. }
  87. // web worker
  88. function useMessageChannel() {
  89. var channel = new MessageChannel();
  90. channel.port1.onmessage = flush;
  91. return function () {
  92. return channel.port2.postMessage(0);
  93. };
  94. }
  95. function useSetTimeout() {
  96. // Store setTimeout reference so es6-promise will be unaffected by
  97. // other code modifying setTimeout (like sinon.useFakeTimers())
  98. var globalSetTimeout = setTimeout;
  99. return function () {
  100. return globalSetTimeout(flush, 1);
  101. };
  102. }
  103. var queue = new Array(1000);
  104. function flush() {
  105. for (var i = 0; i < len; i += 2) {
  106. var callback = queue[i];
  107. var arg = queue[i + 1];
  108. callback(arg);
  109. queue[i] = undefined;
  110. queue[i + 1] = undefined;
  111. }
  112. len = 0;
  113. }
  114. function attemptVertx() {
  115. try {
  116. var r = require;
  117. var vertx = r('vertx');
  118. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  119. return useVertxTimer();
  120. } catch (e) {
  121. return useSetTimeout();
  122. }
  123. }
  124. var scheduleFlush = undefined;
  125. // Decide what async method to use to triggering processing of queued callbacks:
  126. if (isNode) {
  127. scheduleFlush = useNextTick();
  128. } else if (BrowserMutationObserver) {
  129. scheduleFlush = useMutationObserver();
  130. } else if (isWorker) {
  131. scheduleFlush = useMessageChannel();
  132. } else if (browserWindow === undefined && typeof require === 'function') {
  133. scheduleFlush = attemptVertx();
  134. } else {
  135. scheduleFlush = useSetTimeout();
  136. }
  137. function then(onFulfillment, onRejection) {
  138. var _arguments = arguments;
  139. var parent = this;
  140. var child = new this.constructor(noop);
  141. if (child[PROMISE_ID] === undefined) {
  142. makePromise(child);
  143. }
  144. var _state = parent._state;
  145. if (_state) {
  146. (function () {
  147. var callback = _arguments[_state - 1];
  148. asap(function () {
  149. return invokeCallback(_state, child, callback, parent._result);
  150. });
  151. })();
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. _resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(16);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var GET_THEN_ERROR = new ErrorObject();
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. GET_THEN_ERROR.error = error;
  209. return GET_THEN_ERROR;
  210. }
  211. }
  212. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. _resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. _reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. _reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. _reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return _resolve(promise, value);
  253. }, function (reason) {
  254. return _reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$) {
  259. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$ === GET_THEN_ERROR) {
  263. _reject(promise, GET_THEN_ERROR.error);
  264. } else if (then$$ === undefined) {
  265. fulfill(promise, maybeThenable);
  266. } else if (isFunction(then$$)) {
  267. handleForeignThenable(promise, maybeThenable, then$$);
  268. } else {
  269. fulfill(promise, maybeThenable);
  270. }
  271. }
  272. }
  273. function _resolve(promise, value) {
  274. if (promise === value) {
  275. _reject(promise, selfFulfillment());
  276. } else if (objectOrFunction(value)) {
  277. handleMaybeThenable(promise, value, getThen(value));
  278. } else {
  279. fulfill(promise, value);
  280. }
  281. }
  282. function publishRejection(promise) {
  283. if (promise._onerror) {
  284. promise._onerror(promise._result);
  285. }
  286. publish(promise);
  287. }
  288. function fulfill(promise, value) {
  289. if (promise._state !== PENDING) {
  290. return;
  291. }
  292. promise._result = value;
  293. promise._state = FULFILLED;
  294. if (promise._subscribers.length !== 0) {
  295. asap(publish, promise);
  296. }
  297. }
  298. function _reject(promise, reason) {
  299. if (promise._state !== PENDING) {
  300. return;
  301. }
  302. promise._state = REJECTED;
  303. promise._result = reason;
  304. asap(publishRejection, promise);
  305. }
  306. function subscribe(parent, child, onFulfillment, onRejection) {
  307. var _subscribers = parent._subscribers;
  308. var length = _subscribers.length;
  309. parent._onerror = null;
  310. _subscribers[length] = child;
  311. _subscribers[length + FULFILLED] = onFulfillment;
  312. _subscribers[length + REJECTED] = onRejection;
  313. if (length === 0 && parent._state) {
  314. asap(publish, parent);
  315. }
  316. }
  317. function publish(promise) {
  318. var subscribers = promise._subscribers;
  319. var settled = promise._state;
  320. if (subscribers.length === 0) {
  321. return;
  322. }
  323. var child = undefined,
  324. callback = undefined,
  325. detail = promise._result;
  326. for (var i = 0; i < subscribers.length; i += 3) {
  327. child = subscribers[i];
  328. callback = subscribers[i + settled];
  329. if (child) {
  330. invokeCallback(settled, child, callback, detail);
  331. } else {
  332. callback(detail);
  333. }
  334. }
  335. promise._subscribers.length = 0;
  336. }
  337. function ErrorObject() {
  338. this.error = null;
  339. }
  340. var TRY_CATCH_ERROR = new ErrorObject();
  341. function tryCatch(callback, detail) {
  342. try {
  343. return callback(detail);
  344. } catch (e) {
  345. TRY_CATCH_ERROR.error = e;
  346. return TRY_CATCH_ERROR;
  347. }
  348. }
  349. function invokeCallback(settled, promise, callback, detail) {
  350. var hasCallback = isFunction(callback),
  351. value = undefined,
  352. error = undefined,
  353. succeeded = undefined,
  354. failed = undefined;
  355. if (hasCallback) {
  356. value = tryCatch(callback, detail);
  357. if (value === TRY_CATCH_ERROR) {
  358. failed = true;
  359. error = value.error;
  360. value = null;
  361. } else {
  362. succeeded = true;
  363. }
  364. if (promise === value) {
  365. _reject(promise, cannotReturnOwn());
  366. return;
  367. }
  368. } else {
  369. value = detail;
  370. succeeded = true;
  371. }
  372. if (promise._state !== PENDING) {
  373. // noop
  374. } else if (hasCallback && succeeded) {
  375. _resolve(promise, value);
  376. } else if (failed) {
  377. _reject(promise, error);
  378. } else if (settled === FULFILLED) {
  379. fulfill(promise, value);
  380. } else if (settled === REJECTED) {
  381. _reject(promise, value);
  382. }
  383. }
  384. function initializePromise(promise, resolver) {
  385. try {
  386. resolver(function resolvePromise(value) {
  387. _resolve(promise, value);
  388. }, function rejectPromise(reason) {
  389. _reject(promise, reason);
  390. });
  391. } catch (e) {
  392. _reject(promise, e);
  393. }
  394. }
  395. var id = 0;
  396. function nextId() {
  397. return id++;
  398. }
  399. function makePromise(promise) {
  400. promise[PROMISE_ID] = id++;
  401. promise._state = undefined;
  402. promise._result = undefined;
  403. promise._subscribers = [];
  404. }
  405. function Enumerator(Constructor, input) {
  406. this._instanceConstructor = Constructor;
  407. this.promise = new Constructor(noop);
  408. if (!this.promise[PROMISE_ID]) {
  409. makePromise(this.promise);
  410. }
  411. if (isArray(input)) {
  412. this._input = input;
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate();
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. _reject(this.promise, validationError());
  427. }
  428. }
  429. function validationError() {
  430. return new Error('Array Methods must be provided an Array');
  431. };
  432. Enumerator.prototype._enumerate = function () {
  433. var length = this.length;
  434. var _input = this._input;
  435. for (var i = 0; this._state === PENDING && i < length; i++) {
  436. this._eachEntry(_input[i], i);
  437. }
  438. };
  439. Enumerator.prototype._eachEntry = function (entry, i) {
  440. var c = this._instanceConstructor;
  441. var resolve$$ = c.resolve;
  442. if (resolve$$ === resolve) {
  443. var _then = getThen(entry);
  444. if (_then === then && entry._state !== PENDING) {
  445. this._settledAt(entry._state, i, entry._result);
  446. } else if (typeof _then !== 'function') {
  447. this._remaining--;
  448. this._result[i] = entry;
  449. } else if (c === Promise) {
  450. var promise = new c(noop);
  451. handleMaybeThenable(promise, entry, _then);
  452. this._willSettleAt(promise, i);
  453. } else {
  454. this._willSettleAt(new c(function (resolve$$) {
  455. return resolve$$(entry);
  456. }), i);
  457. }
  458. } else {
  459. this._willSettleAt(resolve$$(entry), i);
  460. }
  461. };
  462. Enumerator.prototype._settledAt = function (state, i, value) {
  463. var promise = this.promise;
  464. if (promise._state === PENDING) {
  465. this._remaining--;
  466. if (state === REJECTED) {
  467. _reject(promise, value);
  468. } else {
  469. this._result[i] = value;
  470. }
  471. }
  472. if (this._remaining === 0) {
  473. fulfill(promise, this._result);
  474. }
  475. };
  476. Enumerator.prototype._willSettleAt = function (promise, i) {
  477. var enumerator = this;
  478. subscribe(promise, undefined, function (value) {
  479. return enumerator._settledAt(FULFILLED, i, value);
  480. }, function (reason) {
  481. return enumerator._settledAt(REJECTED, i, reason);
  482. });
  483. };
  484. /**
  485. `Promise.all` accepts an array of promises, and returns a new promise which
  486. is fulfilled with an array of fulfillment values for the passed promises, or
  487. rejected with the reason of the first passed promise to be rejected. It casts all
  488. elements of the passed iterable to promises as it runs this algorithm.
  489. Example:
  490. ```javascript
  491. let promise1 = resolve(1);
  492. let promise2 = resolve(2);
  493. let promise3 = resolve(3);
  494. let promises = [ promise1, promise2, promise3 ];
  495. Promise.all(promises).then(function(array){
  496. // The array here would be [ 1, 2, 3 ];
  497. });
  498. ```
  499. If any of the `promises` given to `all` are rejected, the first promise
  500. that is rejected will be given as an argument to the returned promises's
  501. rejection handler. For example:
  502. Example:
  503. ```javascript
  504. let promise1 = resolve(1);
  505. let promise2 = reject(new Error("2"));
  506. let promise3 = reject(new Error("3"));
  507. let promises = [ promise1, promise2, promise3 ];
  508. Promise.all(promises).then(function(array){
  509. // Code here never runs because there are rejected promises!
  510. }, function(error) {
  511. // error.message === "2"
  512. });
  513. ```
  514. @method all
  515. @static
  516. @param {Array} entries array of promises
  517. @param {String} label optional string for labeling the promise.
  518. Useful for tooling.
  519. @return {Promise} promise that is fulfilled when all `promises` have been
  520. fulfilled, or rejected if any of them become rejected.
  521. @static
  522. */
  523. function all(entries) {
  524. return new Enumerator(this, entries).promise;
  525. }
  526. /**
  527. `Promise.race` returns a new promise which is settled in the same way as the
  528. first passed promise to settle.
  529. Example:
  530. ```javascript
  531. let promise1 = new Promise(function(resolve, reject){
  532. setTimeout(function(){
  533. resolve('promise 1');
  534. }, 200);
  535. });
  536. let promise2 = new Promise(function(resolve, reject){
  537. setTimeout(function(){
  538. resolve('promise 2');
  539. }, 100);
  540. });
  541. Promise.race([promise1, promise2]).then(function(result){
  542. // result === 'promise 2' because it was resolved before promise1
  543. // was resolved.
  544. });
  545. ```
  546. `Promise.race` is deterministic in that only the state of the first
  547. settled promise matters. For example, even if other promises given to the
  548. `promises` array argument are resolved, but the first settled promise has
  549. become rejected before the other promises became fulfilled, the returned
  550. promise will become rejected:
  551. ```javascript
  552. let promise1 = new Promise(function(resolve, reject){
  553. setTimeout(function(){
  554. resolve('promise 1');
  555. }, 200);
  556. });
  557. let promise2 = new Promise(function(resolve, reject){
  558. setTimeout(function(){
  559. reject(new Error('promise 2'));
  560. }, 100);
  561. });
  562. Promise.race([promise1, promise2]).then(function(result){
  563. // Code here never runs
  564. }, function(reason){
  565. // reason.message === 'promise 2' because promise 2 became rejected before
  566. // promise 1 became fulfilled
  567. });
  568. ```
  569. An example real-world use case is implementing timeouts:
  570. ```javascript
  571. Promise.race([ajax('foo.json'), timeout(5000)])
  572. ```
  573. @method race
  574. @static
  575. @param {Array} promises array of promises to observe
  576. Useful for tooling.
  577. @return {Promise} a promise which settles in the same way as the first passed
  578. promise to settle.
  579. */
  580. function race(entries) {
  581. /*jshint validthis:true */
  582. var Constructor = this;
  583. if (!isArray(entries)) {
  584. return new Constructor(function (_, reject) {
  585. return reject(new TypeError('You must pass an array to race.'));
  586. });
  587. } else {
  588. return new Constructor(function (resolve, reject) {
  589. var length = entries.length;
  590. for (var i = 0; i < length; i++) {
  591. Constructor.resolve(entries[i]).then(resolve, reject);
  592. }
  593. });
  594. }
  595. }
  596. /**
  597. `Promise.reject` returns a promise rejected with the passed `reason`.
  598. It is shorthand for the following:
  599. ```javascript
  600. let promise = new Promise(function(resolve, reject){
  601. reject(new Error('WHOOPS'));
  602. });
  603. promise.then(function(value){
  604. // Code here doesn't run because the promise is rejected!
  605. }, function(reason){
  606. // reason.message === 'WHOOPS'
  607. });
  608. ```
  609. Instead of writing the above, your code now simply becomes the following:
  610. ```javascript
  611. let promise = Promise.reject(new Error('WHOOPS'));
  612. promise.then(function(value){
  613. // Code here doesn't run because the promise is rejected!
  614. }, function(reason){
  615. // reason.message === 'WHOOPS'
  616. });
  617. ```
  618. @method reject
  619. @static
  620. @param {Any} reason value that the returned promise will be rejected with.
  621. Useful for tooling.
  622. @return {Promise} a promise rejected with the given `reason`.
  623. */
  624. function reject(reason) {
  625. /*jshint validthis:true */
  626. var Constructor = this;
  627. var promise = new Constructor(noop);
  628. _reject(promise, reason);
  629. return promise;
  630. }
  631. function needsResolver() {
  632. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  633. }
  634. function needsNew() {
  635. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  636. }
  637. /**
  638. Promise objects represent the eventual result of an asynchronous operation. The
  639. primary way of interacting with a promise is through its `then` method, which
  640. registers callbacks to receive either a promise's eventual value or the reason
  641. why the promise cannot be fulfilled.
  642. Terminology
  643. -----------
  644. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  645. - `thenable` is an object or function that defines a `then` method.
  646. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  647. - `exception` is a value that is thrown using the throw statement.
  648. - `reason` is a value that indicates why a promise was rejected.
  649. - `settled` the final resting state of a promise, fulfilled or rejected.
  650. A promise can be in one of three states: pending, fulfilled, or rejected.
  651. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  652. state. Promises that are rejected have a rejection reason and are in the
  653. rejected state. A fulfillment value is never a thenable.
  654. Promises can also be said to *resolve* a value. If this value is also a
  655. promise, then the original promise's settled state will match the value's
  656. settled state. So a promise that *resolves* a promise that rejects will
  657. itself reject, and a promise that *resolves* a promise that fulfills will
  658. itself fulfill.
  659. Basic Usage:
  660. ------------
  661. ```js
  662. let promise = new Promise(function(resolve, reject) {
  663. // on success
  664. resolve(value);
  665. // on failure
  666. reject(reason);
  667. });
  668. promise.then(function(value) {
  669. // on fulfillment
  670. }, function(reason) {
  671. // on rejection
  672. });
  673. ```
  674. Advanced Usage:
  675. ---------------
  676. Promises shine when abstracting away asynchronous interactions such as
  677. `XMLHttpRequest`s.
  678. ```js
  679. function getJSON(url) {
  680. return new Promise(function(resolve, reject){
  681. let xhr = new XMLHttpRequest();
  682. xhr.open('GET', url);
  683. xhr.onreadystatechange = handler;
  684. xhr.responseType = 'json';
  685. xhr.setRequestHeader('Accept', 'application/json');
  686. xhr.send();
  687. function handler() {
  688. if (this.readyState === this.DONE) {
  689. if (this.status === 200) {
  690. resolve(this.response);
  691. } else {
  692. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  693. }
  694. }
  695. };
  696. });
  697. }
  698. getJSON('/posts.json').then(function(json) {
  699. // on fulfillment
  700. }, function(reason) {
  701. // on rejection
  702. });
  703. ```
  704. Unlike callbacks, promises are great composable primitives.
  705. ```js
  706. Promise.all([
  707. getJSON('/posts'),
  708. getJSON('/comments')
  709. ]).then(function(values){
  710. values[0] // => postsJSON
  711. values[1] // => commentsJSON
  712. return values;
  713. });
  714. ```
  715. @class Promise
  716. @param {function} resolver
  717. Useful for tooling.
  718. @constructor
  719. */
  720. function Promise(resolver) {
  721. this[PROMISE_ID] = nextId();
  722. this._result = this._state = undefined;
  723. this._subscribers = [];
  724. if (noop !== resolver) {
  725. typeof resolver !== 'function' && needsResolver();
  726. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  727. }
  728. }
  729. Promise.all = all;
  730. Promise.race = race;
  731. Promise.resolve = resolve;
  732. Promise.reject = reject;
  733. Promise._setScheduler = setScheduler;
  734. Promise._setAsap = setAsap;
  735. Promise._asap = asap;
  736. Promise.prototype = {
  737. constructor: Promise,
  738. /**
  739. The primary way of interacting with a promise is through its `then` method,
  740. which registers callbacks to receive either a promise's eventual value or the
  741. reason why the promise cannot be fulfilled.
  742. ```js
  743. findUser().then(function(user){
  744. // user is available
  745. }, function(reason){
  746. // user is unavailable, and you are given the reason why
  747. });
  748. ```
  749. Chaining
  750. --------
  751. The return value of `then` is itself a promise. This second, 'downstream'
  752. promise is resolved with the return value of the first promise's fulfillment
  753. or rejection handler, or rejected if the handler throws an exception.
  754. ```js
  755. findUser().then(function (user) {
  756. return user.name;
  757. }, function (reason) {
  758. return 'default name';
  759. }).then(function (userName) {
  760. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  761. // will be `'default name'`
  762. });
  763. findUser().then(function (user) {
  764. throw new Error('Found user, but still unhappy');
  765. }, function (reason) {
  766. throw new Error('`findUser` rejected and we're unhappy');
  767. }).then(function (value) {
  768. // never reached
  769. }, function (reason) {
  770. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  771. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  772. });
  773. ```
  774. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  775. ```js
  776. findUser().then(function (user) {
  777. throw new PedagogicalException('Upstream error');
  778. }).then(function (value) {
  779. // never reached
  780. }).then(function (value) {
  781. // never reached
  782. }, function (reason) {
  783. // The `PedgagocialException` is propagated all the way down to here
  784. });
  785. ```
  786. Assimilation
  787. ------------
  788. Sometimes the value you want to propagate to a downstream promise can only be
  789. retrieved asynchronously. This can be achieved by returning a promise in the
  790. fulfillment or rejection handler. The downstream promise will then be pending
  791. until the returned promise is settled. This is called *assimilation*.
  792. ```js
  793. findUser().then(function (user) {
  794. return findCommentsByAuthor(user);
  795. }).then(function (comments) {
  796. // The user's comments are now available
  797. });
  798. ```
  799. If the assimliated promise rejects, then the downstream promise will also reject.
  800. ```js
  801. findUser().then(function (user) {
  802. return findCommentsByAuthor(user);
  803. }).then(function (comments) {
  804. // If `findCommentsByAuthor` fulfills, we'll have the value here
  805. }, function (reason) {
  806. // If `findCommentsByAuthor` rejects, we'll have the reason here
  807. });
  808. ```
  809. Simple Example
  810. --------------
  811. Synchronous Example
  812. ```javascript
  813. let result;
  814. try {
  815. result = findResult();
  816. // success
  817. } catch(reason) {
  818. // failure
  819. }
  820. ```
  821. Errback Example
  822. ```js
  823. findResult(function(result, err){
  824. if (err) {
  825. // failure
  826. } else {
  827. // success
  828. }
  829. });
  830. ```
  831. Promise Example;
  832. ```javascript
  833. findResult().then(function(result){
  834. // success
  835. }, function(reason){
  836. // failure
  837. });
  838. ```
  839. Advanced Example
  840. --------------
  841. Synchronous Example
  842. ```javascript
  843. let author, books;
  844. try {
  845. author = findAuthor();
  846. books = findBooksByAuthor(author);
  847. // success
  848. } catch(reason) {
  849. // failure
  850. }
  851. ```
  852. Errback Example
  853. ```js
  854. function foundBooks(books) {
  855. }
  856. function failure(reason) {
  857. }
  858. findAuthor(function(author, err){
  859. if (err) {
  860. failure(err);
  861. // failure
  862. } else {
  863. try {
  864. findBoooksByAuthor(author, function(books, err) {
  865. if (err) {
  866. failure(err);
  867. } else {
  868. try {
  869. foundBooks(books);
  870. } catch(reason) {
  871. failure(reason);
  872. }
  873. }
  874. });
  875. } catch(error) {
  876. failure(err);
  877. }
  878. // success
  879. }
  880. });
  881. ```
  882. Promise Example;
  883. ```javascript
  884. findAuthor().
  885. then(findBooksByAuthor).
  886. then(function(books){
  887. // found books
  888. }).catch(function(reason){
  889. // something went wrong
  890. });
  891. ```
  892. @method then
  893. @param {Function} onFulfilled
  894. @param {Function} onRejected
  895. Useful for tooling.
  896. @return {Promise}
  897. */
  898. then: then,
  899. /**
  900. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  901. as the catch block of a try/catch statement.
  902. ```js
  903. function findAuthor(){
  904. throw new Error('couldn't find that author');
  905. }
  906. // synchronous
  907. try {
  908. findAuthor();
  909. } catch(reason) {
  910. // something went wrong
  911. }
  912. // async with promises
  913. findAuthor().catch(function(reason){
  914. // something went wrong
  915. });
  916. ```
  917. @method catch
  918. @param {Function} onRejection
  919. Useful for tooling.
  920. @return {Promise}
  921. */
  922. 'catch': function _catch(onRejection) {
  923. return this.then(null, onRejection);
  924. }
  925. };
  926. function polyfill() {
  927. var local = undefined;
  928. if (typeof global !== 'undefined') {
  929. local = global;
  930. } else if (typeof self !== 'undefined') {
  931. local = self;
  932. } else {
  933. try {
  934. local = Function('return this')();
  935. } catch (e) {
  936. throw new Error('polyfill failed because global object is unavailable in this environment');
  937. }
  938. }
  939. var P = local.Promise;
  940. if (P) {
  941. var promiseToString = null;
  942. try {
  943. promiseToString = Object.prototype.toString.call(P.resolve());
  944. } catch (e) {
  945. // silently ignored
  946. }
  947. if (promiseToString === '[object Promise]' && !P.cast) {
  948. return;
  949. }
  950. }
  951. local.Promise = Promise;
  952. }
  953. polyfill();
  954. // Strange compat..
  955. Promise.polyfill = polyfill;
  956. Promise.Promise = Promise;
  957. return Promise;
  958. })));
  959. //# sourceMappingURL=es6-promise.map;
  960. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  961. promiseLib.polyfill();
  962. });
  963. (function () {
  964. define('app',["require", "amber/es2015-polyfills"], function (require) {
  965. require(["__app__"]);
  966. });
  967. }());
  968. //jshint eqnull:true
  969. define('amber/kernel-runtime',[],function () {
  970. "use strict";
  971. function defineMethod (klass, name, method) {
  972. Object.defineProperty(klass.prototype, name, {
  973. value: method,
  974. enumerable: false, configurable: true, writable: true
  975. });
  976. }
  977. DNUBrik.deps = ["selectors", "smalltalkGlobals", "manipulation", "classes"];
  978. function DNUBrik (brikz, st) {
  979. var selectorPairs = brikz.selectors.selectorPairs;
  980. var globals = brikz.smalltalkGlobals.globals;
  981. var installJSMethod = brikz.manipulation.installJSMethod;
  982. var nilAsClass = brikz.classes.nilAsClass;
  983. /* Method not implemented handlers */
  984. function makeDnuHandler (pair, targetClasses) {
  985. var jsSelector = pair.js;
  986. var fn = createHandler(pair.st);
  987. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  988. targetClasses.forEach(function (target) {
  989. installJSMethod(target.fn.prototype, jsSelector, fn);
  990. });
  991. }
  992. this.makeDnuHandler = makeDnuHandler;
  993. /* Dnu handler method */
  994. function createHandler (stSelector) {
  995. return function () {
  996. return globals.Message._selector_arguments_notUnderstoodBy_(
  997. stSelector, [].slice.call(arguments), this
  998. );
  999. };
  1000. }
  1001. selectorPairs.forEach(function (pair) {
  1002. makeDnuHandler(pair, []);
  1003. });
  1004. }
  1005. function ManipulationBrik (brikz, st) {
  1006. function installJSMethod (obj, jsSelector, fn) {
  1007. Object.defineProperty(obj, jsSelector, {
  1008. value: fn,
  1009. enumerable: false, configurable: true, writable: true
  1010. });
  1011. }
  1012. function installMethod (method, klass) {
  1013. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  1014. }
  1015. this.installMethod = installMethod;
  1016. this.installJSMethod = installJSMethod;
  1017. }
  1018. RuntimeClassesBrik.deps = ["event", "selectors", "dnu", "behaviors", "classes", "manipulation"];
  1019. function RuntimeClassesBrik (brikz, st) {
  1020. var selectors = brikz.selectors;
  1021. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1022. var wireKlass = brikz.classes.wireKlass;
  1023. var installMethod = brikz.manipulation.installMethod;
  1024. var installJSMethod = brikz.manipulation.installJSMethod;
  1025. var emit = brikz.event.emit;
  1026. var detachedRootClasses = [];
  1027. function markClassDetachedRoot (klass) {
  1028. klass.detachedRoot = true;
  1029. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1030. return klass.detachedRoot;
  1031. });
  1032. }
  1033. this.detachedRootClasses = function () {
  1034. return detachedRootClasses;
  1035. };
  1036. /* Initialize a class in its class hierarchy. Handle both classes and
  1037. metaclasses. */
  1038. function initClassAndMetaclass (klass) {
  1039. initClass(klass);
  1040. if (klass.a$cls && !klass.meta) {
  1041. initClass(klass.a$cls);
  1042. }
  1043. }
  1044. traitsOrClasses.forEach(function (traitOrClass) {
  1045. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1046. });
  1047. emit.classAdded = function (klass) {
  1048. initClassAndMetaclass(klass);
  1049. klass._enterOrganization();
  1050. };
  1051. emit.traitAdded = function (trait) {
  1052. trait._enterOrganization();
  1053. };
  1054. emit.classRemoved = function (klass) {
  1055. klass._leaveOrganization();
  1056. };
  1057. emit.traitRemoved = function (trait) {
  1058. trait._leaveOrganization();
  1059. };
  1060. function initClass (klass) {
  1061. wireKlass(klass);
  1062. if (klass.detachedRoot) {
  1063. copySuperclass(klass);
  1064. }
  1065. installMethods(klass);
  1066. }
  1067. function copySuperclass (klass) {
  1068. var myproto = klass.fn.prototype,
  1069. superproto = klass.superclass.fn.prototype;
  1070. selectors.selectorPairs.forEach(function (selectorPair) {
  1071. var jsSelector = selectorPair.js;
  1072. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1073. });
  1074. }
  1075. function installMethods (klass) {
  1076. var methods = klass.methods;
  1077. Object.keys(methods).forEach(function (selector) {
  1078. installMethod(methods[selector], klass);
  1079. });
  1080. }
  1081. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1082. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1083. markClassDetachedRoot(klass);
  1084. klass.fn = constructor;
  1085. initClass(klass);
  1086. };
  1087. }
  1088. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1089. function FrameBindingBrik (brikz, st) {
  1090. var globals = brikz.smalltalkGlobals.globals;
  1091. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1092. setClassConstructor(globals.Number, Number);
  1093. setClassConstructor(globals.BlockClosure, Function);
  1094. setClassConstructor(globals.Boolean, Boolean);
  1095. setClassConstructor(globals.Date, Date);
  1096. setClassConstructor(globals.String, String);
  1097. setClassConstructor(globals.Array, Array);
  1098. setClassConstructor(globals.RegularExpression, RegExp);
  1099. setClassConstructor(globals.Error, Error);
  1100. setClassConstructor(globals.Promise, Promise);
  1101. this.__init__ = function () {
  1102. st.alias(globals.Array, "OrderedCollection");
  1103. st.alias(globals.Date, "Time");
  1104. }
  1105. }
  1106. RuntimeMethodsBrik.deps = ["event", "manipulation", "dnu", "runtimeClasses"];
  1107. function RuntimeMethodsBrik (brikz, st) {
  1108. var installMethod = brikz.manipulation.installMethod;
  1109. var installJSMethod = brikz.manipulation.installJSMethod;
  1110. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  1111. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  1112. var emit = brikz.event.emit;
  1113. emit.behaviorMethodAdded = function (method, klass) {
  1114. installMethod(method, klass);
  1115. propagateMethodChange(klass, method, klass);
  1116. };
  1117. emit.selectorsAdded = function (newSelectors) {
  1118. var targetClasses = detachedRootClasses();
  1119. newSelectors.forEach(function (pair) {
  1120. makeDnuHandler(pair, targetClasses);
  1121. });
  1122. };
  1123. emit.behaviorMethodRemoved = function (method, klass) {
  1124. delete klass.fn.prototype[method.jsSelector];
  1125. propagateMethodChange(klass, method, null);
  1126. };
  1127. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1128. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1129. };
  1130. function propagateMethodChange (klass, method, exclude) {
  1131. var selector = method.selector;
  1132. var jsSelector = method.jsSelector;
  1133. st.traverseClassTree(klass, function (subclass, sentinel) {
  1134. if (subclass === exclude) return;
  1135. if (subclass.methods[selector]) return sentinel;
  1136. if (subclass.detachedRoot) {
  1137. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1138. }
  1139. });
  1140. }
  1141. }
  1142. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1143. function PrimitivesBrik (brikz, st) {
  1144. var globals = brikz.smalltalkGlobals.globals;
  1145. var oid = 0;
  1146. /* Unique ID number generator */
  1147. st.nextId = function () {
  1148. console.warn("$core.nextId() deprecated. Use your own unique counter.");
  1149. oid += 1;
  1150. return oid;
  1151. };
  1152. /* Converts a JavaScript object to valid Smalltalk Object */
  1153. st.readJSObject = function (js) {
  1154. if (js == null) return null;
  1155. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1156. else if (js.constructor !== Object) return js;
  1157. var pairs = [];
  1158. for (var i in js) {
  1159. pairs.push(i, st.readJSObject(js[i]));
  1160. }
  1161. return globals.Dictionary._newFromPairs_(pairs);
  1162. };
  1163. /* Boolean assertion */
  1164. st.assert = function (shouldBeBoolean) {
  1165. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1166. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1167. shouldBeBoolean = shouldBeBoolean.valueOf();
  1168. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1169. }
  1170. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1171. };
  1172. }
  1173. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1174. function RuntimeBrik (brikz, st) {
  1175. var globals = brikz.smalltalkGlobals.globals;
  1176. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1177. function SmalltalkMethodContext (home, setup) {
  1178. // TODO lazy fill of .sendIdx
  1179. this.sendIdx = {};
  1180. // TODO very likely .senderContext, not .homeContext here
  1181. this.homeContext = home;
  1182. this.setup = setup;
  1183. }
  1184. // Fallbacks
  1185. SmalltalkMethodContext.prototype.supercall = false;
  1186. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1187. SmalltalkMethodContext.prototype.receiver = null;
  1188. SmalltalkMethodContext.prototype.selector = null;
  1189. SmalltalkMethodContext.prototype.lookupClass = null;
  1190. SmalltalkMethodContext.prototype.outerContext = null;
  1191. SmalltalkMethodContext.prototype.index = 0;
  1192. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1193. this.receiver = receiver;
  1194. this.selector = selector;
  1195. if (locals != null) this.locals = locals;
  1196. this.lookupClass = lookupClass;
  1197. if (this.homeContext) {
  1198. this.homeContext.evaluatedSelector = selector;
  1199. }
  1200. });
  1201. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1202. if (locals != null) this.locals = locals;
  1203. this.outerContext = ctx;
  1204. if (index) this.index = index;
  1205. });
  1206. defineMethod(SmalltalkMethodContext, "method", function () {
  1207. var method;
  1208. var lookup = this.lookupClass || this.receiver.a$cls;
  1209. while (!method && lookup) {
  1210. method = lookup.methods[st.js2st(this.selector)];
  1211. lookup = lookup.superclass;
  1212. }
  1213. return method;
  1214. });
  1215. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1216. /* This is the current call context object.
  1217. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1218. In JS code, use api.getThisContext() (see below).
  1219. */
  1220. var thisContext = null;
  1221. /*
  1222. Runs worker function so that error handler is not set up
  1223. if there isn't one. This is accomplished by unconditional
  1224. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1225. which then stops error handler setup (see st.withContext above).
  1226. The effect is, $core.seamless(fn)'s exceptions are not
  1227. handed into ST error handler and caller should process them.
  1228. */
  1229. st.seamless = function (worker) {
  1230. var oldContext = thisContext;
  1231. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1232. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1233. });
  1234. var result = worker(thisContext);
  1235. thisContext = oldContext;
  1236. return result;
  1237. };
  1238. function resultWithErrorHandling (worker) {
  1239. try {
  1240. return worker(thisContext);
  1241. } catch (error) {
  1242. globals.ErrorHandler._handleError_(error);
  1243. thisContext = null;
  1244. // Rethrow the error in any case.
  1245. throw error;
  1246. }
  1247. }
  1248. /*
  1249. Standard way to run within context.
  1250. Sets up error handler if entering first ST context in a stack.
  1251. */
  1252. st.withContext = function (worker, setup) {
  1253. var oldContext = thisContext;
  1254. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1255. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1256. thisContext = oldContext;
  1257. return result;
  1258. };
  1259. /* Handle thisContext pseudo variable */
  1260. st.getThisContext = function () {
  1261. if (!thisContext) return null;
  1262. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1263. frame.setup(frame);
  1264. }
  1265. return thisContext;
  1266. };
  1267. }
  1268. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1269. function MessageSendBrik (brikz, st) {
  1270. var globals = brikz.smalltalkGlobals.globals;
  1271. var nilAsReceiver = brikz.root.nilAsReceiver;
  1272. /* Send message programmatically. Used to implement #perform: & Co. */
  1273. st.send2 = function (self, selector, args, klass) {
  1274. if (self == null) {
  1275. self = nilAsReceiver;
  1276. }
  1277. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1278. return method != null ?
  1279. method.apply(self, args || []) :
  1280. globals.Message._selector_arguments_notUnderstoodBy_(
  1281. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1282. );
  1283. };
  1284. function wrapJavaScript (o) {
  1285. return globals.JSObjectProxy._on_(o);
  1286. }
  1287. st.wrapJavaScript = wrapJavaScript;
  1288. /* If the object property is a function, then call it, except if it starts with
  1289. an uppercase character (we probably want to answer the function itself in this
  1290. case and send it #new from Amber).
  1291. */
  1292. st.accessJavaScript = function accessJavaScript (self, propertyName, args) {
  1293. var propertyValue = self[propertyName];
  1294. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1295. return propertyValue.apply(self, args || []);
  1296. } else if (args.length === 0) {
  1297. return propertyValue;
  1298. } else {
  1299. self[propertyName] = args[0];
  1300. return self;
  1301. }
  1302. };
  1303. }
  1304. StartImageBrik.deps = ["smalltalkGlobals"];
  1305. function StartImageBrik (brikz, st) {
  1306. var globals = brikz.smalltalkGlobals.globals;
  1307. this.run = function () {
  1308. globals.AmberBootstrapInitialization._run();
  1309. };
  1310. }
  1311. /* Making smalltalk that can run */
  1312. function configureWithRuntime (brikz) {
  1313. brikz.dnu = DNUBrik;
  1314. brikz.manipulation = ManipulationBrik;
  1315. brikz.runtimeClasses = RuntimeClassesBrik;
  1316. brikz.frameBinding = FrameBindingBrik;
  1317. brikz.runtimeMethods = RuntimeMethodsBrik;
  1318. brikz.messageSend = MessageSendBrik;
  1319. brikz.runtime = RuntimeBrik;
  1320. brikz.primitives = PrimitivesBrik;
  1321. brikz.startImage = StartImageBrik;
  1322. brikz.rebuild();
  1323. }
  1324. return configureWithRuntime;
  1325. });
  1326. // Depend on each module that is loaded lazily.
  1327. // Add to packager tasks as dependency,
  1328. // so the lazy-loaded modules are included.
  1329. define('amber/lazypack',['./kernel-runtime'], {});
  1330. //jshint eqnull:true
  1331. define('amber/kernel-checks',[],function () {
  1332. "use strict";
  1333. function assert (fn) {
  1334. try {
  1335. if (fn()) return;
  1336. } catch (ex) {
  1337. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1338. }
  1339. throw new Error("Assertion failed:\n" + fn);
  1340. }
  1341. assert(function () {
  1342. return !("hasOwnProperty" in Object.create(null));
  1343. });
  1344. assert(function () {
  1345. return new Function("return this")().Object === Object;
  1346. });
  1347. assert(function () {
  1348. return Object.create(new Function("return this")()).Object === Object;
  1349. });
  1350. assert(function () {
  1351. return (function () {
  1352. return this;
  1353. }).apply(void 0) === void 0;
  1354. });
  1355. assert(function () {
  1356. return (function () {
  1357. return this;
  1358. }).apply(null) === null;
  1359. });
  1360. assert(function () {
  1361. return (function () {
  1362. return this;
  1363. }).apply(3) === 3;
  1364. });
  1365. assert(function () {
  1366. return (function () {
  1367. return this;
  1368. }).apply("foo") === "foo";
  1369. });
  1370. assert(function () {
  1371. return (function () {
  1372. return this;
  1373. }).apply(true) === true;
  1374. });
  1375. assert(function () {
  1376. var o = Object.freeze({});
  1377. try {
  1378. o.foo = "bar";
  1379. } catch (ex) {
  1380. }
  1381. return o.foo == null;
  1382. });
  1383. assert(function () {
  1384. return typeof Promise === "function";
  1385. });
  1386. assert(function () {
  1387. return typeof Promise.resolve === "function";
  1388. });
  1389. assert(function () {
  1390. return typeof Promise.reject === "function";
  1391. });
  1392. assert(function () {
  1393. return typeof new Promise(function () {
  1394. }).then === "function";
  1395. });
  1396. });
  1397. define('amber/brikz',[], function () {
  1398. return function Brikz(api, apiKey, initKey) {
  1399. "use strict";
  1400. //jshint eqnull:true
  1401. var brikz = this,
  1402. backup = {};
  1403. apiKey = apiKey || 'exports';
  1404. initKey = initKey || '__init__';
  1405. function mixin(src, target, what) {
  1406. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1407. if (src == null) {
  1408. target[keys[i]] = undefined;
  1409. } else {
  1410. var value = src[keys[i]];
  1411. if (typeof value !== "undefined") {
  1412. target[keys[i]] = value;
  1413. }
  1414. }
  1415. }
  1416. return target;
  1417. }
  1418. Object.defineProperties(this, {
  1419. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1420. });
  1421. var exclude = mixin(this, {});
  1422. this.rebuild = function () {
  1423. Object.keys(backup).forEach(function (key) {
  1424. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1425. });
  1426. var oapi = mixin(api, {}),
  1427. order = [],
  1428. chk = {};
  1429. function ensure(key) {
  1430. if (key in exclude) {
  1431. return null;
  1432. }
  1433. var b = brikz[key],
  1434. bak = backup[key];
  1435. mixin(null, api, api);
  1436. while (typeof b === "function") {
  1437. (b.deps || []).forEach(ensure);
  1438. b = new b(brikz, api, bak);
  1439. }
  1440. brikz[key] = b;
  1441. if (b && !chk[key]) {
  1442. chk[key] = true;
  1443. order.push(b);
  1444. }
  1445. if (b && !b[apiKey]) {
  1446. b[apiKey] = mixin(api, {});
  1447. }
  1448. }
  1449. Object.keys(brikz).forEach(ensure);
  1450. mixin(oapi, mixin(null, api, api));
  1451. order.forEach(function (brik) {
  1452. mixin(brik[apiKey] || {}, api);
  1453. });
  1454. order.forEach(function (brik) {
  1455. if (brik[initKey]) {
  1456. brik[initKey]();
  1457. if (brik[initKey].once) {
  1458. delete brik[initKey];
  1459. }
  1460. }
  1461. });
  1462. backup = mixin(brikz, {});
  1463. };
  1464. };
  1465. });
  1466. /* ====================================================================
  1467. |
  1468. | Amber Smalltalk
  1469. | http://amber-lang.net
  1470. |
  1471. ======================================================================
  1472. ======================================================================
  1473. |
  1474. | Copyright (c) 2010-2014
  1475. | Nicolas Petton <petton.nicolas@gmail.com>
  1476. |
  1477. | Copyright (c) 2012-2017
  1478. | The Amber team https://lolg.it/org/amber/members
  1479. | Amber contributors (see /CONTRIBUTORS)
  1480. |
  1481. | Amber is released under the MIT license
  1482. |
  1483. | Permission is hereby granted, free of charge, to any person obtaining
  1484. | a copy of this software and associated documentation files (the
  1485. | 'Software'), to deal in the Software without restriction, including
  1486. | without limitation the rights to use, copy, modify, merge, publish,
  1487. | distribute, sublicense, and/or sell copies of the Software, and to
  1488. | permit persons to whom the Software is furnished to do so, subject to
  1489. | the following conditions:
  1490. |
  1491. | The above copyright notice and this permission notice shall be
  1492. | included in all copies or substantial portions of the Software.
  1493. |
  1494. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1495. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1496. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1497. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1498. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1499. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1500. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1501. |
  1502. ==================================================================== */
  1503. //jshint eqnull:true
  1504. define('amber/kernel-fundamentals',[],function () {
  1505. "use strict";
  1506. function inherits (child, parent) {
  1507. child.prototype = Object.create(parent.prototype, {
  1508. constructor: {
  1509. value: child,
  1510. enumerable: false, configurable: true, writable: true
  1511. }
  1512. });
  1513. return child;
  1514. }
  1515. function SmalltalkGlobalsBrik (brikz, st) {
  1516. // jshint evil:true
  1517. var jsGlobals = new Function("return this")();
  1518. var globals = Object.create(jsGlobals);
  1519. globals.SmalltalkSettings = {};
  1520. this.globals = globals;
  1521. }
  1522. function EventBrik (brikz, st) {
  1523. var emit = {};
  1524. this.emit = emit;
  1525. this.declareEvent = function (event) {
  1526. if (!emit[event]) emit[event] = function () {
  1527. };
  1528. }
  1529. }
  1530. function RootBrik (brikz, st) {
  1531. /* Smalltalk foundational objects */
  1532. var coreFns = this.coreFns = {};
  1533. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1534. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1535. Detached roots (eg. wrapped JS classes like Number or Date)
  1536. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1537. function SmalltalkRoot () {
  1538. }
  1539. function SmalltalkProtoObject () {
  1540. }
  1541. function SmalltalkObject () {
  1542. }
  1543. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1544. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1545. this.Root = SmalltalkRoot;
  1546. this.Object = SmalltalkObject;
  1547. }
  1548. SelectorsBrik.deps = ["selectorConversion"];
  1549. function SelectorsBrik (brikz, st) {
  1550. var selectorSet = Object.create(null);
  1551. var selectors = this.selectors = [];
  1552. var selectorPairs = this.selectorPairs = [];
  1553. this.registerSelector = function (stSelector) {
  1554. if (selectorSet[stSelector]) return null;
  1555. var jsSelector = st.st2js(stSelector);
  1556. selectorSet[stSelector] = true;
  1557. selectors.push(stSelector);
  1558. var pair = {st: stSelector, js: jsSelector};
  1559. selectorPairs.push(pair);
  1560. return pair;
  1561. };
  1562. st.allSelectors = function () {
  1563. return selectors;
  1564. };
  1565. }
  1566. function PackagesBrik (brikz, st) {
  1567. st.packages = st.packageDescriptors = {};
  1568. /* Add a package load descriptor to the system */
  1569. st.addPackage = function (name, properties) {
  1570. if (!name) return null;
  1571. return st.packageDescriptors[name] = {properties: properties};
  1572. };
  1573. }
  1574. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1575. function BehaviorsBrik (brikz, st) {
  1576. var globals = brikz.smalltalkGlobals.globals;
  1577. var addElement = brikz.arraySet.addElement;
  1578. var removeElement = brikz.arraySet.removeElement;
  1579. /* Smalltalk classes and traits */
  1580. var traitsOrClasses = [];
  1581. this.buildTraitOrClass = function (category, builder) {
  1582. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1583. if (traitOrClass) {
  1584. builder.updateExisting(traitOrClass);
  1585. } else {
  1586. traitOrClass = builder.make();
  1587. traitOrClass.category = category;
  1588. addTraitOrClass(traitOrClass);
  1589. }
  1590. return traitOrClass;
  1591. };
  1592. function addTraitOrClass (traitOrClass) {
  1593. globals[traitOrClass.name] = traitOrClass;
  1594. addElement(traitsOrClasses, traitOrClass);
  1595. traitOrClass.added();
  1596. }
  1597. function removeTraitOrClass (traitOrClass) {
  1598. traitOrClass.removed();
  1599. removeElement(traitsOrClasses, traitOrClass);
  1600. delete globals[traitOrClass.name];
  1601. }
  1602. this.removeTraitOrClass = removeTraitOrClass;
  1603. /* Create an alias for an existing class */
  1604. st.alias = function (traitOrClass, alias) {
  1605. globals[alias] = traitOrClass;
  1606. };
  1607. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1608. }
  1609. MethodsBrik.deps = ["event", "selectors", "root", "selectorConversion"];
  1610. function MethodsBrik (brikz, st) {
  1611. var registerSelector = brikz.selectors.registerSelector;
  1612. var SmalltalkObject = brikz.root.Object;
  1613. var coreFns = brikz.root.coreFns;
  1614. var emit = brikz.event.emit;
  1615. var declareEvent = brikz.event.declareEvent;
  1616. function SmalltalkMethod () {
  1617. }
  1618. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1619. /* Smalltalk method object. To add a method to a class,
  1620. use api.addMethod() */
  1621. st.method = function (spec) {
  1622. var that = new SmalltalkMethod();
  1623. var selector = spec.selector;
  1624. that.selector = selector;
  1625. that.jsSelector = st.st2js(selector);
  1626. that.args = spec.args || {};
  1627. that.protocol = spec.protocol;
  1628. that.source = spec.source;
  1629. that.messageSends = spec.messageSends || [];
  1630. // TODO remove .referencedClasses, have .referencedGlobals
  1631. that.referencedClasses = spec.referencedClasses || [];
  1632. that.fn = spec.fn;
  1633. return that;
  1634. };
  1635. /* Add/remove a method to/from a class */
  1636. st.addMethod = function (method, traitOrBehavior) {
  1637. if (method.owner != null) {
  1638. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1639. }
  1640. method.owner = traitOrBehavior;
  1641. // TODO deprecation helper; remove
  1642. Object.defineProperty(method, "methodClass", {
  1643. get: function () {
  1644. console.warn("Use of .methodClass deprecated, use .owner");
  1645. return method.owner;
  1646. },
  1647. set: function (v) {
  1648. console.warn("Use of .methodClass= deprecated, use .owner=");
  1649. method.owner = v;
  1650. }
  1651. });
  1652. registerNewSelectors(method);
  1653. traitOrBehavior.localMethods[method.selector] = method;
  1654. updateMethod(method.selector, traitOrBehavior);
  1655. };
  1656. declareEvent("selectorsAdded");
  1657. function registerNewSelectors (method) {
  1658. var newSelectors = [];
  1659. function selectorInUse (stSelector) {
  1660. var pair = registerSelector(stSelector);
  1661. if (pair) {
  1662. newSelectors.push(pair);
  1663. }
  1664. }
  1665. selectorInUse(method.selector);
  1666. method.messageSends.forEach(selectorInUse);
  1667. emit.selectorsAdded(newSelectors);
  1668. }
  1669. st.removeMethod = function (method, traitOrBehavior) {
  1670. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1671. delete traitOrBehavior.localMethods[method.selector];
  1672. updateMethod(method.selector, traitOrBehavior);
  1673. };
  1674. this.setupMethods = function (traitOrBehavior) {
  1675. traitOrBehavior.localMethods = Object.create(null);
  1676. traitOrBehavior.methods = Object.create(null);
  1677. };
  1678. declareEvent("methodReplaced");
  1679. function updateMethod (selector, traitOrBehavior) {
  1680. var oldMethod = traitOrBehavior.methods[selector],
  1681. newMethod = traitOrBehavior.localMethods[selector];
  1682. if (oldMethod == null && newMethod == null) {
  1683. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1684. return;
  1685. }
  1686. if (newMethod === oldMethod) return;
  1687. if (newMethod != null) {
  1688. traitOrBehavior.methods[selector] = newMethod;
  1689. traitOrBehavior.methodAdded(newMethod);
  1690. } else {
  1691. delete traitOrBehavior.methods[selector];
  1692. traitOrBehavior.methodRemoved(oldMethod);
  1693. }
  1694. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1695. }
  1696. this.updateMethod = updateMethod;
  1697. }
  1698. function ArraySetBrik (brikz, st) {
  1699. st.addElement = this.addElement = function (array, el) {
  1700. if (typeof el === 'undefined') {
  1701. return;
  1702. }
  1703. if (array.indexOf(el) === -1) {
  1704. array.push(el);
  1705. }
  1706. };
  1707. st.removeElement = this.removeElement = function (array, el) {
  1708. var i = array.indexOf(el);
  1709. if (i !== -1) {
  1710. array.splice(i, 1);
  1711. }
  1712. };
  1713. }
  1714. function SelectorConversionBrik (brikz, st) {
  1715. /* Convert a Smalltalk selector into a JS selector */
  1716. st.st2js = function (string) {
  1717. return '_' + string
  1718. .replace(/:/g, '_')
  1719. .replace(/[\&]/g, '_and')
  1720. .replace(/[\|]/g, '_or')
  1721. .replace(/[+]/g, '_plus')
  1722. .replace(/-/g, '_minus')
  1723. .replace(/[*]/g, '_star')
  1724. .replace(/[\/]/g, '_slash')
  1725. .replace(/[\\]/g, '_backslash')
  1726. .replace(/[\~]/g, '_tild')
  1727. .replace(/%/g, '_percent')
  1728. .replace(/>/g, '_gt')
  1729. .replace(/</g, '_lt')
  1730. .replace(/=/g, '_eq')
  1731. .replace(/,/g, '_comma')
  1732. .replace(/[@]/g, '_at');
  1733. };
  1734. /* Convert a string to a valid smalltalk selector.
  1735. if you modify the following functions, also change st2js
  1736. accordingly */
  1737. st.js2st = function (selector) {
  1738. if (selector.match(/^__/)) {
  1739. return binaryJsToSt(selector);
  1740. } else {
  1741. return keywordJsToSt(selector);
  1742. }
  1743. };
  1744. function keywordJsToSt (selector) {
  1745. return selector.replace(/^_/, '').replace(/_/g, ':');
  1746. }
  1747. function binaryJsToSt (selector) {
  1748. return selector
  1749. .replace(/^_/, '')
  1750. .replace(/_and/g, '&')
  1751. .replace(/_or/g, '|')
  1752. .replace(/_plus/g, '+')
  1753. .replace(/_minus/g, '-')
  1754. .replace(/_star/g, '*')
  1755. .replace(/_slash/g, '/')
  1756. .replace(/_backslash/g, '\\')
  1757. .replace(/_tild/g, '~')
  1758. .replace(/_percent/g, '%')
  1759. .replace(/_gt/g, '>')
  1760. .replace(/_lt/g, '<')
  1761. .replace(/_eq/g, '=')
  1762. .replace(/_comma/g, ',')
  1763. .replace(/_at/g, '@');
  1764. }
  1765. st.st2prop = function (stSelector) {
  1766. var colonPosition = stSelector.indexOf(':');
  1767. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1768. };
  1769. }
  1770. NilBrik.deps = ["root"];
  1771. function NilBrik (brikz, st) {
  1772. var SmalltalkObject = brikz.root.Object;
  1773. var coreFns = brikz.root.coreFns;
  1774. function SmalltalkNil () {
  1775. }
  1776. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1777. this.nilAsReceiver = new SmalltalkNil();
  1778. this.nilAsValue = this.nilAsReceiver; // TODO null
  1779. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1780. // nil objects from one environment to another, doing
  1781. // `anObject == nil` (in JavaScript) does not always answer
  1782. // true as the referenced nil object might come from the other
  1783. // environment.
  1784. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1785. value: true,
  1786. enumerable: false, configurable: false, writable: false
  1787. });
  1788. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1789. value: true,
  1790. enumerable: false, configurable: false, writable: false
  1791. });
  1792. }
  1793. /* Making smalltalk that has basic building blocks */
  1794. function configureWithFundamentals (brikz) {
  1795. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1796. brikz.root = RootBrik;
  1797. brikz.nil = NilBrik;
  1798. brikz.event = EventBrik;
  1799. brikz.arraySet = ArraySetBrik;
  1800. brikz.selectorConversion = SelectorConversionBrik;
  1801. brikz.selectors = SelectorsBrik;
  1802. brikz.packages = PackagesBrik;
  1803. brikz.behaviors = BehaviorsBrik;
  1804. brikz.methods = MethodsBrik;
  1805. brikz.rebuild();
  1806. }
  1807. return configureWithFundamentals;
  1808. });
  1809. /* ====================================================================
  1810. |
  1811. | Amber Smalltalk
  1812. | http://amber-lang.net
  1813. |
  1814. ======================================================================
  1815. ======================================================================
  1816. |
  1817. | Copyright (c) 2010-2014
  1818. | Nicolas Petton <petton.nicolas@gmail.com>
  1819. |
  1820. | Copyright (c) 2012-2017
  1821. | The Amber team https://lolg.it/org/amber/members
  1822. | Amber contributors (see /CONTRIBUTORS)
  1823. |
  1824. | Amber is released under the MIT license
  1825. |
  1826. | Permission is hereby granted, free of charge, to any person obtaining
  1827. | a copy of this software and associated documentation files (the
  1828. | 'Software'), to deal in the Software without restriction, including
  1829. | without limitation the rights to use, copy, modify, merge, publish,
  1830. | distribute, sublicense, and/or sell copies of the Software, and to
  1831. | permit persons to whom the Software is furnished to do so, subject to
  1832. | the following conditions:
  1833. |
  1834. | The above copyright notice and this permission notice shall be
  1835. | included in all copies or substantial portions of the Software.
  1836. |
  1837. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1838. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1839. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1840. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1841. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1842. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1843. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1844. |
  1845. ==================================================================== */
  1846. //jshint eqnull:true
  1847. define('amber/kernel-language',[],function () {
  1848. "use strict";
  1849. function inherits (child, parent) {
  1850. child.prototype = Object.create(parent.prototype, {
  1851. constructor: {
  1852. value: child,
  1853. enumerable: false, configurable: true, writable: true
  1854. }
  1855. });
  1856. return child;
  1857. }
  1858. function defineMethod (klass, name, method) {
  1859. Object.defineProperty(klass.prototype, name, {
  1860. value: method,
  1861. enumerable: false, configurable: true, writable: true
  1862. });
  1863. }
  1864. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1865. function TraitsBrik (brikz, st) {
  1866. var coreFns = brikz.root.coreFns;
  1867. var SmalltalkObject = brikz.root.Object;
  1868. var setupMethods = brikz.methods.setupMethods;
  1869. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1870. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1871. var emit = brikz.event.emit;
  1872. var declareEvent = brikz.event.declareEvent;
  1873. function SmalltalkTrait () {
  1874. }
  1875. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1876. SmalltalkTrait.prototype.trait = true;
  1877. defineMethod(SmalltalkTrait, "toString", function () {
  1878. return 'Smalltalk Trait ' + this.name;
  1879. });
  1880. declareEvent("traitAdded");
  1881. defineMethod(SmalltalkTrait, "added", function () {
  1882. emit.traitAdded(this);
  1883. });
  1884. declareEvent("traitRemoved");
  1885. defineMethod(SmalltalkTrait, "removed", function () {
  1886. emit.traitRemoved(this);
  1887. });
  1888. declareEvent("traitMethodAdded");
  1889. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1890. var self = this;
  1891. this.traitUsers.forEach(function (each) {
  1892. traitMethodChanged(method.selector, method, self, each);
  1893. });
  1894. emit.traitMethodAdded(method, this);
  1895. });
  1896. declareEvent("traitMethodRemoved");
  1897. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1898. var self = this;
  1899. this.traitUsers.forEach(function (each) {
  1900. traitMethodChanged(method.selector, null, self, each);
  1901. });
  1902. emit.traitMethodRemoved(method, this);
  1903. });
  1904. function traitBuilder (traitName) {
  1905. return {
  1906. name: traitName,
  1907. make: function () {
  1908. var that = new SmalltalkTrait();
  1909. // TODO deprecation helper; remove
  1910. Object.defineProperty(that, "className", {
  1911. get: function () {
  1912. console.warn("Use of .className deprecated, use .name");
  1913. return that.name;
  1914. },
  1915. set: function (v) {
  1916. console.warn("Use of .className= deprecated, use .name=");
  1917. that.name = v;
  1918. }
  1919. });
  1920. that.name = traitName;
  1921. that.traitUsers = [];
  1922. setupMethods(that);
  1923. return that;
  1924. },
  1925. updateExisting: function (trait) {
  1926. }
  1927. };
  1928. }
  1929. st.addTrait = function (className, category) {
  1930. return buildTraitOrClass(category, traitBuilder(className));
  1931. };
  1932. }
  1933. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1934. function MethodCompositionBrik (brikz, st) {
  1935. var updateMethod = brikz.methods.updateMethod;
  1936. var addElement = brikz.arraySet.addElement;
  1937. var removeElement = brikz.arraySet.removeElement;
  1938. function aliased (selector, method) {
  1939. if (method.selector === selector) return method;
  1940. var result = st.method({
  1941. selector: selector,
  1942. args: method.args,
  1943. protocol: method.protocol,
  1944. source: '"Aliased as ' + selector + '"\n' + method.source,
  1945. messageSends: method.messageSends,
  1946. referencesClasses: method.referencedClasses,
  1947. fn: method.fn
  1948. });
  1949. result.owner = method.owner;
  1950. return result;
  1951. }
  1952. function deleteKeysFrom (keys, obj) {
  1953. keys.forEach(function (each) {
  1954. delete obj[each];
  1955. });
  1956. }
  1957. function fillTraitTransformation (traitTransformation, obj) {
  1958. // assert(Object.getOwnProperties(obj).length === 0)
  1959. var traitMethods = traitTransformation.trait.methods;
  1960. Object.keys(traitMethods).forEach(function (selector) {
  1961. obj[selector] = traitMethods[selector];
  1962. });
  1963. var traitAliases = traitTransformation.aliases;
  1964. if (traitAliases) {
  1965. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1966. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1967. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1968. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1969. });
  1970. }
  1971. var traitExclusions = traitTransformation.exclusions;
  1972. if (traitExclusions) {
  1973. deleteKeysFrom(traitExclusions, obj);
  1974. }
  1975. return obj;
  1976. }
  1977. function buildCompositionChain (traitComposition) {
  1978. return traitComposition.reduce(function (soFar, each) {
  1979. return fillTraitTransformation(each, Object.create(soFar));
  1980. }, null);
  1981. }
  1982. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1983. var oldLocalMethods = traitOrBehavior.localMethods,
  1984. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1985. Object.keys(oldLocalMethods).forEach(function (selector) {
  1986. newLocalMethods[selector] = oldLocalMethods[selector];
  1987. });
  1988. var selector;
  1989. traitOrBehavior.localMethods = newLocalMethods;
  1990. for (selector in newLocalMethods) {
  1991. updateMethod(selector, traitOrBehavior);
  1992. }
  1993. for (selector in oldLocalMethods) {
  1994. updateMethod(selector, traitOrBehavior);
  1995. }
  1996. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1997. removeElement(each.trait.traitUsers, traitOrBehavior);
  1998. });
  1999. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2000. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2001. addElement(each.trait.traitUsers, traitOrBehavior);
  2002. });
  2003. };
  2004. function aliasesOfSelector (selector, traitAliases) {
  2005. if (!traitAliases) return [selector];
  2006. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2007. return traitAliases[aliasSelector] === selector
  2008. });
  2009. if (!traitAliases[selector]) result.push(selector);
  2010. return result;
  2011. }
  2012. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2013. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2014. changes.forEach(function (aliasSelector) {
  2015. obj[aliasSelector] = aliased(aliasSelector, method);
  2016. });
  2017. var traitExclusions = traitTransformation.exclusions;
  2018. if (traitExclusions) {
  2019. deleteKeysFrom(traitExclusions, obj);
  2020. }
  2021. return changes;
  2022. }
  2023. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2024. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2025. deleteKeysFrom(changes, obj);
  2026. return changes;
  2027. }
  2028. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2029. var traitComposition = traitOrBehavior.traitComposition,
  2030. chain = traitOrBehavior.localMethods,
  2031. changes = [];
  2032. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2033. chain = Object.getPrototypeOf(chain);
  2034. var traitTransformation = traitComposition[i];
  2035. if (traitTransformation.trait !== trait) continue;
  2036. changes.push.apply(changes, method ?
  2037. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2038. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2039. }
  2040. // assert(chain === null);
  2041. changes.forEach(function (each) {
  2042. updateMethod(each, traitOrBehavior);
  2043. });
  2044. }
  2045. this.traitMethodChanged = traitMethodChanged;
  2046. }
  2047. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2048. function ClassesBrik (brikz, st) {
  2049. var SmalltalkRoot = brikz.root.Root;
  2050. var coreFns = brikz.root.coreFns;
  2051. var globals = brikz.smalltalkGlobals.globals;
  2052. var SmalltalkObject = brikz.root.Object;
  2053. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2054. var setupMethods = brikz.methods.setupMethods;
  2055. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2056. var addElement = brikz.arraySet.addElement;
  2057. var removeElement = brikz.arraySet.removeElement;
  2058. var emit = brikz.event.emit;
  2059. var declareEvent = brikz.event.declareEvent;
  2060. function SmalltalkBehavior () {
  2061. }
  2062. function SmalltalkClass () {
  2063. }
  2064. function SmalltalkMetaclass () {
  2065. }
  2066. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2067. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2068. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2069. // Fake root class of the system.
  2070. // Effective superclass of all classes created with `nil subclass: ...`.
  2071. var nilAsClass = this.nilAsClass = {
  2072. fn: SmalltalkRoot,
  2073. a$cls: {fn: SmalltalkClass},
  2074. klass: {fn: SmalltalkClass}
  2075. };
  2076. SmalltalkMetaclass.prototype.meta = true;
  2077. defineMethod(SmalltalkClass, "toString", function () {
  2078. return 'Smalltalk ' + this.name;
  2079. });
  2080. defineMethod(SmalltalkMetaclass, "toString", function () {
  2081. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2082. });
  2083. declareEvent("classAdded");
  2084. defineMethod(SmalltalkClass, "added", function () {
  2085. addSubclass(this);
  2086. emit.classAdded(this);
  2087. });
  2088. declareEvent("classRemoved");
  2089. defineMethod(SmalltalkClass, "removed", function () {
  2090. emit.classRemoved(this);
  2091. removeSubclass(this);
  2092. });
  2093. declareEvent("behaviorMethodAdded");
  2094. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2095. emit.behaviorMethodAdded(method, this);
  2096. });
  2097. declareEvent("behaviorMethodRemove");
  2098. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2099. emit.behaviorMethodRemoved(method, this);
  2100. });
  2101. this.bootstrapHierarchy = function () {
  2102. var nilSubclasses = [globals.ProtoObject];
  2103. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2104. nilSubclasses.forEach(function (each) {
  2105. each.a$cls.superclass = globals.Class;
  2106. addSubclass(each.a$cls);
  2107. });
  2108. };
  2109. /* Smalltalk class creation. A class is an instance of an automatically
  2110. created metaclass object. Newly created classes (not their metaclass)
  2111. should be added to the system, see smalltalk.addClass().
  2112. Superclass linking is *not* handled here, see api.initialize() */
  2113. function classBuilder (className, superclass, iVarNames, fn) {
  2114. var logicalSuperclass = superclass;
  2115. if (superclass == null || superclass.a$nil) {
  2116. superclass = nilAsClass;
  2117. logicalSuperclass = null;
  2118. }
  2119. function klass () {
  2120. var that = metaclass().instanceClass;
  2121. that.superclass = logicalSuperclass;
  2122. that.fn = fn || inherits(function () {
  2123. }, superclass.fn);
  2124. that.iVarNames = iVarNames || [];
  2125. // TODO deprecation helper; remove
  2126. Object.defineProperty(that, "className", {
  2127. get: function () {
  2128. console.warn("Use of .className deprecated, use .name");
  2129. return that.name;
  2130. },
  2131. set: function (v) {
  2132. console.warn("Use of .className= deprecated, use .name=");
  2133. that.name = v;
  2134. }
  2135. });
  2136. that.name = className;
  2137. that.subclasses = [];
  2138. setupMethods(that);
  2139. return that;
  2140. }
  2141. function metaclass () {
  2142. var that = new SmalltalkMetaclass();
  2143. that.superclass = superclass.a$cls;
  2144. that.fn = inherits(function () {
  2145. }, that.superclass.fn);
  2146. that.iVarNames = [];
  2147. that.instanceClass = new that.fn();
  2148. wireKlass(that);
  2149. setupMethods(that);
  2150. return that;
  2151. }
  2152. return {
  2153. name: className,
  2154. make: klass,
  2155. updateExisting: function (klass) {
  2156. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2157. if (iVarNames) klass.iVarNames = iVarNames;
  2158. } else throw new Error("Incompatible change of class: " + klass.name);
  2159. }
  2160. };
  2161. }
  2162. function wireKlass (klass) {
  2163. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2164. value: klass,
  2165. enumerable: false, configurable: true, writable: true
  2166. });
  2167. Object.defineProperty(klass.fn.prototype, "klass", {
  2168. value: klass,
  2169. enumerable: false, configurable: true, writable: true
  2170. });
  2171. }
  2172. this.wireKlass = wireKlass;
  2173. /* Add a class to the system, creating a new one if needed.
  2174. A Package is lazily created if one with given name does not exist. */
  2175. st.addClass = function (className, superclass, iVarNames, category) {
  2176. // While subclassing nil is allowed, it might be an error, so
  2177. // warn about it.
  2178. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2179. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2180. }
  2181. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2182. };
  2183. st.removeClass = removeTraitOrClass;
  2184. function addSubclass (klass) {
  2185. if (klass.superclass) {
  2186. addElement(klass.superclass.subclasses, klass);
  2187. }
  2188. }
  2189. function removeSubclass (klass) {
  2190. if (klass.superclass) {
  2191. removeElement(klass.superclass.subclasses, klass);
  2192. }
  2193. }
  2194. function metaSubclasses (metaclass) {
  2195. return metaclass.instanceClass.subclasses
  2196. .filter(function (each) {
  2197. return !each.meta;
  2198. })
  2199. .map(function (each) {
  2200. return each.a$cls;
  2201. });
  2202. }
  2203. st.metaSubclasses = metaSubclasses;
  2204. st.traverseClassTree = function (klass, fn) {
  2205. var queue = [klass], sentinel = {};
  2206. for (var i = 0; i < queue.length; ++i) {
  2207. var item = queue[i];
  2208. if (fn(item, sentinel) === sentinel) continue;
  2209. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2210. queue.push.apply(queue, subclasses);
  2211. }
  2212. };
  2213. }
  2214. /* Making smalltalk that can load */
  2215. function configureWithHierarchy (brikz) {
  2216. brikz.traits = TraitsBrik;
  2217. brikz.composition = MethodCompositionBrik;
  2218. brikz.classes = ClassesBrik;
  2219. brikz.rebuild();
  2220. }
  2221. return configureWithHierarchy;
  2222. });
  2223. /* ====================================================================
  2224. |
  2225. | Amber Smalltalk
  2226. | http://amber-lang.net
  2227. |
  2228. ======================================================================
  2229. ======================================================================
  2230. |
  2231. | Copyright (c) 2010-2014
  2232. | Nicolas Petton <petton.nicolas@gmail.com>
  2233. |
  2234. | Copyright (c) 2012-2017
  2235. | The Amber team https://lolg.it/org/amber/members
  2236. | Amber contributors (see /CONTRIBUTORS)
  2237. |
  2238. | Amber is released under the MIT license
  2239. |
  2240. | Permission is hereby granted, free of charge, to any person obtaining
  2241. | a copy of this software and associated documentation files (the
  2242. | 'Software'), to deal in the Software without restriction, including
  2243. | without limitation the rights to use, copy, modify, merge, publish,
  2244. | distribute, sublicense, and/or sell copies of the Software, and to
  2245. | permit persons to whom the Software is furnished to do so, subject to
  2246. | the following conditions:
  2247. |
  2248. | The above copyright notice and this permission notice shall be
  2249. | included in all copies or substantial portions of the Software.
  2250. |
  2251. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2252. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2253. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2254. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2255. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2256. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2257. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2258. |
  2259. ==================================================================== */
  2260. //jshint eqnull:true
  2261. define('amber/boot',[
  2262. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2263. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2264. "use strict";
  2265. require(['./kernel-runtime']); // preload
  2266. function SmalltalkInitBrik (brikz, st) {
  2267. var initialized = false;
  2268. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2269. require(['./kernel-runtime'], resolve, reject);
  2270. });
  2271. /* Smalltalk initialization. Called on page load */
  2272. st.initialize = function () {
  2273. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2274. if (initialized) return;
  2275. brikz.classes.bootstrapHierarchy();
  2276. configureWithRuntime(brikz);
  2277. // TODO deprecation helper; remove
  2278. Object.defineProperty(st, "packages", {
  2279. get: function () {
  2280. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2281. return st.packageDescriptors;
  2282. },
  2283. set: function (v) {
  2284. console.trace();
  2285. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2286. }
  2287. });
  2288. brikz.startImage.run();
  2289. initialized = true;
  2290. });
  2291. };
  2292. }
  2293. /* Adds AMD and requirejs related methods to the api */
  2294. function AMDBrik (brikz, st) {
  2295. st.amdRequire = require;
  2296. st.defaultTransportType = st.defaultTransportType || "amd";
  2297. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2298. }
  2299. /* Defines asReceiver to be present at load time */
  2300. /* (logically it belongs more to PrimitiveBrik) */
  2301. AsReceiverBrik.deps = ["nil"];
  2302. function AsReceiverBrik (brikz, st) {
  2303. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2304. /**
  2305. * This function is used all over the compiled amber code.
  2306. * It takes any value (JavaScript or Smalltalk)
  2307. * and returns a proper Amber Smalltalk receiver.
  2308. *
  2309. * null or undefined -> nilAsReceiver,
  2310. * object having Smalltalk signature -> unchanged,
  2311. * otherwise wrapped foreign (JS) object
  2312. */
  2313. this.asReceiver = function (o) {
  2314. if (o == null) return nilAsReceiver;
  2315. else if (o.a$cls != null) return o;
  2316. else return st.wrapJavaScript(o);
  2317. };
  2318. }
  2319. var api = {};
  2320. var brikz = new Brikz(api);
  2321. configureWithFundamentals(brikz);
  2322. configureWithHierarchy(brikz);
  2323. brikz.asReceiver = AsReceiverBrik;
  2324. brikz.stInit = SmalltalkInitBrik;
  2325. brikz.amd = AMDBrik;
  2326. brikz.rebuild();
  2327. return {
  2328. api: api,
  2329. nilAsReceiver: brikz.nil.nilAsReceiver,
  2330. nilAsValue: brikz.nil.nilAsValue,
  2331. nilAsClass: brikz.classes.nilAsClass,
  2332. globals: brikz.smalltalkGlobals.globals,
  2333. asReceiver: brikz.asReceiver.asReceiver
  2334. };
  2335. });
  2336. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2337. var globals = boot.globals,
  2338. exports = {},
  2339. api = boot.api,
  2340. nil = boot.nilAsReceiver;
  2341. // API
  2342. exports.popupHelios = function () {
  2343. require(['helios/index'], function (helios) {
  2344. helios.popup();
  2345. }, function (err) {
  2346. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2347. });
  2348. };
  2349. Object.defineProperty(exports, "api", {
  2350. value: api,
  2351. enumerable: true, configurable: true, writable: false
  2352. });
  2353. Object.defineProperty(exports, "globals", {
  2354. value: globals,
  2355. enumerable: true, configurable: true, writable: false
  2356. });
  2357. Object.defineProperty(exports, "nil", {
  2358. value: nil,
  2359. enumerable: true, configurable: true, writable: false
  2360. });
  2361. function mixinToSettings (source) {
  2362. var settings = globals.SmalltalkSettings;
  2363. Object.keys(source).forEach(function (key) {
  2364. settings[key] = source[key];
  2365. });
  2366. }
  2367. function settingsInLocalStorage () {
  2368. //jshint evil:true
  2369. var global = new Function('return this')(),
  2370. storage = 'localStorage' in global && global.localStorage;
  2371. if (storage) {
  2372. var fromStorage;
  2373. try {
  2374. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2375. } catch (ex) {
  2376. // pass
  2377. }
  2378. mixinToSettings(fromStorage || {});
  2379. if (typeof window !== "undefined") {
  2380. requirejs(['jquery'], function ($) {
  2381. $(window).on('beforeunload', function () {
  2382. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2383. });
  2384. });
  2385. }
  2386. }
  2387. }
  2388. exports.initialize = function (options) {
  2389. return Promise.resolve()
  2390. .then(function () {
  2391. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2392. })
  2393. .then(settingsInLocalStorage)
  2394. .then(function () {
  2395. return options || {};
  2396. })
  2397. .then(mixinToSettings)
  2398. .then(function () {
  2399. return api.initialize();
  2400. });
  2401. };
  2402. // Exports
  2403. return exports;
  2404. });
  2405. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2406. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2407. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2408. $core.addPackage("Kernel-Helpers");
  2409. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2410. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2411. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2412. $core.addMethod(
  2413. $core.method({
  2414. selector: "subclass:",
  2415. protocol: "class creation",
  2416. fn: function (aString){
  2417. var self=this,$self=this;
  2418. return $core.withContext(function($ctx1) {
  2419. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2420. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2421. },
  2422. args: ["aString"],
  2423. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2424. referencedClasses: [],
  2425. messageSends: ["subclass:instanceVariableNames:package:"]
  2426. }),
  2427. $globals.TSubclassable);
  2428. $core.addMethod(
  2429. $core.method({
  2430. selector: "subclass:instanceVariableNames:",
  2431. protocol: "class creation",
  2432. fn: function (aString,anotherString){
  2433. var self=this,$self=this;
  2434. return $core.withContext(function($ctx1) {
  2435. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2436. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2437. },
  2438. args: ["aString", "anotherString"],
  2439. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2440. referencedClasses: [],
  2441. messageSends: ["subclass:instanceVariableNames:package:"]
  2442. }),
  2443. $globals.TSubclassable);
  2444. $core.addMethod(
  2445. $core.method({
  2446. selector: "subclass:instanceVariableNames:category:",
  2447. protocol: "class creation",
  2448. fn: function (aString,aString2,aString3){
  2449. var self=this,$self=this;
  2450. return $core.withContext(function($ctx1) {
  2451. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2452. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2453. },
  2454. args: ["aString", "aString2", "aString3"],
  2455. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2456. referencedClasses: [],
  2457. messageSends: ["subclass:instanceVariableNames:package:"]
  2458. }),
  2459. $globals.TSubclassable);
  2460. $core.addMethod(
  2461. $core.method({
  2462. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2463. protocol: "class creation",
  2464. fn: function (aString,aString2,classVars,pools,aString3){
  2465. var self=this,$self=this;
  2466. return $core.withContext(function($ctx1) {
  2467. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2468. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2469. },
  2470. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2471. 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",
  2472. referencedClasses: [],
  2473. messageSends: ["subclass:instanceVariableNames:package:"]
  2474. }),
  2475. $globals.TSubclassable);
  2476. $core.addMethod(
  2477. $core.method({
  2478. selector: "subclass:instanceVariableNames:package:",
  2479. protocol: "class creation",
  2480. fn: function (aString,aString2,aString3){
  2481. var self=this,$self=this;
  2482. return $core.withContext(function($ctx1) {
  2483. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2484. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2485. },
  2486. args: ["aString", "aString2", "aString3"],
  2487. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2488. referencedClasses: ["ClassBuilder"],
  2489. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2490. }),
  2491. $globals.TSubclassable);
  2492. $core.addMethod(
  2493. $core.method({
  2494. selector: "subclass:uses:",
  2495. protocol: "class creation",
  2496. fn: function (aString,aTraitCompositionDescription){
  2497. var self=this,$self=this;
  2498. return $core.withContext(function($ctx1) {
  2499. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2500. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2501. },
  2502. args: ["aString", "aTraitCompositionDescription"],
  2503. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2504. referencedClasses: [],
  2505. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2506. }),
  2507. $globals.TSubclassable);
  2508. $core.addMethod(
  2509. $core.method({
  2510. selector: "subclass:uses:instanceVariableNames:",
  2511. protocol: "class creation",
  2512. fn: function (aString,aTraitCompositionDescription,anotherString){
  2513. var self=this,$self=this;
  2514. return $core.withContext(function($ctx1) {
  2515. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2516. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2517. },
  2518. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2519. 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",
  2520. referencedClasses: [],
  2521. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2522. }),
  2523. $globals.TSubclassable);
  2524. $core.addMethod(
  2525. $core.method({
  2526. selector: "subclass:uses:instanceVariableNames:category:",
  2527. protocol: "class creation",
  2528. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2529. var self=this,$self=this;
  2530. return $core.withContext(function($ctx1) {
  2531. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2532. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2533. },
  2534. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2535. 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",
  2536. referencedClasses: [],
  2537. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2538. }),
  2539. $globals.TSubclassable);
  2540. $core.addMethod(
  2541. $core.method({
  2542. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2543. protocol: "class creation",
  2544. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2545. var self=this,$self=this;
  2546. return $core.withContext(function($ctx1) {
  2547. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2548. }, 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)});
  2549. },
  2550. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2551. 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",
  2552. referencedClasses: [],
  2553. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2554. }),
  2555. $globals.TSubclassable);
  2556. $core.addMethod(
  2557. $core.method({
  2558. selector: "subclass:uses:instanceVariableNames:package:",
  2559. protocol: "class creation",
  2560. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2561. var self=this,$self=this;
  2562. var cls;
  2563. return $core.withContext(function($ctx1) {
  2564. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2565. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2566. return cls;
  2567. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2568. },
  2569. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2570. 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",
  2571. referencedClasses: [],
  2572. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2573. }),
  2574. $globals.TSubclassable);
  2575. });
  2576. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2577. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2578. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2579. $core.addPackage("Kernel-Objects");
  2580. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2581. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2582. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2583. $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.";
  2584. $core.addMethod(
  2585. $core.method({
  2586. selector: "=",
  2587. protocol: "comparing",
  2588. fn: function (anObject){
  2589. var self=this,$self=this;
  2590. return $core.withContext(function($ctx1) {
  2591. return $self.__eq_eq(anObject);
  2592. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2593. },
  2594. args: ["anObject"],
  2595. source: "= anObject\x0a\x09^ self == anObject",
  2596. referencedClasses: [],
  2597. messageSends: ["=="]
  2598. }),
  2599. $globals.ProtoObject);
  2600. $core.addMethod(
  2601. $core.method({
  2602. selector: "==",
  2603. protocol: "comparing",
  2604. fn: function (anObject){
  2605. var self=this,$self=this;
  2606. return $core.withContext(function($ctx1) {
  2607. return self === anObject;
  2608. return self;
  2609. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2610. },
  2611. args: ["anObject"],
  2612. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2613. referencedClasses: [],
  2614. messageSends: []
  2615. }),
  2616. $globals.ProtoObject);
  2617. $core.addMethod(
  2618. $core.method({
  2619. selector: "asJSON",
  2620. protocol: "converting",
  2621. fn: function (){
  2622. var self=this,$self=this;
  2623. return $core.withContext(function($ctx1) {
  2624. $self._deprecatedAPI_("Use #asJavaScriptObject instead.");
  2625. return $self._asJavaScriptObject();
  2626. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.ProtoObject)});
  2627. },
  2628. args: [],
  2629. source: "asJSON\x0a\x09self deprecatedAPI: 'Use #asJavaScriptObject instead.'.\x0a\x09^ self asJavaScriptObject",
  2630. referencedClasses: [],
  2631. messageSends: ["deprecatedAPI:", "asJavaScriptObject"]
  2632. }),
  2633. $globals.ProtoObject);
  2634. $core.addMethod(
  2635. $core.method({
  2636. selector: "asJavascript",
  2637. protocol: "converting",
  2638. fn: function (){
  2639. var self=this,$self=this;
  2640. return $core.withContext(function($ctx1) {
  2641. $self._deprecatedAPI_("Use #asJavaScriptSource instead.");
  2642. return $self._asJavaScriptSource();
  2643. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.ProtoObject)});
  2644. },
  2645. args: [],
  2646. source: "asJavascript\x0a\x09self deprecatedAPI: 'Use #asJavaScriptSource instead.'.\x0a\x09^ self asJavaScriptSource",
  2647. referencedClasses: [],
  2648. messageSends: ["deprecatedAPI:", "asJavaScriptSource"]
  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: "ceiling",
  5281. protocol: "converting",
  5282. fn: function (){
  5283. var self=this,$self=this;
  5284. return $core.withContext(function($ctx1) {
  5285. return Math.ceil(self);;
  5286. return self;
  5287. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5288. },
  5289. args: [],
  5290. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5291. referencedClasses: [],
  5292. messageSends: []
  5293. }),
  5294. $globals.Number);
  5295. $core.addMethod(
  5296. $core.method({
  5297. selector: "copy",
  5298. protocol: "copying",
  5299. fn: function (){
  5300. var self=this,$self=this;
  5301. return self;
  5302. },
  5303. args: [],
  5304. source: "copy\x0a\x09^ self",
  5305. referencedClasses: [],
  5306. messageSends: []
  5307. }),
  5308. $globals.Number);
  5309. $core.addMethod(
  5310. $core.method({
  5311. selector: "cos",
  5312. protocol: "mathematical functions",
  5313. fn: function (){
  5314. var self=this,$self=this;
  5315. return $core.withContext(function($ctx1) {
  5316. return Math.cos(self);;
  5317. return self;
  5318. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5319. },
  5320. args: [],
  5321. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5322. referencedClasses: [],
  5323. messageSends: []
  5324. }),
  5325. $globals.Number);
  5326. $core.addMethod(
  5327. $core.method({
  5328. selector: "deepCopy",
  5329. protocol: "copying",
  5330. fn: function (){
  5331. var self=this,$self=this;
  5332. return $core.withContext(function($ctx1) {
  5333. return $self._copy();
  5334. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5335. },
  5336. args: [],
  5337. source: "deepCopy\x0a\x09^ self copy",
  5338. referencedClasses: [],
  5339. messageSends: ["copy"]
  5340. }),
  5341. $globals.Number);
  5342. $core.addMethod(
  5343. $core.method({
  5344. selector: "degreesToRadians",
  5345. protocol: "converting",
  5346. fn: function (){
  5347. var self=this,$self=this;
  5348. return $core.withContext(function($ctx1) {
  5349. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5350. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5351. },
  5352. args: [],
  5353. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5354. referencedClasses: ["Number"],
  5355. messageSends: ["*", "radiansPerDegree"]
  5356. }),
  5357. $globals.Number);
  5358. $core.addMethod(
  5359. $core.method({
  5360. selector: "even",
  5361. protocol: "testing",
  5362. fn: function (){
  5363. var self=this,$self=this;
  5364. return $core.withContext(function($ctx1) {
  5365. return (0).__eq($self.__backslash_backslash((2)));
  5366. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5367. },
  5368. args: [],
  5369. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5370. referencedClasses: [],
  5371. messageSends: ["=", "\x5c\x5c"]
  5372. }),
  5373. $globals.Number);
  5374. $core.addMethod(
  5375. $core.method({
  5376. selector: "floor",
  5377. protocol: "converting",
  5378. fn: function (){
  5379. var self=this,$self=this;
  5380. return $core.withContext(function($ctx1) {
  5381. return Math.floor(self);;
  5382. return self;
  5383. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5384. },
  5385. args: [],
  5386. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5387. referencedClasses: [],
  5388. messageSends: []
  5389. }),
  5390. $globals.Number);
  5391. $core.addMethod(
  5392. $core.method({
  5393. selector: "isImmutable",
  5394. protocol: "testing",
  5395. fn: function (){
  5396. var self=this,$self=this;
  5397. return true;
  5398. },
  5399. args: [],
  5400. source: "isImmutable\x0a\x09^ true",
  5401. referencedClasses: [],
  5402. messageSends: []
  5403. }),
  5404. $globals.Number);
  5405. $core.addMethod(
  5406. $core.method({
  5407. selector: "isNumber",
  5408. protocol: "testing",
  5409. fn: function (){
  5410. var self=this,$self=this;
  5411. return true;
  5412. },
  5413. args: [],
  5414. source: "isNumber\x0a\x09^ true",
  5415. referencedClasses: [],
  5416. messageSends: []
  5417. }),
  5418. $globals.Number);
  5419. $core.addMethod(
  5420. $core.method({
  5421. selector: "isZero",
  5422. protocol: "testing",
  5423. fn: function (){
  5424. var self=this,$self=this;
  5425. return $core.withContext(function($ctx1) {
  5426. return $self.__eq((0));
  5427. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5428. },
  5429. args: [],
  5430. source: "isZero\x0a\x09^ self = 0",
  5431. referencedClasses: [],
  5432. messageSends: ["="]
  5433. }),
  5434. $globals.Number);
  5435. $core.addMethod(
  5436. $core.method({
  5437. selector: "ln",
  5438. protocol: "mathematical functions",
  5439. fn: function (){
  5440. var self=this,$self=this;
  5441. return $core.withContext(function($ctx1) {
  5442. return Math.log(self);;
  5443. return self;
  5444. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5445. },
  5446. args: [],
  5447. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5448. referencedClasses: [],
  5449. messageSends: []
  5450. }),
  5451. $globals.Number);
  5452. $core.addMethod(
  5453. $core.method({
  5454. selector: "log",
  5455. protocol: "mathematical functions",
  5456. fn: function (){
  5457. var self=this,$self=this;
  5458. return $core.withContext(function($ctx1) {
  5459. return Math.log(self) / Math.LN10;;
  5460. return self;
  5461. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5462. },
  5463. args: [],
  5464. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5465. referencedClasses: [],
  5466. messageSends: []
  5467. }),
  5468. $globals.Number);
  5469. $core.addMethod(
  5470. $core.method({
  5471. selector: "log:",
  5472. protocol: "mathematical functions",
  5473. fn: function (aNumber){
  5474. var self=this,$self=this;
  5475. return $core.withContext(function($ctx1) {
  5476. return Math.log(self) / Math.log(aNumber);;
  5477. return self;
  5478. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5479. },
  5480. args: ["aNumber"],
  5481. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5482. referencedClasses: [],
  5483. messageSends: []
  5484. }),
  5485. $globals.Number);
  5486. $core.addMethod(
  5487. $core.method({
  5488. selector: "max:",
  5489. protocol: "arithmetic",
  5490. fn: function (aNumber){
  5491. var self=this,$self=this;
  5492. return $core.withContext(function($ctx1) {
  5493. return Math.max(self, aNumber);;
  5494. return self;
  5495. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5496. },
  5497. args: ["aNumber"],
  5498. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5499. referencedClasses: [],
  5500. messageSends: []
  5501. }),
  5502. $globals.Number);
  5503. $core.addMethod(
  5504. $core.method({
  5505. selector: "min:",
  5506. protocol: "arithmetic",
  5507. fn: function (aNumber){
  5508. var self=this,$self=this;
  5509. return $core.withContext(function($ctx1) {
  5510. return Math.min(self, aNumber);;
  5511. return self;
  5512. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5513. },
  5514. args: ["aNumber"],
  5515. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5516. referencedClasses: [],
  5517. messageSends: []
  5518. }),
  5519. $globals.Number);
  5520. $core.addMethod(
  5521. $core.method({
  5522. selector: "min:max:",
  5523. protocol: "arithmetic",
  5524. fn: function (aMin,aMax){
  5525. var self=this,$self=this;
  5526. return $core.withContext(function($ctx1) {
  5527. return $recv($self._min_(aMin))._max_(aMax);
  5528. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5529. },
  5530. args: ["aMin", "aMax"],
  5531. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5532. referencedClasses: [],
  5533. messageSends: ["max:", "min:"]
  5534. }),
  5535. $globals.Number);
  5536. $core.addMethod(
  5537. $core.method({
  5538. selector: "negated",
  5539. protocol: "arithmetic",
  5540. fn: function (){
  5541. var self=this,$self=this;
  5542. return $core.withContext(function($ctx1) {
  5543. return (0).__minus(self);
  5544. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5545. },
  5546. args: [],
  5547. source: "negated\x0a\x09^ 0 - self",
  5548. referencedClasses: [],
  5549. messageSends: ["-"]
  5550. }),
  5551. $globals.Number);
  5552. $core.addMethod(
  5553. $core.method({
  5554. selector: "negative",
  5555. protocol: "testing",
  5556. fn: function (){
  5557. var self=this,$self=this;
  5558. return $core.withContext(function($ctx1) {
  5559. return $self.__lt((0));
  5560. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5561. },
  5562. args: [],
  5563. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5564. referencedClasses: [],
  5565. messageSends: ["<"]
  5566. }),
  5567. $globals.Number);
  5568. $core.addMethod(
  5569. $core.method({
  5570. selector: "odd",
  5571. protocol: "testing",
  5572. fn: function (){
  5573. var self=this,$self=this;
  5574. return $core.withContext(function($ctx1) {
  5575. return $recv($self._even())._not();
  5576. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5577. },
  5578. args: [],
  5579. source: "odd\x0a\x09^ self even not",
  5580. referencedClasses: [],
  5581. messageSends: ["not", "even"]
  5582. }),
  5583. $globals.Number);
  5584. $core.addMethod(
  5585. $core.method({
  5586. selector: "positive",
  5587. protocol: "testing",
  5588. fn: function (){
  5589. var self=this,$self=this;
  5590. return $core.withContext(function($ctx1) {
  5591. return $self.__gt_eq((0));
  5592. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5593. },
  5594. args: [],
  5595. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5596. referencedClasses: [],
  5597. messageSends: [">="]
  5598. }),
  5599. $globals.Number);
  5600. $core.addMethod(
  5601. $core.method({
  5602. selector: "printOn:",
  5603. protocol: "printing",
  5604. fn: function (aStream){
  5605. var self=this,$self=this;
  5606. return $core.withContext(function($ctx1) {
  5607. $recv(aStream)._nextPutAll_($self._asString());
  5608. return self;
  5609. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5610. },
  5611. args: ["aStream"],
  5612. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5613. referencedClasses: [],
  5614. messageSends: ["nextPutAll:", "asString"]
  5615. }),
  5616. $globals.Number);
  5617. $core.addMethod(
  5618. $core.method({
  5619. selector: "printShowingDecimalPlaces:",
  5620. protocol: "printing",
  5621. fn: function (placesDesired){
  5622. var self=this,$self=this;
  5623. return $core.withContext(function($ctx1) {
  5624. return self.toFixed(placesDesired);
  5625. return self;
  5626. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5627. },
  5628. args: ["placesDesired"],
  5629. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5630. referencedClasses: [],
  5631. messageSends: []
  5632. }),
  5633. $globals.Number);
  5634. $core.addMethod(
  5635. $core.method({
  5636. selector: "radiansToDegrees",
  5637. protocol: "converting",
  5638. fn: function (){
  5639. var self=this,$self=this;
  5640. return $core.withContext(function($ctx1) {
  5641. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5642. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5643. },
  5644. args: [],
  5645. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5646. referencedClasses: ["Number"],
  5647. messageSends: ["/", "radiansPerDegree"]
  5648. }),
  5649. $globals.Number);
  5650. $core.addMethod(
  5651. $core.method({
  5652. selector: "raisedTo:",
  5653. protocol: "mathematical functions",
  5654. fn: function (exponent){
  5655. var self=this,$self=this;
  5656. return $core.withContext(function($ctx1) {
  5657. return Math.pow(self, exponent);;
  5658. return self;
  5659. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5660. },
  5661. args: ["exponent"],
  5662. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5663. referencedClasses: [],
  5664. messageSends: []
  5665. }),
  5666. $globals.Number);
  5667. $core.addMethod(
  5668. $core.method({
  5669. selector: "rounded",
  5670. protocol: "converting",
  5671. fn: function (){
  5672. var self=this,$self=this;
  5673. return $core.withContext(function($ctx1) {
  5674. return Math.round(self);;
  5675. return self;
  5676. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5677. },
  5678. args: [],
  5679. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5680. referencedClasses: [],
  5681. messageSends: []
  5682. }),
  5683. $globals.Number);
  5684. $core.addMethod(
  5685. $core.method({
  5686. selector: "sign",
  5687. protocol: "mathematical functions",
  5688. fn: function (){
  5689. var self=this,$self=this;
  5690. return $core.withContext(function($ctx1) {
  5691. var $1,$2;
  5692. $1=$self._isZero();
  5693. if($core.assert($1)){
  5694. return (0);
  5695. }
  5696. $2=$self._positive();
  5697. if($core.assert($2)){
  5698. return (1);
  5699. } else {
  5700. return (-1);
  5701. }
  5702. return self;
  5703. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5704. },
  5705. args: [],
  5706. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5707. referencedClasses: [],
  5708. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5709. }),
  5710. $globals.Number);
  5711. $core.addMethod(
  5712. $core.method({
  5713. selector: "sin",
  5714. protocol: "mathematical functions",
  5715. fn: function (){
  5716. var self=this,$self=this;
  5717. return $core.withContext(function($ctx1) {
  5718. return Math.sin(self);;
  5719. return self;
  5720. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5721. },
  5722. args: [],
  5723. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5724. referencedClasses: [],
  5725. messageSends: []
  5726. }),
  5727. $globals.Number);
  5728. $core.addMethod(
  5729. $core.method({
  5730. selector: "sqrt",
  5731. protocol: "mathematical functions",
  5732. fn: function (){
  5733. var self=this,$self=this;
  5734. return $core.withContext(function($ctx1) {
  5735. return Math.sqrt(self);
  5736. return self;
  5737. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5738. },
  5739. args: [],
  5740. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5741. referencedClasses: [],
  5742. messageSends: []
  5743. }),
  5744. $globals.Number);
  5745. $core.addMethod(
  5746. $core.method({
  5747. selector: "squared",
  5748. protocol: "mathematical functions",
  5749. fn: function (){
  5750. var self=this,$self=this;
  5751. return $core.withContext(function($ctx1) {
  5752. return $self.__star(self);
  5753. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5754. },
  5755. args: [],
  5756. source: "squared\x0a\x09^ self * self",
  5757. referencedClasses: [],
  5758. messageSends: ["*"]
  5759. }),
  5760. $globals.Number);
  5761. $core.addMethod(
  5762. $core.method({
  5763. selector: "tan",
  5764. protocol: "mathematical functions",
  5765. fn: function (){
  5766. var self=this,$self=this;
  5767. return $core.withContext(function($ctx1) {
  5768. return Math.tan(self);;
  5769. return self;
  5770. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5771. },
  5772. args: [],
  5773. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5774. referencedClasses: [],
  5775. messageSends: []
  5776. }),
  5777. $globals.Number);
  5778. $core.addMethod(
  5779. $core.method({
  5780. selector: "timesRepeat:",
  5781. protocol: "enumerating",
  5782. fn: function (aBlock){
  5783. var self=this,$self=this;
  5784. var count;
  5785. return $core.withContext(function($ctx1) {
  5786. count=(1);
  5787. $recv((function(){
  5788. return $core.withContext(function($ctx2) {
  5789. return $recv(count).__gt(self);
  5790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5791. }))._whileFalse_((function(){
  5792. return $core.withContext(function($ctx2) {
  5793. $recv(aBlock)._value();
  5794. count=$recv(count).__plus((1));
  5795. return count;
  5796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5797. }));
  5798. return self;
  5799. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5800. },
  5801. args: ["aBlock"],
  5802. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5803. referencedClasses: [],
  5804. messageSends: ["whileFalse:", ">", "value", "+"]
  5805. }),
  5806. $globals.Number);
  5807. $core.addMethod(
  5808. $core.method({
  5809. selector: "to:",
  5810. protocol: "converting",
  5811. fn: function (aNumber){
  5812. var self=this,$self=this;
  5813. var array,first,last,count;
  5814. return $core.withContext(function($ctx1) {
  5815. first=$self._truncated();
  5816. $ctx1.sendIdx["truncated"]=1;
  5817. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5818. $ctx1.sendIdx["+"]=1;
  5819. count=(1);
  5820. array=$recv($globals.Array)._new();
  5821. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5822. return $core.withContext(function($ctx2) {
  5823. $recv(array)._at_put_(count,first);
  5824. count=$recv(count).__plus((1));
  5825. $ctx2.sendIdx["+"]=2;
  5826. count;
  5827. first=$recv(first).__plus((1));
  5828. return first;
  5829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5830. }));
  5831. return array;
  5832. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5833. },
  5834. args: ["aNumber"],
  5835. 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",
  5836. referencedClasses: ["Array"],
  5837. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5838. }),
  5839. $globals.Number);
  5840. $core.addMethod(
  5841. $core.method({
  5842. selector: "to:by:",
  5843. protocol: "converting",
  5844. fn: function (stop,step){
  5845. var self=this,$self=this;
  5846. var array,value,pos;
  5847. return $core.withContext(function($ctx1) {
  5848. var $1,$2;
  5849. value=self;
  5850. array=$recv($globals.Array)._new();
  5851. pos=(1);
  5852. $1=$recv(step).__eq((0));
  5853. if($core.assert($1)){
  5854. $self._error_("step must be non-zero");
  5855. }
  5856. $2=$recv(step).__lt((0));
  5857. if($core.assert($2)){
  5858. $recv((function(){
  5859. return $core.withContext(function($ctx2) {
  5860. return $recv(value).__gt_eq(stop);
  5861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5862. }))._whileTrue_((function(){
  5863. return $core.withContext(function($ctx2) {
  5864. $recv(array)._at_put_(pos,value);
  5865. $ctx2.sendIdx["at:put:"]=1;
  5866. pos=$recv(pos).__plus((1));
  5867. $ctx2.sendIdx["+"]=1;
  5868. pos;
  5869. value=$recv(value).__plus(step);
  5870. $ctx2.sendIdx["+"]=2;
  5871. return value;
  5872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5873. }));
  5874. $ctx1.sendIdx["whileTrue:"]=1;
  5875. } else {
  5876. $recv((function(){
  5877. return $core.withContext(function($ctx2) {
  5878. return $recv(value).__lt_eq(stop);
  5879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5880. }))._whileTrue_((function(){
  5881. return $core.withContext(function($ctx2) {
  5882. $recv(array)._at_put_(pos,value);
  5883. pos=$recv(pos).__plus((1));
  5884. $ctx2.sendIdx["+"]=3;
  5885. pos;
  5886. value=$recv(value).__plus(step);
  5887. return value;
  5888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5889. }));
  5890. }
  5891. return array;
  5892. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5893. },
  5894. args: ["stop", "step"],
  5895. 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",
  5896. referencedClasses: ["Array"],
  5897. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5898. }),
  5899. $globals.Number);
  5900. $core.addMethod(
  5901. $core.method({
  5902. selector: "to:by:do:",
  5903. protocol: "enumerating",
  5904. fn: function (stop,step,aBlock){
  5905. var self=this,$self=this;
  5906. var value;
  5907. return $core.withContext(function($ctx1) {
  5908. var $1,$2;
  5909. value=self;
  5910. $1=$recv(step).__eq((0));
  5911. if($core.assert($1)){
  5912. $self._error_("step must be non-zero");
  5913. }
  5914. $2=$recv(step).__lt((0));
  5915. if($core.assert($2)){
  5916. $recv((function(){
  5917. return $core.withContext(function($ctx2) {
  5918. return $recv(value).__gt_eq(stop);
  5919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5920. }))._whileTrue_((function(){
  5921. return $core.withContext(function($ctx2) {
  5922. $recv(aBlock)._value_(value);
  5923. $ctx2.sendIdx["value:"]=1;
  5924. value=$recv(value).__plus(step);
  5925. $ctx2.sendIdx["+"]=1;
  5926. return value;
  5927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5928. }));
  5929. $ctx1.sendIdx["whileTrue:"]=1;
  5930. } else {
  5931. $recv((function(){
  5932. return $core.withContext(function($ctx2) {
  5933. return $recv(value).__lt_eq(stop);
  5934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5935. }))._whileTrue_((function(){
  5936. return $core.withContext(function($ctx2) {
  5937. $recv(aBlock)._value_(value);
  5938. value=$recv(value).__plus(step);
  5939. return value;
  5940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5941. }));
  5942. }
  5943. return self;
  5944. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  5945. },
  5946. args: ["stop", "step", "aBlock"],
  5947. 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 ]]",
  5948. referencedClasses: [],
  5949. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5950. }),
  5951. $globals.Number);
  5952. $core.addMethod(
  5953. $core.method({
  5954. selector: "to:do:",
  5955. protocol: "enumerating",
  5956. fn: function (stop,aBlock){
  5957. var self=this,$self=this;
  5958. var nextValue;
  5959. return $core.withContext(function($ctx1) {
  5960. nextValue=self;
  5961. $recv((function(){
  5962. return $core.withContext(function($ctx2) {
  5963. return $recv(nextValue).__lt_eq(stop);
  5964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5965. }))._whileTrue_((function(){
  5966. return $core.withContext(function($ctx2) {
  5967. $recv(aBlock)._value_(nextValue);
  5968. nextValue=$recv(nextValue).__plus((1));
  5969. return nextValue;
  5970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5971. }));
  5972. return self;
  5973. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5974. },
  5975. args: ["stop", "aBlock"],
  5976. 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 ]",
  5977. referencedClasses: [],
  5978. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5979. }),
  5980. $globals.Number);
  5981. $core.addMethod(
  5982. $core.method({
  5983. selector: "truncated",
  5984. protocol: "converting",
  5985. fn: function (){
  5986. var self=this,$self=this;
  5987. return $core.withContext(function($ctx1) {
  5988. if(self >= 0) {
  5989. return Math.floor(self);
  5990. } else {
  5991. return Math.floor(self * (-1)) * (-1);
  5992. };
  5993. ;
  5994. return self;
  5995. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5996. },
  5997. args: [],
  5998. 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'>",
  5999. referencedClasses: [],
  6000. messageSends: []
  6001. }),
  6002. $globals.Number);
  6003. $core.addMethod(
  6004. $core.method({
  6005. selector: "|",
  6006. protocol: "converting",
  6007. fn: function (aNumber){
  6008. var self=this,$self=this;
  6009. return $core.withContext(function($ctx1) {
  6010. return self | aNumber;
  6011. return self;
  6012. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6013. },
  6014. args: ["aNumber"],
  6015. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6016. referencedClasses: [],
  6017. messageSends: []
  6018. }),
  6019. $globals.Number);
  6020. $core.addMethod(
  6021. $core.method({
  6022. selector: "classTag",
  6023. protocol: "accessing",
  6024. fn: function (){
  6025. var self=this,$self=this;
  6026. return "magnitude";
  6027. },
  6028. args: [],
  6029. 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'",
  6030. referencedClasses: [],
  6031. messageSends: []
  6032. }),
  6033. $globals.Number.a$cls);
  6034. $core.addMethod(
  6035. $core.method({
  6036. selector: "e",
  6037. protocol: "instance creation",
  6038. fn: function (){
  6039. var self=this,$self=this;
  6040. return $core.withContext(function($ctx1) {
  6041. return Math.E;;
  6042. return self;
  6043. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6044. },
  6045. args: [],
  6046. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6047. referencedClasses: [],
  6048. messageSends: []
  6049. }),
  6050. $globals.Number.a$cls);
  6051. $core.addMethod(
  6052. $core.method({
  6053. selector: "pi",
  6054. protocol: "instance creation",
  6055. fn: function (){
  6056. var self=this,$self=this;
  6057. return $core.withContext(function($ctx1) {
  6058. return Math.PI;
  6059. return self;
  6060. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6061. },
  6062. args: [],
  6063. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6064. referencedClasses: [],
  6065. messageSends: []
  6066. }),
  6067. $globals.Number.a$cls);
  6068. $core.addMethod(
  6069. $core.method({
  6070. selector: "radiansPerDegree",
  6071. protocol: "instance creation",
  6072. fn: function (){
  6073. var self=this,$self=this;
  6074. return $core.withContext(function($ctx1) {
  6075. return $recv($self._pi()).__slash((180));
  6076. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6077. },
  6078. args: [],
  6079. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6080. referencedClasses: [],
  6081. messageSends: ["/", "pi"]
  6082. }),
  6083. $globals.Number.a$cls);
  6084. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6085. $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";
  6086. $core.addMethod(
  6087. $core.method({
  6088. selector: "*",
  6089. protocol: "arithmetic",
  6090. fn: function (aPoint){
  6091. var self=this,$self=this;
  6092. return $core.withContext(function($ctx1) {
  6093. var $2,$4,$3,$1,$6,$5;
  6094. $2=$self._x();
  6095. $ctx1.sendIdx["x"]=1;
  6096. $4=$recv(aPoint)._asPoint();
  6097. $ctx1.sendIdx["asPoint"]=1;
  6098. $3=$recv($4)._x();
  6099. $1=$recv($2).__star($3);
  6100. $ctx1.sendIdx["*"]=1;
  6101. $6=$self._y();
  6102. $ctx1.sendIdx["y"]=1;
  6103. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6104. return $recv($globals.Point)._x_y_($1,$5);
  6105. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6106. },
  6107. args: ["aPoint"],
  6108. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6109. referencedClasses: ["Point"],
  6110. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6111. }),
  6112. $globals.Point);
  6113. $core.addMethod(
  6114. $core.method({
  6115. selector: "+",
  6116. protocol: "arithmetic",
  6117. fn: function (aPoint){
  6118. var self=this,$self=this;
  6119. return $core.withContext(function($ctx1) {
  6120. var $2,$4,$3,$1,$6,$5;
  6121. $2=$self._x();
  6122. $ctx1.sendIdx["x"]=1;
  6123. $4=$recv(aPoint)._asPoint();
  6124. $ctx1.sendIdx["asPoint"]=1;
  6125. $3=$recv($4)._x();
  6126. $1=$recv($2).__plus($3);
  6127. $ctx1.sendIdx["+"]=1;
  6128. $6=$self._y();
  6129. $ctx1.sendIdx["y"]=1;
  6130. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6131. return $recv($globals.Point)._x_y_($1,$5);
  6132. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6133. },
  6134. args: ["aPoint"],
  6135. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6136. referencedClasses: ["Point"],
  6137. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6138. }),
  6139. $globals.Point);
  6140. $core.addMethod(
  6141. $core.method({
  6142. selector: "-",
  6143. protocol: "arithmetic",
  6144. fn: function (aPoint){
  6145. var self=this,$self=this;
  6146. return $core.withContext(function($ctx1) {
  6147. var $2,$4,$3,$1,$6,$5;
  6148. $2=$self._x();
  6149. $ctx1.sendIdx["x"]=1;
  6150. $4=$recv(aPoint)._asPoint();
  6151. $ctx1.sendIdx["asPoint"]=1;
  6152. $3=$recv($4)._x();
  6153. $1=$recv($2).__minus($3);
  6154. $ctx1.sendIdx["-"]=1;
  6155. $6=$self._y();
  6156. $ctx1.sendIdx["y"]=1;
  6157. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6158. return $recv($globals.Point)._x_y_($1,$5);
  6159. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6160. },
  6161. args: ["aPoint"],
  6162. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6163. referencedClasses: ["Point"],
  6164. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6165. }),
  6166. $globals.Point);
  6167. $core.addMethod(
  6168. $core.method({
  6169. selector: "/",
  6170. protocol: "arithmetic",
  6171. fn: function (aPoint){
  6172. var self=this,$self=this;
  6173. return $core.withContext(function($ctx1) {
  6174. var $2,$4,$3,$1,$6,$5;
  6175. $2=$self._x();
  6176. $ctx1.sendIdx["x"]=1;
  6177. $4=$recv(aPoint)._asPoint();
  6178. $ctx1.sendIdx["asPoint"]=1;
  6179. $3=$recv($4)._x();
  6180. $1=$recv($2).__slash($3);
  6181. $ctx1.sendIdx["/"]=1;
  6182. $6=$self._y();
  6183. $ctx1.sendIdx["y"]=1;
  6184. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6185. return $recv($globals.Point)._x_y_($1,$5);
  6186. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6187. },
  6188. args: ["aPoint"],
  6189. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6190. referencedClasses: ["Point"],
  6191. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6192. }),
  6193. $globals.Point);
  6194. $core.addMethod(
  6195. $core.method({
  6196. selector: "<",
  6197. protocol: "comparing",
  6198. fn: function (aPoint){
  6199. var self=this,$self=this;
  6200. return $core.withContext(function($ctx1) {
  6201. var $2,$1,$3;
  6202. $2=$self._x();
  6203. $ctx1.sendIdx["x"]=1;
  6204. $1=$recv($2).__lt($recv(aPoint)._x());
  6205. $ctx1.sendIdx["<"]=1;
  6206. return $recv($1)._and_((function(){
  6207. return $core.withContext(function($ctx2) {
  6208. $3=$self._y();
  6209. $ctx2.sendIdx["y"]=1;
  6210. return $recv($3).__lt($recv(aPoint)._y());
  6211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6212. }));
  6213. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6214. },
  6215. args: ["aPoint"],
  6216. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6217. referencedClasses: [],
  6218. messageSends: ["and:", "<", "x", "y"]
  6219. }),
  6220. $globals.Point);
  6221. $core.addMethod(
  6222. $core.method({
  6223. selector: "<=",
  6224. protocol: "comparing",
  6225. fn: function (aPoint){
  6226. var self=this,$self=this;
  6227. return $core.withContext(function($ctx1) {
  6228. var $2,$1,$3;
  6229. $2=$self._x();
  6230. $ctx1.sendIdx["x"]=1;
  6231. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6232. $ctx1.sendIdx["<="]=1;
  6233. return $recv($1)._and_((function(){
  6234. return $core.withContext(function($ctx2) {
  6235. $3=$self._y();
  6236. $ctx2.sendIdx["y"]=1;
  6237. return $recv($3).__lt_eq($recv(aPoint)._y());
  6238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6239. }));
  6240. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6241. },
  6242. args: ["aPoint"],
  6243. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6244. referencedClasses: [],
  6245. messageSends: ["and:", "<=", "x", "y"]
  6246. }),
  6247. $globals.Point);
  6248. $core.addMethod(
  6249. $core.method({
  6250. selector: "=",
  6251. protocol: "comparing",
  6252. fn: function (aPoint){
  6253. var self=this,$self=this;
  6254. return $core.withContext(function($ctx1) {
  6255. var $2,$1,$4,$3,$6,$5;
  6256. $2=$recv(aPoint)._class();
  6257. $ctx1.sendIdx["class"]=1;
  6258. $1=$recv($2).__eq($self._class());
  6259. $ctx1.sendIdx["="]=1;
  6260. return $recv($1)._and_((function(){
  6261. return $core.withContext(function($ctx2) {
  6262. $4=$recv(aPoint)._x();
  6263. $ctx2.sendIdx["x"]=1;
  6264. $3=$recv($4).__eq($self._x());
  6265. $ctx2.sendIdx["="]=2;
  6266. $6=$recv(aPoint)._y();
  6267. $ctx2.sendIdx["y"]=1;
  6268. $5=$recv($6).__eq($self._y());
  6269. return $recv($3).__and($5);
  6270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6271. }));
  6272. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6273. },
  6274. args: ["aPoint"],
  6275. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6276. referencedClasses: [],
  6277. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6278. }),
  6279. $globals.Point);
  6280. $core.addMethod(
  6281. $core.method({
  6282. selector: ">",
  6283. protocol: "comparing",
  6284. fn: function (aPoint){
  6285. var self=this,$self=this;
  6286. return $core.withContext(function($ctx1) {
  6287. var $2,$1,$3;
  6288. $2=$self._x();
  6289. $ctx1.sendIdx["x"]=1;
  6290. $1=$recv($2).__gt($recv(aPoint)._x());
  6291. $ctx1.sendIdx[">"]=1;
  6292. return $recv($1)._and_((function(){
  6293. return $core.withContext(function($ctx2) {
  6294. $3=$self._y();
  6295. $ctx2.sendIdx["y"]=1;
  6296. return $recv($3).__gt($recv(aPoint)._y());
  6297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6298. }));
  6299. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6300. },
  6301. args: ["aPoint"],
  6302. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6303. referencedClasses: [],
  6304. messageSends: ["and:", ">", "x", "y"]
  6305. }),
  6306. $globals.Point);
  6307. $core.addMethod(
  6308. $core.method({
  6309. selector: ">=",
  6310. protocol: "comparing",
  6311. fn: function (aPoint){
  6312. var self=this,$self=this;
  6313. return $core.withContext(function($ctx1) {
  6314. var $2,$1,$3;
  6315. $2=$self._x();
  6316. $ctx1.sendIdx["x"]=1;
  6317. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6318. $ctx1.sendIdx[">="]=1;
  6319. return $recv($1)._and_((function(){
  6320. return $core.withContext(function($ctx2) {
  6321. $3=$self._y();
  6322. $ctx2.sendIdx["y"]=1;
  6323. return $recv($3).__gt_eq($recv(aPoint)._y());
  6324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6325. }));
  6326. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6327. },
  6328. args: ["aPoint"],
  6329. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6330. referencedClasses: [],
  6331. messageSends: ["and:", ">=", "x", "y"]
  6332. }),
  6333. $globals.Point);
  6334. $core.addMethod(
  6335. $core.method({
  6336. selector: "angle",
  6337. protocol: "geometry",
  6338. fn: function (){
  6339. var self=this,$self=this;
  6340. return $core.withContext(function($ctx1) {
  6341. return $recv($self._y())._arcTan_($self._x());
  6342. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6343. },
  6344. args: [],
  6345. source: "angle\x0a\x09^ self y arcTan: self x",
  6346. referencedClasses: [],
  6347. messageSends: ["arcTan:", "y", "x"]
  6348. }),
  6349. $globals.Point);
  6350. $core.addMethod(
  6351. $core.method({
  6352. selector: "asPoint",
  6353. protocol: "converting",
  6354. fn: function (){
  6355. var self=this,$self=this;
  6356. return self;
  6357. },
  6358. args: [],
  6359. source: "asPoint\x0a\x09^ self",
  6360. referencedClasses: [],
  6361. messageSends: []
  6362. }),
  6363. $globals.Point);
  6364. $core.addMethod(
  6365. $core.method({
  6366. selector: "corner:",
  6367. protocol: "rectangle creation",
  6368. fn: function (aPoint){
  6369. var self=this,$self=this;
  6370. return $core.withContext(function($ctx1) {
  6371. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6372. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6373. },
  6374. args: ["aPoint"],
  6375. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6376. referencedClasses: ["Rectangle"],
  6377. messageSends: ["origin:corner:"]
  6378. }),
  6379. $globals.Point);
  6380. $core.addMethod(
  6381. $core.method({
  6382. selector: "dist:",
  6383. protocol: "transforming",
  6384. fn: function (aPoint){
  6385. var self=this,$self=this;
  6386. var dx,dy;
  6387. return $core.withContext(function($ctx1) {
  6388. var $2,$1;
  6389. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6390. $ctx1.sendIdx["-"]=1;
  6391. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6392. $2=$recv(dx).__star(dx);
  6393. $ctx1.sendIdx["*"]=1;
  6394. $1=$recv($2).__plus($recv(dy).__star(dy));
  6395. return $recv($1)._sqrt();
  6396. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6397. },
  6398. args: ["aPoint"],
  6399. 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",
  6400. referencedClasses: [],
  6401. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6402. }),
  6403. $globals.Point);
  6404. $core.addMethod(
  6405. $core.method({
  6406. selector: "dotProduct:",
  6407. protocol: "point functions",
  6408. fn: function (aPoint){
  6409. var self=this,$self=this;
  6410. return $core.withContext(function($ctx1) {
  6411. var $1;
  6412. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6413. $ctx1.sendIdx["*"]=1;
  6414. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6415. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6416. },
  6417. args: ["aPoint"],
  6418. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6419. referencedClasses: [],
  6420. messageSends: ["+", "*", "x", "y"]
  6421. }),
  6422. $globals.Point);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "extent:",
  6426. protocol: "rectangle creation",
  6427. fn: function (aPoint){
  6428. var self=this,$self=this;
  6429. return $core.withContext(function($ctx1) {
  6430. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6431. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6432. },
  6433. args: ["aPoint"],
  6434. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6435. referencedClasses: ["Rectangle"],
  6436. messageSends: ["origin:extent:"]
  6437. }),
  6438. $globals.Point);
  6439. $core.addMethod(
  6440. $core.method({
  6441. selector: "normal",
  6442. protocol: "point functions",
  6443. fn: function (){
  6444. var self=this,$self=this;
  6445. var n,d;
  6446. return $core.withContext(function($ctx1) {
  6447. var $4,$3,$6,$5,$2,$1;
  6448. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6449. $ctx1.sendIdx["@"]=1;
  6450. $4=$recv(n)._x();
  6451. $ctx1.sendIdx["x"]=1;
  6452. $3=$recv($4).__star($recv(n)._x());
  6453. $ctx1.sendIdx["*"]=1;
  6454. $6=$recv(n)._y();
  6455. $ctx1.sendIdx["y"]=1;
  6456. $5=$recv($6).__star($recv(n)._y());
  6457. d=$recv($3).__plus($5);
  6458. $2=d;
  6459. $1=$recv($2).__eq((0));
  6460. if($core.assert($1)){
  6461. return (-1).__at((0));
  6462. }
  6463. return $recv(n).__slash($recv(d)._sqrt());
  6464. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6465. },
  6466. args: [],
  6467. 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",
  6468. referencedClasses: [],
  6469. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6470. }),
  6471. $globals.Point);
  6472. $core.addMethod(
  6473. $core.method({
  6474. selector: "normalized",
  6475. protocol: "point functions",
  6476. fn: function (){
  6477. var self=this,$self=this;
  6478. var r;
  6479. return $core.withContext(function($ctx1) {
  6480. var $1,$2,$3;
  6481. r=$self._r();
  6482. $1=$recv(r).__eq((0));
  6483. if($core.assert($1)){
  6484. $2=$recv($globals.Point)._x_y_((0),(0));
  6485. $ctx1.sendIdx["x:y:"]=1;
  6486. return $2;
  6487. } else {
  6488. $3=$recv($self["@x"]).__slash(r);
  6489. $ctx1.sendIdx["/"]=1;
  6490. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6491. }
  6492. return self;
  6493. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6494. },
  6495. args: [],
  6496. 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 ]",
  6497. referencedClasses: ["Point"],
  6498. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6499. }),
  6500. $globals.Point);
  6501. $core.addMethod(
  6502. $core.method({
  6503. selector: "printOn:",
  6504. protocol: "printing",
  6505. fn: function (aStream){
  6506. var self=this,$self=this;
  6507. return $core.withContext(function($ctx1) {
  6508. var $1;
  6509. $recv($self["@x"])._printOn_(aStream);
  6510. $ctx1.sendIdx["printOn:"]=1;
  6511. $recv(aStream)._nextPutAll_("@");
  6512. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6513. return $core.withContext(function($ctx2) {
  6514. return $recv($self["@y"])._negative();
  6515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6516. }));
  6517. if($core.assert($1)){
  6518. $recv(aStream)._space();
  6519. }
  6520. $recv($self["@y"])._printOn_(aStream);
  6521. return self;
  6522. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6523. },
  6524. args: ["aStream"],
  6525. 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",
  6526. referencedClasses: [],
  6527. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6528. }),
  6529. $globals.Point);
  6530. $core.addMethod(
  6531. $core.method({
  6532. selector: "r",
  6533. protocol: "polar coordinates",
  6534. fn: function (){
  6535. var self=this,$self=this;
  6536. return $core.withContext(function($ctx1) {
  6537. var $2,$1;
  6538. $2=$recv($self["@x"]).__star($self["@x"]);
  6539. $ctx1.sendIdx["*"]=1;
  6540. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6541. return $recv($1)._sqrt();
  6542. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6543. },
  6544. args: [],
  6545. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6546. referencedClasses: [],
  6547. messageSends: ["sqrt", "+", "*"]
  6548. }),
  6549. $globals.Point);
  6550. $core.addMethod(
  6551. $core.method({
  6552. selector: "rectangle:",
  6553. protocol: "rectangle creation",
  6554. fn: function (aPoint){
  6555. var self=this,$self=this;
  6556. return $core.withContext(function($ctx1) {
  6557. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6558. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6559. },
  6560. args: ["aPoint"],
  6561. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6562. referencedClasses: ["Rectangle"],
  6563. messageSends: ["point:point:"]
  6564. }),
  6565. $globals.Point);
  6566. $core.addMethod(
  6567. $core.method({
  6568. selector: "translateBy:",
  6569. protocol: "transforming",
  6570. fn: function (delta){
  6571. var self=this,$self=this;
  6572. return $core.withContext(function($ctx1) {
  6573. var $1;
  6574. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6575. $ctx1.sendIdx["+"]=1;
  6576. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6577. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6578. },
  6579. args: ["delta"],
  6580. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6581. referencedClasses: [],
  6582. messageSends: ["@", "+", "x", "y"]
  6583. }),
  6584. $globals.Point);
  6585. $core.addMethod(
  6586. $core.method({
  6587. selector: "x",
  6588. protocol: "accessing",
  6589. fn: function (){
  6590. var self=this,$self=this;
  6591. return $self["@x"];
  6592. },
  6593. args: [],
  6594. source: "x\x0a\x09^ x",
  6595. referencedClasses: [],
  6596. messageSends: []
  6597. }),
  6598. $globals.Point);
  6599. $core.addMethod(
  6600. $core.method({
  6601. selector: "x:",
  6602. protocol: "accessing",
  6603. fn: function (aNumber){
  6604. var self=this,$self=this;
  6605. $self["@x"]=aNumber;
  6606. return self;
  6607. },
  6608. args: ["aNumber"],
  6609. source: "x: aNumber\x0a\x09x := aNumber",
  6610. referencedClasses: [],
  6611. messageSends: []
  6612. }),
  6613. $globals.Point);
  6614. $core.addMethod(
  6615. $core.method({
  6616. selector: "y",
  6617. protocol: "accessing",
  6618. fn: function (){
  6619. var self=this,$self=this;
  6620. return $self["@y"];
  6621. },
  6622. args: [],
  6623. source: "y\x0a\x09^ y",
  6624. referencedClasses: [],
  6625. messageSends: []
  6626. }),
  6627. $globals.Point);
  6628. $core.addMethod(
  6629. $core.method({
  6630. selector: "y:",
  6631. protocol: "accessing",
  6632. fn: function (aNumber){
  6633. var self=this,$self=this;
  6634. $self["@y"]=aNumber;
  6635. return self;
  6636. },
  6637. args: ["aNumber"],
  6638. source: "y: aNumber\x0a\x09y := aNumber",
  6639. referencedClasses: [],
  6640. messageSends: []
  6641. }),
  6642. $globals.Point);
  6643. $core.addMethod(
  6644. $core.method({
  6645. selector: "classTag",
  6646. protocol: "accessing",
  6647. fn: function (){
  6648. var self=this,$self=this;
  6649. return "magnitude";
  6650. },
  6651. args: [],
  6652. 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'",
  6653. referencedClasses: [],
  6654. messageSends: []
  6655. }),
  6656. $globals.Point.a$cls);
  6657. $core.addMethod(
  6658. $core.method({
  6659. selector: "x:y:",
  6660. protocol: "instance creation",
  6661. fn: function (aNumber,anotherNumber){
  6662. var self=this,$self=this;
  6663. return $core.withContext(function($ctx1) {
  6664. var $1;
  6665. $1=$self._new();
  6666. $recv($1)._x_(aNumber);
  6667. $recv($1)._y_(anotherNumber);
  6668. return $recv($1)._yourself();
  6669. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6670. },
  6671. args: ["aNumber", "anotherNumber"],
  6672. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6673. referencedClasses: [],
  6674. messageSends: ["x:", "new", "y:", "yourself"]
  6675. }),
  6676. $globals.Point.a$cls);
  6677. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6678. $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'`.";
  6679. $core.addMethod(
  6680. $core.method({
  6681. selector: "next",
  6682. protocol: "accessing",
  6683. fn: function (){
  6684. var self=this,$self=this;
  6685. return $core.withContext(function($ctx1) {
  6686. return Math.random();
  6687. return self;
  6688. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6689. },
  6690. args: [],
  6691. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6692. referencedClasses: [],
  6693. messageSends: []
  6694. }),
  6695. $globals.Random);
  6696. $core.addMethod(
  6697. $core.method({
  6698. selector: "next:",
  6699. protocol: "accessing",
  6700. fn: function (anInteger){
  6701. var self=this,$self=this;
  6702. return $core.withContext(function($ctx1) {
  6703. return $recv((1)._to_(anInteger))._collect_((function(each){
  6704. return $core.withContext(function($ctx2) {
  6705. return $self._next();
  6706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6707. }));
  6708. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6709. },
  6710. args: ["anInteger"],
  6711. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6712. referencedClasses: [],
  6713. messageSends: ["collect:", "to:", "next"]
  6714. }),
  6715. $globals.Random);
  6716. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6717. $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.";
  6718. $core.addMethod(
  6719. $core.method({
  6720. selector: "=",
  6721. protocol: "testing",
  6722. fn: function (aRectangle){
  6723. var self=this,$self=this;
  6724. return $core.withContext(function($ctx1) {
  6725. var $1;
  6726. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6727. $ctx1.sendIdx["="]=1;
  6728. return $recv($1)._and_((function(){
  6729. return $core.withContext(function($ctx2) {
  6730. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6732. }));
  6733. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6734. },
  6735. args: ["aRectangle"],
  6736. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6737. referencedClasses: [],
  6738. messageSends: ["and:", "=", "origin", "corner"]
  6739. }),
  6740. $globals.Rectangle);
  6741. $core.addMethod(
  6742. $core.method({
  6743. selector: "containsPoint:",
  6744. protocol: "testing",
  6745. fn: function (aPoint){
  6746. var self=this,$self=this;
  6747. return $core.withContext(function($ctx1) {
  6748. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6749. return $core.withContext(function($ctx2) {
  6750. return $recv($self["@corner"]).__gt_eq(aPoint);
  6751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6752. }));
  6753. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6754. },
  6755. args: ["aPoint"],
  6756. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6757. referencedClasses: [],
  6758. messageSends: ["and:", "<=", ">="]
  6759. }),
  6760. $globals.Rectangle);
  6761. $core.addMethod(
  6762. $core.method({
  6763. selector: "containsRect:",
  6764. protocol: "testing",
  6765. fn: function (aRect){
  6766. var self=this,$self=this;
  6767. return $core.withContext(function($ctx1) {
  6768. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6769. return $core.withContext(function($ctx2) {
  6770. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6772. }));
  6773. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6774. },
  6775. args: ["aRect"],
  6776. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6777. referencedClasses: [],
  6778. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6779. }),
  6780. $globals.Rectangle);
  6781. $core.addMethod(
  6782. $core.method({
  6783. selector: "corner",
  6784. protocol: "accessing",
  6785. fn: function (){
  6786. var self=this,$self=this;
  6787. return $self["@corner"];
  6788. },
  6789. args: [],
  6790. source: "corner\x0a\x09^ corner",
  6791. referencedClasses: [],
  6792. messageSends: []
  6793. }),
  6794. $globals.Rectangle);
  6795. $core.addMethod(
  6796. $core.method({
  6797. selector: "origin",
  6798. protocol: "accessing",
  6799. fn: function (){
  6800. var self=this,$self=this;
  6801. return $self["@origin"];
  6802. },
  6803. args: [],
  6804. source: "origin\x0a\x09^ origin",
  6805. referencedClasses: [],
  6806. messageSends: []
  6807. }),
  6808. $globals.Rectangle);
  6809. $core.addMethod(
  6810. $core.method({
  6811. selector: "printOn:",
  6812. protocol: "testing",
  6813. fn: function (aStream){
  6814. var self=this,$self=this;
  6815. return $core.withContext(function($ctx1) {
  6816. $recv($self["@origin"])._printOn_(aStream);
  6817. $ctx1.sendIdx["printOn:"]=1;
  6818. $recv(aStream)._nextPutAll_(" corner: ");
  6819. $recv($self["@corner"])._printOn_(aStream);
  6820. return self;
  6821. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6822. },
  6823. args: ["aStream"],
  6824. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6825. referencedClasses: [],
  6826. messageSends: ["printOn:", "nextPutAll:"]
  6827. }),
  6828. $globals.Rectangle);
  6829. $core.addMethod(
  6830. $core.method({
  6831. selector: "setPoint:point:",
  6832. protocol: "private",
  6833. fn: function (pt1,pt2){
  6834. var self=this,$self=this;
  6835. return $core.withContext(function($ctx1) {
  6836. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6837. $2=$recv(pt1)._x();
  6838. $ctx1.sendIdx["x"]=1;
  6839. $3=$recv(pt2)._x();
  6840. $ctx1.sendIdx["x"]=2;
  6841. $1=$recv($2)._min_($3);
  6842. $ctx1.sendIdx["min:"]=1;
  6843. $5=$recv(pt1)._y();
  6844. $ctx1.sendIdx["y"]=1;
  6845. $6=$recv(pt2)._y();
  6846. $ctx1.sendIdx["y"]=2;
  6847. $4=$recv($5)._min_($6);
  6848. $self["@origin"]=$recv($1).__at($4);
  6849. $ctx1.sendIdx["@"]=1;
  6850. $8=$recv(pt1)._x();
  6851. $ctx1.sendIdx["x"]=3;
  6852. $7=$recv($8)._max_($recv(pt2)._x());
  6853. $ctx1.sendIdx["max:"]=1;
  6854. $10=$recv(pt1)._y();
  6855. $ctx1.sendIdx["y"]=3;
  6856. $9=$recv($10)._max_($recv(pt2)._y());
  6857. $self["@corner"]=$recv($7).__at($9);
  6858. return self;
  6859. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6860. },
  6861. args: ["pt1", "pt2"],
  6862. 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).",
  6863. referencedClasses: [],
  6864. messageSends: ["@", "min:", "x", "y", "max:"]
  6865. }),
  6866. $globals.Rectangle);
  6867. $core.addMethod(
  6868. $core.method({
  6869. selector: "origin:corner:",
  6870. protocol: "instance creation",
  6871. fn: function (anOrigin,aCorner){
  6872. var self=this,$self=this;
  6873. return $core.withContext(function($ctx1) {
  6874. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6875. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6876. },
  6877. args: ["anOrigin", "aCorner"],
  6878. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6879. referencedClasses: [],
  6880. messageSends: ["setPoint:point:", "basicNew"]
  6881. }),
  6882. $globals.Rectangle.a$cls);
  6883. $core.addMethod(
  6884. $core.method({
  6885. selector: "origin:extent:",
  6886. protocol: "instance creation",
  6887. fn: function (anOrigin,anExtent){
  6888. var self=this,$self=this;
  6889. return $core.withContext(function($ctx1) {
  6890. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  6891. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  6892. },
  6893. args: ["anOrigin", "anExtent"],
  6894. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  6895. referencedClasses: [],
  6896. messageSends: ["setPoint:point:", "basicNew", "+"]
  6897. }),
  6898. $globals.Rectangle.a$cls);
  6899. $core.addMethod(
  6900. $core.method({
  6901. selector: "point:point:",
  6902. protocol: "instance creation",
  6903. fn: function (anOrigin,aCorner){
  6904. var self=this,$self=this;
  6905. return $core.withContext(function($ctx1) {
  6906. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6907. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6908. },
  6909. args: ["anOrigin", "aCorner"],
  6910. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6911. referencedClasses: [],
  6912. messageSends: ["setPoint:point:", "basicNew"]
  6913. }),
  6914. $globals.Rectangle.a$cls);
  6915. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  6916. $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`.";
  6917. $core.addMethod(
  6918. $core.method({
  6919. selector: "==",
  6920. protocol: "testing",
  6921. fn: function (anObject){
  6922. var self=this,$self=this;
  6923. return $core.withContext(function($ctx1) {
  6924. return $recv(anObject)._isNil();
  6925. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  6926. },
  6927. args: ["anObject"],
  6928. source: "== anObject\x0a\x09^ anObject isNil",
  6929. referencedClasses: [],
  6930. messageSends: ["isNil"]
  6931. }),
  6932. $globals.UndefinedObject);
  6933. $core.addMethod(
  6934. $core.method({
  6935. selector: "asJavaScriptObject",
  6936. protocol: "converting",
  6937. fn: function (){
  6938. var self=this,$self=this;
  6939. return null;
  6940. },
  6941. args: [],
  6942. source: "asJavaScriptObject\x0a\x09^ null",
  6943. referencedClasses: [],
  6944. messageSends: []
  6945. }),
  6946. $globals.UndefinedObject);
  6947. $core.addMethod(
  6948. $core.method({
  6949. selector: "deepCopy",
  6950. protocol: "copying",
  6951. fn: function (){
  6952. var self=this,$self=this;
  6953. return self;
  6954. },
  6955. args: [],
  6956. source: "deepCopy\x0a\x09^ self",
  6957. referencedClasses: [],
  6958. messageSends: []
  6959. }),
  6960. $globals.UndefinedObject);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "identityHash",
  6964. protocol: "accessing",
  6965. fn: function (){
  6966. var self=this,$self=this;
  6967. return "NIL";
  6968. },
  6969. args: [],
  6970. source: "identityHash\x0a\x09^ 'NIL'",
  6971. referencedClasses: [],
  6972. messageSends: []
  6973. }),
  6974. $globals.UndefinedObject);
  6975. $core.addMethod(
  6976. $core.method({
  6977. selector: "ifNil:",
  6978. protocol: "testing",
  6979. fn: function (aBlock){
  6980. var self=this,$self=this;
  6981. return $core.withContext(function($ctx1) {
  6982. return $self._ifNil_ifNotNil_(aBlock,(function(){
  6983. }));
  6984. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  6985. },
  6986. args: ["aBlock"],
  6987. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  6988. referencedClasses: [],
  6989. messageSends: ["ifNil:ifNotNil:"]
  6990. }),
  6991. $globals.UndefinedObject);
  6992. $core.addMethod(
  6993. $core.method({
  6994. selector: "ifNil:ifNotNil:",
  6995. protocol: "testing",
  6996. fn: function (aBlock,anotherBlock){
  6997. var self=this,$self=this;
  6998. return $core.withContext(function($ctx1) {
  6999. return $recv(aBlock)._value();
  7000. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7001. },
  7002. args: ["aBlock", "anotherBlock"],
  7003. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7004. referencedClasses: [],
  7005. messageSends: ["value"]
  7006. }),
  7007. $globals.UndefinedObject);
  7008. $core.addMethod(
  7009. $core.method({
  7010. selector: "ifNotNil:",
  7011. protocol: "testing",
  7012. fn: function (aBlock){
  7013. var self=this,$self=this;
  7014. return self;
  7015. },
  7016. args: ["aBlock"],
  7017. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7018. referencedClasses: [],
  7019. messageSends: []
  7020. }),
  7021. $globals.UndefinedObject);
  7022. $core.addMethod(
  7023. $core.method({
  7024. selector: "ifNotNil:ifNil:",
  7025. protocol: "testing",
  7026. fn: function (aBlock,anotherBlock){
  7027. var self=this,$self=this;
  7028. return $core.withContext(function($ctx1) {
  7029. return $recv(anotherBlock)._value();
  7030. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7031. },
  7032. args: ["aBlock", "anotherBlock"],
  7033. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7034. referencedClasses: [],
  7035. messageSends: ["value"]
  7036. }),
  7037. $globals.UndefinedObject);
  7038. $core.addMethod(
  7039. $core.method({
  7040. selector: "isImmutable",
  7041. protocol: "testing",
  7042. fn: function (){
  7043. var self=this,$self=this;
  7044. return true;
  7045. },
  7046. args: [],
  7047. source: "isImmutable\x0a\x09^ true",
  7048. referencedClasses: [],
  7049. messageSends: []
  7050. }),
  7051. $globals.UndefinedObject);
  7052. $core.addMethod(
  7053. $core.method({
  7054. selector: "isNil",
  7055. protocol: "testing",
  7056. fn: function (){
  7057. var self=this,$self=this;
  7058. return true;
  7059. },
  7060. args: [],
  7061. source: "isNil\x0a\x09^ true",
  7062. referencedClasses: [],
  7063. messageSends: []
  7064. }),
  7065. $globals.UndefinedObject);
  7066. $core.addMethod(
  7067. $core.method({
  7068. selector: "notNil",
  7069. protocol: "testing",
  7070. fn: function (){
  7071. var self=this,$self=this;
  7072. return false;
  7073. },
  7074. args: [],
  7075. source: "notNil\x0a\x09^ false",
  7076. referencedClasses: [],
  7077. messageSends: []
  7078. }),
  7079. $globals.UndefinedObject);
  7080. $core.addMethod(
  7081. $core.method({
  7082. selector: "printOn:",
  7083. protocol: "printing",
  7084. fn: function (aStream){
  7085. var self=this,$self=this;
  7086. return $core.withContext(function($ctx1) {
  7087. $recv(aStream)._nextPutAll_("nil");
  7088. return self;
  7089. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7090. },
  7091. args: ["aStream"],
  7092. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7093. referencedClasses: [],
  7094. messageSends: ["nextPutAll:"]
  7095. }),
  7096. $globals.UndefinedObject);
  7097. $core.addMethod(
  7098. $core.method({
  7099. selector: "shallowCopy",
  7100. protocol: "copying",
  7101. fn: function (){
  7102. var self=this,$self=this;
  7103. return self;
  7104. },
  7105. args: [],
  7106. source: "shallowCopy\x0a\x09^ self",
  7107. referencedClasses: [],
  7108. messageSends: []
  7109. }),
  7110. $globals.UndefinedObject);
  7111. $core.addMethod(
  7112. $core.method({
  7113. selector: "value",
  7114. protocol: "evaluating",
  7115. fn: function (){
  7116. var self=this,$self=this;
  7117. return $core.withContext(function($ctx1) {
  7118. return null;
  7119. return self;
  7120. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7121. },
  7122. args: [],
  7123. source: "value\x0a\x09<inlineJS: 'return null'>",
  7124. referencedClasses: [],
  7125. messageSends: []
  7126. }),
  7127. $globals.UndefinedObject);
  7128. $core.addMethod(
  7129. $core.method({
  7130. selector: "new",
  7131. protocol: "instance creation",
  7132. fn: function (){
  7133. var self=this,$self=this;
  7134. return $core.withContext(function($ctx1) {
  7135. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7136. return self;
  7137. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7138. },
  7139. args: [],
  7140. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7141. referencedClasses: [],
  7142. messageSends: ["error:"]
  7143. }),
  7144. $globals.UndefinedObject.a$cls);
  7145. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7146. });
  7147. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7148. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7149. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7150. $core.addPackage("Kernel-Collections");
  7151. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7152. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7153. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7154. $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:`";
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "=",
  7158. protocol: "comparing",
  7159. fn: function (anAssociation){
  7160. var self=this,$self=this;
  7161. return $core.withContext(function($ctx1) {
  7162. var $3,$2,$5,$4,$6,$1;
  7163. $3=$self._class();
  7164. $ctx1.sendIdx["class"]=1;
  7165. $2=$recv($3).__eq($recv(anAssociation)._class());
  7166. $ctx1.sendIdx["="]=1;
  7167. $1=$recv($2)._and_((function(){
  7168. return $core.withContext(function($ctx2) {
  7169. $5=$self._key();
  7170. $ctx2.sendIdx["key"]=1;
  7171. $4=$recv($5).__eq($recv(anAssociation)._key());
  7172. $ctx2.sendIdx["="]=2;
  7173. return $recv($4)._and_((function(){
  7174. return $core.withContext(function($ctx3) {
  7175. $6=$self._value();
  7176. $ctx3.sendIdx["value"]=1;
  7177. return $recv($6).__eq($recv(anAssociation)._value());
  7178. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7179. }));
  7180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7181. }));
  7182. $ctx1.sendIdx["and:"]=1;
  7183. return $1;
  7184. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7185. },
  7186. args: ["anAssociation"],
  7187. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7188. referencedClasses: [],
  7189. messageSends: ["and:", "=", "class", "key", "value"]
  7190. }),
  7191. $globals.Association);
  7192. $core.addMethod(
  7193. $core.method({
  7194. selector: "key",
  7195. protocol: "accessing",
  7196. fn: function (){
  7197. var self=this,$self=this;
  7198. return $self["@key"];
  7199. },
  7200. args: [],
  7201. source: "key\x0a\x09^ key",
  7202. referencedClasses: [],
  7203. messageSends: []
  7204. }),
  7205. $globals.Association);
  7206. $core.addMethod(
  7207. $core.method({
  7208. selector: "key:",
  7209. protocol: "accessing",
  7210. fn: function (aKey){
  7211. var self=this,$self=this;
  7212. $self["@key"]=aKey;
  7213. return self;
  7214. },
  7215. args: ["aKey"],
  7216. source: "key: aKey\x0a\x09key := aKey",
  7217. referencedClasses: [],
  7218. messageSends: []
  7219. }),
  7220. $globals.Association);
  7221. $core.addMethod(
  7222. $core.method({
  7223. selector: "printOn:",
  7224. protocol: "printing",
  7225. fn: function (aStream){
  7226. var self=this,$self=this;
  7227. return $core.withContext(function($ctx1) {
  7228. $recv($self._key())._printOn_(aStream);
  7229. $ctx1.sendIdx["printOn:"]=1;
  7230. $recv(aStream)._nextPutAll_(" -> ");
  7231. $recv($self._value())._printOn_(aStream);
  7232. return self;
  7233. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7234. },
  7235. args: ["aStream"],
  7236. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7237. referencedClasses: [],
  7238. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7239. }),
  7240. $globals.Association);
  7241. $core.addMethod(
  7242. $core.method({
  7243. selector: "value",
  7244. protocol: "accessing",
  7245. fn: function (){
  7246. var self=this,$self=this;
  7247. return $self["@value"];
  7248. },
  7249. args: [],
  7250. source: "value\x0a\x09^ value",
  7251. referencedClasses: [],
  7252. messageSends: []
  7253. }),
  7254. $globals.Association);
  7255. $core.addMethod(
  7256. $core.method({
  7257. selector: "value:",
  7258. protocol: "accessing",
  7259. fn: function (aValue){
  7260. var self=this,$self=this;
  7261. $self["@value"]=aValue;
  7262. return self;
  7263. },
  7264. args: ["aValue"],
  7265. source: "value: aValue\x0a\x09value := aValue",
  7266. referencedClasses: [],
  7267. messageSends: []
  7268. }),
  7269. $globals.Association);
  7270. $core.addMethod(
  7271. $core.method({
  7272. selector: "key:value:",
  7273. protocol: "instance creation",
  7274. fn: function (aKey,aValue){
  7275. var self=this,$self=this;
  7276. return $core.withContext(function($ctx1) {
  7277. var $1;
  7278. $1=$self._new();
  7279. $recv($1)._key_(aKey);
  7280. $recv($1)._value_(aValue);
  7281. return $recv($1)._yourself();
  7282. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7283. },
  7284. args: ["aKey", "aValue"],
  7285. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7286. referencedClasses: [],
  7287. messageSends: ["key:", "new", "value:", "yourself"]
  7288. }),
  7289. $globals.Association.a$cls);
  7290. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7291. $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`.";
  7292. $core.addMethod(
  7293. $core.method({
  7294. selector: "bucketOfElement:",
  7295. protocol: "accessing",
  7296. fn: function (anObject){
  7297. var self=this,$self=this;
  7298. return $core.withContext(function($ctx1) {
  7299. var hash = $self['@hashBlock'](anObject);
  7300. if (!hash) return null;
  7301. var buckets = $self['@buckets'],
  7302. bucket = buckets[hash];
  7303. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7304. return bucket;
  7305. ;
  7306. return self;
  7307. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7308. },
  7309. args: ["anObject"],
  7310. 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'>",
  7311. referencedClasses: [],
  7312. messageSends: []
  7313. }),
  7314. $globals.BucketStore);
  7315. $core.addMethod(
  7316. $core.method({
  7317. selector: "do:",
  7318. protocol: "enumerating",
  7319. fn: function (aBlock){
  7320. var self=this,$self=this;
  7321. return $core.withContext(function($ctx1) {
  7322. var buckets = $self['@buckets'];
  7323. var keys = Object.keys(buckets);
  7324. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7325. ;
  7326. return self;
  7327. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7328. },
  7329. args: ["aBlock"],
  7330. 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'>",
  7331. referencedClasses: [],
  7332. messageSends: []
  7333. }),
  7334. $globals.BucketStore);
  7335. $core.addMethod(
  7336. $core.method({
  7337. selector: "hashBlock:",
  7338. protocol: "accessing",
  7339. fn: function (aBlock){
  7340. var self=this,$self=this;
  7341. $self["@hashBlock"]=aBlock;
  7342. return self;
  7343. },
  7344. args: ["aBlock"],
  7345. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7346. referencedClasses: [],
  7347. messageSends: []
  7348. }),
  7349. $globals.BucketStore);
  7350. $core.addMethod(
  7351. $core.method({
  7352. selector: "initialize",
  7353. protocol: "initialization",
  7354. fn: function (){
  7355. var self=this,$self=this;
  7356. return $core.withContext(function($ctx1) {
  7357. (
  7358. $ctx1.supercall = true,
  7359. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7360. $ctx1.supercall = false;
  7361. $self._removeAll();
  7362. return self;
  7363. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7364. },
  7365. args: [],
  7366. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7367. referencedClasses: [],
  7368. messageSends: ["initialize", "removeAll"]
  7369. }),
  7370. $globals.BucketStore);
  7371. $core.addMethod(
  7372. $core.method({
  7373. selector: "newBucket",
  7374. protocol: "private",
  7375. fn: function (){
  7376. var self=this,$self=this;
  7377. return $core.withContext(function($ctx1) {
  7378. $self._subclassResponsibility();
  7379. return self;
  7380. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7381. },
  7382. args: [],
  7383. source: "newBucket\x0a\x09self subclassResponsibility",
  7384. referencedClasses: [],
  7385. messageSends: ["subclassResponsibility"]
  7386. }),
  7387. $globals.BucketStore);
  7388. $core.addMethod(
  7389. $core.method({
  7390. selector: "removeAll",
  7391. protocol: "adding/removing",
  7392. fn: function (){
  7393. var self=this,$self=this;
  7394. return $core.withContext(function($ctx1) {
  7395. $self['@buckets'] = Object.create(null);;
  7396. return self;
  7397. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7398. },
  7399. args: [],
  7400. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7401. referencedClasses: [],
  7402. messageSends: []
  7403. }),
  7404. $globals.BucketStore);
  7405. $core.addMethod(
  7406. $core.method({
  7407. selector: "hashBlock:",
  7408. protocol: "instance creation",
  7409. fn: function (aBlock){
  7410. var self=this,$self=this;
  7411. return $core.withContext(function($ctx1) {
  7412. var $1;
  7413. $1=$self._new();
  7414. $recv($1)._hashBlock_(aBlock);
  7415. return $recv($1)._yourself();
  7416. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7417. },
  7418. args: ["aBlock"],
  7419. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7420. referencedClasses: [],
  7421. messageSends: ["hashBlock:", "new", "yourself"]
  7422. }),
  7423. $globals.BucketStore.a$cls);
  7424. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7425. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7426. $core.addMethod(
  7427. $core.method({
  7428. selector: "newBucket",
  7429. protocol: "private",
  7430. fn: function (){
  7431. var self=this,$self=this;
  7432. return [];
  7433. },
  7434. args: [],
  7435. source: "newBucket\x0a\x09^ #()",
  7436. referencedClasses: [],
  7437. messageSends: []
  7438. }),
  7439. $globals.ArrayBucketStore);
  7440. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7441. $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.";
  7442. $core.addMethod(
  7443. $core.method({
  7444. selector: ",",
  7445. protocol: "copying",
  7446. fn: function (aCollection){
  7447. var self=this,$self=this;
  7448. return $core.withContext(function($ctx1) {
  7449. var $1;
  7450. $1=$self._copy();
  7451. $recv($1)._addAll_(aCollection);
  7452. return $recv($1)._yourself();
  7453. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7454. },
  7455. args: ["aCollection"],
  7456. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7457. referencedClasses: [],
  7458. messageSends: ["addAll:", "copy", "yourself"]
  7459. }),
  7460. $globals.Collection);
  7461. $core.addMethod(
  7462. $core.method({
  7463. selector: "add:",
  7464. protocol: "adding/removing",
  7465. fn: function (anObject){
  7466. var self=this,$self=this;
  7467. return $core.withContext(function($ctx1) {
  7468. $self._subclassResponsibility();
  7469. return self;
  7470. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7471. },
  7472. args: ["anObject"],
  7473. source: "add: anObject\x0a\x09self subclassResponsibility",
  7474. referencedClasses: [],
  7475. messageSends: ["subclassResponsibility"]
  7476. }),
  7477. $globals.Collection);
  7478. $core.addMethod(
  7479. $core.method({
  7480. selector: "addAll:",
  7481. protocol: "adding/removing",
  7482. fn: function (aCollection){
  7483. var self=this,$self=this;
  7484. return $core.withContext(function($ctx1) {
  7485. $recv(aCollection)._do_((function(each){
  7486. return $core.withContext(function($ctx2) {
  7487. return $self._add_(each);
  7488. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7489. }));
  7490. return aCollection;
  7491. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7492. },
  7493. args: ["aCollection"],
  7494. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7495. referencedClasses: [],
  7496. messageSends: ["do:", "add:"]
  7497. }),
  7498. $globals.Collection);
  7499. $core.addMethod(
  7500. $core.method({
  7501. selector: "allSatisfy:",
  7502. protocol: "enumerating",
  7503. fn: function (aBlock){
  7504. var self=this,$self=this;
  7505. return $core.withContext(function($ctx1) {
  7506. var $1;
  7507. var $early={};
  7508. try {
  7509. $self._do_((function(each){
  7510. return $core.withContext(function($ctx2) {
  7511. $1=$recv(aBlock)._value_(each);
  7512. if(!$core.assert($1)){
  7513. throw $early=[false];
  7514. }
  7515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7516. }));
  7517. return true;
  7518. }
  7519. catch(e) {if(e===$early)return e[0]; throw e}
  7520. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7521. },
  7522. args: ["aBlock"],
  7523. 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",
  7524. referencedClasses: [],
  7525. messageSends: ["do:", "ifFalse:", "value:"]
  7526. }),
  7527. $globals.Collection);
  7528. $core.addMethod(
  7529. $core.method({
  7530. selector: "anyOne",
  7531. protocol: "accessing",
  7532. fn: function (){
  7533. var self=this,$self=this;
  7534. return $core.withContext(function($ctx1) {
  7535. var $early={};
  7536. try {
  7537. $self._ifEmpty_((function(){
  7538. return $core.withContext(function($ctx2) {
  7539. return $self._error_("Collection is empty");
  7540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7541. }));
  7542. $self._do_((function(each){
  7543. throw $early=[each];
  7544. }));
  7545. return self;
  7546. }
  7547. catch(e) {if(e===$early)return e[0]; throw e}
  7548. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7549. },
  7550. args: [],
  7551. 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 ]",
  7552. referencedClasses: [],
  7553. messageSends: ["ifEmpty:", "error:", "do:"]
  7554. }),
  7555. $globals.Collection);
  7556. $core.addMethod(
  7557. $core.method({
  7558. selector: "anySatisfy:",
  7559. protocol: "enumerating",
  7560. fn: function (aBlock){
  7561. var self=this,$self=this;
  7562. return $core.withContext(function($ctx1) {
  7563. var $1;
  7564. var $early={};
  7565. try {
  7566. $self._do_((function(each){
  7567. return $core.withContext(function($ctx2) {
  7568. $1=$recv(aBlock)._value_(each);
  7569. if($core.assert($1)){
  7570. throw $early=[true];
  7571. }
  7572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7573. }));
  7574. return false;
  7575. }
  7576. catch(e) {if(e===$early)return e[0]; throw e}
  7577. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7578. },
  7579. args: ["aBlock"],
  7580. 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",
  7581. referencedClasses: [],
  7582. messageSends: ["do:", "ifTrue:", "value:"]
  7583. }),
  7584. $globals.Collection);
  7585. $core.addMethod(
  7586. $core.method({
  7587. selector: "asArray",
  7588. protocol: "converting",
  7589. fn: function (){
  7590. var self=this,$self=this;
  7591. return $core.withContext(function($ctx1) {
  7592. return $recv($globals.Array)._withAll_(self);
  7593. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7594. },
  7595. args: [],
  7596. source: "asArray\x0a\x09^ Array withAll: self",
  7597. referencedClasses: ["Array"],
  7598. messageSends: ["withAll:"]
  7599. }),
  7600. $globals.Collection);
  7601. $core.addMethod(
  7602. $core.method({
  7603. selector: "asJavaScriptObject",
  7604. protocol: "converting",
  7605. fn: function (){
  7606. var self=this,$self=this;
  7607. return $core.withContext(function($ctx1) {
  7608. return $recv($self._asArray())._collect_((function(each){
  7609. return $core.withContext(function($ctx2) {
  7610. return $recv(each)._asJavaScriptObject();
  7611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7612. }));
  7613. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7614. },
  7615. args: [],
  7616. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7617. referencedClasses: [],
  7618. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7619. }),
  7620. $globals.Collection);
  7621. $core.addMethod(
  7622. $core.method({
  7623. selector: "asOrderedCollection",
  7624. protocol: "converting",
  7625. fn: function (){
  7626. var self=this,$self=this;
  7627. return $core.withContext(function($ctx1) {
  7628. return $self._asArray();
  7629. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7630. },
  7631. args: [],
  7632. source: "asOrderedCollection\x0a\x09^ self asArray",
  7633. referencedClasses: [],
  7634. messageSends: ["asArray"]
  7635. }),
  7636. $globals.Collection);
  7637. $core.addMethod(
  7638. $core.method({
  7639. selector: "asSet",
  7640. protocol: "converting",
  7641. fn: function (){
  7642. var self=this,$self=this;
  7643. return $core.withContext(function($ctx1) {
  7644. return $recv($globals.Set)._withAll_(self);
  7645. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7646. },
  7647. args: [],
  7648. source: "asSet\x0a\x09^ Set withAll: self",
  7649. referencedClasses: ["Set"],
  7650. messageSends: ["withAll:"]
  7651. }),
  7652. $globals.Collection);
  7653. $core.addMethod(
  7654. $core.method({
  7655. selector: "collect:",
  7656. protocol: "enumerating",
  7657. fn: function (aBlock){
  7658. var self=this,$self=this;
  7659. var stream;
  7660. return $core.withContext(function($ctx1) {
  7661. stream=$recv($recv($self._class())._new())._writeStream();
  7662. $self._do_((function(each){
  7663. return $core.withContext(function($ctx2) {
  7664. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7666. }));
  7667. return $recv(stream)._contents();
  7668. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7669. },
  7670. args: ["aBlock"],
  7671. 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",
  7672. referencedClasses: [],
  7673. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7674. }),
  7675. $globals.Collection);
  7676. $core.addMethod(
  7677. $core.method({
  7678. selector: "copyWith:",
  7679. protocol: "copying",
  7680. fn: function (anObject){
  7681. var self=this,$self=this;
  7682. return $core.withContext(function($ctx1) {
  7683. var $1;
  7684. $1=$self._copy();
  7685. $recv($1)._add_(anObject);
  7686. return $recv($1)._yourself();
  7687. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7688. },
  7689. args: ["anObject"],
  7690. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7691. referencedClasses: [],
  7692. messageSends: ["add:", "copy", "yourself"]
  7693. }),
  7694. $globals.Collection);
  7695. $core.addMethod(
  7696. $core.method({
  7697. selector: "copyWithAll:",
  7698. protocol: "copying",
  7699. fn: function (aCollection){
  7700. var self=this,$self=this;
  7701. return $core.withContext(function($ctx1) {
  7702. var $1;
  7703. $1=$self._copy();
  7704. $recv($1)._addAll_(aCollection);
  7705. return $recv($1)._yourself();
  7706. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7707. },
  7708. args: ["aCollection"],
  7709. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  7710. referencedClasses: [],
  7711. messageSends: ["addAll:", "copy", "yourself"]
  7712. }),
  7713. $globals.Collection);
  7714. $core.addMethod(
  7715. $core.method({
  7716. selector: "copyWithout:",
  7717. protocol: "copying",
  7718. fn: function (anObject){
  7719. var self=this,$self=this;
  7720. return $core.withContext(function($ctx1) {
  7721. return $self._reject_((function(each){
  7722. return $core.withContext(function($ctx2) {
  7723. return $recv(each).__eq(anObject);
  7724. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7725. }));
  7726. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7727. },
  7728. args: ["anObject"],
  7729. 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 ]",
  7730. referencedClasses: [],
  7731. messageSends: ["reject:", "="]
  7732. }),
  7733. $globals.Collection);
  7734. $core.addMethod(
  7735. $core.method({
  7736. selector: "copyWithoutAll:",
  7737. protocol: "copying",
  7738. fn: function (aCollection){
  7739. var self=this,$self=this;
  7740. return $core.withContext(function($ctx1) {
  7741. return $self._reject_((function(each){
  7742. return $core.withContext(function($ctx2) {
  7743. return $recv(aCollection)._includes_(each);
  7744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7745. }));
  7746. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7747. },
  7748. args: ["aCollection"],
  7749. 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 ]",
  7750. referencedClasses: [],
  7751. messageSends: ["reject:", "includes:"]
  7752. }),
  7753. $globals.Collection);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "deepCopy",
  7757. protocol: "copying",
  7758. fn: function (){
  7759. var self=this,$self=this;
  7760. return $core.withContext(function($ctx1) {
  7761. return $self._collect_((function(each){
  7762. return $core.withContext(function($ctx2) {
  7763. return $recv(each)._deepCopy();
  7764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7765. }));
  7766. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7767. },
  7768. args: [],
  7769. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7770. referencedClasses: [],
  7771. messageSends: ["collect:", "deepCopy"]
  7772. }),
  7773. $globals.Collection);
  7774. $core.addMethod(
  7775. $core.method({
  7776. selector: "detect:",
  7777. protocol: "enumerating",
  7778. fn: function (aBlock){
  7779. var self=this,$self=this;
  7780. return $core.withContext(function($ctx1) {
  7781. return $self._detect_ifNone_(aBlock,(function(){
  7782. return $core.withContext(function($ctx2) {
  7783. return $self._errorNotFound();
  7784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7785. }));
  7786. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7787. },
  7788. args: ["aBlock"],
  7789. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7790. referencedClasses: [],
  7791. messageSends: ["detect:ifNone:", "errorNotFound"]
  7792. }),
  7793. $globals.Collection);
  7794. $core.addMethod(
  7795. $core.method({
  7796. selector: "detect:ifNone:",
  7797. protocol: "enumerating",
  7798. fn: function (aBlock,anotherBlock){
  7799. var self=this,$self=this;
  7800. return $core.withContext(function($ctx1) {
  7801. $self._subclassResponsibility();
  7802. return self;
  7803. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7804. },
  7805. args: ["aBlock", "anotherBlock"],
  7806. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  7807. referencedClasses: [],
  7808. messageSends: ["subclassResponsibility"]
  7809. }),
  7810. $globals.Collection);
  7811. $core.addMethod(
  7812. $core.method({
  7813. selector: "do:",
  7814. protocol: "enumerating",
  7815. fn: function (aBlock){
  7816. var self=this,$self=this;
  7817. return $core.withContext(function($ctx1) {
  7818. $self._subclassResponsibility();
  7819. return self;
  7820. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7821. },
  7822. args: ["aBlock"],
  7823. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7824. referencedClasses: [],
  7825. messageSends: ["subclassResponsibility"]
  7826. }),
  7827. $globals.Collection);
  7828. $core.addMethod(
  7829. $core.method({
  7830. selector: "do:separatedBy:",
  7831. protocol: "enumerating",
  7832. fn: function (aBlock,anotherBlock){
  7833. var self=this,$self=this;
  7834. var actionBeforeElement;
  7835. return $core.withContext(function($ctx1) {
  7836. actionBeforeElement=(function(){
  7837. actionBeforeElement=anotherBlock;
  7838. return actionBeforeElement;
  7839. });
  7840. $self._do_((function(each){
  7841. return $core.withContext(function($ctx2) {
  7842. $recv(actionBeforeElement)._value();
  7843. return $recv(aBlock)._value_(each);
  7844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7845. }));
  7846. return self;
  7847. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7848. },
  7849. args: ["aBlock", "anotherBlock"],
  7850. 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 ]",
  7851. referencedClasses: [],
  7852. messageSends: ["do:", "value", "value:"]
  7853. }),
  7854. $globals.Collection);
  7855. $core.addMethod(
  7856. $core.method({
  7857. selector: "errorNotFound",
  7858. protocol: "error handling",
  7859. fn: function (){
  7860. var self=this,$self=this;
  7861. return $core.withContext(function($ctx1) {
  7862. $self._error_("Object is not in the collection");
  7863. return self;
  7864. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7865. },
  7866. args: [],
  7867. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7868. referencedClasses: [],
  7869. messageSends: ["error:"]
  7870. }),
  7871. $globals.Collection);
  7872. $core.addMethod(
  7873. $core.method({
  7874. selector: "ifEmpty:",
  7875. protocol: "testing",
  7876. fn: function (aBlock){
  7877. var self=this,$self=this;
  7878. return $core.withContext(function($ctx1) {
  7879. var $1;
  7880. $1=$self._isEmpty();
  7881. if($core.assert($1)){
  7882. return $recv(aBlock)._value();
  7883. } else {
  7884. return self;
  7885. }
  7886. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7887. },
  7888. args: ["aBlock"],
  7889. 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 ]",
  7890. referencedClasses: [],
  7891. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7892. }),
  7893. $globals.Collection);
  7894. $core.addMethod(
  7895. $core.method({
  7896. selector: "ifEmpty:ifNotEmpty:",
  7897. protocol: "testing",
  7898. fn: function (aBlock,anotherBlock){
  7899. var self=this,$self=this;
  7900. return $core.withContext(function($ctx1) {
  7901. var $1;
  7902. $1=$self._isEmpty();
  7903. if($core.assert($1)){
  7904. return $recv(aBlock)._value();
  7905. } else {
  7906. return $recv(anotherBlock)._value_(self);
  7907. }
  7908. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7909. },
  7910. args: ["aBlock", "anotherBlock"],
  7911. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  7912. referencedClasses: [],
  7913. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  7914. }),
  7915. $globals.Collection);
  7916. $core.addMethod(
  7917. $core.method({
  7918. selector: "ifNotEmpty:",
  7919. protocol: "testing",
  7920. fn: function (aBlock){
  7921. var self=this,$self=this;
  7922. return $core.withContext(function($ctx1) {
  7923. var $1;
  7924. $1=$self._notEmpty();
  7925. if($core.assert($1)){
  7926. return $recv(aBlock)._value_(self);
  7927. } else {
  7928. return self;
  7929. }
  7930. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  7931. },
  7932. args: ["aBlock"],
  7933. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  7934. referencedClasses: [],
  7935. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  7936. }),
  7937. $globals.Collection);
  7938. $core.addMethod(
  7939. $core.method({
  7940. selector: "ifNotEmpty:ifEmpty:",
  7941. protocol: "testing",
  7942. fn: function (aBlock,anotherBlock){
  7943. var self=this,$self=this;
  7944. return $core.withContext(function($ctx1) {
  7945. var $1;
  7946. $1=$self._notEmpty();
  7947. if($core.assert($1)){
  7948. return $recv(aBlock)._value_(self);
  7949. } else {
  7950. return $recv(anotherBlock)._value();
  7951. }
  7952. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7953. },
  7954. args: ["aBlock", "anotherBlock"],
  7955. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  7956. referencedClasses: [],
  7957. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  7958. }),
  7959. $globals.Collection);
  7960. $core.addMethod(
  7961. $core.method({
  7962. selector: "includes:",
  7963. protocol: "testing",
  7964. fn: function (anObject){
  7965. var self=this,$self=this;
  7966. return $core.withContext(function($ctx1) {
  7967. return $self._anySatisfy_((function(each){
  7968. return $core.withContext(function($ctx2) {
  7969. return $recv(each).__eq(anObject);
  7970. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7971. }));
  7972. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  7973. },
  7974. args: ["anObject"],
  7975. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  7976. referencedClasses: [],
  7977. messageSends: ["anySatisfy:", "="]
  7978. }),
  7979. $globals.Collection);
  7980. $core.addMethod(
  7981. $core.method({
  7982. selector: "inject:into:",
  7983. protocol: "enumerating",
  7984. fn: function (anObject,aBlock){
  7985. var self=this,$self=this;
  7986. var result;
  7987. return $core.withContext(function($ctx1) {
  7988. result=anObject;
  7989. $self._do_((function(each){
  7990. return $core.withContext(function($ctx2) {
  7991. result=$recv(aBlock)._value_value_(result,each);
  7992. return result;
  7993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7994. }));
  7995. return result;
  7996. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  7997. },
  7998. args: ["anObject", "aBlock"],
  7999. 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",
  8000. referencedClasses: [],
  8001. messageSends: ["do:", "value:value:"]
  8002. }),
  8003. $globals.Collection);
  8004. $core.addMethod(
  8005. $core.method({
  8006. selector: "intersection:",
  8007. protocol: "enumerating",
  8008. fn: function (aCollection){
  8009. var self=this,$self=this;
  8010. var set,outputSet;
  8011. return $core.withContext(function($ctx1) {
  8012. var $2,$1;
  8013. set=$self._asSet();
  8014. outputSet=$recv($globals.Set)._new();
  8015. $recv(aCollection)._do_((function(each){
  8016. return $core.withContext(function($ctx2) {
  8017. $2=$recv(set)._includes_(each);
  8018. $ctx2.sendIdx["includes:"]=1;
  8019. $1=$recv($2)._and_((function(){
  8020. return $core.withContext(function($ctx3) {
  8021. return $recv($recv(outputSet)._includes_(each))._not();
  8022. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8023. }));
  8024. if($core.assert($1)){
  8025. return $recv(outputSet)._add_(each);
  8026. }
  8027. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8028. }));
  8029. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8030. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8031. },
  8032. args: ["aCollection"],
  8033. 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",
  8034. referencedClasses: ["Set"],
  8035. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8036. }),
  8037. $globals.Collection);
  8038. $core.addMethod(
  8039. $core.method({
  8040. selector: "isEmpty",
  8041. protocol: "testing",
  8042. fn: function (){
  8043. var self=this,$self=this;
  8044. return $core.withContext(function($ctx1) {
  8045. return $recv($self._size()).__eq((0));
  8046. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8047. },
  8048. args: [],
  8049. source: "isEmpty\x0a\x09^ self size = 0",
  8050. referencedClasses: [],
  8051. messageSends: ["=", "size"]
  8052. }),
  8053. $globals.Collection);
  8054. $core.addMethod(
  8055. $core.method({
  8056. selector: "noneSatisfy:",
  8057. protocol: "enumerating",
  8058. fn: function (aBlock){
  8059. var self=this,$self=this;
  8060. return $core.withContext(function($ctx1) {
  8061. var $1;
  8062. var $early={};
  8063. try {
  8064. $self._do_((function(item){
  8065. return $core.withContext(function($ctx2) {
  8066. $1=$recv(aBlock)._value_(item);
  8067. if($core.assert($1)){
  8068. throw $early=[false];
  8069. }
  8070. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8071. }));
  8072. return true;
  8073. }
  8074. catch(e) {if(e===$early)return e[0]; throw e}
  8075. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8076. },
  8077. args: ["aBlock"],
  8078. 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",
  8079. referencedClasses: [],
  8080. messageSends: ["do:", "ifTrue:", "value:"]
  8081. }),
  8082. $globals.Collection);
  8083. $core.addMethod(
  8084. $core.method({
  8085. selector: "notEmpty",
  8086. protocol: "testing",
  8087. fn: function (){
  8088. var self=this,$self=this;
  8089. return $core.withContext(function($ctx1) {
  8090. return $recv($self._isEmpty())._not();
  8091. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8092. },
  8093. args: [],
  8094. source: "notEmpty\x0a\x09^ self isEmpty not",
  8095. referencedClasses: [],
  8096. messageSends: ["not", "isEmpty"]
  8097. }),
  8098. $globals.Collection);
  8099. $core.addMethod(
  8100. $core.method({
  8101. selector: "occurrencesOf:",
  8102. protocol: "accessing",
  8103. fn: function (anObject){
  8104. var self=this,$self=this;
  8105. var tally;
  8106. return $core.withContext(function($ctx1) {
  8107. var $1;
  8108. tally=(0);
  8109. $self._do_((function(each){
  8110. return $core.withContext(function($ctx2) {
  8111. $1=$recv(anObject).__eq(each);
  8112. if($core.assert($1)){
  8113. tally=$recv(tally).__plus((1));
  8114. return tally;
  8115. }
  8116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8117. }));
  8118. return tally;
  8119. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8120. },
  8121. args: ["anObject"],
  8122. 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",
  8123. referencedClasses: [],
  8124. messageSends: ["do:", "ifTrue:", "=", "+"]
  8125. }),
  8126. $globals.Collection);
  8127. $core.addMethod(
  8128. $core.method({
  8129. selector: "putOn:",
  8130. protocol: "streaming",
  8131. fn: function (aStream){
  8132. var self=this,$self=this;
  8133. return $core.withContext(function($ctx1) {
  8134. $self._do_((function(each){
  8135. return $core.withContext(function($ctx2) {
  8136. return $recv(each)._putOn_(aStream);
  8137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8138. }));
  8139. return self;
  8140. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8141. },
  8142. args: ["aStream"],
  8143. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8144. referencedClasses: [],
  8145. messageSends: ["do:", "putOn:"]
  8146. }),
  8147. $globals.Collection);
  8148. $core.addMethod(
  8149. $core.method({
  8150. selector: "reject:",
  8151. protocol: "enumerating",
  8152. fn: function (aBlock){
  8153. var self=this,$self=this;
  8154. return $core.withContext(function($ctx1) {
  8155. return $self._select_((function(each){
  8156. return $core.withContext(function($ctx2) {
  8157. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8159. }));
  8160. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8161. },
  8162. args: ["aBlock"],
  8163. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8164. referencedClasses: [],
  8165. messageSends: ["select:", "=", "value:"]
  8166. }),
  8167. $globals.Collection);
  8168. $core.addMethod(
  8169. $core.method({
  8170. selector: "remove:",
  8171. protocol: "adding/removing",
  8172. fn: function (anObject){
  8173. var self=this,$self=this;
  8174. return $core.withContext(function($ctx1) {
  8175. return $self._remove_ifAbsent_(anObject,(function(){
  8176. return $core.withContext(function($ctx2) {
  8177. return $self._errorNotFound();
  8178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8179. }));
  8180. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8181. },
  8182. args: ["anObject"],
  8183. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8184. referencedClasses: [],
  8185. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8186. }),
  8187. $globals.Collection);
  8188. $core.addMethod(
  8189. $core.method({
  8190. selector: "remove:ifAbsent:",
  8191. protocol: "adding/removing",
  8192. fn: function (anObject,aBlock){
  8193. var self=this,$self=this;
  8194. return $core.withContext(function($ctx1) {
  8195. $self._subclassResponsibility();
  8196. return self;
  8197. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8198. },
  8199. args: ["anObject", "aBlock"],
  8200. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8201. referencedClasses: [],
  8202. messageSends: ["subclassResponsibility"]
  8203. }),
  8204. $globals.Collection);
  8205. $core.addMethod(
  8206. $core.method({
  8207. selector: "removeAll",
  8208. protocol: "adding/removing",
  8209. fn: function (){
  8210. var self=this,$self=this;
  8211. return $core.withContext(function($ctx1) {
  8212. $self._subclassResponsibility();
  8213. return self;
  8214. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8215. },
  8216. args: [],
  8217. source: "removeAll\x0a\x09self subclassResponsibility",
  8218. referencedClasses: [],
  8219. messageSends: ["subclassResponsibility"]
  8220. }),
  8221. $globals.Collection);
  8222. $core.addMethod(
  8223. $core.method({
  8224. selector: "select:",
  8225. protocol: "enumerating",
  8226. fn: function (aBlock){
  8227. var self=this,$self=this;
  8228. var stream;
  8229. return $core.withContext(function($ctx1) {
  8230. var $1;
  8231. stream=$recv($recv($self._class())._new())._writeStream();
  8232. $self._do_((function(each){
  8233. return $core.withContext(function($ctx2) {
  8234. $1=$recv(aBlock)._value_(each);
  8235. if($core.assert($1)){
  8236. return $recv(stream)._nextPut_(each);
  8237. }
  8238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8239. }));
  8240. return $recv(stream)._contents();
  8241. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8242. },
  8243. args: ["aBlock"],
  8244. 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",
  8245. referencedClasses: [],
  8246. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8247. }),
  8248. $globals.Collection);
  8249. $core.addMethod(
  8250. $core.method({
  8251. selector: "select:thenCollect:",
  8252. protocol: "enumerating",
  8253. fn: function (selectBlock,collectBlock){
  8254. var self=this,$self=this;
  8255. var stream;
  8256. return $core.withContext(function($ctx1) {
  8257. var $1;
  8258. stream=$recv($recv($self._class())._new())._writeStream();
  8259. $self._do_((function(each){
  8260. return $core.withContext(function($ctx2) {
  8261. $1=$recv(selectBlock)._value_(each);
  8262. $ctx2.sendIdx["value:"]=1;
  8263. if($core.assert($1)){
  8264. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8265. }
  8266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8267. }));
  8268. return $recv(stream)._contents();
  8269. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8270. },
  8271. args: ["selectBlock", "collectBlock"],
  8272. 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",
  8273. referencedClasses: [],
  8274. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8275. }),
  8276. $globals.Collection);
  8277. $core.addMethod(
  8278. $core.method({
  8279. selector: "shallowCopy",
  8280. protocol: "copying",
  8281. fn: function (){
  8282. var self=this,$self=this;
  8283. return $core.withContext(function($ctx1) {
  8284. return $self._collect_((function(each){
  8285. return each;
  8286. }));
  8287. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8288. },
  8289. args: [],
  8290. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8291. referencedClasses: [],
  8292. messageSends: ["collect:"]
  8293. }),
  8294. $globals.Collection);
  8295. $core.addMethod(
  8296. $core.method({
  8297. selector: "single",
  8298. protocol: "accessing",
  8299. fn: function (){
  8300. var self=this,$self=this;
  8301. return $core.withContext(function($ctx1) {
  8302. var $1;
  8303. $self._ifEmpty_((function(){
  8304. return $core.withContext(function($ctx2) {
  8305. return $self._error_("Collection is empty");
  8306. $ctx2.sendIdx["error:"]=1;
  8307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8308. }));
  8309. $1=$recv($self._size()).__gt((1));
  8310. if($core.assert($1)){
  8311. $self._error_("Collection holds more than one element");
  8312. }
  8313. return $self._anyOne();
  8314. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8315. },
  8316. args: [],
  8317. 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",
  8318. referencedClasses: [],
  8319. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8320. }),
  8321. $globals.Collection);
  8322. $core.addMethod(
  8323. $core.method({
  8324. selector: "size",
  8325. protocol: "accessing",
  8326. fn: function (){
  8327. var self=this,$self=this;
  8328. return $core.withContext(function($ctx1) {
  8329. $self._subclassResponsibility();
  8330. return self;
  8331. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8332. },
  8333. args: [],
  8334. source: "size\x0a\x09self subclassResponsibility",
  8335. referencedClasses: [],
  8336. messageSends: ["subclassResponsibility"]
  8337. }),
  8338. $globals.Collection);
  8339. $core.addMethod(
  8340. $core.method({
  8341. selector: "classTag",
  8342. protocol: "accessing",
  8343. fn: function (){
  8344. var self=this,$self=this;
  8345. return "collection";
  8346. },
  8347. args: [],
  8348. 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'",
  8349. referencedClasses: [],
  8350. messageSends: []
  8351. }),
  8352. $globals.Collection.a$cls);
  8353. $core.addMethod(
  8354. $core.method({
  8355. selector: "new:",
  8356. protocol: "instance creation",
  8357. fn: function (anInteger){
  8358. var self=this,$self=this;
  8359. return $core.withContext(function($ctx1) {
  8360. return $self._new();
  8361. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8362. },
  8363. args: ["anInteger"],
  8364. source: "new: anInteger\x0a\x09^ self new",
  8365. referencedClasses: [],
  8366. messageSends: ["new"]
  8367. }),
  8368. $globals.Collection.a$cls);
  8369. $core.addMethod(
  8370. $core.method({
  8371. selector: "with:",
  8372. protocol: "instance creation",
  8373. fn: function (anObject){
  8374. var self=this,$self=this;
  8375. return $core.withContext(function($ctx1) {
  8376. var $1;
  8377. $1=$self._new();
  8378. $recv($1)._add_(anObject);
  8379. return $recv($1)._yourself();
  8380. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8381. },
  8382. args: ["anObject"],
  8383. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8384. referencedClasses: [],
  8385. messageSends: ["add:", "new", "yourself"]
  8386. }),
  8387. $globals.Collection.a$cls);
  8388. $core.addMethod(
  8389. $core.method({
  8390. selector: "with:with:",
  8391. protocol: "instance creation",
  8392. fn: function (anObject,anotherObject){
  8393. var self=this,$self=this;
  8394. return $core.withContext(function($ctx1) {
  8395. var $1;
  8396. $1=$self._new();
  8397. $recv($1)._add_(anObject);
  8398. $ctx1.sendIdx["add:"]=1;
  8399. $recv($1)._add_(anotherObject);
  8400. return $recv($1)._yourself();
  8401. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8402. },
  8403. args: ["anObject", "anotherObject"],
  8404. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8405. referencedClasses: [],
  8406. messageSends: ["add:", "new", "yourself"]
  8407. }),
  8408. $globals.Collection.a$cls);
  8409. $core.addMethod(
  8410. $core.method({
  8411. selector: "with:with:with:",
  8412. protocol: "instance creation",
  8413. fn: function (firstObject,secondObject,thirdObject){
  8414. var self=this,$self=this;
  8415. return $core.withContext(function($ctx1) {
  8416. var $1;
  8417. $1=$self._new();
  8418. $recv($1)._add_(firstObject);
  8419. $ctx1.sendIdx["add:"]=1;
  8420. $recv($1)._add_(secondObject);
  8421. $ctx1.sendIdx["add:"]=2;
  8422. $recv($1)._add_(thirdObject);
  8423. return $recv($1)._yourself();
  8424. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8425. },
  8426. args: ["firstObject", "secondObject", "thirdObject"],
  8427. 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",
  8428. referencedClasses: [],
  8429. messageSends: ["add:", "new", "yourself"]
  8430. }),
  8431. $globals.Collection.a$cls);
  8432. $core.addMethod(
  8433. $core.method({
  8434. selector: "withAll:",
  8435. protocol: "instance creation",
  8436. fn: function (aCollection){
  8437. var self=this,$self=this;
  8438. return $core.withContext(function($ctx1) {
  8439. var $1;
  8440. $1=$self._new();
  8441. $recv($1)._addAll_(aCollection);
  8442. return $recv($1)._yourself();
  8443. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8444. },
  8445. args: ["aCollection"],
  8446. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8447. referencedClasses: [],
  8448. messageSends: ["addAll:", "new", "yourself"]
  8449. }),
  8450. $globals.Collection.a$cls);
  8451. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  8452. $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.";
  8453. $core.addMethod(
  8454. $core.method({
  8455. selector: "at:",
  8456. protocol: "accessing",
  8457. fn: function (anIndex){
  8458. var self=this,$self=this;
  8459. return $core.withContext(function($ctx1) {
  8460. return $self._at_ifAbsent_(anIndex,(function(){
  8461. return $core.withContext(function($ctx2) {
  8462. return $self._errorNotFound();
  8463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8464. }));
  8465. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  8466. },
  8467. args: ["anIndex"],
  8468. 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 ]",
  8469. referencedClasses: [],
  8470. messageSends: ["at:ifAbsent:", "errorNotFound"]
  8471. }),
  8472. $globals.IndexableCollection);
  8473. $core.addMethod(
  8474. $core.method({
  8475. selector: "at:ifAbsent:",
  8476. protocol: "accessing",
  8477. fn: function (anIndex,aBlock){
  8478. var self=this,$self=this;
  8479. return $core.withContext(function($ctx1) {
  8480. $self._subclassResponsibility();
  8481. return self;
  8482. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8483. },
  8484. args: ["anIndex", "aBlock"],
  8485. 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",
  8486. referencedClasses: [],
  8487. messageSends: ["subclassResponsibility"]
  8488. }),
  8489. $globals.IndexableCollection);
  8490. $core.addMethod(
  8491. $core.method({
  8492. selector: "at:ifAbsentPut:",
  8493. protocol: "accessing",
  8494. fn: function (aKey,aBlock){
  8495. var self=this,$self=this;
  8496. return $core.withContext(function($ctx1) {
  8497. return $self._at_ifAbsent_(aKey,(function(){
  8498. return $core.withContext(function($ctx2) {
  8499. return $self._at_put_(aKey,$recv(aBlock)._value());
  8500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8501. }));
  8502. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  8503. },
  8504. args: ["aKey", "aBlock"],
  8505. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  8506. referencedClasses: [],
  8507. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  8508. }),
  8509. $globals.IndexableCollection);
  8510. $core.addMethod(
  8511. $core.method({
  8512. selector: "at:ifPresent:",
  8513. protocol: "accessing",
  8514. fn: function (anIndex,aBlock){
  8515. var self=this,$self=this;
  8516. return $core.withContext(function($ctx1) {
  8517. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  8518. return nil;
  8519. }));
  8520. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8521. },
  8522. args: ["anIndex", "aBlock"],
  8523. 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 ]",
  8524. referencedClasses: [],
  8525. messageSends: ["at:ifPresent:ifAbsent:"]
  8526. }),
  8527. $globals.IndexableCollection);
  8528. $core.addMethod(
  8529. $core.method({
  8530. selector: "at:ifPresent:ifAbsent:",
  8531. protocol: "accessing",
  8532. fn: function (anIndex,aBlock,anotherBlock){
  8533. var self=this,$self=this;
  8534. return $core.withContext(function($ctx1) {
  8535. $self._subclassResponsibility();
  8536. return self;
  8537. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  8538. },
  8539. args: ["anIndex", "aBlock", "anotherBlock"],
  8540. 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",
  8541. referencedClasses: [],
  8542. messageSends: ["subclassResponsibility"]
  8543. }),
  8544. $globals.IndexableCollection);
  8545. $core.addMethod(
  8546. $core.method({
  8547. selector: "at:put:",
  8548. protocol: "accessing",
  8549. fn: function (anIndex,anObject){
  8550. var self=this,$self=this;
  8551. return $core.withContext(function($ctx1) {
  8552. $self._subclassResponsibility();
  8553. return self;
  8554. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  8555. },
  8556. args: ["anIndex", "anObject"],
  8557. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  8558. referencedClasses: [],
  8559. messageSends: ["subclassResponsibility"]
  8560. }),
  8561. $globals.IndexableCollection);
  8562. $core.addMethod(
  8563. $core.method({
  8564. selector: "indexOf:",
  8565. protocol: "accessing",
  8566. fn: function (anObject){
  8567. var self=this,$self=this;
  8568. return $core.withContext(function($ctx1) {
  8569. return $self._indexOf_ifAbsent_(anObject,(function(){
  8570. return $core.withContext(function($ctx2) {
  8571. return $self._errorNotFound();
  8572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8573. }));
  8574. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  8575. },
  8576. args: ["anObject"],
  8577. 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 ]",
  8578. referencedClasses: [],
  8579. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  8580. }),
  8581. $globals.IndexableCollection);
  8582. $core.addMethod(
  8583. $core.method({
  8584. selector: "indexOf:ifAbsent:",
  8585. protocol: "accessing",
  8586. fn: function (anObject,aBlock){
  8587. var self=this,$self=this;
  8588. return $core.withContext(function($ctx1) {
  8589. $self._subclassResponsibility();
  8590. return self;
  8591. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  8592. },
  8593. args: ["anObject", "aBlock"],
  8594. 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",
  8595. referencedClasses: [],
  8596. messageSends: ["subclassResponsibility"]
  8597. }),
  8598. $globals.IndexableCollection);
  8599. $core.addMethod(
  8600. $core.method({
  8601. selector: "with:do:",
  8602. protocol: "enumerating",
  8603. fn: function (anotherCollection,aBlock){
  8604. var self=this,$self=this;
  8605. return $core.withContext(function($ctx1) {
  8606. $self._withIndexDo_((function(each,index){
  8607. return $core.withContext(function($ctx2) {
  8608. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  8609. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  8610. }));
  8611. return self;
  8612. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  8613. },
  8614. args: ["anotherCollection", "aBlock"],
  8615. 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) ]",
  8616. referencedClasses: [],
  8617. messageSends: ["withIndexDo:", "value:value:", "at:"]
  8618. }),
  8619. $globals.IndexableCollection);
  8620. $core.addMethod(
  8621. $core.method({
  8622. selector: "withIndexDo:",
  8623. protocol: "enumerating",
  8624. fn: function (aBlock){
  8625. var self=this,$self=this;
  8626. return $core.withContext(function($ctx1) {
  8627. $self._subclassResponsibility();
  8628. return self;
  8629. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  8630. },
  8631. args: ["aBlock"],
  8632. 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",
  8633. referencedClasses: [],
  8634. messageSends: ["subclassResponsibility"]
  8635. }),
  8636. $globals.IndexableCollection);
  8637. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8638. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8639. $core.addMethod(
  8640. $core.method({
  8641. selector: "=",
  8642. protocol: "comparing",
  8643. fn: function (anAssocitativeCollection){
  8644. var self=this,$self=this;
  8645. return $core.withContext(function($ctx1) {
  8646. var $2,$1,$4,$3,$5;
  8647. $2=$self._class();
  8648. $ctx1.sendIdx["class"]=1;
  8649. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8650. $ctx1.sendIdx["="]=1;
  8651. if(!$core.assert($1)){
  8652. return false;
  8653. }
  8654. $4=$self._size();
  8655. $ctx1.sendIdx["size"]=1;
  8656. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8657. $ctx1.sendIdx["="]=2;
  8658. if(!$core.assert($3)){
  8659. return false;
  8660. }
  8661. $5=$self._associations();
  8662. $ctx1.sendIdx["associations"]=1;
  8663. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8664. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8665. },
  8666. args: ["anAssocitativeCollection"],
  8667. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8668. referencedClasses: [],
  8669. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8670. }),
  8671. $globals.AssociativeCollection);
  8672. $core.addMethod(
  8673. $core.method({
  8674. selector: "add:",
  8675. protocol: "adding/removing",
  8676. fn: function (anAssociation){
  8677. var self=this,$self=this;
  8678. return $core.withContext(function($ctx1) {
  8679. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8680. return self;
  8681. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8682. },
  8683. args: ["anAssociation"],
  8684. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8685. referencedClasses: [],
  8686. messageSends: ["at:put:", "key", "value"]
  8687. }),
  8688. $globals.AssociativeCollection);
  8689. $core.addMethod(
  8690. $core.method({
  8691. selector: "addAll:",
  8692. protocol: "adding/removing",
  8693. fn: function (anAssociativeCollection){
  8694. var self=this,$self=this;
  8695. return $core.withContext(function($ctx1) {
  8696. (
  8697. $ctx1.supercall = true,
  8698. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8699. $ctx1.supercall = false;
  8700. return anAssociativeCollection;
  8701. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8702. },
  8703. args: ["anAssociativeCollection"],
  8704. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8705. referencedClasses: [],
  8706. messageSends: ["addAll:", "associations"]
  8707. }),
  8708. $globals.AssociativeCollection);
  8709. $core.addMethod(
  8710. $core.method({
  8711. selector: "asDictionary",
  8712. protocol: "converting",
  8713. fn: function (){
  8714. var self=this,$self=this;
  8715. return $core.withContext(function($ctx1) {
  8716. return $recv($globals.Dictionary)._from_($self._associations());
  8717. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8718. },
  8719. args: [],
  8720. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8721. referencedClasses: ["Dictionary"],
  8722. messageSends: ["from:", "associations"]
  8723. }),
  8724. $globals.AssociativeCollection);
  8725. $core.addMethod(
  8726. $core.method({
  8727. selector: "asHashedCollection",
  8728. protocol: "converting",
  8729. fn: function (){
  8730. var self=this,$self=this;
  8731. return $core.withContext(function($ctx1) {
  8732. return $recv($globals.HashedCollection)._from_($self._associations());
  8733. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8734. },
  8735. args: [],
  8736. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8737. referencedClasses: ["HashedCollection"],
  8738. messageSends: ["from:", "associations"]
  8739. }),
  8740. $globals.AssociativeCollection);
  8741. $core.addMethod(
  8742. $core.method({
  8743. selector: "asJavaScriptObject",
  8744. protocol: "converting",
  8745. fn: function (){
  8746. var self=this,$self=this;
  8747. var hash;
  8748. return $core.withContext(function($ctx1) {
  8749. hash=$recv($globals.HashedCollection)._new();
  8750. $self._keysAndValuesDo_((function(key,value){
  8751. return $core.withContext(function($ctx2) {
  8752. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8753. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8754. }));
  8755. return hash;
  8756. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8757. },
  8758. args: [],
  8759. 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",
  8760. referencedClasses: ["HashedCollection"],
  8761. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8762. }),
  8763. $globals.AssociativeCollection);
  8764. $core.addMethod(
  8765. $core.method({
  8766. selector: "associations",
  8767. protocol: "accessing",
  8768. fn: function (){
  8769. var self=this,$self=this;
  8770. var associations;
  8771. return $core.withContext(function($ctx1) {
  8772. associations=[];
  8773. $self._associationsDo_((function(each){
  8774. return $core.withContext(function($ctx2) {
  8775. return $recv(associations)._add_(each);
  8776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8777. }));
  8778. return associations;
  8779. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8780. },
  8781. args: [],
  8782. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8783. referencedClasses: [],
  8784. messageSends: ["associationsDo:", "add:"]
  8785. }),
  8786. $globals.AssociativeCollection);
  8787. $core.addMethod(
  8788. $core.method({
  8789. selector: "associationsDo:",
  8790. protocol: "enumerating",
  8791. fn: function (aBlock){
  8792. var self=this,$self=this;
  8793. return $core.withContext(function($ctx1) {
  8794. $self._keysAndValuesDo_((function(key,value){
  8795. return $core.withContext(function($ctx2) {
  8796. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8797. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8798. }));
  8799. return self;
  8800. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8801. },
  8802. args: ["aBlock"],
  8803. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8804. referencedClasses: ["Association"],
  8805. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8806. }),
  8807. $globals.AssociativeCollection);
  8808. $core.addMethod(
  8809. $core.method({
  8810. selector: "at:ifPresent:ifAbsent:",
  8811. protocol: "accessing",
  8812. fn: function (aKey,aBlock,anotherBlock){
  8813. var self=this,$self=this;
  8814. return $core.withContext(function($ctx1) {
  8815. var $1;
  8816. $1=$self._includesKey_(aKey);
  8817. if($core.assert($1)){
  8818. return $recv(aBlock)._value_($self._at_(aKey));
  8819. } else {
  8820. return $recv(anotherBlock)._value();
  8821. }
  8822. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8823. },
  8824. args: ["aKey", "aBlock", "anotherBlock"],
  8825. 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 ]",
  8826. referencedClasses: [],
  8827. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8828. }),
  8829. $globals.AssociativeCollection);
  8830. $core.addMethod(
  8831. $core.method({
  8832. selector: "collect:",
  8833. protocol: "enumerating",
  8834. fn: function (aBlock){
  8835. var self=this,$self=this;
  8836. var newDict;
  8837. return $core.withContext(function($ctx1) {
  8838. newDict=$recv($self._class())._new();
  8839. $self._keysAndValuesDo_((function(key,value){
  8840. return $core.withContext(function($ctx2) {
  8841. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8842. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8843. }));
  8844. return newDict;
  8845. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8846. },
  8847. args: ["aBlock"],
  8848. 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",
  8849. referencedClasses: [],
  8850. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8851. }),
  8852. $globals.AssociativeCollection);
  8853. $core.addMethod(
  8854. $core.method({
  8855. selector: "deepCopy",
  8856. protocol: "copying",
  8857. fn: function (){
  8858. var self=this,$self=this;
  8859. var copy;
  8860. return $core.withContext(function($ctx1) {
  8861. copy=$recv($self._class())._new();
  8862. $self._keysAndValuesDo_((function(key,value){
  8863. return $core.withContext(function($ctx2) {
  8864. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8865. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8866. }));
  8867. return copy;
  8868. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8869. },
  8870. args: [],
  8871. 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",
  8872. referencedClasses: [],
  8873. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8874. }),
  8875. $globals.AssociativeCollection);
  8876. $core.addMethod(
  8877. $core.method({
  8878. selector: "detect:ifNone:",
  8879. protocol: "enumerating",
  8880. fn: function (aBlock,anotherBlock){
  8881. var self=this,$self=this;
  8882. return $core.withContext(function($ctx1) {
  8883. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8884. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8885. },
  8886. args: ["aBlock", "anotherBlock"],
  8887. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8888. referencedClasses: [],
  8889. messageSends: ["detect:ifNone:", "values"]
  8890. }),
  8891. $globals.AssociativeCollection);
  8892. $core.addMethod(
  8893. $core.method({
  8894. selector: "do:",
  8895. protocol: "enumerating",
  8896. fn: function (aBlock){
  8897. var self=this,$self=this;
  8898. return $core.withContext(function($ctx1) {
  8899. $self._valuesDo_(aBlock);
  8900. return self;
  8901. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8902. },
  8903. args: ["aBlock"],
  8904. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8905. referencedClasses: [],
  8906. messageSends: ["valuesDo:"]
  8907. }),
  8908. $globals.AssociativeCollection);
  8909. $core.addMethod(
  8910. $core.method({
  8911. selector: "includes:",
  8912. protocol: "enumerating",
  8913. fn: function (anObject){
  8914. var self=this,$self=this;
  8915. return $core.withContext(function($ctx1) {
  8916. return $recv($self._values())._includes_(anObject);
  8917. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8918. },
  8919. args: ["anObject"],
  8920. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8921. referencedClasses: [],
  8922. messageSends: ["includes:", "values"]
  8923. }),
  8924. $globals.AssociativeCollection);
  8925. $core.addMethod(
  8926. $core.method({
  8927. selector: "includesKey:",
  8928. protocol: "testing",
  8929. fn: function (aKey){
  8930. var self=this,$self=this;
  8931. return $core.withContext(function($ctx1) {
  8932. $self._subclassResponsibility();
  8933. return self;
  8934. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8935. },
  8936. args: ["aKey"],
  8937. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8938. referencedClasses: [],
  8939. messageSends: ["subclassResponsibility"]
  8940. }),
  8941. $globals.AssociativeCollection);
  8942. $core.addMethod(
  8943. $core.method({
  8944. selector: "indexOf:ifAbsent:",
  8945. protocol: "accessing",
  8946. fn: function (anObject,aBlock){
  8947. var self=this,$self=this;
  8948. return $core.withContext(function($ctx1) {
  8949. return $recv($self._keys())._detect_ifNone_((function(each){
  8950. return $core.withContext(function($ctx2) {
  8951. return $recv($self._at_(each)).__eq(anObject);
  8952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8953. }),aBlock);
  8954. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8955. },
  8956. args: ["anObject", "aBlock"],
  8957. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  8958. referencedClasses: [],
  8959. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  8960. }),
  8961. $globals.AssociativeCollection);
  8962. $core.addMethod(
  8963. $core.method({
  8964. selector: "keyAtValue:",
  8965. protocol: "accessing",
  8966. fn: function (anObject){
  8967. var self=this,$self=this;
  8968. return $core.withContext(function($ctx1) {
  8969. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  8970. return $core.withContext(function($ctx2) {
  8971. return $self._errorNotFound();
  8972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8973. }));
  8974. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  8975. },
  8976. args: ["anObject"],
  8977. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  8978. referencedClasses: [],
  8979. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  8980. }),
  8981. $globals.AssociativeCollection);
  8982. $core.addMethod(
  8983. $core.method({
  8984. selector: "keyAtValue:ifAbsent:",
  8985. protocol: "accessing",
  8986. fn: function (anObject,aBlock){
  8987. var self=this,$self=this;
  8988. return $core.withContext(function($ctx1) {
  8989. return $self._indexOf_ifAbsent_(anObject,aBlock);
  8990. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  8991. },
  8992. args: ["anObject", "aBlock"],
  8993. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  8994. referencedClasses: [],
  8995. messageSends: ["indexOf:ifAbsent:"]
  8996. }),
  8997. $globals.AssociativeCollection);
  8998. $core.addMethod(
  8999. $core.method({
  9000. selector: "keys",
  9001. protocol: "accessing",
  9002. fn: function (){
  9003. var self=this,$self=this;
  9004. return $core.withContext(function($ctx1) {
  9005. $self._subclassResponsibility();
  9006. return self;
  9007. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  9008. },
  9009. args: [],
  9010. source: "keys\x0a\x09self subclassResponsibility",
  9011. referencedClasses: [],
  9012. messageSends: ["subclassResponsibility"]
  9013. }),
  9014. $globals.AssociativeCollection);
  9015. $core.addMethod(
  9016. $core.method({
  9017. selector: "keysAndValuesDo:",
  9018. protocol: "enumerating",
  9019. fn: function (aBlock){
  9020. var self=this,$self=this;
  9021. return $core.withContext(function($ctx1) {
  9022. $self._keysDo_((function(each){
  9023. return $core.withContext(function($ctx2) {
  9024. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9025. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9026. }));
  9027. return self;
  9028. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9029. },
  9030. args: ["aBlock"],
  9031. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9032. referencedClasses: [],
  9033. messageSends: ["keysDo:", "value:value:", "at:"]
  9034. }),
  9035. $globals.AssociativeCollection);
  9036. $core.addMethod(
  9037. $core.method({
  9038. selector: "keysDo:",
  9039. protocol: "enumerating",
  9040. fn: function (aBlock){
  9041. var self=this,$self=this;
  9042. return $core.withContext(function($ctx1) {
  9043. $self._subclassResponsibility();
  9044. return self;
  9045. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9046. },
  9047. args: ["aBlock"],
  9048. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9049. referencedClasses: [],
  9050. messageSends: ["subclassResponsibility"]
  9051. }),
  9052. $globals.AssociativeCollection);
  9053. $core.addMethod(
  9054. $core.method({
  9055. selector: "printOn:",
  9056. protocol: "printing",
  9057. fn: function (aStream){
  9058. var self=this,$self=this;
  9059. return $core.withContext(function($ctx1) {
  9060. (
  9061. $ctx1.supercall = true,
  9062. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9063. $ctx1.supercall = false;
  9064. $ctx1.sendIdx["printOn:"]=1;
  9065. $recv(aStream)._nextPutAll_(" (");
  9066. $ctx1.sendIdx["nextPutAll:"]=1;
  9067. $recv($self._associations())._do_separatedBy_((function(each){
  9068. return $core.withContext(function($ctx2) {
  9069. return $recv(each)._printOn_(aStream);
  9070. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9071. }),(function(){
  9072. return $core.withContext(function($ctx2) {
  9073. return $recv(aStream)._nextPutAll_(" , ");
  9074. $ctx2.sendIdx["nextPutAll:"]=2;
  9075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9076. }));
  9077. $recv(aStream)._nextPutAll_(")");
  9078. return self;
  9079. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9080. },
  9081. args: ["aStream"],
  9082. 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: ')'",
  9083. referencedClasses: [],
  9084. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9085. }),
  9086. $globals.AssociativeCollection);
  9087. $core.addMethod(
  9088. $core.method({
  9089. selector: "remove:ifAbsent:",
  9090. protocol: "adding/removing",
  9091. fn: function (aKey,aBlock){
  9092. var self=this,$self=this;
  9093. return $core.withContext(function($ctx1) {
  9094. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9095. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9096. },
  9097. args: ["aKey", "aBlock"],
  9098. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9099. referencedClasses: [],
  9100. messageSends: ["removeKey:ifAbsent:"]
  9101. }),
  9102. $globals.AssociativeCollection);
  9103. $core.addMethod(
  9104. $core.method({
  9105. selector: "removeAll",
  9106. protocol: "adding/removing",
  9107. fn: function (){
  9108. var self=this,$self=this;
  9109. return $core.withContext(function($ctx1) {
  9110. return $recv($self._keys())._do_((function(each){
  9111. return $core.withContext(function($ctx2) {
  9112. return $self._removeKey_(each);
  9113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9114. }));
  9115. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9116. },
  9117. args: [],
  9118. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9119. referencedClasses: [],
  9120. messageSends: ["do:", "keys", "removeKey:"]
  9121. }),
  9122. $globals.AssociativeCollection);
  9123. $core.addMethod(
  9124. $core.method({
  9125. selector: "removeKey:",
  9126. protocol: "adding/removing",
  9127. fn: function (aKey){
  9128. var self=this,$self=this;
  9129. return $core.withContext(function($ctx1) {
  9130. return $self._remove_(aKey);
  9131. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9132. },
  9133. args: ["aKey"],
  9134. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9135. referencedClasses: [],
  9136. messageSends: ["remove:"]
  9137. }),
  9138. $globals.AssociativeCollection);
  9139. $core.addMethod(
  9140. $core.method({
  9141. selector: "removeKey:ifAbsent:",
  9142. protocol: "adding/removing",
  9143. fn: function (aKey,aBlock){
  9144. var self=this,$self=this;
  9145. return $core.withContext(function($ctx1) {
  9146. $self._subclassResponsibility();
  9147. return self;
  9148. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9149. },
  9150. args: ["aKey", "aBlock"],
  9151. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9152. referencedClasses: [],
  9153. messageSends: ["subclassResponsibility"]
  9154. }),
  9155. $globals.AssociativeCollection);
  9156. $core.addMethod(
  9157. $core.method({
  9158. selector: "select:",
  9159. protocol: "enumerating",
  9160. fn: function (aBlock){
  9161. var self=this,$self=this;
  9162. var newDict;
  9163. return $core.withContext(function($ctx1) {
  9164. var $1;
  9165. newDict=$recv($self._class())._new();
  9166. $self._keysAndValuesDo_((function(key,value){
  9167. return $core.withContext(function($ctx2) {
  9168. $1=$recv(aBlock)._value_(value);
  9169. if($core.assert($1)){
  9170. return $recv(newDict)._at_put_(key,value);
  9171. }
  9172. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9173. }));
  9174. return newDict;
  9175. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9176. },
  9177. args: ["aBlock"],
  9178. 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",
  9179. referencedClasses: [],
  9180. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9181. }),
  9182. $globals.AssociativeCollection);
  9183. $core.addMethod(
  9184. $core.method({
  9185. selector: "select:thenCollect:",
  9186. protocol: "enumerating",
  9187. fn: function (selectBlock,collectBlock){
  9188. var self=this,$self=this;
  9189. var newDict;
  9190. return $core.withContext(function($ctx1) {
  9191. var $1;
  9192. newDict=$recv($self._class())._new();
  9193. $self._keysAndValuesDo_((function(key,value){
  9194. return $core.withContext(function($ctx2) {
  9195. $1=$recv(selectBlock)._value_(value);
  9196. $ctx2.sendIdx["value:"]=1;
  9197. if($core.assert($1)){
  9198. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9199. }
  9200. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9201. }));
  9202. return newDict;
  9203. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9204. },
  9205. args: ["selectBlock", "collectBlock"],
  9206. 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",
  9207. referencedClasses: [],
  9208. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9209. }),
  9210. $globals.AssociativeCollection);
  9211. $core.addMethod(
  9212. $core.method({
  9213. selector: "shallowCopy",
  9214. protocol: "copying",
  9215. fn: function (){
  9216. var self=this,$self=this;
  9217. var copy;
  9218. return $core.withContext(function($ctx1) {
  9219. copy=$recv($self._class())._new();
  9220. $self._keysAndValuesDo_((function(key,value){
  9221. return $core.withContext(function($ctx2) {
  9222. return $recv(copy)._at_put_(key,value);
  9223. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9224. }));
  9225. return copy;
  9226. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9227. },
  9228. args: [],
  9229. 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",
  9230. referencedClasses: [],
  9231. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9232. }),
  9233. $globals.AssociativeCollection);
  9234. $core.addMethod(
  9235. $core.method({
  9236. selector: "size",
  9237. protocol: "accessing",
  9238. fn: function (){
  9239. var self=this,$self=this;
  9240. return $core.withContext(function($ctx1) {
  9241. return $recv($self._keys())._size();
  9242. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9243. },
  9244. args: [],
  9245. source: "size\x0a\x09^ self keys size",
  9246. referencedClasses: [],
  9247. messageSends: ["size", "keys"]
  9248. }),
  9249. $globals.AssociativeCollection);
  9250. $core.addMethod(
  9251. $core.method({
  9252. selector: "values",
  9253. protocol: "accessing",
  9254. fn: function (){
  9255. var self=this,$self=this;
  9256. return $core.withContext(function($ctx1) {
  9257. $self._subclassResponsibility();
  9258. return self;
  9259. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9260. },
  9261. args: [],
  9262. source: "values\x0a\x09self subclassResponsibility",
  9263. referencedClasses: [],
  9264. messageSends: ["subclassResponsibility"]
  9265. }),
  9266. $globals.AssociativeCollection);
  9267. $core.addMethod(
  9268. $core.method({
  9269. selector: "valuesDo:",
  9270. protocol: "enumerating",
  9271. fn: function (aBlock){
  9272. var self=this,$self=this;
  9273. return $core.withContext(function($ctx1) {
  9274. $self._subclassResponsibility();
  9275. return self;
  9276. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9277. },
  9278. args: ["aBlock"],
  9279. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9280. referencedClasses: [],
  9281. messageSends: ["subclassResponsibility"]
  9282. }),
  9283. $globals.AssociativeCollection);
  9284. $core.addMethod(
  9285. $core.method({
  9286. selector: "withIndexDo:",
  9287. protocol: "enumerating",
  9288. fn: function (aBlock){
  9289. var self=this,$self=this;
  9290. return $core.withContext(function($ctx1) {
  9291. $self._keysAndValuesDo_((function(key,value){
  9292. return $core.withContext(function($ctx2) {
  9293. return $recv(aBlock)._value_value_(value,key);
  9294. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9295. }));
  9296. return self;
  9297. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9298. },
  9299. args: ["aBlock"],
  9300. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9301. referencedClasses: [],
  9302. messageSends: ["keysAndValuesDo:", "value:value:"]
  9303. }),
  9304. $globals.AssociativeCollection);
  9305. $core.addMethod(
  9306. $core.method({
  9307. selector: "from:",
  9308. protocol: "instance creation",
  9309. fn: function (aCollection){
  9310. var self=this,$self=this;
  9311. var newCollection;
  9312. return $core.withContext(function($ctx1) {
  9313. newCollection=$self._new();
  9314. $recv(aCollection)._do_((function(each){
  9315. return $core.withContext(function($ctx2) {
  9316. return $recv(newCollection)._add_(each);
  9317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9318. }));
  9319. return newCollection;
  9320. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9321. },
  9322. args: ["aCollection"],
  9323. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9324. referencedClasses: [],
  9325. messageSends: ["new", "do:", "add:"]
  9326. }),
  9327. $globals.AssociativeCollection.a$cls);
  9328. $core.addMethod(
  9329. $core.method({
  9330. selector: "fromPairs:",
  9331. protocol: "instance creation",
  9332. fn: function (aCollection){
  9333. var self=this,$self=this;
  9334. return $core.withContext(function($ctx1) {
  9335. return $self._from_(aCollection);
  9336. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9337. },
  9338. args: ["aCollection"],
  9339. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9340. referencedClasses: [],
  9341. messageSends: ["from:"]
  9342. }),
  9343. $globals.AssociativeCollection.a$cls);
  9344. $core.addMethod(
  9345. $core.method({
  9346. selector: "newFromPairs:",
  9347. protocol: "instance creation",
  9348. fn: function (aCollection){
  9349. var self=this,$self=this;
  9350. var newCollection;
  9351. return $core.withContext(function($ctx1) {
  9352. var $2,$1,$3,$4;
  9353. $2=$recv(aCollection)._size();
  9354. $ctx1.sendIdx["size"]=1;
  9355. $1=$recv($2)._even();
  9356. if(!$core.assert($1)){
  9357. $self._error_("#newFromPairs only accepts arrays of an even length");
  9358. }
  9359. newCollection=$self._new();
  9360. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9361. return $core.withContext(function($ctx2) {
  9362. $3=newCollection;
  9363. $4=$recv(aCollection)._at_(each);
  9364. $ctx2.sendIdx["at:"]=1;
  9365. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9366. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9367. }));
  9368. return newCollection;
  9369. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9370. },
  9371. args: ["aCollection"],
  9372. 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",
  9373. referencedClasses: [],
  9374. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9375. }),
  9376. $globals.AssociativeCollection.a$cls);
  9377. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9378. $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.";
  9379. $core.addMethod(
  9380. $core.method({
  9381. selector: "at:ifAbsent:",
  9382. protocol: "accessing",
  9383. fn: function (aKey,aBlock){
  9384. var self=this,$self=this;
  9385. return $core.withContext(function($ctx1) {
  9386. var index = $self._positionOfKey_(aKey);
  9387. return index >=0 ? $self['@values'][index] : aBlock._value();
  9388. ;
  9389. return self;
  9390. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9391. },
  9392. args: ["aKey", "aBlock"],
  9393. 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'>",
  9394. referencedClasses: [],
  9395. messageSends: []
  9396. }),
  9397. $globals.Dictionary);
  9398. $core.addMethod(
  9399. $core.method({
  9400. selector: "at:put:",
  9401. protocol: "accessing",
  9402. fn: function (aKey,aValue){
  9403. var self=this,$self=this;
  9404. return $core.withContext(function($ctx1) {
  9405. var index = $self._positionOfKey_(aKey);
  9406. if(index === -1) {
  9407. var keys = $self['@keys'];
  9408. index = keys.length;
  9409. keys.push(aKey);
  9410. }
  9411. return $self['@values'][index] = aValue;
  9412. ;
  9413. return self;
  9414. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9415. },
  9416. args: ["aKey", "aValue"],
  9417. 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'>",
  9418. referencedClasses: [],
  9419. messageSends: []
  9420. }),
  9421. $globals.Dictionary);
  9422. $core.addMethod(
  9423. $core.method({
  9424. selector: "includesKey:",
  9425. protocol: "testing",
  9426. fn: function (aKey){
  9427. var self=this,$self=this;
  9428. return $core.withContext(function($ctx1) {
  9429. return $self._positionOfKey_(aKey) >= 0;;
  9430. return self;
  9431. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9432. },
  9433. args: ["aKey"],
  9434. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9435. referencedClasses: [],
  9436. messageSends: []
  9437. }),
  9438. $globals.Dictionary);
  9439. $core.addMethod(
  9440. $core.method({
  9441. selector: "indexOf:ifAbsent:",
  9442. protocol: "accessing",
  9443. fn: function (anObject,aBlock){
  9444. var self=this,$self=this;
  9445. var index;
  9446. return $core.withContext(function($ctx1) {
  9447. var $1;
  9448. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9449. return (0);
  9450. }));
  9451. $1=$recv(index).__eq((0));
  9452. if($core.assert($1)){
  9453. return $recv(aBlock)._value();
  9454. } else {
  9455. return $recv($self["@keys"])._at_(index);
  9456. }
  9457. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9458. },
  9459. args: ["anObject", "aBlock"],
  9460. 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 ]",
  9461. referencedClasses: [],
  9462. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9463. }),
  9464. $globals.Dictionary);
  9465. $core.addMethod(
  9466. $core.method({
  9467. selector: "initialize",
  9468. protocol: "initialization",
  9469. fn: function (){
  9470. var self=this,$self=this;
  9471. return $core.withContext(function($ctx1) {
  9472. (
  9473. $ctx1.supercall = true,
  9474. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9475. $ctx1.supercall = false;
  9476. $self["@keys"]=[];
  9477. $self["@values"]=[];
  9478. return self;
  9479. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9480. },
  9481. args: [],
  9482. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9483. referencedClasses: [],
  9484. messageSends: ["initialize"]
  9485. }),
  9486. $globals.Dictionary);
  9487. $core.addMethod(
  9488. $core.method({
  9489. selector: "keys",
  9490. protocol: "accessing",
  9491. fn: function (){
  9492. var self=this,$self=this;
  9493. return $core.withContext(function($ctx1) {
  9494. return $recv($self["@keys"])._copy();
  9495. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9496. },
  9497. args: [],
  9498. source: "keys\x0a\x09^ keys copy",
  9499. referencedClasses: [],
  9500. messageSends: ["copy"]
  9501. }),
  9502. $globals.Dictionary);
  9503. $core.addMethod(
  9504. $core.method({
  9505. selector: "keysAndValuesDo:",
  9506. protocol: "enumerating",
  9507. fn: function (aBlock){
  9508. var self=this,$self=this;
  9509. return $core.withContext(function($ctx1) {
  9510. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9511. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9512. },
  9513. args: ["aBlock"],
  9514. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9515. referencedClasses: [],
  9516. messageSends: ["with:do:"]
  9517. }),
  9518. $globals.Dictionary);
  9519. $core.addMethod(
  9520. $core.method({
  9521. selector: "keysDo:",
  9522. protocol: "enumerating",
  9523. fn: function (aBlock){
  9524. var self=this,$self=this;
  9525. return $core.withContext(function($ctx1) {
  9526. return $recv($self["@keys"])._do_(aBlock);
  9527. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9528. },
  9529. args: ["aBlock"],
  9530. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9531. referencedClasses: [],
  9532. messageSends: ["do:"]
  9533. }),
  9534. $globals.Dictionary);
  9535. $core.addMethod(
  9536. $core.method({
  9537. selector: "positionOfKey:",
  9538. protocol: "private",
  9539. fn: function (anObject){
  9540. var self=this,$self=this;
  9541. return $core.withContext(function($ctx1) {
  9542. var keys = $self['@keys'];
  9543. for(var i=0;i<keys.length;i++){
  9544. if(keys[i].__eq(anObject)) { return i;}
  9545. }
  9546. return -1;
  9547. ;
  9548. return self;
  9549. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9550. },
  9551. args: ["anObject"],
  9552. 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'>",
  9553. referencedClasses: [],
  9554. messageSends: []
  9555. }),
  9556. $globals.Dictionary);
  9557. $core.addMethod(
  9558. $core.method({
  9559. selector: "removeAll",
  9560. protocol: "adding/removing",
  9561. fn: function (){
  9562. var self=this,$self=this;
  9563. return $core.withContext(function($ctx1) {
  9564. $recv($self["@keys"])._removeAll();
  9565. $ctx1.sendIdx["removeAll"]=1;
  9566. $recv($self["@values"])._removeAll();
  9567. return self;
  9568. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9569. },
  9570. args: [],
  9571. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9572. referencedClasses: [],
  9573. messageSends: ["removeAll"]
  9574. }),
  9575. $globals.Dictionary);
  9576. $core.addMethod(
  9577. $core.method({
  9578. selector: "removeKey:ifAbsent:",
  9579. protocol: "adding/removing",
  9580. fn: function (aKey,aBlock){
  9581. var self=this,$self=this;
  9582. return $core.withContext(function($ctx1) {
  9583. var index = $self._positionOfKey_(aKey);
  9584. if(index === -1) {
  9585. return aBlock._value()
  9586. } else {
  9587. var keys = $self['@keys'], values = $self['@values'];
  9588. var value = values[index], l = keys.length;
  9589. keys[index] = keys[l-1];
  9590. keys.pop();
  9591. values[index] = values[l-1];
  9592. values.pop();
  9593. return value;
  9594. }
  9595. ;
  9596. return self;
  9597. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9598. },
  9599. args: ["aKey", "aBlock"],
  9600. 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'>",
  9601. referencedClasses: [],
  9602. messageSends: []
  9603. }),
  9604. $globals.Dictionary);
  9605. $core.addMethod(
  9606. $core.method({
  9607. selector: "values",
  9608. protocol: "accessing",
  9609. fn: function (){
  9610. var self=this,$self=this;
  9611. return $self["@values"];
  9612. },
  9613. args: [],
  9614. source: "values\x0a\x09^ values",
  9615. referencedClasses: [],
  9616. messageSends: []
  9617. }),
  9618. $globals.Dictionary);
  9619. $core.addMethod(
  9620. $core.method({
  9621. selector: "valuesDo:",
  9622. protocol: "enumerating",
  9623. fn: function (aBlock){
  9624. var self=this,$self=this;
  9625. return $core.withContext(function($ctx1) {
  9626. return $recv($self["@values"])._do_(aBlock);
  9627. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9628. },
  9629. args: ["aBlock"],
  9630. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9631. referencedClasses: [],
  9632. messageSends: ["do:"]
  9633. }),
  9634. $globals.Dictionary);
  9635. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9636. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9637. $core.addMethod(
  9638. $core.method({
  9639. selector: "at:ifAbsent:",
  9640. protocol: "accessing",
  9641. fn: function (aKey,aBlock){
  9642. var self=this,$self=this;
  9643. return $core.withContext(function($ctx1) {
  9644. var $1;
  9645. $1=$self._includesKey_(aKey);
  9646. if($core.assert($1)){
  9647. return $self._basicAt_(aKey);
  9648. } else {
  9649. return $recv(aBlock)._value();
  9650. }
  9651. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9652. },
  9653. args: ["aKey", "aBlock"],
  9654. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9655. referencedClasses: [],
  9656. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9657. }),
  9658. $globals.HashedCollection);
  9659. $core.addMethod(
  9660. $core.method({
  9661. selector: "at:put:",
  9662. protocol: "accessing",
  9663. fn: function (aKey,aValue){
  9664. var self=this,$self=this;
  9665. return $core.withContext(function($ctx1) {
  9666. return $self._basicAt_put_(aKey,aValue);
  9667. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9668. },
  9669. args: ["aKey", "aValue"],
  9670. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9671. referencedClasses: [],
  9672. messageSends: ["basicAt:put:"]
  9673. }),
  9674. $globals.HashedCollection);
  9675. $core.addMethod(
  9676. $core.method({
  9677. selector: "includesKey:",
  9678. protocol: "testing",
  9679. fn: function (aKey){
  9680. var self=this,$self=this;
  9681. return $core.withContext(function($ctx1) {
  9682. return self.hasOwnProperty(aKey);
  9683. return self;
  9684. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9685. },
  9686. args: ["aKey"],
  9687. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9688. referencedClasses: [],
  9689. messageSends: []
  9690. }),
  9691. $globals.HashedCollection);
  9692. $core.addMethod(
  9693. $core.method({
  9694. selector: "keys",
  9695. protocol: "accessing",
  9696. fn: function (){
  9697. var self=this,$self=this;
  9698. return $core.withContext(function($ctx1) {
  9699. return Object.keys(self);
  9700. return self;
  9701. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9702. },
  9703. args: [],
  9704. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9705. referencedClasses: [],
  9706. messageSends: []
  9707. }),
  9708. $globals.HashedCollection);
  9709. $core.addMethod(
  9710. $core.method({
  9711. selector: "keysDo:",
  9712. protocol: "enumerating",
  9713. fn: function (aBlock){
  9714. var self=this,$self=this;
  9715. return $core.withContext(function($ctx1) {
  9716. $recv($self._keys())._do_(aBlock);
  9717. return self;
  9718. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9719. },
  9720. args: ["aBlock"],
  9721. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9722. referencedClasses: [],
  9723. messageSends: ["do:", "keys"]
  9724. }),
  9725. $globals.HashedCollection);
  9726. $core.addMethod(
  9727. $core.method({
  9728. selector: "removeKey:ifAbsent:",
  9729. protocol: "adding/removing",
  9730. fn: function (aKey,aBlock){
  9731. var self=this,$self=this;
  9732. return $core.withContext(function($ctx1) {
  9733. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9734. return $core.withContext(function($ctx2) {
  9735. $self._basicDelete_(aKey);
  9736. return removed;
  9737. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9738. }),(function(){
  9739. return $core.withContext(function($ctx2) {
  9740. return $recv(aBlock)._value();
  9741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9742. }));
  9743. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9744. },
  9745. args: ["aKey", "aBlock"],
  9746. 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 ]",
  9747. referencedClasses: [],
  9748. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9749. }),
  9750. $globals.HashedCollection);
  9751. $core.addMethod(
  9752. $core.method({
  9753. selector: "values",
  9754. protocol: "accessing",
  9755. fn: function (){
  9756. var self=this,$self=this;
  9757. return $core.withContext(function($ctx1) {
  9758. return $self._keys().map(function(key){
  9759. return $self._at_(key);
  9760. });
  9761. ;
  9762. return self;
  9763. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9764. },
  9765. args: [],
  9766. 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'>",
  9767. referencedClasses: [],
  9768. messageSends: []
  9769. }),
  9770. $globals.HashedCollection);
  9771. $core.addMethod(
  9772. $core.method({
  9773. selector: "valuesDo:",
  9774. protocol: "enumerating",
  9775. fn: function (aBlock){
  9776. var self=this,$self=this;
  9777. return $core.withContext(function($ctx1) {
  9778. $recv($self._values())._do_(aBlock);
  9779. return self;
  9780. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9781. },
  9782. args: ["aBlock"],
  9783. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9784. referencedClasses: [],
  9785. messageSends: ["do:", "values"]
  9786. }),
  9787. $globals.HashedCollection);
  9788. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  9789. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9790. $core.addMethod(
  9791. $core.method({
  9792. selector: "=",
  9793. protocol: "comparing",
  9794. fn: function (aCollection){
  9795. var self=this,$self=this;
  9796. return $core.withContext(function($ctx1) {
  9797. var $3,$2,$4,$1,$5;
  9798. var $early={};
  9799. try {
  9800. $3=$self._class();
  9801. $ctx1.sendIdx["class"]=1;
  9802. $2=$recv($3).__eq($recv(aCollection)._class());
  9803. $ctx1.sendIdx["="]=1;
  9804. $1=$recv($2)._and_((function(){
  9805. return $core.withContext(function($ctx2) {
  9806. $4=$self._size();
  9807. $ctx2.sendIdx["size"]=1;
  9808. return $recv($4).__eq($recv(aCollection)._size());
  9809. $ctx2.sendIdx["="]=2;
  9810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9811. }));
  9812. if(!$core.assert($1)){
  9813. return false;
  9814. }
  9815. $self._withIndexDo_((function(each,i){
  9816. return $core.withContext(function($ctx2) {
  9817. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9818. if(!$core.assert($5)){
  9819. throw $early=[false];
  9820. }
  9821. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9822. }));
  9823. return true;
  9824. }
  9825. catch(e) {if(e===$early)return e[0]; throw e}
  9826. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9827. },
  9828. args: ["aCollection"],
  9829. 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",
  9830. referencedClasses: [],
  9831. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9832. }),
  9833. $globals.SequenceableCollection);
  9834. $core.addMethod(
  9835. $core.method({
  9836. selector: "addLast:",
  9837. protocol: "adding/removing",
  9838. fn: function (anObject){
  9839. var self=this,$self=this;
  9840. return $core.withContext(function($ctx1) {
  9841. $self._add_(anObject);
  9842. return self;
  9843. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9844. },
  9845. args: ["anObject"],
  9846. source: "addLast: anObject\x0a\x09self add: anObject",
  9847. referencedClasses: [],
  9848. messageSends: ["add:"]
  9849. }),
  9850. $globals.SequenceableCollection);
  9851. $core.addMethod(
  9852. $core.method({
  9853. selector: "allButFirst",
  9854. protocol: "accessing",
  9855. fn: function (){
  9856. var self=this,$self=this;
  9857. return $core.withContext(function($ctx1) {
  9858. return $self._copyFrom_to_((2),$self._size());
  9859. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9860. },
  9861. args: [],
  9862. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9863. referencedClasses: [],
  9864. messageSends: ["copyFrom:to:", "size"]
  9865. }),
  9866. $globals.SequenceableCollection);
  9867. $core.addMethod(
  9868. $core.method({
  9869. selector: "allButLast",
  9870. protocol: "accessing",
  9871. fn: function (){
  9872. var self=this,$self=this;
  9873. return $core.withContext(function($ctx1) {
  9874. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9875. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9876. },
  9877. args: [],
  9878. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9879. referencedClasses: [],
  9880. messageSends: ["copyFrom:to:", "-", "size"]
  9881. }),
  9882. $globals.SequenceableCollection);
  9883. $core.addMethod(
  9884. $core.method({
  9885. selector: "anyOne",
  9886. protocol: "accessing",
  9887. fn: function (){
  9888. var self=this,$self=this;
  9889. return $core.withContext(function($ctx1) {
  9890. return $self._at_((1));
  9891. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9892. },
  9893. args: [],
  9894. source: "anyOne\x0a\x09^ self at: 1",
  9895. referencedClasses: [],
  9896. messageSends: ["at:"]
  9897. }),
  9898. $globals.SequenceableCollection);
  9899. $core.addMethod(
  9900. $core.method({
  9901. selector: "atRandom",
  9902. protocol: "accessing",
  9903. fn: function (){
  9904. var self=this,$self=this;
  9905. return $core.withContext(function($ctx1) {
  9906. return $self._at_($recv($self._size())._atRandom());
  9907. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9908. },
  9909. args: [],
  9910. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9911. referencedClasses: [],
  9912. messageSends: ["at:", "atRandom", "size"]
  9913. }),
  9914. $globals.SequenceableCollection);
  9915. $core.addMethod(
  9916. $core.method({
  9917. selector: "beginsWith:",
  9918. protocol: "testing",
  9919. fn: function (prefix){
  9920. var self=this,$self=this;
  9921. return $core.withContext(function($ctx1) {
  9922. var $2,$3,$1;
  9923. $2=$self._size();
  9924. $ctx1.sendIdx["size"]=1;
  9925. $3=$recv(prefix)._size();
  9926. $ctx1.sendIdx["size"]=2;
  9927. $1=$recv($2).__lt($3);
  9928. if($core.assert($1)){
  9929. return false;
  9930. }
  9931. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9932. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9933. },
  9934. args: ["prefix"],
  9935. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9936. referencedClasses: [],
  9937. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9938. }),
  9939. $globals.SequenceableCollection);
  9940. $core.addMethod(
  9941. $core.method({
  9942. selector: "copyFrom:to:",
  9943. protocol: "copying",
  9944. fn: function (anIndex,anotherIndex){
  9945. var self=this,$self=this;
  9946. return $core.withContext(function($ctx1) {
  9947. $self._subclassResponsibility();
  9948. return self;
  9949. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  9950. },
  9951. args: ["anIndex", "anotherIndex"],
  9952. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  9953. referencedClasses: [],
  9954. messageSends: ["subclassResponsibility"]
  9955. }),
  9956. $globals.SequenceableCollection);
  9957. $core.addMethod(
  9958. $core.method({
  9959. selector: "detect:ifNone:",
  9960. protocol: "enumerating",
  9961. fn: function (aBlock,anotherBlock){
  9962. var self=this,$self=this;
  9963. return $core.withContext(function($ctx1) {
  9964. var nself = $self._numericallyIndexable();
  9965. for(var i = 0; i < nself.length; i++)
  9966. if(aBlock._value_(nself[i]))
  9967. return nself[i];
  9968. return anotherBlock._value();
  9969. ;
  9970. return self;
  9971. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  9972. },
  9973. args: ["aBlock", "anotherBlock"],
  9974. 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'>",
  9975. referencedClasses: [],
  9976. messageSends: []
  9977. }),
  9978. $globals.SequenceableCollection);
  9979. $core.addMethod(
  9980. $core.method({
  9981. selector: "do:",
  9982. protocol: "enumerating",
  9983. fn: function (aBlock){
  9984. var self=this,$self=this;
  9985. return $core.withContext(function($ctx1) {
  9986. var nself = $self._numericallyIndexable();
  9987. for(var i=0; i < nself.length; i++) {
  9988. aBlock._value_(nself[i]);
  9989. }
  9990. ;
  9991. return self;
  9992. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  9993. },
  9994. args: ["aBlock"],
  9995. 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'>",
  9996. referencedClasses: [],
  9997. messageSends: []
  9998. }),
  9999. $globals.SequenceableCollection);
  10000. $core.addMethod(
  10001. $core.method({
  10002. selector: "endsWith:",
  10003. protocol: "testing",
  10004. fn: function (suffix){
  10005. var self=this,$self=this;
  10006. return $core.withContext(function($ctx1) {
  10007. var $2,$3,$1;
  10008. $2=$self._size();
  10009. $ctx1.sendIdx["size"]=1;
  10010. $3=$recv(suffix)._size();
  10011. $ctx1.sendIdx["size"]=2;
  10012. $1=$recv($2).__lt($3);
  10013. if($core.assert($1)){
  10014. return false;
  10015. }
  10016. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10017. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  10018. },
  10019. args: ["suffix"],
  10020. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10021. referencedClasses: [],
  10022. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10023. }),
  10024. $globals.SequenceableCollection);
  10025. $core.addMethod(
  10026. $core.method({
  10027. selector: "first",
  10028. protocol: "accessing",
  10029. fn: function (){
  10030. var self=this,$self=this;
  10031. return $core.withContext(function($ctx1) {
  10032. return $self._at_((1));
  10033. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10034. },
  10035. args: [],
  10036. source: "first\x0a\x09^ self at: 1",
  10037. referencedClasses: [],
  10038. messageSends: ["at:"]
  10039. }),
  10040. $globals.SequenceableCollection);
  10041. $core.addMethod(
  10042. $core.method({
  10043. selector: "first:",
  10044. protocol: "accessing",
  10045. fn: function (aNumber){
  10046. var self=this,$self=this;
  10047. return $core.withContext(function($ctx1) {
  10048. var $1;
  10049. $1=$recv($self._size()).__lt(aNumber);
  10050. if($core.assert($1)){
  10051. $self._error_("Invalid number of elements");
  10052. }
  10053. return $self._copyFrom_to_((1),aNumber);
  10054. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10055. },
  10056. args: ["aNumber"],
  10057. 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",
  10058. referencedClasses: [],
  10059. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10060. }),
  10061. $globals.SequenceableCollection);
  10062. $core.addMethod(
  10063. $core.method({
  10064. selector: "fourth",
  10065. protocol: "accessing",
  10066. fn: function (){
  10067. var self=this,$self=this;
  10068. return $core.withContext(function($ctx1) {
  10069. return $self._at_((4));
  10070. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10071. },
  10072. args: [],
  10073. source: "fourth\x0a\x09^ self at: 4",
  10074. referencedClasses: [],
  10075. messageSends: ["at:"]
  10076. }),
  10077. $globals.SequenceableCollection);
  10078. $core.addMethod(
  10079. $core.method({
  10080. selector: "includes:",
  10081. protocol: "testing",
  10082. fn: function (anObject){
  10083. var self=this,$self=this;
  10084. return $core.withContext(function($ctx1) {
  10085. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10086. return nil;
  10087. })))._notNil();
  10088. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10089. },
  10090. args: ["anObject"],
  10091. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10092. referencedClasses: [],
  10093. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10094. }),
  10095. $globals.SequenceableCollection);
  10096. $core.addMethod(
  10097. $core.method({
  10098. selector: "indexOf:ifAbsent:",
  10099. protocol: "accessing",
  10100. fn: function (anObject,aBlock){
  10101. var self=this,$self=this;
  10102. return $core.withContext(function($ctx1) {
  10103. var nself = $self._numericallyIndexable();
  10104. for(var i=0; i < nself.length; i++) {
  10105. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10106. };
  10107. return aBlock._value();
  10108. ;
  10109. return self;
  10110. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  10111. },
  10112. args: ["anObject", "aBlock"],
  10113. 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'>",
  10114. referencedClasses: [],
  10115. messageSends: []
  10116. }),
  10117. $globals.SequenceableCollection);
  10118. $core.addMethod(
  10119. $core.method({
  10120. selector: "indexOf:startingAt:",
  10121. protocol: "accessing",
  10122. fn: function (anObject,start){
  10123. var self=this,$self=this;
  10124. return $core.withContext(function($ctx1) {
  10125. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10126. return (0);
  10127. }));
  10128. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10129. },
  10130. args: ["anObject", "start"],
  10131. 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 ]",
  10132. referencedClasses: [],
  10133. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10134. }),
  10135. $globals.SequenceableCollection);
  10136. $core.addMethod(
  10137. $core.method({
  10138. selector: "indexOf:startingAt:ifAbsent:",
  10139. protocol: "accessing",
  10140. fn: function (anObject,start,aBlock){
  10141. var self=this,$self=this;
  10142. return $core.withContext(function($ctx1) {
  10143. var nself = $self._numericallyIndexable();
  10144. for(var i=start - 1; i < nself.length; i++){
  10145. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10146. }
  10147. return aBlock._value();
  10148. ;
  10149. return self;
  10150. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10151. },
  10152. args: ["anObject", "start", "aBlock"],
  10153. 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'>",
  10154. referencedClasses: [],
  10155. messageSends: []
  10156. }),
  10157. $globals.SequenceableCollection);
  10158. $core.addMethod(
  10159. $core.method({
  10160. selector: "last",
  10161. protocol: "accessing",
  10162. fn: function (){
  10163. var self=this,$self=this;
  10164. return $core.withContext(function($ctx1) {
  10165. return $self._at_($self._size());
  10166. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10167. },
  10168. args: [],
  10169. source: "last\x0a\x09^ self at: self size",
  10170. referencedClasses: [],
  10171. messageSends: ["at:", "size"]
  10172. }),
  10173. $globals.SequenceableCollection);
  10174. $core.addMethod(
  10175. $core.method({
  10176. selector: "last:",
  10177. protocol: "accessing",
  10178. fn: function (aNumber){
  10179. var self=this,$self=this;
  10180. return $core.withContext(function($ctx1) {
  10181. var $2,$1,$5,$4,$3;
  10182. $2=$self._size();
  10183. $ctx1.sendIdx["size"]=1;
  10184. $1=$recv($2).__lt(aNumber);
  10185. if($core.assert($1)){
  10186. $self._error_("Invalid number of elements");
  10187. }
  10188. $5=$self._size();
  10189. $ctx1.sendIdx["size"]=2;
  10190. $4=$recv($5).__minus(aNumber);
  10191. $3=$recv($4).__plus((1));
  10192. return $self._copyFrom_to_($3,$self._size());
  10193. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10194. },
  10195. args: ["aNumber"],
  10196. 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",
  10197. referencedClasses: [],
  10198. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10199. }),
  10200. $globals.SequenceableCollection);
  10201. $core.addMethod(
  10202. $core.method({
  10203. selector: "newStream",
  10204. protocol: "streaming",
  10205. fn: function (){
  10206. var self=this,$self=this;
  10207. return $core.withContext(function($ctx1) {
  10208. return $recv($self._streamClass())._on_(self);
  10209. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10210. },
  10211. args: [],
  10212. source: "newStream\x0a\x09^ self streamClass on: self",
  10213. referencedClasses: [],
  10214. messageSends: ["on:", "streamClass"]
  10215. }),
  10216. $globals.SequenceableCollection);
  10217. $core.addMethod(
  10218. $core.method({
  10219. selector: "numericallyIndexable",
  10220. protocol: "private",
  10221. fn: function (){
  10222. var self=this,$self=this;
  10223. return $core.withContext(function($ctx1) {
  10224. $self._subclassResponsibility();
  10225. return self;
  10226. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  10227. },
  10228. args: [],
  10229. 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",
  10230. referencedClasses: [],
  10231. messageSends: ["subclassResponsibility"]
  10232. }),
  10233. $globals.SequenceableCollection);
  10234. $core.addMethod(
  10235. $core.method({
  10236. selector: "readStream",
  10237. protocol: "streaming",
  10238. fn: function (){
  10239. var self=this,$self=this;
  10240. return $core.withContext(function($ctx1) {
  10241. return $self._stream();
  10242. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10243. },
  10244. args: [],
  10245. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10246. referencedClasses: [],
  10247. messageSends: ["stream"]
  10248. }),
  10249. $globals.SequenceableCollection);
  10250. $core.addMethod(
  10251. $core.method({
  10252. selector: "removeLast",
  10253. protocol: "adding/removing",
  10254. fn: function (){
  10255. var self=this,$self=this;
  10256. return $core.withContext(function($ctx1) {
  10257. return $self._remove_($self._last());
  10258. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10259. },
  10260. args: [],
  10261. source: "removeLast\x0a\x09^ self remove: self last",
  10262. referencedClasses: [],
  10263. messageSends: ["remove:", "last"]
  10264. }),
  10265. $globals.SequenceableCollection);
  10266. $core.addMethod(
  10267. $core.method({
  10268. selector: "reverseDo:",
  10269. protocol: "enumerating",
  10270. fn: function (aBlock){
  10271. var self=this,$self=this;
  10272. return $core.withContext(function($ctx1) {
  10273. $recv($self._reversed())._do_(aBlock);
  10274. return self;
  10275. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10276. },
  10277. args: ["aBlock"],
  10278. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10279. referencedClasses: [],
  10280. messageSends: ["do:", "reversed"]
  10281. }),
  10282. $globals.SequenceableCollection);
  10283. $core.addMethod(
  10284. $core.method({
  10285. selector: "reversed",
  10286. protocol: "converting",
  10287. fn: function (){
  10288. var self=this,$self=this;
  10289. return $core.withContext(function($ctx1) {
  10290. $self._subclassResponsibility();
  10291. return self;
  10292. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10293. },
  10294. args: [],
  10295. source: "reversed\x0a\x09self subclassResponsibility",
  10296. referencedClasses: [],
  10297. messageSends: ["subclassResponsibility"]
  10298. }),
  10299. $globals.SequenceableCollection);
  10300. $core.addMethod(
  10301. $core.method({
  10302. selector: "second",
  10303. protocol: "accessing",
  10304. fn: function (){
  10305. var self=this,$self=this;
  10306. return $core.withContext(function($ctx1) {
  10307. return $self._at_((2));
  10308. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10309. },
  10310. args: [],
  10311. source: "second\x0a\x09^ self at: 2",
  10312. referencedClasses: [],
  10313. messageSends: ["at:"]
  10314. }),
  10315. $globals.SequenceableCollection);
  10316. $core.addMethod(
  10317. $core.method({
  10318. selector: "single",
  10319. protocol: "accessing",
  10320. fn: function (){
  10321. var self=this,$self=this;
  10322. return $core.withContext(function($ctx1) {
  10323. if (self.length == 0) throw new Error("Collection is empty");
  10324. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10325. return $self._numericallyIndexable()[0];;
  10326. return self;
  10327. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  10328. },
  10329. args: [],
  10330. 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'>",
  10331. referencedClasses: [],
  10332. messageSends: []
  10333. }),
  10334. $globals.SequenceableCollection);
  10335. $core.addMethod(
  10336. $core.method({
  10337. selector: "stream",
  10338. protocol: "streaming",
  10339. fn: function (){
  10340. var self=this,$self=this;
  10341. return $core.withContext(function($ctx1) {
  10342. return $self._newStream();
  10343. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10344. },
  10345. args: [],
  10346. source: "stream\x0a\x09^ self newStream",
  10347. referencedClasses: [],
  10348. messageSends: ["newStream"]
  10349. }),
  10350. $globals.SequenceableCollection);
  10351. $core.addMethod(
  10352. $core.method({
  10353. selector: "streamClass",
  10354. protocol: "streaming",
  10355. fn: function (){
  10356. var self=this,$self=this;
  10357. return $core.withContext(function($ctx1) {
  10358. return $recv($self._class())._streamClass();
  10359. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10360. },
  10361. args: [],
  10362. source: "streamClass\x0a\x09^ self class streamClass",
  10363. referencedClasses: [],
  10364. messageSends: ["streamClass", "class"]
  10365. }),
  10366. $globals.SequenceableCollection);
  10367. $core.addMethod(
  10368. $core.method({
  10369. selector: "third",
  10370. protocol: "accessing",
  10371. fn: function (){
  10372. var self=this,$self=this;
  10373. return $core.withContext(function($ctx1) {
  10374. return $self._at_((3));
  10375. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10376. },
  10377. args: [],
  10378. source: "third\x0a\x09^ self at: 3",
  10379. referencedClasses: [],
  10380. messageSends: ["at:"]
  10381. }),
  10382. $globals.SequenceableCollection);
  10383. $core.addMethod(
  10384. $core.method({
  10385. selector: "with:do:",
  10386. protocol: "enumerating",
  10387. fn: function (anotherCollection,aBlock){
  10388. var self=this,$self=this;
  10389. return $core.withContext(function($ctx1) {
  10390. var nself = $self._numericallyIndexable();
  10391. anotherCollection = anotherCollection._numericallyIndexable();
  10392. for(var i=0; i<nself.length; i++) {
  10393. aBlock._value_value_(nself[i], anotherCollection[i]);
  10394. }
  10395. ;
  10396. return self;
  10397. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  10398. },
  10399. args: ["anotherCollection", "aBlock"],
  10400. 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'>",
  10401. referencedClasses: [],
  10402. messageSends: []
  10403. }),
  10404. $globals.SequenceableCollection);
  10405. $core.addMethod(
  10406. $core.method({
  10407. selector: "withIndexDo:",
  10408. protocol: "enumerating",
  10409. fn: function (aBlock){
  10410. var self=this,$self=this;
  10411. return $core.withContext(function($ctx1) {
  10412. var nself = $self._numericallyIndexable();
  10413. for(var i=0; i < nself.length; i++) {
  10414. aBlock._value_value_(nself[i], i+1);
  10415. }
  10416. ;
  10417. return self;
  10418. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10419. },
  10420. args: ["aBlock"],
  10421. 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'>",
  10422. referencedClasses: [],
  10423. messageSends: []
  10424. }),
  10425. $globals.SequenceableCollection);
  10426. $core.addMethod(
  10427. $core.method({
  10428. selector: "writeStream",
  10429. protocol: "streaming",
  10430. fn: function (){
  10431. var self=this,$self=this;
  10432. return $core.withContext(function($ctx1) {
  10433. return $self._stream();
  10434. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10435. },
  10436. args: [],
  10437. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10438. referencedClasses: [],
  10439. messageSends: ["stream"]
  10440. }),
  10441. $globals.SequenceableCollection);
  10442. $core.addMethod(
  10443. $core.method({
  10444. selector: "streamClass",
  10445. protocol: "accessing",
  10446. fn: function (){
  10447. var self=this,$self=this;
  10448. return $globals.Stream;
  10449. },
  10450. args: [],
  10451. source: "streamClass\x0a\x09\x09^ Stream",
  10452. referencedClasses: ["Stream"],
  10453. messageSends: []
  10454. }),
  10455. $globals.SequenceableCollection.a$cls);
  10456. $core.addMethod(
  10457. $core.method({
  10458. selector: "streamContents:",
  10459. protocol: "streaming",
  10460. fn: function (aBlock){
  10461. var self=this,$self=this;
  10462. var stream;
  10463. return $core.withContext(function($ctx1) {
  10464. stream=$recv($self._streamClass())._on_($self._new());
  10465. $recv(aBlock)._value_(stream);
  10466. return $recv(stream)._contents();
  10467. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10468. },
  10469. args: ["aBlock"],
  10470. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10471. referencedClasses: [],
  10472. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10473. }),
  10474. $globals.SequenceableCollection.a$cls);
  10475. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10476. $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`.";
  10477. $core.addMethod(
  10478. $core.method({
  10479. selector: "add:",
  10480. protocol: "adding/removing",
  10481. fn: function (anObject){
  10482. var self=this,$self=this;
  10483. return $core.withContext(function($ctx1) {
  10484. self.push(anObject); return anObject;;
  10485. return self;
  10486. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10487. },
  10488. args: ["anObject"],
  10489. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10490. referencedClasses: [],
  10491. messageSends: []
  10492. }),
  10493. $globals.Array);
  10494. $core.addMethod(
  10495. $core.method({
  10496. selector: "addAll:",
  10497. protocol: "adding/removing",
  10498. fn: function (aCollection){
  10499. var self=this,$self=this;
  10500. return $core.withContext(function($ctx1) {
  10501. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10502. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10503. return aCollection;;
  10504. return self;
  10505. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10506. },
  10507. args: ["aCollection"],
  10508. 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'>",
  10509. referencedClasses: [],
  10510. messageSends: []
  10511. }),
  10512. $globals.Array);
  10513. $core.addMethod(
  10514. $core.method({
  10515. selector: "addFirst:",
  10516. protocol: "adding/removing",
  10517. fn: function (anObject){
  10518. var self=this,$self=this;
  10519. return $core.withContext(function($ctx1) {
  10520. self.unshift(anObject); return anObject;;
  10521. return self;
  10522. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10523. },
  10524. args: ["anObject"],
  10525. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10526. referencedClasses: [],
  10527. messageSends: []
  10528. }),
  10529. $globals.Array);
  10530. $core.addMethod(
  10531. $core.method({
  10532. selector: "asJavaScriptSource",
  10533. protocol: "converting",
  10534. fn: function (){
  10535. var self=this,$self=this;
  10536. return $core.withContext(function($ctx1) {
  10537. var $1;
  10538. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10539. return $core.withContext(function($ctx2) {
  10540. return $recv(each)._asJavaScriptSource();
  10541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10542. })))._join_(", "))).__comma("]");
  10543. $ctx1.sendIdx[","]=1;
  10544. return $1;
  10545. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10546. },
  10547. args: [],
  10548. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10549. referencedClasses: [],
  10550. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10551. }),
  10552. $globals.Array);
  10553. $core.addMethod(
  10554. $core.method({
  10555. selector: "at:ifAbsent:",
  10556. protocol: "accessing",
  10557. fn: function (anIndex,aBlock){
  10558. var self=this,$self=this;
  10559. return $core.withContext(function($ctx1) {
  10560. return anIndex >= 1 && anIndex <= self.length
  10561. ? self[anIndex - 1]
  10562. : aBlock._value()
  10563. ;
  10564. return self;
  10565. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  10566. },
  10567. args: ["anIndex", "aBlock"],
  10568. 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'>",
  10569. referencedClasses: [],
  10570. messageSends: []
  10571. }),
  10572. $globals.Array);
  10573. $core.addMethod(
  10574. $core.method({
  10575. selector: "at:ifPresent:ifAbsent:",
  10576. protocol: "accessing",
  10577. fn: function (anIndex,aBlock,anotherBlock){
  10578. var self=this,$self=this;
  10579. return $core.withContext(function($ctx1) {
  10580. return anIndex >= 1 && anIndex <= self.length
  10581. ? aBlock._value_(self[anIndex - 1])
  10582. : anotherBlock._value()
  10583. ;
  10584. return self;
  10585. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  10586. },
  10587. args: ["anIndex", "aBlock", "anotherBlock"],
  10588. 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'>",
  10589. referencedClasses: [],
  10590. messageSends: []
  10591. }),
  10592. $globals.Array);
  10593. $core.addMethod(
  10594. $core.method({
  10595. selector: "at:put:",
  10596. protocol: "accessing",
  10597. fn: function (anIndex,anObject){
  10598. var self=this,$self=this;
  10599. return $core.withContext(function($ctx1) {
  10600. return self[anIndex - 1] = anObject;
  10601. return self;
  10602. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10603. },
  10604. args: ["anIndex", "anObject"],
  10605. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10606. referencedClasses: [],
  10607. messageSends: []
  10608. }),
  10609. $globals.Array);
  10610. $core.addMethod(
  10611. $core.method({
  10612. selector: "collect:",
  10613. protocol: "enumerating",
  10614. fn: function (aBlock){
  10615. var self=this,$self=this;
  10616. return $core.withContext(function($ctx1) {
  10617. return self.map(function(each) {return aBlock._value_(each)});
  10618. return self;
  10619. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10620. },
  10621. args: ["aBlock"],
  10622. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10623. referencedClasses: [],
  10624. messageSends: []
  10625. }),
  10626. $globals.Array);
  10627. $core.addMethod(
  10628. $core.method({
  10629. selector: "copyFrom:to:",
  10630. protocol: "copying",
  10631. fn: function (anIndex,anotherIndex){
  10632. var self=this,$self=this;
  10633. return $core.withContext(function($ctx1) {
  10634. if (anIndex >= 1 && anotherIndex <= self.length) {
  10635. return self.slice(anIndex - 1, anotherIndex);
  10636. } else {
  10637. self._at_(anIndex);
  10638. self._at_(self.length + 1);
  10639. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10640. };
  10641. return self;
  10642. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10643. },
  10644. args: ["anIndex", "anotherIndex"],
  10645. 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'>",
  10646. referencedClasses: [],
  10647. messageSends: []
  10648. }),
  10649. $globals.Array);
  10650. $core.addMethod(
  10651. $core.method({
  10652. selector: "join:",
  10653. protocol: "enumerating",
  10654. fn: function (aString){
  10655. var self=this,$self=this;
  10656. return $core.withContext(function($ctx1) {
  10657. return self.join(aString);
  10658. return self;
  10659. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10660. },
  10661. args: ["aString"],
  10662. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10663. referencedClasses: [],
  10664. messageSends: []
  10665. }),
  10666. $globals.Array);
  10667. $core.addMethod(
  10668. $core.method({
  10669. selector: "numericallyIndexable",
  10670. protocol: "private",
  10671. fn: function (){
  10672. var self=this,$self=this;
  10673. return self;
  10674. },
  10675. args: [],
  10676. source: "numericallyIndexable\x0a\x09^ self",
  10677. referencedClasses: [],
  10678. messageSends: []
  10679. }),
  10680. $globals.Array);
  10681. $core.addMethod(
  10682. $core.method({
  10683. selector: "printOn:",
  10684. protocol: "printing",
  10685. fn: function (aStream){
  10686. var self=this,$self=this;
  10687. return $core.withContext(function($ctx1) {
  10688. (
  10689. $ctx1.supercall = true,
  10690. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10691. $ctx1.supercall = false;
  10692. $ctx1.sendIdx["printOn:"]=1;
  10693. $recv(aStream)._nextPutAll_(" (");
  10694. $ctx1.sendIdx["nextPutAll:"]=1;
  10695. $self._do_separatedBy_((function(each){
  10696. return $core.withContext(function($ctx2) {
  10697. return $recv(each)._printOn_(aStream);
  10698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10699. }),(function(){
  10700. return $core.withContext(function($ctx2) {
  10701. return $recv(aStream)._nextPutAll_(" ");
  10702. $ctx2.sendIdx["nextPutAll:"]=2;
  10703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10704. }));
  10705. $recv(aStream)._nextPutAll_(")");
  10706. return self;
  10707. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10708. },
  10709. args: ["aStream"],
  10710. 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: ')'",
  10711. referencedClasses: [],
  10712. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10713. }),
  10714. $globals.Array);
  10715. $core.addMethod(
  10716. $core.method({
  10717. selector: "remove:ifAbsent:",
  10718. protocol: "adding/removing",
  10719. fn: function (anObject,aBlock){
  10720. var self=this,$self=this;
  10721. var index;
  10722. return $core.withContext(function($ctx1) {
  10723. var $1;
  10724. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10725. return (0);
  10726. }));
  10727. $1=$recv(index).__eq((0));
  10728. if($core.assert($1)){
  10729. return $recv(aBlock)._value();
  10730. } else {
  10731. $self._removeIndex_(index);
  10732. return anObject;
  10733. }
  10734. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10735. },
  10736. args: ["anObject", "aBlock"],
  10737. 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 ]",
  10738. referencedClasses: [],
  10739. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10740. }),
  10741. $globals.Array);
  10742. $core.addMethod(
  10743. $core.method({
  10744. selector: "removeAll",
  10745. protocol: "adding/removing",
  10746. fn: function (){
  10747. var self=this,$self=this;
  10748. return $core.withContext(function($ctx1) {
  10749. self.length = 0;
  10750. return self;
  10751. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10752. },
  10753. args: [],
  10754. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10755. referencedClasses: [],
  10756. messageSends: []
  10757. }),
  10758. $globals.Array);
  10759. $core.addMethod(
  10760. $core.method({
  10761. selector: "removeFrom:to:",
  10762. protocol: "adding/removing",
  10763. fn: function (aNumber,anotherNumber){
  10764. var self=this,$self=this;
  10765. return $core.withContext(function($ctx1) {
  10766. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10767. return self;
  10768. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10769. },
  10770. args: ["aNumber", "anotherNumber"],
  10771. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10772. referencedClasses: [],
  10773. messageSends: []
  10774. }),
  10775. $globals.Array);
  10776. $core.addMethod(
  10777. $core.method({
  10778. selector: "removeIndex:",
  10779. protocol: "adding/removing",
  10780. fn: function (anInteger){
  10781. var self=this,$self=this;
  10782. return $core.withContext(function($ctx1) {
  10783. self.splice(anInteger - 1, 1);
  10784. return self;
  10785. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10786. },
  10787. args: ["anInteger"],
  10788. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10789. referencedClasses: [],
  10790. messageSends: []
  10791. }),
  10792. $globals.Array);
  10793. $core.addMethod(
  10794. $core.method({
  10795. selector: "removeLast",
  10796. protocol: "adding/removing",
  10797. fn: function (){
  10798. var self=this,$self=this;
  10799. return $core.withContext(function($ctx1) {
  10800. return self.pop();;
  10801. return self;
  10802. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10803. },
  10804. args: [],
  10805. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10806. referencedClasses: [],
  10807. messageSends: []
  10808. }),
  10809. $globals.Array);
  10810. $core.addMethod(
  10811. $core.method({
  10812. selector: "reversed",
  10813. protocol: "converting",
  10814. fn: function (){
  10815. var self=this,$self=this;
  10816. return $core.withContext(function($ctx1) {
  10817. return self.slice().reverse();
  10818. return self;
  10819. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10820. },
  10821. args: [],
  10822. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10823. referencedClasses: [],
  10824. messageSends: []
  10825. }),
  10826. $globals.Array);
  10827. $core.addMethod(
  10828. $core.method({
  10829. selector: "select:",
  10830. protocol: "enumerating",
  10831. fn: function (aBlock){
  10832. var self=this,$self=this;
  10833. return $core.withContext(function($ctx1) {
  10834. return self.filter(function(each) {return aBlock._value_(each)});
  10835. return self;
  10836. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10837. },
  10838. args: ["aBlock"],
  10839. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10840. referencedClasses: [],
  10841. messageSends: []
  10842. }),
  10843. $globals.Array);
  10844. $core.addMethod(
  10845. $core.method({
  10846. selector: "shallowCopy",
  10847. protocol: "copying",
  10848. fn: function (){
  10849. var self=this,$self=this;
  10850. return $core.withContext(function($ctx1) {
  10851. return self.slice();
  10852. return self;
  10853. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10854. },
  10855. args: [],
  10856. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10857. referencedClasses: [],
  10858. messageSends: []
  10859. }),
  10860. $globals.Array);
  10861. $core.addMethod(
  10862. $core.method({
  10863. selector: "size",
  10864. protocol: "accessing",
  10865. fn: function (){
  10866. var self=this,$self=this;
  10867. return $core.withContext(function($ctx1) {
  10868. return self.length;
  10869. return self;
  10870. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10871. },
  10872. args: [],
  10873. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10874. referencedClasses: [],
  10875. messageSends: []
  10876. }),
  10877. $globals.Array);
  10878. $core.addMethod(
  10879. $core.method({
  10880. selector: "sort",
  10881. protocol: "enumerating",
  10882. fn: function (){
  10883. var self=this,$self=this;
  10884. return $core.withContext(function($ctx1) {
  10885. return $self._sort_((function(a,b){
  10886. return $core.withContext(function($ctx2) {
  10887. return $recv(a).__lt(b);
  10888. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10889. }));
  10890. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10891. },
  10892. args: [],
  10893. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10894. referencedClasses: [],
  10895. messageSends: ["sort:", "<"]
  10896. }),
  10897. $globals.Array);
  10898. $core.addMethod(
  10899. $core.method({
  10900. selector: "sort:",
  10901. protocol: "enumerating",
  10902. fn: function (aBlock){
  10903. var self=this,$self=this;
  10904. return $core.withContext(function($ctx1) {
  10905. return self.sort(function(a, b) {
  10906. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10907. })
  10908. ;
  10909. return self;
  10910. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10911. },
  10912. args: ["aBlock"],
  10913. 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'>",
  10914. referencedClasses: [],
  10915. messageSends: []
  10916. }),
  10917. $globals.Array);
  10918. $core.addMethod(
  10919. $core.method({
  10920. selector: "sorted",
  10921. protocol: "enumerating",
  10922. fn: function (){
  10923. var self=this,$self=this;
  10924. return $core.withContext(function($ctx1) {
  10925. return $recv($self._copy())._sort();
  10926. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10927. },
  10928. args: [],
  10929. source: "sorted\x0a\x09^ self copy sort",
  10930. referencedClasses: [],
  10931. messageSends: ["sort", "copy"]
  10932. }),
  10933. $globals.Array);
  10934. $core.addMethod(
  10935. $core.method({
  10936. selector: "sorted:",
  10937. protocol: "enumerating",
  10938. fn: function (aBlock){
  10939. var self=this,$self=this;
  10940. return $core.withContext(function($ctx1) {
  10941. return $recv($self._copy())._sort_(aBlock);
  10942. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10943. },
  10944. args: ["aBlock"],
  10945. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  10946. referencedClasses: [],
  10947. messageSends: ["sort:", "copy"]
  10948. }),
  10949. $globals.Array);
  10950. $core.addMethod(
  10951. $core.method({
  10952. selector: "new:",
  10953. protocol: "instance creation",
  10954. fn: function (anInteger){
  10955. var self=this,$self=this;
  10956. return $core.withContext(function($ctx1) {
  10957. return new Array(anInteger);
  10958. return self;
  10959. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  10960. },
  10961. args: ["anInteger"],
  10962. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  10963. referencedClasses: [],
  10964. messageSends: []
  10965. }),
  10966. $globals.Array.a$cls);
  10967. $core.addMethod(
  10968. $core.method({
  10969. selector: "with:",
  10970. protocol: "instance creation",
  10971. fn: function (anObject){
  10972. var self=this,$self=this;
  10973. return $core.withContext(function($ctx1) {
  10974. var $1;
  10975. $1=$self._new_((1));
  10976. $recv($1)._at_put_((1),anObject);
  10977. return $recv($1)._yourself();
  10978. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  10979. },
  10980. args: ["anObject"],
  10981. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  10982. referencedClasses: [],
  10983. messageSends: ["at:put:", "new:", "yourself"]
  10984. }),
  10985. $globals.Array.a$cls);
  10986. $core.addMethod(
  10987. $core.method({
  10988. selector: "with:with:",
  10989. protocol: "instance creation",
  10990. fn: function (anObject,anObject2){
  10991. var self=this,$self=this;
  10992. return $core.withContext(function($ctx1) {
  10993. var $1;
  10994. $1=$self._new_((2));
  10995. $recv($1)._at_put_((1),anObject);
  10996. $ctx1.sendIdx["at:put:"]=1;
  10997. $recv($1)._at_put_((2),anObject2);
  10998. return $recv($1)._yourself();
  10999. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  11000. },
  11001. args: ["anObject", "anObject2"],
  11002. 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",
  11003. referencedClasses: [],
  11004. messageSends: ["at:put:", "new:", "yourself"]
  11005. }),
  11006. $globals.Array.a$cls);
  11007. $core.addMethod(
  11008. $core.method({
  11009. selector: "with:with:with:",
  11010. protocol: "instance creation",
  11011. fn: function (anObject,anObject2,anObject3){
  11012. var self=this,$self=this;
  11013. return $core.withContext(function($ctx1) {
  11014. var $1;
  11015. $1=$self._new_((3));
  11016. $recv($1)._at_put_((1),anObject);
  11017. $ctx1.sendIdx["at:put:"]=1;
  11018. $recv($1)._at_put_((2),anObject2);
  11019. $ctx1.sendIdx["at:put:"]=2;
  11020. $recv($1)._at_put_((3),anObject3);
  11021. return $recv($1)._yourself();
  11022. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  11023. },
  11024. args: ["anObject", "anObject2", "anObject3"],
  11025. 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",
  11026. referencedClasses: [],
  11027. messageSends: ["at:put:", "new:", "yourself"]
  11028. }),
  11029. $globals.Array.a$cls);
  11030. $core.addMethod(
  11031. $core.method({
  11032. selector: "withAll:",
  11033. protocol: "instance creation",
  11034. fn: function (aCollection){
  11035. var self=this,$self=this;
  11036. var instance,index;
  11037. return $core.withContext(function($ctx1) {
  11038. index=(1);
  11039. instance=$self._new_($recv(aCollection)._size());
  11040. $recv(aCollection)._do_((function(each){
  11041. return $core.withContext(function($ctx2) {
  11042. $recv(instance)._at_put_(index,each);
  11043. index=$recv(index).__plus((1));
  11044. return index;
  11045. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11046. }));
  11047. return instance;
  11048. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  11049. },
  11050. args: ["aCollection"],
  11051. 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",
  11052. referencedClasses: [],
  11053. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11054. }),
  11055. $globals.Array.a$cls);
  11056. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  11057. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11058. $core.addMethod(
  11059. $core.method({
  11060. selector: ",",
  11061. protocol: "copying",
  11062. fn: function (aString){
  11063. var self=this,$self=this;
  11064. return $core.withContext(function($ctx1) {
  11065. var $1;
  11066. $1=$self._asString();
  11067. $ctx1.sendIdx["asString"]=1;
  11068. return $recv($1).__comma($recv(aString)._asString());
  11069. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  11070. },
  11071. args: ["aString"],
  11072. source: ", aString\x0a\x09^ self asString, aString asString",
  11073. referencedClasses: [],
  11074. messageSends: [",", "asString"]
  11075. }),
  11076. $globals.CharacterArray);
  11077. $core.addMethod(
  11078. $core.method({
  11079. selector: "add:",
  11080. protocol: "adding/removing",
  11081. fn: function (anObject){
  11082. var self=this,$self=this;
  11083. return $core.withContext(function($ctx1) {
  11084. $self._errorReadOnly();
  11085. return self;
  11086. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  11087. },
  11088. args: ["anObject"],
  11089. source: "add: anObject\x0a\x09self errorReadOnly",
  11090. referencedClasses: [],
  11091. messageSends: ["errorReadOnly"]
  11092. }),
  11093. $globals.CharacterArray);
  11094. $core.addMethod(
  11095. $core.method({
  11096. selector: "asLowercase",
  11097. protocol: "converting",
  11098. fn: function (){
  11099. var self=this,$self=this;
  11100. return $core.withContext(function($ctx1) {
  11101. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  11102. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  11103. },
  11104. args: [],
  11105. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  11106. referencedClasses: [],
  11107. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  11108. }),
  11109. $globals.CharacterArray);
  11110. $core.addMethod(
  11111. $core.method({
  11112. selector: "asNumber",
  11113. protocol: "converting",
  11114. fn: function (){
  11115. var self=this,$self=this;
  11116. return $core.withContext(function($ctx1) {
  11117. return $recv($self._asString())._asNumber();
  11118. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  11119. },
  11120. args: [],
  11121. source: "asNumber\x0a\x09^ self asString asNumber",
  11122. referencedClasses: [],
  11123. messageSends: ["asNumber", "asString"]
  11124. }),
  11125. $globals.CharacterArray);
  11126. $core.addMethod(
  11127. $core.method({
  11128. selector: "asString",
  11129. protocol: "converting",
  11130. fn: function (){
  11131. var self=this,$self=this;
  11132. return $core.withContext(function($ctx1) {
  11133. return $self._subclassResponsibility();
  11134. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  11135. },
  11136. args: [],
  11137. source: "asString\x0a\x09^ self subclassResponsibility",
  11138. referencedClasses: [],
  11139. messageSends: ["subclassResponsibility"]
  11140. }),
  11141. $globals.CharacterArray);
  11142. $core.addMethod(
  11143. $core.method({
  11144. selector: "asSymbol",
  11145. protocol: "converting",
  11146. fn: function (){
  11147. var self=this,$self=this;
  11148. return $core.withContext(function($ctx1) {
  11149. return $self._asString();
  11150. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  11151. },
  11152. args: [],
  11153. source: "asSymbol\x0a\x09^ self asString",
  11154. referencedClasses: [],
  11155. messageSends: ["asString"]
  11156. }),
  11157. $globals.CharacterArray);
  11158. $core.addMethod(
  11159. $core.method({
  11160. selector: "asSymbolPrintOn:",
  11161. protocol: "printing",
  11162. fn: function (aStream){
  11163. var self=this,$self=this;
  11164. return $core.withContext(function($ctx1) {
  11165. var $1;
  11166. $recv(aStream)._nextPutAll_("#");
  11167. $1=$recv($self._asString())._isSelector();
  11168. if($core.assert($1)){
  11169. $recv(aStream)._nextPut_(self);
  11170. } else {
  11171. $self._printOn_(aStream);
  11172. }
  11173. return self;
  11174. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  11175. },
  11176. args: ["aStream"],
  11177. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11178. referencedClasses: [],
  11179. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11180. }),
  11181. $globals.CharacterArray);
  11182. $core.addMethod(
  11183. $core.method({
  11184. selector: "asUppercase",
  11185. protocol: "converting",
  11186. fn: function (){
  11187. var self=this,$self=this;
  11188. return $core.withContext(function($ctx1) {
  11189. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  11190. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  11191. },
  11192. args: [],
  11193. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  11194. referencedClasses: [],
  11195. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  11196. }),
  11197. $globals.CharacterArray);
  11198. $core.addMethod(
  11199. $core.method({
  11200. selector: "at:put:",
  11201. protocol: "accessing",
  11202. fn: function (anIndex,anObject){
  11203. var self=this,$self=this;
  11204. return $core.withContext(function($ctx1) {
  11205. $self._errorReadOnly();
  11206. return self;
  11207. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  11208. },
  11209. args: ["anIndex", "anObject"],
  11210. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11211. referencedClasses: [],
  11212. messageSends: ["errorReadOnly"]
  11213. }),
  11214. $globals.CharacterArray);
  11215. $core.addMethod(
  11216. $core.method({
  11217. selector: "errorReadOnly",
  11218. protocol: "error handling",
  11219. fn: function (){
  11220. var self=this,$self=this;
  11221. return $core.withContext(function($ctx1) {
  11222. $self._error_("Object is read-only");
  11223. return self;
  11224. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  11225. },
  11226. args: [],
  11227. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11228. referencedClasses: [],
  11229. messageSends: ["error:"]
  11230. }),
  11231. $globals.CharacterArray);
  11232. $core.addMethod(
  11233. $core.method({
  11234. selector: "printOn:",
  11235. protocol: "printing",
  11236. fn: function (aStream){
  11237. var self=this,$self=this;
  11238. return $core.withContext(function($ctx1) {
  11239. $recv($self._asString())._printOn_(aStream);
  11240. return self;
  11241. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  11242. },
  11243. args: ["aStream"],
  11244. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11245. referencedClasses: [],
  11246. messageSends: ["printOn:", "asString"]
  11247. }),
  11248. $globals.CharacterArray);
  11249. $core.addMethod(
  11250. $core.method({
  11251. selector: "putOn:",
  11252. protocol: "streaming",
  11253. fn: function (aStream){
  11254. var self=this,$self=this;
  11255. return $core.withContext(function($ctx1) {
  11256. $recv(aStream)._nextPutString_(self);
  11257. return self;
  11258. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  11259. },
  11260. args: ["aStream"],
  11261. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11262. referencedClasses: [],
  11263. messageSends: ["nextPutString:"]
  11264. }),
  11265. $globals.CharacterArray);
  11266. $core.addMethod(
  11267. $core.method({
  11268. selector: "remove:",
  11269. protocol: "adding/removing",
  11270. fn: function (anObject){
  11271. var self=this,$self=this;
  11272. return $core.withContext(function($ctx1) {
  11273. $self._errorReadOnly();
  11274. return self;
  11275. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  11276. },
  11277. args: ["anObject"],
  11278. source: "remove: anObject\x0a\x09self errorReadOnly",
  11279. referencedClasses: [],
  11280. messageSends: ["errorReadOnly"]
  11281. }),
  11282. $globals.CharacterArray);
  11283. $core.addMethod(
  11284. $core.method({
  11285. selector: "remove:ifAbsent:",
  11286. protocol: "adding/removing",
  11287. fn: function (anObject,aBlock){
  11288. var self=this,$self=this;
  11289. return $core.withContext(function($ctx1) {
  11290. $self._errorReadOnly();
  11291. return self;
  11292. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  11293. },
  11294. args: ["anObject", "aBlock"],
  11295. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11296. referencedClasses: [],
  11297. messageSends: ["errorReadOnly"]
  11298. }),
  11299. $globals.CharacterArray);
  11300. $core.addMethod(
  11301. $core.method({
  11302. selector: "symbolPrintString",
  11303. protocol: "printing",
  11304. fn: function (){
  11305. var self=this,$self=this;
  11306. return $core.withContext(function($ctx1) {
  11307. return $recv($globals.String)._streamContents_((function(str){
  11308. return $core.withContext(function($ctx2) {
  11309. return $self._asSymbolPrintOn_(str);
  11310. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11311. }));
  11312. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  11313. },
  11314. args: [],
  11315. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11316. referencedClasses: ["String"],
  11317. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11318. }),
  11319. $globals.CharacterArray);
  11320. $core.addMethod(
  11321. $core.method({
  11322. selector: "fromString:",
  11323. protocol: "instance creation",
  11324. fn: function (aString){
  11325. var self=this,$self=this;
  11326. return $core.withContext(function($ctx1) {
  11327. $self._subclassResponsibility();
  11328. return self;
  11329. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  11330. },
  11331. args: ["aString"],
  11332. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11333. referencedClasses: [],
  11334. messageSends: ["subclassResponsibility"]
  11335. }),
  11336. $globals.CharacterArray.a$cls);
  11337. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  11338. $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 >> #,`";
  11339. $core.addMethod(
  11340. $core.method({
  11341. selector: ",",
  11342. protocol: "copying",
  11343. fn: function (aString){
  11344. var self=this,$self=this;
  11345. return $core.withContext(function($ctx1) {
  11346. return String(self) + aString;
  11347. return self;
  11348. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  11349. },
  11350. args: ["aString"],
  11351. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11352. referencedClasses: [],
  11353. messageSends: []
  11354. }),
  11355. $globals.String);
  11356. $core.addMethod(
  11357. $core.method({
  11358. selector: "<",
  11359. protocol: "comparing",
  11360. fn: function (aString){
  11361. var self=this,$self=this;
  11362. return $core.withContext(function($ctx1) {
  11363. return String(self) < aString._asString();
  11364. return self;
  11365. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  11366. },
  11367. args: ["aString"],
  11368. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11369. referencedClasses: [],
  11370. messageSends: []
  11371. }),
  11372. $globals.String);
  11373. $core.addMethod(
  11374. $core.method({
  11375. selector: "<=",
  11376. protocol: "comparing",
  11377. fn: function (aString){
  11378. var self=this,$self=this;
  11379. return $core.withContext(function($ctx1) {
  11380. return String(self) <= aString._asString();
  11381. return self;
  11382. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  11383. },
  11384. args: ["aString"],
  11385. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11386. referencedClasses: [],
  11387. messageSends: []
  11388. }),
  11389. $globals.String);
  11390. $core.addMethod(
  11391. $core.method({
  11392. selector: "=",
  11393. protocol: "comparing",
  11394. fn: function (aString){
  11395. var self=this,$self=this;
  11396. return $core.withContext(function($ctx1) {
  11397. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11398. return self;
  11399. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  11400. },
  11401. args: ["aString"],
  11402. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11403. referencedClasses: [],
  11404. messageSends: []
  11405. }),
  11406. $globals.String);
  11407. $core.addMethod(
  11408. $core.method({
  11409. selector: "==",
  11410. protocol: "comparing",
  11411. fn: function (aString){
  11412. var self=this,$self=this;
  11413. return $core.withContext(function($ctx1) {
  11414. if (typeof aString === "string") return String(self) === aString;
  11415. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11416. else return false;;
  11417. return self;
  11418. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  11419. },
  11420. args: ["aString"],
  11421. 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'>",
  11422. referencedClasses: [],
  11423. messageSends: []
  11424. }),
  11425. $globals.String);
  11426. $core.addMethod(
  11427. $core.method({
  11428. selector: ">",
  11429. protocol: "comparing",
  11430. fn: function (aString){
  11431. var self=this,$self=this;
  11432. return $core.withContext(function($ctx1) {
  11433. return String(self) > aString._asString();
  11434. return self;
  11435. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  11436. },
  11437. args: ["aString"],
  11438. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11439. referencedClasses: [],
  11440. messageSends: []
  11441. }),
  11442. $globals.String);
  11443. $core.addMethod(
  11444. $core.method({
  11445. selector: ">=",
  11446. protocol: "comparing",
  11447. fn: function (aString){
  11448. var self=this,$self=this;
  11449. return $core.withContext(function($ctx1) {
  11450. return String(self) >= aString._asString();
  11451. return self;
  11452. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  11453. },
  11454. args: ["aString"],
  11455. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11456. referencedClasses: [],
  11457. messageSends: []
  11458. }),
  11459. $globals.String);
  11460. $core.addMethod(
  11461. $core.method({
  11462. selector: "asJavaScriptMethodName",
  11463. protocol: "converting",
  11464. fn: function (){
  11465. var self=this,$self=this;
  11466. return $core.withContext(function($ctx1) {
  11467. return $core.st2js(self);
  11468. return self;
  11469. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11470. },
  11471. args: [],
  11472. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11473. referencedClasses: [],
  11474. messageSends: []
  11475. }),
  11476. $globals.String);
  11477. $core.addMethod(
  11478. $core.method({
  11479. selector: "asJavaScriptObject",
  11480. protocol: "converting",
  11481. fn: function (){
  11482. var self=this,$self=this;
  11483. return self;
  11484. },
  11485. args: [],
  11486. source: "asJavaScriptObject\x0a\x09^ self",
  11487. referencedClasses: [],
  11488. messageSends: []
  11489. }),
  11490. $globals.String);
  11491. $core.addMethod(
  11492. $core.method({
  11493. selector: "asJavaScriptSource",
  11494. protocol: "converting",
  11495. fn: function (){
  11496. var self=this,$self=this;
  11497. return $core.withContext(function($ctx1) {
  11498. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11499. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11500. else
  11501. return "\"" + self + "\"";
  11502. ;
  11503. return self;
  11504. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11505. },
  11506. args: [],
  11507. 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'>",
  11508. referencedClasses: [],
  11509. messageSends: []
  11510. }),
  11511. $globals.String);
  11512. $core.addMethod(
  11513. $core.method({
  11514. selector: "asLowercase",
  11515. protocol: "converting",
  11516. fn: function (){
  11517. var self=this,$self=this;
  11518. return $core.withContext(function($ctx1) {
  11519. return self.toLowerCase();
  11520. return self;
  11521. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11522. },
  11523. args: [],
  11524. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11525. referencedClasses: [],
  11526. messageSends: []
  11527. }),
  11528. $globals.String);
  11529. $core.addMethod(
  11530. $core.method({
  11531. selector: "asMutator",
  11532. protocol: "converting",
  11533. fn: function (){
  11534. var self=this,$self=this;
  11535. return $core.withContext(function($ctx1) {
  11536. var $1;
  11537. $1=$recv($self._last()).__eq(":");
  11538. if(!$core.assert($1)){
  11539. return $self.__comma(":");
  11540. }
  11541. return self;
  11542. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11543. },
  11544. args: [],
  11545. 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",
  11546. referencedClasses: [],
  11547. messageSends: ["ifFalse:", "=", "last", ","]
  11548. }),
  11549. $globals.String);
  11550. $core.addMethod(
  11551. $core.method({
  11552. selector: "asNumber",
  11553. protocol: "converting",
  11554. fn: function (){
  11555. var self=this,$self=this;
  11556. return $core.withContext(function($ctx1) {
  11557. return Number(self);
  11558. return self;
  11559. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11560. },
  11561. args: [],
  11562. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11563. referencedClasses: [],
  11564. messageSends: []
  11565. }),
  11566. $globals.String);
  11567. $core.addMethod(
  11568. $core.method({
  11569. selector: "asRegexp",
  11570. protocol: "converting",
  11571. fn: function (){
  11572. var self=this,$self=this;
  11573. return $core.withContext(function($ctx1) {
  11574. return $recv($globals.RegularExpression)._fromString_(self);
  11575. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11576. },
  11577. args: [],
  11578. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11579. referencedClasses: ["RegularExpression"],
  11580. messageSends: ["fromString:"]
  11581. }),
  11582. $globals.String);
  11583. $core.addMethod(
  11584. $core.method({
  11585. selector: "asString",
  11586. protocol: "converting",
  11587. fn: function (){
  11588. var self=this,$self=this;
  11589. return self;
  11590. },
  11591. args: [],
  11592. source: "asString\x0a\x09^ self",
  11593. referencedClasses: [],
  11594. messageSends: []
  11595. }),
  11596. $globals.String);
  11597. $core.addMethod(
  11598. $core.method({
  11599. selector: "asSymbol",
  11600. protocol: "converting",
  11601. fn: function (){
  11602. var self=this,$self=this;
  11603. return self;
  11604. },
  11605. args: [],
  11606. source: "asSymbol\x0a\x09^ self",
  11607. referencedClasses: [],
  11608. messageSends: []
  11609. }),
  11610. $globals.String);
  11611. $core.addMethod(
  11612. $core.method({
  11613. selector: "asUppercase",
  11614. protocol: "converting",
  11615. fn: function (){
  11616. var self=this,$self=this;
  11617. return $core.withContext(function($ctx1) {
  11618. return self.toUpperCase();
  11619. return self;
  11620. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11621. },
  11622. args: [],
  11623. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11624. referencedClasses: [],
  11625. messageSends: []
  11626. }),
  11627. $globals.String);
  11628. $core.addMethod(
  11629. $core.method({
  11630. selector: "asciiValue",
  11631. protocol: "accessing",
  11632. fn: function (){
  11633. var self=this,$self=this;
  11634. return $core.withContext(function($ctx1) {
  11635. return self.charCodeAt(0);;
  11636. return self;
  11637. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11638. },
  11639. args: [],
  11640. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11641. referencedClasses: [],
  11642. messageSends: []
  11643. }),
  11644. $globals.String);
  11645. $core.addMethod(
  11646. $core.method({
  11647. selector: "at:ifAbsent:",
  11648. protocol: "accessing",
  11649. fn: function (anIndex,aBlock){
  11650. var self=this,$self=this;
  11651. return $core.withContext(function($ctx1) {
  11652. return String(self)[anIndex - 1] || aBlock._value();
  11653. return self;
  11654. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11655. },
  11656. args: ["anIndex", "aBlock"],
  11657. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11658. referencedClasses: [],
  11659. messageSends: []
  11660. }),
  11661. $globals.String);
  11662. $core.addMethod(
  11663. $core.method({
  11664. selector: "at:ifPresent:ifAbsent:",
  11665. protocol: "accessing",
  11666. fn: function (anIndex,aBlock,anotherBlock){
  11667. var self=this,$self=this;
  11668. return $core.withContext(function($ctx1) {
  11669. var result = String(self)[anIndex - 1];
  11670. return result ? aBlock._value_(result) : anotherBlock._value();
  11671. ;
  11672. return self;
  11673. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11674. },
  11675. args: ["anIndex", "aBlock", "anotherBlock"],
  11676. 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'>",
  11677. referencedClasses: [],
  11678. messageSends: []
  11679. }),
  11680. $globals.String);
  11681. $core.addMethod(
  11682. $core.method({
  11683. selector: "capitalized",
  11684. protocol: "converting",
  11685. fn: function (){
  11686. var self=this,$self=this;
  11687. return $core.withContext(function($ctx1) {
  11688. return $self._ifNotEmpty_((function(){
  11689. return $core.withContext(function($ctx2) {
  11690. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11692. }));
  11693. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11694. },
  11695. args: [],
  11696. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11697. referencedClasses: [],
  11698. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11699. }),
  11700. $globals.String);
  11701. $core.addMethod(
  11702. $core.method({
  11703. selector: "charCodeAt:",
  11704. protocol: "accessing",
  11705. fn: function (anInteger){
  11706. var self=this,$self=this;
  11707. return $core.withContext(function($ctx1) {
  11708. return self.charCodeAt(anInteger - 1);
  11709. return self;
  11710. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11711. },
  11712. args: ["anInteger"],
  11713. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11714. referencedClasses: [],
  11715. messageSends: []
  11716. }),
  11717. $globals.String);
  11718. $core.addMethod(
  11719. $core.method({
  11720. selector: "copyFrom:to:",
  11721. protocol: "copying",
  11722. fn: function (anIndex,anotherIndex){
  11723. var self=this,$self=this;
  11724. return $core.withContext(function($ctx1) {
  11725. return self.substring(anIndex - 1, anotherIndex);
  11726. return self;
  11727. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11728. },
  11729. args: ["anIndex", "anotherIndex"],
  11730. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11731. referencedClasses: [],
  11732. messageSends: []
  11733. }),
  11734. $globals.String);
  11735. $core.addMethod(
  11736. $core.method({
  11737. selector: "crlfSanitized",
  11738. protocol: "converting",
  11739. fn: function (){
  11740. var self=this,$self=this;
  11741. return $core.withContext(function($ctx1) {
  11742. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11743. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11744. },
  11745. args: [],
  11746. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11747. referencedClasses: ["String"],
  11748. messageSends: ["join:", "lines", "lf"]
  11749. }),
  11750. $globals.String);
  11751. $core.addMethod(
  11752. $core.method({
  11753. selector: "deepCopy",
  11754. protocol: "copying",
  11755. fn: function (){
  11756. var self=this,$self=this;
  11757. return $core.withContext(function($ctx1) {
  11758. return $self._shallowCopy();
  11759. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11760. },
  11761. args: [],
  11762. source: "deepCopy\x0a\x09^ self shallowCopy",
  11763. referencedClasses: [],
  11764. messageSends: ["shallowCopy"]
  11765. }),
  11766. $globals.String);
  11767. $core.addMethod(
  11768. $core.method({
  11769. selector: "escaped",
  11770. protocol: "converting",
  11771. fn: function (){
  11772. var self=this,$self=this;
  11773. return $core.withContext(function($ctx1) {
  11774. return escape(self);
  11775. return self;
  11776. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11777. },
  11778. args: [],
  11779. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11780. referencedClasses: [],
  11781. messageSends: []
  11782. }),
  11783. $globals.String);
  11784. $core.addMethod(
  11785. $core.method({
  11786. selector: "includesSubString:",
  11787. protocol: "testing",
  11788. fn: function (subString){
  11789. var self=this,$self=this;
  11790. return $core.withContext(function($ctx1) {
  11791. return self.indexOf(subString) != -1;
  11792. return self;
  11793. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11794. },
  11795. args: ["subString"],
  11796. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11797. referencedClasses: [],
  11798. messageSends: []
  11799. }),
  11800. $globals.String);
  11801. $core.addMethod(
  11802. $core.method({
  11803. selector: "isCapitalized",
  11804. protocol: "testing",
  11805. fn: function (){
  11806. var self=this,$self=this;
  11807. return $core.withContext(function($ctx1) {
  11808. var $2,$1;
  11809. $2=$self._first();
  11810. $ctx1.sendIdx["first"]=1;
  11811. $1=$recv($2)._asUppercase();
  11812. return $recv($1).__eq_eq($self._first());
  11813. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11814. },
  11815. args: [],
  11816. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11817. referencedClasses: [],
  11818. messageSends: ["==", "asUppercase", "first"]
  11819. }),
  11820. $globals.String);
  11821. $core.addMethod(
  11822. $core.method({
  11823. selector: "isImmutable",
  11824. protocol: "testing",
  11825. fn: function (){
  11826. var self=this,$self=this;
  11827. return true;
  11828. },
  11829. args: [],
  11830. source: "isImmutable\x0a\x09^ true",
  11831. referencedClasses: [],
  11832. messageSends: []
  11833. }),
  11834. $globals.String);
  11835. $core.addMethod(
  11836. $core.method({
  11837. selector: "isSelector",
  11838. protocol: "testing",
  11839. fn: function (){
  11840. var self=this,$self=this;
  11841. return $core.withContext(function($ctx1) {
  11842. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11843. return self;
  11844. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11845. },
  11846. args: [],
  11847. 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>",
  11848. referencedClasses: [],
  11849. messageSends: []
  11850. }),
  11851. $globals.String);
  11852. $core.addMethod(
  11853. $core.method({
  11854. selector: "isString",
  11855. protocol: "testing",
  11856. fn: function (){
  11857. var self=this,$self=this;
  11858. return true;
  11859. },
  11860. args: [],
  11861. source: "isString\x0a\x09^ true",
  11862. referencedClasses: [],
  11863. messageSends: []
  11864. }),
  11865. $globals.String);
  11866. $core.addMethod(
  11867. $core.method({
  11868. selector: "isVowel",
  11869. protocol: "testing",
  11870. fn: function (){
  11871. var self=this,$self=this;
  11872. return $core.withContext(function($ctx1) {
  11873. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11874. return $core.withContext(function($ctx2) {
  11875. return "aeiou"._includes_($self._asLowercase());
  11876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11877. }));
  11878. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11879. },
  11880. args: [],
  11881. 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 ]",
  11882. referencedClasses: [],
  11883. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11884. }),
  11885. $globals.String);
  11886. $core.addMethod(
  11887. $core.method({
  11888. selector: "join:",
  11889. protocol: "split join",
  11890. fn: function (aCollection){
  11891. var self=this,$self=this;
  11892. return $core.withContext(function($ctx1) {
  11893. return $recv($globals.String)._streamContents_((function(stream){
  11894. return $core.withContext(function($ctx2) {
  11895. return $recv(aCollection)._do_separatedBy_((function(each){
  11896. return $core.withContext(function($ctx3) {
  11897. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11898. $ctx3.sendIdx["nextPutAll:"]=1;
  11899. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11900. }),(function(){
  11901. return $core.withContext(function($ctx3) {
  11902. return $recv(stream)._nextPutAll_(self);
  11903. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11904. }));
  11905. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11906. }));
  11907. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11908. },
  11909. args: ["aCollection"],
  11910. 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 ]]",
  11911. referencedClasses: ["String"],
  11912. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11913. }),
  11914. $globals.String);
  11915. $core.addMethod(
  11916. $core.method({
  11917. selector: "lineIndicesDo:",
  11918. protocol: "split join",
  11919. fn: function (aBlock){
  11920. var self=this,$self=this;
  11921. var cr,lf,start,sz,nextLF,nextCR;
  11922. return $core.withContext(function($ctx1) {
  11923. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11924. var $early={};
  11925. try {
  11926. start=(1);
  11927. sz=$self._size();
  11928. cr=$recv($globals.String)._cr();
  11929. nextCR=$self._indexOf_startingAt_(cr,(1));
  11930. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11931. lf=$recv($globals.String)._lf();
  11932. nextLF=$self._indexOf_startingAt_(lf,(1));
  11933. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11934. $recv((function(){
  11935. return $core.withContext(function($ctx2) {
  11936. return $recv(start).__lt_eq(sz);
  11937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11938. }))._whileTrue_((function(){
  11939. return $core.withContext(function($ctx2) {
  11940. $2=$recv(nextLF).__eq((0));
  11941. $ctx2.sendIdx["="]=1;
  11942. $1=$recv($2)._and_((function(){
  11943. return $core.withContext(function($ctx3) {
  11944. return $recv(nextCR).__eq((0));
  11945. $ctx3.sendIdx["="]=2;
  11946. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11947. }));
  11948. $ctx2.sendIdx["and:"]=1;
  11949. if($core.assert($1)){
  11950. $recv(aBlock)._value_value_value_(start,sz,sz);
  11951. $ctx2.sendIdx["value:value:value:"]=1;
  11952. throw $early=[self];
  11953. }
  11954. $4=$recv(nextCR).__eq((0));
  11955. $ctx2.sendIdx["="]=3;
  11956. $3=$recv($4)._or_((function(){
  11957. return $core.withContext(function($ctx3) {
  11958. $5=(0).__lt(nextLF);
  11959. $ctx3.sendIdx["<"]=1;
  11960. return $recv($5)._and_((function(){
  11961. return $core.withContext(function($ctx4) {
  11962. return $recv(nextLF).__lt(nextCR);
  11963. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  11964. }));
  11965. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11966. }));
  11967. if($core.assert($3)){
  11968. $6=start;
  11969. $7=$recv(nextLF).__minus((1));
  11970. $ctx2.sendIdx["-"]=1;
  11971. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  11972. $ctx2.sendIdx["value:value:value:"]=2;
  11973. start=(1).__plus(nextLF);
  11974. $ctx2.sendIdx["+"]=1;
  11975. start;
  11976. nextLF=$self._indexOf_startingAt_(lf,start);
  11977. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  11978. return nextLF;
  11979. } else {
  11980. $9=(1).__plus(nextCR);
  11981. $ctx2.sendIdx["+"]=2;
  11982. $8=$recv($9).__eq(nextLF);
  11983. if($core.assert($8)){
  11984. $10=start;
  11985. $11=$recv(nextCR).__minus((1));
  11986. $ctx2.sendIdx["-"]=2;
  11987. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  11988. $ctx2.sendIdx["value:value:value:"]=3;
  11989. start=(1).__plus(nextLF);
  11990. $ctx2.sendIdx["+"]=3;
  11991. start;
  11992. nextCR=$self._indexOf_startingAt_(cr,start);
  11993. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  11994. nextCR;
  11995. nextLF=$self._indexOf_startingAt_(lf,start);
  11996. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  11997. return nextLF;
  11998. } else {
  11999. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12000. start=(1).__plus(nextCR);
  12001. start;
  12002. nextCR=$self._indexOf_startingAt_(cr,start);
  12003. return nextCR;
  12004. }
  12005. }
  12006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12007. }));
  12008. return self;
  12009. }
  12010. catch(e) {if(e===$early)return e[0]; throw e}
  12011. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  12012. },
  12013. args: ["aBlock"],
  12014. 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 ] ]]",
  12015. referencedClasses: ["String"],
  12016. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12017. }),
  12018. $globals.String);
  12019. $core.addMethod(
  12020. $core.method({
  12021. selector: "lineNumber:",
  12022. protocol: "split join",
  12023. fn: function (anIndex){
  12024. var self=this,$self=this;
  12025. var lineCount;
  12026. return $core.withContext(function($ctx1) {
  12027. var $2,$1;
  12028. var $early={};
  12029. try {
  12030. lineCount=(0);
  12031. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12032. return $core.withContext(function($ctx2) {
  12033. lineCount=$recv(lineCount).__plus((1));
  12034. $2=lineCount;
  12035. $1=$recv($2).__eq(anIndex);
  12036. if($core.assert($1)){
  12037. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12038. }
  12039. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12040. }));
  12041. return nil;
  12042. }
  12043. catch(e) {if(e===$early)return e[0]; throw e}
  12044. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  12045. },
  12046. args: ["anIndex"],
  12047. 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",
  12048. referencedClasses: [],
  12049. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12050. }),
  12051. $globals.String);
  12052. $core.addMethod(
  12053. $core.method({
  12054. selector: "lines",
  12055. protocol: "split join",
  12056. fn: function (){
  12057. var self=this,$self=this;
  12058. return $core.withContext(function($ctx1) {
  12059. var result = self.split(/\r\n|\r|\n/);
  12060. if (!result[result.length-1]) result.pop();
  12061. return result;;
  12062. return self;
  12063. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  12064. },
  12065. args: [],
  12066. 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'>",
  12067. referencedClasses: [],
  12068. messageSends: []
  12069. }),
  12070. $globals.String);
  12071. $core.addMethod(
  12072. $core.method({
  12073. selector: "linesDo:",
  12074. protocol: "split join",
  12075. fn: function (aBlock){
  12076. var self=this,$self=this;
  12077. return $core.withContext(function($ctx1) {
  12078. $recv($self._lines())._do_(aBlock);
  12079. return self;
  12080. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  12081. },
  12082. args: ["aBlock"],
  12083. 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",
  12084. referencedClasses: [],
  12085. messageSends: ["do:", "lines"]
  12086. }),
  12087. $globals.String);
  12088. $core.addMethod(
  12089. $core.method({
  12090. selector: "match:",
  12091. protocol: "regular expressions",
  12092. fn: function (aRegexp){
  12093. var self=this,$self=this;
  12094. return $core.withContext(function($ctx1) {
  12095. return self.search(aRegexp) != -1;
  12096. return self;
  12097. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  12098. },
  12099. args: ["aRegexp"],
  12100. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12101. referencedClasses: [],
  12102. messageSends: []
  12103. }),
  12104. $globals.String);
  12105. $core.addMethod(
  12106. $core.method({
  12107. selector: "matchesOf:",
  12108. protocol: "regular expressions",
  12109. fn: function (aRegularExpression){
  12110. var self=this,$self=this;
  12111. return $core.withContext(function($ctx1) {
  12112. return self.match(aRegularExpression);
  12113. return self;
  12114. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  12115. },
  12116. args: ["aRegularExpression"],
  12117. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12118. referencedClasses: [],
  12119. messageSends: []
  12120. }),
  12121. $globals.String);
  12122. $core.addMethod(
  12123. $core.method({
  12124. selector: "numericallyIndexable",
  12125. protocol: "private",
  12126. fn: function (){
  12127. var self=this,$self=this;
  12128. return $core.withContext(function($ctx1) {
  12129. return String(self);
  12130. return self;
  12131. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  12132. },
  12133. args: [],
  12134. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  12135. referencedClasses: [],
  12136. messageSends: []
  12137. }),
  12138. $globals.String);
  12139. $core.addMethod(
  12140. $core.method({
  12141. selector: "printNl",
  12142. protocol: "printing",
  12143. fn: function (){
  12144. var self=this,$self=this;
  12145. return $core.withContext(function($ctx1) {
  12146. console.log(self);
  12147. return self;
  12148. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  12149. },
  12150. args: [],
  12151. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12152. referencedClasses: [],
  12153. messageSends: []
  12154. }),
  12155. $globals.String);
  12156. $core.addMethod(
  12157. $core.method({
  12158. selector: "printOn:",
  12159. protocol: "printing",
  12160. fn: function (aStream){
  12161. var self=this,$self=this;
  12162. return $core.withContext(function($ctx1) {
  12163. $recv(aStream)._nextPutAll_("'");
  12164. $ctx1.sendIdx["nextPutAll:"]=1;
  12165. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12166. $ctx1.sendIdx["nextPutAll:"]=2;
  12167. $recv(aStream)._nextPutAll_("'");
  12168. return self;
  12169. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  12170. },
  12171. args: ["aStream"],
  12172. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12173. referencedClasses: [],
  12174. messageSends: ["nextPutAll:", "replace:with:"]
  12175. }),
  12176. $globals.String);
  12177. $core.addMethod(
  12178. $core.method({
  12179. selector: "replace:with:",
  12180. protocol: "regular expressions",
  12181. fn: function (aString,anotherString){
  12182. var self=this,$self=this;
  12183. return $core.withContext(function($ctx1) {
  12184. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12185. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  12186. },
  12187. args: ["aString", "anotherString"],
  12188. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12189. referencedClasses: ["RegularExpression"],
  12190. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12191. }),
  12192. $globals.String);
  12193. $core.addMethod(
  12194. $core.method({
  12195. selector: "replaceRegexp:with:",
  12196. protocol: "regular expressions",
  12197. fn: function (aRegexp,aString){
  12198. var self=this,$self=this;
  12199. return $core.withContext(function($ctx1) {
  12200. return self.replace(aRegexp, aString);
  12201. return self;
  12202. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  12203. },
  12204. args: ["aRegexp", "aString"],
  12205. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12206. referencedClasses: [],
  12207. messageSends: []
  12208. }),
  12209. $globals.String);
  12210. $core.addMethod(
  12211. $core.method({
  12212. selector: "reversed",
  12213. protocol: "converting",
  12214. fn: function (){
  12215. var self=this,$self=this;
  12216. return $core.withContext(function($ctx1) {
  12217. return self.split("").reverse().join("");
  12218. return self;
  12219. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  12220. },
  12221. args: [],
  12222. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12223. referencedClasses: [],
  12224. messageSends: []
  12225. }),
  12226. $globals.String);
  12227. $core.addMethod(
  12228. $core.method({
  12229. selector: "shallowCopy",
  12230. protocol: "copying",
  12231. fn: function (){
  12232. var self=this,$self=this;
  12233. return self;
  12234. },
  12235. args: [],
  12236. source: "shallowCopy\x0a\x09^ self",
  12237. referencedClasses: [],
  12238. messageSends: []
  12239. }),
  12240. $globals.String);
  12241. $core.addMethod(
  12242. $core.method({
  12243. selector: "size",
  12244. protocol: "accessing",
  12245. fn: function (){
  12246. var self=this,$self=this;
  12247. return $core.withContext(function($ctx1) {
  12248. return self.length;
  12249. return self;
  12250. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  12251. },
  12252. args: [],
  12253. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  12254. referencedClasses: [],
  12255. messageSends: []
  12256. }),
  12257. $globals.String);
  12258. $core.addMethod(
  12259. $core.method({
  12260. selector: "subStrings:",
  12261. protocol: "split join",
  12262. fn: function (aString){
  12263. var self=this,$self=this;
  12264. return $core.withContext(function($ctx1) {
  12265. return $self._tokenize_(aString);
  12266. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  12267. },
  12268. args: ["aString"],
  12269. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12270. referencedClasses: [],
  12271. messageSends: ["tokenize:"]
  12272. }),
  12273. $globals.String);
  12274. $core.addMethod(
  12275. $core.method({
  12276. selector: "tokenize:",
  12277. protocol: "split join",
  12278. fn: function (aString){
  12279. var self=this,$self=this;
  12280. return $core.withContext(function($ctx1) {
  12281. return self.split(aString);
  12282. return self;
  12283. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  12284. },
  12285. args: ["aString"],
  12286. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12287. referencedClasses: [],
  12288. messageSends: []
  12289. }),
  12290. $globals.String);
  12291. $core.addMethod(
  12292. $core.method({
  12293. selector: "trimBoth",
  12294. protocol: "regular expressions",
  12295. fn: function (){
  12296. var self=this,$self=this;
  12297. return $core.withContext(function($ctx1) {
  12298. return $self._trimBoth_("\x5cs");
  12299. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  12300. },
  12301. args: [],
  12302. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12303. referencedClasses: [],
  12304. messageSends: ["trimBoth:"]
  12305. }),
  12306. $globals.String);
  12307. $core.addMethod(
  12308. $core.method({
  12309. selector: "trimBoth:",
  12310. protocol: "regular expressions",
  12311. fn: function (separators){
  12312. var self=this,$self=this;
  12313. return $core.withContext(function($ctx1) {
  12314. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12315. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  12316. },
  12317. args: ["separators"],
  12318. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12319. referencedClasses: [],
  12320. messageSends: ["trimRight:", "trimLeft:"]
  12321. }),
  12322. $globals.String);
  12323. $core.addMethod(
  12324. $core.method({
  12325. selector: "trimLeft",
  12326. protocol: "regular expressions",
  12327. fn: function (){
  12328. var self=this,$self=this;
  12329. return $core.withContext(function($ctx1) {
  12330. return $self._trimLeft_("\x5cs");
  12331. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  12332. },
  12333. args: [],
  12334. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12335. referencedClasses: [],
  12336. messageSends: ["trimLeft:"]
  12337. }),
  12338. $globals.String);
  12339. $core.addMethod(
  12340. $core.method({
  12341. selector: "trimLeft:",
  12342. protocol: "regular expressions",
  12343. fn: function (separators){
  12344. var self=this,$self=this;
  12345. return $core.withContext(function($ctx1) {
  12346. var $2,$1;
  12347. $2=$recv("^[".__comma(separators)).__comma("]+");
  12348. $ctx1.sendIdx[","]=1;
  12349. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12350. return $self._replaceRegexp_with_($1,"");
  12351. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  12352. },
  12353. args: ["separators"],
  12354. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12355. referencedClasses: ["RegularExpression"],
  12356. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12357. }),
  12358. $globals.String);
  12359. $core.addMethod(
  12360. $core.method({
  12361. selector: "trimRight",
  12362. protocol: "regular expressions",
  12363. fn: function (){
  12364. var self=this,$self=this;
  12365. return $core.withContext(function($ctx1) {
  12366. return $self._trimRight_("\x5cs");
  12367. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  12368. },
  12369. args: [],
  12370. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12371. referencedClasses: [],
  12372. messageSends: ["trimRight:"]
  12373. }),
  12374. $globals.String);
  12375. $core.addMethod(
  12376. $core.method({
  12377. selector: "trimRight:",
  12378. protocol: "regular expressions",
  12379. fn: function (separators){
  12380. var self=this,$self=this;
  12381. return $core.withContext(function($ctx1) {
  12382. var $2,$1;
  12383. $2=$recv("[".__comma(separators)).__comma("]+$");
  12384. $ctx1.sendIdx[","]=1;
  12385. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12386. return $self._replaceRegexp_with_($1,"");
  12387. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12388. },
  12389. args: ["separators"],
  12390. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12391. referencedClasses: ["RegularExpression"],
  12392. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12393. }),
  12394. $globals.String);
  12395. $core.addMethod(
  12396. $core.method({
  12397. selector: "unescaped",
  12398. protocol: "converting",
  12399. fn: function (){
  12400. var self=this,$self=this;
  12401. return $core.withContext(function($ctx1) {
  12402. return unescape(self);
  12403. return self;
  12404. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12405. },
  12406. args: [],
  12407. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12408. referencedClasses: [],
  12409. messageSends: []
  12410. }),
  12411. $globals.String);
  12412. $core.addMethod(
  12413. $core.method({
  12414. selector: "uriComponentDecoded",
  12415. protocol: "converting",
  12416. fn: function (){
  12417. var self=this,$self=this;
  12418. return $core.withContext(function($ctx1) {
  12419. return decodeURIComponent(self);
  12420. return self;
  12421. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12422. },
  12423. args: [],
  12424. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12425. referencedClasses: [],
  12426. messageSends: []
  12427. }),
  12428. $globals.String);
  12429. $core.addMethod(
  12430. $core.method({
  12431. selector: "uriComponentEncoded",
  12432. protocol: "converting",
  12433. fn: function (){
  12434. var self=this,$self=this;
  12435. return $core.withContext(function($ctx1) {
  12436. return encodeURIComponent(self);
  12437. return self;
  12438. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12439. },
  12440. args: [],
  12441. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12442. referencedClasses: [],
  12443. messageSends: []
  12444. }),
  12445. $globals.String);
  12446. $core.addMethod(
  12447. $core.method({
  12448. selector: "uriDecoded",
  12449. protocol: "converting",
  12450. fn: function (){
  12451. var self=this,$self=this;
  12452. return $core.withContext(function($ctx1) {
  12453. return decodeURI(self);
  12454. return self;
  12455. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12456. },
  12457. args: [],
  12458. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12459. referencedClasses: [],
  12460. messageSends: []
  12461. }),
  12462. $globals.String);
  12463. $core.addMethod(
  12464. $core.method({
  12465. selector: "uriEncoded",
  12466. protocol: "converting",
  12467. fn: function (){
  12468. var self=this,$self=this;
  12469. return $core.withContext(function($ctx1) {
  12470. return encodeURI(self);
  12471. return self;
  12472. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12473. },
  12474. args: [],
  12475. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12476. referencedClasses: [],
  12477. messageSends: []
  12478. }),
  12479. $globals.String);
  12480. $core.addMethod(
  12481. $core.method({
  12482. selector: "value:",
  12483. protocol: "evaluating",
  12484. fn: function (anObject){
  12485. var self=this,$self=this;
  12486. return $core.withContext(function($ctx1) {
  12487. return $recv(anObject)._perform_(self);
  12488. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12489. },
  12490. args: ["anObject"],
  12491. source: "value: anObject \x0a\x09^ anObject perform: self",
  12492. referencedClasses: [],
  12493. messageSends: ["perform:"]
  12494. }),
  12495. $globals.String);
  12496. $core.addMethod(
  12497. $core.method({
  12498. selector: "cr",
  12499. protocol: "accessing",
  12500. fn: function (){
  12501. var self=this,$self=this;
  12502. return $core.withContext(function($ctx1) {
  12503. return "\r";
  12504. return self;
  12505. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12506. },
  12507. args: [],
  12508. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12509. referencedClasses: [],
  12510. messageSends: []
  12511. }),
  12512. $globals.String.a$cls);
  12513. $core.addMethod(
  12514. $core.method({
  12515. selector: "crlf",
  12516. protocol: "accessing",
  12517. fn: function (){
  12518. var self=this,$self=this;
  12519. return $core.withContext(function($ctx1) {
  12520. return "\r\n";
  12521. return self;
  12522. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12523. },
  12524. args: [],
  12525. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12526. referencedClasses: [],
  12527. messageSends: []
  12528. }),
  12529. $globals.String.a$cls);
  12530. $core.addMethod(
  12531. $core.method({
  12532. selector: "esc",
  12533. protocol: "accessing",
  12534. fn: function (){
  12535. var self=this,$self=this;
  12536. return $core.withContext(function($ctx1) {
  12537. return $self._fromCharCode_((27));
  12538. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12539. },
  12540. args: [],
  12541. source: "esc\x0a\x09^ self fromCharCode: 27",
  12542. referencedClasses: [],
  12543. messageSends: ["fromCharCode:"]
  12544. }),
  12545. $globals.String.a$cls);
  12546. $core.addMethod(
  12547. $core.method({
  12548. selector: "fromCharCode:",
  12549. protocol: "instance creation",
  12550. fn: function (anInteger){
  12551. var self=this,$self=this;
  12552. return $core.withContext(function($ctx1) {
  12553. return String.fromCharCode(anInteger);
  12554. return self;
  12555. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12556. },
  12557. args: ["anInteger"],
  12558. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12559. referencedClasses: [],
  12560. messageSends: []
  12561. }),
  12562. $globals.String.a$cls);
  12563. $core.addMethod(
  12564. $core.method({
  12565. selector: "fromString:",
  12566. protocol: "instance creation",
  12567. fn: function (aString){
  12568. var self=this,$self=this;
  12569. return $core.withContext(function($ctx1) {
  12570. return String(aString);
  12571. return self;
  12572. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12573. },
  12574. args: ["aString"],
  12575. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12576. referencedClasses: [],
  12577. messageSends: []
  12578. }),
  12579. $globals.String.a$cls);
  12580. $core.addMethod(
  12581. $core.method({
  12582. selector: "lf",
  12583. protocol: "accessing",
  12584. fn: function (){
  12585. var self=this,$self=this;
  12586. return $core.withContext(function($ctx1) {
  12587. return "\n";
  12588. return self;
  12589. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12590. },
  12591. args: [],
  12592. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12593. referencedClasses: [],
  12594. messageSends: []
  12595. }),
  12596. $globals.String.a$cls);
  12597. $core.addMethod(
  12598. $core.method({
  12599. selector: "random",
  12600. protocol: "random",
  12601. fn: function (){
  12602. var self=this,$self=this;
  12603. return $core.withContext(function($ctx1) {
  12604. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12605. return self;
  12606. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12607. },
  12608. args: [],
  12609. 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);'>",
  12610. referencedClasses: [],
  12611. messageSends: []
  12612. }),
  12613. $globals.String.a$cls);
  12614. $core.addMethod(
  12615. $core.method({
  12616. selector: "randomNotIn:",
  12617. protocol: "random",
  12618. fn: function (aString){
  12619. var self=this,$self=this;
  12620. var result;
  12621. return $core.withContext(function($ctx1) {
  12622. $recv((function(){
  12623. return $core.withContext(function($ctx2) {
  12624. result=$self._random();
  12625. result;
  12626. return $recv(aString)._includesSubString_(result);
  12627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12628. }))._whileTrue();
  12629. return result;
  12630. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12631. },
  12632. args: ["aString"],
  12633. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12634. referencedClasses: [],
  12635. messageSends: ["whileTrue", "random", "includesSubString:"]
  12636. }),
  12637. $globals.String.a$cls);
  12638. $core.addMethod(
  12639. $core.method({
  12640. selector: "space",
  12641. protocol: "accessing",
  12642. fn: function (){
  12643. var self=this,$self=this;
  12644. return $core.withContext(function($ctx1) {
  12645. return " ";
  12646. return self;
  12647. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12648. },
  12649. args: [],
  12650. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12651. referencedClasses: [],
  12652. messageSends: []
  12653. }),
  12654. $globals.String.a$cls);
  12655. $core.addMethod(
  12656. $core.method({
  12657. selector: "streamClass",
  12658. protocol: "accessing",
  12659. fn: function (){
  12660. var self=this,$self=this;
  12661. return $globals.StringStream;
  12662. },
  12663. args: [],
  12664. source: "streamClass\x0a\x09\x09^ StringStream",
  12665. referencedClasses: ["StringStream"],
  12666. messageSends: []
  12667. }),
  12668. $globals.String.a$cls);
  12669. $core.addMethod(
  12670. $core.method({
  12671. selector: "tab",
  12672. protocol: "accessing",
  12673. fn: function (){
  12674. var self=this,$self=this;
  12675. return $core.withContext(function($ctx1) {
  12676. return "\t";
  12677. return self;
  12678. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12679. },
  12680. args: [],
  12681. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12682. referencedClasses: [],
  12683. messageSends: []
  12684. }),
  12685. $globals.String.a$cls);
  12686. $core.addMethod(
  12687. $core.method({
  12688. selector: "value:",
  12689. protocol: "instance creation",
  12690. fn: function (aUTFCharCode){
  12691. var self=this,$self=this;
  12692. return $core.withContext(function($ctx1) {
  12693. return String.fromCharCode(aUTFCharCode);;
  12694. return self;
  12695. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12696. },
  12697. args: ["aUTFCharCode"],
  12698. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12699. referencedClasses: [],
  12700. messageSends: []
  12701. }),
  12702. $globals.String.a$cls);
  12703. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12704. $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`.";
  12705. $core.addMethod(
  12706. $core.method({
  12707. selector: "=",
  12708. protocol: "comparing",
  12709. fn: function (aCollection){
  12710. var self=this,$self=this;
  12711. return $core.withContext(function($ctx1) {
  12712. var $2,$1,$4,$3,$5;
  12713. var $early={};
  12714. try {
  12715. $2=$self._class();
  12716. $ctx1.sendIdx["class"]=1;
  12717. $1=$recv($2).__eq($recv(aCollection)._class());
  12718. $ctx1.sendIdx["="]=1;
  12719. if(!$core.assert($1)){
  12720. return false;
  12721. }
  12722. $4=$self._size();
  12723. $ctx1.sendIdx["size"]=1;
  12724. $3=$recv($4).__eq($recv(aCollection)._size());
  12725. if(!$core.assert($3)){
  12726. return false;
  12727. }
  12728. $self._do_((function(each){
  12729. return $core.withContext(function($ctx2) {
  12730. $5=$recv(aCollection)._includes_(each);
  12731. if(!$core.assert($5)){
  12732. throw $early=[false];
  12733. }
  12734. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12735. }));
  12736. return true;
  12737. }
  12738. catch(e) {if(e===$early)return e[0]; throw e}
  12739. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12740. },
  12741. args: ["aCollection"],
  12742. 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",
  12743. referencedClasses: [],
  12744. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12745. }),
  12746. $globals.Set);
  12747. $core.addMethod(
  12748. $core.method({
  12749. selector: "add:",
  12750. protocol: "adding/removing",
  12751. fn: function (anObject){
  12752. var self=this,$self=this;
  12753. var bucket;
  12754. return $core.withContext(function($ctx1) {
  12755. var $1,$receiver;
  12756. bucket=$self._bucketsOfElement_(anObject);
  12757. $1=$recv(bucket)._second();
  12758. if(($receiver = $1) == null || $receiver.a$nil){
  12759. var object,slowBucket;
  12760. object=$recv(bucket)._first();
  12761. $ctx1.sendIdx["first"]=1;
  12762. object;
  12763. slowBucket=$recv(bucket)._third();
  12764. slowBucket;
  12765. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12766. return $core.withContext(function($ctx2) {
  12767. $recv(slowBucket)._add_(object);
  12768. $self["@size"]=$recv($self["@size"]).__plus((1));
  12769. return $self["@size"];
  12770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12771. }));
  12772. return object;
  12773. } else {
  12774. var primitiveBucket;
  12775. primitiveBucket=$receiver;
  12776. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12777. }
  12778. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12779. },
  12780. args: ["anObject"],
  12781. 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 ]",
  12782. referencedClasses: [],
  12783. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12784. }),
  12785. $globals.Set);
  12786. $core.addMethod(
  12787. $core.method({
  12788. selector: "add:in:",
  12789. protocol: "private",
  12790. fn: function (anObject,anotherObject){
  12791. var self=this,$self=this;
  12792. return $core.withContext(function($ctx1) {
  12793. if (anObject in anotherObject.store) { return false; }
  12794. $self['@size']++;
  12795. anotherObject.store[anObject] = true;
  12796. return anObject;
  12797. ;
  12798. return self;
  12799. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12800. },
  12801. args: ["anObject", "anotherObject"],
  12802. 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'>",
  12803. referencedClasses: [],
  12804. messageSends: []
  12805. }),
  12806. $globals.Set);
  12807. $core.addMethod(
  12808. $core.method({
  12809. selector: "bucketsOfElement:",
  12810. protocol: "private",
  12811. fn: function (anObject){
  12812. var self=this,$self=this;
  12813. return $core.withContext(function($ctx1) {
  12814. // include nil to well-known objects under "boolean" fastBucket
  12815. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12816. var prim = anObject.valueOf();
  12817. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12818. var bucket = null;
  12819. $self['@slowBucketStores'].some(function (store) {
  12820. return bucket = store._bucketOfElement_(anObject);
  12821. });
  12822. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12823. }
  12824. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12825. ;
  12826. return self;
  12827. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12828. },
  12829. args: ["anObject"],
  12830. 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'>",
  12831. referencedClasses: [],
  12832. messageSends: []
  12833. }),
  12834. $globals.Set);
  12835. $core.addMethod(
  12836. $core.method({
  12837. selector: "classNameOf:",
  12838. protocol: "private",
  12839. fn: function (anObject){
  12840. var self=this,$self=this;
  12841. return $core.withContext(function($ctx1) {
  12842. return anObject.a$cls != null && anObject.a$cls.name;
  12843. return self;
  12844. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12845. },
  12846. args: ["anObject"],
  12847. 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'>",
  12848. referencedClasses: [],
  12849. messageSends: []
  12850. }),
  12851. $globals.Set);
  12852. $core.addMethod(
  12853. $core.method({
  12854. selector: "collect:",
  12855. protocol: "enumerating",
  12856. fn: function (aBlock){
  12857. var self=this,$self=this;
  12858. var collection;
  12859. return $core.withContext(function($ctx1) {
  12860. collection=$recv($self._class())._new();
  12861. $self._do_((function(each){
  12862. return $core.withContext(function($ctx2) {
  12863. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12864. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12865. }));
  12866. return collection;
  12867. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12868. },
  12869. args: ["aBlock"],
  12870. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12871. referencedClasses: [],
  12872. messageSends: ["new", "class", "do:", "add:", "value:"]
  12873. }),
  12874. $globals.Set);
  12875. $core.addMethod(
  12876. $core.method({
  12877. selector: "detect:ifNone:",
  12878. protocol: "enumerating",
  12879. fn: function (aBlock,anotherBlock){
  12880. var self=this,$self=this;
  12881. return $core.withContext(function($ctx1) {
  12882. var $1;
  12883. var $early={};
  12884. try {
  12885. $self._do_((function(each){
  12886. return $core.withContext(function($ctx2) {
  12887. $1=$recv(aBlock)._value_(each);
  12888. if($core.assert($1)){
  12889. throw $early=[each];
  12890. }
  12891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12892. }));
  12893. return $recv(anotherBlock)._value();
  12894. }
  12895. catch(e) {if(e===$early)return e[0]; throw e}
  12896. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12897. },
  12898. args: ["aBlock", "anotherBlock"],
  12899. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12900. referencedClasses: [],
  12901. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12902. }),
  12903. $globals.Set);
  12904. $core.addMethod(
  12905. $core.method({
  12906. selector: "do:",
  12907. protocol: "enumerating",
  12908. fn: function (aBlock){
  12909. var self=this,$self=this;
  12910. return $core.withContext(function($ctx1) {
  12911. var el, keys, i;
  12912. el = $self['@fastBuckets'];
  12913. keys = Object.keys(el);
  12914. for (i = 0; i < keys.length; ++i) {
  12915. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12916. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12917. else { store._do_(aBlock); }
  12918. }
  12919. el = $self['@slowBucketStores'];
  12920. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12921. $self['@defaultBucket']._do_(aBlock);
  12922. ;
  12923. return self;
  12924. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12925. },
  12926. args: ["aBlock"],
  12927. 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'>",
  12928. referencedClasses: [],
  12929. messageSends: []
  12930. }),
  12931. $globals.Set);
  12932. $core.addMethod(
  12933. $core.method({
  12934. selector: "includes:",
  12935. protocol: "testing",
  12936. fn: function (anObject){
  12937. var self=this,$self=this;
  12938. var bucket;
  12939. return $core.withContext(function($ctx1) {
  12940. var $1,$2,$3,$receiver;
  12941. bucket=$self._bucketsOfElement_(anObject);
  12942. $1=$recv(bucket)._second();
  12943. if(($receiver = $1) == null || $receiver.a$nil){
  12944. $2=$recv(bucket)._third();
  12945. $3=$recv(bucket)._first();
  12946. $ctx1.sendIdx["first"]=1;
  12947. return $recv($2)._includes_($3);
  12948. } else {
  12949. var primitiveBucket;
  12950. primitiveBucket=$receiver;
  12951. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  12952. }
  12953. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12954. },
  12955. args: ["anObject"],
  12956. 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 ]",
  12957. referencedClasses: [],
  12958. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  12959. }),
  12960. $globals.Set);
  12961. $core.addMethod(
  12962. $core.method({
  12963. selector: "includes:in:",
  12964. protocol: "private",
  12965. fn: function (anObject,anotherObject){
  12966. var self=this,$self=this;
  12967. return $core.withContext(function($ctx1) {
  12968. return anObject in anotherObject.store;
  12969. return self;
  12970. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12971. },
  12972. args: ["anObject", "anotherObject"],
  12973. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  12974. referencedClasses: [],
  12975. messageSends: []
  12976. }),
  12977. $globals.Set);
  12978. $core.addMethod(
  12979. $core.method({
  12980. selector: "initialize",
  12981. protocol: "initialization",
  12982. fn: function (){
  12983. var self=this,$self=this;
  12984. return $core.withContext(function($ctx1) {
  12985. (
  12986. $ctx1.supercall = true,
  12987. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  12988. $ctx1.supercall = false;
  12989. $self["@defaultBucket"]=[];
  12990. $self._initializeSlowBucketStores();
  12991. $self._removeAll();
  12992. return self;
  12993. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  12994. },
  12995. args: [],
  12996. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  12997. referencedClasses: [],
  12998. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  12999. }),
  13000. $globals.Set);
  13001. $core.addMethod(
  13002. $core.method({
  13003. selector: "initializeSlowBucketStores",
  13004. protocol: "initialization",
  13005. fn: function (){
  13006. var self=this,$self=this;
  13007. return $core.withContext(function($ctx1) {
  13008. var $1;
  13009. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13010. return $core.withContext(function($ctx2) {
  13011. return $self._classNameOf_(x);
  13012. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13013. }));
  13014. $ctx1.sendIdx["hashBlock:"]=1;
  13015. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13016. return $core.withContext(function($ctx2) {
  13017. return $self._jsConstructorNameOf_(x);
  13018. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13019. }))];
  13020. return self;
  13021. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  13022. },
  13023. args: [],
  13024. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13025. referencedClasses: ["ArrayBucketStore"],
  13026. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13027. }),
  13028. $globals.Set);
  13029. $core.addMethod(
  13030. $core.method({
  13031. selector: "jsConstructorNameOf:",
  13032. protocol: "private",
  13033. fn: function (anObject){
  13034. var self=this,$self=this;
  13035. return $core.withContext(function($ctx1) {
  13036. return anObject.constructor && anObject.constructor.name;
  13037. return self;
  13038. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  13039. },
  13040. args: ["anObject"],
  13041. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13042. referencedClasses: [],
  13043. messageSends: []
  13044. }),
  13045. $globals.Set);
  13046. $core.addMethod(
  13047. $core.method({
  13048. selector: "printOn:",
  13049. protocol: "printing",
  13050. fn: function (aStream){
  13051. var self=this,$self=this;
  13052. return $core.withContext(function($ctx1) {
  13053. (
  13054. $ctx1.supercall = true,
  13055. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13056. $ctx1.supercall = false;
  13057. $ctx1.sendIdx["printOn:"]=1;
  13058. $recv(aStream)._nextPutAll_(" (");
  13059. $ctx1.sendIdx["nextPutAll:"]=1;
  13060. $self._do_separatedBy_((function(each){
  13061. return $core.withContext(function($ctx2) {
  13062. return $recv(each)._printOn_(aStream);
  13063. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13064. }),(function(){
  13065. return $core.withContext(function($ctx2) {
  13066. return $recv(aStream)._nextPutAll_(" ");
  13067. $ctx2.sendIdx["nextPutAll:"]=2;
  13068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13069. }));
  13070. $recv(aStream)._nextPutAll_(")");
  13071. return self;
  13072. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  13073. },
  13074. args: ["aStream"],
  13075. 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: ')'",
  13076. referencedClasses: [],
  13077. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13078. }),
  13079. $globals.Set);
  13080. $core.addMethod(
  13081. $core.method({
  13082. selector: "remove:ifAbsent:",
  13083. protocol: "adding/removing",
  13084. fn: function (anObject,aBlock){
  13085. var self=this,$self=this;
  13086. var bucket;
  13087. return $core.withContext(function($ctx1) {
  13088. var $1,$2,$3,$receiver;
  13089. var $early={};
  13090. try {
  13091. bucket=$self._bucketsOfElement_(anObject);
  13092. $1=$recv(bucket)._second();
  13093. if(($receiver = $1) == null || $receiver.a$nil){
  13094. $2=$recv(bucket)._third();
  13095. $3=$recv(bucket)._first();
  13096. $ctx1.sendIdx["first"]=1;
  13097. $recv($2)._remove_ifAbsent_($3,(function(){
  13098. return $core.withContext(function($ctx2) {
  13099. throw $early=[$recv(aBlock)._value()];
  13100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13101. }));
  13102. $self["@size"]=$recv($self["@size"]).__minus((1));
  13103. return $self["@size"];
  13104. } else {
  13105. var primitiveBucket;
  13106. primitiveBucket=$receiver;
  13107. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  13108. }
  13109. }
  13110. catch(e) {if(e===$early)return e[0]; throw e}
  13111. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  13112. },
  13113. args: ["anObject", "aBlock"],
  13114. 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 ]",
  13115. referencedClasses: [],
  13116. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  13117. }),
  13118. $globals.Set);
  13119. $core.addMethod(
  13120. $core.method({
  13121. selector: "remove:in:",
  13122. protocol: "private",
  13123. fn: function (anObject,anotherObject){
  13124. var self=this,$self=this;
  13125. return $core.withContext(function($ctx1) {
  13126. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  13127. return self;
  13128. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13129. },
  13130. args: ["anObject", "anotherObject"],
  13131. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  13132. referencedClasses: [],
  13133. messageSends: []
  13134. }),
  13135. $globals.Set);
  13136. $core.addMethod(
  13137. $core.method({
  13138. selector: "removeAll",
  13139. protocol: "adding/removing",
  13140. fn: function (){
  13141. var self=this,$self=this;
  13142. return $core.withContext(function($ctx1) {
  13143. $self['@fastBuckets'] = {
  13144. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13145. "number": { store: Object.create(null), fn: Number },
  13146. "string": { store: Object.create(null) }
  13147. };
  13148. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  13149. $self['@defaultBucket']._removeAll();
  13150. $self['@size'] = 0;
  13151. ;
  13152. return self;
  13153. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  13154. },
  13155. args: [],
  13156. 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'>",
  13157. referencedClasses: [],
  13158. messageSends: []
  13159. }),
  13160. $globals.Set);
  13161. $core.addMethod(
  13162. $core.method({
  13163. selector: "select:",
  13164. protocol: "enumerating",
  13165. fn: function (aBlock){
  13166. var self=this,$self=this;
  13167. var collection;
  13168. return $core.withContext(function($ctx1) {
  13169. var $1;
  13170. collection=$recv($self._class())._new();
  13171. $self._do_((function(each){
  13172. return $core.withContext(function($ctx2) {
  13173. $1=$recv(aBlock)._value_(each);
  13174. if($core.assert($1)){
  13175. return $recv(collection)._add_(each);
  13176. }
  13177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13178. }));
  13179. return collection;
  13180. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  13181. },
  13182. args: ["aBlock"],
  13183. 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",
  13184. referencedClasses: [],
  13185. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13186. }),
  13187. $globals.Set);
  13188. $core.addMethod(
  13189. $core.method({
  13190. selector: "select:thenCollect:",
  13191. protocol: "enumerating",
  13192. fn: function (selectBlock,collectBlock){
  13193. var self=this,$self=this;
  13194. var collection;
  13195. return $core.withContext(function($ctx1) {
  13196. var $1;
  13197. collection=$recv($self._class())._new();
  13198. $self._do_((function(each){
  13199. return $core.withContext(function($ctx2) {
  13200. $1=$recv(selectBlock)._value_(each);
  13201. $ctx2.sendIdx["value:"]=1;
  13202. if($core.assert($1)){
  13203. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13204. }
  13205. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13206. }));
  13207. return collection;
  13208. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  13209. },
  13210. args: ["selectBlock", "collectBlock"],
  13211. 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",
  13212. referencedClasses: [],
  13213. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13214. }),
  13215. $globals.Set);
  13216. $core.addMethod(
  13217. $core.method({
  13218. selector: "size",
  13219. protocol: "accessing",
  13220. fn: function (){
  13221. var self=this,$self=this;
  13222. return $self["@size"];
  13223. },
  13224. args: [],
  13225. source: "size\x0a\x09^ size",
  13226. referencedClasses: [],
  13227. messageSends: []
  13228. }),
  13229. $globals.Set);
  13230. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13231. $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.";
  13232. $core.addMethod(
  13233. $core.method({
  13234. selector: "<<",
  13235. protocol: "writing",
  13236. fn: function (anObject){
  13237. var self=this,$self=this;
  13238. return $core.withContext(function($ctx1) {
  13239. $self._write_(anObject);
  13240. return self;
  13241. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  13242. },
  13243. args: ["anObject"],
  13244. source: "<< anObject\x0a\x09self write: anObject",
  13245. referencedClasses: [],
  13246. messageSends: ["write:"]
  13247. }),
  13248. $globals.ProtoStream);
  13249. $core.addMethod(
  13250. $core.method({
  13251. selector: "atEnd",
  13252. protocol: "testing",
  13253. fn: function (){
  13254. var self=this,$self=this;
  13255. return $core.withContext(function($ctx1) {
  13256. $self._subclassResponsibility();
  13257. return self;
  13258. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  13259. },
  13260. args: [],
  13261. source: "atEnd\x0a\x09self subclassResponsibility",
  13262. referencedClasses: [],
  13263. messageSends: ["subclassResponsibility"]
  13264. }),
  13265. $globals.ProtoStream);
  13266. $core.addMethod(
  13267. $core.method({
  13268. selector: "atStart",
  13269. protocol: "testing",
  13270. fn: function (){
  13271. var self=this,$self=this;
  13272. return $core.withContext(function($ctx1) {
  13273. $self._subclassResponsibility();
  13274. return self;
  13275. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  13276. },
  13277. args: [],
  13278. source: "atStart\x0a\x09self subclassResponsibility",
  13279. referencedClasses: [],
  13280. messageSends: ["subclassResponsibility"]
  13281. }),
  13282. $globals.ProtoStream);
  13283. $core.addMethod(
  13284. $core.method({
  13285. selector: "contents",
  13286. protocol: "accessing",
  13287. fn: function (){
  13288. var self=this,$self=this;
  13289. return $core.withContext(function($ctx1) {
  13290. $self._subclassResponsibility();
  13291. return self;
  13292. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  13293. },
  13294. args: [],
  13295. source: "contents\x0a\x09self subclassResponsibility",
  13296. referencedClasses: [],
  13297. messageSends: ["subclassResponsibility"]
  13298. }),
  13299. $globals.ProtoStream);
  13300. $core.addMethod(
  13301. $core.method({
  13302. selector: "do:",
  13303. protocol: "enumerating",
  13304. fn: function (aBlock){
  13305. var self=this,$self=this;
  13306. return $core.withContext(function($ctx1) {
  13307. $recv((function(){
  13308. return $core.withContext(function($ctx2) {
  13309. return $self._atEnd();
  13310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13311. }))._whileFalse_((function(){
  13312. return $core.withContext(function($ctx2) {
  13313. return $recv(aBlock)._value_($self._next());
  13314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13315. }));
  13316. return self;
  13317. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  13318. },
  13319. args: ["aBlock"],
  13320. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13321. referencedClasses: [],
  13322. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13323. }),
  13324. $globals.ProtoStream);
  13325. $core.addMethod(
  13326. $core.method({
  13327. selector: "isEmpty",
  13328. protocol: "testing",
  13329. fn: function (){
  13330. var self=this,$self=this;
  13331. return $core.withContext(function($ctx1) {
  13332. return $recv($self._atStart())._and_((function(){
  13333. return $core.withContext(function($ctx2) {
  13334. return $self._atEnd();
  13335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13336. }));
  13337. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  13338. },
  13339. args: [],
  13340. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13341. referencedClasses: [],
  13342. messageSends: ["and:", "atStart", "atEnd"]
  13343. }),
  13344. $globals.ProtoStream);
  13345. $core.addMethod(
  13346. $core.method({
  13347. selector: "next",
  13348. protocol: "reading",
  13349. fn: function (){
  13350. var self=this,$self=this;
  13351. return $core.withContext(function($ctx1) {
  13352. var $1;
  13353. $1=$self._atEnd();
  13354. if($core.assert($1)){
  13355. return nil;
  13356. } else {
  13357. return $self._subclassResponsibility();
  13358. }
  13359. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  13360. },
  13361. args: [],
  13362. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13363. referencedClasses: [],
  13364. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13365. }),
  13366. $globals.ProtoStream);
  13367. $core.addMethod(
  13368. $core.method({
  13369. selector: "nextPut:",
  13370. protocol: "writing",
  13371. fn: function (anObject){
  13372. var self=this,$self=this;
  13373. return $core.withContext(function($ctx1) {
  13374. $self._subclassResponsibility();
  13375. return self;
  13376. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  13377. },
  13378. args: ["anObject"],
  13379. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13380. referencedClasses: [],
  13381. messageSends: ["subclassResponsibility"]
  13382. }),
  13383. $globals.ProtoStream);
  13384. $core.addMethod(
  13385. $core.method({
  13386. selector: "nextPutAll:",
  13387. protocol: "writing",
  13388. fn: function (aCollection){
  13389. var self=this,$self=this;
  13390. return $core.withContext(function($ctx1) {
  13391. $recv(aCollection)._do_((function(each){
  13392. return $core.withContext(function($ctx2) {
  13393. return $self._nextPut_(each);
  13394. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13395. }));
  13396. return self;
  13397. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  13398. },
  13399. args: ["aCollection"],
  13400. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13401. referencedClasses: [],
  13402. messageSends: ["do:", "nextPut:"]
  13403. }),
  13404. $globals.ProtoStream);
  13405. $core.addMethod(
  13406. $core.method({
  13407. selector: "nextPutString:",
  13408. protocol: "writing",
  13409. fn: function (aString){
  13410. var self=this,$self=this;
  13411. return $core.withContext(function($ctx1) {
  13412. $self._nextPut_(aString);
  13413. return self;
  13414. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13415. },
  13416. args: ["aString"],
  13417. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13418. referencedClasses: [],
  13419. messageSends: ["nextPut:"]
  13420. }),
  13421. $globals.ProtoStream);
  13422. $core.addMethod(
  13423. $core.method({
  13424. selector: "peek",
  13425. protocol: "reading",
  13426. fn: function (){
  13427. var self=this,$self=this;
  13428. return $core.withContext(function($ctx1) {
  13429. var $1;
  13430. $1=$self._atEnd();
  13431. if($core.assert($1)){
  13432. return nil;
  13433. } else {
  13434. return $self._subclassResponsibility();
  13435. }
  13436. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13437. },
  13438. args: [],
  13439. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13440. referencedClasses: [],
  13441. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13442. }),
  13443. $globals.ProtoStream);
  13444. $core.addMethod(
  13445. $core.method({
  13446. selector: "reset",
  13447. protocol: "actions",
  13448. fn: function (){
  13449. var self=this,$self=this;
  13450. return $core.withContext(function($ctx1) {
  13451. $self._subclassResponsibility();
  13452. return self;
  13453. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  13454. },
  13455. args: [],
  13456. source: "reset\x0a\x09self subclassResponsibility",
  13457. referencedClasses: [],
  13458. messageSends: ["subclassResponsibility"]
  13459. }),
  13460. $globals.ProtoStream);
  13461. $core.addMethod(
  13462. $core.method({
  13463. selector: "resetContents",
  13464. protocol: "actions",
  13465. fn: function (){
  13466. var self=this,$self=this;
  13467. return $core.withContext(function($ctx1) {
  13468. $self._subclassResponsibility();
  13469. return self;
  13470. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13471. },
  13472. args: [],
  13473. source: "resetContents\x0a\x09self subclassResponsibility",
  13474. referencedClasses: [],
  13475. messageSends: ["subclassResponsibility"]
  13476. }),
  13477. $globals.ProtoStream);
  13478. $core.addMethod(
  13479. $core.method({
  13480. selector: "setToEnd",
  13481. protocol: "positioning",
  13482. fn: function (){
  13483. var self=this,$self=this;
  13484. return $core.withContext(function($ctx1) {
  13485. $self._subclassResponsibility();
  13486. return self;
  13487. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13488. },
  13489. args: [],
  13490. source: "setToEnd\x0a\x09self subclassResponsibility",
  13491. referencedClasses: [],
  13492. messageSends: ["subclassResponsibility"]
  13493. }),
  13494. $globals.ProtoStream);
  13495. $core.addMethod(
  13496. $core.method({
  13497. selector: "setToStart",
  13498. protocol: "positioning",
  13499. fn: function (){
  13500. var self=this,$self=this;
  13501. return $core.withContext(function($ctx1) {
  13502. $self._reset();
  13503. return self;
  13504. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13505. },
  13506. args: [],
  13507. source: "setToStart\x0a\x09self reset",
  13508. referencedClasses: [],
  13509. messageSends: ["reset"]
  13510. }),
  13511. $globals.ProtoStream);
  13512. $core.addMethod(
  13513. $core.method({
  13514. selector: "write:",
  13515. protocol: "writing",
  13516. fn: function (anObject){
  13517. var self=this,$self=this;
  13518. return $core.withContext(function($ctx1) {
  13519. $recv(anObject)._putOn_(self);
  13520. return self;
  13521. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13522. },
  13523. args: ["anObject"],
  13524. source: "write: anObject\x0a\x09anObject putOn: self",
  13525. referencedClasses: [],
  13526. messageSends: ["putOn:"]
  13527. }),
  13528. $globals.ProtoStream);
  13529. $core.addMethod(
  13530. $core.method({
  13531. selector: "on:",
  13532. protocol: "instance creation",
  13533. fn: function (aCollection){
  13534. var self=this,$self=this;
  13535. return $core.withContext(function($ctx1) {
  13536. var $1;
  13537. $1=$self._new();
  13538. $recv($1)._setCollection_(aCollection);
  13539. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13540. return $recv($1)._yourself();
  13541. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13542. },
  13543. args: ["aCollection"],
  13544. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13545. referencedClasses: [],
  13546. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13547. }),
  13548. $globals.ProtoStream.a$cls);
  13549. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13550. $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.";
  13551. $core.addMethod(
  13552. $core.method({
  13553. selector: "atEnd",
  13554. protocol: "testing",
  13555. fn: function (){
  13556. var self=this,$self=this;
  13557. return $core.withContext(function($ctx1) {
  13558. return $recv($self._position()).__eq($self._size());
  13559. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13560. },
  13561. args: [],
  13562. source: "atEnd\x0a\x09^ self position = self size",
  13563. referencedClasses: [],
  13564. messageSends: ["=", "position", "size"]
  13565. }),
  13566. $globals.Stream);
  13567. $core.addMethod(
  13568. $core.method({
  13569. selector: "atStart",
  13570. protocol: "testing",
  13571. fn: function (){
  13572. var self=this,$self=this;
  13573. return $core.withContext(function($ctx1) {
  13574. return $recv($self._position()).__eq((0));
  13575. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13576. },
  13577. args: [],
  13578. source: "atStart\x0a\x09^ self position = 0",
  13579. referencedClasses: [],
  13580. messageSends: ["=", "position"]
  13581. }),
  13582. $globals.Stream);
  13583. $core.addMethod(
  13584. $core.method({
  13585. selector: "close",
  13586. protocol: "actions",
  13587. fn: function (){
  13588. var self=this,$self=this;
  13589. return self;
  13590. },
  13591. args: [],
  13592. source: "close",
  13593. referencedClasses: [],
  13594. messageSends: []
  13595. }),
  13596. $globals.Stream);
  13597. $core.addMethod(
  13598. $core.method({
  13599. selector: "collection",
  13600. protocol: "accessing",
  13601. fn: function (){
  13602. var self=this,$self=this;
  13603. return $self["@collection"];
  13604. },
  13605. args: [],
  13606. source: "collection\x0a\x09^ collection",
  13607. referencedClasses: [],
  13608. messageSends: []
  13609. }),
  13610. $globals.Stream);
  13611. $core.addMethod(
  13612. $core.method({
  13613. selector: "contents",
  13614. protocol: "accessing",
  13615. fn: function (){
  13616. var self=this,$self=this;
  13617. return $core.withContext(function($ctx1) {
  13618. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13619. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13620. },
  13621. args: [],
  13622. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13623. referencedClasses: [],
  13624. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13625. }),
  13626. $globals.Stream);
  13627. $core.addMethod(
  13628. $core.method({
  13629. selector: "flush",
  13630. protocol: "actions",
  13631. fn: function (){
  13632. var self=this,$self=this;
  13633. return self;
  13634. },
  13635. args: [],
  13636. source: "flush",
  13637. referencedClasses: [],
  13638. messageSends: []
  13639. }),
  13640. $globals.Stream);
  13641. $core.addMethod(
  13642. $core.method({
  13643. selector: "isEmpty",
  13644. protocol: "testing",
  13645. fn: function (){
  13646. var self=this,$self=this;
  13647. return $core.withContext(function($ctx1) {
  13648. return $recv($self._size()).__eq((0));
  13649. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13650. },
  13651. args: [],
  13652. source: "isEmpty\x0a\x09^ self size = 0",
  13653. referencedClasses: [],
  13654. messageSends: ["=", "size"]
  13655. }),
  13656. $globals.Stream);
  13657. $core.addMethod(
  13658. $core.method({
  13659. selector: "next",
  13660. protocol: "reading",
  13661. fn: function (){
  13662. var self=this,$self=this;
  13663. return $core.withContext(function($ctx1) {
  13664. var $1,$3,$2;
  13665. $1=$self._atEnd();
  13666. if($core.assert($1)){
  13667. return nil;
  13668. } else {
  13669. $3=$self._position();
  13670. $ctx1.sendIdx["position"]=1;
  13671. $2=$recv($3).__plus((1));
  13672. $self._position_($2);
  13673. return $recv($self["@collection"])._at_($self._position());
  13674. }
  13675. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13676. },
  13677. args: [],
  13678. 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 ]",
  13679. referencedClasses: [],
  13680. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13681. }),
  13682. $globals.Stream);
  13683. $core.addMethod(
  13684. $core.method({
  13685. selector: "next:",
  13686. protocol: "reading",
  13687. fn: function (anInteger){
  13688. var self=this,$self=this;
  13689. var tempCollection;
  13690. return $core.withContext(function($ctx1) {
  13691. var $1;
  13692. tempCollection=$recv($recv($self._collection())._class())._new();
  13693. $recv(anInteger)._timesRepeat_((function(){
  13694. return $core.withContext(function($ctx2) {
  13695. $1=$self._atEnd();
  13696. if(!$core.assert($1)){
  13697. return $recv(tempCollection)._add_($self._next());
  13698. }
  13699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13700. }));
  13701. return tempCollection;
  13702. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13703. },
  13704. args: ["anInteger"],
  13705. 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",
  13706. referencedClasses: [],
  13707. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13708. }),
  13709. $globals.Stream);
  13710. $core.addMethod(
  13711. $core.method({
  13712. selector: "nextPut:",
  13713. protocol: "writing",
  13714. fn: function (anObject){
  13715. var self=this,$self=this;
  13716. return $core.withContext(function($ctx1) {
  13717. var $2,$1,$3,$4;
  13718. $2=$self._position();
  13719. $ctx1.sendIdx["position"]=1;
  13720. $1=$recv($2).__plus((1));
  13721. $self._position_($1);
  13722. $3=$self._collection();
  13723. $4=$self._position();
  13724. $ctx1.sendIdx["position"]=2;
  13725. $recv($3)._at_put_($4,anObject);
  13726. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13727. return self;
  13728. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13729. },
  13730. args: ["anObject"],
  13731. 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)",
  13732. referencedClasses: [],
  13733. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13734. }),
  13735. $globals.Stream);
  13736. $core.addMethod(
  13737. $core.method({
  13738. selector: "peek",
  13739. protocol: "reading",
  13740. fn: function (){
  13741. var self=this,$self=this;
  13742. return $core.withContext(function($ctx1) {
  13743. var $1;
  13744. $1=$self._atEnd();
  13745. if(!$core.assert($1)){
  13746. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13747. }
  13748. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13749. },
  13750. args: [],
  13751. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13752. referencedClasses: [],
  13753. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13754. }),
  13755. $globals.Stream);
  13756. $core.addMethod(
  13757. $core.method({
  13758. selector: "position",
  13759. protocol: "accessing",
  13760. fn: function (){
  13761. var self=this,$self=this;
  13762. return $core.withContext(function($ctx1) {
  13763. var $1,$receiver;
  13764. $1=$self["@position"];
  13765. if(($receiver = $1) == null || $receiver.a$nil){
  13766. $self["@position"]=(0);
  13767. return $self["@position"];
  13768. } else {
  13769. return $1;
  13770. }
  13771. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13772. },
  13773. args: [],
  13774. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13775. referencedClasses: [],
  13776. messageSends: ["ifNil:"]
  13777. }),
  13778. $globals.Stream);
  13779. $core.addMethod(
  13780. $core.method({
  13781. selector: "position:",
  13782. protocol: "accessing",
  13783. fn: function (anInteger){
  13784. var self=this,$self=this;
  13785. $self["@position"]=anInteger;
  13786. return self;
  13787. },
  13788. args: ["anInteger"],
  13789. source: "position: anInteger\x0a\x09position := anInteger",
  13790. referencedClasses: [],
  13791. messageSends: []
  13792. }),
  13793. $globals.Stream);
  13794. $core.addMethod(
  13795. $core.method({
  13796. selector: "reset",
  13797. protocol: "actions",
  13798. fn: function (){
  13799. var self=this,$self=this;
  13800. return $core.withContext(function($ctx1) {
  13801. $self._position_((0));
  13802. return self;
  13803. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13804. },
  13805. args: [],
  13806. source: "reset\x0a\x09self position: 0",
  13807. referencedClasses: [],
  13808. messageSends: ["position:"]
  13809. }),
  13810. $globals.Stream);
  13811. $core.addMethod(
  13812. $core.method({
  13813. selector: "resetContents",
  13814. protocol: "actions",
  13815. fn: function (){
  13816. var self=this,$self=this;
  13817. return $core.withContext(function($ctx1) {
  13818. $self._reset();
  13819. $self._setStreamSize_((0));
  13820. return self;
  13821. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13822. },
  13823. args: [],
  13824. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13825. referencedClasses: [],
  13826. messageSends: ["reset", "setStreamSize:"]
  13827. }),
  13828. $globals.Stream);
  13829. $core.addMethod(
  13830. $core.method({
  13831. selector: "setCollection:",
  13832. protocol: "accessing",
  13833. fn: function (aCollection){
  13834. var self=this,$self=this;
  13835. $self["@collection"]=aCollection;
  13836. return self;
  13837. },
  13838. args: ["aCollection"],
  13839. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13840. referencedClasses: [],
  13841. messageSends: []
  13842. }),
  13843. $globals.Stream);
  13844. $core.addMethod(
  13845. $core.method({
  13846. selector: "setStreamSize:",
  13847. protocol: "accessing",
  13848. fn: function (anInteger){
  13849. var self=this,$self=this;
  13850. $self["@streamSize"]=anInteger;
  13851. return self;
  13852. },
  13853. args: ["anInteger"],
  13854. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13855. referencedClasses: [],
  13856. messageSends: []
  13857. }),
  13858. $globals.Stream);
  13859. $core.addMethod(
  13860. $core.method({
  13861. selector: "setToEnd",
  13862. protocol: "positioning",
  13863. fn: function (){
  13864. var self=this,$self=this;
  13865. return $core.withContext(function($ctx1) {
  13866. $self._position_($self._size());
  13867. return self;
  13868. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13869. },
  13870. args: [],
  13871. source: "setToEnd\x0a\x09self position: self size",
  13872. referencedClasses: [],
  13873. messageSends: ["position:", "size"]
  13874. }),
  13875. $globals.Stream);
  13876. $core.addMethod(
  13877. $core.method({
  13878. selector: "size",
  13879. protocol: "accessing",
  13880. fn: function (){
  13881. var self=this,$self=this;
  13882. return $core.withContext(function($ctx1) {
  13883. return $self._streamSize();
  13884. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13885. },
  13886. args: [],
  13887. source: "size\x0a\x09^ self streamSize",
  13888. referencedClasses: [],
  13889. messageSends: ["streamSize"]
  13890. }),
  13891. $globals.Stream);
  13892. $core.addMethod(
  13893. $core.method({
  13894. selector: "skip:",
  13895. protocol: "positioning",
  13896. fn: function (anInteger){
  13897. var self=this,$self=this;
  13898. return $core.withContext(function($ctx1) {
  13899. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13900. return self;
  13901. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13902. },
  13903. args: ["anInteger"],
  13904. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13905. referencedClasses: [],
  13906. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13907. }),
  13908. $globals.Stream);
  13909. $core.addMethod(
  13910. $core.method({
  13911. selector: "streamSize",
  13912. protocol: "accessing",
  13913. fn: function (){
  13914. var self=this,$self=this;
  13915. return $self["@streamSize"];
  13916. },
  13917. args: [],
  13918. source: "streamSize\x0a\x09^ streamSize",
  13919. referencedClasses: [],
  13920. messageSends: []
  13921. }),
  13922. $globals.Stream);
  13923. $core.addMethod(
  13924. $core.method({
  13925. selector: "on:",
  13926. protocol: "instance creation",
  13927. fn: function (aCollection){
  13928. var self=this,$self=this;
  13929. return $core.withContext(function($ctx1) {
  13930. var $1;
  13931. $1=$self._new();
  13932. $recv($1)._setCollection_(aCollection);
  13933. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13934. return $recv($1)._yourself();
  13935. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13936. },
  13937. args: ["aCollection"],
  13938. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13939. referencedClasses: [],
  13940. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13941. }),
  13942. $globals.Stream.a$cls);
  13943. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13944. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13945. $core.addMethod(
  13946. $core.method({
  13947. selector: "cr",
  13948. protocol: "writing",
  13949. fn: function (){
  13950. var self=this,$self=this;
  13951. return $core.withContext(function($ctx1) {
  13952. return $self._nextPutAll_($recv($globals.String)._cr());
  13953. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  13954. },
  13955. args: [],
  13956. source: "cr\x0a\x09^ self nextPutAll: String cr",
  13957. referencedClasses: ["String"],
  13958. messageSends: ["nextPutAll:", "cr"]
  13959. }),
  13960. $globals.StringStream);
  13961. $core.addMethod(
  13962. $core.method({
  13963. selector: "crlf",
  13964. protocol: "writing",
  13965. fn: function (){
  13966. var self=this,$self=this;
  13967. return $core.withContext(function($ctx1) {
  13968. return $self._nextPutAll_($recv($globals.String)._crlf());
  13969. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  13970. },
  13971. args: [],
  13972. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  13973. referencedClasses: ["String"],
  13974. messageSends: ["nextPutAll:", "crlf"]
  13975. }),
  13976. $globals.StringStream);
  13977. $core.addMethod(
  13978. $core.method({
  13979. selector: "lf",
  13980. protocol: "writing",
  13981. fn: function (){
  13982. var self=this,$self=this;
  13983. return $core.withContext(function($ctx1) {
  13984. return $self._nextPutAll_($recv($globals.String)._lf());
  13985. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  13986. },
  13987. args: [],
  13988. source: "lf\x0a\x09^ self nextPutAll: String lf",
  13989. referencedClasses: ["String"],
  13990. messageSends: ["nextPutAll:", "lf"]
  13991. }),
  13992. $globals.StringStream);
  13993. $core.addMethod(
  13994. $core.method({
  13995. selector: "next:",
  13996. protocol: "reading",
  13997. fn: function (anInteger){
  13998. var self=this,$self=this;
  13999. var tempCollection;
  14000. return $core.withContext(function($ctx1) {
  14001. var $1;
  14002. tempCollection=$recv($recv($self._collection())._class())._new();
  14003. $recv(anInteger)._timesRepeat_((function(){
  14004. return $core.withContext(function($ctx2) {
  14005. $1=$self._atEnd();
  14006. if(!$core.assert($1)){
  14007. tempCollection=$recv(tempCollection).__comma($self._next());
  14008. return tempCollection;
  14009. }
  14010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14011. }));
  14012. return tempCollection;
  14013. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  14014. },
  14015. args: ["anInteger"],
  14016. 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",
  14017. referencedClasses: [],
  14018. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14019. }),
  14020. $globals.StringStream);
  14021. $core.addMethod(
  14022. $core.method({
  14023. selector: "nextPut:",
  14024. protocol: "writing",
  14025. fn: function (aString){
  14026. var self=this,$self=this;
  14027. return $core.withContext(function($ctx1) {
  14028. $self._nextPutAll_(aString);
  14029. return self;
  14030. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  14031. },
  14032. args: ["aString"],
  14033. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14034. referencedClasses: [],
  14035. messageSends: ["nextPutAll:"]
  14036. }),
  14037. $globals.StringStream);
  14038. $core.addMethod(
  14039. $core.method({
  14040. selector: "nextPutAll:",
  14041. protocol: "writing",
  14042. fn: function (aString){
  14043. var self=this,$self=this;
  14044. var pre,post;
  14045. return $core.withContext(function($ctx1) {
  14046. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  14047. $1=$self._atEnd();
  14048. if($core.assert($1)){
  14049. $3=$self._collection();
  14050. $ctx1.sendIdx["collection"]=1;
  14051. $2=$recv($3).__comma(aString);
  14052. $ctx1.sendIdx[","]=1;
  14053. $self._setCollection_($2);
  14054. $ctx1.sendIdx["setCollection:"]=1;
  14055. } else {
  14056. $4=$self._collection();
  14057. $ctx1.sendIdx["collection"]=2;
  14058. $5=$self._position();
  14059. $ctx1.sendIdx["position"]=1;
  14060. pre=$recv($4)._copyFrom_to_((1),$5);
  14061. $ctx1.sendIdx["copyFrom:to:"]=1;
  14062. pre;
  14063. $6=$self._collection();
  14064. $ctx1.sendIdx["collection"]=3;
  14065. $9=$self._position();
  14066. $ctx1.sendIdx["position"]=2;
  14067. $8=$recv($9).__plus((1));
  14068. $ctx1.sendIdx["+"]=2;
  14069. $10=$recv(aString)._size();
  14070. $ctx1.sendIdx["size"]=1;
  14071. $7=$recv($8).__plus($10);
  14072. $ctx1.sendIdx["+"]=1;
  14073. $11=$recv($self._collection())._size();
  14074. $ctx1.sendIdx["size"]=2;
  14075. post=$recv($6)._copyFrom_to_($7,$11);
  14076. post;
  14077. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  14078. $ctx1.sendIdx[","]=2;
  14079. $self._setCollection_($12);
  14080. }
  14081. $14=$self._position();
  14082. $ctx1.sendIdx["position"]=3;
  14083. $13=$recv($14).__plus($recv(aString)._size());
  14084. $self._position_($13);
  14085. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14086. return self;
  14087. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  14088. },
  14089. args: ["aString"],
  14090. 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)",
  14091. referencedClasses: [],
  14092. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  14093. }),
  14094. $globals.StringStream);
  14095. $core.addMethod(
  14096. $core.method({
  14097. selector: "nextPutString:",
  14098. protocol: "writing",
  14099. fn: function (aString){
  14100. var self=this,$self=this;
  14101. return $core.withContext(function($ctx1) {
  14102. $self._nextPutAll_(aString);
  14103. return self;
  14104. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  14105. },
  14106. args: ["aString"],
  14107. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14108. referencedClasses: [],
  14109. messageSends: ["nextPutAll:"]
  14110. }),
  14111. $globals.StringStream);
  14112. $core.addMethod(
  14113. $core.method({
  14114. selector: "print:",
  14115. protocol: "writing",
  14116. fn: function (anObject){
  14117. var self=this,$self=this;
  14118. return $core.withContext(function($ctx1) {
  14119. $recv(anObject)._printOn_(self);
  14120. return self;
  14121. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  14122. },
  14123. args: ["anObject"],
  14124. source: "print: anObject\x0a\x09anObject printOn: self",
  14125. referencedClasses: [],
  14126. messageSends: ["printOn:"]
  14127. }),
  14128. $globals.StringStream);
  14129. $core.addMethod(
  14130. $core.method({
  14131. selector: "printSymbol:",
  14132. protocol: "writing",
  14133. fn: function (anObject){
  14134. var self=this,$self=this;
  14135. return $core.withContext(function($ctx1) {
  14136. $recv(anObject)._asSymbolPrintOn_(self);
  14137. return self;
  14138. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  14139. },
  14140. args: ["anObject"],
  14141. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14142. referencedClasses: [],
  14143. messageSends: ["asSymbolPrintOn:"]
  14144. }),
  14145. $globals.StringStream);
  14146. $core.addMethod(
  14147. $core.method({
  14148. selector: "space",
  14149. protocol: "writing",
  14150. fn: function (){
  14151. var self=this,$self=this;
  14152. return $core.withContext(function($ctx1) {
  14153. $self._nextPut_(" ");
  14154. return self;
  14155. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  14156. },
  14157. args: [],
  14158. source: "space\x0a\x09self nextPut: ' '",
  14159. referencedClasses: [],
  14160. messageSends: ["nextPut:"]
  14161. }),
  14162. $globals.StringStream);
  14163. $core.addMethod(
  14164. $core.method({
  14165. selector: "tab",
  14166. protocol: "writing",
  14167. fn: function (){
  14168. var self=this,$self=this;
  14169. return $core.withContext(function($ctx1) {
  14170. return $self._nextPutAll_($recv($globals.String)._tab());
  14171. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  14172. },
  14173. args: [],
  14174. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14175. referencedClasses: ["String"],
  14176. messageSends: ["nextPutAll:", "tab"]
  14177. }),
  14178. $globals.StringStream);
  14179. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14180. $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.";
  14181. $core.addMethod(
  14182. $core.method({
  14183. selector: "initialize",
  14184. protocol: "initialization",
  14185. fn: function (){
  14186. var self=this,$self=this;
  14187. return $core.withContext(function($ctx1) {
  14188. (
  14189. $ctx1.supercall = true,
  14190. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14191. $ctx1.supercall = false;
  14192. $self["@read"]=$recv($globals.OrderedCollection)._new();
  14193. $ctx1.sendIdx["new"]=1;
  14194. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14195. $self["@readIndex"]=(1);
  14196. return self;
  14197. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  14198. },
  14199. args: [],
  14200. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14201. referencedClasses: ["OrderedCollection"],
  14202. messageSends: ["initialize", "new"]
  14203. }),
  14204. $globals.Queue);
  14205. $core.addMethod(
  14206. $core.method({
  14207. selector: "next",
  14208. protocol: "accessing",
  14209. fn: function (){
  14210. var self=this,$self=this;
  14211. return $core.withContext(function($ctx1) {
  14212. return $self._nextIfAbsent_((function(){
  14213. return $core.withContext(function($ctx2) {
  14214. return $self._error_("Cannot read from empty Queue.");
  14215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14216. }));
  14217. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  14218. },
  14219. args: [],
  14220. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14221. referencedClasses: [],
  14222. messageSends: ["nextIfAbsent:", "error:"]
  14223. }),
  14224. $globals.Queue);
  14225. $core.addMethod(
  14226. $core.method({
  14227. selector: "nextIfAbsent:",
  14228. protocol: "accessing",
  14229. fn: function (aBlock){
  14230. var self=this,$self=this;
  14231. var result;
  14232. return $core.withContext(function($ctx1) {
  14233. var $1;
  14234. var $early={};
  14235. try {
  14236. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  14237. return $core.withContext(function($ctx2) {
  14238. $recv($self["@write"])._ifEmpty_((function(){
  14239. return $core.withContext(function($ctx3) {
  14240. $1=$recv($self["@readIndex"]).__gt((1));
  14241. if($core.assert($1)){
  14242. $self["@read"]=[];
  14243. $self["@read"];
  14244. $self["@readIndex"]=(1);
  14245. $self["@readIndex"];
  14246. }
  14247. throw $early=[$recv(aBlock)._value()];
  14248. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14249. }));
  14250. $self["@read"]=$self["@write"];
  14251. $self["@read"];
  14252. $self["@readIndex"]=(1);
  14253. $self["@readIndex"];
  14254. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14255. $self["@write"];
  14256. return $recv($self["@read"])._first();
  14257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14258. }));
  14259. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  14260. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  14261. return result;
  14262. }
  14263. catch(e) {if(e===$early)return e[0]; throw e}
  14264. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  14265. },
  14266. args: ["aBlock"],
  14267. 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",
  14268. referencedClasses: ["OrderedCollection"],
  14269. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14270. }),
  14271. $globals.Queue);
  14272. $core.addMethod(
  14273. $core.method({
  14274. selector: "nextPut:",
  14275. protocol: "accessing",
  14276. fn: function (anObject){
  14277. var self=this,$self=this;
  14278. return $core.withContext(function($ctx1) {
  14279. $recv($self["@write"])._add_(anObject);
  14280. return self;
  14281. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  14282. },
  14283. args: ["anObject"],
  14284. source: "nextPut: anObject\x0a\x09write add: anObject",
  14285. referencedClasses: [],
  14286. messageSends: ["add:"]
  14287. }),
  14288. $globals.Queue);
  14289. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14290. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14291. $core.addMethod(
  14292. $core.method({
  14293. selector: "compile:",
  14294. protocol: "evaluating",
  14295. fn: function (aString){
  14296. var self=this,$self=this;
  14297. return $core.withContext(function($ctx1) {
  14298. return self.compile(aString);
  14299. return self;
  14300. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  14301. },
  14302. args: ["aString"],
  14303. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14304. referencedClasses: [],
  14305. messageSends: []
  14306. }),
  14307. $globals.RegularExpression);
  14308. $core.addMethod(
  14309. $core.method({
  14310. selector: "exec:",
  14311. protocol: "evaluating",
  14312. fn: function (aString){
  14313. var self=this,$self=this;
  14314. return $core.withContext(function($ctx1) {
  14315. return self.exec(aString) || nil;
  14316. return self;
  14317. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  14318. },
  14319. args: ["aString"],
  14320. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14321. referencedClasses: [],
  14322. messageSends: []
  14323. }),
  14324. $globals.RegularExpression);
  14325. $core.addMethod(
  14326. $core.method({
  14327. selector: "test:",
  14328. protocol: "evaluating",
  14329. fn: function (aString){
  14330. var self=this,$self=this;
  14331. return $core.withContext(function($ctx1) {
  14332. return self.test(aString);
  14333. return self;
  14334. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  14335. },
  14336. args: ["aString"],
  14337. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14338. referencedClasses: [],
  14339. messageSends: []
  14340. }),
  14341. $globals.RegularExpression);
  14342. $core.addMethod(
  14343. $core.method({
  14344. selector: "fromString:",
  14345. protocol: "instance creation",
  14346. fn: function (aString){
  14347. var self=this,$self=this;
  14348. return $core.withContext(function($ctx1) {
  14349. return $self._fromString_flag_(aString,"");
  14350. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  14351. },
  14352. args: ["aString"],
  14353. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14354. referencedClasses: [],
  14355. messageSends: ["fromString:flag:"]
  14356. }),
  14357. $globals.RegularExpression.a$cls);
  14358. $core.addMethod(
  14359. $core.method({
  14360. selector: "fromString:flag:",
  14361. protocol: "instance creation",
  14362. fn: function (aString,anotherString){
  14363. var self=this,$self=this;
  14364. return $core.withContext(function($ctx1) {
  14365. return new RegExp(aString, anotherString);
  14366. return self;
  14367. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  14368. },
  14369. args: ["aString", "anotherString"],
  14370. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14371. referencedClasses: [],
  14372. messageSends: []
  14373. }),
  14374. $globals.RegularExpression.a$cls);
  14375. });
  14376. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14377. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14378. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14379. $core.addPackage("Kernel-Classes");
  14380. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14381. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14382. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14383. $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.";
  14384. $core.addMethod(
  14385. $core.method({
  14386. selector: "allInstanceVariableNames",
  14387. protocol: "accessing",
  14388. fn: function (){
  14389. var self=this,$self=this;
  14390. var result;
  14391. return $core.withContext(function($ctx1) {
  14392. var $1,$receiver;
  14393. result=$recv($self._instanceVariableNames())._copy();
  14394. $1=$self._superclass();
  14395. $ctx1.sendIdx["superclass"]=1;
  14396. if(($receiver = $1) == null || $receiver.a$nil){
  14397. $1;
  14398. } else {
  14399. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14400. }
  14401. return result;
  14402. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14403. },
  14404. args: [],
  14405. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14406. referencedClasses: [],
  14407. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14408. }),
  14409. $globals.Behavior);
  14410. $core.addMethod(
  14411. $core.method({
  14412. selector: "allSelectors",
  14413. protocol: "accessing",
  14414. fn: function (){
  14415. var self=this,$self=this;
  14416. return $core.withContext(function($ctx1) {
  14417. var $1,$2;
  14418. $1=$self._allSuperclasses();
  14419. $2=$self._selectors();
  14420. $ctx1.sendIdx["selectors"]=1;
  14421. return $recv($1)._inject_into_($2,(function(acc,each){
  14422. return $core.withContext(function($ctx2) {
  14423. $recv(acc)._addAll_($recv(each)._selectors());
  14424. return $recv(acc)._yourself();
  14425. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14426. }));
  14427. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14428. },
  14429. args: [],
  14430. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14431. referencedClasses: [],
  14432. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14433. }),
  14434. $globals.Behavior);
  14435. $core.addMethod(
  14436. $core.method({
  14437. selector: "allSubclasses",
  14438. protocol: "accessing",
  14439. fn: function (){
  14440. var self=this,$self=this;
  14441. return $core.withContext(function($ctx1) {
  14442. return $recv($globals.Array)._streamContents_((function(str){
  14443. return $core.withContext(function($ctx2) {
  14444. return $self._allSubclassesDo_((function(each){
  14445. return $core.withContext(function($ctx3) {
  14446. return $recv(str)._nextPut_(each);
  14447. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14448. }));
  14449. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14450. }));
  14451. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14452. },
  14453. args: [],
  14454. 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 ] ]",
  14455. referencedClasses: ["Array"],
  14456. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14457. }),
  14458. $globals.Behavior);
  14459. $core.addMethod(
  14460. $core.method({
  14461. selector: "allSubclassesDo:",
  14462. protocol: "enumerating",
  14463. fn: function (aBlock){
  14464. var self=this,$self=this;
  14465. return $core.withContext(function($ctx1) {
  14466. $core.traverseClassTree(self, function(subclass) {
  14467. if (subclass !== self) aBlock._value_(subclass);
  14468. });
  14469. return self;
  14470. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14471. },
  14472. args: ["aBlock"],
  14473. 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})'>",
  14474. referencedClasses: [],
  14475. messageSends: []
  14476. }),
  14477. $globals.Behavior);
  14478. $core.addMethod(
  14479. $core.method({
  14480. selector: "allSuperclasses",
  14481. protocol: "accessing",
  14482. fn: function (){
  14483. var self=this,$self=this;
  14484. return $core.withContext(function($ctx1) {
  14485. var $1,$3,$2,$receiver;
  14486. $1=$self._superclass();
  14487. $ctx1.sendIdx["superclass"]=1;
  14488. if(($receiver = $1) == null || $receiver.a$nil){
  14489. return [];
  14490. } else {
  14491. $1;
  14492. }
  14493. $3=$self._superclass();
  14494. $ctx1.sendIdx["superclass"]=2;
  14495. $2=$recv($globals.OrderedCollection)._with_($3);
  14496. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14497. return $recv($2)._yourself();
  14498. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14499. },
  14500. args: [],
  14501. 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",
  14502. referencedClasses: ["OrderedCollection"],
  14503. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14504. }),
  14505. $globals.Behavior);
  14506. $core.addMethod(
  14507. $core.method({
  14508. selector: "basicNew",
  14509. protocol: "instance creation",
  14510. fn: function (){
  14511. var self=this,$self=this;
  14512. return $core.withContext(function($ctx1) {
  14513. return new self.fn();
  14514. return self;
  14515. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14516. },
  14517. args: [],
  14518. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14519. referencedClasses: [],
  14520. messageSends: []
  14521. }),
  14522. $globals.Behavior);
  14523. $core.addMethod(
  14524. $core.method({
  14525. selector: "basicOrganization",
  14526. protocol: "accessing",
  14527. fn: function (){
  14528. var self=this,$self=this;
  14529. return $self["@organization"];
  14530. },
  14531. args: [],
  14532. source: "basicOrganization\x0a\x09^ organization",
  14533. referencedClasses: [],
  14534. messageSends: []
  14535. }),
  14536. $globals.Behavior);
  14537. $core.addMethod(
  14538. $core.method({
  14539. selector: "basicOrganization:",
  14540. protocol: "accessing",
  14541. fn: function (aClassOrganizer){
  14542. var self=this,$self=this;
  14543. $self["@organization"]=aClassOrganizer;
  14544. return self;
  14545. },
  14546. args: ["aClassOrganizer"],
  14547. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14548. referencedClasses: [],
  14549. messageSends: []
  14550. }),
  14551. $globals.Behavior);
  14552. $core.addMethod(
  14553. $core.method({
  14554. selector: "canUnderstand:",
  14555. protocol: "testing",
  14556. fn: function (aSelector){
  14557. var self=this,$self=this;
  14558. return $core.withContext(function($ctx1) {
  14559. var $2,$1;
  14560. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14561. return $core.withContext(function($ctx2) {
  14562. $2=$self._superclass();
  14563. $ctx2.sendIdx["superclass"]=1;
  14564. $1=$recv($2)._notNil();
  14565. return $recv($1)._and_((function(){
  14566. return $core.withContext(function($ctx3) {
  14567. return $recv($self._superclass())._canUnderstand_(aSelector);
  14568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14569. }));
  14570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14571. }));
  14572. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14573. },
  14574. args: ["aSelector"],
  14575. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14576. referencedClasses: [],
  14577. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14578. }),
  14579. $globals.Behavior);
  14580. $core.addMethod(
  14581. $core.method({
  14582. selector: "includesBehavior:",
  14583. protocol: "testing",
  14584. fn: function (aClass){
  14585. var self=this,$self=this;
  14586. return $core.withContext(function($ctx1) {
  14587. return $recv($self.__eq_eq(aClass))._or_((function(){
  14588. return $core.withContext(function($ctx2) {
  14589. return $self._inheritsFrom_(aClass);
  14590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14591. }));
  14592. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14593. },
  14594. args: ["aClass"],
  14595. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14596. referencedClasses: [],
  14597. messageSends: ["or:", "==", "inheritsFrom:"]
  14598. }),
  14599. $globals.Behavior);
  14600. $core.addMethod(
  14601. $core.method({
  14602. selector: "inheritsFrom:",
  14603. protocol: "testing",
  14604. fn: function (aClass){
  14605. var self=this,$self=this;
  14606. return $core.withContext(function($ctx1) {
  14607. var $1,$3,$2,$receiver;
  14608. $1=$self._superclass();
  14609. $ctx1.sendIdx["superclass"]=1;
  14610. if(($receiver = $1) == null || $receiver.a$nil){
  14611. return false;
  14612. } else {
  14613. $1;
  14614. }
  14615. $3=$self._superclass();
  14616. $ctx1.sendIdx["superclass"]=2;
  14617. $2=$recv(aClass).__eq_eq($3);
  14618. return $recv($2)._or_((function(){
  14619. return $core.withContext(function($ctx2) {
  14620. return $recv($self._superclass())._inheritsFrom_(aClass);
  14621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14622. }));
  14623. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14624. },
  14625. args: ["aClass"],
  14626. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14627. referencedClasses: [],
  14628. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14629. }),
  14630. $globals.Behavior);
  14631. $core.addMethod(
  14632. $core.method({
  14633. selector: "instanceVariableNames",
  14634. protocol: "accessing",
  14635. fn: function (){
  14636. var self=this,$self=this;
  14637. return $core.withContext(function($ctx1) {
  14638. return self.iVarNames;
  14639. return self;
  14640. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14641. },
  14642. args: [],
  14643. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14644. referencedClasses: [],
  14645. messageSends: []
  14646. }),
  14647. $globals.Behavior);
  14648. $core.addMethod(
  14649. $core.method({
  14650. selector: "isBehavior",
  14651. protocol: "testing",
  14652. fn: function (){
  14653. var self=this,$self=this;
  14654. return true;
  14655. },
  14656. args: [],
  14657. source: "isBehavior\x0a\x09^ true",
  14658. referencedClasses: [],
  14659. messageSends: []
  14660. }),
  14661. $globals.Behavior);
  14662. $core.addMethod(
  14663. $core.method({
  14664. selector: "javascriptConstructor",
  14665. protocol: "accessing",
  14666. fn: function (){
  14667. var self=this,$self=this;
  14668. return $core.withContext(function($ctx1) {
  14669. return self.fn;
  14670. return self;
  14671. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14672. },
  14673. args: [],
  14674. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14675. referencedClasses: [],
  14676. messageSends: []
  14677. }),
  14678. $globals.Behavior);
  14679. $core.addMethod(
  14680. $core.method({
  14681. selector: "javascriptConstructor:",
  14682. protocol: "accessing",
  14683. fn: function (aJavaScriptFunction){
  14684. var self=this,$self=this;
  14685. return $core.withContext(function($ctx1) {
  14686. $core.setClassConstructor(self, aJavaScriptFunction);;
  14687. return self;
  14688. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14689. },
  14690. args: ["aJavaScriptFunction"],
  14691. 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);'>",
  14692. referencedClasses: [],
  14693. messageSends: []
  14694. }),
  14695. $globals.Behavior);
  14696. $core.addMethod(
  14697. $core.method({
  14698. selector: "lookupSelector:",
  14699. protocol: "accessing",
  14700. fn: function (selector){
  14701. var self=this,$self=this;
  14702. var lookupClass;
  14703. return $core.withContext(function($ctx1) {
  14704. var $1;
  14705. var $early={};
  14706. try {
  14707. lookupClass=self;
  14708. $recv((function(){
  14709. return $core.withContext(function($ctx2) {
  14710. return $recv(lookupClass).__eq(nil);
  14711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14712. }))._whileFalse_((function(){
  14713. return $core.withContext(function($ctx2) {
  14714. $1=$recv(lookupClass)._includesSelector_(selector);
  14715. if($core.assert($1)){
  14716. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14717. }
  14718. lookupClass=$recv(lookupClass)._superclass();
  14719. return lookupClass;
  14720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14721. }));
  14722. return nil;
  14723. }
  14724. catch(e) {if(e===$early)return e[0]; throw e}
  14725. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14726. },
  14727. args: ["selector"],
  14728. 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",
  14729. referencedClasses: [],
  14730. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14731. }),
  14732. $globals.Behavior);
  14733. $core.addMethod(
  14734. $core.method({
  14735. selector: "new",
  14736. protocol: "instance creation",
  14737. fn: function (){
  14738. var self=this,$self=this;
  14739. return $core.withContext(function($ctx1) {
  14740. return $recv($self._basicNew())._initialize();
  14741. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14742. },
  14743. args: [],
  14744. source: "new\x0a\x09^ self basicNew initialize",
  14745. referencedClasses: [],
  14746. messageSends: ["initialize", "basicNew"]
  14747. }),
  14748. $globals.Behavior);
  14749. $core.addMethod(
  14750. $core.method({
  14751. selector: "prototype",
  14752. protocol: "accessing",
  14753. fn: function (){
  14754. var self=this,$self=this;
  14755. return $core.withContext(function($ctx1) {
  14756. return self.fn.prototype;
  14757. return self;
  14758. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14759. },
  14760. args: [],
  14761. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14762. referencedClasses: [],
  14763. messageSends: []
  14764. }),
  14765. $globals.Behavior);
  14766. $core.addMethod(
  14767. $core.method({
  14768. selector: "subclasses",
  14769. protocol: "accessing",
  14770. fn: function (){
  14771. var self=this,$self=this;
  14772. return $core.withContext(function($ctx1) {
  14773. $self._subclassResponsibility();
  14774. return self;
  14775. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14776. },
  14777. args: [],
  14778. source: "subclasses\x0a\x09self subclassResponsibility",
  14779. referencedClasses: [],
  14780. messageSends: ["subclassResponsibility"]
  14781. }),
  14782. $globals.Behavior);
  14783. $core.addMethod(
  14784. $core.method({
  14785. selector: "superclass",
  14786. protocol: "accessing",
  14787. fn: function (){
  14788. var self=this,$self=this;
  14789. return $core.withContext(function($ctx1) {
  14790. return self.superclass;
  14791. return self;
  14792. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14793. },
  14794. args: [],
  14795. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14796. referencedClasses: [],
  14797. messageSends: []
  14798. }),
  14799. $globals.Behavior);
  14800. $core.addMethod(
  14801. $core.method({
  14802. selector: "theMetaClass",
  14803. protocol: "accessing",
  14804. fn: function (){
  14805. var self=this,$self=this;
  14806. return $core.withContext(function($ctx1) {
  14807. $self._subclassResponsibility();
  14808. return self;
  14809. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14810. },
  14811. args: [],
  14812. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14813. referencedClasses: [],
  14814. messageSends: ["subclassResponsibility"]
  14815. }),
  14816. $globals.Behavior);
  14817. $core.addMethod(
  14818. $core.method({
  14819. selector: "theNonMetaClass",
  14820. protocol: "accessing",
  14821. fn: function (){
  14822. var self=this,$self=this;
  14823. return $core.withContext(function($ctx1) {
  14824. $self._subclassResponsibility();
  14825. return self;
  14826. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14827. },
  14828. args: [],
  14829. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14830. referencedClasses: [],
  14831. messageSends: ["subclassResponsibility"]
  14832. }),
  14833. $globals.Behavior);
  14834. $core.addMethod(
  14835. $core.method({
  14836. selector: "withAllSubclasses",
  14837. protocol: "accessing",
  14838. fn: function (){
  14839. var self=this,$self=this;
  14840. return $core.withContext(function($ctx1) {
  14841. var $1;
  14842. $1=$recv($globals.Array)._with_(self);
  14843. $recv($1)._addAll_($self._allSubclasses());
  14844. return $recv($1)._yourself();
  14845. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14846. },
  14847. args: [],
  14848. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14849. referencedClasses: ["Array"],
  14850. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14851. }),
  14852. $globals.Behavior);
  14853. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14854. $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.";
  14855. $core.addMethod(
  14856. $core.method({
  14857. selector: "basicPackage:",
  14858. protocol: "accessing",
  14859. fn: function (aPackage){
  14860. var self=this,$self=this;
  14861. $self["@package"]=aPackage;
  14862. return self;
  14863. },
  14864. args: ["aPackage"],
  14865. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14866. referencedClasses: [],
  14867. messageSends: []
  14868. }),
  14869. $globals.Class);
  14870. $core.addMethod(
  14871. $core.method({
  14872. selector: "classTag",
  14873. protocol: "accessing",
  14874. fn: function (){
  14875. var self=this,$self=this;
  14876. return "class";
  14877. },
  14878. args: [],
  14879. 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'",
  14880. referencedClasses: [],
  14881. messageSends: []
  14882. }),
  14883. $globals.Class);
  14884. $core.addMethod(
  14885. $core.method({
  14886. selector: "definition",
  14887. protocol: "accessing",
  14888. fn: function (){
  14889. var self=this,$self=this;
  14890. return $core.withContext(function($ctx1) {
  14891. var $1,$2;
  14892. return $recv($globals.String)._streamContents_((function(stream){
  14893. return $core.withContext(function($ctx2) {
  14894. $recv(stream)._print_($self._superclass());
  14895. $ctx2.sendIdx["print:"]=1;
  14896. $recv(stream)._write_(" subclass: ");
  14897. $ctx2.sendIdx["write:"]=1;
  14898. $recv(stream)._printSymbol_($self._name());
  14899. $recv(stream)._lf();
  14900. $ctx2.sendIdx["lf"]=1;
  14901. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14902. return $core.withContext(function($ctx3) {
  14903. $1=$recv($globals.String)._tab();
  14904. $ctx3.sendIdx["tab"]=1;
  14905. $2=$recv($globals.String)._lf();
  14906. $ctx3.sendIdx["lf"]=2;
  14907. return [$1,"uses: ",tcd,$2];
  14908. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14909. })));
  14910. $ctx2.sendIdx["write:"]=2;
  14911. $recv(stream)._tab();
  14912. $ctx2.sendIdx["tab"]=2;
  14913. $recv(stream)._write_("instanceVariableNames: ");
  14914. $ctx2.sendIdx["write:"]=3;
  14915. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14916. $ctx2.sendIdx["print:"]=2;
  14917. $recv(stream)._lf();
  14918. $recv(stream)._tab();
  14919. $recv(stream)._write_("package: ");
  14920. return $recv(stream)._print_($self._category());
  14921. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14922. }));
  14923. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14924. },
  14925. args: [],
  14926. 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 ]",
  14927. referencedClasses: ["String"],
  14928. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14929. }),
  14930. $globals.Class);
  14931. $core.addMethod(
  14932. $core.method({
  14933. selector: "isClass",
  14934. protocol: "testing",
  14935. fn: function (){
  14936. var self=this,$self=this;
  14937. return true;
  14938. },
  14939. args: [],
  14940. source: "isClass\x0a\x09^ true",
  14941. referencedClasses: [],
  14942. messageSends: []
  14943. }),
  14944. $globals.Class);
  14945. $core.addMethod(
  14946. $core.method({
  14947. selector: "package",
  14948. protocol: "accessing",
  14949. fn: function (){
  14950. var self=this,$self=this;
  14951. return $self["@package"];
  14952. },
  14953. args: [],
  14954. source: "package\x0a\x09^ package",
  14955. referencedClasses: [],
  14956. messageSends: []
  14957. }),
  14958. $globals.Class);
  14959. $core.addMethod(
  14960. $core.method({
  14961. selector: "rename:",
  14962. protocol: "accessing",
  14963. fn: function (aString){
  14964. var self=this,$self=this;
  14965. return $core.withContext(function($ctx1) {
  14966. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  14967. return self;
  14968. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  14969. },
  14970. args: ["aString"],
  14971. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  14972. referencedClasses: ["ClassBuilder"],
  14973. messageSends: ["renameClass:to:", "new"]
  14974. }),
  14975. $globals.Class);
  14976. $core.addMethod(
  14977. $core.method({
  14978. selector: "subclasses",
  14979. protocol: "accessing",
  14980. fn: function (){
  14981. var self=this,$self=this;
  14982. return $core.withContext(function($ctx1) {
  14983. return self.subclasses._copy();
  14984. return self;
  14985. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  14986. },
  14987. args: [],
  14988. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  14989. referencedClasses: [],
  14990. messageSends: []
  14991. }),
  14992. $globals.Class);
  14993. $core.addMethod(
  14994. $core.method({
  14995. selector: "theMetaClass",
  14996. protocol: "accessing",
  14997. fn: function (){
  14998. var self=this,$self=this;
  14999. return $core.withContext(function($ctx1) {
  15000. return $self._class();
  15001. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  15002. },
  15003. args: [],
  15004. source: "theMetaClass\x0a\x09^ self class",
  15005. referencedClasses: [],
  15006. messageSends: ["class"]
  15007. }),
  15008. $globals.Class);
  15009. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  15010. $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.";
  15011. $core.addMethod(
  15012. $core.method({
  15013. selector: "asJavaScriptSource",
  15014. protocol: "converting",
  15015. fn: function (){
  15016. var self=this,$self=this;
  15017. return $core.withContext(function($ctx1) {
  15018. var $1;
  15019. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15020. $ctx1.sendIdx[","]=1;
  15021. return $1;
  15022. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15023. },
  15024. args: [],
  15025. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15026. referencedClasses: [],
  15027. messageSends: [",", "name", "instanceClass"]
  15028. }),
  15029. $globals.Metaclass);
  15030. $core.addMethod(
  15031. $core.method({
  15032. selector: "definition",
  15033. protocol: "accessing",
  15034. fn: function (){
  15035. var self=this,$self=this;
  15036. return $core.withContext(function($ctx1) {
  15037. var $1,$2;
  15038. return $recv($globals.String)._streamContents_((function(stream){
  15039. return $core.withContext(function($ctx2) {
  15040. $recv(stream)._print_(self);
  15041. $ctx2.sendIdx["print:"]=1;
  15042. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15043. return " ";
  15044. }),(function(tcd){
  15045. return $core.withContext(function($ctx3) {
  15046. $1=$recv($globals.String)._lf();
  15047. $ctx3.sendIdx["lf"]=1;
  15048. $2=$recv($globals.String)._tab();
  15049. $ctx3.sendIdx["tab"]=1;
  15050. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15051. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15052. })));
  15053. $ctx2.sendIdx["write:"]=1;
  15054. $recv(stream)._write_("instanceVariableNames: ");
  15055. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15056. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15057. }));
  15058. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15059. },
  15060. args: [],
  15061. 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) ]",
  15062. referencedClasses: ["String"],
  15063. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15064. }),
  15065. $globals.Metaclass);
  15066. $core.addMethod(
  15067. $core.method({
  15068. selector: "instanceClass",
  15069. protocol: "accessing",
  15070. fn: function (){
  15071. var self=this,$self=this;
  15072. return $core.withContext(function($ctx1) {
  15073. return self.instanceClass;
  15074. return self;
  15075. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15076. },
  15077. args: [],
  15078. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15079. referencedClasses: [],
  15080. messageSends: []
  15081. }),
  15082. $globals.Metaclass);
  15083. $core.addMethod(
  15084. $core.method({
  15085. selector: "instanceVariableNames:",
  15086. protocol: "accessing",
  15087. fn: function (aCollection){
  15088. var self=this,$self=this;
  15089. return $core.withContext(function($ctx1) {
  15090. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15091. return self;
  15092. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15093. },
  15094. args: ["aCollection"],
  15095. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15096. referencedClasses: ["ClassBuilder"],
  15097. messageSends: ["class:instanceVariableNames:", "new"]
  15098. }),
  15099. $globals.Metaclass);
  15100. $core.addMethod(
  15101. $core.method({
  15102. selector: "isMetaclass",
  15103. protocol: "testing",
  15104. fn: function (){
  15105. var self=this,$self=this;
  15106. return true;
  15107. },
  15108. args: [],
  15109. source: "isMetaclass\x0a\x09^ true",
  15110. referencedClasses: [],
  15111. messageSends: []
  15112. }),
  15113. $globals.Metaclass);
  15114. $core.addMethod(
  15115. $core.method({
  15116. selector: "name",
  15117. protocol: "accessing",
  15118. fn: function (){
  15119. var self=this,$self=this;
  15120. return $core.withContext(function($ctx1) {
  15121. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15122. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15123. },
  15124. args: [],
  15125. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15126. referencedClasses: [],
  15127. messageSends: [",", "name", "instanceClass"]
  15128. }),
  15129. $globals.Metaclass);
  15130. $core.addMethod(
  15131. $core.method({
  15132. selector: "package",
  15133. protocol: "accessing",
  15134. fn: function (){
  15135. var self=this,$self=this;
  15136. return $core.withContext(function($ctx1) {
  15137. return $recv($self._instanceClass())._package();
  15138. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15139. },
  15140. args: [],
  15141. source: "package\x0a\x09^ self instanceClass package",
  15142. referencedClasses: [],
  15143. messageSends: ["package", "instanceClass"]
  15144. }),
  15145. $globals.Metaclass);
  15146. $core.addMethod(
  15147. $core.method({
  15148. selector: "subclasses",
  15149. protocol: "accessing",
  15150. fn: function (){
  15151. var self=this,$self=this;
  15152. return $core.withContext(function($ctx1) {
  15153. return $core.metaSubclasses(self);
  15154. return self;
  15155. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15156. },
  15157. args: [],
  15158. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15159. referencedClasses: [],
  15160. messageSends: []
  15161. }),
  15162. $globals.Metaclass);
  15163. $core.addMethod(
  15164. $core.method({
  15165. selector: "theMetaClass",
  15166. protocol: "accessing",
  15167. fn: function (){
  15168. var self=this,$self=this;
  15169. return self;
  15170. },
  15171. args: [],
  15172. source: "theMetaClass\x0a\x09^ self",
  15173. referencedClasses: [],
  15174. messageSends: []
  15175. }),
  15176. $globals.Metaclass);
  15177. $core.addMethod(
  15178. $core.method({
  15179. selector: "theNonMetaClass",
  15180. protocol: "accessing",
  15181. fn: function (){
  15182. var self=this,$self=this;
  15183. return $core.withContext(function($ctx1) {
  15184. return $self._instanceClass();
  15185. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15186. },
  15187. args: [],
  15188. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15189. referencedClasses: [],
  15190. messageSends: ["instanceClass"]
  15191. }),
  15192. $globals.Metaclass);
  15193. $core.addMethod(
  15194. $core.method({
  15195. selector: "uses:instanceVariableNames:",
  15196. protocol: "accessing",
  15197. fn: function (aTraitCompositionDescription,aCollection){
  15198. var self=this,$self=this;
  15199. var metaclass;
  15200. return $core.withContext(function($ctx1) {
  15201. metaclass=$self._instanceVariableNames_(aCollection);
  15202. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15203. return metaclass;
  15204. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15205. },
  15206. args: ["aTraitCompositionDescription", "aCollection"],
  15207. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15208. referencedClasses: [],
  15209. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15210. }),
  15211. $globals.Metaclass);
  15212. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15213. $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:`.";
  15214. $core.addMethod(
  15215. $core.method({
  15216. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15217. protocol: "class definition",
  15218. fn: function (aClass,className,aCollection,packageName){
  15219. var self=this,$self=this;
  15220. var theClass,thePackage;
  15221. return $core.withContext(function($ctx1) {
  15222. var $1,$2,$3,$receiver;
  15223. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15224. thePackage=$recv($globals.Package)._named_(packageName);
  15225. $1=theClass;
  15226. if(($receiver = $1) == null || $receiver.a$nil){
  15227. $1;
  15228. } else {
  15229. $recv(theClass)._package_(thePackage);
  15230. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15231. if(!$core.assert($2)){
  15232. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15233. }
  15234. }
  15235. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15236. $recv($3)._recompile();
  15237. return $recv($3)._yourself();
  15238. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15239. },
  15240. args: ["aClass", "className", "aCollection", "packageName"],
  15241. 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",
  15242. referencedClasses: ["Smalltalk", "Package"],
  15243. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15244. }),
  15245. $globals.ClassBuilder);
  15246. $core.addMethod(
  15247. $core.method({
  15248. selector: "addTraitNamed:package:",
  15249. protocol: "class definition",
  15250. fn: function (traitName,packageName){
  15251. var self=this,$self=this;
  15252. var theTrait,thePackage;
  15253. return $core.withContext(function($ctx1) {
  15254. var $1,$2,$receiver;
  15255. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15256. thePackage=$recv($globals.Package)._named_(packageName);
  15257. $1=theTrait;
  15258. if(($receiver = $1) == null || $receiver.a$nil){
  15259. $1;
  15260. } else {
  15261. $2=theTrait;
  15262. $recv($2)._package_(thePackage);
  15263. $recv($2)._recompile();
  15264. return $recv($2)._yourself();
  15265. }
  15266. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15267. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15268. },
  15269. args: ["traitName", "packageName"],
  15270. 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",
  15271. referencedClasses: ["Smalltalk", "Package"],
  15272. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15273. }),
  15274. $globals.ClassBuilder);
  15275. $core.addMethod(
  15276. $core.method({
  15277. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15278. protocol: "private",
  15279. fn: function (aClass,aString,aCollection,packageName){
  15280. var self=this,$self=this;
  15281. return $core.withContext(function($ctx1) {
  15282. return $core.addClass(aString, aClass, aCollection, packageName);
  15283. ;
  15284. return self;
  15285. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15286. },
  15287. args: ["aClass", "aString", "aCollection", "packageName"],
  15288. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15289. referencedClasses: [],
  15290. messageSends: []
  15291. }),
  15292. $globals.ClassBuilder);
  15293. $core.addMethod(
  15294. $core.method({
  15295. selector: "basicAddTraitNamed:package:",
  15296. protocol: "private",
  15297. fn: function (aString,anotherString){
  15298. var self=this,$self=this;
  15299. return $core.withContext(function($ctx1) {
  15300. return $core.addTrait(aString, anotherString);
  15301. return self;
  15302. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15303. },
  15304. args: ["aString", "anotherString"],
  15305. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15306. referencedClasses: [],
  15307. messageSends: []
  15308. }),
  15309. $globals.ClassBuilder);
  15310. $core.addMethod(
  15311. $core.method({
  15312. selector: "basicClass:instanceVariableNames:",
  15313. protocol: "private",
  15314. fn: function (aClass,aString){
  15315. var self=this,$self=this;
  15316. return $core.withContext(function($ctx1) {
  15317. $self._basicClass_instanceVariables_(aClass,$self._instanceVariableNamesFor_(aString));
  15318. return self;
  15319. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15320. },
  15321. args: ["aClass", "aString"],
  15322. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  15323. referencedClasses: [],
  15324. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  15325. }),
  15326. $globals.ClassBuilder);
  15327. $core.addMethod(
  15328. $core.method({
  15329. selector: "basicClass:instanceVariables:",
  15330. protocol: "private",
  15331. fn: function (aClass,aCollection){
  15332. var self=this,$self=this;
  15333. return $core.withContext(function($ctx1) {
  15334. var $1;
  15335. $1=$recv(aClass)._isMetaclass();
  15336. if(!$core.assert($1)){
  15337. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15338. }
  15339. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15340. return self;
  15341. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15342. },
  15343. args: ["aClass", "aCollection"],
  15344. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15345. referencedClasses: [],
  15346. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15347. }),
  15348. $globals.ClassBuilder);
  15349. $core.addMethod(
  15350. $core.method({
  15351. selector: "basicRemoveClass:",
  15352. protocol: "private",
  15353. fn: function (aClass){
  15354. var self=this,$self=this;
  15355. return $core.withContext(function($ctx1) {
  15356. $core.removeClass(aClass);
  15357. return self;
  15358. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15359. },
  15360. args: ["aClass"],
  15361. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15362. referencedClasses: [],
  15363. messageSends: []
  15364. }),
  15365. $globals.ClassBuilder);
  15366. $core.addMethod(
  15367. $core.method({
  15368. selector: "basicRenameClass:to:",
  15369. protocol: "private",
  15370. fn: function (aClass,aString){
  15371. var self=this,$self=this;
  15372. return $core.withContext(function($ctx1) {
  15373. $globals[aString] = aClass;
  15374. delete $globals[aClass.name];
  15375. aClass.name = aString;
  15376. ;
  15377. return self;
  15378. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15379. },
  15380. args: ["aClass", "aString"],
  15381. 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'>",
  15382. referencedClasses: [],
  15383. messageSends: []
  15384. }),
  15385. $globals.ClassBuilder);
  15386. $core.addMethod(
  15387. $core.method({
  15388. selector: "basicSwapClassNames:with:",
  15389. protocol: "private",
  15390. fn: function (aClass,anotherClass){
  15391. var self=this,$self=this;
  15392. return $core.withContext(function($ctx1) {
  15393. var tmp = aClass.name;
  15394. aClass.name = anotherClass.name;
  15395. anotherClass.name = tmp;
  15396. ;
  15397. return self;
  15398. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15399. },
  15400. args: ["aClass", "anotherClass"],
  15401. 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'>",
  15402. referencedClasses: [],
  15403. messageSends: []
  15404. }),
  15405. $globals.ClassBuilder);
  15406. $core.addMethod(
  15407. $core.method({
  15408. selector: "class:instanceVariableNames:",
  15409. protocol: "class definition",
  15410. fn: function (aClass,ivarNames){
  15411. var self=this,$self=this;
  15412. return $core.withContext(function($ctx1) {
  15413. var $1,$3,$2;
  15414. $self._basicClass_instanceVariableNames_(aClass,ivarNames);
  15415. $1=$recv($globals.SystemAnnouncer)._current();
  15416. $3=$recv($globals.ClassDefinitionChanged)._new();
  15417. $recv($3)._theClass_(aClass);
  15418. $2=$recv($3)._yourself();
  15419. $recv($1)._announce_($2);
  15420. return self;
  15421. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15422. },
  15423. args: ["aClass", "ivarNames"],
  15424. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15425. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15426. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  15427. }),
  15428. $globals.ClassBuilder);
  15429. $core.addMethod(
  15430. $core.method({
  15431. selector: "copyClass:named:",
  15432. protocol: "copying",
  15433. fn: function (aClass,className){
  15434. var self=this,$self=this;
  15435. var newClass;
  15436. return $core.withContext(function($ctx1) {
  15437. var $1,$3,$2;
  15438. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15439. $self._copyClass_to_(aClass,newClass);
  15440. $1=$recv($globals.SystemAnnouncer)._current();
  15441. $3=$recv($globals.ClassAdded)._new();
  15442. $recv($3)._theClass_(newClass);
  15443. $2=$recv($3)._yourself();
  15444. $recv($1)._announce_($2);
  15445. return newClass;
  15446. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15447. },
  15448. args: ["aClass", "className"],
  15449. 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",
  15450. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15451. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15452. }),
  15453. $globals.ClassBuilder);
  15454. $core.addMethod(
  15455. $core.method({
  15456. selector: "copyClass:to:",
  15457. protocol: "copying",
  15458. fn: function (aClass,anotherClass){
  15459. var self=this,$self=this;
  15460. return $core.withContext(function($ctx1) {
  15461. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15462. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15463. $1=$recv(aClass)._methodDictionary();
  15464. $ctx1.sendIdx["methodDictionary"]=1;
  15465. $recv($1)._valuesDo_((function(each){
  15466. return $core.withContext(function($ctx2) {
  15467. $3=$recv(each)._methodClass();
  15468. $ctx2.sendIdx["methodClass"]=1;
  15469. $2=$recv($3).__eq(aClass);
  15470. $ctx2.sendIdx["="]=1;
  15471. if($core.assert($2)){
  15472. $4=$recv($globals.Compiler)._new();
  15473. $ctx2.sendIdx["new"]=1;
  15474. $5=$recv(each)._source();
  15475. $ctx2.sendIdx["source"]=1;
  15476. $6=$recv(each)._protocol();
  15477. $ctx2.sendIdx["protocol"]=1;
  15478. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15479. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15480. }
  15481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15482. }));
  15483. $ctx1.sendIdx["valuesDo:"]=1;
  15484. $7=$recv(aClass)._traitComposition();
  15485. $ctx1.sendIdx["traitComposition"]=1;
  15486. $recv(anotherClass)._setTraitComposition_($7);
  15487. $ctx1.sendIdx["setTraitComposition:"]=1;
  15488. $8=$recv(anotherClass)._class();
  15489. $ctx1.sendIdx["class"]=1;
  15490. $10=$recv(aClass)._class();
  15491. $ctx1.sendIdx["class"]=2;
  15492. $9=$recv($10)._instanceVariableNames();
  15493. $self._basicClass_instanceVariables_($8,$9);
  15494. $12=$recv(aClass)._class();
  15495. $ctx1.sendIdx["class"]=3;
  15496. $11=$recv($12)._methodDictionary();
  15497. $recv($11)._valuesDo_((function(each){
  15498. return $core.withContext(function($ctx2) {
  15499. $14=$recv(each)._methodClass();
  15500. $15=$recv(aClass)._class();
  15501. $ctx2.sendIdx["class"]=4;
  15502. $13=$recv($14).__eq($15);
  15503. if($core.assert($13)){
  15504. $16=$recv($globals.Compiler)._new();
  15505. $17=$recv(each)._source();
  15506. $18=$recv(anotherClass)._class();
  15507. $ctx2.sendIdx["class"]=5;
  15508. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15509. }
  15510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15511. }));
  15512. $19=$recv(anotherClass)._class();
  15513. $ctx1.sendIdx["class"]=6;
  15514. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15515. return self;
  15516. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15517. },
  15518. args: ["aClass", "anotherClass"],
  15519. 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",
  15520. referencedClasses: ["Compiler"],
  15521. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15522. }),
  15523. $globals.ClassBuilder);
  15524. $core.addMethod(
  15525. $core.method({
  15526. selector: "installMethod:forClass:protocol:",
  15527. protocol: "method definition",
  15528. fn: function (aCompiledMethod,aBehavior,aString){
  15529. var self=this,$self=this;
  15530. return $core.withContext(function($ctx1) {
  15531. $recv(aCompiledMethod)._protocol_(aString);
  15532. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15533. return aCompiledMethod;
  15534. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15535. },
  15536. args: ["aCompiledMethod", "aBehavior", "aString"],
  15537. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15538. referencedClasses: [],
  15539. messageSends: ["protocol:", "addCompiledMethod:"]
  15540. }),
  15541. $globals.ClassBuilder);
  15542. $core.addMethod(
  15543. $core.method({
  15544. selector: "instanceVariableNamesFor:",
  15545. protocol: "accessing",
  15546. fn: function (aString){
  15547. var self=this,$self=this;
  15548. return $core.withContext(function($ctx1) {
  15549. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15550. return $core.withContext(function($ctx2) {
  15551. return $recv(each)._isEmpty();
  15552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15553. }));
  15554. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15555. },
  15556. args: ["aString"],
  15557. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15558. referencedClasses: [],
  15559. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15560. }),
  15561. $globals.ClassBuilder);
  15562. $core.addMethod(
  15563. $core.method({
  15564. selector: "migrateClass:superclass:",
  15565. protocol: "class migration",
  15566. fn: function (aClass,anotherClass){
  15567. var self=this,$self=this;
  15568. return $core.withContext(function($ctx1) {
  15569. var $1;
  15570. $1=$recv(aClass)._name();
  15571. $ctx1.sendIdx["name"]=1;
  15572. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15573. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15574. },
  15575. args: ["aClass", "anotherClass"],
  15576. 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",
  15577. referencedClasses: [],
  15578. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15579. }),
  15580. $globals.ClassBuilder);
  15581. $core.addMethod(
  15582. $core.method({
  15583. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15584. protocol: "class migration",
  15585. fn: function (className,aClass,aCollection,packageName){
  15586. var self=this,$self=this;
  15587. var oldClass,newClass,tmp;
  15588. return $core.withContext(function($ctx1) {
  15589. var $1,$2,$4,$3;
  15590. tmp="new*".__comma(className);
  15591. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15592. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15593. $self._basicSwapClassNames_with_(oldClass,newClass);
  15594. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15595. $recv((function(){
  15596. return $core.withContext(function($ctx2) {
  15597. return $self._copyClass_to_(oldClass,newClass);
  15598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15599. }))._on_do_($globals.Error,(function(exception){
  15600. return $core.withContext(function($ctx2) {
  15601. $self._basicSwapClassNames_with_(oldClass,newClass);
  15602. $1=$self._basicRemoveClass_(newClass);
  15603. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15604. $1;
  15605. return $recv(exception)._resignal();
  15606. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15607. }));
  15608. $self._rawRenameClass_to_(oldClass,tmp);
  15609. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15610. $self._rawRenameClass_to_(newClass,className);
  15611. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15612. return $core.withContext(function($ctx2) {
  15613. return $self._migrateClass_superclass_(each,newClass);
  15614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15615. }));
  15616. $self._basicRemoveClass_(oldClass);
  15617. $2=$recv($globals.SystemAnnouncer)._current();
  15618. $4=$recv($globals.ClassMigrated)._new();
  15619. $recv($4)._theClass_(newClass);
  15620. $recv($4)._oldClass_(oldClass);
  15621. $3=$recv($4)._yourself();
  15622. $recv($2)._announce_($3);
  15623. return newClass;
  15624. }, 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)});
  15625. },
  15626. args: ["className", "aClass", "aCollection", "packageName"],
  15627. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15628. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15629. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15630. }),
  15631. $globals.ClassBuilder);
  15632. $core.addMethod(
  15633. $core.method({
  15634. selector: "rawRenameClass:to:",
  15635. protocol: "private",
  15636. fn: function (aClass,aString){
  15637. var self=this,$self=this;
  15638. return $core.withContext(function($ctx1) {
  15639. $globals[aString] = aClass;
  15640. ;
  15641. return self;
  15642. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15643. },
  15644. args: ["aClass", "aString"],
  15645. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15646. referencedClasses: [],
  15647. messageSends: []
  15648. }),
  15649. $globals.ClassBuilder);
  15650. $core.addMethod(
  15651. $core.method({
  15652. selector: "renameClass:to:",
  15653. protocol: "class migration",
  15654. fn: function (aClass,className){
  15655. var self=this,$self=this;
  15656. return $core.withContext(function($ctx1) {
  15657. var $1,$3,$2;
  15658. $self._basicRenameClass_to_(aClass,className);
  15659. $recv(aClass)._recompile();
  15660. $1=$recv($globals.SystemAnnouncer)._current();
  15661. $3=$recv($globals.ClassRenamed)._new();
  15662. $recv($3)._theClass_(aClass);
  15663. $2=$recv($3)._yourself();
  15664. $recv($1)._announce_($2);
  15665. return self;
  15666. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15667. },
  15668. args: ["aClass", "className"],
  15669. 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)",
  15670. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15671. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15672. }),
  15673. $globals.ClassBuilder);
  15674. $core.addMethod(
  15675. $core.method({
  15676. selector: "setupClass:",
  15677. protocol: "public",
  15678. fn: function (aClass){
  15679. var self=this,$self=this;
  15680. return $core.withContext(function($ctx1) {
  15681. $self._deprecatedAPI_("Classes are now auto-inited.");
  15682. return self;
  15683. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  15684. },
  15685. args: ["aClass"],
  15686. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  15687. referencedClasses: [],
  15688. messageSends: ["deprecatedAPI:"]
  15689. }),
  15690. $globals.ClassBuilder);
  15691. $core.addMethod(
  15692. $core.method({
  15693. selector: "superclass:subclass:",
  15694. protocol: "class definition",
  15695. fn: function (aClass,className){
  15696. var self=this,$self=this;
  15697. return $core.withContext(function($ctx1) {
  15698. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15699. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15700. },
  15701. args: ["aClass", "className"],
  15702. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15703. referencedClasses: [],
  15704. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15705. }),
  15706. $globals.ClassBuilder);
  15707. $core.addMethod(
  15708. $core.method({
  15709. selector: "superclass:subclass:instanceVariableNames:package:",
  15710. protocol: "class definition",
  15711. fn: function (aClass,className,ivarNames,packageName){
  15712. var self=this,$self=this;
  15713. var newClass;
  15714. return $core.withContext(function($ctx1) {
  15715. var $1,$2,$3,$5,$4,$receiver;
  15716. $1=$self._instanceVariableNamesFor_(ivarNames);
  15717. if(($receiver = packageName) == null || $receiver.a$nil){
  15718. $2="unclassified";
  15719. } else {
  15720. $2=packageName;
  15721. }
  15722. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15723. $3=$recv($globals.SystemAnnouncer)._current();
  15724. $5=$recv($globals.ClassAdded)._new();
  15725. $recv($5)._theClass_(newClass);
  15726. $4=$recv($5)._yourself();
  15727. $recv($3)._announce_($4);
  15728. return newClass;
  15729. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15730. },
  15731. args: ["aClass", "className", "ivarNames", "packageName"],
  15732. 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",
  15733. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15734. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15735. }),
  15736. $globals.ClassBuilder);
  15737. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15738. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15739. $core.addMethod(
  15740. $core.method({
  15741. selector: "getNodesFrom:",
  15742. protocol: "accessing",
  15743. fn: function (aCollection){
  15744. var self=this,$self=this;
  15745. var children,others;
  15746. return $core.withContext(function($ctx1) {
  15747. var $1;
  15748. children=[];
  15749. others=[];
  15750. $recv(aCollection)._do_((function(each){
  15751. return $core.withContext(function($ctx2) {
  15752. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15753. if($core.assert($1)){
  15754. return $recv(children)._add_(each);
  15755. $ctx2.sendIdx["add:"]=1;
  15756. } else {
  15757. return $recv(others)._add_(each);
  15758. }
  15759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15760. }));
  15761. $self["@nodes"]=$recv(children)._collect_((function(each){
  15762. return $core.withContext(function($ctx2) {
  15763. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15764. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15765. }));
  15766. return self;
  15767. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15768. },
  15769. args: ["aCollection"],
  15770. 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 ]",
  15771. referencedClasses: ["ClassSorterNode"],
  15772. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15773. }),
  15774. $globals.ClassSorterNode);
  15775. $core.addMethod(
  15776. $core.method({
  15777. selector: "level",
  15778. protocol: "accessing",
  15779. fn: function (){
  15780. var self=this,$self=this;
  15781. return $self["@level"];
  15782. },
  15783. args: [],
  15784. source: "level\x0a\x09^ level",
  15785. referencedClasses: [],
  15786. messageSends: []
  15787. }),
  15788. $globals.ClassSorterNode);
  15789. $core.addMethod(
  15790. $core.method({
  15791. selector: "level:",
  15792. protocol: "accessing",
  15793. fn: function (anInteger){
  15794. var self=this,$self=this;
  15795. $self["@level"]=anInteger;
  15796. return self;
  15797. },
  15798. args: ["anInteger"],
  15799. source: "level: anInteger\x0a\x09level := anInteger",
  15800. referencedClasses: [],
  15801. messageSends: []
  15802. }),
  15803. $globals.ClassSorterNode);
  15804. $core.addMethod(
  15805. $core.method({
  15806. selector: "nodes",
  15807. protocol: "accessing",
  15808. fn: function (){
  15809. var self=this,$self=this;
  15810. return $self["@nodes"];
  15811. },
  15812. args: [],
  15813. source: "nodes\x0a\x09^ nodes",
  15814. referencedClasses: [],
  15815. messageSends: []
  15816. }),
  15817. $globals.ClassSorterNode);
  15818. $core.addMethod(
  15819. $core.method({
  15820. selector: "theClass",
  15821. protocol: "accessing",
  15822. fn: function (){
  15823. var self=this,$self=this;
  15824. return $self["@theClass"];
  15825. },
  15826. args: [],
  15827. source: "theClass\x0a\x09^ theClass",
  15828. referencedClasses: [],
  15829. messageSends: []
  15830. }),
  15831. $globals.ClassSorterNode);
  15832. $core.addMethod(
  15833. $core.method({
  15834. selector: "theClass:",
  15835. protocol: "accessing",
  15836. fn: function (aClass){
  15837. var self=this,$self=this;
  15838. $self["@theClass"]=aClass;
  15839. return self;
  15840. },
  15841. args: ["aClass"],
  15842. source: "theClass: aClass\x0a\x09theClass := aClass",
  15843. referencedClasses: [],
  15844. messageSends: []
  15845. }),
  15846. $globals.ClassSorterNode);
  15847. $core.addMethod(
  15848. $core.method({
  15849. selector: "traverseClassesWith:",
  15850. protocol: "visiting",
  15851. fn: function (aCollection){
  15852. var self=this,$self=this;
  15853. return $core.withContext(function($ctx1) {
  15854. var $1,$3,$2;
  15855. $1=$self._theClass();
  15856. $ctx1.sendIdx["theClass"]=1;
  15857. $recv(aCollection)._add_($1);
  15858. $recv($recv($self._nodes())._sorted_((function(a,b){
  15859. return $core.withContext(function($ctx2) {
  15860. $3=$recv(a)._theClass();
  15861. $ctx2.sendIdx["theClass"]=2;
  15862. $2=$recv($3)._name();
  15863. $ctx2.sendIdx["name"]=1;
  15864. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15865. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15866. })))._do_((function(aNode){
  15867. return $core.withContext(function($ctx2) {
  15868. return $recv(aNode)._traverseClassesWith_(aCollection);
  15869. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15870. }));
  15871. return self;
  15872. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15873. },
  15874. args: ["aCollection"],
  15875. 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 ].",
  15876. referencedClasses: [],
  15877. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15878. }),
  15879. $globals.ClassSorterNode);
  15880. $core.addMethod(
  15881. $core.method({
  15882. selector: "on:classes:level:",
  15883. protocol: "instance creation",
  15884. fn: function (aClass,aCollection,anInteger){
  15885. var self=this,$self=this;
  15886. return $core.withContext(function($ctx1) {
  15887. var $1;
  15888. $1=$self._new();
  15889. $recv($1)._theClass_(aClass);
  15890. $recv($1)._level_(anInteger);
  15891. $recv($1)._getNodesFrom_(aCollection);
  15892. return $recv($1)._yourself();
  15893. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15894. },
  15895. args: ["aClass", "aCollection", "anInteger"],
  15896. 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",
  15897. referencedClasses: [],
  15898. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15899. }),
  15900. $globals.ClassSorterNode.a$cls);
  15901. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15902. $core.addMethod(
  15903. $core.method({
  15904. selector: "allInstanceVariableNames",
  15905. protocol: "accessing",
  15906. fn: function (){
  15907. var self=this,$self=this;
  15908. return [];
  15909. },
  15910. args: [],
  15911. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15912. referencedClasses: [],
  15913. messageSends: []
  15914. }),
  15915. $globals.TBehaviorDefaults);
  15916. $core.addMethod(
  15917. $core.method({
  15918. selector: "allSubclassesDo:",
  15919. protocol: "enumerating",
  15920. fn: function (aBlock){
  15921. var self=this,$self=this;
  15922. return self;
  15923. },
  15924. args: ["aBlock"],
  15925. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15926. referencedClasses: [],
  15927. messageSends: []
  15928. }),
  15929. $globals.TBehaviorDefaults);
  15930. $core.addMethod(
  15931. $core.method({
  15932. selector: "name",
  15933. protocol: "accessing",
  15934. fn: function (){
  15935. var self=this,$self=this;
  15936. return nil;
  15937. },
  15938. args: [],
  15939. source: "name\x0a\x09^ nil",
  15940. referencedClasses: [],
  15941. messageSends: []
  15942. }),
  15943. $globals.TBehaviorDefaults);
  15944. $core.addMethod(
  15945. $core.method({
  15946. selector: "printOn:",
  15947. protocol: "printing",
  15948. fn: function (aStream){
  15949. var self=this,$self=this;
  15950. return $core.withContext(function($ctx1) {
  15951. var $1,$receiver;
  15952. $1=$self._name();
  15953. if(($receiver = $1) == null || $receiver.a$nil){
  15954. (
  15955. $ctx1.supercall = true,
  15956. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15957. $ctx1.supercall = false;
  15958. } else {
  15959. var name;
  15960. name=$receiver;
  15961. $recv(aStream)._nextPutAll_(name);
  15962. }
  15963. return self;
  15964. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15965. },
  15966. args: ["aStream"],
  15967. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15968. referencedClasses: [],
  15969. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15970. }),
  15971. $globals.TBehaviorDefaults);
  15972. $core.addMethod(
  15973. $core.method({
  15974. selector: "superclass",
  15975. protocol: "accessing",
  15976. fn: function (){
  15977. var self=this,$self=this;
  15978. return nil;
  15979. },
  15980. args: [],
  15981. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  15982. referencedClasses: [],
  15983. messageSends: []
  15984. }),
  15985. $globals.TBehaviorDefaults);
  15986. $core.addMethod(
  15987. $core.method({
  15988. selector: "traitUsers",
  15989. protocol: "accessing",
  15990. fn: function (){
  15991. var self=this,$self=this;
  15992. return [];
  15993. },
  15994. args: [],
  15995. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  15996. referencedClasses: [],
  15997. messageSends: []
  15998. }),
  15999. $globals.TBehaviorDefaults);
  16000. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16001. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16002. $core.addMethod(
  16003. $core.method({
  16004. selector: ">>",
  16005. protocol: "accessing",
  16006. fn: function (aString){
  16007. var self=this,$self=this;
  16008. return $core.withContext(function($ctx1) {
  16009. return $self._methodAt_(aString);
  16010. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  16011. },
  16012. args: ["aString"],
  16013. source: ">> aString\x0a\x09^ self methodAt: aString",
  16014. referencedClasses: [],
  16015. messageSends: ["methodAt:"]
  16016. }),
  16017. $globals.TBehaviorProvider);
  16018. $core.addMethod(
  16019. $core.method({
  16020. selector: "addCompiledMethod:",
  16021. protocol: "compiling",
  16022. fn: function (aMethod){
  16023. var self=this,$self=this;
  16024. var oldMethod,announcement;
  16025. return $core.withContext(function($ctx1) {
  16026. var $1,$2,$3,$4,$receiver;
  16027. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16028. return nil;
  16029. }));
  16030. $self._basicAddCompiledMethod_(aMethod);
  16031. $1=oldMethod;
  16032. if(($receiver = $1) == null || $receiver.a$nil){
  16033. $2=$recv($globals.MethodAdded)._new();
  16034. $ctx1.sendIdx["new"]=1;
  16035. $recv($2)._method_(aMethod);
  16036. $ctx1.sendIdx["method:"]=1;
  16037. $3=$recv($2)._yourself();
  16038. $ctx1.sendIdx["yourself"]=1;
  16039. announcement=$3;
  16040. } else {
  16041. $4=$recv($globals.MethodModified)._new();
  16042. $recv($4)._oldMethod_(oldMethod);
  16043. $recv($4)._method_(aMethod);
  16044. announcement=$recv($4)._yourself();
  16045. }
  16046. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16047. return self;
  16048. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16049. },
  16050. args: ["aMethod"],
  16051. 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",
  16052. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16053. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16054. }),
  16055. $globals.TBehaviorProvider);
  16056. $core.addMethod(
  16057. $core.method({
  16058. selector: "basicAddCompiledMethod:",
  16059. protocol: "private",
  16060. fn: function (aMethod){
  16061. var self=this,$self=this;
  16062. return $core.withContext(function($ctx1) {
  16063. $core.addMethod(aMethod, self);
  16064. return self;
  16065. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16066. },
  16067. args: ["aMethod"],
  16068. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16069. referencedClasses: [],
  16070. messageSends: []
  16071. }),
  16072. $globals.TBehaviorProvider);
  16073. $core.addMethod(
  16074. $core.method({
  16075. selector: "basicRemoveCompiledMethod:",
  16076. protocol: "private",
  16077. fn: function (aMethod){
  16078. var self=this,$self=this;
  16079. return $core.withContext(function($ctx1) {
  16080. $core.removeMethod(aMethod,self);
  16081. return self;
  16082. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16083. },
  16084. args: ["aMethod"],
  16085. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16086. referencedClasses: [],
  16087. messageSends: []
  16088. }),
  16089. $globals.TBehaviorProvider);
  16090. $core.addMethod(
  16091. $core.method({
  16092. selector: "compile:protocol:",
  16093. protocol: "compiling",
  16094. fn: function (aString,anotherString){
  16095. var self=this,$self=this;
  16096. return $core.withContext(function($ctx1) {
  16097. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16098. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16099. },
  16100. args: ["aString", "anotherString"],
  16101. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16102. referencedClasses: ["Compiler"],
  16103. messageSends: ["install:forClass:protocol:", "new"]
  16104. }),
  16105. $globals.TBehaviorProvider);
  16106. $core.addMethod(
  16107. $core.method({
  16108. selector: "includesSelector:",
  16109. protocol: "testing",
  16110. fn: function (aString){
  16111. var self=this,$self=this;
  16112. return $core.withContext(function($ctx1) {
  16113. return $recv($self._methodDictionary())._includesKey_(aString);
  16114. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16115. },
  16116. args: ["aString"],
  16117. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16118. referencedClasses: [],
  16119. messageSends: ["includesKey:", "methodDictionary"]
  16120. }),
  16121. $globals.TBehaviorProvider);
  16122. $core.addMethod(
  16123. $core.method({
  16124. selector: "methodAt:",
  16125. protocol: "accessing",
  16126. fn: function (aString){
  16127. var self=this,$self=this;
  16128. return $core.withContext(function($ctx1) {
  16129. return $recv($self._methodDictionary())._at_(aString);
  16130. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16131. },
  16132. args: ["aString"],
  16133. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16134. referencedClasses: [],
  16135. messageSends: ["at:", "methodDictionary"]
  16136. }),
  16137. $globals.TBehaviorProvider);
  16138. $core.addMethod(
  16139. $core.method({
  16140. selector: "methodDictionary",
  16141. protocol: "accessing",
  16142. fn: function (){
  16143. var self=this,$self=this;
  16144. return $core.withContext(function($ctx1) {
  16145. var dict = $globals.HashedCollection._new();
  16146. var methods = self.methods;
  16147. Object.keys(methods).forEach(function(i) {
  16148. if(methods[i].selector) {
  16149. dict._at_put_(methods[i].selector, methods[i]);
  16150. }
  16151. });
  16152. return dict;
  16153. return self;
  16154. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16155. },
  16156. args: [],
  16157. 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'>",
  16158. referencedClasses: [],
  16159. messageSends: []
  16160. }),
  16161. $globals.TBehaviorProvider);
  16162. $core.addMethod(
  16163. $core.method({
  16164. selector: "methodOrganizationEnter:andLeave:",
  16165. protocol: "accessing",
  16166. fn: function (aMethod,oldMethod){
  16167. var self=this,$self=this;
  16168. return $core.withContext(function($ctx1) {
  16169. var $1,$2,$receiver;
  16170. if(($receiver = aMethod) == null || $receiver.a$nil){
  16171. aMethod;
  16172. } else {
  16173. $1=$self._organization();
  16174. $2=$recv(aMethod)._protocol();
  16175. $ctx1.sendIdx["protocol"]=1;
  16176. $recv($1)._addElement_($2);
  16177. }
  16178. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16179. oldMethod;
  16180. } else {
  16181. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16182. }
  16183. return self;
  16184. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16185. },
  16186. args: ["aMethod", "oldMethod"],
  16187. 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 ]",
  16188. referencedClasses: [],
  16189. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16190. }),
  16191. $globals.TBehaviorProvider);
  16192. $core.addMethod(
  16193. $core.method({
  16194. selector: "methodTemplate",
  16195. protocol: "accessing",
  16196. fn: function (){
  16197. var self=this,$self=this;
  16198. return $core.withContext(function($ctx1) {
  16199. return $recv($globals.String)._streamContents_((function(stream){
  16200. return $core.withContext(function($ctx2) {
  16201. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16202. $ctx2.sendIdx["write:"]=1;
  16203. $recv(stream)._lf();
  16204. $ctx2.sendIdx["lf"]=1;
  16205. $recv(stream)._tab();
  16206. $ctx2.sendIdx["tab"]=1;
  16207. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16208. $ctx2.sendIdx["write:"]=2;
  16209. $recv(stream)._lf();
  16210. $ctx2.sendIdx["lf"]=2;
  16211. $recv(stream)._lf();
  16212. $ctx2.sendIdx["lf"]=3;
  16213. $recv(stream)._tab();
  16214. $ctx2.sendIdx["tab"]=2;
  16215. $recv(stream)._write_("| temporary variable names |");
  16216. $ctx2.sendIdx["write:"]=3;
  16217. $recv(stream)._lf();
  16218. $recv(stream)._tab();
  16219. return $recv(stream)._write_("statements");
  16220. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16221. }));
  16222. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16223. },
  16224. args: [],
  16225. 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' ]",
  16226. referencedClasses: ["String"],
  16227. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16228. }),
  16229. $globals.TBehaviorProvider);
  16230. $core.addMethod(
  16231. $core.method({
  16232. selector: "methods",
  16233. protocol: "accessing",
  16234. fn: function (){
  16235. var self=this,$self=this;
  16236. return $core.withContext(function($ctx1) {
  16237. return $recv($self._methodDictionary())._values();
  16238. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16239. },
  16240. args: [],
  16241. source: "methods\x0a\x09^ self methodDictionary values",
  16242. referencedClasses: [],
  16243. messageSends: ["values", "methodDictionary"]
  16244. }),
  16245. $globals.TBehaviorProvider);
  16246. $core.addMethod(
  16247. $core.method({
  16248. selector: "methodsInProtocol:",
  16249. protocol: "accessing",
  16250. fn: function (aString){
  16251. var self=this,$self=this;
  16252. return $core.withContext(function($ctx1) {
  16253. return $recv($self._methods())._select_((function(each){
  16254. return $core.withContext(function($ctx2) {
  16255. return $recv($recv(each)._protocol()).__eq(aString);
  16256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16257. }));
  16258. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16259. },
  16260. args: ["aString"],
  16261. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16262. referencedClasses: [],
  16263. messageSends: ["select:", "methods", "=", "protocol"]
  16264. }),
  16265. $globals.TBehaviorProvider);
  16266. $core.addMethod(
  16267. $core.method({
  16268. selector: "organization",
  16269. protocol: "accessing",
  16270. fn: function (){
  16271. var self=this,$self=this;
  16272. return $core.withContext(function($ctx1) {
  16273. var $1,$receiver;
  16274. $1=$self._basicOrganization();
  16275. $ctx1.sendIdx["basicOrganization"]=1;
  16276. if(($receiver = $1) == null || $receiver.a$nil){
  16277. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16278. return $self._basicOrganization();
  16279. } else {
  16280. return $1;
  16281. }
  16282. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16283. },
  16284. args: [],
  16285. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16286. referencedClasses: ["ClassOrganizer"],
  16287. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16288. }),
  16289. $globals.TBehaviorProvider);
  16290. $core.addMethod(
  16291. $core.method({
  16292. selector: "ownMethods",
  16293. protocol: "accessing",
  16294. fn: function (){
  16295. var self=this,$self=this;
  16296. return $core.withContext(function($ctx1) {
  16297. var $1;
  16298. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16299. return $core.withContext(function($ctx2) {
  16300. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16301. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16302. })))._sorted_((function(a,b){
  16303. return $core.withContext(function($ctx2) {
  16304. $1=$recv(a)._selector();
  16305. $ctx2.sendIdx["selector"]=1;
  16306. return $recv($1).__lt_eq($recv(b)._selector());
  16307. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16308. }));
  16309. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16310. },
  16311. args: [],
  16312. 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 ]",
  16313. referencedClasses: ["OrderedCollection"],
  16314. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16315. }),
  16316. $globals.TBehaviorProvider);
  16317. $core.addMethod(
  16318. $core.method({
  16319. selector: "ownMethodsInProtocol:",
  16320. protocol: "accessing",
  16321. fn: function (aString){
  16322. var self=this,$self=this;
  16323. return $core.withContext(function($ctx1) {
  16324. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16325. return $core.withContext(function($ctx2) {
  16326. return $recv($recv(each)._methodClass()).__eq(self);
  16327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16328. }));
  16329. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16330. },
  16331. args: ["aString"],
  16332. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16333. referencedClasses: [],
  16334. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16335. }),
  16336. $globals.TBehaviorProvider);
  16337. $core.addMethod(
  16338. $core.method({
  16339. selector: "ownProtocols",
  16340. protocol: "accessing",
  16341. fn: function (){
  16342. var self=this,$self=this;
  16343. return $core.withContext(function($ctx1) {
  16344. return $recv($self._protocols())._reject_((function(each){
  16345. return $core.withContext(function($ctx2) {
  16346. return $recv(each)._match_("^\x5c*");
  16347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16348. }));
  16349. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16350. },
  16351. args: [],
  16352. 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*' ]",
  16353. referencedClasses: [],
  16354. messageSends: ["reject:", "protocols", "match:"]
  16355. }),
  16356. $globals.TBehaviorProvider);
  16357. $core.addMethod(
  16358. $core.method({
  16359. selector: "packageOfProtocol:",
  16360. protocol: "accessing",
  16361. fn: function (aString){
  16362. var self=this,$self=this;
  16363. return $core.withContext(function($ctx1) {
  16364. var $1;
  16365. $1=$recv(aString)._beginsWith_("*");
  16366. if(!$core.assert($1)){
  16367. return $self._package();
  16368. }
  16369. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16370. return nil;
  16371. }));
  16372. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16373. },
  16374. args: ["aString"],
  16375. 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 ]",
  16376. referencedClasses: ["Package"],
  16377. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16378. }),
  16379. $globals.TBehaviorProvider);
  16380. $core.addMethod(
  16381. $core.method({
  16382. selector: "protocols",
  16383. protocol: "accessing",
  16384. fn: function (){
  16385. var self=this,$self=this;
  16386. return $core.withContext(function($ctx1) {
  16387. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16388. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16389. },
  16390. args: [],
  16391. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16392. referencedClasses: [],
  16393. messageSends: ["sorted", "asArray", "elements", "organization"]
  16394. }),
  16395. $globals.TBehaviorProvider);
  16396. $core.addMethod(
  16397. $core.method({
  16398. selector: "protocolsDo:",
  16399. protocol: "enumerating",
  16400. fn: function (aBlock){
  16401. var self=this,$self=this;
  16402. var methodsByProtocol;
  16403. return $core.withContext(function($ctx1) {
  16404. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16405. $ctx1.sendIdx["new"]=1;
  16406. $recv($self._methodDictionary())._valuesDo_((function(m){
  16407. return $core.withContext(function($ctx2) {
  16408. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16409. return $core.withContext(function($ctx3) {
  16410. return $recv($globals.Array)._new();
  16411. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16412. })))._add_(m);
  16413. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16414. }));
  16415. $recv($self._protocols())._do_((function(protocol){
  16416. return $core.withContext(function($ctx2) {
  16417. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16418. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16419. }));
  16420. return self;
  16421. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16422. },
  16423. args: ["aBlock"],
  16424. 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) ]",
  16425. referencedClasses: ["HashedCollection", "Array"],
  16426. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16427. }),
  16428. $globals.TBehaviorProvider);
  16429. $core.addMethod(
  16430. $core.method({
  16431. selector: "recompile",
  16432. protocol: "compiling",
  16433. fn: function (){
  16434. var self=this,$self=this;
  16435. return $core.withContext(function($ctx1) {
  16436. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16437. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16438. },
  16439. args: [],
  16440. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16441. referencedClasses: ["Compiler"],
  16442. messageSends: ["recompile:", "new"]
  16443. }),
  16444. $globals.TBehaviorProvider);
  16445. $core.addMethod(
  16446. $core.method({
  16447. selector: "removeCompiledMethod:",
  16448. protocol: "compiling",
  16449. fn: function (aMethod){
  16450. var self=this,$self=this;
  16451. return $core.withContext(function($ctx1) {
  16452. var $1,$3,$2;
  16453. $self._basicRemoveCompiledMethod_(aMethod);
  16454. $1=$recv($globals.SystemAnnouncer)._current();
  16455. $3=$recv($globals.MethodRemoved)._new();
  16456. $recv($3)._method_(aMethod);
  16457. $2=$recv($3)._yourself();
  16458. $recv($1)._announce_($2);
  16459. return self;
  16460. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16461. },
  16462. args: ["aMethod"],
  16463. 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)",
  16464. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16465. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16466. }),
  16467. $globals.TBehaviorProvider);
  16468. $core.addMethod(
  16469. $core.method({
  16470. selector: "removeProtocolIfEmpty:",
  16471. protocol: "accessing",
  16472. fn: function (aString){
  16473. var self=this,$self=this;
  16474. return $core.withContext(function($ctx1) {
  16475. $recv($self._methods())._detect_ifNone_((function(each){
  16476. return $core.withContext(function($ctx2) {
  16477. return $recv($recv(each)._protocol()).__eq(aString);
  16478. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16479. }),(function(){
  16480. return $core.withContext(function($ctx2) {
  16481. return $recv($self._organization())._removeElement_(aString);
  16482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16483. }));
  16484. return self;
  16485. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16486. },
  16487. args: ["aString"],
  16488. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16489. referencedClasses: [],
  16490. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16491. }),
  16492. $globals.TBehaviorProvider);
  16493. $core.addMethod(
  16494. $core.method({
  16495. selector: "selectors",
  16496. protocol: "accessing",
  16497. fn: function (){
  16498. var self=this,$self=this;
  16499. return $core.withContext(function($ctx1) {
  16500. return $recv($self._methodDictionary())._keys();
  16501. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16502. },
  16503. args: [],
  16504. source: "selectors\x0a\x09^ self methodDictionary keys",
  16505. referencedClasses: [],
  16506. messageSends: ["keys", "methodDictionary"]
  16507. }),
  16508. $globals.TBehaviorProvider);
  16509. $core.addMethod(
  16510. $core.method({
  16511. selector: "setTraitComposition:",
  16512. protocol: "compiling",
  16513. fn: function (aTraitComposition){
  16514. var self=this,$self=this;
  16515. return $core.withContext(function($ctx1) {
  16516. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16517. return self;
  16518. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16519. },
  16520. args: ["aTraitComposition"],
  16521. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16522. referencedClasses: [],
  16523. messageSends: []
  16524. }),
  16525. $globals.TBehaviorProvider);
  16526. $core.addMethod(
  16527. $core.method({
  16528. selector: "traitComposition",
  16529. protocol: "accessing",
  16530. fn: function (){
  16531. var self=this,$self=this;
  16532. return $core.withContext(function($ctx1) {
  16533. var $1,$receiver;
  16534. $1=$self._basicAt_("traitComposition");
  16535. if(($receiver = $1) == null || $receiver.a$nil){
  16536. return [];
  16537. } else {
  16538. var aCollection;
  16539. aCollection=$receiver;
  16540. return $recv(aCollection)._collect_((function(each){
  16541. return $core.withContext(function($ctx2) {
  16542. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16543. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16544. }));
  16545. }
  16546. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16547. },
  16548. args: [],
  16549. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16550. referencedClasses: ["TraitTransformation"],
  16551. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16552. }),
  16553. $globals.TBehaviorProvider);
  16554. $core.addMethod(
  16555. $core.method({
  16556. selector: "traitCompositionDefinition",
  16557. protocol: "accessing",
  16558. fn: function (){
  16559. var self=this,$self=this;
  16560. return $core.withContext(function($ctx1) {
  16561. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16562. return $core.withContext(function($ctx2) {
  16563. return $recv($globals.String)._streamContents_((function(str){
  16564. return $core.withContext(function($ctx3) {
  16565. $recv(str)._write_("{");
  16566. $ctx3.sendIdx["write:"]=1;
  16567. $recv(traitComposition)._do_separatedBy_((function(each){
  16568. return $core.withContext(function($ctx4) {
  16569. return $recv(str)._write_($recv(each)._definition());
  16570. $ctx4.sendIdx["write:"]=2;
  16571. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16572. }),(function(){
  16573. return $core.withContext(function($ctx4) {
  16574. return $recv(str)._write_(". ");
  16575. $ctx4.sendIdx["write:"]=3;
  16576. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16577. }));
  16578. return $recv(str)._write_("}");
  16579. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16580. }));
  16581. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16582. }));
  16583. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16584. },
  16585. args: [],
  16586. 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: '}' ] ]",
  16587. referencedClasses: ["String"],
  16588. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16589. }),
  16590. $globals.TBehaviorProvider);
  16591. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16592. $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.";
  16593. $core.addMethod(
  16594. $core.method({
  16595. selector: "asJavaScriptSource",
  16596. protocol: "converting",
  16597. fn: function (){
  16598. var self=this,$self=this;
  16599. return $core.withContext(function($ctx1) {
  16600. return "$globals.".__comma($self._name());
  16601. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16602. },
  16603. args: [],
  16604. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16605. referencedClasses: [],
  16606. messageSends: [",", "name"]
  16607. }),
  16608. $globals.TMasterBehavior);
  16609. $core.addMethod(
  16610. $core.method({
  16611. selector: "browse",
  16612. protocol: "browsing",
  16613. fn: function (){
  16614. var self=this,$self=this;
  16615. return $core.withContext(function($ctx1) {
  16616. $recv($globals.Finder)._findClass_(self);
  16617. return self;
  16618. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16619. },
  16620. args: [],
  16621. source: "browse\x0a\x09Finder findClass: self",
  16622. referencedClasses: ["Finder"],
  16623. messageSends: ["findClass:"]
  16624. }),
  16625. $globals.TMasterBehavior);
  16626. $core.addMethod(
  16627. $core.method({
  16628. selector: "category",
  16629. protocol: "accessing",
  16630. fn: function (){
  16631. var self=this,$self=this;
  16632. return $core.withContext(function($ctx1) {
  16633. var $1,$receiver;
  16634. $1=$self._package();
  16635. $ctx1.sendIdx["package"]=1;
  16636. if(($receiver = $1) == null || $receiver.a$nil){
  16637. return "Unclassified";
  16638. } else {
  16639. return $recv($self._package())._name();
  16640. }
  16641. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16642. },
  16643. args: [],
  16644. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16645. referencedClasses: [],
  16646. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16647. }),
  16648. $globals.TMasterBehavior);
  16649. $core.addMethod(
  16650. $core.method({
  16651. selector: "classTag",
  16652. protocol: "accessing",
  16653. fn: function (){
  16654. var self=this,$self=this;
  16655. return $core.withContext(function($ctx1) {
  16656. return $self._subclassResponsibility();
  16657. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16658. },
  16659. args: [],
  16660. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16661. referencedClasses: [],
  16662. messageSends: ["subclassResponsibility"]
  16663. }),
  16664. $globals.TMasterBehavior);
  16665. $core.addMethod(
  16666. $core.method({
  16667. selector: "comment",
  16668. protocol: "accessing",
  16669. fn: function (){
  16670. var self=this,$self=this;
  16671. return $core.withContext(function($ctx1) {
  16672. var $1,$receiver;
  16673. $1=$self._basicAt_("comment");
  16674. if(($receiver = $1) == null || $receiver.a$nil){
  16675. return "";
  16676. } else {
  16677. return $1;
  16678. }
  16679. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16680. },
  16681. args: [],
  16682. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16683. referencedClasses: [],
  16684. messageSends: ["ifNil:", "basicAt:"]
  16685. }),
  16686. $globals.TMasterBehavior);
  16687. $core.addMethod(
  16688. $core.method({
  16689. selector: "comment:",
  16690. protocol: "accessing",
  16691. fn: function (aString){
  16692. var self=this,$self=this;
  16693. return $core.withContext(function($ctx1) {
  16694. var $1,$3,$2;
  16695. $self._basicAt_put_("comment",aString);
  16696. $1=$recv($globals.SystemAnnouncer)._current();
  16697. $3=$recv($globals.ClassCommentChanged)._new();
  16698. $recv($3)._theClass_(self);
  16699. $2=$recv($3)._yourself();
  16700. $recv($1)._announce_($2);
  16701. return self;
  16702. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16703. },
  16704. args: ["aString"],
  16705. 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)",
  16706. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16707. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16708. }),
  16709. $globals.TMasterBehavior);
  16710. $core.addMethod(
  16711. $core.method({
  16712. selector: "definedMethods",
  16713. protocol: "accessing",
  16714. fn: function (){
  16715. var self=this,$self=this;
  16716. var methods;
  16717. return $core.withContext(function($ctx1) {
  16718. var $1,$receiver;
  16719. methods=$self._methods();
  16720. $ctx1.sendIdx["methods"]=1;
  16721. $1=$self._theMetaClass();
  16722. if(($receiver = $1) == null || $receiver.a$nil){
  16723. return methods;
  16724. } else {
  16725. var meta;
  16726. meta=$receiver;
  16727. return $recv(methods).__comma($recv(meta)._methods());
  16728. }
  16729. return self;
  16730. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16731. },
  16732. args: [],
  16733. 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 ]",
  16734. referencedClasses: [],
  16735. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16736. }),
  16737. $globals.TMasterBehavior);
  16738. $core.addMethod(
  16739. $core.method({
  16740. selector: "enterOrganization",
  16741. protocol: "accessing",
  16742. fn: function (){
  16743. var self=this,$self=this;
  16744. return $core.withContext(function($ctx1) {
  16745. var $1,$receiver;
  16746. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16747. $globals.Smalltalk;
  16748. } else {
  16749. $1=$self._basicAt_("category");
  16750. if(($receiver = $1) == null || $receiver.a$nil){
  16751. $self._basicPackage_(nil);
  16752. $ctx1.sendIdx["basicPackage:"]=1;
  16753. } else {
  16754. var category;
  16755. category=$receiver;
  16756. $self._basicPackage_($recv($globals.Package)._named_(category));
  16757. $recv($recv($self._package())._organization())._addElement_(self);
  16758. }
  16759. }
  16760. return self;
  16761. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16762. },
  16763. args: [],
  16764. 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 ] ]",
  16765. referencedClasses: ["Smalltalk", "Package"],
  16766. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16767. }),
  16768. $globals.TMasterBehavior);
  16769. $core.addMethod(
  16770. $core.method({
  16771. selector: "leaveOrganization",
  16772. protocol: "accessing",
  16773. fn: function (){
  16774. var self=this,$self=this;
  16775. return $core.withContext(function($ctx1) {
  16776. var $receiver;
  16777. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16778. $globals.Smalltalk;
  16779. } else {
  16780. $recv($recv($self._package())._organization())._removeElement_(self);
  16781. }
  16782. return self;
  16783. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16784. },
  16785. args: [],
  16786. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16787. referencedClasses: ["Smalltalk"],
  16788. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16789. }),
  16790. $globals.TMasterBehavior);
  16791. $core.addMethod(
  16792. $core.method({
  16793. selector: "name",
  16794. protocol: "accessing",
  16795. fn: function (){
  16796. var self=this,$self=this;
  16797. return $core.withContext(function($ctx1) {
  16798. return self.name;
  16799. return self;
  16800. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16801. },
  16802. args: [],
  16803. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16804. referencedClasses: [],
  16805. messageSends: []
  16806. }),
  16807. $globals.TMasterBehavior);
  16808. $core.addMethod(
  16809. $core.method({
  16810. selector: "package:",
  16811. protocol: "accessing",
  16812. fn: function (aPackage){
  16813. var self=this,$self=this;
  16814. var oldPackage;
  16815. return $core.withContext(function($ctx1) {
  16816. var $2,$1,$3,$5,$4;
  16817. $2=$self._package();
  16818. $ctx1.sendIdx["package"]=1;
  16819. $1=$recv($2).__eq(aPackage);
  16820. if($core.assert($1)){
  16821. return self;
  16822. }
  16823. oldPackage=$self._package();
  16824. $self._leaveOrganization();
  16825. $self._basicAt_put_("category",aPackage);
  16826. $self._enterOrganization();
  16827. $3=$recv($globals.SystemAnnouncer)._current();
  16828. $5=$recv($globals.ClassMoved)._new();
  16829. $recv($5)._theClass_(self);
  16830. $recv($5)._oldPackage_(oldPackage);
  16831. $4=$recv($5)._yourself();
  16832. $recv($3)._announce_($4);
  16833. return self;
  16834. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16835. },
  16836. args: ["aPackage"],
  16837. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16838. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16839. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16840. }),
  16841. $globals.TMasterBehavior);
  16842. $core.addMethod(
  16843. $core.method({
  16844. selector: "theNonMetaClass",
  16845. protocol: "accessing",
  16846. fn: function (){
  16847. var self=this,$self=this;
  16848. return self;
  16849. },
  16850. args: [],
  16851. source: "theNonMetaClass\x0a\x09^ self",
  16852. referencedClasses: [],
  16853. messageSends: []
  16854. }),
  16855. $globals.TMasterBehavior);
  16856. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16857. $core.addMethod(
  16858. $core.method({
  16859. selector: "-",
  16860. protocol: "composition",
  16861. fn: function (anArray){
  16862. var self=this,$self=this;
  16863. return $core.withContext(function($ctx1) {
  16864. return $recv($self._asTraitTransformation()).__minus(anArray);
  16865. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16866. },
  16867. args: ["anArray"],
  16868. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16869. referencedClasses: [],
  16870. messageSends: ["-", "asTraitTransformation"]
  16871. }),
  16872. $globals.Trait);
  16873. $core.addMethod(
  16874. $core.method({
  16875. selector: "@",
  16876. protocol: "composition",
  16877. fn: function (anArrayOfAssociations){
  16878. var self=this,$self=this;
  16879. return $core.withContext(function($ctx1) {
  16880. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16881. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16882. },
  16883. args: ["anArrayOfAssociations"],
  16884. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16885. referencedClasses: [],
  16886. messageSends: ["@", "asTraitTransformation"]
  16887. }),
  16888. $globals.Trait);
  16889. $core.addMethod(
  16890. $core.method({
  16891. selector: "asTraitComposition",
  16892. protocol: "converting",
  16893. fn: function (){
  16894. var self=this,$self=this;
  16895. return $core.withContext(function($ctx1) {
  16896. return $recv($self._asTraitTransformation())._asTraitComposition();
  16897. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16898. },
  16899. args: [],
  16900. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16901. referencedClasses: [],
  16902. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16903. }),
  16904. $globals.Trait);
  16905. $core.addMethod(
  16906. $core.method({
  16907. selector: "asTraitTransformation",
  16908. protocol: "converting",
  16909. fn: function (){
  16910. var self=this,$self=this;
  16911. return $core.withContext(function($ctx1) {
  16912. return $recv($globals.TraitTransformation)._on_(self);
  16913. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16914. },
  16915. args: [],
  16916. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16917. referencedClasses: ["TraitTransformation"],
  16918. messageSends: ["on:"]
  16919. }),
  16920. $globals.Trait);
  16921. $core.addMethod(
  16922. $core.method({
  16923. selector: "basicOrganization",
  16924. protocol: "accessing",
  16925. fn: function (){
  16926. var self=this,$self=this;
  16927. return $self["@organization"];
  16928. },
  16929. args: [],
  16930. source: "basicOrganization\x0a\x09^ organization",
  16931. referencedClasses: [],
  16932. messageSends: []
  16933. }),
  16934. $globals.Trait);
  16935. $core.addMethod(
  16936. $core.method({
  16937. selector: "basicOrganization:",
  16938. protocol: "accessing",
  16939. fn: function (aClassOrganizer){
  16940. var self=this,$self=this;
  16941. $self["@organization"]=aClassOrganizer;
  16942. return self;
  16943. },
  16944. args: ["aClassOrganizer"],
  16945. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16946. referencedClasses: [],
  16947. messageSends: []
  16948. }),
  16949. $globals.Trait);
  16950. $core.addMethod(
  16951. $core.method({
  16952. selector: "basicPackage:",
  16953. protocol: "accessing",
  16954. fn: function (aPackage){
  16955. var self=this,$self=this;
  16956. $self["@package"]=aPackage;
  16957. return self;
  16958. },
  16959. args: ["aPackage"],
  16960. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16961. referencedClasses: [],
  16962. messageSends: []
  16963. }),
  16964. $globals.Trait);
  16965. $core.addMethod(
  16966. $core.method({
  16967. selector: "classTag",
  16968. protocol: "accessing",
  16969. fn: function (){
  16970. var self=this,$self=this;
  16971. return "trait";
  16972. },
  16973. args: [],
  16974. source: "classTag\x0a\x09^ 'trait'",
  16975. referencedClasses: [],
  16976. messageSends: []
  16977. }),
  16978. $globals.Trait);
  16979. $core.addMethod(
  16980. $core.method({
  16981. selector: "definition",
  16982. protocol: "accessing",
  16983. fn: function (){
  16984. var self=this,$self=this;
  16985. return $core.withContext(function($ctx1) {
  16986. var $1;
  16987. return $recv($globals.String)._streamContents_((function(stream){
  16988. return $core.withContext(function($ctx2) {
  16989. $recv(stream)._write_("Trait named: ");
  16990. $ctx2.sendIdx["write:"]=1;
  16991. $recv(stream)._printSymbol_($self._name());
  16992. $recv(stream)._lf();
  16993. $ctx2.sendIdx["lf"]=1;
  16994. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  16995. return $core.withContext(function($ctx3) {
  16996. $1=$recv($globals.String)._tab();
  16997. $ctx3.sendIdx["tab"]=1;
  16998. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  16999. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17000. })));
  17001. $ctx2.sendIdx["write:"]=2;
  17002. $recv(stream)._tab();
  17003. $recv(stream)._write_("package: ");
  17004. return $recv(stream)._print_($self._category());
  17005. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17006. }));
  17007. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  17008. },
  17009. args: [],
  17010. 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 ]",
  17011. referencedClasses: ["String"],
  17012. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17013. }),
  17014. $globals.Trait);
  17015. $core.addMethod(
  17016. $core.method({
  17017. selector: "package",
  17018. protocol: "accessing",
  17019. fn: function (){
  17020. var self=this,$self=this;
  17021. return $self["@package"];
  17022. },
  17023. args: [],
  17024. source: "package\x0a\x09^ package",
  17025. referencedClasses: [],
  17026. messageSends: []
  17027. }),
  17028. $globals.Trait);
  17029. $core.addMethod(
  17030. $core.method({
  17031. selector: "theMetaClass",
  17032. protocol: "accessing",
  17033. fn: function (){
  17034. var self=this,$self=this;
  17035. return nil;
  17036. },
  17037. args: [],
  17038. source: "theMetaClass\x0a\x09^ nil",
  17039. referencedClasses: [],
  17040. messageSends: []
  17041. }),
  17042. $globals.Trait);
  17043. $core.addMethod(
  17044. $core.method({
  17045. selector: "traitUsers",
  17046. protocol: "accessing",
  17047. fn: function (){
  17048. var self=this,$self=this;
  17049. return $core.withContext(function($ctx1) {
  17050. return $recv($self._basicAt_("traitUsers"))._copy();
  17051. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17052. },
  17053. args: [],
  17054. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  17055. referencedClasses: [],
  17056. messageSends: ["copy", "basicAt:"]
  17057. }),
  17058. $globals.Trait);
  17059. $core.addMethod(
  17060. $core.method({
  17061. selector: "named:package:",
  17062. protocol: "instance creation",
  17063. fn: function (aString,anotherString){
  17064. var self=this,$self=this;
  17065. return $core.withContext(function($ctx1) {
  17066. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17067. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17068. },
  17069. args: ["aString", "anotherString"],
  17070. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17071. referencedClasses: ["ClassBuilder"],
  17072. messageSends: ["addTraitNamed:package:", "new"]
  17073. }),
  17074. $globals.Trait.a$cls);
  17075. $core.addMethod(
  17076. $core.method({
  17077. selector: "named:uses:package:",
  17078. protocol: "instance creation",
  17079. fn: function (aString,aTraitCompositionDescription,anotherString){
  17080. var self=this,$self=this;
  17081. var trait;
  17082. return $core.withContext(function($ctx1) {
  17083. trait=$self._named_package_(aString,anotherString);
  17084. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17085. return trait;
  17086. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17087. },
  17088. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17089. 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",
  17090. referencedClasses: [],
  17091. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17092. }),
  17093. $globals.Trait.a$cls);
  17094. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17095. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17096. $core.addMethod(
  17097. $core.method({
  17098. selector: "-",
  17099. protocol: "composition",
  17100. fn: function (anArray){
  17101. var self=this,$self=this;
  17102. return $core.withContext(function($ctx1) {
  17103. var $1;
  17104. $1=$self._copy();
  17105. $recv($1)._addExclusions_(anArray);
  17106. return $recv($1)._yourself();
  17107. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17108. },
  17109. args: ["anArray"],
  17110. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17111. referencedClasses: [],
  17112. messageSends: ["addExclusions:", "copy", "yourself"]
  17113. }),
  17114. $globals.TraitTransformation);
  17115. $core.addMethod(
  17116. $core.method({
  17117. selector: "@",
  17118. protocol: "composition",
  17119. fn: function (anArrayOfAssociations){
  17120. var self=this,$self=this;
  17121. return $core.withContext(function($ctx1) {
  17122. var $1;
  17123. $1=$self._copy();
  17124. $recv($1)._addAliases_(anArrayOfAssociations);
  17125. return $recv($1)._yourself();
  17126. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17127. },
  17128. args: ["anArrayOfAssociations"],
  17129. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17130. referencedClasses: [],
  17131. messageSends: ["addAliases:", "copy", "yourself"]
  17132. }),
  17133. $globals.TraitTransformation);
  17134. $core.addMethod(
  17135. $core.method({
  17136. selector: "addAliases:",
  17137. protocol: "accessing",
  17138. fn: function (anArrayOfAssociations){
  17139. var self=this,$self=this;
  17140. return $core.withContext(function($ctx1) {
  17141. $recv(anArrayOfAssociations)._do_((function(each){
  17142. var key;
  17143. return $core.withContext(function($ctx2) {
  17144. key=$recv(each)._key();
  17145. key;
  17146. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17147. return $core.withContext(function($ctx3) {
  17148. return $self._error_("Cannot use same alias name twice.");
  17149. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17150. }),(function(){
  17151. return $core.withContext(function($ctx3) {
  17152. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17153. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17154. }));
  17155. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17156. }));
  17157. return anArrayOfAssociations;
  17158. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17159. },
  17160. args: ["anArrayOfAssociations"],
  17161. 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",
  17162. referencedClasses: [],
  17163. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17164. }),
  17165. $globals.TraitTransformation);
  17166. $core.addMethod(
  17167. $core.method({
  17168. selector: "addExclusions:",
  17169. protocol: "accessing",
  17170. fn: function (anArray){
  17171. var self=this,$self=this;
  17172. return $core.withContext(function($ctx1) {
  17173. $recv($self["@exclusions"])._addAll_(anArray);
  17174. return anArray;
  17175. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17176. },
  17177. args: ["anArray"],
  17178. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17179. referencedClasses: [],
  17180. messageSends: ["addAll:"]
  17181. }),
  17182. $globals.TraitTransformation);
  17183. $core.addMethod(
  17184. $core.method({
  17185. selector: "aliases",
  17186. protocol: "accessing",
  17187. fn: function (){
  17188. var self=this,$self=this;
  17189. return $self["@aliases"];
  17190. },
  17191. args: [],
  17192. source: "aliases\x0a\x09^ aliases",
  17193. referencedClasses: [],
  17194. messageSends: []
  17195. }),
  17196. $globals.TraitTransformation);
  17197. $core.addMethod(
  17198. $core.method({
  17199. selector: "asJavaScriptObject",
  17200. protocol: "converting",
  17201. fn: function (){
  17202. var self=this,$self=this;
  17203. return $core.withContext(function($ctx1) {
  17204. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17205. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17206. },
  17207. args: [],
  17208. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17209. referencedClasses: [],
  17210. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17211. }),
  17212. $globals.TraitTransformation);
  17213. $core.addMethod(
  17214. $core.method({
  17215. selector: "asJavaScriptSource",
  17216. protocol: "converting",
  17217. fn: function (){
  17218. var self=this,$self=this;
  17219. return $core.withContext(function($ctx1) {
  17220. var $2,$3,$1;
  17221. return $recv($globals.String)._streamContents_((function(str){
  17222. return $core.withContext(function($ctx2) {
  17223. $2=$recv($self._trait())._asJavaScriptSource();
  17224. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17225. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17226. return $core.withContext(function($ctx3) {
  17227. return [", aliases: ",$recv(al)._asJSONString()];
  17228. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17229. }));
  17230. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17231. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17232. return $core.withContext(function($ctx3) {
  17233. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17234. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17235. })),"}"];
  17236. return $recv(str)._write_($1);
  17237. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17238. }));
  17239. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17240. },
  17241. args: [],
  17242. 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'}' } ]",
  17243. referencedClasses: ["String"],
  17244. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17245. }),
  17246. $globals.TraitTransformation);
  17247. $core.addMethod(
  17248. $core.method({
  17249. selector: "asTraitComposition",
  17250. protocol: "converting",
  17251. fn: function (){
  17252. var self=this,$self=this;
  17253. return [self];
  17254. },
  17255. args: [],
  17256. source: "asTraitComposition\x0a\x09^ { self }",
  17257. referencedClasses: [],
  17258. messageSends: []
  17259. }),
  17260. $globals.TraitTransformation);
  17261. $core.addMethod(
  17262. $core.method({
  17263. selector: "asTraitTransformation",
  17264. protocol: "converting",
  17265. fn: function (){
  17266. var self=this,$self=this;
  17267. return self;
  17268. },
  17269. args: [],
  17270. source: "asTraitTransformation\x0a\x09^ self",
  17271. referencedClasses: [],
  17272. messageSends: []
  17273. }),
  17274. $globals.TraitTransformation);
  17275. $core.addMethod(
  17276. $core.method({
  17277. selector: "definition",
  17278. protocol: "accessing",
  17279. fn: function (){
  17280. var self=this,$self=this;
  17281. return $core.withContext(function($ctx1) {
  17282. return $recv($globals.String)._streamContents_((function(str){
  17283. return $core.withContext(function($ctx2) {
  17284. $recv(str)._print_($self._trait());
  17285. $recv($self._aliases())._ifNotEmpty_((function(al){
  17286. return $core.withContext(function($ctx3) {
  17287. $recv(str)._write_(" @ {");
  17288. $ctx3.sendIdx["write:"]=1;
  17289. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17290. return $core.withContext(function($ctx4) {
  17291. $recv(str)._printSymbol_($recv(each)._key());
  17292. $ctx4.sendIdx["printSymbol:"]=1;
  17293. $recv(str)._write_(" -> ");
  17294. $ctx4.sendIdx["write:"]=2;
  17295. return $recv(str)._printSymbol_($recv(each)._value());
  17296. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17297. }),(function(){
  17298. return $core.withContext(function($ctx4) {
  17299. return $recv(str)._write_(". ");
  17300. $ctx4.sendIdx["write:"]=3;
  17301. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17302. }));
  17303. $ctx3.sendIdx["do:separatedBy:"]=1;
  17304. return $recv(str)._write_("}");
  17305. $ctx3.sendIdx["write:"]=4;
  17306. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17307. }));
  17308. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17309. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17310. return $core.withContext(function($ctx3) {
  17311. $recv(str)._write_(" - #(");
  17312. $ctx3.sendIdx["write:"]=5;
  17313. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17314. return $core.withContext(function($ctx4) {
  17315. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17316. $ctx4.sendIdx["write:"]=6;
  17317. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17318. }),(function(){
  17319. return $core.withContext(function($ctx4) {
  17320. return $recv(str)._space();
  17321. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17322. }));
  17323. return $recv(str)._write_(")");
  17324. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17325. }));
  17326. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17327. }));
  17328. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17329. },
  17330. args: [],
  17331. 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: ')' ] ]",
  17332. referencedClasses: ["String"],
  17333. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17334. }),
  17335. $globals.TraitTransformation);
  17336. $core.addMethod(
  17337. $core.method({
  17338. selector: "exclusions",
  17339. protocol: "accessing",
  17340. fn: function (){
  17341. var self=this,$self=this;
  17342. return $self["@exclusions"];
  17343. },
  17344. args: [],
  17345. source: "exclusions\x0a\x09^ exclusions",
  17346. referencedClasses: [],
  17347. messageSends: []
  17348. }),
  17349. $globals.TraitTransformation);
  17350. $core.addMethod(
  17351. $core.method({
  17352. selector: "initialize",
  17353. protocol: "initialization",
  17354. fn: function (){
  17355. var self=this,$self=this;
  17356. return $core.withContext(function($ctx1) {
  17357. (
  17358. $ctx1.supercall = true,
  17359. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17360. $ctx1.supercall = false;
  17361. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17362. $self["@exclusions"]=$recv($globals.Set)._new();
  17363. $self["@trait"]=nil;
  17364. return self;
  17365. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17366. },
  17367. args: [],
  17368. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17369. referencedClasses: ["Set"],
  17370. messageSends: ["initialize", "new"]
  17371. }),
  17372. $globals.TraitTransformation);
  17373. $core.addMethod(
  17374. $core.method({
  17375. selector: "postCopy",
  17376. protocol: "copying",
  17377. fn: function (){
  17378. var self=this,$self=this;
  17379. return $core.withContext(function($ctx1) {
  17380. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17381. $ctx1.sendIdx["copy"]=1;
  17382. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17383. return self;
  17384. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17385. },
  17386. args: [],
  17387. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17388. referencedClasses: [],
  17389. messageSends: ["copy"]
  17390. }),
  17391. $globals.TraitTransformation);
  17392. $core.addMethod(
  17393. $core.method({
  17394. selector: "trait",
  17395. protocol: "accessing",
  17396. fn: function (){
  17397. var self=this,$self=this;
  17398. return $self["@trait"];
  17399. },
  17400. args: [],
  17401. source: "trait\x0a\x09^ trait",
  17402. referencedClasses: [],
  17403. messageSends: []
  17404. }),
  17405. $globals.TraitTransformation);
  17406. $core.addMethod(
  17407. $core.method({
  17408. selector: "trait:",
  17409. protocol: "accessing",
  17410. fn: function (anObject){
  17411. var self=this,$self=this;
  17412. $self["@trait"]=anObject;
  17413. return self;
  17414. },
  17415. args: ["anObject"],
  17416. source: "trait: anObject\x0a\x09trait := anObject",
  17417. referencedClasses: [],
  17418. messageSends: []
  17419. }),
  17420. $globals.TraitTransformation);
  17421. $core.addMethod(
  17422. $core.method({
  17423. selector: "fromJSON:",
  17424. protocol: "instance creation",
  17425. fn: function (aJSObject){
  17426. var self=this,$self=this;
  17427. return $core.withContext(function($ctx1) {
  17428. var $1,$4,$3,$2;
  17429. $1=(
  17430. $ctx1.supercall = true,
  17431. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17432. $ctx1.supercall = false;
  17433. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17434. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17435. return $globals.HashedCollection._newFromPairs_([]);
  17436. }));
  17437. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17438. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17439. $2=$recv($3)._associations();
  17440. $recv($1)._addAliases_($2);
  17441. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17442. return [];
  17443. })));
  17444. return $recv($1)._yourself();
  17445. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17446. },
  17447. args: ["aJSObject"],
  17448. 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",
  17449. referencedClasses: ["Smalltalk"],
  17450. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17451. }),
  17452. $globals.TraitTransformation.a$cls);
  17453. $core.addMethod(
  17454. $core.method({
  17455. selector: "on:",
  17456. protocol: "instance creation",
  17457. fn: function (aTrait){
  17458. var self=this,$self=this;
  17459. return $core.withContext(function($ctx1) {
  17460. var $1;
  17461. $1=(
  17462. $ctx1.supercall = true,
  17463. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17464. $ctx1.supercall = false;
  17465. $recv($1)._trait_(aTrait);
  17466. return $recv($1)._yourself();
  17467. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17468. },
  17469. args: ["aTrait"],
  17470. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17471. referencedClasses: [],
  17472. messageSends: ["trait:", "new", "yourself"]
  17473. }),
  17474. $globals.TraitTransformation.a$cls);
  17475. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17476. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17477. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17478. $core.addMethod(
  17479. $core.method({
  17480. selector: "asTraitComposition",
  17481. protocol: "*Kernel-Classes",
  17482. fn: function (){
  17483. var self=this,$self=this;
  17484. return $core.withContext(function($ctx1) {
  17485. return $self._collect_((function(each){
  17486. return $core.withContext(function($ctx2) {
  17487. return $recv(each)._asTraitTransformation();
  17488. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17489. }));
  17490. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17491. },
  17492. args: [],
  17493. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17494. referencedClasses: [],
  17495. messageSends: ["collect:", "asTraitTransformation"]
  17496. }),
  17497. $globals.Array);
  17498. });
  17499. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17500. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17501. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17502. $core.addPackage("Kernel-Methods");
  17503. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17504. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17505. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17506. $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 | ... ] `";
  17507. $core.addMethod(
  17508. $core.method({
  17509. selector: "applyTo:arguments:",
  17510. protocol: "evaluating",
  17511. fn: function (anObject,aCollection){
  17512. var self=this,$self=this;
  17513. return $core.withContext(function($ctx1) {
  17514. return self.apply(anObject, aCollection);
  17515. return self;
  17516. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17517. },
  17518. args: ["anObject", "aCollection"],
  17519. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17520. referencedClasses: [],
  17521. messageSends: []
  17522. }),
  17523. $globals.BlockClosure);
  17524. $core.addMethod(
  17525. $core.method({
  17526. selector: "asCompiledMethod:",
  17527. protocol: "converting",
  17528. fn: function (aString){
  17529. var self=this,$self=this;
  17530. return $core.withContext(function($ctx1) {
  17531. return $core.method({selector:aString, fn:self});;
  17532. return self;
  17533. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17534. },
  17535. args: ["aString"],
  17536. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17537. referencedClasses: [],
  17538. messageSends: []
  17539. }),
  17540. $globals.BlockClosure);
  17541. $core.addMethod(
  17542. $core.method({
  17543. selector: "compiledSource",
  17544. protocol: "accessing",
  17545. fn: function (){
  17546. var self=this,$self=this;
  17547. return $core.withContext(function($ctx1) {
  17548. return self.toString();
  17549. return self;
  17550. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17551. },
  17552. args: [],
  17553. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17554. referencedClasses: [],
  17555. messageSends: []
  17556. }),
  17557. $globals.BlockClosure);
  17558. $core.addMethod(
  17559. $core.method({
  17560. selector: "currySelf",
  17561. protocol: "converting",
  17562. fn: function (){
  17563. var self=this,$self=this;
  17564. return $core.withContext(function($ctx1) {
  17565. return function () {
  17566. var args = [ this ];
  17567. args.push.apply(args, arguments);
  17568. return self.apply(null, args);
  17569. }
  17570. ;
  17571. return self;
  17572. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17573. },
  17574. args: [],
  17575. 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'>",
  17576. referencedClasses: [],
  17577. messageSends: []
  17578. }),
  17579. $globals.BlockClosure);
  17580. $core.addMethod(
  17581. $core.method({
  17582. selector: "ensure:",
  17583. protocol: "evaluating",
  17584. fn: function (aBlock){
  17585. var self=this,$self=this;
  17586. return $core.withContext(function($ctx1) {
  17587. try{return $self._value()}finally{aBlock._value()};
  17588. return self;
  17589. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17590. },
  17591. args: ["aBlock"],
  17592. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17593. referencedClasses: [],
  17594. messageSends: []
  17595. }),
  17596. $globals.BlockClosure);
  17597. $core.addMethod(
  17598. $core.method({
  17599. selector: "fork",
  17600. protocol: "timeout/interval",
  17601. fn: function (){
  17602. var self=this,$self=this;
  17603. return $core.withContext(function($ctx1) {
  17604. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17605. return self;
  17606. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17607. },
  17608. args: [],
  17609. source: "fork\x0a\x09ForkPool default fork: self",
  17610. referencedClasses: ["ForkPool"],
  17611. messageSends: ["fork:", "default"]
  17612. }),
  17613. $globals.BlockClosure);
  17614. $core.addMethod(
  17615. $core.method({
  17616. selector: "new",
  17617. protocol: "evaluating",
  17618. fn: function (){
  17619. var self=this,$self=this;
  17620. return $core.withContext(function($ctx1) {
  17621. return new self();
  17622. return self;
  17623. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17624. },
  17625. args: [],
  17626. 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()'>",
  17627. referencedClasses: [],
  17628. messageSends: []
  17629. }),
  17630. $globals.BlockClosure);
  17631. $core.addMethod(
  17632. $core.method({
  17633. selector: "newValue:",
  17634. protocol: "evaluating",
  17635. fn: function (anObject){
  17636. var self=this,$self=this;
  17637. return $core.withContext(function($ctx1) {
  17638. return $self._newWithValues_([anObject]);
  17639. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17640. },
  17641. args: ["anObject"],
  17642. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17643. referencedClasses: [],
  17644. messageSends: ["newWithValues:"]
  17645. }),
  17646. $globals.BlockClosure);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "newValue:value:",
  17650. protocol: "evaluating",
  17651. fn: function (anObject,anObject2){
  17652. var self=this,$self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. return $self._newWithValues_([anObject,anObject2]);
  17655. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17656. },
  17657. args: ["anObject", "anObject2"],
  17658. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17659. referencedClasses: [],
  17660. messageSends: ["newWithValues:"]
  17661. }),
  17662. $globals.BlockClosure);
  17663. $core.addMethod(
  17664. $core.method({
  17665. selector: "newValue:value:value:",
  17666. protocol: "evaluating",
  17667. fn: function (anObject,anObject2,anObject3){
  17668. var self=this,$self=this;
  17669. return $core.withContext(function($ctx1) {
  17670. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17671. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17672. },
  17673. args: ["anObject", "anObject2", "anObject3"],
  17674. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17675. referencedClasses: [],
  17676. messageSends: ["newWithValues:"]
  17677. }),
  17678. $globals.BlockClosure);
  17679. $core.addMethod(
  17680. $core.method({
  17681. selector: "newWithValues:",
  17682. protocol: "evaluating",
  17683. fn: function (aCollection){
  17684. var self=this,$self=this;
  17685. return $core.withContext(function($ctx1) {
  17686. var object = Object.create(self.prototype);
  17687. var result = self.apply(object, aCollection);
  17688. return typeof result === "object" ? result : object;
  17689. ;
  17690. return self;
  17691. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17692. },
  17693. args: ["aCollection"],
  17694. 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'>",
  17695. referencedClasses: [],
  17696. messageSends: []
  17697. }),
  17698. $globals.BlockClosure);
  17699. $core.addMethod(
  17700. $core.method({
  17701. selector: "numArgs",
  17702. protocol: "accessing",
  17703. fn: function (){
  17704. var self=this,$self=this;
  17705. return $core.withContext(function($ctx1) {
  17706. return self.length;
  17707. return self;
  17708. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17709. },
  17710. args: [],
  17711. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17712. referencedClasses: [],
  17713. messageSends: []
  17714. }),
  17715. $globals.BlockClosure);
  17716. $core.addMethod(
  17717. $core.method({
  17718. selector: "on:do:",
  17719. protocol: "error handling",
  17720. fn: function (anErrorClass,aBlock){
  17721. var self=this,$self=this;
  17722. return $core.withContext(function($ctx1) {
  17723. var $1;
  17724. return $self._tryCatch_((function(error){
  17725. var smalltalkError;
  17726. return $core.withContext(function($ctx2) {
  17727. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17728. smalltalkError;
  17729. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17730. if($core.assert($1)){
  17731. return $recv(aBlock)._value_(smalltalkError);
  17732. } else {
  17733. return $recv(smalltalkError)._resignal();
  17734. }
  17735. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17736. }));
  17737. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17738. },
  17739. args: ["anErrorClass", "aBlock"],
  17740. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  17741. referencedClasses: ["Smalltalk"],
  17742. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  17743. }),
  17744. $globals.BlockClosure);
  17745. $core.addMethod(
  17746. $core.method({
  17747. selector: "receiver",
  17748. protocol: "accessing",
  17749. fn: function (){
  17750. var self=this,$self=this;
  17751. return nil;
  17752. },
  17753. args: [],
  17754. source: "receiver\x0a\x09^ nil",
  17755. referencedClasses: [],
  17756. messageSends: []
  17757. }),
  17758. $globals.BlockClosure);
  17759. $core.addMethod(
  17760. $core.method({
  17761. selector: "timeToRun",
  17762. protocol: "evaluating",
  17763. fn: function (){
  17764. var self=this,$self=this;
  17765. return $core.withContext(function($ctx1) {
  17766. return $recv($globals.Date)._millisecondsToRun_(self);
  17767. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17768. },
  17769. args: [],
  17770. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17771. referencedClasses: ["Date"],
  17772. messageSends: ["millisecondsToRun:"]
  17773. }),
  17774. $globals.BlockClosure);
  17775. $core.addMethod(
  17776. $core.method({
  17777. selector: "tryCatch:",
  17778. protocol: "error handling",
  17779. fn: function (aBlock){
  17780. var self=this,$self=this;
  17781. return $core.withContext(function($ctx1) {
  17782. try {
  17783. return $self._value();
  17784. } catch(error) {
  17785. // pass non-local returns undetected
  17786. if (Array.isArray(error) && error.length === 1) throw error;
  17787. return aBlock._value_(error);
  17788. }
  17789. ;
  17790. return self;
  17791. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17792. },
  17793. args: ["aBlock"],
  17794. 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'>",
  17795. referencedClasses: [],
  17796. messageSends: []
  17797. }),
  17798. $globals.BlockClosure);
  17799. $core.addMethod(
  17800. $core.method({
  17801. selector: "value",
  17802. protocol: "evaluating",
  17803. fn: function (){
  17804. var self=this,$self=this;
  17805. return $core.withContext(function($ctx1) {
  17806. return self();;
  17807. return self;
  17808. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17809. },
  17810. args: [],
  17811. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17812. referencedClasses: [],
  17813. messageSends: []
  17814. }),
  17815. $globals.BlockClosure);
  17816. $core.addMethod(
  17817. $core.method({
  17818. selector: "value:",
  17819. protocol: "evaluating",
  17820. fn: function (anArg){
  17821. var self=this,$self=this;
  17822. return $core.withContext(function($ctx1) {
  17823. return self(anArg);;
  17824. return self;
  17825. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17826. },
  17827. args: ["anArg"],
  17828. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17829. referencedClasses: [],
  17830. messageSends: []
  17831. }),
  17832. $globals.BlockClosure);
  17833. $core.addMethod(
  17834. $core.method({
  17835. selector: "value:value:",
  17836. protocol: "evaluating",
  17837. fn: function (firstArg,secondArg){
  17838. var self=this,$self=this;
  17839. return $core.withContext(function($ctx1) {
  17840. return self(firstArg, secondArg);;
  17841. return self;
  17842. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17843. },
  17844. args: ["firstArg", "secondArg"],
  17845. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17846. referencedClasses: [],
  17847. messageSends: []
  17848. }),
  17849. $globals.BlockClosure);
  17850. $core.addMethod(
  17851. $core.method({
  17852. selector: "value:value:value:",
  17853. protocol: "evaluating",
  17854. fn: function (firstArg,secondArg,thirdArg){
  17855. var self=this,$self=this;
  17856. return $core.withContext(function($ctx1) {
  17857. return self(firstArg, secondArg, thirdArg);;
  17858. return self;
  17859. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17860. },
  17861. args: ["firstArg", "secondArg", "thirdArg"],
  17862. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17863. referencedClasses: [],
  17864. messageSends: []
  17865. }),
  17866. $globals.BlockClosure);
  17867. $core.addMethod(
  17868. $core.method({
  17869. selector: "valueWithInterval:",
  17870. protocol: "timeout/interval",
  17871. fn: function (aNumber){
  17872. var self=this,$self=this;
  17873. return $core.withContext(function($ctx1) {
  17874. var interval = setInterval(self, aNumber);
  17875. return $globals.Timeout._on_(interval);
  17876. ;
  17877. return self;
  17878. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17879. },
  17880. args: ["aNumber"],
  17881. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17882. referencedClasses: [],
  17883. messageSends: []
  17884. }),
  17885. $globals.BlockClosure);
  17886. $core.addMethod(
  17887. $core.method({
  17888. selector: "valueWithPossibleArguments:",
  17889. protocol: "evaluating",
  17890. fn: function (aCollection){
  17891. var self=this,$self=this;
  17892. return $core.withContext(function($ctx1) {
  17893. return self.apply(null, aCollection);;
  17894. return self;
  17895. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17896. },
  17897. args: ["aCollection"],
  17898. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17899. referencedClasses: [],
  17900. messageSends: []
  17901. }),
  17902. $globals.BlockClosure);
  17903. $core.addMethod(
  17904. $core.method({
  17905. selector: "valueWithTimeout:",
  17906. protocol: "timeout/interval",
  17907. fn: function (aNumber){
  17908. var self=this,$self=this;
  17909. return $core.withContext(function($ctx1) {
  17910. var timeout = setTimeout(self, aNumber);
  17911. return $globals.Timeout._on_(timeout);
  17912. ;
  17913. return self;
  17914. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17915. },
  17916. args: ["aNumber"],
  17917. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17918. referencedClasses: [],
  17919. messageSends: []
  17920. }),
  17921. $globals.BlockClosure);
  17922. $core.addMethod(
  17923. $core.method({
  17924. selector: "whileFalse",
  17925. protocol: "controlling",
  17926. fn: function (){
  17927. var self=this,$self=this;
  17928. return $core.withContext(function($ctx1) {
  17929. $self._whileFalse_((function(){
  17930. }));
  17931. return self;
  17932. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17933. },
  17934. args: [],
  17935. source: "whileFalse\x0a\x09self whileFalse: []",
  17936. referencedClasses: [],
  17937. messageSends: ["whileFalse:"]
  17938. }),
  17939. $globals.BlockClosure);
  17940. $core.addMethod(
  17941. $core.method({
  17942. selector: "whileFalse:",
  17943. protocol: "controlling",
  17944. fn: function (aBlock){
  17945. var self=this,$self=this;
  17946. return $core.withContext(function($ctx1) {
  17947. while(!$core.assert($self._value())) {aBlock._value()};
  17948. return self;
  17949. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17950. },
  17951. args: ["aBlock"],
  17952. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17953. referencedClasses: [],
  17954. messageSends: []
  17955. }),
  17956. $globals.BlockClosure);
  17957. $core.addMethod(
  17958. $core.method({
  17959. selector: "whileTrue",
  17960. protocol: "controlling",
  17961. fn: function (){
  17962. var self=this,$self=this;
  17963. return $core.withContext(function($ctx1) {
  17964. $self._whileTrue_((function(){
  17965. }));
  17966. return self;
  17967. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17968. },
  17969. args: [],
  17970. source: "whileTrue\x0a\x09self whileTrue: []",
  17971. referencedClasses: [],
  17972. messageSends: ["whileTrue:"]
  17973. }),
  17974. $globals.BlockClosure);
  17975. $core.addMethod(
  17976. $core.method({
  17977. selector: "whileTrue:",
  17978. protocol: "controlling",
  17979. fn: function (aBlock){
  17980. var self=this,$self=this;
  17981. return $core.withContext(function($ctx1) {
  17982. while($core.assert($self._value())) {aBlock._value()};
  17983. return self;
  17984. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  17985. },
  17986. args: ["aBlock"],
  17987. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  17988. referencedClasses: [],
  17989. messageSends: []
  17990. }),
  17991. $globals.BlockClosure);
  17992. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  17993. $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";
  17994. $core.addMethod(
  17995. $core.method({
  17996. selector: "arguments",
  17997. protocol: "accessing",
  17998. fn: function (){
  17999. var self=this,$self=this;
  18000. return $core.withContext(function($ctx1) {
  18001. return self.args || [];
  18002. return self;
  18003. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18004. },
  18005. args: [],
  18006. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  18007. referencedClasses: [],
  18008. messageSends: []
  18009. }),
  18010. $globals.CompiledMethod);
  18011. $core.addMethod(
  18012. $core.method({
  18013. selector: "browse",
  18014. protocol: "browsing",
  18015. fn: function (){
  18016. var self=this,$self=this;
  18017. return $core.withContext(function($ctx1) {
  18018. $recv($globals.Finder)._findMethod_(self);
  18019. return self;
  18020. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18021. },
  18022. args: [],
  18023. source: "browse\x0a\x09Finder findMethod: self",
  18024. referencedClasses: ["Finder"],
  18025. messageSends: ["findMethod:"]
  18026. }),
  18027. $globals.CompiledMethod);
  18028. $core.addMethod(
  18029. $core.method({
  18030. selector: "category",
  18031. protocol: "accessing",
  18032. fn: function (){
  18033. var self=this,$self=this;
  18034. return $core.withContext(function($ctx1) {
  18035. return $self._protocol();
  18036. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18037. },
  18038. args: [],
  18039. source: "category\x0a\x09^ self protocol",
  18040. referencedClasses: [],
  18041. messageSends: ["protocol"]
  18042. }),
  18043. $globals.CompiledMethod);
  18044. $core.addMethod(
  18045. $core.method({
  18046. selector: "defaultProtocol",
  18047. protocol: "defaults",
  18048. fn: function (){
  18049. var self=this,$self=this;
  18050. return "as yet unclassified";
  18051. },
  18052. args: [],
  18053. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18054. referencedClasses: [],
  18055. messageSends: []
  18056. }),
  18057. $globals.CompiledMethod);
  18058. $core.addMethod(
  18059. $core.method({
  18060. selector: "fn",
  18061. protocol: "accessing",
  18062. fn: function (){
  18063. var self=this,$self=this;
  18064. return $core.withContext(function($ctx1) {
  18065. return $self._basicAt_("fn");
  18066. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18067. },
  18068. args: [],
  18069. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18070. referencedClasses: [],
  18071. messageSends: ["basicAt:"]
  18072. }),
  18073. $globals.CompiledMethod);
  18074. $core.addMethod(
  18075. $core.method({
  18076. selector: "fn:",
  18077. protocol: "accessing",
  18078. fn: function (aBlock){
  18079. var self=this,$self=this;
  18080. return $core.withContext(function($ctx1) {
  18081. $self._basicAt_put_("fn",aBlock);
  18082. return self;
  18083. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18084. },
  18085. args: ["aBlock"],
  18086. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18087. referencedClasses: [],
  18088. messageSends: ["basicAt:put:"]
  18089. }),
  18090. $globals.CompiledMethod);
  18091. $core.addMethod(
  18092. $core.method({
  18093. selector: "isCompiledMethod",
  18094. protocol: "testing",
  18095. fn: function (){
  18096. var self=this,$self=this;
  18097. return true;
  18098. },
  18099. args: [],
  18100. source: "isCompiledMethod\x0a\x09^ true",
  18101. referencedClasses: [],
  18102. messageSends: []
  18103. }),
  18104. $globals.CompiledMethod);
  18105. $core.addMethod(
  18106. $core.method({
  18107. selector: "isOverridden",
  18108. protocol: "testing",
  18109. fn: function (){
  18110. var self=this,$self=this;
  18111. var selector;
  18112. return $core.withContext(function($ctx1) {
  18113. var $1;
  18114. var $early={};
  18115. try {
  18116. selector=$self._selector();
  18117. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18118. return $core.withContext(function($ctx2) {
  18119. $1=$recv(each)._includesSelector_(selector);
  18120. if($core.assert($1)){
  18121. throw $early=[true];
  18122. }
  18123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18124. }));
  18125. return false;
  18126. }
  18127. catch(e) {if(e===$early)return e[0]; throw e}
  18128. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18129. },
  18130. args: [],
  18131. 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",
  18132. referencedClasses: [],
  18133. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18134. }),
  18135. $globals.CompiledMethod);
  18136. $core.addMethod(
  18137. $core.method({
  18138. selector: "isOverride",
  18139. protocol: "testing",
  18140. fn: function (){
  18141. var self=this,$self=this;
  18142. var superclass;
  18143. return $core.withContext(function($ctx1) {
  18144. var $1,$2,$receiver;
  18145. $1=$self._methodClass();
  18146. $ctx1.sendIdx["methodClass"]=1;
  18147. superclass=$recv($1)._superclass();
  18148. $ctx1.sendIdx["superclass"]=1;
  18149. $2=superclass;
  18150. if(($receiver = $2) == null || $receiver.a$nil){
  18151. return false;
  18152. } else {
  18153. $2;
  18154. }
  18155. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18156. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18157. },
  18158. args: [],
  18159. 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",
  18160. referencedClasses: [],
  18161. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18162. }),
  18163. $globals.CompiledMethod);
  18164. $core.addMethod(
  18165. $core.method({
  18166. selector: "messageSends",
  18167. protocol: "accessing",
  18168. fn: function (){
  18169. var self=this,$self=this;
  18170. return $core.withContext(function($ctx1) {
  18171. return $self._basicAt_("messageSends");
  18172. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18173. },
  18174. args: [],
  18175. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18176. referencedClasses: [],
  18177. messageSends: ["basicAt:"]
  18178. }),
  18179. $globals.CompiledMethod);
  18180. $core.addMethod(
  18181. $core.method({
  18182. selector: "methodClass",
  18183. protocol: "accessing",
  18184. fn: function (){
  18185. var self=this,$self=this;
  18186. return $core.withContext(function($ctx1) {
  18187. return $self._basicAt_("owner");
  18188. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18189. },
  18190. args: [],
  18191. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18192. referencedClasses: [],
  18193. messageSends: ["basicAt:"]
  18194. }),
  18195. $globals.CompiledMethod);
  18196. $core.addMethod(
  18197. $core.method({
  18198. selector: "package",
  18199. protocol: "accessing",
  18200. fn: function (){
  18201. var self=this,$self=this;
  18202. return $core.withContext(function($ctx1) {
  18203. var $1,$receiver;
  18204. $1=$self._methodClass();
  18205. if(($receiver = $1) == null || $receiver.a$nil){
  18206. return $1;
  18207. } else {
  18208. var class_;
  18209. class_=$receiver;
  18210. return $recv(class_)._packageOfProtocol_($self._protocol());
  18211. }
  18212. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18213. },
  18214. args: [],
  18215. 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 ]",
  18216. referencedClasses: [],
  18217. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18218. }),
  18219. $globals.CompiledMethod);
  18220. $core.addMethod(
  18221. $core.method({
  18222. selector: "protocol",
  18223. protocol: "accessing",
  18224. fn: function (){
  18225. var self=this,$self=this;
  18226. return $core.withContext(function($ctx1) {
  18227. var $1,$receiver;
  18228. $1=$self._basicAt_("protocol");
  18229. if(($receiver = $1) == null || $receiver.a$nil){
  18230. return $self._defaultProtocol();
  18231. } else {
  18232. return $1;
  18233. }
  18234. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18235. },
  18236. args: [],
  18237. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18238. referencedClasses: [],
  18239. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18240. }),
  18241. $globals.CompiledMethod);
  18242. $core.addMethod(
  18243. $core.method({
  18244. selector: "protocol:",
  18245. protocol: "accessing",
  18246. fn: function (aString){
  18247. var self=this,$self=this;
  18248. var oldProtocol;
  18249. return $core.withContext(function($ctx1) {
  18250. var $1,$3,$2,$4,$receiver;
  18251. oldProtocol=$self._protocol();
  18252. $self._basicAt_put_("protocol",aString);
  18253. $1=$recv($globals.SystemAnnouncer)._current();
  18254. $3=$recv($globals.MethodMoved)._new();
  18255. $recv($3)._method_(self);
  18256. $recv($3)._oldProtocol_(oldProtocol);
  18257. $2=$recv($3)._yourself();
  18258. $recv($1)._announce_($2);
  18259. $4=$self._methodClass();
  18260. if(($receiver = $4) == null || $receiver.a$nil){
  18261. $4;
  18262. } else {
  18263. var methodClass;
  18264. methodClass=$receiver;
  18265. $recv($recv(methodClass)._organization())._addElement_(aString);
  18266. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18267. }
  18268. return self;
  18269. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18270. },
  18271. args: ["aString"],
  18272. 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 ]",
  18273. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18274. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18275. }),
  18276. $globals.CompiledMethod);
  18277. $core.addMethod(
  18278. $core.method({
  18279. selector: "referencedClasses",
  18280. protocol: "accessing",
  18281. fn: function (){
  18282. var self=this,$self=this;
  18283. return $core.withContext(function($ctx1) {
  18284. return $self._basicAt_("referencedClasses");
  18285. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18286. },
  18287. args: [],
  18288. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18289. referencedClasses: [],
  18290. messageSends: ["basicAt:"]
  18291. }),
  18292. $globals.CompiledMethod);
  18293. $core.addMethod(
  18294. $core.method({
  18295. selector: "selector",
  18296. protocol: "accessing",
  18297. fn: function (){
  18298. var self=this,$self=this;
  18299. return $core.withContext(function($ctx1) {
  18300. return $self._basicAt_("selector");
  18301. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18302. },
  18303. args: [],
  18304. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18305. referencedClasses: [],
  18306. messageSends: ["basicAt:"]
  18307. }),
  18308. $globals.CompiledMethod);
  18309. $core.addMethod(
  18310. $core.method({
  18311. selector: "selector:",
  18312. protocol: "accessing",
  18313. fn: function (aString){
  18314. var self=this,$self=this;
  18315. return $core.withContext(function($ctx1) {
  18316. $self._basicAt_put_("selector",aString);
  18317. return self;
  18318. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18319. },
  18320. args: ["aString"],
  18321. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18322. referencedClasses: [],
  18323. messageSends: ["basicAt:put:"]
  18324. }),
  18325. $globals.CompiledMethod);
  18326. $core.addMethod(
  18327. $core.method({
  18328. selector: "sendTo:arguments:",
  18329. protocol: "evaluating",
  18330. fn: function (anObject,aCollection){
  18331. var self=this,$self=this;
  18332. return $core.withContext(function($ctx1) {
  18333. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18334. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18335. },
  18336. args: ["anObject", "aCollection"],
  18337. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18338. referencedClasses: [],
  18339. messageSends: ["applyTo:arguments:", "fn"]
  18340. }),
  18341. $globals.CompiledMethod);
  18342. $core.addMethod(
  18343. $core.method({
  18344. selector: "source",
  18345. protocol: "accessing",
  18346. fn: function (){
  18347. var self=this,$self=this;
  18348. return $core.withContext(function($ctx1) {
  18349. var $1,$receiver;
  18350. $1=$self._basicAt_("source");
  18351. if(($receiver = $1) == null || $receiver.a$nil){
  18352. return "";
  18353. } else {
  18354. return $1;
  18355. }
  18356. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18357. },
  18358. args: [],
  18359. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18360. referencedClasses: [],
  18361. messageSends: ["ifNil:", "basicAt:"]
  18362. }),
  18363. $globals.CompiledMethod);
  18364. $core.addMethod(
  18365. $core.method({
  18366. selector: "source:",
  18367. protocol: "accessing",
  18368. fn: function (aString){
  18369. var self=this,$self=this;
  18370. return $core.withContext(function($ctx1) {
  18371. $self._basicAt_put_("source",aString);
  18372. return self;
  18373. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18374. },
  18375. args: ["aString"],
  18376. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18377. referencedClasses: [],
  18378. messageSends: ["basicAt:put:"]
  18379. }),
  18380. $globals.CompiledMethod);
  18381. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18382. $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`";
  18383. $core.addMethod(
  18384. $core.method({
  18385. selector: "addWorker",
  18386. protocol: "private",
  18387. fn: function (){
  18388. var self=this,$self=this;
  18389. return $core.withContext(function($ctx1) {
  18390. $recv($self["@worker"])._valueWithTimeout_((0));
  18391. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18392. return self;
  18393. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18394. },
  18395. args: [],
  18396. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18397. referencedClasses: [],
  18398. messageSends: ["valueWithTimeout:", "+"]
  18399. }),
  18400. $globals.ForkPool);
  18401. $core.addMethod(
  18402. $core.method({
  18403. selector: "defaultMaxPoolSize",
  18404. protocol: "defaults",
  18405. fn: function (){
  18406. var self=this,$self=this;
  18407. return $core.withContext(function($ctx1) {
  18408. return $recv($self._class())._defaultMaxPoolSize();
  18409. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18410. },
  18411. args: [],
  18412. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18413. referencedClasses: [],
  18414. messageSends: ["defaultMaxPoolSize", "class"]
  18415. }),
  18416. $globals.ForkPool);
  18417. $core.addMethod(
  18418. $core.method({
  18419. selector: "fork:",
  18420. protocol: "actions",
  18421. fn: function (aBlock){
  18422. var self=this,$self=this;
  18423. return $core.withContext(function($ctx1) {
  18424. var $1;
  18425. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18426. if($core.assert($1)){
  18427. $self._addWorker();
  18428. }
  18429. $recv($self["@queue"])._nextPut_(aBlock);
  18430. return self;
  18431. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18432. },
  18433. args: ["aBlock"],
  18434. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18435. referencedClasses: [],
  18436. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18437. }),
  18438. $globals.ForkPool);
  18439. $core.addMethod(
  18440. $core.method({
  18441. selector: "initialize",
  18442. protocol: "initialization",
  18443. fn: function (){
  18444. var self=this,$self=this;
  18445. return $core.withContext(function($ctx1) {
  18446. (
  18447. $ctx1.supercall = true,
  18448. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18449. $ctx1.supercall = false;
  18450. $self["@poolSize"]=(0);
  18451. $self["@queue"]=$recv($globals.Queue)._new();
  18452. $self["@worker"]=$self._makeWorker();
  18453. return self;
  18454. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18455. },
  18456. args: [],
  18457. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18458. referencedClasses: ["Queue"],
  18459. messageSends: ["initialize", "new", "makeWorker"]
  18460. }),
  18461. $globals.ForkPool);
  18462. $core.addMethod(
  18463. $core.method({
  18464. selector: "makeWorker",
  18465. protocol: "initialization",
  18466. fn: function (){
  18467. var self=this,$self=this;
  18468. var sentinel;
  18469. return $core.withContext(function($ctx1) {
  18470. var $1;
  18471. sentinel=$recv($globals.Object)._new();
  18472. return (function(){
  18473. var block;
  18474. return $core.withContext(function($ctx2) {
  18475. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18476. $self["@poolSize"];
  18477. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18478. return sentinel;
  18479. }));
  18480. block;
  18481. $1=$recv(block).__eq_eq(sentinel);
  18482. if(!$core.assert($1)){
  18483. return $recv((function(){
  18484. return $core.withContext(function($ctx3) {
  18485. return $recv(block)._value();
  18486. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18487. }))._ensure_((function(){
  18488. return $core.withContext(function($ctx3) {
  18489. return $self._addWorker();
  18490. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18491. }));
  18492. }
  18493. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18494. });
  18495. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18496. },
  18497. args: [],
  18498. 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 ] ]]",
  18499. referencedClasses: ["Object"],
  18500. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18501. }),
  18502. $globals.ForkPool);
  18503. $core.addMethod(
  18504. $core.method({
  18505. selector: "maxPoolSize",
  18506. protocol: "accessing",
  18507. fn: function (){
  18508. var self=this,$self=this;
  18509. return $core.withContext(function($ctx1) {
  18510. var $1,$receiver;
  18511. $1=$self["@maxPoolSize"];
  18512. if(($receiver = $1) == null || $receiver.a$nil){
  18513. return $self._defaultMaxPoolSize();
  18514. } else {
  18515. return $1;
  18516. }
  18517. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18518. },
  18519. args: [],
  18520. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18521. referencedClasses: [],
  18522. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18523. }),
  18524. $globals.ForkPool);
  18525. $core.addMethod(
  18526. $core.method({
  18527. selector: "maxPoolSize:",
  18528. protocol: "accessing",
  18529. fn: function (anInteger){
  18530. var self=this,$self=this;
  18531. $self["@maxPoolSize"]=anInteger;
  18532. return self;
  18533. },
  18534. args: ["anInteger"],
  18535. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18536. referencedClasses: [],
  18537. messageSends: []
  18538. }),
  18539. $globals.ForkPool);
  18540. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18541. $core.addMethod(
  18542. $core.method({
  18543. selector: "default",
  18544. protocol: "accessing",
  18545. fn: function (){
  18546. var self=this,$self=this;
  18547. return $core.withContext(function($ctx1) {
  18548. var $1,$receiver;
  18549. $1=$self["@default"];
  18550. if(($receiver = $1) == null || $receiver.a$nil){
  18551. $self["@default"]=$self._new();
  18552. return $self["@default"];
  18553. } else {
  18554. return $1;
  18555. }
  18556. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18557. },
  18558. args: [],
  18559. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18560. referencedClasses: [],
  18561. messageSends: ["ifNil:", "new"]
  18562. }),
  18563. $globals.ForkPool.a$cls);
  18564. $core.addMethod(
  18565. $core.method({
  18566. selector: "defaultMaxPoolSize",
  18567. protocol: "accessing",
  18568. fn: function (){
  18569. var self=this,$self=this;
  18570. return (100);
  18571. },
  18572. args: [],
  18573. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18574. referencedClasses: [],
  18575. messageSends: []
  18576. }),
  18577. $globals.ForkPool.a$cls);
  18578. $core.addMethod(
  18579. $core.method({
  18580. selector: "resetDefault",
  18581. protocol: "accessing",
  18582. fn: function (){
  18583. var self=this,$self=this;
  18584. $self["@default"]=nil;
  18585. return self;
  18586. },
  18587. args: [],
  18588. source: "resetDefault\x0a\x09default := nil",
  18589. referencedClasses: [],
  18590. messageSends: []
  18591. }),
  18592. $globals.ForkPool.a$cls);
  18593. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18594. $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.";
  18595. $core.addMethod(
  18596. $core.method({
  18597. selector: "arguments",
  18598. protocol: "accessing",
  18599. fn: function (){
  18600. var self=this,$self=this;
  18601. return $self["@arguments"];
  18602. },
  18603. args: [],
  18604. source: "arguments\x0a\x09^ arguments",
  18605. referencedClasses: [],
  18606. messageSends: []
  18607. }),
  18608. $globals.Message);
  18609. $core.addMethod(
  18610. $core.method({
  18611. selector: "arguments:",
  18612. protocol: "accessing",
  18613. fn: function (anArray){
  18614. var self=this,$self=this;
  18615. $self["@arguments"]=anArray;
  18616. return self;
  18617. },
  18618. args: ["anArray"],
  18619. source: "arguments: anArray\x0a\x09arguments := anArray",
  18620. referencedClasses: [],
  18621. messageSends: []
  18622. }),
  18623. $globals.Message);
  18624. $core.addMethod(
  18625. $core.method({
  18626. selector: "printOn:",
  18627. protocol: "printing",
  18628. fn: function (aStream){
  18629. var self=this,$self=this;
  18630. return $core.withContext(function($ctx1) {
  18631. (
  18632. $ctx1.supercall = true,
  18633. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18634. $ctx1.supercall = false;
  18635. $recv(aStream)._nextPutAll_("(");
  18636. $ctx1.sendIdx["nextPutAll:"]=1;
  18637. $recv(aStream)._nextPutAll_($self._selector());
  18638. $ctx1.sendIdx["nextPutAll:"]=2;
  18639. $recv(aStream)._nextPutAll_(")");
  18640. return self;
  18641. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18642. },
  18643. args: ["aStream"],
  18644. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18645. referencedClasses: [],
  18646. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18647. }),
  18648. $globals.Message);
  18649. $core.addMethod(
  18650. $core.method({
  18651. selector: "selector",
  18652. protocol: "accessing",
  18653. fn: function (){
  18654. var self=this,$self=this;
  18655. return $self["@selector"];
  18656. },
  18657. args: [],
  18658. source: "selector\x0a\x09^ selector",
  18659. referencedClasses: [],
  18660. messageSends: []
  18661. }),
  18662. $globals.Message);
  18663. $core.addMethod(
  18664. $core.method({
  18665. selector: "selector:",
  18666. protocol: "accessing",
  18667. fn: function (aString){
  18668. var self=this,$self=this;
  18669. $self["@selector"]=aString;
  18670. return self;
  18671. },
  18672. args: ["aString"],
  18673. source: "selector: aString\x0a\x09selector := aString",
  18674. referencedClasses: [],
  18675. messageSends: []
  18676. }),
  18677. $globals.Message);
  18678. $core.addMethod(
  18679. $core.method({
  18680. selector: "sendTo:",
  18681. protocol: "actions",
  18682. fn: function (anObject){
  18683. var self=this,$self=this;
  18684. return $core.withContext(function($ctx1) {
  18685. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18686. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18687. },
  18688. args: ["anObject"],
  18689. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18690. referencedClasses: [],
  18691. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18692. }),
  18693. $globals.Message);
  18694. $core.addMethod(
  18695. $core.method({
  18696. selector: "selector:arguments:",
  18697. protocol: "instance creation",
  18698. fn: function (aString,anArray){
  18699. var self=this,$self=this;
  18700. return $core.withContext(function($ctx1) {
  18701. var $1;
  18702. $1=$self._new();
  18703. $recv($1)._selector_(aString);
  18704. $recv($1)._arguments_(anArray);
  18705. return $recv($1)._yourself();
  18706. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18707. },
  18708. args: ["aString", "anArray"],
  18709. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18710. referencedClasses: [],
  18711. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18712. }),
  18713. $globals.Message.a$cls);
  18714. $core.addMethod(
  18715. $core.method({
  18716. selector: "selector:arguments:notUnderstoodBy:",
  18717. protocol: "dnu handling",
  18718. fn: function (aString,anArray,anObject){
  18719. var self=this,$self=this;
  18720. return $core.withContext(function($ctx1) {
  18721. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18722. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18723. },
  18724. args: ["aString", "anArray", "anObject"],
  18725. 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)",
  18726. referencedClasses: [],
  18727. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18728. }),
  18729. $globals.Message.a$cls);
  18730. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18731. $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.";
  18732. $core.addMethod(
  18733. $core.method({
  18734. selector: "arguments",
  18735. protocol: "accessing",
  18736. fn: function (){
  18737. var self=this,$self=this;
  18738. return $core.withContext(function($ctx1) {
  18739. return $recv($self["@message"])._arguments();
  18740. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18741. },
  18742. args: [],
  18743. source: "arguments\x0a\x09^ message arguments",
  18744. referencedClasses: [],
  18745. messageSends: ["arguments"]
  18746. }),
  18747. $globals.MessageSend);
  18748. $core.addMethod(
  18749. $core.method({
  18750. selector: "arguments:",
  18751. protocol: "accessing",
  18752. fn: function (aCollection){
  18753. var self=this,$self=this;
  18754. return $core.withContext(function($ctx1) {
  18755. $recv($self["@message"])._arguments_(aCollection);
  18756. return self;
  18757. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18758. },
  18759. args: ["aCollection"],
  18760. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18761. referencedClasses: [],
  18762. messageSends: ["arguments:"]
  18763. }),
  18764. $globals.MessageSend);
  18765. $core.addMethod(
  18766. $core.method({
  18767. selector: "initialize",
  18768. protocol: "initialization",
  18769. fn: function (){
  18770. var self=this,$self=this;
  18771. return $core.withContext(function($ctx1) {
  18772. (
  18773. $ctx1.supercall = true,
  18774. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18775. $ctx1.supercall = false;
  18776. $self["@message"]=$recv($globals.Message)._new();
  18777. return self;
  18778. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18779. },
  18780. args: [],
  18781. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18782. referencedClasses: ["Message"],
  18783. messageSends: ["initialize", "new"]
  18784. }),
  18785. $globals.MessageSend);
  18786. $core.addMethod(
  18787. $core.method({
  18788. selector: "printOn:",
  18789. protocol: "printing",
  18790. fn: function (aStream){
  18791. var self=this,$self=this;
  18792. return $core.withContext(function($ctx1) {
  18793. (
  18794. $ctx1.supercall = true,
  18795. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18796. $ctx1.supercall = false;
  18797. $recv(aStream)._nextPutAll_("(");
  18798. $ctx1.sendIdx["nextPutAll:"]=1;
  18799. $recv(aStream)._nextPutAll_($self._receiver());
  18800. $ctx1.sendIdx["nextPutAll:"]=2;
  18801. $recv(aStream)._nextPutAll_(" >> ");
  18802. $ctx1.sendIdx["nextPutAll:"]=3;
  18803. $recv(aStream)._nextPutAll_($self._selector());
  18804. $ctx1.sendIdx["nextPutAll:"]=4;
  18805. $recv(aStream)._nextPutAll_(")");
  18806. return self;
  18807. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18808. },
  18809. args: ["aStream"],
  18810. 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: ')'",
  18811. referencedClasses: [],
  18812. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18813. }),
  18814. $globals.MessageSend);
  18815. $core.addMethod(
  18816. $core.method({
  18817. selector: "receiver",
  18818. protocol: "accessing",
  18819. fn: function (){
  18820. var self=this,$self=this;
  18821. return $self["@receiver"];
  18822. },
  18823. args: [],
  18824. source: "receiver\x0a\x09^ receiver",
  18825. referencedClasses: [],
  18826. messageSends: []
  18827. }),
  18828. $globals.MessageSend);
  18829. $core.addMethod(
  18830. $core.method({
  18831. selector: "receiver:",
  18832. protocol: "accessing",
  18833. fn: function (anObject){
  18834. var self=this,$self=this;
  18835. $self["@receiver"]=anObject;
  18836. return self;
  18837. },
  18838. args: ["anObject"],
  18839. source: "receiver: anObject\x0a\x09receiver := anObject",
  18840. referencedClasses: [],
  18841. messageSends: []
  18842. }),
  18843. $globals.MessageSend);
  18844. $core.addMethod(
  18845. $core.method({
  18846. selector: "selector",
  18847. protocol: "accessing",
  18848. fn: function (){
  18849. var self=this,$self=this;
  18850. return $core.withContext(function($ctx1) {
  18851. return $recv($self["@message"])._selector();
  18852. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18853. },
  18854. args: [],
  18855. source: "selector\x0a\x09^ message selector",
  18856. referencedClasses: [],
  18857. messageSends: ["selector"]
  18858. }),
  18859. $globals.MessageSend);
  18860. $core.addMethod(
  18861. $core.method({
  18862. selector: "selector:",
  18863. protocol: "accessing",
  18864. fn: function (aString){
  18865. var self=this,$self=this;
  18866. return $core.withContext(function($ctx1) {
  18867. $recv($self["@message"])._selector_(aString);
  18868. return self;
  18869. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18870. },
  18871. args: ["aString"],
  18872. source: "selector: aString\x0a\x09message selector: aString",
  18873. referencedClasses: [],
  18874. messageSends: ["selector:"]
  18875. }),
  18876. $globals.MessageSend);
  18877. $core.addMethod(
  18878. $core.method({
  18879. selector: "value",
  18880. protocol: "evaluating",
  18881. fn: function (){
  18882. var self=this,$self=this;
  18883. return $core.withContext(function($ctx1) {
  18884. return $recv($self["@message"])._sendTo_($self._receiver());
  18885. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18886. },
  18887. args: [],
  18888. source: "value\x0a\x09^ message sendTo: self receiver",
  18889. referencedClasses: [],
  18890. messageSends: ["sendTo:", "receiver"]
  18891. }),
  18892. $globals.MessageSend);
  18893. $core.addMethod(
  18894. $core.method({
  18895. selector: "value:",
  18896. protocol: "evaluating",
  18897. fn: function (anObject){
  18898. var self=this,$self=this;
  18899. return $core.withContext(function($ctx1) {
  18900. var $1;
  18901. $1=$self["@message"];
  18902. $recv($1)._arguments_([anObject]);
  18903. return $recv($1)._sendTo_($self._receiver());
  18904. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18905. },
  18906. args: ["anObject"],
  18907. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18908. referencedClasses: [],
  18909. messageSends: ["arguments:", "sendTo:", "receiver"]
  18910. }),
  18911. $globals.MessageSend);
  18912. $core.addMethod(
  18913. $core.method({
  18914. selector: "value:value:",
  18915. protocol: "evaluating",
  18916. fn: function (firstArgument,secondArgument){
  18917. var self=this,$self=this;
  18918. return $core.withContext(function($ctx1) {
  18919. var $1;
  18920. $1=$self["@message"];
  18921. $recv($1)._arguments_([firstArgument,secondArgument]);
  18922. return $recv($1)._sendTo_($self._receiver());
  18923. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18924. },
  18925. args: ["firstArgument", "secondArgument"],
  18926. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18927. referencedClasses: [],
  18928. messageSends: ["arguments:", "sendTo:", "receiver"]
  18929. }),
  18930. $globals.MessageSend);
  18931. $core.addMethod(
  18932. $core.method({
  18933. selector: "value:value:value:",
  18934. protocol: "evaluating",
  18935. fn: function (firstArgument,secondArgument,thirdArgument){
  18936. var self=this,$self=this;
  18937. return $core.withContext(function($ctx1) {
  18938. var $1;
  18939. $1=$self["@message"];
  18940. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18941. return $recv($1)._sendTo_($self._receiver());
  18942. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18943. },
  18944. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18945. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18946. referencedClasses: [],
  18947. messageSends: ["arguments:", "sendTo:", "receiver"]
  18948. }),
  18949. $globals.MessageSend);
  18950. $core.addMethod(
  18951. $core.method({
  18952. selector: "valueWithPossibleArguments:",
  18953. protocol: "evaluating",
  18954. fn: function (aCollection){
  18955. var self=this,$self=this;
  18956. return $core.withContext(function($ctx1) {
  18957. $self._arguments_(aCollection);
  18958. return $self._value();
  18959. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18960. },
  18961. args: ["aCollection"],
  18962. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18963. referencedClasses: [],
  18964. messageSends: ["arguments:", "value"]
  18965. }),
  18966. $globals.MessageSend);
  18967. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18968. $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`.";
  18969. $core.addMethod(
  18970. $core.method({
  18971. selector: "asString",
  18972. protocol: "converting",
  18973. fn: function (){
  18974. var self=this,$self=this;
  18975. return $core.withContext(function($ctx1) {
  18976. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18977. $2=$self._isBlockContext();
  18978. if($core.assert($2)){
  18979. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  18980. $ctx1.sendIdx[","]=2;
  18981. $1=$recv($3).__comma(")");
  18982. $ctx1.sendIdx[","]=1;
  18983. } else {
  18984. var methodClass;
  18985. methodClass=$recv($self._method())._methodClass();
  18986. methodClass;
  18987. $5=methodClass;
  18988. $7=$self._receiver();
  18989. $ctx1.sendIdx["receiver"]=1;
  18990. $6=$recv($7)._class();
  18991. $ctx1.sendIdx["class"]=1;
  18992. $4=$recv($5).__eq($6);
  18993. if($core.assert($4)){
  18994. $11=$self._receiver();
  18995. $ctx1.sendIdx["receiver"]=2;
  18996. $10=$recv($11)._class();
  18997. $ctx1.sendIdx["class"]=2;
  18998. $9=$recv($10)._name();
  18999. $ctx1.sendIdx["name"]=1;
  19000. $8=$recv($9).__comma(" >> ");
  19001. $ctx1.sendIdx[","]=4;
  19002. $12=$self._selector();
  19003. $ctx1.sendIdx["selector"]=1;
  19004. $1=$recv($8).__comma($12);
  19005. $ctx1.sendIdx[","]=3;
  19006. } else {
  19007. $16=$recv($recv($self._receiver())._class())._name();
  19008. $ctx1.sendIdx["name"]=2;
  19009. $15=$recv($16).__comma("(");
  19010. $14=$recv($15).__comma($recv(methodClass)._name());
  19011. $ctx1.sendIdx[","]=7;
  19012. $13=$recv($14).__comma(") >> ");
  19013. $ctx1.sendIdx[","]=6;
  19014. $1=$recv($13).__comma($self._selector());
  19015. $ctx1.sendIdx[","]=5;
  19016. }
  19017. }
  19018. return $1;
  19019. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  19020. },
  19021. args: [],
  19022. 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 ] ]",
  19023. referencedClasses: [],
  19024. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19025. }),
  19026. $globals.MethodContext);
  19027. $core.addMethod(
  19028. $core.method({
  19029. selector: "basicReceiver",
  19030. protocol: "accessing",
  19031. fn: function (){
  19032. var self=this,$self=this;
  19033. return $core.withContext(function($ctx1) {
  19034. return self.receiver;
  19035. return self;
  19036. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  19037. },
  19038. args: [],
  19039. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  19040. referencedClasses: [],
  19041. messageSends: []
  19042. }),
  19043. $globals.MethodContext);
  19044. $core.addMethod(
  19045. $core.method({
  19046. selector: "evaluatedSelector",
  19047. protocol: "accessing",
  19048. fn: function (){
  19049. var self=this,$self=this;
  19050. return $core.withContext(function($ctx1) {
  19051. return self.evaluatedSelector;
  19052. return self;
  19053. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  19054. },
  19055. args: [],
  19056. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  19057. referencedClasses: [],
  19058. messageSends: []
  19059. }),
  19060. $globals.MethodContext);
  19061. $core.addMethod(
  19062. $core.method({
  19063. selector: "findContextSuchThat:",
  19064. protocol: "accessing",
  19065. fn: function (testBlock){
  19066. var self=this,$self=this;
  19067. var context;
  19068. return $core.withContext(function($ctx1) {
  19069. var $1;
  19070. var $early={};
  19071. try {
  19072. context=self;
  19073. $recv((function(){
  19074. return $core.withContext(function($ctx2) {
  19075. return $recv(context)._isNil();
  19076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19077. }))._whileFalse_((function(){
  19078. return $core.withContext(function($ctx2) {
  19079. $1=$recv(testBlock)._value_(context);
  19080. if($core.assert($1)){
  19081. throw $early=[context];
  19082. }
  19083. context=$recv(context)._outerContext();
  19084. return context;
  19085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19086. }));
  19087. return nil;
  19088. }
  19089. catch(e) {if(e===$early)return e[0]; throw e}
  19090. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19091. },
  19092. args: ["testBlock"],
  19093. 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",
  19094. referencedClasses: [],
  19095. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19096. }),
  19097. $globals.MethodContext);
  19098. $core.addMethod(
  19099. $core.method({
  19100. selector: "home",
  19101. protocol: "accessing",
  19102. fn: function (){
  19103. var self=this,$self=this;
  19104. return $core.withContext(function($ctx1) {
  19105. return self.homeContext;
  19106. return self;
  19107. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19108. },
  19109. args: [],
  19110. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19111. referencedClasses: [],
  19112. messageSends: []
  19113. }),
  19114. $globals.MethodContext);
  19115. $core.addMethod(
  19116. $core.method({
  19117. selector: "index",
  19118. protocol: "accessing",
  19119. fn: function (){
  19120. var self=this,$self=this;
  19121. return $core.withContext(function($ctx1) {
  19122. return self.index || 0;
  19123. return self;
  19124. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19125. },
  19126. args: [],
  19127. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19128. referencedClasses: [],
  19129. messageSends: []
  19130. }),
  19131. $globals.MethodContext);
  19132. $core.addMethod(
  19133. $core.method({
  19134. selector: "isBlockContext",
  19135. protocol: "testing",
  19136. fn: function (){
  19137. var self=this,$self=this;
  19138. return $core.withContext(function($ctx1) {
  19139. return $recv($self._selector())._isNil();
  19140. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19141. },
  19142. args: [],
  19143. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19144. referencedClasses: [],
  19145. messageSends: ["isNil", "selector"]
  19146. }),
  19147. $globals.MethodContext);
  19148. $core.addMethod(
  19149. $core.method({
  19150. selector: "locals",
  19151. protocol: "accessing",
  19152. fn: function (){
  19153. var self=this,$self=this;
  19154. return $core.withContext(function($ctx1) {
  19155. return self.locals || {};
  19156. return self;
  19157. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19158. },
  19159. args: [],
  19160. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19161. referencedClasses: [],
  19162. messageSends: []
  19163. }),
  19164. $globals.MethodContext);
  19165. $core.addMethod(
  19166. $core.method({
  19167. selector: "method",
  19168. protocol: "accessing",
  19169. fn: function (){
  19170. var self=this,$self=this;
  19171. var method,lookupClass,receiverClass,supercall;
  19172. return $core.withContext(function($ctx1) {
  19173. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19174. $1=$self._methodContext();
  19175. $ctx1.sendIdx["methodContext"]=1;
  19176. if(($receiver = $1) == null || $receiver.a$nil){
  19177. return nil;
  19178. } else {
  19179. $1;
  19180. }
  19181. $3=$self._methodContext();
  19182. $ctx1.sendIdx["methodContext"]=2;
  19183. $2=$recv($3)._receiver();
  19184. receiverClass=$recv($2)._class();
  19185. $4=receiverClass;
  19186. $6=$self._methodContext();
  19187. $ctx1.sendIdx["methodContext"]=3;
  19188. $5=$recv($6)._selector();
  19189. $ctx1.sendIdx["selector"]=1;
  19190. method=$recv($4)._lookupSelector_($5);
  19191. $ctx1.sendIdx["lookupSelector:"]=1;
  19192. $7=$self._outerContext();
  19193. if(($receiver = $7) == null || $receiver.a$nil){
  19194. supercall=false;
  19195. } else {
  19196. var outer;
  19197. outer=$receiver;
  19198. supercall=$recv(outer)._supercall();
  19199. }
  19200. $8=supercall;
  19201. if($core.assert($8)){
  19202. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19203. } else {
  19204. return method;
  19205. }
  19206. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19207. },
  19208. args: [],
  19209. 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 ]",
  19210. referencedClasses: [],
  19211. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19212. }),
  19213. $globals.MethodContext);
  19214. $core.addMethod(
  19215. $core.method({
  19216. selector: "methodContext",
  19217. protocol: "accessing",
  19218. fn: function (){
  19219. var self=this,$self=this;
  19220. return $core.withContext(function($ctx1) {
  19221. var $1,$2,$receiver;
  19222. $1=$self._isBlockContext();
  19223. if(!$core.assert($1)){
  19224. return self;
  19225. }
  19226. $2=$self._outerContext();
  19227. if(($receiver = $2) == null || $receiver.a$nil){
  19228. return $2;
  19229. } else {
  19230. var outer;
  19231. outer=$receiver;
  19232. return $recv(outer)._methodContext();
  19233. }
  19234. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19235. },
  19236. args: [],
  19237. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19238. referencedClasses: [],
  19239. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19240. }),
  19241. $globals.MethodContext);
  19242. $core.addMethod(
  19243. $core.method({
  19244. selector: "outerContext",
  19245. protocol: "accessing",
  19246. fn: function (){
  19247. var self=this,$self=this;
  19248. return $core.withContext(function($ctx1) {
  19249. return self.outerContext || self.homeContext;
  19250. return self;
  19251. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19252. },
  19253. args: [],
  19254. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19255. referencedClasses: [],
  19256. messageSends: []
  19257. }),
  19258. $globals.MethodContext);
  19259. $core.addMethod(
  19260. $core.method({
  19261. selector: "printOn:",
  19262. protocol: "printing",
  19263. fn: function (aStream){
  19264. var self=this,$self=this;
  19265. return $core.withContext(function($ctx1) {
  19266. (
  19267. $ctx1.supercall = true,
  19268. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19269. $ctx1.supercall = false;
  19270. $recv(aStream)._nextPutAll_("(");
  19271. $ctx1.sendIdx["nextPutAll:"]=1;
  19272. $recv(aStream)._nextPutAll_($self._asString());
  19273. $ctx1.sendIdx["nextPutAll:"]=2;
  19274. $recv(aStream)._nextPutAll_(")");
  19275. return self;
  19276. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19277. },
  19278. args: ["aStream"],
  19279. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19280. referencedClasses: [],
  19281. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19282. }),
  19283. $globals.MethodContext);
  19284. $core.addMethod(
  19285. $core.method({
  19286. selector: "receiver",
  19287. protocol: "accessing",
  19288. fn: function (){
  19289. var self=this,$self=this;
  19290. return $core.withContext(function($ctx1) {
  19291. var $2,$1;
  19292. $1=$recv($self._isBlockContext())._and_((function(){
  19293. return $core.withContext(function($ctx2) {
  19294. $2=$self._outerContext();
  19295. $ctx2.sendIdx["outerContext"]=1;
  19296. return $recv($2)._notNil();
  19297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19298. }));
  19299. if($core.assert($1)){
  19300. return $recv($self._outerContext())._receiver();
  19301. } else {
  19302. return $self._basicReceiver();
  19303. }
  19304. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19305. },
  19306. args: [],
  19307. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19308. referencedClasses: [],
  19309. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19310. }),
  19311. $globals.MethodContext);
  19312. $core.addMethod(
  19313. $core.method({
  19314. selector: "selector",
  19315. protocol: "accessing",
  19316. fn: function (){
  19317. var self=this,$self=this;
  19318. return $core.withContext(function($ctx1) {
  19319. if(self.selector) {
  19320. return $core.js2st(self.selector);
  19321. } else {
  19322. return nil;
  19323. }
  19324. ;
  19325. return self;
  19326. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19327. },
  19328. args: [],
  19329. 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'>",
  19330. referencedClasses: [],
  19331. messageSends: []
  19332. }),
  19333. $globals.MethodContext);
  19334. $core.addMethod(
  19335. $core.method({
  19336. selector: "sendIndexAt:",
  19337. protocol: "accessing",
  19338. fn: function (aSelector){
  19339. var self=this,$self=this;
  19340. return $core.withContext(function($ctx1) {
  19341. return self.sendIdx[aSelector] || 0;
  19342. return self;
  19343. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19344. },
  19345. args: ["aSelector"],
  19346. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19347. referencedClasses: [],
  19348. messageSends: []
  19349. }),
  19350. $globals.MethodContext);
  19351. $core.addMethod(
  19352. $core.method({
  19353. selector: "sendIndexes",
  19354. protocol: "accessing",
  19355. fn: function (){
  19356. var self=this,$self=this;
  19357. return $core.withContext(function($ctx1) {
  19358. return self.sendIdx;
  19359. return self;
  19360. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19361. },
  19362. args: [],
  19363. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19364. referencedClasses: [],
  19365. messageSends: []
  19366. }),
  19367. $globals.MethodContext);
  19368. $core.addMethod(
  19369. $core.method({
  19370. selector: "stubHere",
  19371. protocol: "accessing",
  19372. fn: function (){
  19373. var self=this,$self=this;
  19374. return $core.withContext(function($ctx1) {
  19375. self.homeContext = undefined;
  19376. return self;
  19377. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19378. },
  19379. args: [],
  19380. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19381. referencedClasses: [],
  19382. messageSends: []
  19383. }),
  19384. $globals.MethodContext);
  19385. $core.addMethod(
  19386. $core.method({
  19387. selector: "stubToAtMost:",
  19388. protocol: "error handling",
  19389. fn: function (anInteger){
  19390. var self=this,$self=this;
  19391. var context;
  19392. return $core.withContext(function($ctx1) {
  19393. var $1,$2,$receiver;
  19394. context=self;
  19395. $recv(anInteger)._timesRepeat_((function(){
  19396. return $core.withContext(function($ctx2) {
  19397. $1=context;
  19398. if(($receiver = $1) == null || $receiver.a$nil){
  19399. context=$1;
  19400. } else {
  19401. context=$recv(context)._home();
  19402. }
  19403. return context;
  19404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19405. }));
  19406. $2=context;
  19407. if(($receiver = $2) == null || $receiver.a$nil){
  19408. $2;
  19409. } else {
  19410. $recv(context)._stubHere();
  19411. }
  19412. return self;
  19413. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19414. },
  19415. args: ["anInteger"],
  19416. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19417. referencedClasses: [],
  19418. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19419. }),
  19420. $globals.MethodContext);
  19421. $core.addMethod(
  19422. $core.method({
  19423. selector: "supercall",
  19424. protocol: "accessing",
  19425. fn: function (){
  19426. var self=this,$self=this;
  19427. return $core.withContext(function($ctx1) {
  19428. return self.supercall == true;
  19429. return self;
  19430. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19431. },
  19432. args: [],
  19433. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19434. referencedClasses: [],
  19435. messageSends: []
  19436. }),
  19437. $globals.MethodContext);
  19438. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19439. $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' ]";
  19440. $core.addMethod(
  19441. $core.method({
  19442. selector: "constructorNamed:",
  19443. protocol: "instance creation",
  19444. fn: function (aString){
  19445. var self=this,$self=this;
  19446. return $core.withContext(function($ctx1) {
  19447. var nativeFunc=(new Function('return this'))()[aString];
  19448. return new nativeFunc();
  19449. ;
  19450. return self;
  19451. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19452. },
  19453. args: ["aString"],
  19454. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19455. referencedClasses: [],
  19456. messageSends: []
  19457. }),
  19458. $globals.NativeFunction.a$cls);
  19459. $core.addMethod(
  19460. $core.method({
  19461. selector: "constructorNamed:value:",
  19462. protocol: "instance creation",
  19463. fn: function (aString,anObject){
  19464. var self=this,$self=this;
  19465. return $core.withContext(function($ctx1) {
  19466. var nativeFunc=(new Function('return this'))()[aString];
  19467. return new nativeFunc(anObject);
  19468. ;
  19469. return self;
  19470. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19471. },
  19472. args: ["aString", "anObject"],
  19473. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19474. referencedClasses: [],
  19475. messageSends: []
  19476. }),
  19477. $globals.NativeFunction.a$cls);
  19478. $core.addMethod(
  19479. $core.method({
  19480. selector: "constructorNamed:value:value:",
  19481. protocol: "instance creation",
  19482. fn: function (aString,anObject,anObject2){
  19483. var self=this,$self=this;
  19484. return $core.withContext(function($ctx1) {
  19485. var nativeFunc=(new Function('return this'))()[aString];
  19486. return new nativeFunc(anObject,anObject2);
  19487. ;
  19488. return self;
  19489. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19490. },
  19491. args: ["aString", "anObject", "anObject2"],
  19492. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19493. referencedClasses: [],
  19494. messageSends: []
  19495. }),
  19496. $globals.NativeFunction.a$cls);
  19497. $core.addMethod(
  19498. $core.method({
  19499. selector: "constructorNamed:value:value:value:",
  19500. protocol: "instance creation",
  19501. fn: function (aString,anObject,anObject2,anObject3){
  19502. var self=this,$self=this;
  19503. return $core.withContext(function($ctx1) {
  19504. var nativeFunc=(new Function('return this'))()[aString];
  19505. return new nativeFunc(anObject,anObject2, anObject3);
  19506. ;
  19507. return self;
  19508. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19509. },
  19510. args: ["aString", "anObject", "anObject2", "anObject3"],
  19511. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19512. referencedClasses: [],
  19513. messageSends: []
  19514. }),
  19515. $globals.NativeFunction.a$cls);
  19516. $core.addMethod(
  19517. $core.method({
  19518. selector: "constructorOf:",
  19519. protocol: "instance creation",
  19520. fn: function (nativeFunc){
  19521. var self=this,$self=this;
  19522. return $core.withContext(function($ctx1) {
  19523. return new nativeFunc();
  19524. ;
  19525. return self;
  19526. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19527. },
  19528. args: ["nativeFunc"],
  19529. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19530. referencedClasses: [],
  19531. messageSends: []
  19532. }),
  19533. $globals.NativeFunction.a$cls);
  19534. $core.addMethod(
  19535. $core.method({
  19536. selector: "constructorOf:value:",
  19537. protocol: "instance creation",
  19538. fn: function (nativeFunc,anObject){
  19539. var self=this,$self=this;
  19540. return $core.withContext(function($ctx1) {
  19541. return new nativeFunc(anObject);
  19542. ;
  19543. return self;
  19544. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19545. },
  19546. args: ["nativeFunc", "anObject"],
  19547. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19548. referencedClasses: [],
  19549. messageSends: []
  19550. }),
  19551. $globals.NativeFunction.a$cls);
  19552. $core.addMethod(
  19553. $core.method({
  19554. selector: "constructorOf:value:value:",
  19555. protocol: "instance creation",
  19556. fn: function (nativeFunc,anObject,anObject2){
  19557. var self=this,$self=this;
  19558. return $core.withContext(function($ctx1) {
  19559. return new nativeFunc(anObject,anObject2);
  19560. ;
  19561. return self;
  19562. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19563. },
  19564. args: ["nativeFunc", "anObject", "anObject2"],
  19565. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19566. referencedClasses: [],
  19567. messageSends: []
  19568. }),
  19569. $globals.NativeFunction.a$cls);
  19570. $core.addMethod(
  19571. $core.method({
  19572. selector: "constructorOf:value:value:value:",
  19573. protocol: "instance creation",
  19574. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19575. var self=this,$self=this;
  19576. return $core.withContext(function($ctx1) {
  19577. return new nativeFunc(anObject,anObject2, anObject3);
  19578. ;
  19579. return self;
  19580. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19581. },
  19582. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19583. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19584. referencedClasses: [],
  19585. messageSends: []
  19586. }),
  19587. $globals.NativeFunction.a$cls);
  19588. $core.addMethod(
  19589. $core.method({
  19590. selector: "exists:",
  19591. protocol: "testing",
  19592. fn: function (aString){
  19593. var self=this,$self=this;
  19594. return $core.withContext(function($ctx1) {
  19595. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  19596. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19597. },
  19598. args: ["aString"],
  19599. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  19600. referencedClasses: ["Smalltalk"],
  19601. messageSends: ["existsJsGlobal:"]
  19602. }),
  19603. $globals.NativeFunction.a$cls);
  19604. $core.addMethod(
  19605. $core.method({
  19606. selector: "functionNamed:",
  19607. protocol: "function calling",
  19608. fn: function (aString){
  19609. var self=this,$self=this;
  19610. return $core.withContext(function($ctx1) {
  19611. var nativeFunc=(new Function('return this'))()[aString];
  19612. return nativeFunc();
  19613. ;
  19614. return self;
  19615. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19616. },
  19617. args: ["aString"],
  19618. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19619. referencedClasses: [],
  19620. messageSends: []
  19621. }),
  19622. $globals.NativeFunction.a$cls);
  19623. $core.addMethod(
  19624. $core.method({
  19625. selector: "functionNamed:value:",
  19626. protocol: "function calling",
  19627. fn: function (aString,anObject){
  19628. var self=this,$self=this;
  19629. return $core.withContext(function($ctx1) {
  19630. var nativeFunc=(new Function('return this'))()[aString];
  19631. return nativeFunc(anObject);
  19632. ;
  19633. return self;
  19634. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19635. },
  19636. args: ["aString", "anObject"],
  19637. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19638. referencedClasses: [],
  19639. messageSends: []
  19640. }),
  19641. $globals.NativeFunction.a$cls);
  19642. $core.addMethod(
  19643. $core.method({
  19644. selector: "functionNamed:value:value:",
  19645. protocol: "function calling",
  19646. fn: function (aString,anObject,anObject2){
  19647. var self=this,$self=this;
  19648. return $core.withContext(function($ctx1) {
  19649. var nativeFunc=(new Function('return this'))()[aString];
  19650. return nativeFunc(anObject,anObject2);
  19651. ;
  19652. return self;
  19653. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19654. },
  19655. args: ["aString", "anObject", "anObject2"],
  19656. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19657. referencedClasses: [],
  19658. messageSends: []
  19659. }),
  19660. $globals.NativeFunction.a$cls);
  19661. $core.addMethod(
  19662. $core.method({
  19663. selector: "functionNamed:value:value:value:",
  19664. protocol: "function calling",
  19665. fn: function (aString,anObject,anObject2,anObject3){
  19666. var self=this,$self=this;
  19667. return $core.withContext(function($ctx1) {
  19668. var nativeFunc=(new Function('return this'))()[aString];
  19669. return nativeFunc(anObject,anObject2, anObject3);
  19670. ;
  19671. return self;
  19672. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19673. },
  19674. args: ["aString", "anObject", "anObject2", "anObject3"],
  19675. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19676. referencedClasses: [],
  19677. messageSends: []
  19678. }),
  19679. $globals.NativeFunction.a$cls);
  19680. $core.addMethod(
  19681. $core.method({
  19682. selector: "functionNamed:valueWithArgs:",
  19683. protocol: "function calling",
  19684. fn: function (aString,args){
  19685. var self=this,$self=this;
  19686. return $core.withContext(function($ctx1) {
  19687. var nativeFunc=(new Function('return this'))()[aString];
  19688. return Function.prototype.apply.call(nativeFunc, null, args);
  19689. ;
  19690. return self;
  19691. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19692. },
  19693. args: ["aString", "args"],
  19694. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=(new Function(''return this''))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19695. referencedClasses: [],
  19696. messageSends: []
  19697. }),
  19698. $globals.NativeFunction.a$cls);
  19699. $core.addMethod(
  19700. $core.method({
  19701. selector: "functionOf:",
  19702. protocol: "function calling",
  19703. fn: function (nativeFunc){
  19704. var self=this,$self=this;
  19705. return $core.withContext(function($ctx1) {
  19706. return nativeFunc();
  19707. ;
  19708. return self;
  19709. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19710. },
  19711. args: ["nativeFunc"],
  19712. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19713. referencedClasses: [],
  19714. messageSends: []
  19715. }),
  19716. $globals.NativeFunction.a$cls);
  19717. $core.addMethod(
  19718. $core.method({
  19719. selector: "functionOf:value:",
  19720. protocol: "function calling",
  19721. fn: function (nativeFunc,anObject){
  19722. var self=this,$self=this;
  19723. return $core.withContext(function($ctx1) {
  19724. return nativeFunc(anObject);
  19725. ;
  19726. return self;
  19727. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19728. },
  19729. args: ["nativeFunc", "anObject"],
  19730. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19731. referencedClasses: [],
  19732. messageSends: []
  19733. }),
  19734. $globals.NativeFunction.a$cls);
  19735. $core.addMethod(
  19736. $core.method({
  19737. selector: "functionOf:value:value:",
  19738. protocol: "function calling",
  19739. fn: function (nativeFunc,anObject,anObject2){
  19740. var self=this,$self=this;
  19741. return $core.withContext(function($ctx1) {
  19742. return nativeFunc(anObject,anObject2);
  19743. ;
  19744. return self;
  19745. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19746. },
  19747. args: ["nativeFunc", "anObject", "anObject2"],
  19748. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19749. referencedClasses: [],
  19750. messageSends: []
  19751. }),
  19752. $globals.NativeFunction.a$cls);
  19753. $core.addMethod(
  19754. $core.method({
  19755. selector: "functionOf:value:value:value:",
  19756. protocol: "function calling",
  19757. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19758. var self=this,$self=this;
  19759. return $core.withContext(function($ctx1) {
  19760. return nativeFunc(anObject,anObject2, anObject3);
  19761. ;
  19762. return self;
  19763. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19764. },
  19765. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19766. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19767. referencedClasses: [],
  19768. messageSends: []
  19769. }),
  19770. $globals.NativeFunction.a$cls);
  19771. $core.addMethod(
  19772. $core.method({
  19773. selector: "functionOf:valueWithArgs:",
  19774. protocol: "function calling",
  19775. fn: function (nativeFunc,args){
  19776. var self=this,$self=this;
  19777. return $core.withContext(function($ctx1) {
  19778. return Function.prototype.apply.call(nativeFunc, null, args);
  19779. ;
  19780. return self;
  19781. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19782. },
  19783. args: ["nativeFunc", "args"],
  19784. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19785. referencedClasses: [],
  19786. messageSends: []
  19787. }),
  19788. $globals.NativeFunction.a$cls);
  19789. $core.addMethod(
  19790. $core.method({
  19791. selector: "isNativeFunction:",
  19792. protocol: "testing",
  19793. fn: function (anObject){
  19794. var self=this,$self=this;
  19795. return $core.withContext(function($ctx1) {
  19796. return typeof anObject === "function";
  19797. return self;
  19798. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19799. },
  19800. args: ["anObject"],
  19801. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19802. referencedClasses: [],
  19803. messageSends: []
  19804. }),
  19805. $globals.NativeFunction.a$cls);
  19806. $core.addMethod(
  19807. $core.method({
  19808. selector: "methodOf:this:",
  19809. protocol: "method calling",
  19810. fn: function (nativeFunc,thisObject){
  19811. var self=this,$self=this;
  19812. return $core.withContext(function($ctx1) {
  19813. return Function.prototype.call.call(nativeFunc, thisObject);
  19814. ;
  19815. return self;
  19816. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19817. },
  19818. args: ["nativeFunc", "thisObject"],
  19819. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19820. referencedClasses: [],
  19821. messageSends: []
  19822. }),
  19823. $globals.NativeFunction.a$cls);
  19824. $core.addMethod(
  19825. $core.method({
  19826. selector: "methodOf:this:value:",
  19827. protocol: "method calling",
  19828. fn: function (nativeFunc,thisObject,anObject){
  19829. var self=this,$self=this;
  19830. return $core.withContext(function($ctx1) {
  19831. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19832. ;
  19833. return self;
  19834. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19835. },
  19836. args: ["nativeFunc", "thisObject", "anObject"],
  19837. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19838. referencedClasses: [],
  19839. messageSends: []
  19840. }),
  19841. $globals.NativeFunction.a$cls);
  19842. $core.addMethod(
  19843. $core.method({
  19844. selector: "methodOf:this:value:value:",
  19845. protocol: "method calling",
  19846. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19847. var self=this,$self=this;
  19848. return $core.withContext(function($ctx1) {
  19849. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19850. ;
  19851. return self;
  19852. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19853. },
  19854. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19855. 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'>",
  19856. referencedClasses: [],
  19857. messageSends: []
  19858. }),
  19859. $globals.NativeFunction.a$cls);
  19860. $core.addMethod(
  19861. $core.method({
  19862. selector: "methodOf:this:value:value:value:",
  19863. protocol: "method calling",
  19864. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19865. var self=this,$self=this;
  19866. return $core.withContext(function($ctx1) {
  19867. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19868. ;
  19869. return self;
  19870. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19871. },
  19872. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19873. 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'>",
  19874. referencedClasses: [],
  19875. messageSends: []
  19876. }),
  19877. $globals.NativeFunction.a$cls);
  19878. $core.addMethod(
  19879. $core.method({
  19880. selector: "methodOf:this:valueWithArgs:",
  19881. protocol: "method calling",
  19882. fn: function (nativeFunc,thisObject,args){
  19883. var self=this,$self=this;
  19884. return $core.withContext(function($ctx1) {
  19885. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19886. ;
  19887. return self;
  19888. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19889. },
  19890. args: ["nativeFunc", "thisObject", "args"],
  19891. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19892. referencedClasses: [],
  19893. messageSends: []
  19894. }),
  19895. $globals.NativeFunction.a$cls);
  19896. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19897. $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.";
  19898. $core.addMethod(
  19899. $core.method({
  19900. selector: "clearInterval",
  19901. protocol: "timeout/interval",
  19902. fn: function (){
  19903. var self=this,$self=this;
  19904. return $core.withContext(function($ctx1) {
  19905. var interval = $self["@rawTimeout"];
  19906. clearInterval(interval);
  19907. ;
  19908. return self;
  19909. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19910. },
  19911. args: [],
  19912. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19913. referencedClasses: [],
  19914. messageSends: []
  19915. }),
  19916. $globals.Timeout);
  19917. $core.addMethod(
  19918. $core.method({
  19919. selector: "clearTimeout",
  19920. protocol: "timeout/interval",
  19921. fn: function (){
  19922. var self=this,$self=this;
  19923. return $core.withContext(function($ctx1) {
  19924. var timeout = $self["@rawTimeout"];
  19925. clearTimeout(timeout);
  19926. ;
  19927. return self;
  19928. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19929. },
  19930. args: [],
  19931. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19932. referencedClasses: [],
  19933. messageSends: []
  19934. }),
  19935. $globals.Timeout);
  19936. $core.addMethod(
  19937. $core.method({
  19938. selector: "rawTimeout:",
  19939. protocol: "accessing",
  19940. fn: function (anObject){
  19941. var self=this,$self=this;
  19942. $self["@rawTimeout"]=anObject;
  19943. return self;
  19944. },
  19945. args: ["anObject"],
  19946. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19947. referencedClasses: [],
  19948. messageSends: []
  19949. }),
  19950. $globals.Timeout);
  19951. $core.addMethod(
  19952. $core.method({
  19953. selector: "on:",
  19954. protocol: "instance creation",
  19955. fn: function (anObject){
  19956. var self=this,$self=this;
  19957. return $core.withContext(function($ctx1) {
  19958. var $1;
  19959. $1=$self._new();
  19960. $recv($1)._rawTimeout_(anObject);
  19961. return $recv($1)._yourself();
  19962. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19963. },
  19964. args: ["anObject"],
  19965. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19966. referencedClasses: [],
  19967. messageSends: ["rawTimeout:", "new", "yourself"]
  19968. }),
  19969. $globals.Timeout.a$cls);
  19970. });
  19971. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19972. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19973. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19974. $core.addPackage("Kernel-Dag");
  19975. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  19976. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19977. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19978. $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:`.";
  19979. $core.addMethod(
  19980. $core.method({
  19981. selector: "value:",
  19982. protocol: "evaluating",
  19983. fn: function (anObject){
  19984. var self=this,$self=this;
  19985. return $core.withContext(function($ctx1) {
  19986. return $self._visit_(anObject);
  19987. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  19988. },
  19989. args: ["anObject"],
  19990. source: "value: anObject\x0a\x09^ self visit: anObject",
  19991. referencedClasses: [],
  19992. messageSends: ["visit:"]
  19993. }),
  19994. $globals.AbstractDagVisitor);
  19995. $core.addMethod(
  19996. $core.method({
  19997. selector: "visit:",
  19998. protocol: "visiting",
  19999. fn: function (aNode){
  20000. var self=this,$self=this;
  20001. return $core.withContext(function($ctx1) {
  20002. return $recv(aNode)._acceptDagVisitor_(self);
  20003. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20004. },
  20005. args: ["aNode"],
  20006. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20007. referencedClasses: [],
  20008. messageSends: ["acceptDagVisitor:"]
  20009. }),
  20010. $globals.AbstractDagVisitor);
  20011. $core.addMethod(
  20012. $core.method({
  20013. selector: "visitAll:",
  20014. protocol: "visiting",
  20015. fn: function (aCollection){
  20016. var self=this,$self=this;
  20017. return $core.withContext(function($ctx1) {
  20018. return $recv(aCollection)._collect_((function(each){
  20019. return $core.withContext(function($ctx2) {
  20020. return $self._visit_(each);
  20021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20022. }));
  20023. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20024. },
  20025. args: ["aCollection"],
  20026. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20027. referencedClasses: [],
  20028. messageSends: ["collect:", "visit:"]
  20029. }),
  20030. $globals.AbstractDagVisitor);
  20031. $core.addMethod(
  20032. $core.method({
  20033. selector: "visitAllChildren:",
  20034. protocol: "visiting",
  20035. fn: function (aDagNode){
  20036. var self=this,$self=this;
  20037. return $core.withContext(function($ctx1) {
  20038. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20039. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20040. },
  20041. args: ["aDagNode"],
  20042. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20043. referencedClasses: [],
  20044. messageSends: ["visitAll:", "dagChildren"]
  20045. }),
  20046. $globals.AbstractDagVisitor);
  20047. $core.addMethod(
  20048. $core.method({
  20049. selector: "visitDagNode:",
  20050. protocol: "visiting",
  20051. fn: function (aNode){
  20052. var self=this,$self=this;
  20053. return $core.withContext(function($ctx1) {
  20054. $self._subclassResponsibility();
  20055. return self;
  20056. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20057. },
  20058. args: ["aNode"],
  20059. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20060. referencedClasses: [],
  20061. messageSends: ["subclassResponsibility"]
  20062. }),
  20063. $globals.AbstractDagVisitor);
  20064. $core.addMethod(
  20065. $core.method({
  20066. selector: "visitDagNodeVariantRedux:",
  20067. protocol: "visiting",
  20068. fn: function (aNode){
  20069. var self=this,$self=this;
  20070. var newChildren,oldChildren;
  20071. return $core.withContext(function($ctx1) {
  20072. var $2,$3,$1,$4,$5;
  20073. var $early={};
  20074. try {
  20075. oldChildren=$recv(aNode)._dagChildren();
  20076. newChildren=$self._visitAllChildren_(aNode);
  20077. $2=$recv(oldChildren)._size();
  20078. $ctx1.sendIdx["size"]=1;
  20079. $3=$recv(newChildren)._size();
  20080. $ctx1.sendIdx["size"]=2;
  20081. $1=$recv($2).__eq($3);
  20082. if($core.assert($1)){
  20083. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20084. return $core.withContext(function($ctx2) {
  20085. $4=$recv(oldChildren)._at_(i);
  20086. $ctx2.sendIdx["at:"]=1;
  20087. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20088. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20089. }),(function(){
  20090. throw $early=[aNode];
  20091. }));
  20092. }
  20093. $5=$recv(aNode)._copy();
  20094. $recv($5)._dagChildren_(newChildren);
  20095. return $recv($5)._yourself();
  20096. }
  20097. catch(e) {if(e===$early)return e[0]; throw e}
  20098. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20099. },
  20100. args: ["aNode"],
  20101. 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",
  20102. referencedClasses: [],
  20103. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20104. }),
  20105. $globals.AbstractDagVisitor);
  20106. $core.addMethod(
  20107. $core.method({
  20108. selector: "visitDagNodeVariantSimple:",
  20109. protocol: "visiting",
  20110. fn: function (aNode){
  20111. var self=this,$self=this;
  20112. return $core.withContext(function($ctx1) {
  20113. $self._visitAllChildren_(aNode);
  20114. return aNode;
  20115. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20116. },
  20117. args: ["aNode"],
  20118. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20119. referencedClasses: [],
  20120. messageSends: ["visitAllChildren:"]
  20121. }),
  20122. $globals.AbstractDagVisitor);
  20123. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20124. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20125. $core.addMethod(
  20126. $core.method({
  20127. selector: "initialize",
  20128. protocol: "initialization",
  20129. fn: function (){
  20130. var self=this,$self=this;
  20131. return $core.withContext(function($ctx1) {
  20132. (
  20133. $ctx1.supercall = true,
  20134. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20135. $ctx1.supercall = false;
  20136. $self["@path"]=[];
  20137. return self;
  20138. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20139. },
  20140. args: [],
  20141. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20142. referencedClasses: [],
  20143. messageSends: ["initialize"]
  20144. }),
  20145. $globals.PathDagVisitor);
  20146. $core.addMethod(
  20147. $core.method({
  20148. selector: "path",
  20149. protocol: "accessing",
  20150. fn: function (){
  20151. var self=this,$self=this;
  20152. return $self["@path"];
  20153. },
  20154. args: [],
  20155. source: "path\x0a\x09^ path",
  20156. referencedClasses: [],
  20157. messageSends: []
  20158. }),
  20159. $globals.PathDagVisitor);
  20160. $core.addMethod(
  20161. $core.method({
  20162. selector: "visit:",
  20163. protocol: "visiting",
  20164. fn: function (aNode){
  20165. var self=this,$self=this;
  20166. var oldPath,result;
  20167. return $core.withContext(function($ctx1) {
  20168. result=aNode;
  20169. oldPath=$self["@path"];
  20170. $recv((function(){
  20171. return $core.withContext(function($ctx2) {
  20172. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20173. $self["@path"];
  20174. result=(
  20175. $ctx2.supercall = true,
  20176. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20177. $ctx2.supercall = false;
  20178. return result;
  20179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20180. }))._ensure_((function(){
  20181. $self["@path"]=oldPath;
  20182. return $self["@path"];
  20183. }));
  20184. return result;
  20185. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20186. },
  20187. args: ["aNode"],
  20188. 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",
  20189. referencedClasses: [],
  20190. messageSends: ["ensure:", ",", "visit:"]
  20191. }),
  20192. $globals.PathDagVisitor);
  20193. $core.addMethod(
  20194. $core.method({
  20195. selector: "visitDagNodeVariantRedux:",
  20196. protocol: "visiting",
  20197. fn: function (aNode){
  20198. var self=this,$self=this;
  20199. var newNode;
  20200. return $core.withContext(function($ctx1) {
  20201. var $1;
  20202. newNode=(
  20203. $ctx1.supercall = true,
  20204. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20205. $ctx1.supercall = false;
  20206. $1=$recv(aNode).__eq_eq(newNode);
  20207. if(!$core.assert($1)){
  20208. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20209. }
  20210. return newNode;
  20211. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20212. },
  20213. args: ["aNode"],
  20214. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20215. referencedClasses: [],
  20216. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20217. }),
  20218. $globals.PathDagVisitor);
  20219. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20220. $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).";
  20221. $core.addMethod(
  20222. $core.method({
  20223. selector: "acceptDagVisitor:",
  20224. protocol: "visiting",
  20225. fn: function (aVisitor){
  20226. var self=this,$self=this;
  20227. return $core.withContext(function($ctx1) {
  20228. return $recv(aVisitor)._visitDagNode_(self);
  20229. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20230. },
  20231. args: ["aVisitor"],
  20232. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20233. referencedClasses: [],
  20234. messageSends: ["visitDagNode:"]
  20235. }),
  20236. $globals.DagNode);
  20237. $core.addMethod(
  20238. $core.method({
  20239. selector: "allDagChildren",
  20240. protocol: "accessing",
  20241. fn: function (){
  20242. var self=this,$self=this;
  20243. var allNodes;
  20244. return $core.withContext(function($ctx1) {
  20245. var $1;
  20246. $1=$self._dagChildren();
  20247. $ctx1.sendIdx["dagChildren"]=1;
  20248. allNodes=$recv($1)._asSet();
  20249. $recv($self._dagChildren())._do_((function(each){
  20250. return $core.withContext(function($ctx2) {
  20251. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20253. }));
  20254. return allNodes;
  20255. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20256. },
  20257. args: [],
  20258. 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",
  20259. referencedClasses: [],
  20260. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20261. }),
  20262. $globals.DagNode);
  20263. $core.addMethod(
  20264. $core.method({
  20265. selector: "dagChildren",
  20266. protocol: "accessing",
  20267. fn: function (){
  20268. var self=this,$self=this;
  20269. return $core.withContext(function($ctx1) {
  20270. $self._subclassResponsibility();
  20271. return self;
  20272. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20273. },
  20274. args: [],
  20275. source: "dagChildren\x0a\x09self subclassResponsibility",
  20276. referencedClasses: [],
  20277. messageSends: ["subclassResponsibility"]
  20278. }),
  20279. $globals.DagNode);
  20280. $core.addMethod(
  20281. $core.method({
  20282. selector: "dagChildren:",
  20283. protocol: "accessing",
  20284. fn: function (aCollection){
  20285. var self=this,$self=this;
  20286. return $core.withContext(function($ctx1) {
  20287. $self._subclassResponsibility();
  20288. return self;
  20289. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20290. },
  20291. args: ["aCollection"],
  20292. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20293. referencedClasses: [],
  20294. messageSends: ["subclassResponsibility"]
  20295. }),
  20296. $globals.DagNode);
  20297. $core.addMethod(
  20298. $core.method({
  20299. selector: "isDagNode",
  20300. protocol: "testing",
  20301. fn: function (){
  20302. var self=this,$self=this;
  20303. return true;
  20304. },
  20305. args: [],
  20306. source: "isDagNode\x0a\x09^ true",
  20307. referencedClasses: [],
  20308. messageSends: []
  20309. }),
  20310. $globals.DagNode);
  20311. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20312. $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.";
  20313. $core.addMethod(
  20314. $core.method({
  20315. selector: "addDagChild:",
  20316. protocol: "accessing",
  20317. fn: function (aDagNode){
  20318. var self=this,$self=this;
  20319. return $core.withContext(function($ctx1) {
  20320. $recv($self._dagChildren())._add_(aDagNode);
  20321. return self;
  20322. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20323. },
  20324. args: ["aDagNode"],
  20325. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20326. referencedClasses: [],
  20327. messageSends: ["add:", "dagChildren"]
  20328. }),
  20329. $globals.DagParentNode);
  20330. $core.addMethod(
  20331. $core.method({
  20332. selector: "dagChildren",
  20333. protocol: "accessing",
  20334. fn: function (){
  20335. var self=this,$self=this;
  20336. return $core.withContext(function($ctx1) {
  20337. var $1,$receiver;
  20338. $1=$self["@nodes"];
  20339. if(($receiver = $1) == null || $receiver.a$nil){
  20340. $self["@nodes"]=$recv($globals.Array)._new();
  20341. return $self["@nodes"];
  20342. } else {
  20343. return $1;
  20344. }
  20345. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20346. },
  20347. args: [],
  20348. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20349. referencedClasses: ["Array"],
  20350. messageSends: ["ifNil:", "new"]
  20351. }),
  20352. $globals.DagParentNode);
  20353. $core.addMethod(
  20354. $core.method({
  20355. selector: "dagChildren:",
  20356. protocol: "accessing",
  20357. fn: function (aCollection){
  20358. var self=this,$self=this;
  20359. $self["@nodes"]=aCollection;
  20360. return self;
  20361. },
  20362. args: ["aCollection"],
  20363. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20364. referencedClasses: [],
  20365. messageSends: []
  20366. }),
  20367. $globals.DagParentNode);
  20368. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20369. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20370. $core.addMethod(
  20371. $core.method({
  20372. selector: "dagChildren",
  20373. protocol: "accessing",
  20374. fn: function (){
  20375. var self=this,$self=this;
  20376. return [];
  20377. },
  20378. args: [],
  20379. source: "dagChildren\x0a\x09^ #()",
  20380. referencedClasses: [],
  20381. messageSends: []
  20382. }),
  20383. $globals.DagSink);
  20384. $core.addMethod(
  20385. $core.method({
  20386. selector: "dagChildren:",
  20387. protocol: "accessing",
  20388. fn: function (aCollection){
  20389. var self=this,$self=this;
  20390. return $core.withContext(function($ctx1) {
  20391. $recv(aCollection)._ifNotEmpty_((function(){
  20392. return $core.withContext(function($ctx2) {
  20393. return $self._error_("A DagSink cannot have children.");
  20394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20395. }));
  20396. return self;
  20397. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20398. },
  20399. args: ["aCollection"],
  20400. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20401. referencedClasses: [],
  20402. messageSends: ["ifNotEmpty:", "error:"]
  20403. }),
  20404. $globals.DagSink);
  20405. $core.addMethod(
  20406. $core.method({
  20407. selector: "isDagNode",
  20408. protocol: "*Kernel-Dag",
  20409. fn: function (){
  20410. var self=this,$self=this;
  20411. return false;
  20412. },
  20413. args: [],
  20414. source: "isDagNode\x0a\x09^ false",
  20415. referencedClasses: [],
  20416. messageSends: []
  20417. }),
  20418. $globals.Object);
  20419. });
  20420. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20421. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20422. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20423. $core.addPackage("Kernel-Exceptions");
  20424. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20425. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20426. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20427. $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.";
  20428. $core.addMethod(
  20429. $core.method({
  20430. selector: "beHandled",
  20431. protocol: "accessing",
  20432. fn: function (){
  20433. var self=this,$self=this;
  20434. return $core.withContext(function($ctx1) {
  20435. self.amberHandled = true;
  20436. return self;
  20437. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20438. },
  20439. args: [],
  20440. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20441. referencedClasses: [],
  20442. messageSends: []
  20443. }),
  20444. $globals.Error);
  20445. $core.addMethod(
  20446. $core.method({
  20447. selector: "beUnhandled",
  20448. protocol: "accessing",
  20449. fn: function (){
  20450. var self=this,$self=this;
  20451. return $core.withContext(function($ctx1) {
  20452. self.amberHandled = false;
  20453. return self;
  20454. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20455. },
  20456. args: [],
  20457. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20458. referencedClasses: [],
  20459. messageSends: []
  20460. }),
  20461. $globals.Error);
  20462. $core.addMethod(
  20463. $core.method({
  20464. selector: "context",
  20465. protocol: "accessing",
  20466. fn: function (){
  20467. var self=this,$self=this;
  20468. return $core.withContext(function($ctx1) {
  20469. return self.context;
  20470. return self;
  20471. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20472. },
  20473. args: [],
  20474. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20475. referencedClasses: [],
  20476. messageSends: []
  20477. }),
  20478. $globals.Error);
  20479. $core.addMethod(
  20480. $core.method({
  20481. selector: "initialize",
  20482. protocol: "initialization",
  20483. fn: function (){
  20484. var self=this,$self=this;
  20485. return $core.withContext(function($ctx1) {
  20486. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20487. return self;
  20488. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20489. },
  20490. args: [],
  20491. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20492. referencedClasses: [],
  20493. messageSends: ["messageText:", ",", "name", "class"]
  20494. }),
  20495. $globals.Error);
  20496. $core.addMethod(
  20497. $core.method({
  20498. selector: "isSmalltalkError",
  20499. protocol: "testing",
  20500. fn: function (){
  20501. var self=this,$self=this;
  20502. return $core.withContext(function($ctx1) {
  20503. return self.smalltalkError === true;
  20504. return self;
  20505. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20506. },
  20507. args: [],
  20508. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20509. referencedClasses: [],
  20510. messageSends: []
  20511. }),
  20512. $globals.Error);
  20513. $core.addMethod(
  20514. $core.method({
  20515. selector: "jsStack",
  20516. protocol: "accessing",
  20517. fn: function (){
  20518. var self=this,$self=this;
  20519. return $core.withContext(function($ctx1) {
  20520. return self.stack;
  20521. return self;
  20522. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20523. },
  20524. args: [],
  20525. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20526. referencedClasses: [],
  20527. messageSends: []
  20528. }),
  20529. $globals.Error);
  20530. $core.addMethod(
  20531. $core.method({
  20532. selector: "messageText",
  20533. protocol: "accessing",
  20534. fn: function (){
  20535. var self=this,$self=this;
  20536. return $self["@messageText"];
  20537. },
  20538. args: [],
  20539. source: "messageText\x0a\x09^ messageText",
  20540. referencedClasses: [],
  20541. messageSends: []
  20542. }),
  20543. $globals.Error);
  20544. $core.addMethod(
  20545. $core.method({
  20546. selector: "messageText:",
  20547. protocol: "accessing",
  20548. fn: function (aString){
  20549. var self=this,$self=this;
  20550. $self["@messageText"]=aString;
  20551. return self;
  20552. },
  20553. args: ["aString"],
  20554. source: "messageText: aString\x0a\x09messageText := aString",
  20555. referencedClasses: [],
  20556. messageSends: []
  20557. }),
  20558. $globals.Error);
  20559. $core.addMethod(
  20560. $core.method({
  20561. selector: "resignal",
  20562. protocol: "signaling",
  20563. fn: function (){
  20564. var self=this,$self=this;
  20565. return $core.withContext(function($ctx1) {
  20566. self.amberHandled = false;
  20567. throw(self);
  20568. ;
  20569. return self;
  20570. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20571. },
  20572. args: [],
  20573. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  20574. referencedClasses: [],
  20575. messageSends: []
  20576. }),
  20577. $globals.Error);
  20578. $core.addMethod(
  20579. $core.method({
  20580. selector: "signal",
  20581. protocol: "signaling",
  20582. fn: function (){
  20583. var self=this,$self=this;
  20584. return $core.withContext(function($ctx1) {
  20585. self.amberHandled = false;
  20586. self.context = $core.getThisContext();
  20587. self.smalltalkError = true;
  20588. throw self;
  20589. ;
  20590. return self;
  20591. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20592. },
  20593. args: [],
  20594. 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'>",
  20595. referencedClasses: [],
  20596. messageSends: []
  20597. }),
  20598. $globals.Error);
  20599. $core.addMethod(
  20600. $core.method({
  20601. selector: "signal:",
  20602. protocol: "signaling",
  20603. fn: function (aString){
  20604. var self=this,$self=this;
  20605. return $core.withContext(function($ctx1) {
  20606. $self._messageText_(aString);
  20607. $self._signal();
  20608. return self;
  20609. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20610. },
  20611. args: ["aString"],
  20612. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20613. referencedClasses: [],
  20614. messageSends: ["messageText:", "signal"]
  20615. }),
  20616. $globals.Error);
  20617. $core.addMethod(
  20618. $core.method({
  20619. selector: "signalerContext",
  20620. protocol: "accessing",
  20621. fn: function (){
  20622. var self=this,$self=this;
  20623. return $core.withContext(function($ctx1) {
  20624. return $self._signalerContextFrom_($self._context());
  20625. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20626. },
  20627. args: [],
  20628. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20629. referencedClasses: [],
  20630. messageSends: ["signalerContextFrom:", "context"]
  20631. }),
  20632. $globals.Error);
  20633. $core.addMethod(
  20634. $core.method({
  20635. selector: "signalerContextFrom:",
  20636. protocol: "accessing",
  20637. fn: function (aContext){
  20638. var self=this,$self=this;
  20639. return $core.withContext(function($ctx1) {
  20640. var $3,$2,$1;
  20641. return $recv(aContext)._findContextSuchThat_((function(context){
  20642. return $core.withContext(function($ctx2) {
  20643. $3=$recv(context)._receiver();
  20644. $ctx2.sendIdx["receiver"]=1;
  20645. $2=$recv($3).__eq_eq(self);
  20646. $ctx2.sendIdx["=="]=1;
  20647. $1=$recv($2)._or_((function(){
  20648. return $core.withContext(function($ctx3) {
  20649. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20650. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20651. }));
  20652. return $recv($1)._not();
  20653. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20654. }));
  20655. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20656. },
  20657. args: ["aContext"],
  20658. 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 ]",
  20659. referencedClasses: [],
  20660. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20661. }),
  20662. $globals.Error);
  20663. $core.addMethod(
  20664. $core.method({
  20665. selector: "wasHandled",
  20666. protocol: "testing",
  20667. fn: function (){
  20668. var self=this,$self=this;
  20669. return $core.withContext(function($ctx1) {
  20670. return self.amberHandled || false;
  20671. return self;
  20672. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20673. },
  20674. args: [],
  20675. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20676. referencedClasses: [],
  20677. messageSends: []
  20678. }),
  20679. $globals.Error);
  20680. $core.addMethod(
  20681. $core.method({
  20682. selector: "classTag",
  20683. protocol: "accessing",
  20684. fn: function (){
  20685. var self=this,$self=this;
  20686. return "exception";
  20687. },
  20688. args: [],
  20689. 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'",
  20690. referencedClasses: [],
  20691. messageSends: []
  20692. }),
  20693. $globals.Error.a$cls);
  20694. $core.addMethod(
  20695. $core.method({
  20696. selector: "signal",
  20697. protocol: "instance creation",
  20698. fn: function (){
  20699. var self=this,$self=this;
  20700. return $core.withContext(function($ctx1) {
  20701. return $recv($self._new())._signal();
  20702. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20703. },
  20704. args: [],
  20705. source: "signal\x0a\x09^ self new signal",
  20706. referencedClasses: [],
  20707. messageSends: ["signal", "new"]
  20708. }),
  20709. $globals.Error.a$cls);
  20710. $core.addMethod(
  20711. $core.method({
  20712. selector: "signal:",
  20713. protocol: "instance creation",
  20714. fn: function (aString){
  20715. var self=this,$self=this;
  20716. return $core.withContext(function($ctx1) {
  20717. return $recv($self._new())._signal_(aString);
  20718. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20719. },
  20720. args: ["aString"],
  20721. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20722. referencedClasses: [],
  20723. messageSends: ["signal:", "new"]
  20724. }),
  20725. $globals.Error.a$cls);
  20726. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20727. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20728. $core.addMethod(
  20729. $core.method({
  20730. selector: "messageText",
  20731. protocol: "accessing",
  20732. fn: function (){
  20733. var self=this,$self=this;
  20734. return "Halt encountered";
  20735. },
  20736. args: [],
  20737. source: "messageText\x0a\x09^ 'Halt encountered'",
  20738. referencedClasses: [],
  20739. messageSends: []
  20740. }),
  20741. $globals.Halt);
  20742. $core.addMethod(
  20743. $core.method({
  20744. selector: "signalerContextFrom:",
  20745. protocol: "accessing",
  20746. fn: function (aContext){
  20747. var self=this,$self=this;
  20748. return $core.withContext(function($ctx1) {
  20749. var $3,$2,$1;
  20750. return $recv(aContext)._findContextSuchThat_((function(context){
  20751. return $core.withContext(function($ctx2) {
  20752. $3=$recv(context)._receiver();
  20753. $ctx2.sendIdx["receiver"]=1;
  20754. $2=$recv($3).__eq_eq(self);
  20755. $ctx2.sendIdx["=="]=1;
  20756. $1=$recv($2)._or_((function(){
  20757. return $core.withContext(function($ctx3) {
  20758. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20759. return $core.withContext(function($ctx4) {
  20760. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20761. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20762. }));
  20763. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20764. }));
  20765. $ctx2.sendIdx["or:"]=1;
  20766. return $recv($1)._not();
  20767. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20768. }));
  20769. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20770. },
  20771. args: ["aContext"],
  20772. 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 ]",
  20773. referencedClasses: [],
  20774. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20775. }),
  20776. $globals.Halt);
  20777. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20778. $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:`";
  20779. $core.addMethod(
  20780. $core.method({
  20781. selector: "context:",
  20782. protocol: "accessing",
  20783. fn: function (aMethodContext){
  20784. var self=this,$self=this;
  20785. return $core.withContext(function($ctx1) {
  20786. self.context = aMethodContext;
  20787. return self;
  20788. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20789. },
  20790. args: ["aMethodContext"],
  20791. 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'>",
  20792. referencedClasses: [],
  20793. messageSends: []
  20794. }),
  20795. $globals.JavaScriptException);
  20796. $core.addMethod(
  20797. $core.method({
  20798. selector: "exception",
  20799. protocol: "accessing",
  20800. fn: function (){
  20801. var self=this,$self=this;
  20802. return $self["@exception"];
  20803. },
  20804. args: [],
  20805. source: "exception\x0a\x09^ exception",
  20806. referencedClasses: [],
  20807. messageSends: []
  20808. }),
  20809. $globals.JavaScriptException);
  20810. $core.addMethod(
  20811. $core.method({
  20812. selector: "exception:",
  20813. protocol: "accessing",
  20814. fn: function (anException){
  20815. var self=this,$self=this;
  20816. $self["@exception"]=anException;
  20817. return self;
  20818. },
  20819. args: ["anException"],
  20820. source: "exception: anException\x0a\x09exception := anException",
  20821. referencedClasses: [],
  20822. messageSends: []
  20823. }),
  20824. $globals.JavaScriptException);
  20825. $core.addMethod(
  20826. $core.method({
  20827. selector: "messageText",
  20828. protocol: "accessing",
  20829. fn: function (){
  20830. var self=this,$self=this;
  20831. return $core.withContext(function($ctx1) {
  20832. return "JavaScript exception: " + $self["@exception"].toString();
  20833. return self;
  20834. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20835. },
  20836. args: [],
  20837. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20838. referencedClasses: [],
  20839. messageSends: []
  20840. }),
  20841. $globals.JavaScriptException);
  20842. $core.addMethod(
  20843. $core.method({
  20844. selector: "shouldBeStubbed",
  20845. protocol: "testing",
  20846. fn: function (){
  20847. var self=this,$self=this;
  20848. return $core.withContext(function($ctx1) {
  20849. return $self["@exception"] instanceof RangeError;
  20850. return self;
  20851. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20852. },
  20853. args: [],
  20854. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20855. referencedClasses: [],
  20856. messageSends: []
  20857. }),
  20858. $globals.JavaScriptException);
  20859. $core.addMethod(
  20860. $core.method({
  20861. selector: "wrap",
  20862. protocol: "error handling",
  20863. fn: function (){
  20864. var self=this,$self=this;
  20865. return $core.withContext(function($ctx1) {
  20866. var $1;
  20867. $recv((function(){
  20868. return $core.withContext(function($ctx2) {
  20869. return $self._signal();
  20870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20871. }))._tryCatch_((function(){
  20872. return $core.withContext(function($ctx2) {
  20873. $1=$self._shouldBeStubbed();
  20874. if($core.assert($1)){
  20875. return $recv($self._context())._stubToAtMost_((100));
  20876. }
  20877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20878. }));
  20879. return self;
  20880. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20881. },
  20882. args: [],
  20883. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20884. referencedClasses: [],
  20885. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20886. }),
  20887. $globals.JavaScriptException);
  20888. $core.addMethod(
  20889. $core.method({
  20890. selector: "on:",
  20891. protocol: "instance creation",
  20892. fn: function (anException){
  20893. var self=this,$self=this;
  20894. return $core.withContext(function($ctx1) {
  20895. var $1;
  20896. $1=$self._new();
  20897. $recv($1)._exception_(anException);
  20898. return $recv($1)._yourself();
  20899. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20900. },
  20901. args: ["anException"],
  20902. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20903. referencedClasses: [],
  20904. messageSends: ["exception:", "new", "yourself"]
  20905. }),
  20906. $globals.JavaScriptException.a$cls);
  20907. $core.addMethod(
  20908. $core.method({
  20909. selector: "on:context:",
  20910. protocol: "instance creation",
  20911. fn: function (anException,aMethodContext){
  20912. var self=this,$self=this;
  20913. return $core.withContext(function($ctx1) {
  20914. var $1;
  20915. $1=$self._new();
  20916. $recv($1)._exception_(anException);
  20917. $recv($1)._context_(aMethodContext);
  20918. return $recv($1)._yourself();
  20919. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20920. },
  20921. args: ["anException", "aMethodContext"],
  20922. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20923. referencedClasses: [],
  20924. messageSends: ["exception:", "new", "context:", "yourself"]
  20925. }),
  20926. $globals.JavaScriptException.a$cls);
  20927. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20928. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20929. $core.addMethod(
  20930. $core.method({
  20931. selector: "message",
  20932. protocol: "accessing",
  20933. fn: function (){
  20934. var self=this,$self=this;
  20935. return $self["@message"];
  20936. },
  20937. args: [],
  20938. source: "message\x0a\x09^ message",
  20939. referencedClasses: [],
  20940. messageSends: []
  20941. }),
  20942. $globals.MessageNotUnderstood);
  20943. $core.addMethod(
  20944. $core.method({
  20945. selector: "message:",
  20946. protocol: "accessing",
  20947. fn: function (aMessage){
  20948. var self=this,$self=this;
  20949. $self["@message"]=aMessage;
  20950. return self;
  20951. },
  20952. args: ["aMessage"],
  20953. source: "message: aMessage\x0a\x09message := aMessage",
  20954. referencedClasses: [],
  20955. messageSends: []
  20956. }),
  20957. $globals.MessageNotUnderstood);
  20958. $core.addMethod(
  20959. $core.method({
  20960. selector: "messageText",
  20961. protocol: "accessing",
  20962. fn: function (){
  20963. var self=this,$self=this;
  20964. return $core.withContext(function($ctx1) {
  20965. var $1;
  20966. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  20967. $ctx1.sendIdx[","]=1;
  20968. return $1;
  20969. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20970. },
  20971. args: [],
  20972. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20973. referencedClasses: [],
  20974. messageSends: [",", "asString", "receiver", "selector", "message"]
  20975. }),
  20976. $globals.MessageNotUnderstood);
  20977. $core.addMethod(
  20978. $core.method({
  20979. selector: "receiver",
  20980. protocol: "accessing",
  20981. fn: function (){
  20982. var self=this,$self=this;
  20983. return $self["@receiver"];
  20984. },
  20985. args: [],
  20986. source: "receiver\x0a\x09^ receiver",
  20987. referencedClasses: [],
  20988. messageSends: []
  20989. }),
  20990. $globals.MessageNotUnderstood);
  20991. $core.addMethod(
  20992. $core.method({
  20993. selector: "receiver:",
  20994. protocol: "accessing",
  20995. fn: function (anObject){
  20996. var self=this,$self=this;
  20997. $self["@receiver"]=anObject;
  20998. return self;
  20999. },
  21000. args: ["anObject"],
  21001. source: "receiver: anObject\x0a\x09receiver := anObject",
  21002. referencedClasses: [],
  21003. messageSends: []
  21004. }),
  21005. $globals.MessageNotUnderstood);
  21006. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21007. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21008. $core.addMethod(
  21009. $core.method({
  21010. selector: "object",
  21011. protocol: "accessing",
  21012. fn: function (){
  21013. var self=this,$self=this;
  21014. return $self["@object"];
  21015. },
  21016. args: [],
  21017. source: "object\x0a\x09^ object",
  21018. referencedClasses: [],
  21019. messageSends: []
  21020. }),
  21021. $globals.NonBooleanReceiver);
  21022. $core.addMethod(
  21023. $core.method({
  21024. selector: "object:",
  21025. protocol: "accessing",
  21026. fn: function (anObject){
  21027. var self=this,$self=this;
  21028. $self["@object"]=anObject;
  21029. return self;
  21030. },
  21031. args: ["anObject"],
  21032. source: "object: anObject\x0a\x09object := anObject",
  21033. referencedClasses: [],
  21034. messageSends: []
  21035. }),
  21036. $globals.NonBooleanReceiver);
  21037. $core.addMethod(
  21038. $core.method({
  21039. selector: "signalOn:",
  21040. protocol: "instance creation",
  21041. fn: function (anObject){
  21042. var self=this,$self=this;
  21043. return $core.withContext(function($ctx1) {
  21044. var $1;
  21045. $1=$self._new();
  21046. $recv($1)._object_(anObject);
  21047. return $recv($1)._signal();
  21048. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21049. },
  21050. args: ["anObject"],
  21051. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21052. referencedClasses: [],
  21053. messageSends: ["object:", "new", "signal"]
  21054. }),
  21055. $globals.NonBooleanReceiver.a$cls);
  21056. });
  21057. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21058. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21059. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21060. $core.addPackage("Kernel-Promises");
  21061. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21062. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21063. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21064. $core.addMethod(
  21065. $core.method({
  21066. selector: "all:",
  21067. protocol: "composites",
  21068. fn: function (aCollection){
  21069. var self=this,$self=this;
  21070. return $core.withContext(function($ctx1) {
  21071. return Promise.all($recv(aCollection)._asArray());
  21072. return self;
  21073. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21074. },
  21075. args: ["aCollection"],
  21076. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21077. referencedClasses: [],
  21078. messageSends: []
  21079. }),
  21080. $globals.Promise.a$cls);
  21081. $core.addMethod(
  21082. $core.method({
  21083. selector: "any:",
  21084. protocol: "composites",
  21085. fn: function (aCollection){
  21086. var self=this,$self=this;
  21087. return $core.withContext(function($ctx1) {
  21088. return Promise.race($recv(aCollection)._asArray());
  21089. return self;
  21090. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21091. },
  21092. args: ["aCollection"],
  21093. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21094. referencedClasses: [],
  21095. messageSends: []
  21096. }),
  21097. $globals.Promise.a$cls);
  21098. $core.addMethod(
  21099. $core.method({
  21100. selector: "forBlock:",
  21101. protocol: "instance creation",
  21102. fn: function (aBlock){
  21103. var self=this,$self=this;
  21104. return $core.withContext(function($ctx1) {
  21105. return $recv($self._new())._then_(aBlock);
  21106. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21107. },
  21108. args: ["aBlock"],
  21109. 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",
  21110. referencedClasses: [],
  21111. messageSends: ["then:", "new"]
  21112. }),
  21113. $globals.Promise.a$cls);
  21114. $core.addMethod(
  21115. $core.method({
  21116. selector: "new",
  21117. protocol: "instance creation",
  21118. fn: function (){
  21119. var self=this,$self=this;
  21120. return $core.withContext(function($ctx1) {
  21121. return Promise.resolve();
  21122. return self;
  21123. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21124. },
  21125. args: [],
  21126. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21127. referencedClasses: [],
  21128. messageSends: []
  21129. }),
  21130. $globals.Promise.a$cls);
  21131. $core.addMethod(
  21132. $core.method({
  21133. selector: "new:",
  21134. protocol: "instance creation",
  21135. fn: function (aBlock){
  21136. var self=this,$self=this;
  21137. return $core.withContext(function($ctx1) {
  21138. return new Promise(function (resolve, reject) {
  21139. var model = {value: resolve, signal: reject};
  21140. aBlock._value_(model);
  21141. });
  21142. return self;
  21143. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21144. },
  21145. args: ["aBlock"],
  21146. 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})'>",
  21147. referencedClasses: [],
  21148. messageSends: []
  21149. }),
  21150. $globals.Promise.a$cls);
  21151. $core.addMethod(
  21152. $core.method({
  21153. selector: "signal:",
  21154. protocol: "instance creation",
  21155. fn: function (anObject){
  21156. var self=this,$self=this;
  21157. return $core.withContext(function($ctx1) {
  21158. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21159. return self;
  21160. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21161. },
  21162. args: ["anObject"],
  21163. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21164. referencedClasses: [],
  21165. messageSends: []
  21166. }),
  21167. $globals.Promise.a$cls);
  21168. $core.addMethod(
  21169. $core.method({
  21170. selector: "value:",
  21171. protocol: "instance creation",
  21172. fn: function (anObject){
  21173. var self=this,$self=this;
  21174. return $core.withContext(function($ctx1) {
  21175. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21176. return self;
  21177. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21178. },
  21179. args: ["anObject"],
  21180. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21181. referencedClasses: [],
  21182. messageSends: []
  21183. }),
  21184. $globals.Promise.a$cls);
  21185. $core.addTrait("TThenable", "Kernel-Promises");
  21186. $core.addMethod(
  21187. $core.method({
  21188. selector: "catch:",
  21189. protocol: "promises",
  21190. fn: function (aBlock){
  21191. var self=this,$self=this;
  21192. return $core.withContext(function($ctx1) {
  21193. return self.then(null, function (err) {return $core.seamless(function () {
  21194. return aBlock._value_(err);
  21195. })});
  21196. return self;
  21197. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21198. },
  21199. args: ["aBlock"],
  21200. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21201. referencedClasses: [],
  21202. messageSends: []
  21203. }),
  21204. $globals.TThenable);
  21205. $core.addMethod(
  21206. $core.method({
  21207. selector: "on:do:",
  21208. protocol: "promises",
  21209. fn: function (aClass,aBlock){
  21210. var self=this,$self=this;
  21211. return $core.withContext(function($ctx1) {
  21212. return self.then(null, function (err) {return $core.seamless(function () {
  21213. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21214. else throw err;
  21215. })});
  21216. return self;
  21217. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21218. },
  21219. args: ["aClass", "aBlock"],
  21220. 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})})'>",
  21221. referencedClasses: [],
  21222. messageSends: []
  21223. }),
  21224. $globals.TThenable);
  21225. $core.addMethod(
  21226. $core.method({
  21227. selector: "on:do:catch:",
  21228. protocol: "promises",
  21229. fn: function (aClass,aBlock,anotherBlock){
  21230. var self=this,$self=this;
  21231. return $core.withContext(function($ctx1) {
  21232. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21233. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21234. },
  21235. args: ["aClass", "aBlock", "anotherBlock"],
  21236. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21237. referencedClasses: [],
  21238. messageSends: ["catch:", "on:do:"]
  21239. }),
  21240. $globals.TThenable);
  21241. $core.addMethod(
  21242. $core.method({
  21243. selector: "then:",
  21244. protocol: "promises",
  21245. fn: function (aBlockOrArray){
  21246. var self=this,$self=this;
  21247. return $core.withContext(function($ctx1) {
  21248. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21249. return array.reduce(function (soFar, aBlock) {
  21250. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21251. function (result) {return $core.seamless(function () {
  21252. if (Array.isArray(result)) {
  21253. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21254. } else {
  21255. return aBlock._value_(result);
  21256. }
  21257. })} :
  21258. function (result) {return $core.seamless(function () {
  21259. return aBlock._value_(result);
  21260. })}
  21261. );
  21262. }, self);
  21263. return self;
  21264. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21265. },
  21266. args: ["aBlockOrArray"],
  21267. 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)'>",
  21268. referencedClasses: [],
  21269. messageSends: []
  21270. }),
  21271. $globals.TThenable);
  21272. $core.addMethod(
  21273. $core.method({
  21274. selector: "then:catch:",
  21275. protocol: "promises",
  21276. fn: function (aBlockOrArray,anotherBlock){
  21277. var self=this,$self=this;
  21278. return $core.withContext(function($ctx1) {
  21279. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21280. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21281. },
  21282. args: ["aBlockOrArray", "anotherBlock"],
  21283. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21284. referencedClasses: [],
  21285. messageSends: ["catch:", "then:"]
  21286. }),
  21287. $globals.TThenable);
  21288. $core.addMethod(
  21289. $core.method({
  21290. selector: "then:on:do:",
  21291. protocol: "promises",
  21292. fn: function (aBlockOrArray,aClass,aBlock){
  21293. var self=this,$self=this;
  21294. return $core.withContext(function($ctx1) {
  21295. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21296. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21297. },
  21298. args: ["aBlockOrArray", "aClass", "aBlock"],
  21299. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21300. referencedClasses: [],
  21301. messageSends: ["on:do:", "then:"]
  21302. }),
  21303. $globals.TThenable);
  21304. $core.addMethod(
  21305. $core.method({
  21306. selector: "then:on:do:catch:",
  21307. protocol: "promises",
  21308. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21309. var self=this,$self=this;
  21310. return $core.withContext(function($ctx1) {
  21311. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21312. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21313. },
  21314. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21315. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21316. referencedClasses: [],
  21317. messageSends: ["catch:", "on:do:", "then:"]
  21318. }),
  21319. $globals.TThenable);
  21320. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21321. });
  21322. 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";
  21323. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21324. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21325. $core.addPackage("Kernel-Infrastructure");
  21326. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21327. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21328. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21329. $core.addMethod(
  21330. $core.method({
  21331. selector: "initializeClasses",
  21332. protocol: "initialization",
  21333. fn: function (){
  21334. var self=this,$self=this;
  21335. return $core.withContext(function($ctx1) {
  21336. var $1;
  21337. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21338. return $core.withContext(function($ctx2) {
  21339. $1=$recv(each).__eq($globals.SmalltalkImage);
  21340. if(!$core.assert($1)){
  21341. return $recv(each)._initialize();
  21342. }
  21343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21344. }));
  21345. return self;
  21346. }, function($ctx1) {$ctx1.fill(self,"initializeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21347. },
  21348. args: [],
  21349. source: "initializeClasses\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09each = SmalltalkImage ifFalse: [ each initialize ] ]",
  21350. referencedClasses: ["Smalltalk", "SmalltalkImage"],
  21351. messageSends: ["do:", "classes", "ifFalse:", "=", "initialize"]
  21352. }),
  21353. $globals.AmberBootstrapInitialization.a$cls);
  21354. $core.addMethod(
  21355. $core.method({
  21356. selector: "organizeClasses",
  21357. protocol: "organization",
  21358. fn: function (){
  21359. var self=this,$self=this;
  21360. return $core.withContext(function($ctx1) {
  21361. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21362. return $core.withContext(function($ctx2) {
  21363. return $recv(each)._enterOrganization();
  21364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21365. }));
  21366. return self;
  21367. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21368. },
  21369. args: [],
  21370. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21371. referencedClasses: ["Smalltalk"],
  21372. messageSends: ["do:", "classes", "enterOrganization"]
  21373. }),
  21374. $globals.AmberBootstrapInitialization.a$cls);
  21375. $core.addMethod(
  21376. $core.method({
  21377. selector: "organizeMethods",
  21378. protocol: "organization",
  21379. fn: function (){
  21380. var self=this,$self=this;
  21381. return $core.withContext(function($ctx1) {
  21382. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21383. return $core.withContext(function($ctx2) {
  21384. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21385. return $core.withContext(function($ctx3) {
  21386. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21387. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21388. }));
  21389. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21390. }));
  21391. $ctx1.sendIdx["do:"]=1;
  21392. return self;
  21393. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21394. },
  21395. args: [],
  21396. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21397. referencedClasses: ["Smalltalk"],
  21398. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21399. }),
  21400. $globals.AmberBootstrapInitialization.a$cls);
  21401. $core.addMethod(
  21402. $core.method({
  21403. selector: "run",
  21404. protocol: "public api",
  21405. fn: function (){
  21406. var self=this,$self=this;
  21407. return $core.withContext(function($ctx1) {
  21408. $recv($globals.SmalltalkImage)._initialize();
  21409. $recv($globals.Smalltalk)._adoptPackageDictionary();
  21410. $self._organizeClasses();
  21411. $self._organizeMethods();
  21412. $self._initializeClasses();
  21413. return self;
  21414. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21415. },
  21416. args: [],
  21417. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09Smalltalk adoptPackageDictionary.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods;\x0a\x09\x09initializeClasses",
  21418. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21419. messageSends: ["initialize", "adoptPackageDictionary", "organizeClasses", "organizeMethods", "initializeClasses"]
  21420. }),
  21421. $globals.AmberBootstrapInitialization.a$cls);
  21422. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21423. $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`.";
  21424. $core.addMethod(
  21425. $core.method({
  21426. selector: "=",
  21427. protocol: "comparing",
  21428. fn: function (anObject){
  21429. var self=this,$self=this;
  21430. return $core.withContext(function($ctx1) {
  21431. var $2,$1;
  21432. $2=$recv(anObject)._class();
  21433. $ctx1.sendIdx["class"]=1;
  21434. $1=$recv($2).__eq_eq($self._class());
  21435. if(!$core.assert($1)){
  21436. return false;
  21437. }
  21438. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21439. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21440. },
  21441. args: ["anObject"],
  21442. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21443. referencedClasses: ["JSObjectProxy"],
  21444. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21445. }),
  21446. $globals.JSObjectProxy);
  21447. $core.addMethod(
  21448. $core.method({
  21449. selector: "asJavaScriptObject",
  21450. protocol: "converting",
  21451. fn: function (){
  21452. var self=this,$self=this;
  21453. return $self["@jsObject"];
  21454. },
  21455. args: [],
  21456. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21457. referencedClasses: [],
  21458. messageSends: []
  21459. }),
  21460. $globals.JSObjectProxy);
  21461. $core.addMethod(
  21462. $core.method({
  21463. selector: "at:",
  21464. protocol: "accessing",
  21465. fn: function (aString){
  21466. var self=this,$self=this;
  21467. return $core.withContext(function($ctx1) {
  21468. return $self['@jsObject'][aString];
  21469. return self;
  21470. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21471. },
  21472. args: ["aString"],
  21473. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21474. referencedClasses: [],
  21475. messageSends: []
  21476. }),
  21477. $globals.JSObjectProxy);
  21478. $core.addMethod(
  21479. $core.method({
  21480. selector: "at:ifAbsent:",
  21481. protocol: "accessing",
  21482. fn: function (aString,aBlock){
  21483. var self=this,$self=this;
  21484. return $core.withContext(function($ctx1) {
  21485. var obj = $self['@jsObject'];
  21486. return aString in obj ? obj[aString] : aBlock._value();
  21487. ;
  21488. return self;
  21489. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21490. },
  21491. args: ["aString", "aBlock"],
  21492. 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'>",
  21493. referencedClasses: [],
  21494. messageSends: []
  21495. }),
  21496. $globals.JSObjectProxy);
  21497. $core.addMethod(
  21498. $core.method({
  21499. selector: "at:ifPresent:",
  21500. protocol: "accessing",
  21501. fn: function (aString,aBlock){
  21502. var self=this,$self=this;
  21503. return $core.withContext(function($ctx1) {
  21504. var obj = $self['@jsObject'];
  21505. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21506. ;
  21507. return self;
  21508. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21509. },
  21510. args: ["aString", "aBlock"],
  21511. 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'>",
  21512. referencedClasses: [],
  21513. messageSends: []
  21514. }),
  21515. $globals.JSObjectProxy);
  21516. $core.addMethod(
  21517. $core.method({
  21518. selector: "at:ifPresent:ifAbsent:",
  21519. protocol: "accessing",
  21520. fn: function (aString,aBlock,anotherBlock){
  21521. var self=this,$self=this;
  21522. return $core.withContext(function($ctx1) {
  21523. var obj = $self['@jsObject'];
  21524. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21525. ;
  21526. return self;
  21527. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21528. },
  21529. args: ["aString", "aBlock", "anotherBlock"],
  21530. 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'>",
  21531. referencedClasses: [],
  21532. messageSends: []
  21533. }),
  21534. $globals.JSObjectProxy);
  21535. $core.addMethod(
  21536. $core.method({
  21537. selector: "at:put:",
  21538. protocol: "accessing",
  21539. fn: function (aString,anObject){
  21540. var self=this,$self=this;
  21541. return $core.withContext(function($ctx1) {
  21542. return $self['@jsObject'][aString] = anObject;
  21543. return self;
  21544. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21545. },
  21546. args: ["aString", "anObject"],
  21547. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21548. referencedClasses: [],
  21549. messageSends: []
  21550. }),
  21551. $globals.JSObjectProxy);
  21552. $core.addMethod(
  21553. $core.method({
  21554. selector: "catch:",
  21555. protocol: "promises",
  21556. fn: function (aBlock){
  21557. var self=this,$self=this;
  21558. return $core.withContext(function($ctx1) {
  21559. var $1,$2;
  21560. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21561. if($core.assert($1)){
  21562. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21563. } else {
  21564. $2=(
  21565. $ctx1.supercall = true,
  21566. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21567. $ctx1.supercall = false;
  21568. return $2;
  21569. }
  21570. return self;
  21571. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21572. },
  21573. args: ["aBlock"],
  21574. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21575. referencedClasses: ["NativeFunction", "TThenable"],
  21576. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21577. }),
  21578. $globals.JSObjectProxy);
  21579. $core.addMethod(
  21580. $core.method({
  21581. selector: "doesNotUnderstand:",
  21582. protocol: "proxy",
  21583. fn: function (aMessage){
  21584. var self=this,$self=this;
  21585. return $core.withContext(function($ctx1) {
  21586. var $1,$receiver;
  21587. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21588. if(($receiver = $1) == null || $receiver.a$nil){
  21589. return (
  21590. $ctx1.supercall = true,
  21591. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21592. $ctx1.supercall = false;
  21593. } else {
  21594. var jsSelector;
  21595. jsSelector=$receiver;
  21596. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21597. }
  21598. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21599. },
  21600. args: ["aMessage"],
  21601. 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 ]",
  21602. referencedClasses: ["JSObjectProxy"],
  21603. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21604. }),
  21605. $globals.JSObjectProxy);
  21606. $core.addMethod(
  21607. $core.method({
  21608. selector: "in:",
  21609. protocol: "accessing",
  21610. fn: function (aValuable){
  21611. var self=this,$self=this;
  21612. return $core.withContext(function($ctx1) {
  21613. return $recv(aValuable)._value_($self["@jsObject"]);
  21614. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21615. },
  21616. args: ["aValuable"],
  21617. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21618. referencedClasses: [],
  21619. messageSends: ["value:"]
  21620. }),
  21621. $globals.JSObjectProxy);
  21622. $core.addMethod(
  21623. $core.method({
  21624. selector: "jsObject",
  21625. protocol: "accessing",
  21626. fn: function (){
  21627. var self=this,$self=this;
  21628. return $self["@jsObject"];
  21629. },
  21630. args: [],
  21631. source: "jsObject\x0a\x09^ jsObject",
  21632. referencedClasses: [],
  21633. messageSends: []
  21634. }),
  21635. $globals.JSObjectProxy);
  21636. $core.addMethod(
  21637. $core.method({
  21638. selector: "keysAndValuesDo:",
  21639. protocol: "enumerating",
  21640. fn: function (aBlock){
  21641. var self=this,$self=this;
  21642. return $core.withContext(function($ctx1) {
  21643. var o = $self['@jsObject'];
  21644. for(var i in o) {
  21645. aBlock._value_value_(i, o[i]);
  21646. }
  21647. ;
  21648. return self;
  21649. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21650. },
  21651. args: ["aBlock"],
  21652. 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'>",
  21653. referencedClasses: [],
  21654. messageSends: []
  21655. }),
  21656. $globals.JSObjectProxy);
  21657. $core.addMethod(
  21658. $core.method({
  21659. selector: "on:do:",
  21660. protocol: "promises",
  21661. fn: function (aClass,aBlock){
  21662. var self=this,$self=this;
  21663. return $core.withContext(function($ctx1) {
  21664. var $1,$2;
  21665. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21666. if($core.assert($1)){
  21667. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21668. } else {
  21669. $2=(
  21670. $ctx1.supercall = true,
  21671. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21672. $ctx1.supercall = false;
  21673. return $2;
  21674. }
  21675. return self;
  21676. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21677. },
  21678. args: ["aClass", "aBlock"],
  21679. 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 ]",
  21680. referencedClasses: ["NativeFunction", "TThenable"],
  21681. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21682. }),
  21683. $globals.JSObjectProxy);
  21684. $core.addMethod(
  21685. $core.method({
  21686. selector: "printOn:",
  21687. protocol: "printing",
  21688. fn: function (aStream){
  21689. var self=this,$self=this;
  21690. return $core.withContext(function($ctx1) {
  21691. $recv(aStream)._nextPutAll_($self._printString());
  21692. return self;
  21693. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21694. },
  21695. args: ["aStream"],
  21696. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21697. referencedClasses: [],
  21698. messageSends: ["nextPutAll:", "printString"]
  21699. }),
  21700. $globals.JSObjectProxy);
  21701. $core.addMethod(
  21702. $core.method({
  21703. selector: "printString",
  21704. protocol: "printing",
  21705. fn: function (){
  21706. var self=this,$self=this;
  21707. return $core.withContext(function($ctx1) {
  21708. var js = $self['@jsObject'];
  21709. return js.toString
  21710. ? js.toString()
  21711. : Object.prototype.toString.call(js)
  21712. ;
  21713. return self;
  21714. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21715. },
  21716. args: [],
  21717. 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'>",
  21718. referencedClasses: [],
  21719. messageSends: []
  21720. }),
  21721. $globals.JSObjectProxy);
  21722. $core.addMethod(
  21723. $core.method({
  21724. selector: "putOn:",
  21725. protocol: "streaming",
  21726. fn: function (aStream){
  21727. var self=this,$self=this;
  21728. return $core.withContext(function($ctx1) {
  21729. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21730. return self;
  21731. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21732. },
  21733. args: ["aStream"],
  21734. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21735. referencedClasses: [],
  21736. messageSends: ["nextPutJSObject:"]
  21737. }),
  21738. $globals.JSObjectProxy);
  21739. $core.addMethod(
  21740. $core.method({
  21741. selector: "then:",
  21742. protocol: "promises",
  21743. fn: function (aBlockOrArray){
  21744. var self=this,$self=this;
  21745. return $core.withContext(function($ctx1) {
  21746. var $1,$2;
  21747. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21748. if($core.assert($1)){
  21749. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21750. } else {
  21751. $2=(
  21752. $ctx1.supercall = true,
  21753. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21754. $ctx1.supercall = false;
  21755. return $2;
  21756. }
  21757. return self;
  21758. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21759. },
  21760. args: ["aBlockOrArray"],
  21761. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21762. referencedClasses: ["NativeFunction", "TThenable"],
  21763. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21764. }),
  21765. $globals.JSObjectProxy);
  21766. $core.addMethod(
  21767. $core.method({
  21768. selector: "addObjectVariablesTo:ofProxy:",
  21769. protocol: "proxy",
  21770. fn: function (aDictionary,aProxy){
  21771. var self=this,$self=this;
  21772. return $core.withContext(function($ctx1) {
  21773. var jsObject = aProxy['@jsObject'];
  21774. for(var i in jsObject) {
  21775. aDictionary._at_put_(i, jsObject[i]);
  21776. }
  21777. ;
  21778. return self;
  21779. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21780. },
  21781. args: ["aDictionary", "aProxy"],
  21782. 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'>",
  21783. referencedClasses: [],
  21784. messageSends: []
  21785. }),
  21786. $globals.JSObjectProxy.a$cls);
  21787. $core.addMethod(
  21788. $core.method({
  21789. selector: "compareJSObjectOfProxy:withProxy:",
  21790. protocol: "proxy",
  21791. fn: function (aProxy,anotherProxy){
  21792. var self=this,$self=this;
  21793. return $core.withContext(function($ctx1) {
  21794. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21795. return aProxy["@jsObject"] === anotherJSObject;
  21796. return self;
  21797. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21798. },
  21799. args: ["aProxy", "anotherProxy"],
  21800. 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'>",
  21801. referencedClasses: [],
  21802. messageSends: []
  21803. }),
  21804. $globals.JSObjectProxy.a$cls);
  21805. $core.addMethod(
  21806. $core.method({
  21807. selector: "forwardMessage:withArguments:ofProxy:",
  21808. protocol: "proxy",
  21809. fn: function (aString,anArray,aProxy){
  21810. var self=this,$self=this;
  21811. return $core.withContext(function($ctx1) {
  21812. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21813. ;
  21814. return self;
  21815. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21816. },
  21817. args: ["aString", "anArray", "aProxy"],
  21818. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21819. referencedClasses: [],
  21820. messageSends: []
  21821. }),
  21822. $globals.JSObjectProxy.a$cls);
  21823. $core.addMethod(
  21824. $core.method({
  21825. selector: "jsObject:ofProxy:",
  21826. protocol: "proxy",
  21827. fn: function (aJSObject,aProxy){
  21828. var self=this,$self=this;
  21829. return $core.withContext(function($ctx1) {
  21830. aProxy['@jsObject'] = aJSObject;
  21831. return self;
  21832. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21833. },
  21834. args: ["aJSObject", "aProxy"],
  21835. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21836. referencedClasses: [],
  21837. messageSends: []
  21838. }),
  21839. $globals.JSObjectProxy.a$cls);
  21840. $core.addMethod(
  21841. $core.method({
  21842. selector: "lookupProperty:ofProxy:",
  21843. protocol: "proxy",
  21844. fn: function (aString,aProxy){
  21845. var self=this,$self=this;
  21846. return $core.withContext(function($ctx1) {
  21847. return aString in aProxy._jsObject() ? aString : nil;
  21848. return self;
  21849. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21850. },
  21851. args: ["aString", "aProxy"],
  21852. 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'>",
  21853. referencedClasses: [],
  21854. messageSends: []
  21855. }),
  21856. $globals.JSObjectProxy.a$cls);
  21857. $core.addMethod(
  21858. $core.method({
  21859. selector: "on:",
  21860. protocol: "instance creation",
  21861. fn: function (aJSObject){
  21862. var self=this,$self=this;
  21863. var instance;
  21864. return $core.withContext(function($ctx1) {
  21865. instance=$self._new();
  21866. $self._jsObject_ofProxy_(aJSObject,instance);
  21867. return instance;
  21868. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21869. },
  21870. args: ["aJSObject"],
  21871. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21872. referencedClasses: [],
  21873. messageSends: ["new", "jsObject:ofProxy:"]
  21874. }),
  21875. $globals.JSObjectProxy.a$cls);
  21876. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21877. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21878. $core.addMethod(
  21879. $core.method({
  21880. selector: "addElement:",
  21881. protocol: "accessing",
  21882. fn: function (anObject){
  21883. var self=this,$self=this;
  21884. return $core.withContext(function($ctx1) {
  21885. $recv($self._elements())._add_(anObject);
  21886. return self;
  21887. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21888. },
  21889. args: ["anObject"],
  21890. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21891. referencedClasses: [],
  21892. messageSends: ["add:", "elements"]
  21893. }),
  21894. $globals.Organizer);
  21895. $core.addMethod(
  21896. $core.method({
  21897. selector: "elements",
  21898. protocol: "accessing",
  21899. fn: function (){
  21900. var self=this,$self=this;
  21901. return $self["@elements"];
  21902. },
  21903. args: [],
  21904. source: "elements\x0a\x09^ elements",
  21905. referencedClasses: [],
  21906. messageSends: []
  21907. }),
  21908. $globals.Organizer);
  21909. $core.addMethod(
  21910. $core.method({
  21911. selector: "initialize",
  21912. protocol: "initialization",
  21913. fn: function (){
  21914. var self=this,$self=this;
  21915. return $core.withContext(function($ctx1) {
  21916. (
  21917. $ctx1.supercall = true,
  21918. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21919. $ctx1.supercall = false;
  21920. $self["@elements"]=$recv($globals.Set)._new();
  21921. return self;
  21922. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  21923. },
  21924. args: [],
  21925. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21926. referencedClasses: ["Set"],
  21927. messageSends: ["initialize", "new"]
  21928. }),
  21929. $globals.Organizer);
  21930. $core.addMethod(
  21931. $core.method({
  21932. selector: "removeElement:",
  21933. protocol: "accessing",
  21934. fn: function (anObject){
  21935. var self=this,$self=this;
  21936. return $core.withContext(function($ctx1) {
  21937. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21938. }));
  21939. return self;
  21940. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  21941. },
  21942. args: ["anObject"],
  21943. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21944. referencedClasses: [],
  21945. messageSends: ["remove:ifAbsent:", "elements"]
  21946. }),
  21947. $globals.Organizer);
  21948. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21949. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  21950. $core.addMethod(
  21951. $core.method({
  21952. selector: "addElement:",
  21953. protocol: "accessing",
  21954. fn: function (aString){
  21955. var self=this,$self=this;
  21956. return $core.withContext(function($ctx1) {
  21957. var $1,$3,$2;
  21958. (
  21959. $ctx1.supercall = true,
  21960. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  21961. $ctx1.supercall = false;
  21962. $1=$recv($globals.SystemAnnouncer)._current();
  21963. $3=$recv($globals.ProtocolAdded)._new();
  21964. $recv($3)._protocol_(aString);
  21965. $recv($3)._theClass_($self._theClass());
  21966. $2=$recv($3)._yourself();
  21967. $recv($1)._announce_($2);
  21968. return self;
  21969. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  21970. },
  21971. args: ["aString"],
  21972. 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)",
  21973. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  21974. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  21975. }),
  21976. $globals.ClassOrganizer);
  21977. $core.addMethod(
  21978. $core.method({
  21979. selector: "removeElement:",
  21980. protocol: "accessing",
  21981. fn: function (aString){
  21982. var self=this,$self=this;
  21983. return $core.withContext(function($ctx1) {
  21984. var $1,$3,$2;
  21985. (
  21986. $ctx1.supercall = true,
  21987. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  21988. $ctx1.supercall = false;
  21989. $1=$recv($globals.SystemAnnouncer)._current();
  21990. $3=$recv($globals.ProtocolRemoved)._new();
  21991. $recv($3)._protocol_(aString);
  21992. $recv($3)._theClass_($self._theClass());
  21993. $2=$recv($3)._yourself();
  21994. $recv($1)._announce_($2);
  21995. return self;
  21996. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  21997. },
  21998. args: ["aString"],
  21999. 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)",
  22000. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22001. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22002. }),
  22003. $globals.ClassOrganizer);
  22004. $core.addMethod(
  22005. $core.method({
  22006. selector: "theClass",
  22007. protocol: "accessing",
  22008. fn: function (){
  22009. var self=this,$self=this;
  22010. return $self["@traitOrBehavior"];
  22011. },
  22012. args: [],
  22013. source: "theClass\x0a\x09^ traitOrBehavior",
  22014. referencedClasses: [],
  22015. messageSends: []
  22016. }),
  22017. $globals.ClassOrganizer);
  22018. $core.addMethod(
  22019. $core.method({
  22020. selector: "theClass:",
  22021. protocol: "accessing",
  22022. fn: function (aClass){
  22023. var self=this,$self=this;
  22024. $self["@traitOrBehavior"]=aClass;
  22025. return self;
  22026. },
  22027. args: ["aClass"],
  22028. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22029. referencedClasses: [],
  22030. messageSends: []
  22031. }),
  22032. $globals.ClassOrganizer);
  22033. $core.addMethod(
  22034. $core.method({
  22035. selector: "on:",
  22036. protocol: "instance creation",
  22037. fn: function (aClass){
  22038. var self=this,$self=this;
  22039. return $core.withContext(function($ctx1) {
  22040. var $1;
  22041. $1=$self._new();
  22042. $recv($1)._theClass_(aClass);
  22043. return $recv($1)._yourself();
  22044. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22045. },
  22046. args: ["aClass"],
  22047. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22048. referencedClasses: [],
  22049. messageSends: ["theClass:", "new", "yourself"]
  22050. }),
  22051. $globals.ClassOrganizer.a$cls);
  22052. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22053. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22054. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22055. $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'";
  22056. $core.addMethod(
  22057. $core.method({
  22058. selector: "basicTransport",
  22059. protocol: "private",
  22060. fn: function (){
  22061. var self=this,$self=this;
  22062. return $self["@basicTransport"];
  22063. },
  22064. args: [],
  22065. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22066. referencedClasses: [],
  22067. messageSends: []
  22068. }),
  22069. $globals.Package);
  22070. $core.addMethod(
  22071. $core.method({
  22072. selector: "beClean",
  22073. protocol: "accessing",
  22074. fn: function (){
  22075. var self=this,$self=this;
  22076. return $core.withContext(function($ctx1) {
  22077. var $1,$3,$2;
  22078. $self["@dirty"]=false;
  22079. $1=$recv($globals.SystemAnnouncer)._current();
  22080. $3=$recv($globals.PackageClean)._new();
  22081. $recv($3)._package_(self);
  22082. $2=$recv($3)._yourself();
  22083. $recv($1)._announce_($2);
  22084. return self;
  22085. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22086. },
  22087. args: [],
  22088. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22089. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22090. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22091. }),
  22092. $globals.Package);
  22093. $core.addMethod(
  22094. $core.method({
  22095. selector: "beDirty",
  22096. protocol: "accessing",
  22097. fn: function (){
  22098. var self=this,$self=this;
  22099. return $core.withContext(function($ctx1) {
  22100. var $1,$3,$2;
  22101. $self["@dirty"]=true;
  22102. $1=$recv($globals.SystemAnnouncer)._current();
  22103. $3=$recv($globals.PackageDirty)._new();
  22104. $recv($3)._package_(self);
  22105. $2=$recv($3)._yourself();
  22106. $recv($1)._announce_($2);
  22107. return self;
  22108. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22109. },
  22110. args: [],
  22111. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22112. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22113. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22114. }),
  22115. $globals.Package);
  22116. $core.addMethod(
  22117. $core.method({
  22118. selector: "classTemplate",
  22119. protocol: "accessing",
  22120. fn: function (){
  22121. var self=this,$self=this;
  22122. return $core.withContext(function($ctx1) {
  22123. return $recv($globals.String)._streamContents_((function(stream){
  22124. return $core.withContext(function($ctx2) {
  22125. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22126. $ctx2.sendIdx["write:"]=1;
  22127. $recv(stream)._lf();
  22128. $ctx2.sendIdx["lf"]=1;
  22129. $recv(stream)._tab();
  22130. $ctx2.sendIdx["tab"]=1;
  22131. $recv(stream)._write_("instanceVariableNames: ''");
  22132. $ctx2.sendIdx["write:"]=2;
  22133. $recv(stream)._lf();
  22134. $recv(stream)._tab();
  22135. $recv(stream)._write_("package: ");
  22136. return $recv(stream)._print_($self._name());
  22137. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22138. }));
  22139. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22140. },
  22141. args: [],
  22142. 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 ]",
  22143. referencedClasses: ["String"],
  22144. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22145. }),
  22146. $globals.Package);
  22147. $core.addMethod(
  22148. $core.method({
  22149. selector: "classes",
  22150. protocol: "classes",
  22151. fn: function (){
  22152. var self=this,$self=this;
  22153. return $core.withContext(function($ctx1) {
  22154. return $recv($recv($self._organization())._elements())._copy();
  22155. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22156. },
  22157. args: [],
  22158. source: "classes\x0a\x09^ self organization elements copy",
  22159. referencedClasses: [],
  22160. messageSends: ["copy", "elements", "organization"]
  22161. }),
  22162. $globals.Package);
  22163. $core.addMethod(
  22164. $core.method({
  22165. selector: "definition",
  22166. protocol: "accessing",
  22167. fn: function (){
  22168. var self=this,$self=this;
  22169. return $core.withContext(function($ctx1) {
  22170. var $1;
  22171. return $recv($globals.String)._streamContents_((function(stream){
  22172. return $core.withContext(function($ctx2) {
  22173. $1=$recv($self._class())._name();
  22174. $ctx2.sendIdx["name"]=1;
  22175. $recv(stream)._write_($1);
  22176. $ctx2.sendIdx["write:"]=1;
  22177. $recv(stream)._lf();
  22178. $ctx2.sendIdx["lf"]=1;
  22179. $recv(stream)._tab();
  22180. $ctx2.sendIdx["tab"]=1;
  22181. $recv(stream)._write_("named: ");
  22182. $ctx2.sendIdx["write:"]=2;
  22183. $recv(stream)._print_($self._name());
  22184. $recv(stream)._lf();
  22185. $ctx2.sendIdx["lf"]=2;
  22186. $recv(stream)._tab();
  22187. $ctx2.sendIdx["tab"]=2;
  22188. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22189. $ctx2.sendIdx["write:"]=3;
  22190. $recv(stream)._lf();
  22191. $recv(stream)._tab();
  22192. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22193. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22194. }));
  22195. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22196. },
  22197. args: [],
  22198. 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. ')' } ]",
  22199. referencedClasses: ["String"],
  22200. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22201. }),
  22202. $globals.Package);
  22203. $core.addMethod(
  22204. $core.method({
  22205. selector: "eval:",
  22206. protocol: "evaluating",
  22207. fn: function (aString){
  22208. var self=this,$self=this;
  22209. return $core.withContext(function($ctx1) {
  22210. var $1,$receiver;
  22211. $1=$self["@evalBlock"];
  22212. if(($receiver = $1) == null || $receiver.a$nil){
  22213. return $recv($globals.Compiler)._eval_(aString);
  22214. } else {
  22215. return $recv($self["@evalBlock"])._value_(aString);
  22216. }
  22217. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22218. },
  22219. args: ["aString"],
  22220. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22221. referencedClasses: ["Compiler"],
  22222. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22223. }),
  22224. $globals.Package);
  22225. $core.addMethod(
  22226. $core.method({
  22227. selector: "evalBlock",
  22228. protocol: "accessing",
  22229. fn: function (){
  22230. var self=this,$self=this;
  22231. return $self["@evalBlock"];
  22232. },
  22233. args: [],
  22234. source: "evalBlock\x0a\x09^ evalBlock",
  22235. referencedClasses: [],
  22236. messageSends: []
  22237. }),
  22238. $globals.Package);
  22239. $core.addMethod(
  22240. $core.method({
  22241. selector: "evalBlock:",
  22242. protocol: "accessing",
  22243. fn: function (aBlock){
  22244. var self=this,$self=this;
  22245. $self["@evalBlock"]=aBlock;
  22246. return self;
  22247. },
  22248. args: ["aBlock"],
  22249. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22250. referencedClasses: [],
  22251. messageSends: []
  22252. }),
  22253. $globals.Package);
  22254. $core.addMethod(
  22255. $core.method({
  22256. selector: "imports",
  22257. protocol: "accessing",
  22258. fn: function (){
  22259. var self=this,$self=this;
  22260. return $core.withContext(function($ctx1) {
  22261. var $1,$receiver;
  22262. $1=$self["@imports"];
  22263. if(($receiver = $1) == null || $receiver.a$nil){
  22264. $self._imports_([]);
  22265. return $self["@imports"];
  22266. } else {
  22267. return $1;
  22268. }
  22269. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22270. },
  22271. args: [],
  22272. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22273. referencedClasses: [],
  22274. messageSends: ["ifNil:", "imports:"]
  22275. }),
  22276. $globals.Package);
  22277. $core.addMethod(
  22278. $core.method({
  22279. selector: "imports:",
  22280. protocol: "accessing",
  22281. fn: function (anArray){
  22282. var self=this,$self=this;
  22283. return $core.withContext(function($ctx1) {
  22284. $self._validateImports_(anArray);
  22285. $self["@imports"]=$recv(anArray)._asSet();
  22286. return self;
  22287. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22288. },
  22289. args: ["anArray"],
  22290. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22291. referencedClasses: [],
  22292. messageSends: ["validateImports:", "asSet"]
  22293. }),
  22294. $globals.Package);
  22295. $core.addMethod(
  22296. $core.method({
  22297. selector: "importsAsJson",
  22298. protocol: "converting",
  22299. fn: function (){
  22300. var self=this,$self=this;
  22301. return $core.withContext(function($ctx1) {
  22302. var $1;
  22303. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22304. return $core.withContext(function($ctx2) {
  22305. $1=$recv(each)._isString();
  22306. if($core.assert($1)){
  22307. return each;
  22308. } else {
  22309. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22310. $ctx2.sendIdx[","]=1;
  22311. }
  22312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22313. }));
  22314. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22315. },
  22316. args: [],
  22317. 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 ]]",
  22318. referencedClasses: [],
  22319. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22320. }),
  22321. $globals.Package);
  22322. $core.addMethod(
  22323. $core.method({
  22324. selector: "importsDefinition",
  22325. protocol: "accessing",
  22326. fn: function (){
  22327. var self=this,$self=this;
  22328. return $core.withContext(function($ctx1) {
  22329. return $recv($globals.String)._streamContents_((function(stream){
  22330. return $core.withContext(function($ctx2) {
  22331. $recv(stream)._write_("{");
  22332. $ctx2.sendIdx["write:"]=1;
  22333. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22334. return $core.withContext(function($ctx3) {
  22335. return $recv(stream)._print_(each);
  22336. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22337. }),(function(){
  22338. return $core.withContext(function($ctx3) {
  22339. return $recv(stream)._write_(". ");
  22340. $ctx3.sendIdx["write:"]=2;
  22341. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22342. }));
  22343. return $recv(stream)._write_("}");
  22344. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22345. }));
  22346. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22347. },
  22348. args: [],
  22349. 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: '}' ]",
  22350. referencedClasses: ["String"],
  22351. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22352. }),
  22353. $globals.Package);
  22354. $core.addMethod(
  22355. $core.method({
  22356. selector: "importsFromJson:",
  22357. protocol: "converting",
  22358. fn: function (anArray){
  22359. var self=this,$self=this;
  22360. return $core.withContext(function($ctx1) {
  22361. var $1;
  22362. return $recv(anArray)._collect_((function(each){
  22363. var split;
  22364. return $core.withContext(function($ctx2) {
  22365. split=$recv(each)._tokenize_("=");
  22366. split;
  22367. $1=$recv($recv(split)._size()).__eq((1));
  22368. if($core.assert($1)){
  22369. return $recv(split)._first();
  22370. $ctx2.sendIdx["first"]=1;
  22371. } else {
  22372. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22373. }
  22374. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22375. }));
  22376. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22377. },
  22378. args: ["anArray"],
  22379. 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 ]]",
  22380. referencedClasses: [],
  22381. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22382. }),
  22383. $globals.Package);
  22384. $core.addMethod(
  22385. $core.method({
  22386. selector: "initialize",
  22387. protocol: "initialization",
  22388. fn: function (){
  22389. var self=this,$self=this;
  22390. return $core.withContext(function($ctx1) {
  22391. (
  22392. $ctx1.supercall = true,
  22393. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22394. $ctx1.supercall = false;
  22395. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22396. $self["@evalBlock"]=nil;
  22397. $self["@dirty"]=nil;
  22398. $self["@imports"]=nil;
  22399. $self["@transport"]=nil;
  22400. return self;
  22401. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22402. },
  22403. args: [],
  22404. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22405. referencedClasses: ["PackageOrganizer"],
  22406. messageSends: ["initialize", "new"]
  22407. }),
  22408. $globals.Package);
  22409. $core.addMethod(
  22410. $core.method({
  22411. selector: "isDirty",
  22412. protocol: "testing",
  22413. fn: function (){
  22414. var self=this,$self=this;
  22415. return $core.withContext(function($ctx1) {
  22416. var $1,$receiver;
  22417. $1=$self["@dirty"];
  22418. if(($receiver = $1) == null || $receiver.a$nil){
  22419. return false;
  22420. } else {
  22421. return $1;
  22422. }
  22423. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22424. },
  22425. args: [],
  22426. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22427. referencedClasses: [],
  22428. messageSends: ["ifNil:"]
  22429. }),
  22430. $globals.Package);
  22431. $core.addMethod(
  22432. $core.method({
  22433. selector: "isPackage",
  22434. protocol: "testing",
  22435. fn: function (){
  22436. var self=this,$self=this;
  22437. return true;
  22438. },
  22439. args: [],
  22440. source: "isPackage\x0a\x09^ true",
  22441. referencedClasses: [],
  22442. messageSends: []
  22443. }),
  22444. $globals.Package);
  22445. $core.addMethod(
  22446. $core.method({
  22447. selector: "javaScriptDescriptor:",
  22448. protocol: "accessing",
  22449. fn: function (anObject){
  22450. var self=this,$self=this;
  22451. var basicEval,basicImports;
  22452. return $core.withContext(function($ctx1) {
  22453. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22454. return $core.withContext(function($ctx2) {
  22455. return nil._asJavaScriptObject();
  22456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22457. }));
  22458. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22459. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22460. return [];
  22461. }));
  22462. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22463. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22464. }));
  22465. $self._evalBlock_(basicEval);
  22466. $self._imports_($self._importsFromJson_(basicImports));
  22467. return self;
  22468. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22469. },
  22470. args: ["anObject"],
  22471. 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)",
  22472. referencedClasses: [],
  22473. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22474. }),
  22475. $globals.Package);
  22476. $core.addMethod(
  22477. $core.method({
  22478. selector: "loadDependencies",
  22479. protocol: "dependencies",
  22480. fn: function (){
  22481. var self=this,$self=this;
  22482. var classes,packages;
  22483. return $core.withContext(function($ctx1) {
  22484. var $1;
  22485. classes=$self._loadDependencyClasses();
  22486. $1=$recv($recv(classes)._collect_((function(each){
  22487. return $core.withContext(function($ctx2) {
  22488. return $recv(each)._package();
  22489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22490. })))._asSet();
  22491. $recv($1)._remove_ifAbsent_(self,(function(){
  22492. }));
  22493. return $recv($1)._yourself();
  22494. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22495. },
  22496. args: [],
  22497. 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",
  22498. referencedClasses: [],
  22499. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22500. }),
  22501. $globals.Package);
  22502. $core.addMethod(
  22503. $core.method({
  22504. selector: "loadDependencyClasses",
  22505. protocol: "dependencies",
  22506. fn: function (){
  22507. var self=this,$self=this;
  22508. var starCategoryName;
  22509. return $core.withContext(function($ctx1) {
  22510. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22511. starCategoryName="*".__comma($self._name());
  22512. $ctx1.sendIdx[","]=1;
  22513. $3=$self._classes();
  22514. $ctx1.sendIdx["classes"]=1;
  22515. $2=$recv($3)._collect_((function(each){
  22516. return $core.withContext(function($ctx2) {
  22517. return $recv(each)._superclass();
  22518. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22519. }));
  22520. $ctx1.sendIdx["collect:"]=1;
  22521. $1=$recv($2)._asSet();
  22522. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22523. return $core.withContext(function($ctx2) {
  22524. $5=$recv(each)._protocols();
  22525. $ctx2.sendIdx["protocols"]=1;
  22526. $7=$recv(each)._theMetaClass();
  22527. if(($receiver = $7) == null || $receiver.a$nil){
  22528. $6=[];
  22529. } else {
  22530. var meta;
  22531. meta=$receiver;
  22532. $6=$recv(meta)._protocols();
  22533. }
  22534. $4=$recv($5).__comma($6);
  22535. return $recv($4)._includes_(starCategoryName);
  22536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22537. })));
  22538. $ctx1.sendIdx["addAll:"]=1;
  22539. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22540. return $core.withContext(function($ctx2) {
  22541. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22542. return $core.withContext(function($ctx3) {
  22543. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22544. return $core.withContext(function($ctx4) {
  22545. return $recv(eachTT)._trait();
  22546. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22547. })));
  22548. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22549. }));
  22550. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22551. })));
  22552. $recv($1)._remove_ifAbsent_(nil,(function(){
  22553. }));
  22554. return $recv($1)._yourself();
  22555. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22556. },
  22557. args: [],
  22558. 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",
  22559. referencedClasses: ["Smalltalk", "Array"],
  22560. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22561. }),
  22562. $globals.Package);
  22563. $core.addMethod(
  22564. $core.method({
  22565. selector: "name",
  22566. protocol: "accessing",
  22567. fn: function (){
  22568. var self=this,$self=this;
  22569. return $self["@name"];
  22570. },
  22571. args: [],
  22572. source: "name\x0a\x09^ name",
  22573. referencedClasses: [],
  22574. messageSends: []
  22575. }),
  22576. $globals.Package);
  22577. $core.addMethod(
  22578. $core.method({
  22579. selector: "name:",
  22580. protocol: "accessing",
  22581. fn: function (aString){
  22582. var self=this,$self=this;
  22583. $self["@name"]=aString;
  22584. return self;
  22585. },
  22586. args: ["aString"],
  22587. source: "name: aString\x0a\x09name := aString",
  22588. referencedClasses: [],
  22589. messageSends: []
  22590. }),
  22591. $globals.Package);
  22592. $core.addMethod(
  22593. $core.method({
  22594. selector: "organization",
  22595. protocol: "accessing",
  22596. fn: function (){
  22597. var self=this,$self=this;
  22598. return $self["@organization"];
  22599. },
  22600. args: [],
  22601. source: "organization\x0a\x09^ organization",
  22602. referencedClasses: [],
  22603. messageSends: []
  22604. }),
  22605. $globals.Package);
  22606. $core.addMethod(
  22607. $core.method({
  22608. selector: "printOn:",
  22609. protocol: "printing",
  22610. fn: function (aStream){
  22611. var self=this,$self=this;
  22612. return $core.withContext(function($ctx1) {
  22613. (
  22614. $ctx1.supercall = true,
  22615. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22616. $ctx1.supercall = false;
  22617. $recv(aStream)._nextPutAll_(" (");
  22618. $ctx1.sendIdx["nextPutAll:"]=1;
  22619. $recv(aStream)._nextPutAll_($self._name());
  22620. $ctx1.sendIdx["nextPutAll:"]=2;
  22621. $recv(aStream)._nextPutAll_(")");
  22622. return self;
  22623. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22624. },
  22625. args: ["aStream"],
  22626. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22627. referencedClasses: [],
  22628. messageSends: ["printOn:", "nextPutAll:", "name"]
  22629. }),
  22630. $globals.Package);
  22631. $core.addMethod(
  22632. $core.method({
  22633. selector: "setupClasses",
  22634. protocol: "classes",
  22635. fn: function (){
  22636. var self=this,$self=this;
  22637. return $core.withContext(function($ctx1) {
  22638. $recv($self._classes())._do_((function(each){
  22639. return $core.withContext(function($ctx2) {
  22640. return $recv(each)._initialize();
  22641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22642. }));
  22643. return self;
  22644. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22645. },
  22646. args: [],
  22647. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22648. referencedClasses: [],
  22649. messageSends: ["do:", "classes", "initialize"]
  22650. }),
  22651. $globals.Package);
  22652. $core.addMethod(
  22653. $core.method({
  22654. selector: "sortedClasses",
  22655. protocol: "classes",
  22656. fn: function (){
  22657. var self=this,$self=this;
  22658. return $core.withContext(function($ctx1) {
  22659. return $recv($self._class())._sortedClasses_($self._classes());
  22660. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22661. },
  22662. args: [],
  22663. 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",
  22664. referencedClasses: [],
  22665. messageSends: ["sortedClasses:", "class", "classes"]
  22666. }),
  22667. $globals.Package);
  22668. $core.addMethod(
  22669. $core.method({
  22670. selector: "sortedImportsAsArray",
  22671. protocol: "private",
  22672. fn: function (){
  22673. var self=this,$self=this;
  22674. return $core.withContext(function($ctx1) {
  22675. var $3,$2,$4,$1,$6,$5,$7;
  22676. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22677. return $core.withContext(function($ctx2) {
  22678. $3=$recv(a)._isString();
  22679. $ctx2.sendIdx["isString"]=1;
  22680. $2=$recv($3)._not();
  22681. $4=$recv(b)._isString();
  22682. $ctx2.sendIdx["isString"]=2;
  22683. $1=$recv($2).__and($4);
  22684. return $recv($1)._or_((function(){
  22685. return $core.withContext(function($ctx3) {
  22686. $6=$recv(a)._isString();
  22687. $ctx3.sendIdx["isString"]=3;
  22688. $5=$recv($6).__eq($recv(b)._isString());
  22689. return $recv($5)._and_((function(){
  22690. return $core.withContext(function($ctx4) {
  22691. $7=$recv(a)._value();
  22692. $ctx4.sendIdx["value"]=1;
  22693. return $recv($7).__lt_eq($recv(b)._value());
  22694. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22695. }));
  22696. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22697. }));
  22698. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22699. }));
  22700. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22701. },
  22702. args: [],
  22703. 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 ]]]",
  22704. referencedClasses: [],
  22705. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22706. }),
  22707. $globals.Package);
  22708. $core.addMethod(
  22709. $core.method({
  22710. selector: "traitCompositions",
  22711. protocol: "dependencies",
  22712. fn: function (){
  22713. var self=this,$self=this;
  22714. var traitCompositions;
  22715. return $core.withContext(function($ctx1) {
  22716. var $1,$2,$3,$receiver;
  22717. traitCompositions=$recv($globals.Dictionary)._new();
  22718. $recv($self._classes())._do_((function(each){
  22719. return $core.withContext(function($ctx2) {
  22720. $1=traitCompositions;
  22721. $2=$recv(each)._traitComposition();
  22722. $ctx2.sendIdx["traitComposition"]=1;
  22723. $recv($1)._at_put_(each,$2);
  22724. $ctx2.sendIdx["at:put:"]=1;
  22725. $3=$recv(each)._theMetaClass();
  22726. if(($receiver = $3) == null || $receiver.a$nil){
  22727. return $3;
  22728. } else {
  22729. var meta;
  22730. meta=$receiver;
  22731. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22732. }
  22733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22734. }));
  22735. return $recv(traitCompositions)._reject_((function(each){
  22736. return $core.withContext(function($ctx2) {
  22737. return $recv(each)._isEmpty();
  22738. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22739. }));
  22740. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22741. },
  22742. args: [],
  22743. 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 ]",
  22744. referencedClasses: ["Dictionary"],
  22745. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22746. }),
  22747. $globals.Package);
  22748. $core.addMethod(
  22749. $core.method({
  22750. selector: "transport",
  22751. protocol: "accessing",
  22752. fn: function (){
  22753. var self=this,$self=this;
  22754. return $core.withContext(function($ctx1) {
  22755. var $1,$receiver;
  22756. $1=$self["@transport"];
  22757. if(($receiver = $1) == null || $receiver.a$nil){
  22758. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22759. return $self["@transport"];
  22760. } else {
  22761. return $1;
  22762. }
  22763. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22764. },
  22765. args: [],
  22766. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22767. referencedClasses: ["PackageTransport"],
  22768. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22769. }),
  22770. $globals.Package);
  22771. $core.addMethod(
  22772. $core.method({
  22773. selector: "transport:",
  22774. protocol: "accessing",
  22775. fn: function (aPackageTransport){
  22776. var self=this,$self=this;
  22777. return $core.withContext(function($ctx1) {
  22778. $self["@transport"]=aPackageTransport;
  22779. $recv(aPackageTransport)._package_(self);
  22780. return self;
  22781. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22782. },
  22783. args: ["aPackageTransport"],
  22784. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22785. referencedClasses: [],
  22786. messageSends: ["package:"]
  22787. }),
  22788. $globals.Package);
  22789. $core.addMethod(
  22790. $core.method({
  22791. selector: "validateImports:",
  22792. protocol: "validation",
  22793. fn: function (aCollection){
  22794. var self=this,$self=this;
  22795. return $core.withContext(function($ctx1) {
  22796. var $1,$2,$5,$4,$3,$6;
  22797. $recv(aCollection)._do_((function(import_){
  22798. return $core.withContext(function($ctx2) {
  22799. $1=$recv(import_)._isString();
  22800. $ctx2.sendIdx["isString"]=1;
  22801. if(!$core.assert($1)){
  22802. $2=$recv(import_)._respondsTo_("key");
  22803. if(!$core.assert($2)){
  22804. $self._error_("Imports must be Strings or Associations");
  22805. $ctx2.sendIdx["error:"]=1;
  22806. }
  22807. $5=$recv(import_)._key();
  22808. $ctx2.sendIdx["key"]=1;
  22809. $4=$recv($5)._isString();
  22810. $ctx2.sendIdx["isString"]=2;
  22811. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22812. if(!$core.assert($3)){
  22813. $self._error_("Key and value must be Strings");
  22814. $ctx2.sendIdx["error:"]=2;
  22815. }
  22816. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22817. if(!$core.assert($6)){
  22818. return $self._error_("Keys must be identifiers");
  22819. }
  22820. }
  22821. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22822. }));
  22823. return self;
  22824. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22825. },
  22826. args: ["aCollection"],
  22827. 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' ]]]",
  22828. referencedClasses: [],
  22829. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22830. }),
  22831. $globals.Package);
  22832. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22833. $core.addMethod(
  22834. $core.method({
  22835. selector: "named:",
  22836. protocol: "accessing",
  22837. fn: function (aPackageName){
  22838. var self=this,$self=this;
  22839. return $core.withContext(function($ctx1) {
  22840. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22841. return $core.withContext(function($ctx2) {
  22842. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22844. }));
  22845. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22846. },
  22847. args: ["aPackageName"],
  22848. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22849. referencedClasses: ["Smalltalk"],
  22850. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22851. }),
  22852. $globals.Package.a$cls);
  22853. $core.addMethod(
  22854. $core.method({
  22855. selector: "named:ifAbsent:",
  22856. protocol: "accessing",
  22857. fn: function (aPackageName,aBlock){
  22858. var self=this,$self=this;
  22859. return $core.withContext(function($ctx1) {
  22860. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22861. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22862. },
  22863. args: ["aPackageName", "aBlock"],
  22864. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22865. referencedClasses: ["Smalltalk"],
  22866. messageSends: ["packageAt:ifAbsent:"]
  22867. }),
  22868. $globals.Package.a$cls);
  22869. $core.addMethod(
  22870. $core.method({
  22871. selector: "named:imports:transport:",
  22872. protocol: "accessing",
  22873. fn: function (aPackageName,anArray,aTransport){
  22874. var self=this,$self=this;
  22875. var pkg;
  22876. return $core.withContext(function($ctx1) {
  22877. pkg=$self._named_(aPackageName);
  22878. $recv(pkg)._imports_(anArray);
  22879. $recv(pkg)._transport_(aTransport);
  22880. return pkg;
  22881. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22882. },
  22883. args: ["aPackageName", "anArray", "aTransport"],
  22884. 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",
  22885. referencedClasses: [],
  22886. messageSends: ["named:", "imports:", "transport:"]
  22887. }),
  22888. $globals.Package.a$cls);
  22889. $core.addMethod(
  22890. $core.method({
  22891. selector: "named:javaScriptDescriptor:",
  22892. protocol: "instance creation",
  22893. fn: function (aString,anObject){
  22894. var self=this,$self=this;
  22895. var pkg;
  22896. return $core.withContext(function($ctx1) {
  22897. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22898. $recv(pkg)._javaScriptDescriptor_(anObject);
  22899. return pkg;
  22900. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22901. },
  22902. args: ["aString", "anObject"],
  22903. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22904. referencedClasses: ["Smalltalk"],
  22905. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22906. }),
  22907. $globals.Package.a$cls);
  22908. $core.addMethod(
  22909. $core.method({
  22910. selector: "named:transport:",
  22911. protocol: "accessing",
  22912. fn: function (aPackageName,aTransport){
  22913. var self=this,$self=this;
  22914. var pkg;
  22915. return $core.withContext(function($ctx1) {
  22916. pkg=$self._named_(aPackageName);
  22917. $recv(pkg)._transport_(aTransport);
  22918. return pkg;
  22919. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22920. },
  22921. args: ["aPackageName", "aTransport"],
  22922. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22923. referencedClasses: [],
  22924. messageSends: ["named:", "transport:"]
  22925. }),
  22926. $globals.Package.a$cls);
  22927. $core.addMethod(
  22928. $core.method({
  22929. selector: "new:",
  22930. protocol: "instance creation",
  22931. fn: function (aString){
  22932. var self=this,$self=this;
  22933. return $core.withContext(function($ctx1) {
  22934. var $1;
  22935. $1=$recv($globals.Package)._new();
  22936. $recv($1)._name_(aString);
  22937. return $recv($1)._yourself();
  22938. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  22939. },
  22940. args: ["aString"],
  22941. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22942. referencedClasses: ["Package"],
  22943. messageSends: ["name:", "new", "yourself"]
  22944. }),
  22945. $globals.Package.a$cls);
  22946. $core.addMethod(
  22947. $core.method({
  22948. selector: "sortedClasses:",
  22949. protocol: "sorting",
  22950. fn: function (classes){
  22951. var self=this,$self=this;
  22952. var children,others,nodes,expandedClasses;
  22953. return $core.withContext(function($ctx1) {
  22954. var $1,$3,$2;
  22955. children=[];
  22956. others=[];
  22957. $recv(classes)._do_((function(each){
  22958. return $core.withContext(function($ctx2) {
  22959. $1=$recv(classes)._includes_($recv(each)._superclass());
  22960. if($core.assert($1)){
  22961. return $recv(others)._add_(each);
  22962. } else {
  22963. return $recv(children)._add_(each);
  22964. $ctx2.sendIdx["add:"]=1;
  22965. }
  22966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22967. }));
  22968. $ctx1.sendIdx["do:"]=1;
  22969. nodes=$recv(children)._collect_((function(each){
  22970. return $core.withContext(function($ctx2) {
  22971. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  22972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  22973. }));
  22974. nodes=$recv(nodes)._sorted_((function(a,b){
  22975. return $core.withContext(function($ctx2) {
  22976. $3=$recv(a)._theClass();
  22977. $ctx2.sendIdx["theClass"]=1;
  22978. $2=$recv($3)._name();
  22979. $ctx2.sendIdx["name"]=1;
  22980. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  22981. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  22982. }));
  22983. expandedClasses=$recv($globals.Array)._new();
  22984. $recv(nodes)._do_((function(aNode){
  22985. return $core.withContext(function($ctx2) {
  22986. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  22987. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  22988. }));
  22989. return expandedClasses;
  22990. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  22991. },
  22992. args: ["classes"],
  22993. 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",
  22994. referencedClasses: ["ClassSorterNode", "Array"],
  22995. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  22996. }),
  22997. $globals.Package.a$cls);
  22998. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  22999. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23000. $core.addMethod(
  23001. $core.method({
  23002. selector: "announcer",
  23003. protocol: "accessing",
  23004. fn: function (){
  23005. var self=this,$self=this;
  23006. return $core.withContext(function($ctx1) {
  23007. return $recv($globals.SystemAnnouncer)._current();
  23008. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23009. },
  23010. args: [],
  23011. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23012. referencedClasses: ["SystemAnnouncer"],
  23013. messageSends: ["current"]
  23014. }),
  23015. $globals.PackageStateObserver);
  23016. $core.addMethod(
  23017. $core.method({
  23018. selector: "observeSystem",
  23019. protocol: "actions",
  23020. fn: function (){
  23021. var self=this,$self=this;
  23022. return $core.withContext(function($ctx1) {
  23023. var $1;
  23024. $1=$self._announcer();
  23025. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23026. $ctx1.sendIdx["on:send:to:"]=1;
  23027. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23028. $ctx1.sendIdx["on:send:to:"]=2;
  23029. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23030. $ctx1.sendIdx["on:send:to:"]=3;
  23031. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23032. return self;
  23033. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23034. },
  23035. args: [],
  23036. 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",
  23037. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23038. messageSends: ["on:send:to:", "announcer"]
  23039. }),
  23040. $globals.PackageStateObserver);
  23041. $core.addMethod(
  23042. $core.method({
  23043. selector: "onClassModification:",
  23044. protocol: "reactions",
  23045. fn: function (anAnnouncement){
  23046. var self=this,$self=this;
  23047. return $core.withContext(function($ctx1) {
  23048. var $1,$receiver;
  23049. $1=$recv(anAnnouncement)._theClass();
  23050. if(($receiver = $1) == null || $receiver.a$nil){
  23051. $1;
  23052. } else {
  23053. var theClass;
  23054. theClass=$receiver;
  23055. $recv($recv(theClass)._package())._beDirty();
  23056. }
  23057. return self;
  23058. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23059. },
  23060. args: ["anAnnouncement"],
  23061. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23062. referencedClasses: [],
  23063. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23064. }),
  23065. $globals.PackageStateObserver);
  23066. $core.addMethod(
  23067. $core.method({
  23068. selector: "onMethodModification:",
  23069. protocol: "reactions",
  23070. fn: function (anAnnouncement){
  23071. var self=this,$self=this;
  23072. return $core.withContext(function($ctx1) {
  23073. var $1,$receiver;
  23074. $1=$recv($recv(anAnnouncement)._method())._package();
  23075. if(($receiver = $1) == null || $receiver.a$nil){
  23076. $1;
  23077. } else {
  23078. var package_;
  23079. package_=$receiver;
  23080. $recv(package_)._beDirty();
  23081. }
  23082. return self;
  23083. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23084. },
  23085. args: ["anAnnouncement"],
  23086. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23087. referencedClasses: [],
  23088. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23089. }),
  23090. $globals.PackageStateObserver);
  23091. $core.addMethod(
  23092. $core.method({
  23093. selector: "onPackageAdded:",
  23094. protocol: "reactions",
  23095. fn: function (anAnnouncement){
  23096. var self=this,$self=this;
  23097. return $core.withContext(function($ctx1) {
  23098. $recv($recv(anAnnouncement)._package())._beDirty();
  23099. return self;
  23100. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23101. },
  23102. args: ["anAnnouncement"],
  23103. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23104. referencedClasses: [],
  23105. messageSends: ["beDirty", "package"]
  23106. }),
  23107. $globals.PackageStateObserver);
  23108. $core.addMethod(
  23109. $core.method({
  23110. selector: "onProtocolModification:",
  23111. protocol: "reactions",
  23112. fn: function (anAnnouncement){
  23113. var self=this,$self=this;
  23114. return $core.withContext(function($ctx1) {
  23115. var $1,$receiver;
  23116. $1=$recv(anAnnouncement)._package();
  23117. if(($receiver = $1) == null || $receiver.a$nil){
  23118. $1;
  23119. } else {
  23120. var package_;
  23121. package_=$receiver;
  23122. $recv(package_)._beDirty();
  23123. }
  23124. return self;
  23125. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23126. },
  23127. args: ["anAnnouncement"],
  23128. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23129. referencedClasses: [],
  23130. messageSends: ["ifNotNil:", "package", "beDirty"]
  23131. }),
  23132. $globals.PackageStateObserver);
  23133. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23134. $core.addMethod(
  23135. $core.method({
  23136. selector: "current",
  23137. protocol: "accessing",
  23138. fn: function (){
  23139. var self=this,$self=this;
  23140. return $core.withContext(function($ctx1) {
  23141. var $1,$receiver;
  23142. $1=$self["@current"];
  23143. if(($receiver = $1) == null || $receiver.a$nil){
  23144. $self["@current"]=$self._new();
  23145. return $self["@current"];
  23146. } else {
  23147. return $1;
  23148. }
  23149. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23150. },
  23151. args: [],
  23152. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23153. referencedClasses: [],
  23154. messageSends: ["ifNil:", "new"]
  23155. }),
  23156. $globals.PackageStateObserver.a$cls);
  23157. $core.addMethod(
  23158. $core.method({
  23159. selector: "initialize",
  23160. protocol: "initialization",
  23161. fn: function (){
  23162. var self=this,$self=this;
  23163. return $core.withContext(function($ctx1) {
  23164. $recv($self._current())._observeSystem();
  23165. return self;
  23166. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23167. },
  23168. args: [],
  23169. source: "initialize\x0a\x09self current observeSystem",
  23170. referencedClasses: [],
  23171. messageSends: ["observeSystem", "current"]
  23172. }),
  23173. $globals.PackageStateObserver.a$cls);
  23174. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23175. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23176. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23177. $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`";
  23178. $core.addMethod(
  23179. $core.method({
  23180. selector: "defaultValue",
  23181. protocol: "accessing",
  23182. fn: function (){
  23183. var self=this,$self=this;
  23184. return $self["@defaultValue"];
  23185. },
  23186. args: [],
  23187. source: "defaultValue\x0a\x09^ defaultValue",
  23188. referencedClasses: [],
  23189. messageSends: []
  23190. }),
  23191. $globals.Setting);
  23192. $core.addMethod(
  23193. $core.method({
  23194. selector: "defaultValue:",
  23195. protocol: "accessing",
  23196. fn: function (aStringifiableObject){
  23197. var self=this,$self=this;
  23198. $self["@defaultValue"]=aStringifiableObject;
  23199. return self;
  23200. },
  23201. args: ["aStringifiableObject"],
  23202. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23203. referencedClasses: [],
  23204. messageSends: []
  23205. }),
  23206. $globals.Setting);
  23207. $core.addMethod(
  23208. $core.method({
  23209. selector: "key",
  23210. protocol: "accessing",
  23211. fn: function (){
  23212. var self=this,$self=this;
  23213. return $self["@key"];
  23214. },
  23215. args: [],
  23216. source: "key\x0a\x09^ key",
  23217. referencedClasses: [],
  23218. messageSends: []
  23219. }),
  23220. $globals.Setting);
  23221. $core.addMethod(
  23222. $core.method({
  23223. selector: "key:",
  23224. protocol: "accessing",
  23225. fn: function (aString){
  23226. var self=this,$self=this;
  23227. $self["@key"]=aString;
  23228. return self;
  23229. },
  23230. args: ["aString"],
  23231. source: "key: aString\x0a\x09key := aString",
  23232. referencedClasses: [],
  23233. messageSends: []
  23234. }),
  23235. $globals.Setting);
  23236. $core.addMethod(
  23237. $core.method({
  23238. selector: "value",
  23239. protocol: "accessing",
  23240. fn: function (){
  23241. var self=this,$self=this;
  23242. return $core.withContext(function($ctx1) {
  23243. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23244. return $core.withContext(function($ctx2) {
  23245. return $self._defaultValue();
  23246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23247. }));
  23248. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23249. },
  23250. args: [],
  23251. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23252. referencedClasses: ["Smalltalk"],
  23253. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23254. }),
  23255. $globals.Setting);
  23256. $core.addMethod(
  23257. $core.method({
  23258. selector: "value:",
  23259. protocol: "accessing",
  23260. fn: function (aStringifiableObject){
  23261. var self=this,$self=this;
  23262. return $core.withContext(function($ctx1) {
  23263. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23264. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23265. },
  23266. args: ["aStringifiableObject"],
  23267. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23268. referencedClasses: ["Smalltalk"],
  23269. messageSends: ["at:put:", "settings", "key"]
  23270. }),
  23271. $globals.Setting);
  23272. $core.addMethod(
  23273. $core.method({
  23274. selector: "at:ifAbsent:",
  23275. protocol: "instance creation",
  23276. fn: function (aString,aDefaultValue){
  23277. var self=this,$self=this;
  23278. return $core.withContext(function($ctx1) {
  23279. var $1;
  23280. $1=(
  23281. $ctx1.supercall = true,
  23282. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23283. $ctx1.supercall = false;
  23284. $recv($1)._key_(aString);
  23285. $recv($1)._defaultValue_(aDefaultValue);
  23286. return $recv($1)._yourself();
  23287. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23288. },
  23289. args: ["aString", "aDefaultValue"],
  23290. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23291. referencedClasses: [],
  23292. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23293. }),
  23294. $globals.Setting.a$cls);
  23295. $core.addMethod(
  23296. $core.method({
  23297. selector: "new",
  23298. protocol: "instance creation",
  23299. fn: function (){
  23300. var self=this,$self=this;
  23301. return $core.withContext(function($ctx1) {
  23302. $self._shouldNotImplement();
  23303. return self;
  23304. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23305. },
  23306. args: [],
  23307. source: "new\x0a\x09self shouldNotImplement",
  23308. referencedClasses: [],
  23309. messageSends: ["shouldNotImplement"]
  23310. }),
  23311. $globals.Setting.a$cls);
  23312. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23313. $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.";
  23314. $core.addMethod(
  23315. $core.method({
  23316. selector: "addGlobalJsVariable:",
  23317. protocol: "globals",
  23318. fn: function (aString){
  23319. var self=this,$self=this;
  23320. return $core.withContext(function($ctx1) {
  23321. $recv($self._globalJsVariables())._add_(aString);
  23322. return self;
  23323. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23324. },
  23325. args: ["aString"],
  23326. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23327. referencedClasses: [],
  23328. messageSends: ["add:", "globalJsVariables"]
  23329. }),
  23330. $globals.SmalltalkImage);
  23331. $core.addMethod(
  23332. $core.method({
  23333. selector: "adoptPackageDictionary",
  23334. protocol: "private",
  23335. fn: function (){
  23336. var self=this,$self=this;
  23337. return $core.withContext(function($ctx1) {
  23338. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23339. return $core.withContext(function($ctx2) {
  23340. return $recv($globals.Package)._named_javaScriptDescriptor_(key,value);
  23341. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23342. }));
  23343. return self;
  23344. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDictionary",{},$globals.SmalltalkImage)});
  23345. },
  23346. args: [],
  23347. source: "adoptPackageDictionary\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]",
  23348. referencedClasses: ["Package"],
  23349. messageSends: ["keysAndValuesDo:", "packageDescriptors", "core", "named:javaScriptDescriptor:"]
  23350. }),
  23351. $globals.SmalltalkImage);
  23352. $core.addMethod(
  23353. $core.method({
  23354. selector: "amdRequire",
  23355. protocol: "accessing amd",
  23356. fn: function (){
  23357. var self=this,$self=this;
  23358. return $core.withContext(function($ctx1) {
  23359. return $recv($self._core())._at_("amdRequire");
  23360. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23361. },
  23362. args: [],
  23363. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23364. referencedClasses: [],
  23365. messageSends: ["at:", "core"]
  23366. }),
  23367. $globals.SmalltalkImage);
  23368. $core.addMethod(
  23369. $core.method({
  23370. selector: "asSmalltalkException:",
  23371. protocol: "error handling",
  23372. fn: function (anObject){
  23373. var self=this,$self=this;
  23374. return $core.withContext(function($ctx1) {
  23375. var $1;
  23376. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23377. return $core.withContext(function($ctx2) {
  23378. return $recv(anObject)._isKindOf_($globals.Error);
  23379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23380. }));
  23381. if($core.assert($1)){
  23382. return anObject;
  23383. } else {
  23384. return $recv($globals.JavaScriptException)._on_(anObject);
  23385. }
  23386. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23387. },
  23388. args: ["anObject"],
  23389. 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 ]",
  23390. referencedClasses: ["Error", "JavaScriptException"],
  23391. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23392. }),
  23393. $globals.SmalltalkImage);
  23394. $core.addMethod(
  23395. $core.method({
  23396. selector: "basicCreatePackage:",
  23397. protocol: "private",
  23398. fn: function (packageName){
  23399. var self=this,$self=this;
  23400. return $core.withContext(function($ctx1) {
  23401. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23402. return $core.withContext(function($ctx2) {
  23403. return $recv($globals.Package)._new_(packageName);
  23404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23405. }));
  23406. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23407. },
  23408. args: ["packageName"],
  23409. 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 ]",
  23410. referencedClasses: ["Package"],
  23411. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23412. }),
  23413. $globals.SmalltalkImage);
  23414. $core.addMethod(
  23415. $core.method({
  23416. selector: "basicParse:",
  23417. protocol: "private",
  23418. fn: function (aString){
  23419. var self=this,$self=this;
  23420. return $core.withContext(function($ctx1) {
  23421. return $recv($globals.SmalltalkParser)._parse_(aString);
  23422. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23423. },
  23424. args: ["aString"],
  23425. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23426. referencedClasses: ["SmalltalkParser"],
  23427. messageSends: ["parse:"]
  23428. }),
  23429. $globals.SmalltalkImage);
  23430. $core.addMethod(
  23431. $core.method({
  23432. selector: "cancelOptOut:",
  23433. protocol: "accessing",
  23434. fn: function (anObject){
  23435. var self=this,$self=this;
  23436. return $core.withContext(function($ctx1) {
  23437. delete anObject.klass; delete anObject.a$cls;;
  23438. return self;
  23439. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23440. },
  23441. args: ["anObject"],
  23442. 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;'>",
  23443. referencedClasses: [],
  23444. messageSends: []
  23445. }),
  23446. $globals.SmalltalkImage);
  23447. $core.addMethod(
  23448. $core.method({
  23449. selector: "classes",
  23450. protocol: "classes",
  23451. fn: function (){
  23452. var self=this,$self=this;
  23453. return $core.withContext(function($ctx1) {
  23454. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23455. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23456. },
  23457. args: [],
  23458. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23459. referencedClasses: [],
  23460. messageSends: ["copy", "traitsOrClasses", "core"]
  23461. }),
  23462. $globals.SmalltalkImage);
  23463. $core.addMethod(
  23464. $core.method({
  23465. selector: "core",
  23466. protocol: "accessing",
  23467. fn: function (){
  23468. var self=this,$self=this;
  23469. return $core.withContext(function($ctx1) {
  23470. return $core;
  23471. return self;
  23472. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23473. },
  23474. args: [],
  23475. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23476. referencedClasses: [],
  23477. messageSends: []
  23478. }),
  23479. $globals.SmalltalkImage);
  23480. $core.addMethod(
  23481. $core.method({
  23482. selector: "createPackage:",
  23483. protocol: "packages",
  23484. fn: function (packageName){
  23485. var self=this,$self=this;
  23486. var package_,announcement;
  23487. return $core.withContext(function($ctx1) {
  23488. var $1;
  23489. package_=$self._basicCreatePackage_(packageName);
  23490. $1=$recv($globals.PackageAdded)._new();
  23491. $recv($1)._package_(package_);
  23492. announcement=$recv($1)._yourself();
  23493. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23494. return package_;
  23495. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23496. },
  23497. args: ["packageName"],
  23498. 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",
  23499. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23500. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23501. }),
  23502. $globals.SmalltalkImage);
  23503. $core.addMethod(
  23504. $core.method({
  23505. selector: "defaultAmdNamespace",
  23506. protocol: "accessing amd",
  23507. fn: function (){
  23508. var self=this,$self=this;
  23509. return $core.withContext(function($ctx1) {
  23510. return "transport.defaultAmdNamespace"._settingValue();
  23511. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23512. },
  23513. args: [],
  23514. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23515. referencedClasses: [],
  23516. messageSends: ["settingValue"]
  23517. }),
  23518. $globals.SmalltalkImage);
  23519. $core.addMethod(
  23520. $core.method({
  23521. selector: "defaultAmdNamespace:",
  23522. protocol: "accessing amd",
  23523. fn: function (aString){
  23524. var self=this,$self=this;
  23525. return $core.withContext(function($ctx1) {
  23526. "transport.defaultAmdNamespace"._settingValue_(aString);
  23527. return self;
  23528. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23529. },
  23530. args: ["aString"],
  23531. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23532. referencedClasses: [],
  23533. messageSends: ["settingValue:"]
  23534. }),
  23535. $globals.SmalltalkImage);
  23536. $core.addMethod(
  23537. $core.method({
  23538. selector: "deleteClass:",
  23539. protocol: "private",
  23540. fn: function (aClass){
  23541. var self=this,$self=this;
  23542. return $core.withContext(function($ctx1) {
  23543. $core.removeClass(aClass);
  23544. return self;
  23545. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23546. },
  23547. args: ["aClass"],
  23548. 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)'>",
  23549. referencedClasses: [],
  23550. messageSends: []
  23551. }),
  23552. $globals.SmalltalkImage);
  23553. $core.addMethod(
  23554. $core.method({
  23555. selector: "deleteGlobalJsVariable:",
  23556. protocol: "globals",
  23557. fn: function (aString){
  23558. var self=this,$self=this;
  23559. return $core.withContext(function($ctx1) {
  23560. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23561. }));
  23562. return self;
  23563. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23564. },
  23565. args: ["aString"],
  23566. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23567. referencedClasses: [],
  23568. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23569. }),
  23570. $globals.SmalltalkImage);
  23571. $core.addMethod(
  23572. $core.method({
  23573. selector: "existsJsGlobal:",
  23574. protocol: "testing",
  23575. fn: function (aString){
  23576. var self=this,$self=this;
  23577. return $core.withContext(function($ctx1) {
  23578. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  23579. return true;
  23580. }),(function(){
  23581. return false;
  23582. }));
  23583. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23584. },
  23585. args: ["aString"],
  23586. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  23587. referencedClasses: ["Platform"],
  23588. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  23589. }),
  23590. $globals.SmalltalkImage);
  23591. $core.addMethod(
  23592. $core.method({
  23593. selector: "globalJsVariables",
  23594. protocol: "globals",
  23595. fn: function (){
  23596. var self=this,$self=this;
  23597. return $core.withContext(function($ctx1) {
  23598. var $1,$receiver;
  23599. $1=$self["@globalJsVariables"];
  23600. if(($receiver = $1) == null || $receiver.a$nil){
  23601. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23602. return $self["@globalJsVariables"];
  23603. } else {
  23604. return $1;
  23605. }
  23606. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23607. },
  23608. args: [],
  23609. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23610. referencedClasses: [],
  23611. messageSends: ["ifNil:"]
  23612. }),
  23613. $globals.SmalltalkImage);
  23614. $core.addMethod(
  23615. $core.method({
  23616. selector: "globals",
  23617. protocol: "accessing",
  23618. fn: function (){
  23619. var self=this,$self=this;
  23620. return $core.withContext(function($ctx1) {
  23621. return $globals;
  23622. return self;
  23623. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23624. },
  23625. args: [],
  23626. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23627. referencedClasses: [],
  23628. messageSends: []
  23629. }),
  23630. $globals.SmalltalkImage);
  23631. $core.addMethod(
  23632. $core.method({
  23633. selector: "includesKey:",
  23634. protocol: "accessing",
  23635. fn: function (aKey){
  23636. var self=this,$self=this;
  23637. return $core.withContext(function($ctx1) {
  23638. return $core.hasOwnProperty(aKey);
  23639. return self;
  23640. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23641. },
  23642. args: ["aKey"],
  23643. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23644. referencedClasses: [],
  23645. messageSends: []
  23646. }),
  23647. $globals.SmalltalkImage);
  23648. $core.addMethod(
  23649. $core.method({
  23650. selector: "isSmalltalkObject:",
  23651. protocol: "testing",
  23652. fn: function (anObject){
  23653. var self=this,$self=this;
  23654. return $core.withContext(function($ctx1) {
  23655. return anObject.a$cls != null;
  23656. return self;
  23657. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23658. },
  23659. args: ["anObject"],
  23660. 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'>",
  23661. referencedClasses: [],
  23662. messageSends: []
  23663. }),
  23664. $globals.SmalltalkImage);
  23665. $core.addMethod(
  23666. $core.method({
  23667. selector: "optOut:",
  23668. protocol: "accessing",
  23669. fn: function (anObject){
  23670. var self=this,$self=this;
  23671. return $core.withContext(function($ctx1) {
  23672. anObject.klass = null; anObject.a$cls = null;
  23673. return self;
  23674. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23675. },
  23676. args: ["anObject"],
  23677. 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'>",
  23678. referencedClasses: [],
  23679. messageSends: []
  23680. }),
  23681. $globals.SmalltalkImage);
  23682. $core.addMethod(
  23683. $core.method({
  23684. selector: "packageAt:",
  23685. protocol: "packages",
  23686. fn: function (packageName){
  23687. var self=this,$self=this;
  23688. return $core.withContext(function($ctx1) {
  23689. $self._deprecatedAPI_("Use #packageAt:ifAbsent: directly.");
  23690. return $self._packageAt_ifAbsent_(packageName,(function(){
  23691. }));
  23692. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  23693. },
  23694. args: ["packageName"],
  23695. source: "packageAt: packageName\x0a\x09self deprecatedAPI: 'Use #packageAt:ifAbsent: directly.'.\x0a\x09^ self packageAt: packageName ifAbsent: []",
  23696. referencedClasses: [],
  23697. messageSends: ["deprecatedAPI:", "packageAt:ifAbsent:"]
  23698. }),
  23699. $globals.SmalltalkImage);
  23700. $core.addMethod(
  23701. $core.method({
  23702. selector: "packageAt:ifAbsent:",
  23703. protocol: "packages",
  23704. fn: function (packageName,aBlock){
  23705. var self=this,$self=this;
  23706. return $core.withContext(function($ctx1) {
  23707. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23708. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23709. },
  23710. args: ["packageName", "aBlock"],
  23711. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23712. referencedClasses: [],
  23713. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23714. }),
  23715. $globals.SmalltalkImage);
  23716. $core.addMethod(
  23717. $core.method({
  23718. selector: "packageAt:ifPresent:",
  23719. protocol: "packages",
  23720. fn: function (packageName,aBlock){
  23721. var self=this,$self=this;
  23722. return $core.withContext(function($ctx1) {
  23723. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23724. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23725. },
  23726. args: ["packageName", "aBlock"],
  23727. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23728. referencedClasses: [],
  23729. messageSends: ["at:ifPresent:", "packageDictionary"]
  23730. }),
  23731. $globals.SmalltalkImage);
  23732. $core.addMethod(
  23733. $core.method({
  23734. selector: "packageDictionary",
  23735. protocol: "packages",
  23736. fn: function (){
  23737. var self=this,$self=this;
  23738. return $core.withContext(function($ctx1) {
  23739. var $1,$receiver;
  23740. $1=$self["@packageDictionary"];
  23741. if(($receiver = $1) == null || $receiver.a$nil){
  23742. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23743. return $self["@packageDictionary"];
  23744. } else {
  23745. return $1;
  23746. }
  23747. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23748. },
  23749. args: [],
  23750. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23751. referencedClasses: ["Dictionary"],
  23752. messageSends: ["ifNil:", "new"]
  23753. }),
  23754. $globals.SmalltalkImage);
  23755. $core.addMethod(
  23756. $core.method({
  23757. selector: "packages",
  23758. protocol: "packages",
  23759. fn: function (){
  23760. var self=this,$self=this;
  23761. return $core.withContext(function($ctx1) {
  23762. return $recv($recv($self._packageDictionary())._values())._copy();
  23763. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23764. },
  23765. args: [],
  23766. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23767. referencedClasses: [],
  23768. messageSends: ["copy", "values", "packageDictionary"]
  23769. }),
  23770. $globals.SmalltalkImage);
  23771. $core.addMethod(
  23772. $core.method({
  23773. selector: "parse:",
  23774. protocol: "accessing",
  23775. fn: function (aString){
  23776. var self=this,$self=this;
  23777. var result;
  23778. return $core.withContext(function($ctx1) {
  23779. var $1;
  23780. $recv((function(){
  23781. return $core.withContext(function($ctx2) {
  23782. result=$self._basicParse_(aString);
  23783. return result;
  23784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23785. }))._tryCatch_((function(ex){
  23786. return $core.withContext(function($ctx2) {
  23787. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23788. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23789. }));
  23790. $1=result;
  23791. $recv($1)._source_(aString);
  23792. return $recv($1)._yourself();
  23793. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23794. },
  23795. args: ["aString"],
  23796. 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",
  23797. referencedClasses: [],
  23798. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23799. }),
  23800. $globals.SmalltalkImage);
  23801. $core.addMethod(
  23802. $core.method({
  23803. selector: "parseError:parsing:",
  23804. protocol: "error handling",
  23805. fn: function (anException,aString){
  23806. var self=this,$self=this;
  23807. var pos;
  23808. return $core.withContext(function($ctx1) {
  23809. var $1,$2,$6,$5,$4,$3;
  23810. $1=$recv(anException)._basicAt_("location");
  23811. $ctx1.sendIdx["basicAt:"]=1;
  23812. pos=$recv($1)._start();
  23813. $2=$recv($globals.ParseError)._new();
  23814. $6=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  23815. $ctx1.sendIdx[","]=4;
  23816. $5=$recv($6).__comma($recv(pos)._column());
  23817. $ctx1.sendIdx[","]=3;
  23818. $4=$recv($5).__comma(" : Unexpected character ");
  23819. $ctx1.sendIdx[","]=2;
  23820. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23821. $ctx1.sendIdx[","]=1;
  23822. return $recv($2)._messageText_($3);
  23823. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  23824. },
  23825. args: ["anException", "aString"],
  23826. source: "parseError: anException parsing: aString\x0a\x09| pos |\x0a\x09pos := (anException basicAt: 'location') start.\x0a\x09^ ParseError new messageText: 'Parse error on line ', pos line ,' column ' , pos column ,' : Unexpected character ', (anException basicAt: 'found')",
  23827. referencedClasses: ["ParseError"],
  23828. messageSends: ["start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  23829. }),
  23830. $globals.SmalltalkImage);
  23831. $core.addMethod(
  23832. $core.method({
  23833. selector: "pseudoVariableNames",
  23834. protocol: "accessing",
  23835. fn: function (){
  23836. var self=this,$self=this;
  23837. return ["self", "super", "nil", "true", "false", "thisContext"];
  23838. },
  23839. args: [],
  23840. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23841. referencedClasses: [],
  23842. messageSends: []
  23843. }),
  23844. $globals.SmalltalkImage);
  23845. $core.addMethod(
  23846. $core.method({
  23847. selector: "readJSObject:",
  23848. protocol: "accessing",
  23849. fn: function (anObject){
  23850. var self=this,$self=this;
  23851. return $core.withContext(function($ctx1) {
  23852. return $core.readJSObject(anObject);
  23853. return self;
  23854. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23855. },
  23856. args: ["anObject"],
  23857. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23858. referencedClasses: [],
  23859. messageSends: []
  23860. }),
  23861. $globals.SmalltalkImage);
  23862. $core.addMethod(
  23863. $core.method({
  23864. selector: "removeClass:",
  23865. protocol: "classes",
  23866. fn: function (aClass){
  23867. var self=this,$self=this;
  23868. return $core.withContext(function($ctx1) {
  23869. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23870. $1=$recv(aClass)._isMetaclass();
  23871. if($core.assert($1)){
  23872. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23873. $ctx1.sendIdx[","]=1;
  23874. $self._error_($2);
  23875. $ctx1.sendIdx["error:"]=1;
  23876. }
  23877. $recv(aClass)._allSubclassesDo_((function(subclass){
  23878. return $core.withContext(function($ctx2) {
  23879. $5=$recv(aClass)._name();
  23880. $ctx2.sendIdx["name"]=1;
  23881. $4=$recv($5).__comma(" has a subclass: ");
  23882. $ctx2.sendIdx[","]=3;
  23883. $6=$recv(subclass)._name();
  23884. $ctx2.sendIdx["name"]=2;
  23885. $3=$recv($4).__comma($6);
  23886. $ctx2.sendIdx[","]=2;
  23887. return $self._error_($3);
  23888. $ctx2.sendIdx["error:"]=2;
  23889. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23890. }));
  23891. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23892. return $core.withContext(function($ctx2) {
  23893. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23895. }));
  23896. $self._deleteClass_(aClass);
  23897. $recv(aClass)._setTraitComposition_([]);
  23898. $ctx1.sendIdx["setTraitComposition:"]=1;
  23899. $7=$recv(aClass)._theMetaClass();
  23900. if(($receiver = $7) == null || $receiver.a$nil){
  23901. $7;
  23902. } else {
  23903. var meta;
  23904. meta=$receiver;
  23905. $recv(meta)._setTraitComposition_([]);
  23906. }
  23907. $8=$recv($globals.SystemAnnouncer)._current();
  23908. $10=$recv($globals.ClassRemoved)._new();
  23909. $recv($10)._theClass_(aClass);
  23910. $9=$recv($10)._yourself();
  23911. $recv($8)._announce_($9);
  23912. return self;
  23913. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23914. },
  23915. args: ["aClass"],
  23916. 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)",
  23917. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23918. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  23919. }),
  23920. $globals.SmalltalkImage);
  23921. $core.addMethod(
  23922. $core.method({
  23923. selector: "removePackage:",
  23924. protocol: "packages",
  23925. fn: function (packageName){
  23926. var self=this,$self=this;
  23927. var pkg;
  23928. return $core.withContext(function($ctx1) {
  23929. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23930. return $core.withContext(function($ctx2) {
  23931. return $self._error_("Missing package: ".__comma(packageName));
  23932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23933. }));
  23934. $recv($recv(pkg)._classes())._do_((function(each){
  23935. return $core.withContext(function($ctx2) {
  23936. return $self._removeClass_(each);
  23937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23938. }));
  23939. $recv($self._packageDictionary())._removeKey_(packageName);
  23940. return self;
  23941. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  23942. },
  23943. args: ["packageName"],
  23944. 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",
  23945. referencedClasses: [],
  23946. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  23947. }),
  23948. $globals.SmalltalkImage);
  23949. $core.addMethod(
  23950. $core.method({
  23951. selector: "renamePackage:to:",
  23952. protocol: "packages",
  23953. fn: function (packageName,newName){
  23954. var self=this,$self=this;
  23955. var pkg;
  23956. return $core.withContext(function($ctx1) {
  23957. var $1,$2,$3;
  23958. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23959. return $core.withContext(function($ctx2) {
  23960. $1="Missing package: ".__comma(packageName);
  23961. $ctx2.sendIdx[","]=1;
  23962. return $self._error_($1);
  23963. $ctx2.sendIdx["error:"]=1;
  23964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23965. }));
  23966. $self._packageAt_ifPresent_(newName,(function(){
  23967. return $core.withContext(function($ctx2) {
  23968. return $self._error_("Already exists a package called: ".__comma(newName));
  23969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  23970. }));
  23971. $2=pkg;
  23972. $recv($2)._name_(newName);
  23973. $recv($2)._beDirty();
  23974. $3=$self._packageDictionary();
  23975. $recv($3)._at_put_(newName,pkg);
  23976. $recv($3)._removeKey_(packageName);
  23977. return self;
  23978. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  23979. },
  23980. args: ["packageName", "newName"],
  23981. 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",
  23982. referencedClasses: [],
  23983. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  23984. }),
  23985. $globals.SmalltalkImage);
  23986. $core.addMethod(
  23987. $core.method({
  23988. selector: "reservedWords",
  23989. protocol: "accessing",
  23990. fn: function (){
  23991. var self=this,$self=this;
  23992. 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"];
  23993. },
  23994. args: [],
  23995. 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)",
  23996. referencedClasses: [],
  23997. messageSends: []
  23998. }),
  23999. $globals.SmalltalkImage);
  24000. $core.addMethod(
  24001. $core.method({
  24002. selector: "settings",
  24003. protocol: "accessing",
  24004. fn: function (){
  24005. var self=this,$self=this;
  24006. return $globals.SmalltalkSettings;
  24007. },
  24008. args: [],
  24009. source: "settings\x0a\x09^ SmalltalkSettings",
  24010. referencedClasses: ["SmalltalkSettings"],
  24011. messageSends: []
  24012. }),
  24013. $globals.SmalltalkImage);
  24014. $core.addMethod(
  24015. $core.method({
  24016. selector: "version",
  24017. protocol: "accessing",
  24018. fn: function (){
  24019. var self=this,$self=this;
  24020. return "0.20.0";
  24021. },
  24022. args: [],
  24023. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.20.0'",
  24024. referencedClasses: [],
  24025. messageSends: []
  24026. }),
  24027. $globals.SmalltalkImage);
  24028. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24029. $core.addMethod(
  24030. $core.method({
  24031. selector: "current",
  24032. protocol: "instance creation",
  24033. fn: function (){
  24034. var self=this,$self=this;
  24035. return $core.withContext(function($ctx1) {
  24036. var $1,$receiver;
  24037. $1=$self["@current"];
  24038. if(($receiver = $1) == null || $receiver.a$nil){
  24039. $self["@current"]=(
  24040. $ctx1.supercall = true,
  24041. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24042. $ctx1.supercall = false;
  24043. return $self["@current"];
  24044. } else {
  24045. $self._deprecatedAPI();
  24046. return $self["@current"];
  24047. }
  24048. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24049. },
  24050. args: [],
  24051. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24052. referencedClasses: [],
  24053. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24054. }),
  24055. $globals.SmalltalkImage.a$cls);
  24056. $core.addMethod(
  24057. $core.method({
  24058. selector: "initialize",
  24059. protocol: "initialization",
  24060. fn: function (){
  24061. var self=this,$self=this;
  24062. var st;
  24063. return $core.withContext(function($ctx1) {
  24064. st=$self._current();
  24065. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24066. return self;
  24067. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24068. },
  24069. args: [],
  24070. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24071. referencedClasses: [],
  24072. messageSends: ["current", "at:put:", "globals"]
  24073. }),
  24074. $globals.SmalltalkImage.a$cls);
  24075. $core.addMethod(
  24076. $core.method({
  24077. selector: "new",
  24078. protocol: "instance creation",
  24079. fn: function (){
  24080. var self=this,$self=this;
  24081. return $core.withContext(function($ctx1) {
  24082. $self._shouldNotImplement();
  24083. return self;
  24084. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24085. },
  24086. args: [],
  24087. source: "new\x0a\x09self shouldNotImplement",
  24088. referencedClasses: [],
  24089. messageSends: ["shouldNotImplement"]
  24090. }),
  24091. $globals.SmalltalkImage.a$cls);
  24092. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24093. $core.addMethod(
  24094. $core.method({
  24095. selector: "nextPutJSObject:",
  24096. protocol: "*Kernel-Infrastructure",
  24097. fn: function (aJSObject){
  24098. var self=this,$self=this;
  24099. return $core.withContext(function($ctx1) {
  24100. $self._nextPut_(aJSObject);
  24101. return self;
  24102. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24103. },
  24104. args: ["aJSObject"],
  24105. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24106. referencedClasses: [],
  24107. messageSends: ["nextPut:"]
  24108. }),
  24109. $globals.ProtoStream);
  24110. $core.addMethod(
  24111. $core.method({
  24112. selector: "asJavaScriptPropertyName",
  24113. protocol: "*Kernel-Infrastructure",
  24114. fn: function (){
  24115. var self=this,$self=this;
  24116. return $core.withContext(function($ctx1) {
  24117. return $core.st2prop(self);
  24118. return self;
  24119. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24120. },
  24121. args: [],
  24122. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24123. referencedClasses: [],
  24124. messageSends: []
  24125. }),
  24126. $globals.String);
  24127. $core.addMethod(
  24128. $core.method({
  24129. selector: "asSetting",
  24130. protocol: "*Kernel-Infrastructure",
  24131. fn: function (){
  24132. var self=this,$self=this;
  24133. return $core.withContext(function($ctx1) {
  24134. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24135. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24136. },
  24137. args: [],
  24138. 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",
  24139. referencedClasses: ["Setting"],
  24140. messageSends: ["at:ifAbsent:"]
  24141. }),
  24142. $globals.String);
  24143. $core.addMethod(
  24144. $core.method({
  24145. selector: "asSettingIfAbsent:",
  24146. protocol: "*Kernel-Infrastructure",
  24147. fn: function (aDefaultValue){
  24148. var self=this,$self=this;
  24149. return $core.withContext(function($ctx1) {
  24150. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24151. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24152. },
  24153. args: ["aDefaultValue"],
  24154. 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",
  24155. referencedClasses: ["Setting"],
  24156. messageSends: ["at:ifAbsent:"]
  24157. }),
  24158. $globals.String);
  24159. $core.addMethod(
  24160. $core.method({
  24161. selector: "settingValue",
  24162. protocol: "*Kernel-Infrastructure",
  24163. fn: function (){
  24164. var self=this,$self=this;
  24165. return $core.withContext(function($ctx1) {
  24166. return $recv($self._asSetting())._value();
  24167. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24168. },
  24169. args: [],
  24170. source: "settingValue\x0a\x09^ self asSetting value",
  24171. referencedClasses: [],
  24172. messageSends: ["value", "asSetting"]
  24173. }),
  24174. $globals.String);
  24175. $core.addMethod(
  24176. $core.method({
  24177. selector: "settingValue:",
  24178. protocol: "*Kernel-Infrastructure",
  24179. fn: function (aValue){
  24180. var self=this,$self=this;
  24181. return $core.withContext(function($ctx1) {
  24182. return $recv($self._asSetting())._value_(aValue);
  24183. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24184. },
  24185. args: ["aValue"],
  24186. 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",
  24187. referencedClasses: [],
  24188. messageSends: ["value:", "asSetting"]
  24189. }),
  24190. $globals.String);
  24191. $core.addMethod(
  24192. $core.method({
  24193. selector: "settingValueIfAbsent:",
  24194. protocol: "*Kernel-Infrastructure",
  24195. fn: function (aDefaultValue){
  24196. var self=this,$self=this;
  24197. return $core.withContext(function($ctx1) {
  24198. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24199. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24200. },
  24201. args: ["aDefaultValue"],
  24202. 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",
  24203. referencedClasses: [],
  24204. messageSends: ["value", "asSettingIfAbsent:"]
  24205. }),
  24206. $globals.String);
  24207. });
  24208. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24209. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24210. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24211. $core.addPackage("Kernel-Announcements");
  24212. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24213. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24214. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24215. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24216. $core.addMethod(
  24217. $core.method({
  24218. selector: "announcementClass",
  24219. protocol: "accessing",
  24220. fn: function (){
  24221. var self=this,$self=this;
  24222. return $self["@announcementClass"];
  24223. },
  24224. args: [],
  24225. source: "announcementClass\x0a\x09^ announcementClass",
  24226. referencedClasses: [],
  24227. messageSends: []
  24228. }),
  24229. $globals.AnnouncementSubscription);
  24230. $core.addMethod(
  24231. $core.method({
  24232. selector: "announcementClass:",
  24233. protocol: "accessing",
  24234. fn: function (aClass){
  24235. var self=this,$self=this;
  24236. $self["@announcementClass"]=aClass;
  24237. return self;
  24238. },
  24239. args: ["aClass"],
  24240. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24241. referencedClasses: [],
  24242. messageSends: []
  24243. }),
  24244. $globals.AnnouncementSubscription);
  24245. $core.addMethod(
  24246. $core.method({
  24247. selector: "deliver:",
  24248. protocol: "announcing",
  24249. fn: function (anAnnouncement){
  24250. var self=this,$self=this;
  24251. return $core.withContext(function($ctx1) {
  24252. var $1;
  24253. $1=$self._handlesAnnouncement_(anAnnouncement);
  24254. if($core.assert($1)){
  24255. $recv($self._valuable())._value_(anAnnouncement);
  24256. }
  24257. return self;
  24258. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24259. },
  24260. args: ["anAnnouncement"],
  24261. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24262. referencedClasses: [],
  24263. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24264. }),
  24265. $globals.AnnouncementSubscription);
  24266. $core.addMethod(
  24267. $core.method({
  24268. selector: "handlesAnnouncement:",
  24269. protocol: "announcing",
  24270. fn: function (anAnnouncement){
  24271. var self=this,$self=this;
  24272. return $core.withContext(function($ctx1) {
  24273. var $2,$3,$1,$receiver;
  24274. $2=$recv($globals.Smalltalk)._globals();
  24275. $ctx1.sendIdx["globals"]=1;
  24276. $3=$recv($self._announcementClass())._name();
  24277. $ctx1.sendIdx["name"]=1;
  24278. $1=$recv($2)._at_($3);
  24279. $ctx1.sendIdx["at:"]=1;
  24280. if(($receiver = $1) == null || $receiver.a$nil){
  24281. return false;
  24282. } else {
  24283. var class_;
  24284. class_=$receiver;
  24285. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24286. }
  24287. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24288. },
  24289. args: ["anAnnouncement"],
  24290. 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 ]",
  24291. referencedClasses: ["Smalltalk"],
  24292. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24293. }),
  24294. $globals.AnnouncementSubscription);
  24295. $core.addMethod(
  24296. $core.method({
  24297. selector: "receiver",
  24298. protocol: "accessing",
  24299. fn: function (){
  24300. var self=this,$self=this;
  24301. return $core.withContext(function($ctx1) {
  24302. return $recv($self._valuable())._receiver();
  24303. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24304. },
  24305. args: [],
  24306. source: "receiver\x0a\x09^ self valuable receiver",
  24307. referencedClasses: [],
  24308. messageSends: ["receiver", "valuable"]
  24309. }),
  24310. $globals.AnnouncementSubscription);
  24311. $core.addMethod(
  24312. $core.method({
  24313. selector: "valuable",
  24314. protocol: "accessing",
  24315. fn: function (){
  24316. var self=this,$self=this;
  24317. return $self["@valuable"];
  24318. },
  24319. args: [],
  24320. source: "valuable\x0a\x09^ valuable",
  24321. referencedClasses: [],
  24322. messageSends: []
  24323. }),
  24324. $globals.AnnouncementSubscription);
  24325. $core.addMethod(
  24326. $core.method({
  24327. selector: "valuable:",
  24328. protocol: "accessing",
  24329. fn: function (aValuable){
  24330. var self=this,$self=this;
  24331. $self["@valuable"]=aValuable;
  24332. return self;
  24333. },
  24334. args: ["aValuable"],
  24335. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24336. referencedClasses: [],
  24337. messageSends: []
  24338. }),
  24339. $globals.AnnouncementSubscription);
  24340. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24341. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24342. $core.addMethod(
  24343. $core.method({
  24344. selector: "receiver",
  24345. protocol: "accessing",
  24346. fn: function (){
  24347. var self=this,$self=this;
  24348. return $self["@receiver"];
  24349. },
  24350. args: [],
  24351. source: "receiver\x0a\x09^ receiver",
  24352. referencedClasses: [],
  24353. messageSends: []
  24354. }),
  24355. $globals.AnnouncementValuable);
  24356. $core.addMethod(
  24357. $core.method({
  24358. selector: "receiver:",
  24359. protocol: "accessing",
  24360. fn: function (anObject){
  24361. var self=this,$self=this;
  24362. $self["@receiver"]=anObject;
  24363. return self;
  24364. },
  24365. args: ["anObject"],
  24366. source: "receiver: anObject\x0a\x09receiver := anObject",
  24367. referencedClasses: [],
  24368. messageSends: []
  24369. }),
  24370. $globals.AnnouncementValuable);
  24371. $core.addMethod(
  24372. $core.method({
  24373. selector: "valuable",
  24374. protocol: "accessing",
  24375. fn: function (){
  24376. var self=this,$self=this;
  24377. return $self["@valuable"];
  24378. },
  24379. args: [],
  24380. source: "valuable\x0a\x09^ valuable",
  24381. referencedClasses: [],
  24382. messageSends: []
  24383. }),
  24384. $globals.AnnouncementValuable);
  24385. $core.addMethod(
  24386. $core.method({
  24387. selector: "valuable:",
  24388. protocol: "accessing",
  24389. fn: function (anObject){
  24390. var self=this,$self=this;
  24391. $self["@valuable"]=anObject;
  24392. return self;
  24393. },
  24394. args: ["anObject"],
  24395. source: "valuable: anObject\x0a\x09valuable := anObject",
  24396. referencedClasses: [],
  24397. messageSends: []
  24398. }),
  24399. $globals.AnnouncementValuable);
  24400. $core.addMethod(
  24401. $core.method({
  24402. selector: "value",
  24403. protocol: "evaluating",
  24404. fn: function (){
  24405. var self=this,$self=this;
  24406. return $core.withContext(function($ctx1) {
  24407. return $recv($self._valuable())._value();
  24408. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24409. },
  24410. args: [],
  24411. source: "value\x0a\x09^ self valuable value",
  24412. referencedClasses: [],
  24413. messageSends: ["value", "valuable"]
  24414. }),
  24415. $globals.AnnouncementValuable);
  24416. $core.addMethod(
  24417. $core.method({
  24418. selector: "value:",
  24419. protocol: "evaluating",
  24420. fn: function (anObject){
  24421. var self=this,$self=this;
  24422. return $core.withContext(function($ctx1) {
  24423. return $recv($self._valuable())._value_(anObject);
  24424. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24425. },
  24426. args: ["anObject"],
  24427. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24428. referencedClasses: [],
  24429. messageSends: ["value:", "valuable"]
  24430. }),
  24431. $globals.AnnouncementValuable);
  24432. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24433. $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' ].";
  24434. $core.addMethod(
  24435. $core.method({
  24436. selector: "announce:",
  24437. protocol: "announcing",
  24438. fn: function (anAnnouncement){
  24439. var self=this,$self=this;
  24440. return $core.withContext(function($ctx1) {
  24441. $recv($self["@subscriptions"])._do_((function(each){
  24442. return $core.withContext(function($ctx2) {
  24443. return $recv(each)._deliver_(anAnnouncement);
  24444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24445. }));
  24446. return self;
  24447. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24448. },
  24449. args: ["anAnnouncement"],
  24450. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24451. referencedClasses: [],
  24452. messageSends: ["do:", "deliver:"]
  24453. }),
  24454. $globals.Announcer);
  24455. $core.addMethod(
  24456. $core.method({
  24457. selector: "initialize",
  24458. protocol: "initialization",
  24459. fn: function (){
  24460. var self=this,$self=this;
  24461. return $core.withContext(function($ctx1) {
  24462. (
  24463. $ctx1.supercall = true,
  24464. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24465. $ctx1.supercall = false;
  24466. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24467. return self;
  24468. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24469. },
  24470. args: [],
  24471. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24472. referencedClasses: ["OrderedCollection"],
  24473. messageSends: ["initialize", "new"]
  24474. }),
  24475. $globals.Announcer);
  24476. $core.addMethod(
  24477. $core.method({
  24478. selector: "on:do:",
  24479. protocol: "subscribing",
  24480. fn: function (aClass,aBlock){
  24481. var self=this,$self=this;
  24482. return $core.withContext(function($ctx1) {
  24483. $self._on_do_for_(aClass,aBlock,nil);
  24484. return self;
  24485. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24486. },
  24487. args: ["aClass", "aBlock"],
  24488. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24489. referencedClasses: [],
  24490. messageSends: ["on:do:for:"]
  24491. }),
  24492. $globals.Announcer);
  24493. $core.addMethod(
  24494. $core.method({
  24495. selector: "on:do:for:",
  24496. protocol: "subscribing",
  24497. fn: function (aClass,aBlock,aReceiver){
  24498. var self=this,$self=this;
  24499. return $core.withContext(function($ctx1) {
  24500. var $1,$3,$5,$6,$4,$2;
  24501. $1=$self["@subscriptions"];
  24502. $3=$recv($globals.AnnouncementSubscription)._new();
  24503. $ctx1.sendIdx["new"]=1;
  24504. $5=$recv($globals.AnnouncementValuable)._new();
  24505. $recv($5)._valuable_(aBlock);
  24506. $recv($5)._receiver_(aReceiver);
  24507. $6=$recv($5)._yourself();
  24508. $ctx1.sendIdx["yourself"]=1;
  24509. $4=$6;
  24510. $recv($3)._valuable_($4);
  24511. $ctx1.sendIdx["valuable:"]=1;
  24512. $recv($3)._announcementClass_(aClass);
  24513. $2=$recv($3)._yourself();
  24514. $recv($1)._add_($2);
  24515. return self;
  24516. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24517. },
  24518. args: ["aClass", "aBlock", "aReceiver"],
  24519. 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)",
  24520. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24521. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24522. }),
  24523. $globals.Announcer);
  24524. $core.addMethod(
  24525. $core.method({
  24526. selector: "on:doOnce:",
  24527. protocol: "subscribing",
  24528. fn: function (aClass,aBlock){
  24529. var self=this,$self=this;
  24530. var subscription;
  24531. return $core.withContext(function($ctx1) {
  24532. var $1;
  24533. $1=$recv($globals.AnnouncementSubscription)._new();
  24534. $recv($1)._announcementClass_(aClass);
  24535. subscription=$recv($1)._yourself();
  24536. $recv(subscription)._valuable_((function(ann){
  24537. return $core.withContext(function($ctx2) {
  24538. $recv($self["@subscriptions"])._remove_(subscription);
  24539. return $recv(aBlock)._value_(ann);
  24540. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24541. }));
  24542. $recv($self["@subscriptions"])._add_(subscription);
  24543. return self;
  24544. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24545. },
  24546. args: ["aClass", "aBlock"],
  24547. 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",
  24548. referencedClasses: ["AnnouncementSubscription"],
  24549. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24550. }),
  24551. $globals.Announcer);
  24552. $core.addMethod(
  24553. $core.method({
  24554. selector: "on:send:to:",
  24555. protocol: "subscribing",
  24556. fn: function (aClass,aSelector,anObject){
  24557. var self=this,$self=this;
  24558. return $core.withContext(function($ctx1) {
  24559. var $1,$3,$5,$6,$4,$2;
  24560. $1=$self["@subscriptions"];
  24561. $3=$recv($globals.AnnouncementSubscription)._new();
  24562. $ctx1.sendIdx["new"]=1;
  24563. $5=$recv($globals.MessageSend)._new();
  24564. $recv($5)._receiver_(anObject);
  24565. $recv($5)._selector_(aSelector);
  24566. $6=$recv($5)._yourself();
  24567. $ctx1.sendIdx["yourself"]=1;
  24568. $4=$6;
  24569. $recv($3)._valuable_($4);
  24570. $recv($3)._announcementClass_(aClass);
  24571. $2=$recv($3)._yourself();
  24572. $recv($1)._add_($2);
  24573. return self;
  24574. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24575. },
  24576. args: ["aClass", "aSelector", "anObject"],
  24577. 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)",
  24578. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24579. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24580. }),
  24581. $globals.Announcer);
  24582. $core.addMethod(
  24583. $core.method({
  24584. selector: "unsubscribe:",
  24585. protocol: "subscribing",
  24586. fn: function (anObject){
  24587. var self=this,$self=this;
  24588. return $core.withContext(function($ctx1) {
  24589. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24590. return $core.withContext(function($ctx2) {
  24591. return $recv($recv(each)._receiver()).__eq(anObject);
  24592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24593. }));
  24594. return self;
  24595. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24596. },
  24597. args: ["anObject"],
  24598. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24599. referencedClasses: [],
  24600. messageSends: ["reject:", "=", "receiver"]
  24601. }),
  24602. $globals.Announcer);
  24603. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24604. $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`";
  24605. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24606. $core.addMethod(
  24607. $core.method({
  24608. selector: "current",
  24609. protocol: "accessing",
  24610. fn: function (){
  24611. var self=this,$self=this;
  24612. return $core.withContext(function($ctx1) {
  24613. var $1,$receiver;
  24614. $1=$self["@current"];
  24615. if(($receiver = $1) == null || $receiver.a$nil){
  24616. $self["@current"]=(
  24617. $ctx1.supercall = true,
  24618. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24619. $ctx1.supercall = false;
  24620. return $self["@current"];
  24621. } else {
  24622. return $1;
  24623. }
  24624. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24625. },
  24626. args: [],
  24627. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24628. referencedClasses: [],
  24629. messageSends: ["ifNil:", "new"]
  24630. }),
  24631. $globals.SystemAnnouncer.a$cls);
  24632. $core.addMethod(
  24633. $core.method({
  24634. selector: "new",
  24635. protocol: "instance creation",
  24636. fn: function (){
  24637. var self=this,$self=this;
  24638. return $core.withContext(function($ctx1) {
  24639. $self._shouldNotImplement();
  24640. return self;
  24641. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24642. },
  24643. args: [],
  24644. source: "new\x0a\x09self shouldNotImplement",
  24645. referencedClasses: [],
  24646. messageSends: ["shouldNotImplement"]
  24647. }),
  24648. $globals.SystemAnnouncer.a$cls);
  24649. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24650. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24651. $core.addMethod(
  24652. $core.method({
  24653. selector: "classTag",
  24654. protocol: "accessing",
  24655. fn: function (){
  24656. var self=this,$self=this;
  24657. return "announcement";
  24658. },
  24659. args: [],
  24660. 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'",
  24661. referencedClasses: [],
  24662. messageSends: []
  24663. }),
  24664. $globals.SystemAnnouncement.a$cls);
  24665. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24666. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24667. $core.addMethod(
  24668. $core.method({
  24669. selector: "theClass",
  24670. protocol: "accessing",
  24671. fn: function (){
  24672. var self=this,$self=this;
  24673. return $self["@theClass"];
  24674. },
  24675. args: [],
  24676. source: "theClass\x0a\x09^ theClass",
  24677. referencedClasses: [],
  24678. messageSends: []
  24679. }),
  24680. $globals.ClassAnnouncement);
  24681. $core.addMethod(
  24682. $core.method({
  24683. selector: "theClass:",
  24684. protocol: "accessing",
  24685. fn: function (aClass){
  24686. var self=this,$self=this;
  24687. $self["@theClass"]=aClass;
  24688. return self;
  24689. },
  24690. args: ["aClass"],
  24691. source: "theClass: aClass\x0a\x09theClass := aClass",
  24692. referencedClasses: [],
  24693. messageSends: []
  24694. }),
  24695. $globals.ClassAnnouncement);
  24696. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24697. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24698. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24699. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24700. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24701. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24702. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24703. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24704. $core.addMethod(
  24705. $core.method({
  24706. selector: "oldClass",
  24707. protocol: "accessing",
  24708. fn: function (){
  24709. var self=this,$self=this;
  24710. return $self["@oldClass"];
  24711. },
  24712. args: [],
  24713. source: "oldClass\x0a\x09^ oldClass",
  24714. referencedClasses: [],
  24715. messageSends: []
  24716. }),
  24717. $globals.ClassMigrated);
  24718. $core.addMethod(
  24719. $core.method({
  24720. selector: "oldClass:",
  24721. protocol: "accessing",
  24722. fn: function (aClass){
  24723. var self=this,$self=this;
  24724. $self["@oldClass"]=aClass;
  24725. return self;
  24726. },
  24727. args: ["aClass"],
  24728. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24729. referencedClasses: [],
  24730. messageSends: []
  24731. }),
  24732. $globals.ClassMigrated);
  24733. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24734. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24735. $core.addMethod(
  24736. $core.method({
  24737. selector: "oldPackage",
  24738. protocol: "accessing",
  24739. fn: function (){
  24740. var self=this,$self=this;
  24741. return $self["@oldPackage"];
  24742. },
  24743. args: [],
  24744. source: "oldPackage\x0a\x09^ oldPackage",
  24745. referencedClasses: [],
  24746. messageSends: []
  24747. }),
  24748. $globals.ClassMoved);
  24749. $core.addMethod(
  24750. $core.method({
  24751. selector: "oldPackage:",
  24752. protocol: "accessing",
  24753. fn: function (aPackage){
  24754. var self=this,$self=this;
  24755. $self["@oldPackage"]=aPackage;
  24756. return self;
  24757. },
  24758. args: ["aPackage"],
  24759. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24760. referencedClasses: [],
  24761. messageSends: []
  24762. }),
  24763. $globals.ClassMoved);
  24764. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24765. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24766. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24767. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24768. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24769. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24770. $core.addMethod(
  24771. $core.method({
  24772. selector: "method",
  24773. protocol: "accessing",
  24774. fn: function (){
  24775. var self=this,$self=this;
  24776. return $self["@method"];
  24777. },
  24778. args: [],
  24779. source: "method\x0a\x09^ method",
  24780. referencedClasses: [],
  24781. messageSends: []
  24782. }),
  24783. $globals.MethodAnnouncement);
  24784. $core.addMethod(
  24785. $core.method({
  24786. selector: "method:",
  24787. protocol: "accessing",
  24788. fn: function (aCompiledMethod){
  24789. var self=this,$self=this;
  24790. $self["@method"]=aCompiledMethod;
  24791. return self;
  24792. },
  24793. args: ["aCompiledMethod"],
  24794. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24795. referencedClasses: [],
  24796. messageSends: []
  24797. }),
  24798. $globals.MethodAnnouncement);
  24799. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24800. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24801. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24802. $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.";
  24803. $core.addMethod(
  24804. $core.method({
  24805. selector: "oldMethod",
  24806. protocol: "accessing",
  24807. fn: function (){
  24808. var self=this,$self=this;
  24809. return $self["@oldMethod"];
  24810. },
  24811. args: [],
  24812. source: "oldMethod\x0a\x09^ oldMethod",
  24813. referencedClasses: [],
  24814. messageSends: []
  24815. }),
  24816. $globals.MethodModified);
  24817. $core.addMethod(
  24818. $core.method({
  24819. selector: "oldMethod:",
  24820. protocol: "accessing",
  24821. fn: function (aMethod){
  24822. var self=this,$self=this;
  24823. $self["@oldMethod"]=aMethod;
  24824. return self;
  24825. },
  24826. args: ["aMethod"],
  24827. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24828. referencedClasses: [],
  24829. messageSends: []
  24830. }),
  24831. $globals.MethodModified);
  24832. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24833. $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.";
  24834. $core.addMethod(
  24835. $core.method({
  24836. selector: "oldProtocol",
  24837. protocol: "accessing",
  24838. fn: function (){
  24839. var self=this,$self=this;
  24840. return $self["@oldProtocol"];
  24841. },
  24842. args: [],
  24843. source: "oldProtocol\x0a\x09^ oldProtocol",
  24844. referencedClasses: [],
  24845. messageSends: []
  24846. }),
  24847. $globals.MethodMoved);
  24848. $core.addMethod(
  24849. $core.method({
  24850. selector: "oldProtocol:",
  24851. protocol: "accessing",
  24852. fn: function (aString){
  24853. var self=this,$self=this;
  24854. $self["@oldProtocol"]=aString;
  24855. return self;
  24856. },
  24857. args: ["aString"],
  24858. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24859. referencedClasses: [],
  24860. messageSends: []
  24861. }),
  24862. $globals.MethodMoved);
  24863. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24864. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24865. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24866. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24867. $core.addMethod(
  24868. $core.method({
  24869. selector: "package",
  24870. protocol: "accessing",
  24871. fn: function (){
  24872. var self=this,$self=this;
  24873. return $self["@package"];
  24874. },
  24875. args: [],
  24876. source: "package\x0a\x09^ package",
  24877. referencedClasses: [],
  24878. messageSends: []
  24879. }),
  24880. $globals.PackageAnnouncement);
  24881. $core.addMethod(
  24882. $core.method({
  24883. selector: "package:",
  24884. protocol: "accessing",
  24885. fn: function (aPackage){
  24886. var self=this,$self=this;
  24887. $self["@package"]=aPackage;
  24888. return self;
  24889. },
  24890. args: ["aPackage"],
  24891. source: "package: aPackage\x0a\x09package := aPackage",
  24892. referencedClasses: [],
  24893. messageSends: []
  24894. }),
  24895. $globals.PackageAnnouncement);
  24896. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24897. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24898. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24899. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24900. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24901. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24902. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24903. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24904. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24905. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24906. $core.addMethod(
  24907. $core.method({
  24908. selector: "package",
  24909. protocol: "accessing",
  24910. fn: function (){
  24911. var self=this,$self=this;
  24912. return $core.withContext(function($ctx1) {
  24913. var $1,$receiver;
  24914. $1=$self._theClass();
  24915. if(($receiver = $1) == null || $receiver.a$nil){
  24916. return $1;
  24917. } else {
  24918. var class_;
  24919. class_=$receiver;
  24920. return $recv(class_)._packageOfProtocol_($self._protocol());
  24921. }
  24922. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  24923. },
  24924. args: [],
  24925. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  24926. referencedClasses: [],
  24927. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  24928. }),
  24929. $globals.ProtocolAnnouncement);
  24930. $core.addMethod(
  24931. $core.method({
  24932. selector: "protocol",
  24933. protocol: "accessing",
  24934. fn: function (){
  24935. var self=this,$self=this;
  24936. return $self["@protocol"];
  24937. },
  24938. args: [],
  24939. source: "protocol\x0a\x09^ protocol",
  24940. referencedClasses: [],
  24941. messageSends: []
  24942. }),
  24943. $globals.ProtocolAnnouncement);
  24944. $core.addMethod(
  24945. $core.method({
  24946. selector: "protocol:",
  24947. protocol: "accessing",
  24948. fn: function (aString){
  24949. var self=this,$self=this;
  24950. $self["@protocol"]=aString;
  24951. return self;
  24952. },
  24953. args: ["aString"],
  24954. source: "protocol: aString\x0a\x09protocol := aString",
  24955. referencedClasses: [],
  24956. messageSends: []
  24957. }),
  24958. $globals.ProtocolAnnouncement);
  24959. $core.addMethod(
  24960. $core.method({
  24961. selector: "theClass",
  24962. protocol: "accessing",
  24963. fn: function (){
  24964. var self=this,$self=this;
  24965. return $self["@theClass"];
  24966. },
  24967. args: [],
  24968. source: "theClass\x0a\x09^ theClass",
  24969. referencedClasses: [],
  24970. messageSends: []
  24971. }),
  24972. $globals.ProtocolAnnouncement);
  24973. $core.addMethod(
  24974. $core.method({
  24975. selector: "theClass:",
  24976. protocol: "accessing",
  24977. fn: function (aClass){
  24978. var self=this,$self=this;
  24979. $self["@theClass"]=aClass;
  24980. return self;
  24981. },
  24982. args: ["aClass"],
  24983. source: "theClass: aClass\x0a\x09theClass := aClass",
  24984. referencedClasses: [],
  24985. messageSends: []
  24986. }),
  24987. $globals.ProtocolAnnouncement);
  24988. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  24989. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  24990. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  24991. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  24992. });
  24993. 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";
  24994. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24995. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24996. $core.addPackage("Platform-Services");
  24997. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  24998. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24999. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25000. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25001. $core.addMethod(
  25002. $core.method({
  25003. selector: "handleError:",
  25004. protocol: "error handling",
  25005. fn: function (anError){
  25006. var self=this,$self=this;
  25007. return $core.withContext(function($ctx1) {
  25008. var $1,$receiver;
  25009. $1=$recv(anError)._context();
  25010. $ctx1.sendIdx["context"]=1;
  25011. if(($receiver = $1) == null || $receiver.a$nil){
  25012. $1;
  25013. } else {
  25014. $self._logErrorContext_($recv(anError)._context());
  25015. }
  25016. $self._logError_(anError);
  25017. return self;
  25018. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25019. },
  25020. args: ["anError"],
  25021. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25022. referencedClasses: [],
  25023. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25024. }),
  25025. $globals.ConsoleErrorHandler);
  25026. $core.addMethod(
  25027. $core.method({
  25028. selector: "log:",
  25029. protocol: "private",
  25030. fn: function (aString){
  25031. var self=this,$self=this;
  25032. return $core.withContext(function($ctx1) {
  25033. $recv(console)._log_(aString);
  25034. return self;
  25035. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25036. },
  25037. args: ["aString"],
  25038. source: "log: aString\x0a\x09console log: aString",
  25039. referencedClasses: [],
  25040. messageSends: ["log:"]
  25041. }),
  25042. $globals.ConsoleErrorHandler);
  25043. $core.addMethod(
  25044. $core.method({
  25045. selector: "logContext:",
  25046. protocol: "private",
  25047. fn: function (aContext){
  25048. var self=this,$self=this;
  25049. return $core.withContext(function($ctx1) {
  25050. var $1,$receiver;
  25051. $1=$recv(aContext)._home();
  25052. $ctx1.sendIdx["home"]=1;
  25053. if(($receiver = $1) == null || $receiver.a$nil){
  25054. $1;
  25055. } else {
  25056. $self._logContext_($recv(aContext)._home());
  25057. }
  25058. $self._log_($recv(aContext)._asString());
  25059. return self;
  25060. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25061. },
  25062. args: ["aContext"],
  25063. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25064. referencedClasses: [],
  25065. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25066. }),
  25067. $globals.ConsoleErrorHandler);
  25068. $core.addMethod(
  25069. $core.method({
  25070. selector: "logError:",
  25071. protocol: "private",
  25072. fn: function (anError){
  25073. var self=this,$self=this;
  25074. return $core.withContext(function($ctx1) {
  25075. $self._log_($recv(anError)._messageText());
  25076. return self;
  25077. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25078. },
  25079. args: ["anError"],
  25080. source: "logError: anError\x0a\x09self log: anError messageText",
  25081. referencedClasses: [],
  25082. messageSends: ["log:", "messageText"]
  25083. }),
  25084. $globals.ConsoleErrorHandler);
  25085. $core.addMethod(
  25086. $core.method({
  25087. selector: "logErrorContext:",
  25088. protocol: "private",
  25089. fn: function (aContext){
  25090. var self=this,$self=this;
  25091. return $core.withContext(function($ctx1) {
  25092. var $1,$receiver;
  25093. if(($receiver = aContext) == null || $receiver.a$nil){
  25094. aContext;
  25095. } else {
  25096. $1=$recv(aContext)._home();
  25097. $ctx1.sendIdx["home"]=1;
  25098. if(($receiver = $1) == null || $receiver.a$nil){
  25099. $1;
  25100. } else {
  25101. $self._logContext_($recv(aContext)._home());
  25102. }
  25103. }
  25104. return self;
  25105. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25106. },
  25107. args: ["aContext"],
  25108. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25109. referencedClasses: [],
  25110. messageSends: ["ifNotNil:", "home", "logContext:"]
  25111. }),
  25112. $globals.ConsoleErrorHandler);
  25113. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25114. $core.addMethod(
  25115. $core.method({
  25116. selector: "initialize",
  25117. protocol: "initialization",
  25118. fn: function (){
  25119. var self=this,$self=this;
  25120. return $core.withContext(function($ctx1) {
  25121. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25122. return self;
  25123. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25124. },
  25125. args: [],
  25126. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25127. referencedClasses: ["ErrorHandler"],
  25128. messageSends: ["registerIfNone:", "new"]
  25129. }),
  25130. $globals.ConsoleErrorHandler.a$cls);
  25131. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25132. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25133. $core.addMethod(
  25134. $core.method({
  25135. selector: "clear",
  25136. protocol: "printing",
  25137. fn: function (){
  25138. var self=this,$self=this;
  25139. return self;
  25140. },
  25141. args: [],
  25142. source: "clear\x0a\x09\x22no op\x22",
  25143. referencedClasses: [],
  25144. messageSends: []
  25145. }),
  25146. $globals.ConsoleTranscript);
  25147. $core.addMethod(
  25148. $core.method({
  25149. selector: "cr",
  25150. protocol: "printing",
  25151. fn: function (){
  25152. var self=this,$self=this;
  25153. return self;
  25154. },
  25155. args: [],
  25156. source: "cr\x0a\x09\x22no op\x22",
  25157. referencedClasses: [],
  25158. messageSends: []
  25159. }),
  25160. $globals.ConsoleTranscript);
  25161. $core.addMethod(
  25162. $core.method({
  25163. selector: "open",
  25164. protocol: "actions",
  25165. fn: function (){
  25166. var self=this,$self=this;
  25167. return self;
  25168. },
  25169. args: [],
  25170. source: "open",
  25171. referencedClasses: [],
  25172. messageSends: []
  25173. }),
  25174. $globals.ConsoleTranscript);
  25175. $core.addMethod(
  25176. $core.method({
  25177. selector: "show:",
  25178. protocol: "printing",
  25179. fn: function (anObject){
  25180. var self=this,$self=this;
  25181. return $core.withContext(function($ctx1) {
  25182. console.log(String($recv(anObject)._asString()));
  25183. return self;
  25184. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25185. },
  25186. args: ["anObject"],
  25187. 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()))'>",
  25188. referencedClasses: [],
  25189. messageSends: []
  25190. }),
  25191. $globals.ConsoleTranscript);
  25192. $core.addMethod(
  25193. $core.method({
  25194. selector: "initialize",
  25195. protocol: "initialization",
  25196. fn: function (){
  25197. var self=this,$self=this;
  25198. return $core.withContext(function($ctx1) {
  25199. $recv($globals.Transcript)._registerIfNone_($self._new());
  25200. return self;
  25201. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25202. },
  25203. args: [],
  25204. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25205. referencedClasses: ["Transcript"],
  25206. messageSends: ["registerIfNone:", "new"]
  25207. }),
  25208. $globals.ConsoleTranscript.a$cls);
  25209. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25210. $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.";
  25211. $core.addMethod(
  25212. $core.method({
  25213. selector: "addInstVarNamed:to:",
  25214. protocol: "compiling",
  25215. fn: function (aString,aClass){
  25216. var self=this,$self=this;
  25217. return $core.withContext(function($ctx1) {
  25218. var $1,$2,$3,$5,$4;
  25219. $1=$self._classBuilder();
  25220. $2=$recv(aClass)._superclass();
  25221. $3=$recv(aClass)._name();
  25222. $ctx1.sendIdx["name"]=1;
  25223. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  25224. $recv($5)._add_(aString);
  25225. $4=$recv($5)._yourself();
  25226. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  25227. return self;
  25228. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  25229. },
  25230. args: ["aString", "aClass"],
  25231. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  25232. referencedClasses: [],
  25233. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  25234. }),
  25235. $globals.Environment);
  25236. $core.addMethod(
  25237. $core.method({
  25238. selector: "allSelectors",
  25239. protocol: "accessing",
  25240. fn: function (){
  25241. var self=this,$self=this;
  25242. return $core.withContext(function($ctx1) {
  25243. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25244. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25245. },
  25246. args: [],
  25247. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25248. referencedClasses: ["Smalltalk"],
  25249. messageSends: ["allSelectors", "core"]
  25250. }),
  25251. $globals.Environment);
  25252. $core.addMethod(
  25253. $core.method({
  25254. selector: "availableClassNames",
  25255. protocol: "accessing",
  25256. fn: function (){
  25257. var self=this,$self=this;
  25258. return $core.withContext(function($ctx1) {
  25259. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25260. return $core.withContext(function($ctx2) {
  25261. return $recv(each)._name();
  25262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25263. }));
  25264. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25265. },
  25266. args: [],
  25267. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25268. referencedClasses: ["Smalltalk"],
  25269. messageSends: ["collect:", "classes", "name"]
  25270. }),
  25271. $globals.Environment);
  25272. $core.addMethod(
  25273. $core.method({
  25274. selector: "availablePackageNames",
  25275. protocol: "accessing",
  25276. fn: function (){
  25277. var self=this,$self=this;
  25278. return $core.withContext(function($ctx1) {
  25279. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25280. return $core.withContext(function($ctx2) {
  25281. return $recv(each)._name();
  25282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25283. }));
  25284. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25285. },
  25286. args: [],
  25287. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25288. referencedClasses: ["Smalltalk"],
  25289. messageSends: ["collect:", "packages", "name"]
  25290. }),
  25291. $globals.Environment);
  25292. $core.addMethod(
  25293. $core.method({
  25294. selector: "availableProtocolsFor:",
  25295. protocol: "accessing",
  25296. fn: function (aClass){
  25297. var self=this,$self=this;
  25298. var protocols;
  25299. return $core.withContext(function($ctx1) {
  25300. var $1,$receiver;
  25301. protocols=$recv(aClass)._protocols();
  25302. $1=$recv(aClass)._superclass();
  25303. $ctx1.sendIdx["superclass"]=1;
  25304. if(($receiver = $1) == null || $receiver.a$nil){
  25305. $1;
  25306. } else {
  25307. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25308. }
  25309. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25310. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25311. },
  25312. args: ["aClass"],
  25313. 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",
  25314. referencedClasses: [],
  25315. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25316. }),
  25317. $globals.Environment);
  25318. $core.addMethod(
  25319. $core.method({
  25320. selector: "classBuilder",
  25321. protocol: "accessing",
  25322. fn: function (){
  25323. var self=this,$self=this;
  25324. return $core.withContext(function($ctx1) {
  25325. return $recv($globals.ClassBuilder)._new();
  25326. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25327. },
  25328. args: [],
  25329. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25330. referencedClasses: ["ClassBuilder"],
  25331. messageSends: ["new"]
  25332. }),
  25333. $globals.Environment);
  25334. $core.addMethod(
  25335. $core.method({
  25336. selector: "classNamed:",
  25337. protocol: "accessing",
  25338. fn: function (aString){
  25339. var self=this,$self=this;
  25340. return $core.withContext(function($ctx1) {
  25341. var $1,$receiver;
  25342. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25343. if(($receiver = $1) == null || $receiver.a$nil){
  25344. return $self._error_("Invalid class name");
  25345. } else {
  25346. return $1;
  25347. }
  25348. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25349. },
  25350. args: ["aString"],
  25351. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25352. referencedClasses: ["Smalltalk"],
  25353. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25354. }),
  25355. $globals.Environment);
  25356. $core.addMethod(
  25357. $core.method({
  25358. selector: "classes",
  25359. protocol: "accessing",
  25360. fn: function (){
  25361. var self=this,$self=this;
  25362. return $core.withContext(function($ctx1) {
  25363. return $recv($globals.Smalltalk)._classes();
  25364. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25365. },
  25366. args: [],
  25367. source: "classes\x0a\x09^ Smalltalk classes",
  25368. referencedClasses: ["Smalltalk"],
  25369. messageSends: ["classes"]
  25370. }),
  25371. $globals.Environment);
  25372. $core.addMethod(
  25373. $core.method({
  25374. selector: "commitPackage:onSuccess:onError:",
  25375. protocol: "actions",
  25376. fn: function (aPackage,aBlock,anotherBlock){
  25377. var self=this,$self=this;
  25378. return $core.withContext(function($ctx1) {
  25379. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25380. return self;
  25381. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25382. },
  25383. args: ["aPackage", "aBlock", "anotherBlock"],
  25384. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25385. referencedClasses: [],
  25386. messageSends: ["commitOnSuccess:onError:", "transport"]
  25387. }),
  25388. $globals.Environment);
  25389. $core.addMethod(
  25390. $core.method({
  25391. selector: "compileClassComment:for:",
  25392. protocol: "compiling",
  25393. fn: function (aString,aClass){
  25394. var self=this,$self=this;
  25395. return $core.withContext(function($ctx1) {
  25396. $recv(aClass)._comment_(aString);
  25397. return self;
  25398. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25399. },
  25400. args: ["aString", "aClass"],
  25401. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25402. referencedClasses: [],
  25403. messageSends: ["comment:"]
  25404. }),
  25405. $globals.Environment);
  25406. $core.addMethod(
  25407. $core.method({
  25408. selector: "compileClassDefinition:",
  25409. protocol: "compiling",
  25410. fn: function (aString){
  25411. var self=this,$self=this;
  25412. return $core.withContext(function($ctx1) {
  25413. $recv((function(){
  25414. return $core.withContext(function($ctx2) {
  25415. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25417. }))._on_do_($globals.Error,(function(error){
  25418. return $core.withContext(function($ctx2) {
  25419. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25420. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25421. }));
  25422. return self;
  25423. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25424. },
  25425. args: ["aString"],
  25426. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25427. referencedClasses: ["DoIt", "Error", "Terminal"],
  25428. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25429. }),
  25430. $globals.Environment);
  25431. $core.addMethod(
  25432. $core.method({
  25433. selector: "compileMethod:for:protocol:",
  25434. protocol: "compiling",
  25435. fn: function (sourceCode,class_,protocol){
  25436. var self=this,$self=this;
  25437. return $core.withContext(function($ctx1) {
  25438. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25439. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25440. },
  25441. args: ["sourceCode", "class", "protocol"],
  25442. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25443. referencedClasses: [],
  25444. messageSends: ["compile:protocol:"]
  25445. }),
  25446. $globals.Environment);
  25447. $core.addMethod(
  25448. $core.method({
  25449. selector: "copyClass:to:",
  25450. protocol: "actions",
  25451. fn: function (aClass,aClassName){
  25452. var self=this,$self=this;
  25453. return $core.withContext(function($ctx1) {
  25454. var $1,$2,$receiver;
  25455. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25456. if(($receiver = $1) == null || $receiver.a$nil){
  25457. $1;
  25458. } else {
  25459. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25460. $ctx1.sendIdx[","]=1;
  25461. $self._error_($2);
  25462. }
  25463. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25464. return self;
  25465. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25466. },
  25467. args: ["aClass", "aClassName"],
  25468. 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",
  25469. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25470. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25471. }),
  25472. $globals.Environment);
  25473. $core.addMethod(
  25474. $core.method({
  25475. selector: "doItReceiver",
  25476. protocol: "accessing",
  25477. fn: function (){
  25478. var self=this,$self=this;
  25479. return $core.withContext(function($ctx1) {
  25480. return $recv($globals.DoIt)._new();
  25481. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25482. },
  25483. args: [],
  25484. source: "doItReceiver\x0a\x09^ DoIt new",
  25485. referencedClasses: ["DoIt"],
  25486. messageSends: ["new"]
  25487. }),
  25488. $globals.Environment);
  25489. $core.addMethod(
  25490. $core.method({
  25491. selector: "evaluate:for:",
  25492. protocol: "evaluating",
  25493. fn: function (aString,anObject){
  25494. var self=this,$self=this;
  25495. return $core.withContext(function($ctx1) {
  25496. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25497. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25498. },
  25499. args: ["aString", "anObject"],
  25500. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25501. referencedClasses: ["Evaluator"],
  25502. messageSends: ["evaluate:for:"]
  25503. }),
  25504. $globals.Environment);
  25505. $core.addMethod(
  25506. $core.method({
  25507. selector: "evaluate:on:do:",
  25508. protocol: "error handling",
  25509. fn: function (aBlock,anErrorClass,exceptionBlock){
  25510. var self=this,$self=this;
  25511. return $core.withContext(function($ctx1) {
  25512. var $1;
  25513. $recv(aBlock)._tryCatch_((function(exception){
  25514. return $core.withContext(function($ctx2) {
  25515. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25516. if($core.assert($1)){
  25517. return $recv(exceptionBlock)._value_(exception);
  25518. } else {
  25519. return $recv(exception)._resignal();
  25520. }
  25521. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25522. }));
  25523. return self;
  25524. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25525. },
  25526. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25527. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  25528. referencedClasses: [],
  25529. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  25530. }),
  25531. $globals.Environment);
  25532. $core.addMethod(
  25533. $core.method({
  25534. selector: "inspect:",
  25535. protocol: "actions",
  25536. fn: function (anObject){
  25537. var self=this,$self=this;
  25538. return $core.withContext(function($ctx1) {
  25539. $recv($globals.Inspector)._inspect_(anObject);
  25540. return self;
  25541. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25542. },
  25543. args: ["anObject"],
  25544. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25545. referencedClasses: ["Inspector"],
  25546. messageSends: ["inspect:"]
  25547. }),
  25548. $globals.Environment);
  25549. $core.addMethod(
  25550. $core.method({
  25551. selector: "moveClass:toPackage:",
  25552. protocol: "actions",
  25553. fn: function (aClass,aPackageName){
  25554. var self=this,$self=this;
  25555. var package_;
  25556. return $core.withContext(function($ctx1) {
  25557. var $1,$2,$receiver;
  25558. package_=$recv($globals.Package)._named_(aPackageName);
  25559. $1=package_;
  25560. if(($receiver = $1) == null || $receiver.a$nil){
  25561. $self._error_("Invalid package name");
  25562. } else {
  25563. $1;
  25564. }
  25565. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25566. if($core.assert($2)){
  25567. return self;
  25568. }
  25569. $recv(aClass)._package_(package_);
  25570. $recv(aClass)._recompile();
  25571. return self;
  25572. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25573. },
  25574. args: ["aClass", "aPackageName"],
  25575. 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",
  25576. referencedClasses: ["Package"],
  25577. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25578. }),
  25579. $globals.Environment);
  25580. $core.addMethod(
  25581. $core.method({
  25582. selector: "moveMethod:toClass:",
  25583. protocol: "actions",
  25584. fn: function (aMethod,aClassName){
  25585. var self=this,$self=this;
  25586. var destinationClass;
  25587. return $core.withContext(function($ctx1) {
  25588. var $2,$3,$1,$5,$4;
  25589. destinationClass=$self._classNamed_(aClassName);
  25590. $2=destinationClass;
  25591. $3=$recv(aMethod)._methodClass();
  25592. $ctx1.sendIdx["methodClass"]=1;
  25593. $1=$recv($2).__eq_eq($3);
  25594. if($core.assert($1)){
  25595. return self;
  25596. }
  25597. $5=$recv(aMethod)._methodClass();
  25598. $ctx1.sendIdx["methodClass"]=2;
  25599. $4=$recv($5)._isMetaclass();
  25600. if($core.assert($4)){
  25601. destinationClass=$recv(destinationClass)._theMetaClass();
  25602. destinationClass;
  25603. }
  25604. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25605. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25606. return self;
  25607. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25608. },
  25609. args: ["aMethod", "aClassName"],
  25610. 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",
  25611. referencedClasses: [],
  25612. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25613. }),
  25614. $globals.Environment);
  25615. $core.addMethod(
  25616. $core.method({
  25617. selector: "moveMethod:toProtocol:",
  25618. protocol: "actions",
  25619. fn: function (aMethod,aProtocol){
  25620. var self=this,$self=this;
  25621. return $core.withContext(function($ctx1) {
  25622. $recv(aMethod)._protocol_(aProtocol);
  25623. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25624. return self;
  25625. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25626. },
  25627. args: ["aMethod", "aProtocol"],
  25628. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25629. referencedClasses: [],
  25630. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25631. }),
  25632. $globals.Environment);
  25633. $core.addMethod(
  25634. $core.method({
  25635. selector: "packages",
  25636. protocol: "accessing",
  25637. fn: function (){
  25638. var self=this,$self=this;
  25639. return $core.withContext(function($ctx1) {
  25640. return $recv($globals.Smalltalk)._packages();
  25641. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25642. },
  25643. args: [],
  25644. source: "packages\x0a\x09^ Smalltalk packages",
  25645. referencedClasses: ["Smalltalk"],
  25646. messageSends: ["packages"]
  25647. }),
  25648. $globals.Environment);
  25649. $core.addMethod(
  25650. $core.method({
  25651. selector: "registerErrorHandler:",
  25652. protocol: "services",
  25653. fn: function (anErrorHandler){
  25654. var self=this,$self=this;
  25655. return $core.withContext(function($ctx1) {
  25656. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25657. return self;
  25658. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25659. },
  25660. args: ["anErrorHandler"],
  25661. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25662. referencedClasses: ["ErrorHandler"],
  25663. messageSends: ["register:"]
  25664. }),
  25665. $globals.Environment);
  25666. $core.addMethod(
  25667. $core.method({
  25668. selector: "registerFinder:",
  25669. protocol: "services",
  25670. fn: function (aFinder){
  25671. var self=this,$self=this;
  25672. return $core.withContext(function($ctx1) {
  25673. $recv($globals.Finder)._register_(aFinder);
  25674. return self;
  25675. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25676. },
  25677. args: ["aFinder"],
  25678. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25679. referencedClasses: ["Finder"],
  25680. messageSends: ["register:"]
  25681. }),
  25682. $globals.Environment);
  25683. $core.addMethod(
  25684. $core.method({
  25685. selector: "registerInspector:",
  25686. protocol: "services",
  25687. fn: function (anInspector){
  25688. var self=this,$self=this;
  25689. return $core.withContext(function($ctx1) {
  25690. $recv($globals.Inspector)._register_(anInspector);
  25691. return self;
  25692. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25693. },
  25694. args: ["anInspector"],
  25695. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25696. referencedClasses: ["Inspector"],
  25697. messageSends: ["register:"]
  25698. }),
  25699. $globals.Environment);
  25700. $core.addMethod(
  25701. $core.method({
  25702. selector: "registerProgressHandler:",
  25703. protocol: "services",
  25704. fn: function (aProgressHandler){
  25705. var self=this,$self=this;
  25706. return $core.withContext(function($ctx1) {
  25707. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25708. return self;
  25709. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25710. },
  25711. args: ["aProgressHandler"],
  25712. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25713. referencedClasses: ["ProgressHandler"],
  25714. messageSends: ["register:"]
  25715. }),
  25716. $globals.Environment);
  25717. $core.addMethod(
  25718. $core.method({
  25719. selector: "registerTranscript:",
  25720. protocol: "services",
  25721. fn: function (aTranscript){
  25722. var self=this,$self=this;
  25723. return $core.withContext(function($ctx1) {
  25724. $recv($globals.Transcript)._register_(aTranscript);
  25725. return self;
  25726. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25727. },
  25728. args: ["aTranscript"],
  25729. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25730. referencedClasses: ["Transcript"],
  25731. messageSends: ["register:"]
  25732. }),
  25733. $globals.Environment);
  25734. $core.addMethod(
  25735. $core.method({
  25736. selector: "removeClass:",
  25737. protocol: "actions",
  25738. fn: function (aClass){
  25739. var self=this,$self=this;
  25740. return $core.withContext(function($ctx1) {
  25741. $recv($globals.Smalltalk)._removeClass_(aClass);
  25742. return self;
  25743. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25744. },
  25745. args: ["aClass"],
  25746. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25747. referencedClasses: ["Smalltalk"],
  25748. messageSends: ["removeClass:"]
  25749. }),
  25750. $globals.Environment);
  25751. $core.addMethod(
  25752. $core.method({
  25753. selector: "removeMethod:",
  25754. protocol: "actions",
  25755. fn: function (aMethod){
  25756. var self=this,$self=this;
  25757. return $core.withContext(function($ctx1) {
  25758. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25759. return self;
  25760. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25761. },
  25762. args: ["aMethod"],
  25763. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25764. referencedClasses: [],
  25765. messageSends: ["removeCompiledMethod:", "methodClass"]
  25766. }),
  25767. $globals.Environment);
  25768. $core.addMethod(
  25769. $core.method({
  25770. selector: "removeProtocol:from:",
  25771. protocol: "actions",
  25772. fn: function (aString,aClass){
  25773. var self=this,$self=this;
  25774. return $core.withContext(function($ctx1) {
  25775. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25776. return $core.withContext(function($ctx2) {
  25777. return $recv(aClass)._removeCompiledMethod_(each);
  25778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25779. }));
  25780. return self;
  25781. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25782. },
  25783. args: ["aString", "aClass"],
  25784. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25785. referencedClasses: [],
  25786. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25787. }),
  25788. $globals.Environment);
  25789. $core.addMethod(
  25790. $core.method({
  25791. selector: "renameClass:to:",
  25792. protocol: "actions",
  25793. fn: function (aClass,aClassName){
  25794. var self=this,$self=this;
  25795. return $core.withContext(function($ctx1) {
  25796. var $1,$2,$receiver;
  25797. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25798. if(($receiver = $1) == null || $receiver.a$nil){
  25799. $1;
  25800. } else {
  25801. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25802. $ctx1.sendIdx[","]=1;
  25803. $self._error_($2);
  25804. }
  25805. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25806. return self;
  25807. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25808. },
  25809. args: ["aClass", "aClassName"],
  25810. 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",
  25811. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25812. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25813. }),
  25814. $globals.Environment);
  25815. $core.addMethod(
  25816. $core.method({
  25817. selector: "renamePackage:to:",
  25818. protocol: "actions",
  25819. fn: function (aPackageName,aNewPackageName){
  25820. var self=this,$self=this;
  25821. return $core.withContext(function($ctx1) {
  25822. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25823. return self;
  25824. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25825. },
  25826. args: ["aPackageName", "aNewPackageName"],
  25827. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25828. referencedClasses: ["Smalltalk"],
  25829. messageSends: ["renamePackage:to:"]
  25830. }),
  25831. $globals.Environment);
  25832. $core.addMethod(
  25833. $core.method({
  25834. selector: "renameProtocol:to:in:",
  25835. protocol: "actions",
  25836. fn: function (aString,anotherString,aClass){
  25837. var self=this,$self=this;
  25838. return $core.withContext(function($ctx1) {
  25839. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25840. return $core.withContext(function($ctx2) {
  25841. return $recv(each)._protocol_(anotherString);
  25842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25843. }));
  25844. return self;
  25845. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25846. },
  25847. args: ["aString", "anotherString", "aClass"],
  25848. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25849. referencedClasses: [],
  25850. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25851. }),
  25852. $globals.Environment);
  25853. $core.addMethod(
  25854. $core.method({
  25855. selector: "setClassCommentOf:to:",
  25856. protocol: "actions",
  25857. fn: function (aClass,aString){
  25858. var self=this,$self=this;
  25859. return $core.withContext(function($ctx1) {
  25860. $recv(aClass)._comment_(aString);
  25861. return self;
  25862. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25863. },
  25864. args: ["aClass", "aString"],
  25865. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25866. referencedClasses: [],
  25867. messageSends: ["comment:"]
  25868. }),
  25869. $globals.Environment);
  25870. $core.addMethod(
  25871. $core.method({
  25872. selector: "systemAnnouncer",
  25873. protocol: "accessing",
  25874. fn: function (){
  25875. var self=this,$self=this;
  25876. return $core.withContext(function($ctx1) {
  25877. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25878. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25879. },
  25880. args: [],
  25881. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25882. referencedClasses: ["Smalltalk"],
  25883. messageSends: ["current", "at:", "globals"]
  25884. }),
  25885. $globals.Environment);
  25886. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25887. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25888. $core.addMethod(
  25889. $core.method({
  25890. selector: "do:on:displaying:",
  25891. protocol: "progress handling",
  25892. fn: function (aBlock,aCollection,aString){
  25893. var self=this,$self=this;
  25894. return $core.withContext(function($ctx1) {
  25895. $recv(aCollection)._do_(aBlock);
  25896. return self;
  25897. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25898. },
  25899. args: ["aBlock", "aCollection", "aString"],
  25900. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25901. referencedClasses: [],
  25902. messageSends: ["do:"]
  25903. }),
  25904. $globals.NullProgressHandler);
  25905. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  25906. $core.addMethod(
  25907. $core.method({
  25908. selector: "initialize",
  25909. protocol: "initialization",
  25910. fn: function (){
  25911. var self=this,$self=this;
  25912. return $core.withContext(function($ctx1) {
  25913. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  25914. return self;
  25915. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  25916. },
  25917. args: [],
  25918. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  25919. referencedClasses: ["ProgressHandler"],
  25920. messageSends: ["registerIfNone:", "new"]
  25921. }),
  25922. $globals.NullProgressHandler.a$cls);
  25923. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  25924. $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.";
  25925. $globals.Service.a$cls.iVarNames = ["current"];
  25926. $core.addMethod(
  25927. $core.method({
  25928. selector: "current",
  25929. protocol: "accessing",
  25930. fn: function (){
  25931. var self=this,$self=this;
  25932. return $self["@current"];
  25933. },
  25934. args: [],
  25935. source: "current\x0a\x09^ current",
  25936. referencedClasses: [],
  25937. messageSends: []
  25938. }),
  25939. $globals.Service.a$cls);
  25940. $core.addMethod(
  25941. $core.method({
  25942. selector: "new",
  25943. protocol: "instance creation",
  25944. fn: function (){
  25945. var self=this,$self=this;
  25946. return $core.withContext(function($ctx1) {
  25947. $self._shouldNotImplement();
  25948. return self;
  25949. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  25950. },
  25951. args: [],
  25952. source: "new\x0a\x09self shouldNotImplement",
  25953. referencedClasses: [],
  25954. messageSends: ["shouldNotImplement"]
  25955. }),
  25956. $globals.Service.a$cls);
  25957. $core.addMethod(
  25958. $core.method({
  25959. selector: "register:",
  25960. protocol: "registration",
  25961. fn: function (anObject){
  25962. var self=this,$self=this;
  25963. $self["@current"]=anObject;
  25964. return self;
  25965. },
  25966. args: ["anObject"],
  25967. source: "register: anObject\x0a\x09current := anObject",
  25968. referencedClasses: [],
  25969. messageSends: []
  25970. }),
  25971. $globals.Service.a$cls);
  25972. $core.addMethod(
  25973. $core.method({
  25974. selector: "registerIfNone:",
  25975. protocol: "registration",
  25976. fn: function (anObject){
  25977. var self=this,$self=this;
  25978. return $core.withContext(function($ctx1) {
  25979. var $1,$receiver;
  25980. $1=$self._current();
  25981. if(($receiver = $1) == null || $receiver.a$nil){
  25982. $self._register_(anObject);
  25983. } else {
  25984. $1;
  25985. }
  25986. return self;
  25987. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  25988. },
  25989. args: ["anObject"],
  25990. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  25991. referencedClasses: [],
  25992. messageSends: ["ifNil:", "current", "register:"]
  25993. }),
  25994. $globals.Service.a$cls);
  25995. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  25996. $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.";
  25997. $core.addMethod(
  25998. $core.method({
  25999. selector: "handleError:",
  26000. protocol: "error handling",
  26001. fn: function (anError){
  26002. var self=this,$self=this;
  26003. return $core.withContext(function($ctx1) {
  26004. var $1;
  26005. $1=$recv((function(){
  26006. return $core.withContext(function($ctx2) {
  26007. return $recv(anError)._isSmalltalkError();
  26008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26009. }))._tryCatch_((function(){
  26010. return false;
  26011. }));
  26012. if($core.assert($1)){
  26013. $self._handleUnhandledError_(anError);
  26014. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26015. } else {
  26016. var smalltalkError;
  26017. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26018. smalltalkError;
  26019. $recv(smalltalkError)._wrap();
  26020. $self._handleUnhandledError_(smalltalkError);
  26021. }
  26022. return self;
  26023. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26024. },
  26025. args: ["anError"],
  26026. 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 ]",
  26027. referencedClasses: ["JavaScriptException"],
  26028. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26029. }),
  26030. $globals.ErrorHandler.a$cls);
  26031. $core.addMethod(
  26032. $core.method({
  26033. selector: "handleUnhandledError:",
  26034. protocol: "error handling",
  26035. fn: function (anError){
  26036. var self=this,$self=this;
  26037. return $core.withContext(function($ctx1) {
  26038. var $1;
  26039. $1=$recv(anError)._wasHandled();
  26040. if(!$core.assert($1)){
  26041. $recv($self._current())._handleError_(anError);
  26042. $recv(anError)._beHandled();
  26043. }
  26044. return self;
  26045. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26046. },
  26047. args: ["anError"],
  26048. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26049. referencedClasses: [],
  26050. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26051. }),
  26052. $globals.ErrorHandler.a$cls);
  26053. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26054. $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.";
  26055. $core.addMethod(
  26056. $core.method({
  26057. selector: "findClass:",
  26058. protocol: "finding",
  26059. fn: function (aClass){
  26060. var self=this,$self=this;
  26061. return $core.withContext(function($ctx1) {
  26062. return $recv($self._current())._findClass_(aClass);
  26063. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26064. },
  26065. args: ["aClass"],
  26066. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26067. referencedClasses: [],
  26068. messageSends: ["findClass:", "current"]
  26069. }),
  26070. $globals.Finder.a$cls);
  26071. $core.addMethod(
  26072. $core.method({
  26073. selector: "findMethod:",
  26074. protocol: "finding",
  26075. fn: function (aCompiledMethod){
  26076. var self=this,$self=this;
  26077. return $core.withContext(function($ctx1) {
  26078. return $recv($self._current())._findMethod_(aCompiledMethod);
  26079. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26080. },
  26081. args: ["aCompiledMethod"],
  26082. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26083. referencedClasses: [],
  26084. messageSends: ["findMethod:", "current"]
  26085. }),
  26086. $globals.Finder.a$cls);
  26087. $core.addMethod(
  26088. $core.method({
  26089. selector: "findString:",
  26090. protocol: "finding",
  26091. fn: function (aString){
  26092. var self=this,$self=this;
  26093. return $core.withContext(function($ctx1) {
  26094. return $recv($self._current())._findString_(aString);
  26095. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26096. },
  26097. args: ["aString"],
  26098. source: "findString: aString\x0a\x09^ self current findString: aString",
  26099. referencedClasses: [],
  26100. messageSends: ["findString:", "current"]
  26101. }),
  26102. $globals.Finder.a$cls);
  26103. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26104. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26105. $core.addMethod(
  26106. $core.method({
  26107. selector: "inspect:",
  26108. protocol: "inspecting",
  26109. fn: function (anObject){
  26110. var self=this,$self=this;
  26111. return $core.withContext(function($ctx1) {
  26112. return $recv($self._current())._inspect_(anObject);
  26113. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26114. },
  26115. args: ["anObject"],
  26116. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26117. referencedClasses: [],
  26118. messageSends: ["inspect:", "current"]
  26119. }),
  26120. $globals.Inspector.a$cls);
  26121. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26122. $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";
  26123. $core.addMethod(
  26124. $core.method({
  26125. selector: "globals",
  26126. protocol: "accessing",
  26127. fn: function (){
  26128. var self=this,$self=this;
  26129. return $core.withContext(function($ctx1) {
  26130. return $recv($self._current())._globals();
  26131. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26132. },
  26133. args: [],
  26134. source: "globals\x0a\x09^ self current globals",
  26135. referencedClasses: [],
  26136. messageSends: ["globals", "current"]
  26137. }),
  26138. $globals.Platform.a$cls);
  26139. $core.addMethod(
  26140. $core.method({
  26141. selector: "newXhr",
  26142. protocol: "accessing",
  26143. fn: function (){
  26144. var self=this,$self=this;
  26145. return $core.withContext(function($ctx1) {
  26146. return $recv($self._current())._newXhr();
  26147. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26148. },
  26149. args: [],
  26150. source: "newXhr\x0a\x09^ self current newXhr",
  26151. referencedClasses: [],
  26152. messageSends: ["newXhr", "current"]
  26153. }),
  26154. $globals.Platform.a$cls);
  26155. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26156. $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`.";
  26157. $core.addMethod(
  26158. $core.method({
  26159. selector: "do:on:displaying:",
  26160. protocol: "progress handling",
  26161. fn: function (aBlock,aCollection,aString){
  26162. var self=this,$self=this;
  26163. return $core.withContext(function($ctx1) {
  26164. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26165. return self;
  26166. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26167. },
  26168. args: ["aBlock", "aCollection", "aString"],
  26169. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26170. referencedClasses: [],
  26171. messageSends: ["do:on:displaying:", "current"]
  26172. }),
  26173. $globals.ProgressHandler.a$cls);
  26174. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26175. $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:'.";
  26176. $core.addMethod(
  26177. $core.method({
  26178. selector: "alert:",
  26179. protocol: "dialogs",
  26180. fn: function (aString){
  26181. var self=this,$self=this;
  26182. return $core.withContext(function($ctx1) {
  26183. return $recv($self._current())._alert_(aString);
  26184. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26185. },
  26186. args: ["aString"],
  26187. source: "alert: aString\x0a\x09^ self current alert: aString",
  26188. referencedClasses: [],
  26189. messageSends: ["alert:", "current"]
  26190. }),
  26191. $globals.Terminal.a$cls);
  26192. $core.addMethod(
  26193. $core.method({
  26194. selector: "confirm:",
  26195. protocol: "dialogs",
  26196. fn: function (aString){
  26197. var self=this,$self=this;
  26198. return $core.withContext(function($ctx1) {
  26199. return $recv($self._current())._confirm_(aString);
  26200. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26201. },
  26202. args: ["aString"],
  26203. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26204. referencedClasses: [],
  26205. messageSends: ["confirm:", "current"]
  26206. }),
  26207. $globals.Terminal.a$cls);
  26208. $core.addMethod(
  26209. $core.method({
  26210. selector: "prompt:",
  26211. protocol: "dialogs",
  26212. fn: function (aString){
  26213. var self=this,$self=this;
  26214. return $core.withContext(function($ctx1) {
  26215. return $recv($self._current())._prompt_(aString);
  26216. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26217. },
  26218. args: ["aString"],
  26219. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26220. referencedClasses: [],
  26221. messageSends: ["prompt:", "current"]
  26222. }),
  26223. $globals.Terminal.a$cls);
  26224. $core.addMethod(
  26225. $core.method({
  26226. selector: "prompt:default:",
  26227. protocol: "dialogs",
  26228. fn: function (aString,defaultString){
  26229. var self=this,$self=this;
  26230. return $core.withContext(function($ctx1) {
  26231. return $recv($self._current())._prompt_default_(aString,defaultString);
  26232. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26233. },
  26234. args: ["aString", "defaultString"],
  26235. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26236. referencedClasses: [],
  26237. messageSends: ["prompt:default:", "current"]
  26238. }),
  26239. $globals.Terminal.a$cls);
  26240. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26241. $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.";
  26242. $core.addMethod(
  26243. $core.method({
  26244. selector: "clear",
  26245. protocol: "printing",
  26246. fn: function (){
  26247. var self=this,$self=this;
  26248. return $core.withContext(function($ctx1) {
  26249. $recv($self._current())._clear();
  26250. return self;
  26251. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26252. },
  26253. args: [],
  26254. source: "clear\x0a\x09self current clear",
  26255. referencedClasses: [],
  26256. messageSends: ["clear", "current"]
  26257. }),
  26258. $globals.Transcript.a$cls);
  26259. $core.addMethod(
  26260. $core.method({
  26261. selector: "cr",
  26262. protocol: "printing",
  26263. fn: function (){
  26264. var self=this,$self=this;
  26265. return $core.withContext(function($ctx1) {
  26266. $recv($self._current())._show_($recv($globals.String)._cr());
  26267. return self;
  26268. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26269. },
  26270. args: [],
  26271. source: "cr\x0a\x09self current show: String cr",
  26272. referencedClasses: ["String"],
  26273. messageSends: ["show:", "current", "cr"]
  26274. }),
  26275. $globals.Transcript.a$cls);
  26276. $core.addMethod(
  26277. $core.method({
  26278. selector: "inspect:",
  26279. protocol: "printing",
  26280. fn: function (anObject){
  26281. var self=this,$self=this;
  26282. return $core.withContext(function($ctx1) {
  26283. $self._show_(anObject);
  26284. return self;
  26285. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26286. },
  26287. args: ["anObject"],
  26288. source: "inspect: anObject\x0a\x09self show: anObject",
  26289. referencedClasses: [],
  26290. messageSends: ["show:"]
  26291. }),
  26292. $globals.Transcript.a$cls);
  26293. $core.addMethod(
  26294. $core.method({
  26295. selector: "open",
  26296. protocol: "instance creation",
  26297. fn: function (){
  26298. var self=this,$self=this;
  26299. return $core.withContext(function($ctx1) {
  26300. $recv($self._current())._open();
  26301. return self;
  26302. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26303. },
  26304. args: [],
  26305. source: "open\x0a\x09self current open",
  26306. referencedClasses: [],
  26307. messageSends: ["open", "current"]
  26308. }),
  26309. $globals.Transcript.a$cls);
  26310. $core.addMethod(
  26311. $core.method({
  26312. selector: "show:",
  26313. protocol: "printing",
  26314. fn: function (anObject){
  26315. var self=this,$self=this;
  26316. return $core.withContext(function($ctx1) {
  26317. $recv($self._current())._show_(anObject);
  26318. return self;
  26319. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26320. },
  26321. args: ["anObject"],
  26322. source: "show: anObject\x0a\x09self current show: anObject",
  26323. referencedClasses: [],
  26324. messageSends: ["show:", "current"]
  26325. }),
  26326. $globals.Transcript.a$cls);
  26327. $core.addMethod(
  26328. $core.method({
  26329. selector: "inspectOn:",
  26330. protocol: "*Platform-Services",
  26331. fn: function (anInspector){
  26332. var self=this,$self=this;
  26333. var variables;
  26334. return $core.withContext(function($ctx1) {
  26335. variables=$recv($globals.Dictionary)._new();
  26336. $recv(variables)._at_put_("#self",self);
  26337. $ctx1.sendIdx["at:put:"]=1;
  26338. $recv(variables)._at_put_("#keys",$self._keys());
  26339. $ctx1.sendIdx["at:put:"]=2;
  26340. $self._keysAndValuesDo_((function(key,value){
  26341. return $core.withContext(function($ctx2) {
  26342. return $recv(variables)._at_put_(key,value);
  26343. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26344. }));
  26345. $recv(anInspector)._setLabel_($self._printString());
  26346. $recv(anInspector)._setVariables_(variables);
  26347. return self;
  26348. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26349. },
  26350. args: ["anInspector"],
  26351. 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",
  26352. referencedClasses: ["Dictionary"],
  26353. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26354. }),
  26355. $globals.AssociativeCollection);
  26356. $core.addMethod(
  26357. $core.method({
  26358. selector: "inspectOn:",
  26359. protocol: "*Platform-Services",
  26360. fn: function (anInspector){
  26361. var self=this,$self=this;
  26362. var variables;
  26363. return $core.withContext(function($ctx1) {
  26364. variables=$recv($globals.Dictionary)._new();
  26365. $recv(variables)._at_put_("#self",self);
  26366. $ctx1.sendIdx["at:put:"]=1;
  26367. $self._withIndexDo_((function(each,i){
  26368. return $core.withContext(function($ctx2) {
  26369. return $recv(variables)._at_put_(i,each);
  26370. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26371. }));
  26372. $recv(anInspector)._setLabel_($self._printString());
  26373. $recv(anInspector)._setVariables_(variables);
  26374. return self;
  26375. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26376. },
  26377. args: ["anInspector"],
  26378. 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",
  26379. referencedClasses: ["Dictionary"],
  26380. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26381. }),
  26382. $globals.Collection);
  26383. $core.addMethod(
  26384. $core.method({
  26385. selector: "inspectOn:",
  26386. protocol: "*Platform-Services",
  26387. fn: function (anInspector){
  26388. var self=this,$self=this;
  26389. var variables;
  26390. return $core.withContext(function($ctx1) {
  26391. variables=$recv($globals.Dictionary)._new();
  26392. $recv(variables)._at_put_("#self",self);
  26393. $ctx1.sendIdx["at:put:"]=1;
  26394. $recv(variables)._at_put_("#year",$self._year());
  26395. $ctx1.sendIdx["at:put:"]=2;
  26396. $recv(variables)._at_put_("#month",$self._month());
  26397. $ctx1.sendIdx["at:put:"]=3;
  26398. $recv(variables)._at_put_("#day",$self._day());
  26399. $ctx1.sendIdx["at:put:"]=4;
  26400. $recv(variables)._at_put_("#hours",$self._hours());
  26401. $ctx1.sendIdx["at:put:"]=5;
  26402. $recv(variables)._at_put_("#minutes",$self._minutes());
  26403. $ctx1.sendIdx["at:put:"]=6;
  26404. $recv(variables)._at_put_("#seconds",$self._seconds());
  26405. $ctx1.sendIdx["at:put:"]=7;
  26406. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26407. $recv(anInspector)._setLabel_($self._printString());
  26408. $recv(anInspector)._setVariables_(variables);
  26409. return self;
  26410. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26411. },
  26412. args: ["anInspector"],
  26413. 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",
  26414. referencedClasses: ["Dictionary"],
  26415. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26416. }),
  26417. $globals.Date);
  26418. $core.addMethod(
  26419. $core.method({
  26420. selector: "inspectOn:",
  26421. protocol: "*Platform-Services",
  26422. fn: function (anInspector){
  26423. var self=this,$self=this;
  26424. var variables;
  26425. return $core.withContext(function($ctx1) {
  26426. variables=$recv($globals.Dictionary)._new();
  26427. $recv(variables)._at_put_("#self",$self._jsObject());
  26428. $recv(anInspector)._setLabel_($self._printString());
  26429. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26430. $recv(anInspector)._setVariables_(variables);
  26431. return self;
  26432. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26433. },
  26434. args: ["anInspector"],
  26435. 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",
  26436. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26437. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26438. }),
  26439. $globals.JSObjectProxy);
  26440. $core.addMethod(
  26441. $core.method({
  26442. selector: "inspectOn:",
  26443. protocol: "*Platform-Services",
  26444. fn: function (anInspector){
  26445. var self=this,$self=this;
  26446. var variables;
  26447. return $core.withContext(function($ctx1) {
  26448. variables=$recv($globals.Dictionary)._new();
  26449. $recv(variables)._at_put_("#self",self);
  26450. $ctx1.sendIdx["at:put:"]=1;
  26451. $recv(variables)._at_put_("#home",$self._home());
  26452. $ctx1.sendIdx["at:put:"]=2;
  26453. $recv(variables)._at_put_("#receiver",$self._receiver());
  26454. $ctx1.sendIdx["at:put:"]=3;
  26455. $recv(variables)._at_put_("#selector",$self._selector());
  26456. $ctx1.sendIdx["at:put:"]=4;
  26457. $recv(variables)._at_put_("#locals",$self._locals());
  26458. $ctx1.sendIdx["at:put:"]=5;
  26459. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26460. return $core.withContext(function($ctx2) {
  26461. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26463. }));
  26464. $recv(anInspector)._setLabel_($self._printString());
  26465. $recv(anInspector)._setVariables_(variables);
  26466. return self;
  26467. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26468. },
  26469. args: ["anInspector"],
  26470. 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",
  26471. referencedClasses: ["Dictionary"],
  26472. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26473. }),
  26474. $globals.MethodContext);
  26475. $core.addMethod(
  26476. $core.method({
  26477. selector: "inspectOn:",
  26478. protocol: "*Platform-Services",
  26479. fn: function (anInspector){
  26480. var self=this,$self=this;
  26481. var variables;
  26482. return $core.withContext(function($ctx1) {
  26483. variables=$recv($globals.Dictionary)._new();
  26484. $recv(variables)._at_put_("#self",self);
  26485. $ctx1.sendIdx["at:put:"]=1;
  26486. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26487. return $core.withContext(function($ctx2) {
  26488. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26490. }));
  26491. $recv(anInspector)._setLabel_($self._printString());
  26492. $recv(anInspector)._setVariables_(variables);
  26493. return self;
  26494. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26495. },
  26496. args: ["anInspector"],
  26497. 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",
  26498. referencedClasses: ["Dictionary"],
  26499. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26500. }),
  26501. $globals.Object);
  26502. $core.addMethod(
  26503. $core.method({
  26504. selector: "do:displayingProgress:",
  26505. protocol: "*Platform-Services",
  26506. fn: function (aBlock,aString){
  26507. var self=this,$self=this;
  26508. return $core.withContext(function($ctx1) {
  26509. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26510. return self;
  26511. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26512. },
  26513. args: ["aBlock", "aString"],
  26514. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26515. referencedClasses: ["ProgressHandler"],
  26516. messageSends: ["do:on:displaying:"]
  26517. }),
  26518. $globals.SequenceableCollection);
  26519. $core.addMethod(
  26520. $core.method({
  26521. selector: "inspectOn:",
  26522. protocol: "*Platform-Services",
  26523. fn: function (anInspector){
  26524. var self=this,$self=this;
  26525. var variables,i;
  26526. return $core.withContext(function($ctx1) {
  26527. variables=$recv($globals.Dictionary)._new();
  26528. $recv(variables)._at_put_("#self",self);
  26529. $ctx1.sendIdx["at:put:"]=1;
  26530. i=(1);
  26531. $self._do_((function(each){
  26532. return $core.withContext(function($ctx2) {
  26533. $recv(variables)._at_put_(i,each);
  26534. i=$recv(i).__plus((1));
  26535. return i;
  26536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26537. }));
  26538. $recv(anInspector)._setLabel_($self._printString());
  26539. $recv(anInspector)._setVariables_(variables);
  26540. return self;
  26541. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26542. },
  26543. args: ["anInspector"],
  26544. 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",
  26545. referencedClasses: ["Dictionary"],
  26546. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26547. }),
  26548. $globals.Set);
  26549. $core.addMethod(
  26550. $core.method({
  26551. selector: "inspectOn:",
  26552. protocol: "*Platform-Services",
  26553. fn: function (anInspector){
  26554. var self=this,$self=this;
  26555. var label;
  26556. return $core.withContext(function($ctx1) {
  26557. var $3,$2,$1,$5,$4;
  26558. (
  26559. $ctx1.supercall = true,
  26560. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26561. $ctx1.supercall = false;
  26562. $3=$self._printString();
  26563. $ctx1.sendIdx["printString"]=1;
  26564. $2=$recv($3)._size();
  26565. $1=$recv($2).__gt((30));
  26566. if($core.assert($1)){
  26567. $5=$self._printString();
  26568. $ctx1.sendIdx["printString"]=2;
  26569. $4=$recv($5)._copyFrom_to_((1),(30));
  26570. label=$recv($4).__comma("...'");
  26571. label;
  26572. } else {
  26573. label=$self._printString();
  26574. label;
  26575. }
  26576. $recv(anInspector)._setLabel_(label);
  26577. return self;
  26578. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26579. },
  26580. args: ["anInspector"],
  26581. 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",
  26582. referencedClasses: [],
  26583. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26584. }),
  26585. $globals.String);
  26586. });
  26587. define('amber/deploy',[
  26588. './helpers',
  26589. './boot', // pre-fetch, dep of ./helpers
  26590. // --- packages of the core Amber begin here ---
  26591. 'amber_core/Kernel-Helpers',
  26592. 'amber_core/Kernel-Objects',
  26593. 'amber_core/Kernel-Classes',
  26594. 'amber_core/Kernel-Methods',
  26595. 'amber_core/Kernel-Collections',
  26596. 'amber_core/Kernel-Dag',
  26597. 'amber_core/Kernel-Infrastructure',
  26598. 'amber_core/Kernel-Promises',
  26599. 'amber_core/Kernel-Exceptions',
  26600. 'amber_core/Kernel-Announcements',
  26601. 'amber_core/Platform-Services',
  26602. // --- packages of the core Amber end here ---
  26603. ], function (amber) {
  26604. return amber;
  26605. });
  26606. // jshint ignore:start
  26607. define('amber/parser',['./boot'], function($boot) {
  26608. var $globals = $boot.globals;
  26609. $globals.SmalltalkParser = (function() {
  26610. "use strict";
  26611. /*
  26612. * Generated by PEG.js 0.9.0.
  26613. *
  26614. * http://pegjs.org/
  26615. */
  26616. function peg$subclass(child, parent) {
  26617. function ctor() { this.constructor = child; }
  26618. ctor.prototype = parent.prototype;
  26619. child.prototype = new ctor();
  26620. }
  26621. function peg$SyntaxError(message, expected, found, location) {
  26622. this.message = message;
  26623. this.expected = expected;
  26624. this.found = found;
  26625. this.location = location;
  26626. this.name = "SyntaxError";
  26627. if (typeof Error.captureStackTrace === "function") {
  26628. Error.captureStackTrace(this, peg$SyntaxError);
  26629. }
  26630. }
  26631. peg$subclass(peg$SyntaxError, Error);
  26632. function peg$parse(input) {
  26633. var options = arguments.length > 1 ? arguments[1] : {},
  26634. parser = this,
  26635. peg$FAILED = {},
  26636. peg$startRuleFunctions = { start: peg$parsestart },
  26637. peg$startRuleFunction = peg$parsestart,
  26638. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26639. 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]" },
  26640. peg$c2 = "\"",
  26641. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26642. peg$c4 = /^[^"]/,
  26643. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26644. peg$c6 = ".",
  26645. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26646. peg$c8 = /^[a-zA-Z]/,
  26647. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26648. peg$c10 = /^[a-zA-Z0-9]/,
  26649. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26650. peg$c12 = ":",
  26651. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26652. peg$c14 = /^[A-Z]/,
  26653. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26654. peg$c16 = function(val) {
  26655. return $globals.ValueNode._new()
  26656. ._location_(location())
  26657. ._source_(text())
  26658. ._value_(val);
  26659. },
  26660. peg$c17 = "'",
  26661. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26662. peg$c19 = "''",
  26663. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26664. peg$c21 = function() {return '\'';},
  26665. peg$c22 = /^[^']/,
  26666. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26667. peg$c24 = function(val) {return val.join('');},
  26668. peg$c25 = "$",
  26669. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26670. peg$c27 = { type: "any", description: "any character" },
  26671. peg$c28 = function(char) {
  26672. return $globals.ValueNode._new()
  26673. ._location_(location())
  26674. ._source_(text())
  26675. ._value_(char);
  26676. },
  26677. peg$c29 = "#",
  26678. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26679. peg$c31 = function(rest) {return rest;},
  26680. peg$c32 = "e",
  26681. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26682. peg$c34 = function(n) {return parseFloat(n);},
  26683. peg$c35 = "-",
  26684. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26685. peg$c37 = "16r",
  26686. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26687. peg$c39 = /^[0-9a-fA-F]/,
  26688. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26689. peg$c41 = function(neg, num) {
  26690. return parseInt(((neg || '') + num), 16);
  26691. },
  26692. peg$c42 = /^[0-9]/,
  26693. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26694. peg$c44 = function(n) {return parseFloat(n, 10);},
  26695. peg$c45 = function(n) {return parseInt(n, 10);},
  26696. peg$c46 = "#(",
  26697. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26698. peg$c48 = ")",
  26699. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26700. peg$c50 = function(rest) {
  26701. return rest
  26702. ._location_(location())
  26703. ._source_(text());
  26704. },
  26705. peg$c51 = "(",
  26706. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26707. peg$c53 = function(lit) {return lit._value();},
  26708. peg$c54 = function(lits) {
  26709. return $globals.ValueNode._new()
  26710. ._value_(lits);
  26711. },
  26712. peg$c55 = "{",
  26713. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26714. peg$c57 = "}",
  26715. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26716. peg$c59 = function(expressions) {
  26717. return $globals.DynamicArrayNode._new()
  26718. ._location_(location())
  26719. ._source_(text())
  26720. ._dagChildren_(expressions || []);
  26721. },
  26722. peg$c60 = "#{",
  26723. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26724. peg$c62 = function(expressions) {
  26725. return $globals.DynamicDictionaryNode._new()
  26726. ._location_(location())
  26727. ._source_(text())
  26728. ._dagChildren_(expressions || []);
  26729. },
  26730. peg$c63 = "true",
  26731. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26732. peg$c65 = function() {return true;},
  26733. peg$c66 = "false",
  26734. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26735. peg$c68 = function() {return false;},
  26736. peg$c69 = "nil",
  26737. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26738. peg$c71 = function() {return null;},
  26739. peg$c72 = function(identifier) {
  26740. return $globals.VariableNode._new()
  26741. ._location_(location())
  26742. ._source_(text())
  26743. ._value_(identifier);
  26744. },
  26745. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26746. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26747. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26748. peg$c76 = function(pairs) {
  26749. var selector = '';
  26750. var params = [];
  26751. for(var i = 0; i < pairs.length; i++) {
  26752. selector += pairs[i].key;
  26753. params.push(pairs[i].arg);
  26754. }
  26755. return [selector, params];
  26756. },
  26757. peg$c77 = function(selector, arg) {
  26758. return [selector, [arg]];
  26759. },
  26760. peg$c78 = function(selector) {return [selector, []];},
  26761. peg$c79 = function(expression) {
  26762. return expression;
  26763. },
  26764. peg$c80 = function(first, others) {
  26765. return [first].concat(others);
  26766. },
  26767. peg$c81 = ":=",
  26768. peg$c82 = { type: "literal", value: ":=", description: "\":=\"" },
  26769. peg$c83 = function(variable, expression) {
  26770. return $globals.AssignmentNode._new()
  26771. ._location_(location())
  26772. ._source_(text())
  26773. ._left_(variable)
  26774. ._right_(expression);
  26775. },
  26776. peg$c84 = "^",
  26777. peg$c85 = { type: "literal", value: "^", description: "\"^\"" },
  26778. peg$c86 = function(expression) {
  26779. return $globals.ReturnNode._new()
  26780. ._location_(location())
  26781. ._source_(text())
  26782. ._dagChildren_([expression]);
  26783. },
  26784. peg$c87 = "|",
  26785. peg$c88 = { type: "literal", value: "|", description: "\"|\"" },
  26786. peg$c89 = function(variable) {return variable;},
  26787. peg$c90 = function(vars) {
  26788. return vars;
  26789. },
  26790. peg$c91 = function(param) {return param;},
  26791. peg$c92 = function(params) {
  26792. return params;
  26793. },
  26794. peg$c93 = function(ret) {return [ret];},
  26795. peg$c94 = function(exps, ret) {
  26796. var expressions = exps;
  26797. expressions.push(ret);
  26798. return expressions;
  26799. },
  26800. peg$c95 = function(expressions) {return expressions || [];},
  26801. peg$c96 = function(js) {return js;},
  26802. peg$c97 = function(temps, statements) {
  26803. return $globals.SequenceNode._new()
  26804. ._location_(location())
  26805. ._source_(text())
  26806. ._temps_(temps || [])
  26807. ._dagChildren_(statements || []);
  26808. },
  26809. peg$c98 = "[",
  26810. peg$c99 = { type: "literal", value: "[", description: "\"[\"" },
  26811. peg$c100 = "]",
  26812. peg$c101 = { type: "literal", value: "]", description: "\"]\"" },
  26813. peg$c102 = function(params, sequence) {
  26814. return $globals.BlockNode._new()
  26815. ._location_(location())
  26816. ._source_(text())
  26817. ._parameters_(params || [])
  26818. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26819. },
  26820. peg$c103 = function(selector) {
  26821. return $globals.SendNode._new()
  26822. ._location_(location())
  26823. ._source_(text())
  26824. ._selector_(selector);
  26825. },
  26826. peg$c104 = function(receiver, tail) {
  26827. return receiver._withTail_(tail);
  26828. },
  26829. peg$c105 = function(selector, arg) {
  26830. return $globals.SendNode._new()
  26831. ._location_(location())
  26832. ._source_(text())
  26833. ._selector_(selector)
  26834. ._arguments_([arg]);
  26835. },
  26836. peg$c106 = function(pairs) {
  26837. var selector = '';
  26838. var args = [];
  26839. for(var i = 0; i < pairs.length; i++) {
  26840. selector += pairs[i].key;
  26841. args.push(pairs[i].arg);
  26842. }
  26843. return $globals.SendNode._new()
  26844. ._location_(location())
  26845. ._source_(text())
  26846. ._selector_(selector)
  26847. ._arguments_(args);
  26848. },
  26849. peg$c107 = function(receiver, tail) {
  26850. return tail ? receiver._withTail_([tail]) : receiver;
  26851. },
  26852. peg$c108 = function(send) {return send._isSendNode();},
  26853. peg$c109 = ";",
  26854. peg$c110 = { type: "literal", value: ";", description: "\";\"" },
  26855. peg$c111 = function(send, mess) {return mess;},
  26856. peg$c112 = function(send, messages) {
  26857. messages.unshift(send);
  26858. return $globals.CascadeNode._new()
  26859. ._location_(location())
  26860. ._source_(text())
  26861. ._dagChildren_(messages);
  26862. },
  26863. peg$c113 = "<",
  26864. peg$c114 = { type: "literal", value: "<", description: "\"<\"" },
  26865. peg$c115 = ">>",
  26866. peg$c116 = { type: "literal", value: ">>", description: "\">>\"" },
  26867. peg$c117 = function() {return '>';},
  26868. peg$c118 = /^[^>]/,
  26869. peg$c119 = { type: "class", value: "[^>]", description: "[^>]" },
  26870. peg$c120 = ">",
  26871. peg$c121 = { type: "literal", value: ">", description: "\">\"" },
  26872. peg$c122 = function(val) {return !/^\s*inlineJS/.test(val.join(''));},
  26873. peg$c123 = function(val) {
  26874. console.warn('Use of <...js code...> is deprecated, in:\n' + val.join(''));
  26875. return $globals.JSStatementNode._new()
  26876. ._location_(location())
  26877. ._source_(val.join(''))
  26878. },
  26879. peg$c124 = "inlineJS:",
  26880. peg$c125 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  26881. peg$c126 = function(val) {
  26882. return $globals.JSStatementNode._new()
  26883. ._location_(location())
  26884. ._source_(val)
  26885. },
  26886. peg$c127 = function(pattern, sequence) {
  26887. return $globals.MethodNode._new()
  26888. ._location_(location())
  26889. ._source_(text())
  26890. ._selector_(pattern[0])
  26891. ._arguments_(pattern[1])
  26892. ._dagChildren_([sequence]);
  26893. },
  26894. peg$c128 = function(send) { return send._isSendNode() && send._selector() === '->' },
  26895. peg$c129 = function(send) {
  26896. return [send._receiver(), send._arguments()[0]];
  26897. },
  26898. peg$c130 = function(first, others) {
  26899. return first.concat.apply(first, others);
  26900. },
  26901. peg$currPos = 0,
  26902. peg$savedPos = 0,
  26903. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  26904. peg$maxFailPos = 0,
  26905. peg$maxFailExpected = [],
  26906. peg$silentFails = 0,
  26907. peg$resultsCache = {},
  26908. peg$result;
  26909. if ("startRule" in options) {
  26910. if (!(options.startRule in peg$startRuleFunctions)) {
  26911. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  26912. }
  26913. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  26914. }
  26915. function text() {
  26916. return input.substring(peg$savedPos, peg$currPos);
  26917. }
  26918. function location() {
  26919. return peg$computeLocation(peg$savedPos, peg$currPos);
  26920. }
  26921. function expected(description) {
  26922. throw peg$buildException(
  26923. null,
  26924. [{ type: "other", description: description }],
  26925. input.substring(peg$savedPos, peg$currPos),
  26926. peg$computeLocation(peg$savedPos, peg$currPos)
  26927. );
  26928. }
  26929. function error(message) {
  26930. throw peg$buildException(
  26931. message,
  26932. null,
  26933. input.substring(peg$savedPos, peg$currPos),
  26934. peg$computeLocation(peg$savedPos, peg$currPos)
  26935. );
  26936. }
  26937. function peg$computePosDetails(pos) {
  26938. var details = peg$posDetailsCache[pos],
  26939. p, ch;
  26940. if (details) {
  26941. return details;
  26942. } else {
  26943. p = pos - 1;
  26944. while (!peg$posDetailsCache[p]) {
  26945. p--;
  26946. }
  26947. details = peg$posDetailsCache[p];
  26948. details = {
  26949. line: details.line,
  26950. column: details.column,
  26951. seenCR: details.seenCR
  26952. };
  26953. while (p < pos) {
  26954. ch = input.charAt(p);
  26955. if (ch === "\n") {
  26956. if (!details.seenCR) { details.line++; }
  26957. details.column = 1;
  26958. details.seenCR = false;
  26959. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  26960. details.line++;
  26961. details.column = 1;
  26962. details.seenCR = true;
  26963. } else {
  26964. details.column++;
  26965. details.seenCR = false;
  26966. }
  26967. p++;
  26968. }
  26969. peg$posDetailsCache[pos] = details;
  26970. return details;
  26971. }
  26972. }
  26973. function peg$computeLocation(startPos, endPos) {
  26974. var startPosDetails = peg$computePosDetails(startPos),
  26975. endPosDetails = peg$computePosDetails(endPos);
  26976. return {
  26977. start: {
  26978. offset: startPos,
  26979. line: startPosDetails.line,
  26980. column: startPosDetails.column
  26981. },
  26982. end: {
  26983. offset: endPos,
  26984. line: endPosDetails.line,
  26985. column: endPosDetails.column
  26986. }
  26987. };
  26988. }
  26989. function peg$fail(expected) {
  26990. if (peg$currPos < peg$maxFailPos) { return; }
  26991. if (peg$currPos > peg$maxFailPos) {
  26992. peg$maxFailPos = peg$currPos;
  26993. peg$maxFailExpected = [];
  26994. }
  26995. peg$maxFailExpected.push(expected);
  26996. }
  26997. function peg$buildException(message, expected, found, location) {
  26998. function cleanupExpected(expected) {
  26999. var i = 1;
  27000. expected.sort(function(a, b) {
  27001. if (a.description < b.description) {
  27002. return -1;
  27003. } else if (a.description > b.description) {
  27004. return 1;
  27005. } else {
  27006. return 0;
  27007. }
  27008. });
  27009. while (i < expected.length) {
  27010. if (expected[i - 1] === expected[i]) {
  27011. expected.splice(i, 1);
  27012. } else {
  27013. i++;
  27014. }
  27015. }
  27016. }
  27017. function buildMessage(expected, found) {
  27018. function stringEscape(s) {
  27019. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27020. return s
  27021. .replace(/\\/g, '\\\\')
  27022. .replace(/"/g, '\\"')
  27023. .replace(/\x08/g, '\\b')
  27024. .replace(/\t/g, '\\t')
  27025. .replace(/\n/g, '\\n')
  27026. .replace(/\f/g, '\\f')
  27027. .replace(/\r/g, '\\r')
  27028. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27029. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27030. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27031. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27032. }
  27033. var expectedDescs = new Array(expected.length),
  27034. expectedDesc, foundDesc, i;
  27035. for (i = 0; i < expected.length; i++) {
  27036. expectedDescs[i] = expected[i].description;
  27037. }
  27038. expectedDesc = expected.length > 1
  27039. ? expectedDescs.slice(0, -1).join(", ")
  27040. + " or "
  27041. + expectedDescs[expected.length - 1]
  27042. : expectedDescs[0];
  27043. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27044. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27045. }
  27046. if (expected !== null) {
  27047. cleanupExpected(expected);
  27048. }
  27049. return new peg$SyntaxError(
  27050. message !== null ? message : buildMessage(expected, found),
  27051. expected,
  27052. found,
  27053. location
  27054. );
  27055. }
  27056. function peg$parsestart() {
  27057. var s0;
  27058. var key = peg$currPos * 63 + 0,
  27059. cached = peg$resultsCache[key];
  27060. if (cached) {
  27061. peg$currPos = cached.nextPos;
  27062. return cached.result;
  27063. }
  27064. s0 = peg$parsemethod();
  27065. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27066. return s0;
  27067. }
  27068. function peg$parseseparator() {
  27069. var s0, s1;
  27070. var key = peg$currPos * 63 + 1,
  27071. cached = peg$resultsCache[key];
  27072. if (cached) {
  27073. peg$currPos = cached.nextPos;
  27074. return cached.result;
  27075. }
  27076. s0 = [];
  27077. if (peg$c0.test(input.charAt(peg$currPos))) {
  27078. s1 = input.charAt(peg$currPos);
  27079. peg$currPos++;
  27080. } else {
  27081. s1 = peg$FAILED;
  27082. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27083. }
  27084. if (s1 !== peg$FAILED) {
  27085. while (s1 !== peg$FAILED) {
  27086. s0.push(s1);
  27087. if (peg$c0.test(input.charAt(peg$currPos))) {
  27088. s1 = input.charAt(peg$currPos);
  27089. peg$currPos++;
  27090. } else {
  27091. s1 = peg$FAILED;
  27092. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27093. }
  27094. }
  27095. } else {
  27096. s0 = peg$FAILED;
  27097. }
  27098. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27099. return s0;
  27100. }
  27101. function peg$parsecomments() {
  27102. var s0, s1, s2, s3, s4;
  27103. var key = peg$currPos * 63 + 2,
  27104. cached = peg$resultsCache[key];
  27105. if (cached) {
  27106. peg$currPos = cached.nextPos;
  27107. return cached.result;
  27108. }
  27109. s0 = [];
  27110. s1 = peg$currPos;
  27111. if (input.charCodeAt(peg$currPos) === 34) {
  27112. s2 = peg$c2;
  27113. peg$currPos++;
  27114. } else {
  27115. s2 = peg$FAILED;
  27116. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27117. }
  27118. if (s2 !== peg$FAILED) {
  27119. s3 = [];
  27120. if (peg$c4.test(input.charAt(peg$currPos))) {
  27121. s4 = input.charAt(peg$currPos);
  27122. peg$currPos++;
  27123. } else {
  27124. s4 = peg$FAILED;
  27125. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27126. }
  27127. while (s4 !== peg$FAILED) {
  27128. s3.push(s4);
  27129. if (peg$c4.test(input.charAt(peg$currPos))) {
  27130. s4 = input.charAt(peg$currPos);
  27131. peg$currPos++;
  27132. } else {
  27133. s4 = peg$FAILED;
  27134. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27135. }
  27136. }
  27137. if (s3 !== peg$FAILED) {
  27138. if (input.charCodeAt(peg$currPos) === 34) {
  27139. s4 = peg$c2;
  27140. peg$currPos++;
  27141. } else {
  27142. s4 = peg$FAILED;
  27143. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27144. }
  27145. if (s4 !== peg$FAILED) {
  27146. s2 = [s2, s3, s4];
  27147. s1 = s2;
  27148. } else {
  27149. peg$currPos = s1;
  27150. s1 = peg$FAILED;
  27151. }
  27152. } else {
  27153. peg$currPos = s1;
  27154. s1 = peg$FAILED;
  27155. }
  27156. } else {
  27157. peg$currPos = s1;
  27158. s1 = peg$FAILED;
  27159. }
  27160. if (s1 !== peg$FAILED) {
  27161. while (s1 !== peg$FAILED) {
  27162. s0.push(s1);
  27163. s1 = peg$currPos;
  27164. if (input.charCodeAt(peg$currPos) === 34) {
  27165. s2 = peg$c2;
  27166. peg$currPos++;
  27167. } else {
  27168. s2 = peg$FAILED;
  27169. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27170. }
  27171. if (s2 !== peg$FAILED) {
  27172. s3 = [];
  27173. if (peg$c4.test(input.charAt(peg$currPos))) {
  27174. s4 = input.charAt(peg$currPos);
  27175. peg$currPos++;
  27176. } else {
  27177. s4 = peg$FAILED;
  27178. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27179. }
  27180. while (s4 !== peg$FAILED) {
  27181. s3.push(s4);
  27182. if (peg$c4.test(input.charAt(peg$currPos))) {
  27183. s4 = input.charAt(peg$currPos);
  27184. peg$currPos++;
  27185. } else {
  27186. s4 = peg$FAILED;
  27187. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27188. }
  27189. }
  27190. if (s3 !== peg$FAILED) {
  27191. if (input.charCodeAt(peg$currPos) === 34) {
  27192. s4 = peg$c2;
  27193. peg$currPos++;
  27194. } else {
  27195. s4 = peg$FAILED;
  27196. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27197. }
  27198. if (s4 !== peg$FAILED) {
  27199. s2 = [s2, s3, s4];
  27200. s1 = s2;
  27201. } else {
  27202. peg$currPos = s1;
  27203. s1 = peg$FAILED;
  27204. }
  27205. } else {
  27206. peg$currPos = s1;
  27207. s1 = peg$FAILED;
  27208. }
  27209. } else {
  27210. peg$currPos = s1;
  27211. s1 = peg$FAILED;
  27212. }
  27213. }
  27214. } else {
  27215. s0 = peg$FAILED;
  27216. }
  27217. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27218. return s0;
  27219. }
  27220. function peg$parsews() {
  27221. var s0, s1;
  27222. var key = peg$currPos * 63 + 3,
  27223. cached = peg$resultsCache[key];
  27224. if (cached) {
  27225. peg$currPos = cached.nextPos;
  27226. return cached.result;
  27227. }
  27228. s0 = [];
  27229. s1 = peg$parseseparator();
  27230. if (s1 === peg$FAILED) {
  27231. s1 = peg$parsecomments();
  27232. }
  27233. while (s1 !== peg$FAILED) {
  27234. s0.push(s1);
  27235. s1 = peg$parseseparator();
  27236. if (s1 === peg$FAILED) {
  27237. s1 = peg$parsecomments();
  27238. }
  27239. }
  27240. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27241. return s0;
  27242. }
  27243. function peg$parsemaybeDotsWs() {
  27244. var s0, s1;
  27245. var key = peg$currPos * 63 + 4,
  27246. cached = peg$resultsCache[key];
  27247. if (cached) {
  27248. peg$currPos = cached.nextPos;
  27249. return cached.result;
  27250. }
  27251. s0 = [];
  27252. if (input.charCodeAt(peg$currPos) === 46) {
  27253. s1 = peg$c6;
  27254. peg$currPos++;
  27255. } else {
  27256. s1 = peg$FAILED;
  27257. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27258. }
  27259. if (s1 === peg$FAILED) {
  27260. s1 = peg$parseseparator();
  27261. if (s1 === peg$FAILED) {
  27262. s1 = peg$parsecomments();
  27263. }
  27264. }
  27265. while (s1 !== peg$FAILED) {
  27266. s0.push(s1);
  27267. if (input.charCodeAt(peg$currPos) === 46) {
  27268. s1 = peg$c6;
  27269. peg$currPos++;
  27270. } else {
  27271. s1 = peg$FAILED;
  27272. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27273. }
  27274. if (s1 === peg$FAILED) {
  27275. s1 = peg$parseseparator();
  27276. if (s1 === peg$FAILED) {
  27277. s1 = peg$parsecomments();
  27278. }
  27279. }
  27280. }
  27281. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27282. return s0;
  27283. }
  27284. function peg$parsesomeDotsWs() {
  27285. var s0, s1, s2, s3;
  27286. var key = peg$currPos * 63 + 5,
  27287. cached = peg$resultsCache[key];
  27288. if (cached) {
  27289. peg$currPos = cached.nextPos;
  27290. return cached.result;
  27291. }
  27292. s0 = peg$currPos;
  27293. s1 = peg$parsews();
  27294. if (s1 !== peg$FAILED) {
  27295. if (input.charCodeAt(peg$currPos) === 46) {
  27296. s2 = peg$c6;
  27297. peg$currPos++;
  27298. } else {
  27299. s2 = peg$FAILED;
  27300. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27301. }
  27302. if (s2 !== peg$FAILED) {
  27303. s3 = peg$parsemaybeDotsWs();
  27304. if (s3 !== peg$FAILED) {
  27305. s1 = [s1, s2, s3];
  27306. s0 = s1;
  27307. } else {
  27308. peg$currPos = s0;
  27309. s0 = peg$FAILED;
  27310. }
  27311. } else {
  27312. peg$currPos = s0;
  27313. s0 = peg$FAILED;
  27314. }
  27315. } else {
  27316. peg$currPos = s0;
  27317. s0 = peg$FAILED;
  27318. }
  27319. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27320. return s0;
  27321. }
  27322. function peg$parseidentifier() {
  27323. var s0, s1, s2, s3, s4;
  27324. var key = peg$currPos * 63 + 6,
  27325. cached = peg$resultsCache[key];
  27326. if (cached) {
  27327. peg$currPos = cached.nextPos;
  27328. return cached.result;
  27329. }
  27330. s0 = peg$currPos;
  27331. s1 = peg$currPos;
  27332. if (peg$c8.test(input.charAt(peg$currPos))) {
  27333. s2 = input.charAt(peg$currPos);
  27334. peg$currPos++;
  27335. } else {
  27336. s2 = peg$FAILED;
  27337. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27338. }
  27339. if (s2 !== peg$FAILED) {
  27340. s3 = [];
  27341. if (peg$c10.test(input.charAt(peg$currPos))) {
  27342. s4 = input.charAt(peg$currPos);
  27343. peg$currPos++;
  27344. } else {
  27345. s4 = peg$FAILED;
  27346. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27347. }
  27348. while (s4 !== peg$FAILED) {
  27349. s3.push(s4);
  27350. if (peg$c10.test(input.charAt(peg$currPos))) {
  27351. s4 = input.charAt(peg$currPos);
  27352. peg$currPos++;
  27353. } else {
  27354. s4 = peg$FAILED;
  27355. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27356. }
  27357. }
  27358. if (s3 !== peg$FAILED) {
  27359. s2 = [s2, s3];
  27360. s1 = s2;
  27361. } else {
  27362. peg$currPos = s1;
  27363. s1 = peg$FAILED;
  27364. }
  27365. } else {
  27366. peg$currPos = s1;
  27367. s1 = peg$FAILED;
  27368. }
  27369. if (s1 !== peg$FAILED) {
  27370. s0 = input.substring(s0, peg$currPos);
  27371. } else {
  27372. s0 = s1;
  27373. }
  27374. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27375. return s0;
  27376. }
  27377. function peg$parsekeyword() {
  27378. var s0, s1, s2, s3;
  27379. var key = peg$currPos * 63 + 7,
  27380. cached = peg$resultsCache[key];
  27381. if (cached) {
  27382. peg$currPos = cached.nextPos;
  27383. return cached.result;
  27384. }
  27385. s0 = peg$currPos;
  27386. s1 = peg$currPos;
  27387. s2 = peg$parseidentifier();
  27388. if (s2 !== peg$FAILED) {
  27389. if (input.charCodeAt(peg$currPos) === 58) {
  27390. s3 = peg$c12;
  27391. peg$currPos++;
  27392. } else {
  27393. s3 = peg$FAILED;
  27394. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27395. }
  27396. if (s3 !== peg$FAILED) {
  27397. s2 = [s2, s3];
  27398. s1 = s2;
  27399. } else {
  27400. peg$currPos = s1;
  27401. s1 = peg$FAILED;
  27402. }
  27403. } else {
  27404. peg$currPos = s1;
  27405. s1 = peg$FAILED;
  27406. }
  27407. if (s1 !== peg$FAILED) {
  27408. s0 = input.substring(s0, peg$currPos);
  27409. } else {
  27410. s0 = s1;
  27411. }
  27412. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27413. return s0;
  27414. }
  27415. function peg$parseclassName() {
  27416. var s0, s1, s2, s3, s4;
  27417. var key = peg$currPos * 63 + 8,
  27418. cached = peg$resultsCache[key];
  27419. if (cached) {
  27420. peg$currPos = cached.nextPos;
  27421. return cached.result;
  27422. }
  27423. s0 = peg$currPos;
  27424. s1 = peg$currPos;
  27425. if (peg$c14.test(input.charAt(peg$currPos))) {
  27426. s2 = input.charAt(peg$currPos);
  27427. peg$currPos++;
  27428. } else {
  27429. s2 = peg$FAILED;
  27430. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27431. }
  27432. if (s2 !== peg$FAILED) {
  27433. s3 = [];
  27434. if (peg$c10.test(input.charAt(peg$currPos))) {
  27435. s4 = input.charAt(peg$currPos);
  27436. peg$currPos++;
  27437. } else {
  27438. s4 = peg$FAILED;
  27439. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27440. }
  27441. while (s4 !== peg$FAILED) {
  27442. s3.push(s4);
  27443. if (peg$c10.test(input.charAt(peg$currPos))) {
  27444. s4 = input.charAt(peg$currPos);
  27445. peg$currPos++;
  27446. } else {
  27447. s4 = peg$FAILED;
  27448. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27449. }
  27450. }
  27451. if (s3 !== peg$FAILED) {
  27452. s2 = [s2, s3];
  27453. s1 = s2;
  27454. } else {
  27455. peg$currPos = s1;
  27456. s1 = peg$FAILED;
  27457. }
  27458. } else {
  27459. peg$currPos = s1;
  27460. s1 = peg$FAILED;
  27461. }
  27462. if (s1 !== peg$FAILED) {
  27463. s0 = input.substring(s0, peg$currPos);
  27464. } else {
  27465. s0 = s1;
  27466. }
  27467. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27468. return s0;
  27469. }
  27470. function peg$parsestring() {
  27471. var s0, s1;
  27472. var key = peg$currPos * 63 + 9,
  27473. cached = peg$resultsCache[key];
  27474. if (cached) {
  27475. peg$currPos = cached.nextPos;
  27476. return cached.result;
  27477. }
  27478. s0 = peg$currPos;
  27479. s1 = peg$parserawString();
  27480. if (s1 !== peg$FAILED) {
  27481. peg$savedPos = s0;
  27482. s1 = peg$c16(s1);
  27483. }
  27484. s0 = s1;
  27485. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27486. return s0;
  27487. }
  27488. function peg$parserawString() {
  27489. var s0, s1, s2, s3, s4;
  27490. var key = peg$currPos * 63 + 10,
  27491. cached = peg$resultsCache[key];
  27492. if (cached) {
  27493. peg$currPos = cached.nextPos;
  27494. return cached.result;
  27495. }
  27496. s0 = peg$currPos;
  27497. if (input.charCodeAt(peg$currPos) === 39) {
  27498. s1 = peg$c17;
  27499. peg$currPos++;
  27500. } else {
  27501. s1 = peg$FAILED;
  27502. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27503. }
  27504. if (s1 !== peg$FAILED) {
  27505. s2 = [];
  27506. s3 = peg$currPos;
  27507. if (input.substr(peg$currPos, 2) === peg$c19) {
  27508. s4 = peg$c19;
  27509. peg$currPos += 2;
  27510. } else {
  27511. s4 = peg$FAILED;
  27512. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27513. }
  27514. if (s4 !== peg$FAILED) {
  27515. peg$savedPos = s3;
  27516. s4 = peg$c21();
  27517. }
  27518. s3 = s4;
  27519. if (s3 === peg$FAILED) {
  27520. if (peg$c22.test(input.charAt(peg$currPos))) {
  27521. s3 = input.charAt(peg$currPos);
  27522. peg$currPos++;
  27523. } else {
  27524. s3 = peg$FAILED;
  27525. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27526. }
  27527. }
  27528. while (s3 !== peg$FAILED) {
  27529. s2.push(s3);
  27530. s3 = peg$currPos;
  27531. if (input.substr(peg$currPos, 2) === peg$c19) {
  27532. s4 = peg$c19;
  27533. peg$currPos += 2;
  27534. } else {
  27535. s4 = peg$FAILED;
  27536. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27537. }
  27538. if (s4 !== peg$FAILED) {
  27539. peg$savedPos = s3;
  27540. s4 = peg$c21();
  27541. }
  27542. s3 = s4;
  27543. if (s3 === peg$FAILED) {
  27544. if (peg$c22.test(input.charAt(peg$currPos))) {
  27545. s3 = input.charAt(peg$currPos);
  27546. peg$currPos++;
  27547. } else {
  27548. s3 = peg$FAILED;
  27549. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27550. }
  27551. }
  27552. }
  27553. if (s2 !== peg$FAILED) {
  27554. if (input.charCodeAt(peg$currPos) === 39) {
  27555. s3 = peg$c17;
  27556. peg$currPos++;
  27557. } else {
  27558. s3 = peg$FAILED;
  27559. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27560. }
  27561. if (s3 !== peg$FAILED) {
  27562. peg$savedPos = s0;
  27563. s1 = peg$c24(s2);
  27564. s0 = s1;
  27565. } else {
  27566. peg$currPos = s0;
  27567. s0 = peg$FAILED;
  27568. }
  27569. } else {
  27570. peg$currPos = s0;
  27571. s0 = peg$FAILED;
  27572. }
  27573. } else {
  27574. peg$currPos = s0;
  27575. s0 = peg$FAILED;
  27576. }
  27577. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27578. return s0;
  27579. }
  27580. function peg$parsecharacter() {
  27581. var s0, s1, s2;
  27582. var key = peg$currPos * 63 + 11,
  27583. cached = peg$resultsCache[key];
  27584. if (cached) {
  27585. peg$currPos = cached.nextPos;
  27586. return cached.result;
  27587. }
  27588. s0 = peg$currPos;
  27589. if (input.charCodeAt(peg$currPos) === 36) {
  27590. s1 = peg$c25;
  27591. peg$currPos++;
  27592. } else {
  27593. s1 = peg$FAILED;
  27594. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27595. }
  27596. if (s1 !== peg$FAILED) {
  27597. if (input.length > peg$currPos) {
  27598. s2 = input.charAt(peg$currPos);
  27599. peg$currPos++;
  27600. } else {
  27601. s2 = peg$FAILED;
  27602. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27603. }
  27604. if (s2 !== peg$FAILED) {
  27605. peg$savedPos = s0;
  27606. s1 = peg$c28(s2);
  27607. s0 = s1;
  27608. } else {
  27609. peg$currPos = s0;
  27610. s0 = peg$FAILED;
  27611. }
  27612. } else {
  27613. peg$currPos = s0;
  27614. s0 = peg$FAILED;
  27615. }
  27616. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27617. return s0;
  27618. }
  27619. function peg$parsesymbol() {
  27620. var s0, s1, s2;
  27621. var key = peg$currPos * 63 + 12,
  27622. cached = peg$resultsCache[key];
  27623. if (cached) {
  27624. peg$currPos = cached.nextPos;
  27625. return cached.result;
  27626. }
  27627. s0 = peg$currPos;
  27628. if (input.charCodeAt(peg$currPos) === 35) {
  27629. s1 = peg$c29;
  27630. peg$currPos++;
  27631. } else {
  27632. s1 = peg$FAILED;
  27633. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27634. }
  27635. if (s1 !== peg$FAILED) {
  27636. s2 = peg$parsebareSymbol();
  27637. if (s2 !== peg$FAILED) {
  27638. peg$savedPos = s0;
  27639. s1 = peg$c31(s2);
  27640. s0 = s1;
  27641. } else {
  27642. peg$currPos = s0;
  27643. s0 = peg$FAILED;
  27644. }
  27645. } else {
  27646. peg$currPos = s0;
  27647. s0 = peg$FAILED;
  27648. }
  27649. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27650. return s0;
  27651. }
  27652. function peg$parsebareSymbol() {
  27653. var s0, s1, s2, s3;
  27654. var key = peg$currPos * 63 + 13,
  27655. cached = peg$resultsCache[key];
  27656. if (cached) {
  27657. peg$currPos = cached.nextPos;
  27658. return cached.result;
  27659. }
  27660. s0 = peg$currPos;
  27661. s1 = peg$currPos;
  27662. s2 = [];
  27663. s3 = peg$parsekeyword();
  27664. if (s3 !== peg$FAILED) {
  27665. while (s3 !== peg$FAILED) {
  27666. s2.push(s3);
  27667. s3 = peg$parsekeyword();
  27668. }
  27669. } else {
  27670. s2 = peg$FAILED;
  27671. }
  27672. if (s2 !== peg$FAILED) {
  27673. s1 = input.substring(s1, peg$currPos);
  27674. } else {
  27675. s1 = s2;
  27676. }
  27677. if (s1 === peg$FAILED) {
  27678. s1 = peg$parsebinarySelector();
  27679. if (s1 === peg$FAILED) {
  27680. s1 = peg$parseidentifier();
  27681. if (s1 === peg$FAILED) {
  27682. s1 = peg$parserawString();
  27683. }
  27684. }
  27685. }
  27686. if (s1 !== peg$FAILED) {
  27687. peg$savedPos = s0;
  27688. s1 = peg$c16(s1);
  27689. }
  27690. s0 = s1;
  27691. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27692. return s0;
  27693. }
  27694. function peg$parsenumber() {
  27695. var s0, s1;
  27696. var key = peg$currPos * 63 + 14,
  27697. cached = peg$resultsCache[key];
  27698. if (cached) {
  27699. peg$currPos = cached.nextPos;
  27700. return cached.result;
  27701. }
  27702. s0 = peg$currPos;
  27703. s1 = peg$parserawNumber();
  27704. if (s1 !== peg$FAILED) {
  27705. peg$savedPos = s0;
  27706. s1 = peg$c16(s1);
  27707. }
  27708. s0 = s1;
  27709. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27710. return s0;
  27711. }
  27712. function peg$parserawNumber() {
  27713. var s0;
  27714. var key = peg$currPos * 63 + 15,
  27715. cached = peg$resultsCache[key];
  27716. if (cached) {
  27717. peg$currPos = cached.nextPos;
  27718. return cached.result;
  27719. }
  27720. s0 = peg$parsenumberExp();
  27721. if (s0 === peg$FAILED) {
  27722. s0 = peg$parsehex();
  27723. if (s0 === peg$FAILED) {
  27724. s0 = peg$parsefloat();
  27725. if (s0 === peg$FAILED) {
  27726. s0 = peg$parseinteger();
  27727. }
  27728. }
  27729. }
  27730. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27731. return s0;
  27732. }
  27733. function peg$parsenumberExp() {
  27734. var s0, s1, s2, s3, s4, s5;
  27735. var key = peg$currPos * 63 + 16,
  27736. cached = peg$resultsCache[key];
  27737. if (cached) {
  27738. peg$currPos = cached.nextPos;
  27739. return cached.result;
  27740. }
  27741. s0 = peg$currPos;
  27742. s1 = peg$currPos;
  27743. s2 = peg$currPos;
  27744. s3 = peg$parsefloat();
  27745. if (s3 === peg$FAILED) {
  27746. s3 = peg$parseinteger();
  27747. }
  27748. if (s3 !== peg$FAILED) {
  27749. if (input.charCodeAt(peg$currPos) === 101) {
  27750. s4 = peg$c32;
  27751. peg$currPos++;
  27752. } else {
  27753. s4 = peg$FAILED;
  27754. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27755. }
  27756. if (s4 !== peg$FAILED) {
  27757. s5 = peg$parseinteger();
  27758. if (s5 !== peg$FAILED) {
  27759. s3 = [s3, s4, s5];
  27760. s2 = s3;
  27761. } else {
  27762. peg$currPos = s2;
  27763. s2 = peg$FAILED;
  27764. }
  27765. } else {
  27766. peg$currPos = s2;
  27767. s2 = peg$FAILED;
  27768. }
  27769. } else {
  27770. peg$currPos = s2;
  27771. s2 = peg$FAILED;
  27772. }
  27773. if (s2 !== peg$FAILED) {
  27774. s1 = input.substring(s1, peg$currPos);
  27775. } else {
  27776. s1 = s2;
  27777. }
  27778. if (s1 !== peg$FAILED) {
  27779. peg$savedPos = s0;
  27780. s1 = peg$c34(s1);
  27781. }
  27782. s0 = s1;
  27783. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27784. return s0;
  27785. }
  27786. function peg$parsehex() {
  27787. var s0, s1, s2, s3, s4, s5;
  27788. var key = peg$currPos * 63 + 17,
  27789. cached = peg$resultsCache[key];
  27790. if (cached) {
  27791. peg$currPos = cached.nextPos;
  27792. return cached.result;
  27793. }
  27794. s0 = peg$currPos;
  27795. if (input.charCodeAt(peg$currPos) === 45) {
  27796. s1 = peg$c35;
  27797. peg$currPos++;
  27798. } else {
  27799. s1 = peg$FAILED;
  27800. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27801. }
  27802. if (s1 === peg$FAILED) {
  27803. s1 = null;
  27804. }
  27805. if (s1 !== peg$FAILED) {
  27806. if (input.substr(peg$currPos, 3) === peg$c37) {
  27807. s2 = peg$c37;
  27808. peg$currPos += 3;
  27809. } else {
  27810. s2 = peg$FAILED;
  27811. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27812. }
  27813. if (s2 !== peg$FAILED) {
  27814. s3 = peg$currPos;
  27815. s4 = [];
  27816. if (peg$c39.test(input.charAt(peg$currPos))) {
  27817. s5 = input.charAt(peg$currPos);
  27818. peg$currPos++;
  27819. } else {
  27820. s5 = peg$FAILED;
  27821. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27822. }
  27823. if (s5 !== peg$FAILED) {
  27824. while (s5 !== peg$FAILED) {
  27825. s4.push(s5);
  27826. if (peg$c39.test(input.charAt(peg$currPos))) {
  27827. s5 = input.charAt(peg$currPos);
  27828. peg$currPos++;
  27829. } else {
  27830. s5 = peg$FAILED;
  27831. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27832. }
  27833. }
  27834. } else {
  27835. s4 = peg$FAILED;
  27836. }
  27837. if (s4 !== peg$FAILED) {
  27838. s3 = input.substring(s3, peg$currPos);
  27839. } else {
  27840. s3 = s4;
  27841. }
  27842. if (s3 !== peg$FAILED) {
  27843. peg$savedPos = s0;
  27844. s1 = peg$c41(s1, s3);
  27845. s0 = s1;
  27846. } else {
  27847. peg$currPos = s0;
  27848. s0 = peg$FAILED;
  27849. }
  27850. } else {
  27851. peg$currPos = s0;
  27852. s0 = peg$FAILED;
  27853. }
  27854. } else {
  27855. peg$currPos = s0;
  27856. s0 = peg$FAILED;
  27857. }
  27858. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27859. return s0;
  27860. }
  27861. function peg$parsefloat() {
  27862. var s0, s1, s2, s3, s4, s5, s6, s7;
  27863. var key = peg$currPos * 63 + 18,
  27864. cached = peg$resultsCache[key];
  27865. if (cached) {
  27866. peg$currPos = cached.nextPos;
  27867. return cached.result;
  27868. }
  27869. s0 = peg$currPos;
  27870. s1 = peg$currPos;
  27871. s2 = peg$currPos;
  27872. if (input.charCodeAt(peg$currPos) === 45) {
  27873. s3 = peg$c35;
  27874. peg$currPos++;
  27875. } else {
  27876. s3 = peg$FAILED;
  27877. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27878. }
  27879. if (s3 === peg$FAILED) {
  27880. s3 = null;
  27881. }
  27882. if (s3 !== peg$FAILED) {
  27883. s4 = [];
  27884. if (peg$c42.test(input.charAt(peg$currPos))) {
  27885. s5 = input.charAt(peg$currPos);
  27886. peg$currPos++;
  27887. } else {
  27888. s5 = peg$FAILED;
  27889. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27890. }
  27891. if (s5 !== peg$FAILED) {
  27892. while (s5 !== peg$FAILED) {
  27893. s4.push(s5);
  27894. if (peg$c42.test(input.charAt(peg$currPos))) {
  27895. s5 = input.charAt(peg$currPos);
  27896. peg$currPos++;
  27897. } else {
  27898. s5 = peg$FAILED;
  27899. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27900. }
  27901. }
  27902. } else {
  27903. s4 = peg$FAILED;
  27904. }
  27905. if (s4 !== peg$FAILED) {
  27906. if (input.charCodeAt(peg$currPos) === 46) {
  27907. s5 = peg$c6;
  27908. peg$currPos++;
  27909. } else {
  27910. s5 = peg$FAILED;
  27911. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27912. }
  27913. if (s5 !== peg$FAILED) {
  27914. s6 = [];
  27915. if (peg$c42.test(input.charAt(peg$currPos))) {
  27916. s7 = input.charAt(peg$currPos);
  27917. peg$currPos++;
  27918. } else {
  27919. s7 = peg$FAILED;
  27920. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27921. }
  27922. if (s7 !== peg$FAILED) {
  27923. while (s7 !== peg$FAILED) {
  27924. s6.push(s7);
  27925. if (peg$c42.test(input.charAt(peg$currPos))) {
  27926. s7 = input.charAt(peg$currPos);
  27927. peg$currPos++;
  27928. } else {
  27929. s7 = peg$FAILED;
  27930. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27931. }
  27932. }
  27933. } else {
  27934. s6 = peg$FAILED;
  27935. }
  27936. if (s6 !== peg$FAILED) {
  27937. s3 = [s3, s4, s5, s6];
  27938. s2 = s3;
  27939. } else {
  27940. peg$currPos = s2;
  27941. s2 = peg$FAILED;
  27942. }
  27943. } else {
  27944. peg$currPos = s2;
  27945. s2 = peg$FAILED;
  27946. }
  27947. } else {
  27948. peg$currPos = s2;
  27949. s2 = peg$FAILED;
  27950. }
  27951. } else {
  27952. peg$currPos = s2;
  27953. s2 = peg$FAILED;
  27954. }
  27955. if (s2 !== peg$FAILED) {
  27956. s1 = input.substring(s1, peg$currPos);
  27957. } else {
  27958. s1 = s2;
  27959. }
  27960. if (s1 !== peg$FAILED) {
  27961. peg$savedPos = s0;
  27962. s1 = peg$c44(s1);
  27963. }
  27964. s0 = s1;
  27965. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27966. return s0;
  27967. }
  27968. function peg$parseinteger() {
  27969. var s0, s1, s2, s3, s4, s5;
  27970. var key = peg$currPos * 63 + 19,
  27971. cached = peg$resultsCache[key];
  27972. if (cached) {
  27973. peg$currPos = cached.nextPos;
  27974. return cached.result;
  27975. }
  27976. s0 = peg$currPos;
  27977. s1 = peg$currPos;
  27978. s2 = peg$currPos;
  27979. if (input.charCodeAt(peg$currPos) === 45) {
  27980. s3 = peg$c35;
  27981. peg$currPos++;
  27982. } else {
  27983. s3 = peg$FAILED;
  27984. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27985. }
  27986. if (s3 === peg$FAILED) {
  27987. s3 = null;
  27988. }
  27989. if (s3 !== peg$FAILED) {
  27990. s4 = [];
  27991. if (peg$c42.test(input.charAt(peg$currPos))) {
  27992. s5 = input.charAt(peg$currPos);
  27993. peg$currPos++;
  27994. } else {
  27995. s5 = peg$FAILED;
  27996. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27997. }
  27998. if (s5 !== peg$FAILED) {
  27999. while (s5 !== peg$FAILED) {
  28000. s4.push(s5);
  28001. if (peg$c42.test(input.charAt(peg$currPos))) {
  28002. s5 = input.charAt(peg$currPos);
  28003. peg$currPos++;
  28004. } else {
  28005. s5 = peg$FAILED;
  28006. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28007. }
  28008. }
  28009. } else {
  28010. s4 = peg$FAILED;
  28011. }
  28012. if (s4 !== peg$FAILED) {
  28013. s3 = [s3, s4];
  28014. s2 = s3;
  28015. } else {
  28016. peg$currPos = s2;
  28017. s2 = peg$FAILED;
  28018. }
  28019. } else {
  28020. peg$currPos = s2;
  28021. s2 = peg$FAILED;
  28022. }
  28023. if (s2 !== peg$FAILED) {
  28024. s1 = input.substring(s1, peg$currPos);
  28025. } else {
  28026. s1 = s2;
  28027. }
  28028. if (s1 !== peg$FAILED) {
  28029. peg$savedPos = s0;
  28030. s1 = peg$c45(s1);
  28031. }
  28032. s0 = s1;
  28033. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28034. return s0;
  28035. }
  28036. function peg$parseliteralArray() {
  28037. var s0, s1, s2, s3, s4;
  28038. var key = peg$currPos * 63 + 20,
  28039. cached = peg$resultsCache[key];
  28040. if (cached) {
  28041. peg$currPos = cached.nextPos;
  28042. return cached.result;
  28043. }
  28044. s0 = peg$currPos;
  28045. if (input.substr(peg$currPos, 2) === peg$c46) {
  28046. s1 = peg$c46;
  28047. peg$currPos += 2;
  28048. } else {
  28049. s1 = peg$FAILED;
  28050. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28051. }
  28052. if (s1 !== peg$FAILED) {
  28053. s2 = peg$parsewsLiteralArrayContents();
  28054. if (s2 !== peg$FAILED) {
  28055. s3 = peg$parsews();
  28056. if (s3 !== peg$FAILED) {
  28057. if (input.charCodeAt(peg$currPos) === 41) {
  28058. s4 = peg$c48;
  28059. peg$currPos++;
  28060. } else {
  28061. s4 = peg$FAILED;
  28062. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28063. }
  28064. if (s4 !== peg$FAILED) {
  28065. peg$savedPos = s0;
  28066. s1 = peg$c50(s2);
  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. } else {
  28081. peg$currPos = s0;
  28082. s0 = peg$FAILED;
  28083. }
  28084. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28085. return s0;
  28086. }
  28087. function peg$parsebareLiteralArray() {
  28088. var s0, s1, s2, s3, s4;
  28089. var key = peg$currPos * 63 + 21,
  28090. cached = peg$resultsCache[key];
  28091. if (cached) {
  28092. peg$currPos = cached.nextPos;
  28093. return cached.result;
  28094. }
  28095. s0 = peg$currPos;
  28096. if (input.charCodeAt(peg$currPos) === 40) {
  28097. s1 = peg$c51;
  28098. peg$currPos++;
  28099. } else {
  28100. s1 = peg$FAILED;
  28101. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28102. }
  28103. if (s1 !== peg$FAILED) {
  28104. s2 = peg$parsewsLiteralArrayContents();
  28105. if (s2 !== peg$FAILED) {
  28106. s3 = peg$parsews();
  28107. if (s3 !== peg$FAILED) {
  28108. if (input.charCodeAt(peg$currPos) === 41) {
  28109. s4 = peg$c48;
  28110. peg$currPos++;
  28111. } else {
  28112. s4 = peg$FAILED;
  28113. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28114. }
  28115. if (s4 !== peg$FAILED) {
  28116. peg$savedPos = s0;
  28117. s1 = peg$c50(s2);
  28118. s0 = s1;
  28119. } else {
  28120. peg$currPos = s0;
  28121. s0 = peg$FAILED;
  28122. }
  28123. } else {
  28124. peg$currPos = s0;
  28125. s0 = peg$FAILED;
  28126. }
  28127. } else {
  28128. peg$currPos = s0;
  28129. s0 = peg$FAILED;
  28130. }
  28131. } else {
  28132. peg$currPos = s0;
  28133. s0 = peg$FAILED;
  28134. }
  28135. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28136. return s0;
  28137. }
  28138. function peg$parseliteralArrayElement() {
  28139. var s0;
  28140. var key = peg$currPos * 63 + 22,
  28141. cached = peg$resultsCache[key];
  28142. if (cached) {
  28143. peg$currPos = cached.nextPos;
  28144. return cached.result;
  28145. }
  28146. s0 = peg$parseparseTimeLiteral();
  28147. if (s0 === peg$FAILED) {
  28148. s0 = peg$parsebareLiteralArray();
  28149. if (s0 === peg$FAILED) {
  28150. s0 = peg$parsebareSymbol();
  28151. }
  28152. }
  28153. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28154. return s0;
  28155. }
  28156. function peg$parsewsLiteralArrayContents() {
  28157. var s0, s1, s2, s3, s4;
  28158. var key = peg$currPos * 63 + 23,
  28159. cached = peg$resultsCache[key];
  28160. if (cached) {
  28161. peg$currPos = cached.nextPos;
  28162. return cached.result;
  28163. }
  28164. s0 = peg$currPos;
  28165. s1 = [];
  28166. s2 = peg$currPos;
  28167. s3 = peg$parsews();
  28168. if (s3 !== peg$FAILED) {
  28169. s4 = peg$parseliteralArrayElement();
  28170. if (s4 !== peg$FAILED) {
  28171. peg$savedPos = s2;
  28172. s3 = peg$c53(s4);
  28173. s2 = s3;
  28174. } else {
  28175. peg$currPos = s2;
  28176. s2 = peg$FAILED;
  28177. }
  28178. } else {
  28179. peg$currPos = s2;
  28180. s2 = peg$FAILED;
  28181. }
  28182. while (s2 !== peg$FAILED) {
  28183. s1.push(s2);
  28184. s2 = peg$currPos;
  28185. s3 = peg$parsews();
  28186. if (s3 !== peg$FAILED) {
  28187. s4 = peg$parseliteralArrayElement();
  28188. if (s4 !== peg$FAILED) {
  28189. peg$savedPos = s2;
  28190. s3 = peg$c53(s4);
  28191. s2 = s3;
  28192. } else {
  28193. peg$currPos = s2;
  28194. s2 = peg$FAILED;
  28195. }
  28196. } else {
  28197. peg$currPos = s2;
  28198. s2 = peg$FAILED;
  28199. }
  28200. }
  28201. if (s1 !== peg$FAILED) {
  28202. peg$savedPos = s0;
  28203. s1 = peg$c54(s1);
  28204. }
  28205. s0 = s1;
  28206. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28207. return s0;
  28208. }
  28209. function peg$parsedynamicArray() {
  28210. var s0, s1, s2, s3, s4;
  28211. var key = peg$currPos * 63 + 24,
  28212. cached = peg$resultsCache[key];
  28213. if (cached) {
  28214. peg$currPos = cached.nextPos;
  28215. return cached.result;
  28216. }
  28217. s0 = peg$currPos;
  28218. if (input.charCodeAt(peg$currPos) === 123) {
  28219. s1 = peg$c55;
  28220. peg$currPos++;
  28221. } else {
  28222. s1 = peg$FAILED;
  28223. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28224. }
  28225. if (s1 !== peg$FAILED) {
  28226. s2 = peg$parsewsExpressions();
  28227. if (s2 === peg$FAILED) {
  28228. s2 = null;
  28229. }
  28230. if (s2 !== peg$FAILED) {
  28231. s3 = peg$parsemaybeDotsWs();
  28232. if (s3 !== peg$FAILED) {
  28233. if (input.charCodeAt(peg$currPos) === 125) {
  28234. s4 = peg$c57;
  28235. peg$currPos++;
  28236. } else {
  28237. s4 = peg$FAILED;
  28238. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28239. }
  28240. if (s4 !== peg$FAILED) {
  28241. peg$savedPos = s0;
  28242. s1 = peg$c59(s2);
  28243. s0 = s1;
  28244. } else {
  28245. peg$currPos = s0;
  28246. s0 = peg$FAILED;
  28247. }
  28248. } else {
  28249. peg$currPos = s0;
  28250. s0 = peg$FAILED;
  28251. }
  28252. } else {
  28253. peg$currPos = s0;
  28254. s0 = peg$FAILED;
  28255. }
  28256. } else {
  28257. peg$currPos = s0;
  28258. s0 = peg$FAILED;
  28259. }
  28260. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28261. return s0;
  28262. }
  28263. function peg$parsedynamicDictionary() {
  28264. var s0, s1, s2, s3, s4;
  28265. var key = peg$currPos * 63 + 25,
  28266. cached = peg$resultsCache[key];
  28267. if (cached) {
  28268. peg$currPos = cached.nextPos;
  28269. return cached.result;
  28270. }
  28271. s0 = peg$currPos;
  28272. if (input.substr(peg$currPos, 2) === peg$c60) {
  28273. s1 = peg$c60;
  28274. peg$currPos += 2;
  28275. } else {
  28276. s1 = peg$FAILED;
  28277. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28278. }
  28279. if (s1 !== peg$FAILED) {
  28280. s2 = peg$parsewsAssociations();
  28281. if (s2 === peg$FAILED) {
  28282. s2 = null;
  28283. }
  28284. if (s2 !== peg$FAILED) {
  28285. s3 = peg$parsemaybeDotsWs();
  28286. if (s3 !== peg$FAILED) {
  28287. if (input.charCodeAt(peg$currPos) === 125) {
  28288. s4 = peg$c57;
  28289. peg$currPos++;
  28290. } else {
  28291. s4 = peg$FAILED;
  28292. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28293. }
  28294. if (s4 !== peg$FAILED) {
  28295. peg$savedPos = s0;
  28296. s1 = peg$c62(s2);
  28297. s0 = s1;
  28298. } else {
  28299. peg$currPos = s0;
  28300. s0 = peg$FAILED;
  28301. }
  28302. } else {
  28303. peg$currPos = s0;
  28304. s0 = peg$FAILED;
  28305. }
  28306. } else {
  28307. peg$currPos = s0;
  28308. s0 = peg$FAILED;
  28309. }
  28310. } else {
  28311. peg$currPos = s0;
  28312. s0 = peg$FAILED;
  28313. }
  28314. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28315. return s0;
  28316. }
  28317. function peg$parsepseudoVariable() {
  28318. var s0, s1, s2;
  28319. var key = peg$currPos * 63 + 26,
  28320. cached = peg$resultsCache[key];
  28321. if (cached) {
  28322. peg$currPos = cached.nextPos;
  28323. return cached.result;
  28324. }
  28325. s0 = peg$currPos;
  28326. s1 = peg$currPos;
  28327. if (input.substr(peg$currPos, 4) === peg$c63) {
  28328. s2 = peg$c63;
  28329. peg$currPos += 4;
  28330. } else {
  28331. s2 = peg$FAILED;
  28332. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28333. }
  28334. if (s2 !== peg$FAILED) {
  28335. peg$savedPos = s1;
  28336. s2 = peg$c65();
  28337. }
  28338. s1 = s2;
  28339. if (s1 === peg$FAILED) {
  28340. s1 = peg$currPos;
  28341. if (input.substr(peg$currPos, 5) === peg$c66) {
  28342. s2 = peg$c66;
  28343. peg$currPos += 5;
  28344. } else {
  28345. s2 = peg$FAILED;
  28346. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28347. }
  28348. if (s2 !== peg$FAILED) {
  28349. peg$savedPos = s1;
  28350. s2 = peg$c68();
  28351. }
  28352. s1 = s2;
  28353. if (s1 === peg$FAILED) {
  28354. s1 = peg$currPos;
  28355. if (input.substr(peg$currPos, 3) === peg$c69) {
  28356. s2 = peg$c69;
  28357. peg$currPos += 3;
  28358. } else {
  28359. s2 = peg$FAILED;
  28360. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28361. }
  28362. if (s2 !== peg$FAILED) {
  28363. peg$savedPos = s1;
  28364. s2 = peg$c71();
  28365. }
  28366. s1 = s2;
  28367. }
  28368. }
  28369. if (s1 !== peg$FAILED) {
  28370. peg$savedPos = s0;
  28371. s1 = peg$c16(s1);
  28372. }
  28373. s0 = s1;
  28374. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28375. return s0;
  28376. }
  28377. function peg$parseparseTimeLiteral() {
  28378. var s0;
  28379. var key = peg$currPos * 63 + 27,
  28380. cached = peg$resultsCache[key];
  28381. if (cached) {
  28382. peg$currPos = cached.nextPos;
  28383. return cached.result;
  28384. }
  28385. s0 = peg$parsepseudoVariable();
  28386. if (s0 === peg$FAILED) {
  28387. s0 = peg$parsenumber();
  28388. if (s0 === peg$FAILED) {
  28389. s0 = peg$parseliteralArray();
  28390. if (s0 === peg$FAILED) {
  28391. s0 = peg$parsestring();
  28392. if (s0 === peg$FAILED) {
  28393. s0 = peg$parsesymbol();
  28394. if (s0 === peg$FAILED) {
  28395. s0 = peg$parsecharacter();
  28396. }
  28397. }
  28398. }
  28399. }
  28400. }
  28401. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28402. return s0;
  28403. }
  28404. function peg$parseruntimeLiteral() {
  28405. var s0;
  28406. var key = peg$currPos * 63 + 28,
  28407. cached = peg$resultsCache[key];
  28408. if (cached) {
  28409. peg$currPos = cached.nextPos;
  28410. return cached.result;
  28411. }
  28412. s0 = peg$parsedynamicDictionary();
  28413. if (s0 === peg$FAILED) {
  28414. s0 = peg$parsedynamicArray();
  28415. if (s0 === peg$FAILED) {
  28416. s0 = peg$parseblock();
  28417. }
  28418. }
  28419. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28420. return s0;
  28421. }
  28422. function peg$parseliteral() {
  28423. var s0;
  28424. var key = peg$currPos * 63 + 29,
  28425. cached = peg$resultsCache[key];
  28426. if (cached) {
  28427. peg$currPos = cached.nextPos;
  28428. return cached.result;
  28429. }
  28430. s0 = peg$parseruntimeLiteral();
  28431. if (s0 === peg$FAILED) {
  28432. s0 = peg$parseparseTimeLiteral();
  28433. }
  28434. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28435. return s0;
  28436. }
  28437. function peg$parsevariable() {
  28438. var s0, s1;
  28439. var key = peg$currPos * 63 + 30,
  28440. cached = peg$resultsCache[key];
  28441. if (cached) {
  28442. peg$currPos = cached.nextPos;
  28443. return cached.result;
  28444. }
  28445. s0 = peg$currPos;
  28446. s1 = peg$parseidentifier();
  28447. if (s1 !== peg$FAILED) {
  28448. peg$savedPos = s0;
  28449. s1 = peg$c72(s1);
  28450. }
  28451. s0 = s1;
  28452. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28453. return s0;
  28454. }
  28455. function peg$parsebinarySelector() {
  28456. var s0, s1, s2;
  28457. var key = peg$currPos * 63 + 31,
  28458. cached = peg$resultsCache[key];
  28459. if (cached) {
  28460. peg$currPos = cached.nextPos;
  28461. return cached.result;
  28462. }
  28463. s0 = peg$currPos;
  28464. s1 = [];
  28465. if (peg$c73.test(input.charAt(peg$currPos))) {
  28466. s2 = input.charAt(peg$currPos);
  28467. peg$currPos++;
  28468. } else {
  28469. s2 = peg$FAILED;
  28470. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28471. }
  28472. if (s2 !== peg$FAILED) {
  28473. while (s2 !== peg$FAILED) {
  28474. s1.push(s2);
  28475. if (peg$c73.test(input.charAt(peg$currPos))) {
  28476. s2 = input.charAt(peg$currPos);
  28477. peg$currPos++;
  28478. } else {
  28479. s2 = peg$FAILED;
  28480. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28481. }
  28482. }
  28483. } else {
  28484. s1 = peg$FAILED;
  28485. }
  28486. if (s1 !== peg$FAILED) {
  28487. s0 = input.substring(s0, peg$currPos);
  28488. } else {
  28489. s0 = s1;
  28490. }
  28491. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28492. return s0;
  28493. }
  28494. function peg$parsewsKeywordPattern() {
  28495. var s0, s1, s2, s3, s4, s5, s6;
  28496. var key = peg$currPos * 63 + 32,
  28497. cached = peg$resultsCache[key];
  28498. if (cached) {
  28499. peg$currPos = cached.nextPos;
  28500. return cached.result;
  28501. }
  28502. s0 = peg$currPos;
  28503. s1 = [];
  28504. s2 = peg$currPos;
  28505. s3 = peg$parsews();
  28506. if (s3 !== peg$FAILED) {
  28507. s4 = peg$parsekeyword();
  28508. if (s4 !== peg$FAILED) {
  28509. s5 = peg$parsews();
  28510. if (s5 !== peg$FAILED) {
  28511. s6 = peg$parseidentifier();
  28512. if (s6 !== peg$FAILED) {
  28513. peg$savedPos = s2;
  28514. s3 = peg$c75(s4, s6);
  28515. s2 = s3;
  28516. } else {
  28517. peg$currPos = s2;
  28518. s2 = peg$FAILED;
  28519. }
  28520. } else {
  28521. peg$currPos = s2;
  28522. s2 = peg$FAILED;
  28523. }
  28524. } else {
  28525. peg$currPos = s2;
  28526. s2 = peg$FAILED;
  28527. }
  28528. } else {
  28529. peg$currPos = s2;
  28530. s2 = peg$FAILED;
  28531. }
  28532. if (s2 !== peg$FAILED) {
  28533. while (s2 !== peg$FAILED) {
  28534. s1.push(s2);
  28535. s2 = peg$currPos;
  28536. s3 = peg$parsews();
  28537. if (s3 !== peg$FAILED) {
  28538. s4 = peg$parsekeyword();
  28539. if (s4 !== peg$FAILED) {
  28540. s5 = peg$parsews();
  28541. if (s5 !== peg$FAILED) {
  28542. s6 = peg$parseidentifier();
  28543. if (s6 !== peg$FAILED) {
  28544. peg$savedPos = s2;
  28545. s3 = peg$c75(s4, s6);
  28546. s2 = s3;
  28547. } else {
  28548. peg$currPos = s2;
  28549. s2 = peg$FAILED;
  28550. }
  28551. } else {
  28552. peg$currPos = s2;
  28553. s2 = peg$FAILED;
  28554. }
  28555. } else {
  28556. peg$currPos = s2;
  28557. s2 = peg$FAILED;
  28558. }
  28559. } else {
  28560. peg$currPos = s2;
  28561. s2 = peg$FAILED;
  28562. }
  28563. }
  28564. } else {
  28565. s1 = peg$FAILED;
  28566. }
  28567. if (s1 !== peg$FAILED) {
  28568. peg$savedPos = s0;
  28569. s1 = peg$c76(s1);
  28570. }
  28571. s0 = s1;
  28572. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28573. return s0;
  28574. }
  28575. function peg$parsewsBinaryPattern() {
  28576. var s0, s1, s2, s3, s4;
  28577. var key = peg$currPos * 63 + 33,
  28578. cached = peg$resultsCache[key];
  28579. if (cached) {
  28580. peg$currPos = cached.nextPos;
  28581. return cached.result;
  28582. }
  28583. s0 = peg$currPos;
  28584. s1 = peg$parsews();
  28585. if (s1 !== peg$FAILED) {
  28586. s2 = peg$parsebinarySelector();
  28587. if (s2 !== peg$FAILED) {
  28588. s3 = peg$parsews();
  28589. if (s3 !== peg$FAILED) {
  28590. s4 = peg$parseidentifier();
  28591. if (s4 !== peg$FAILED) {
  28592. peg$savedPos = s0;
  28593. s1 = peg$c77(s2, s4);
  28594. s0 = s1;
  28595. } else {
  28596. peg$currPos = s0;
  28597. s0 = peg$FAILED;
  28598. }
  28599. } else {
  28600. peg$currPos = s0;
  28601. s0 = peg$FAILED;
  28602. }
  28603. } else {
  28604. peg$currPos = s0;
  28605. s0 = peg$FAILED;
  28606. }
  28607. } else {
  28608. peg$currPos = s0;
  28609. s0 = peg$FAILED;
  28610. }
  28611. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28612. return s0;
  28613. }
  28614. function peg$parsewsUnaryPattern() {
  28615. var s0, s1, s2;
  28616. var key = peg$currPos * 63 + 34,
  28617. cached = peg$resultsCache[key];
  28618. if (cached) {
  28619. peg$currPos = cached.nextPos;
  28620. return cached.result;
  28621. }
  28622. s0 = peg$currPos;
  28623. s1 = peg$parsews();
  28624. if (s1 !== peg$FAILED) {
  28625. s2 = peg$parseidentifier();
  28626. if (s2 !== peg$FAILED) {
  28627. peg$savedPos = s0;
  28628. s1 = peg$c78(s2);
  28629. s0 = s1;
  28630. } else {
  28631. peg$currPos = s0;
  28632. s0 = peg$FAILED;
  28633. }
  28634. } else {
  28635. peg$currPos = s0;
  28636. s0 = peg$FAILED;
  28637. }
  28638. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28639. return s0;
  28640. }
  28641. function peg$parseexpression() {
  28642. var s0;
  28643. var key = peg$currPos * 63 + 35,
  28644. cached = peg$resultsCache[key];
  28645. if (cached) {
  28646. peg$currPos = cached.nextPos;
  28647. return cached.result;
  28648. }
  28649. s0 = peg$parseassignment();
  28650. if (s0 === peg$FAILED) {
  28651. s0 = peg$parsecascade();
  28652. if (s0 === peg$FAILED) {
  28653. s0 = peg$parsekeywordSend();
  28654. }
  28655. }
  28656. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28657. return s0;
  28658. }
  28659. function peg$parsewsExpressionsRest() {
  28660. var s0, s1, s2;
  28661. var key = peg$currPos * 63 + 36,
  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$parsesomeDotsWs();
  28669. if (s1 !== peg$FAILED) {
  28670. s2 = peg$parseexpression();
  28671. if (s2 !== peg$FAILED) {
  28672. peg$savedPos = s0;
  28673. s1 = peg$c79(s2);
  28674. s0 = s1;
  28675. } else {
  28676. peg$currPos = s0;
  28677. s0 = peg$FAILED;
  28678. }
  28679. } else {
  28680. peg$currPos = s0;
  28681. s0 = peg$FAILED;
  28682. }
  28683. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28684. return s0;
  28685. }
  28686. function peg$parsewsExpressions() {
  28687. var s0, s1, s2, s3, s4;
  28688. var key = peg$currPos * 63 + 37,
  28689. cached = peg$resultsCache[key];
  28690. if (cached) {
  28691. peg$currPos = cached.nextPos;
  28692. return cached.result;
  28693. }
  28694. s0 = peg$currPos;
  28695. s1 = peg$parsemaybeDotsWs();
  28696. if (s1 !== peg$FAILED) {
  28697. s2 = peg$parseexpression();
  28698. if (s2 !== peg$FAILED) {
  28699. s3 = [];
  28700. s4 = peg$parsewsExpressionsRest();
  28701. while (s4 !== peg$FAILED) {
  28702. s3.push(s4);
  28703. s4 = peg$parsewsExpressionsRest();
  28704. }
  28705. if (s3 !== peg$FAILED) {
  28706. peg$savedPos = s0;
  28707. s1 = peg$c80(s2, s3);
  28708. s0 = s1;
  28709. } else {
  28710. peg$currPos = s0;
  28711. s0 = peg$FAILED;
  28712. }
  28713. } else {
  28714. peg$currPos = s0;
  28715. s0 = peg$FAILED;
  28716. }
  28717. } else {
  28718. peg$currPos = s0;
  28719. s0 = peg$FAILED;
  28720. }
  28721. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28722. return s0;
  28723. }
  28724. function peg$parseassignment() {
  28725. var s0, s1, s2, s3, s4, s5;
  28726. var key = peg$currPos * 63 + 38,
  28727. cached = peg$resultsCache[key];
  28728. if (cached) {
  28729. peg$currPos = cached.nextPos;
  28730. return cached.result;
  28731. }
  28732. s0 = peg$currPos;
  28733. s1 = peg$parsevariable();
  28734. if (s1 !== peg$FAILED) {
  28735. s2 = peg$parsews();
  28736. if (s2 !== peg$FAILED) {
  28737. if (input.substr(peg$currPos, 2) === peg$c81) {
  28738. s3 = peg$c81;
  28739. peg$currPos += 2;
  28740. } else {
  28741. s3 = peg$FAILED;
  28742. if (peg$silentFails === 0) { peg$fail(peg$c82); }
  28743. }
  28744. if (s3 !== peg$FAILED) {
  28745. s4 = peg$parsews();
  28746. if (s4 !== peg$FAILED) {
  28747. s5 = peg$parseexpression();
  28748. if (s5 !== peg$FAILED) {
  28749. peg$savedPos = s0;
  28750. s1 = peg$c83(s1, s5);
  28751. s0 = s1;
  28752. } else {
  28753. peg$currPos = s0;
  28754. s0 = peg$FAILED;
  28755. }
  28756. } else {
  28757. peg$currPos = s0;
  28758. s0 = peg$FAILED;
  28759. }
  28760. } else {
  28761. peg$currPos = s0;
  28762. s0 = peg$FAILED;
  28763. }
  28764. } else {
  28765. peg$currPos = s0;
  28766. s0 = peg$FAILED;
  28767. }
  28768. } else {
  28769. peg$currPos = s0;
  28770. s0 = peg$FAILED;
  28771. }
  28772. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28773. return s0;
  28774. }
  28775. function peg$parseret() {
  28776. var s0, s1, s2, s3;
  28777. var key = peg$currPos * 63 + 39,
  28778. cached = peg$resultsCache[key];
  28779. if (cached) {
  28780. peg$currPos = cached.nextPos;
  28781. return cached.result;
  28782. }
  28783. s0 = peg$currPos;
  28784. if (input.charCodeAt(peg$currPos) === 94) {
  28785. s1 = peg$c84;
  28786. peg$currPos++;
  28787. } else {
  28788. s1 = peg$FAILED;
  28789. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  28790. }
  28791. if (s1 !== peg$FAILED) {
  28792. s2 = peg$parsews();
  28793. if (s2 !== peg$FAILED) {
  28794. s3 = peg$parseexpression();
  28795. if (s3 !== peg$FAILED) {
  28796. peg$savedPos = s0;
  28797. s1 = peg$c86(s3);
  28798. s0 = s1;
  28799. } else {
  28800. peg$currPos = s0;
  28801. s0 = peg$FAILED;
  28802. }
  28803. } else {
  28804. peg$currPos = s0;
  28805. s0 = peg$FAILED;
  28806. }
  28807. } else {
  28808. peg$currPos = s0;
  28809. s0 = peg$FAILED;
  28810. }
  28811. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28812. return s0;
  28813. }
  28814. function peg$parsetemps() {
  28815. var s0, s1, s2, s3, s4, s5;
  28816. var key = peg$currPos * 63 + 40,
  28817. cached = peg$resultsCache[key];
  28818. if (cached) {
  28819. peg$currPos = cached.nextPos;
  28820. return cached.result;
  28821. }
  28822. s0 = peg$currPos;
  28823. if (input.charCodeAt(peg$currPos) === 124) {
  28824. s1 = peg$c87;
  28825. peg$currPos++;
  28826. } else {
  28827. s1 = peg$FAILED;
  28828. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28829. }
  28830. if (s1 !== peg$FAILED) {
  28831. s2 = [];
  28832. s3 = peg$currPos;
  28833. s4 = peg$parsews();
  28834. if (s4 !== peg$FAILED) {
  28835. s5 = peg$parseidentifier();
  28836. if (s5 !== peg$FAILED) {
  28837. peg$savedPos = s3;
  28838. s4 = peg$c89(s5);
  28839. s3 = s4;
  28840. } else {
  28841. peg$currPos = s3;
  28842. s3 = peg$FAILED;
  28843. }
  28844. } else {
  28845. peg$currPos = s3;
  28846. s3 = peg$FAILED;
  28847. }
  28848. while (s3 !== peg$FAILED) {
  28849. s2.push(s3);
  28850. s3 = peg$currPos;
  28851. s4 = peg$parsews();
  28852. if (s4 !== peg$FAILED) {
  28853. s5 = peg$parseidentifier();
  28854. if (s5 !== peg$FAILED) {
  28855. peg$savedPos = s3;
  28856. s4 = peg$c89(s5);
  28857. s3 = s4;
  28858. } else {
  28859. peg$currPos = s3;
  28860. s3 = peg$FAILED;
  28861. }
  28862. } else {
  28863. peg$currPos = s3;
  28864. s3 = peg$FAILED;
  28865. }
  28866. }
  28867. if (s2 !== peg$FAILED) {
  28868. s3 = peg$parsews();
  28869. if (s3 !== peg$FAILED) {
  28870. if (input.charCodeAt(peg$currPos) === 124) {
  28871. s4 = peg$c87;
  28872. peg$currPos++;
  28873. } else {
  28874. s4 = peg$FAILED;
  28875. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28876. }
  28877. if (s4 !== peg$FAILED) {
  28878. peg$savedPos = s0;
  28879. s1 = peg$c90(s2);
  28880. s0 = s1;
  28881. } else {
  28882. peg$currPos = s0;
  28883. s0 = peg$FAILED;
  28884. }
  28885. } else {
  28886. peg$currPos = s0;
  28887. s0 = peg$FAILED;
  28888. }
  28889. } else {
  28890. peg$currPos = s0;
  28891. s0 = peg$FAILED;
  28892. }
  28893. } else {
  28894. peg$currPos = s0;
  28895. s0 = peg$FAILED;
  28896. }
  28897. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28898. return s0;
  28899. }
  28900. function peg$parsewsBlockParamList() {
  28901. var s0, s1, s2, s3, s4, s5, s6;
  28902. var key = peg$currPos * 63 + 41,
  28903. cached = peg$resultsCache[key];
  28904. if (cached) {
  28905. peg$currPos = cached.nextPos;
  28906. return cached.result;
  28907. }
  28908. s0 = peg$currPos;
  28909. s1 = [];
  28910. s2 = peg$currPos;
  28911. s3 = peg$parsews();
  28912. if (s3 !== peg$FAILED) {
  28913. if (input.charCodeAt(peg$currPos) === 58) {
  28914. s4 = peg$c12;
  28915. peg$currPos++;
  28916. } else {
  28917. s4 = peg$FAILED;
  28918. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28919. }
  28920. if (s4 !== peg$FAILED) {
  28921. s5 = peg$parsews();
  28922. if (s5 !== peg$FAILED) {
  28923. s6 = peg$parseidentifier();
  28924. if (s6 !== peg$FAILED) {
  28925. peg$savedPos = s2;
  28926. s3 = peg$c91(s6);
  28927. s2 = s3;
  28928. } else {
  28929. peg$currPos = s2;
  28930. s2 = peg$FAILED;
  28931. }
  28932. } else {
  28933. peg$currPos = s2;
  28934. s2 = peg$FAILED;
  28935. }
  28936. } else {
  28937. peg$currPos = s2;
  28938. s2 = peg$FAILED;
  28939. }
  28940. } else {
  28941. peg$currPos = s2;
  28942. s2 = peg$FAILED;
  28943. }
  28944. if (s2 !== peg$FAILED) {
  28945. while (s2 !== peg$FAILED) {
  28946. s1.push(s2);
  28947. s2 = peg$currPos;
  28948. s3 = peg$parsews();
  28949. if (s3 !== peg$FAILED) {
  28950. if (input.charCodeAt(peg$currPos) === 58) {
  28951. s4 = peg$c12;
  28952. peg$currPos++;
  28953. } else {
  28954. s4 = peg$FAILED;
  28955. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28956. }
  28957. if (s4 !== peg$FAILED) {
  28958. s5 = peg$parsews();
  28959. if (s5 !== peg$FAILED) {
  28960. s6 = peg$parseidentifier();
  28961. if (s6 !== peg$FAILED) {
  28962. peg$savedPos = s2;
  28963. s3 = peg$c91(s6);
  28964. s2 = s3;
  28965. } else {
  28966. peg$currPos = s2;
  28967. s2 = peg$FAILED;
  28968. }
  28969. } else {
  28970. peg$currPos = s2;
  28971. s2 = peg$FAILED;
  28972. }
  28973. } else {
  28974. peg$currPos = s2;
  28975. s2 = peg$FAILED;
  28976. }
  28977. } else {
  28978. peg$currPos = s2;
  28979. s2 = peg$FAILED;
  28980. }
  28981. }
  28982. } else {
  28983. s1 = peg$FAILED;
  28984. }
  28985. if (s1 !== peg$FAILED) {
  28986. s2 = peg$parsews();
  28987. if (s2 !== peg$FAILED) {
  28988. if (input.charCodeAt(peg$currPos) === 124) {
  28989. s3 = peg$c87;
  28990. peg$currPos++;
  28991. } else {
  28992. s3 = peg$FAILED;
  28993. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28994. }
  28995. if (s3 !== peg$FAILED) {
  28996. peg$savedPos = s0;
  28997. s1 = peg$c92(s1);
  28998. s0 = s1;
  28999. } else {
  29000. peg$currPos = s0;
  29001. s0 = peg$FAILED;
  29002. }
  29003. } else {
  29004. peg$currPos = s0;
  29005. s0 = peg$FAILED;
  29006. }
  29007. } else {
  29008. peg$currPos = s0;
  29009. s0 = peg$FAILED;
  29010. }
  29011. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29012. return s0;
  29013. }
  29014. function peg$parsesubexpression() {
  29015. var s0, s1, s2, s3, s4, s5;
  29016. var key = peg$currPos * 63 + 42,
  29017. cached = peg$resultsCache[key];
  29018. if (cached) {
  29019. peg$currPos = cached.nextPos;
  29020. return cached.result;
  29021. }
  29022. s0 = peg$currPos;
  29023. if (input.charCodeAt(peg$currPos) === 40) {
  29024. s1 = peg$c51;
  29025. peg$currPos++;
  29026. } else {
  29027. s1 = peg$FAILED;
  29028. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29029. }
  29030. if (s1 !== peg$FAILED) {
  29031. s2 = peg$parsews();
  29032. if (s2 !== peg$FAILED) {
  29033. s3 = peg$parseexpression();
  29034. if (s3 !== peg$FAILED) {
  29035. s4 = peg$parsews();
  29036. if (s4 !== peg$FAILED) {
  29037. if (input.charCodeAt(peg$currPos) === 41) {
  29038. s5 = peg$c48;
  29039. peg$currPos++;
  29040. } else {
  29041. s5 = peg$FAILED;
  29042. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29043. }
  29044. if (s5 !== peg$FAILED) {
  29045. peg$savedPos = s0;
  29046. s1 = peg$c79(s3);
  29047. s0 = s1;
  29048. } else {
  29049. peg$currPos = s0;
  29050. s0 = peg$FAILED;
  29051. }
  29052. } else {
  29053. peg$currPos = s0;
  29054. s0 = peg$FAILED;
  29055. }
  29056. } else {
  29057. peg$currPos = s0;
  29058. s0 = peg$FAILED;
  29059. }
  29060. } else {
  29061. peg$currPos = s0;
  29062. s0 = peg$FAILED;
  29063. }
  29064. } else {
  29065. peg$currPos = s0;
  29066. s0 = peg$FAILED;
  29067. }
  29068. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29069. return s0;
  29070. }
  29071. function peg$parsewsStatements() {
  29072. var s0, s1, s2, s3;
  29073. var key = peg$currPos * 63 + 43,
  29074. cached = peg$resultsCache[key];
  29075. if (cached) {
  29076. peg$currPos = cached.nextPos;
  29077. return cached.result;
  29078. }
  29079. s0 = peg$currPos;
  29080. s1 = peg$parsemaybeDotsWs();
  29081. if (s1 !== peg$FAILED) {
  29082. s2 = peg$parseret();
  29083. if (s2 !== peg$FAILED) {
  29084. peg$savedPos = s0;
  29085. s1 = peg$c93(s2);
  29086. s0 = s1;
  29087. } else {
  29088. peg$currPos = s0;
  29089. s0 = peg$FAILED;
  29090. }
  29091. } else {
  29092. peg$currPos = s0;
  29093. s0 = peg$FAILED;
  29094. }
  29095. if (s0 === peg$FAILED) {
  29096. s0 = peg$currPos;
  29097. s1 = peg$parsewsExpressions();
  29098. if (s1 !== peg$FAILED) {
  29099. s2 = peg$parsesomeDotsWs();
  29100. if (s2 !== peg$FAILED) {
  29101. s3 = peg$parseret();
  29102. if (s3 !== peg$FAILED) {
  29103. peg$savedPos = s0;
  29104. s1 = peg$c94(s1, s3);
  29105. s0 = s1;
  29106. } else {
  29107. peg$currPos = s0;
  29108. s0 = peg$FAILED;
  29109. }
  29110. } else {
  29111. peg$currPos = s0;
  29112. s0 = peg$FAILED;
  29113. }
  29114. } else {
  29115. peg$currPos = s0;
  29116. s0 = peg$FAILED;
  29117. }
  29118. if (s0 === peg$FAILED) {
  29119. s0 = peg$currPos;
  29120. s1 = peg$parsewsExpressions();
  29121. if (s1 === peg$FAILED) {
  29122. s1 = null;
  29123. }
  29124. if (s1 !== peg$FAILED) {
  29125. peg$savedPos = s0;
  29126. s1 = peg$c95(s1);
  29127. }
  29128. s0 = s1;
  29129. }
  29130. }
  29131. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29132. return s0;
  29133. }
  29134. function peg$parsewsSequenceWs() {
  29135. var s0, s1, s2, s3;
  29136. var key = peg$currPos * 63 + 44,
  29137. cached = peg$resultsCache[key];
  29138. if (cached) {
  29139. peg$currPos = cached.nextPos;
  29140. return cached.result;
  29141. }
  29142. s0 = peg$currPos;
  29143. s1 = peg$parsews();
  29144. if (s1 !== peg$FAILED) {
  29145. s2 = peg$parsejsStatement();
  29146. if (s2 !== peg$FAILED) {
  29147. s3 = peg$parsews();
  29148. if (s3 !== peg$FAILED) {
  29149. peg$savedPos = s0;
  29150. s1 = peg$c96(s2);
  29151. s0 = s1;
  29152. } else {
  29153. peg$currPos = s0;
  29154. s0 = peg$FAILED;
  29155. }
  29156. } else {
  29157. peg$currPos = s0;
  29158. s0 = peg$FAILED;
  29159. }
  29160. } else {
  29161. peg$currPos = s0;
  29162. s0 = peg$FAILED;
  29163. }
  29164. if (s0 === peg$FAILED) {
  29165. s0 = peg$parsewsStSequenceWs();
  29166. }
  29167. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29168. return s0;
  29169. }
  29170. function peg$parsewsStSequenceWs() {
  29171. var s0, s1, s2, s3, s4;
  29172. var key = peg$currPos * 63 + 45,
  29173. cached = peg$resultsCache[key];
  29174. if (cached) {
  29175. peg$currPos = cached.nextPos;
  29176. return cached.result;
  29177. }
  29178. s0 = peg$currPos;
  29179. s1 = peg$parsews();
  29180. if (s1 !== peg$FAILED) {
  29181. s2 = peg$parsetemps();
  29182. if (s2 === peg$FAILED) {
  29183. s2 = null;
  29184. }
  29185. if (s2 !== peg$FAILED) {
  29186. s3 = peg$parsewsStatements();
  29187. if (s3 === peg$FAILED) {
  29188. s3 = null;
  29189. }
  29190. if (s3 !== peg$FAILED) {
  29191. s4 = peg$parsemaybeDotsWs();
  29192. if (s4 !== peg$FAILED) {
  29193. peg$savedPos = s0;
  29194. s1 = peg$c97(s2, s3);
  29195. s0 = s1;
  29196. } else {
  29197. peg$currPos = s0;
  29198. s0 = peg$FAILED;
  29199. }
  29200. } else {
  29201. peg$currPos = s0;
  29202. s0 = peg$FAILED;
  29203. }
  29204. } else {
  29205. peg$currPos = s0;
  29206. s0 = peg$FAILED;
  29207. }
  29208. } else {
  29209. peg$currPos = s0;
  29210. s0 = peg$FAILED;
  29211. }
  29212. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29213. return s0;
  29214. }
  29215. function peg$parseblock() {
  29216. var s0, s1, s2, s3, s4;
  29217. var key = peg$currPos * 63 + 46,
  29218. cached = peg$resultsCache[key];
  29219. if (cached) {
  29220. peg$currPos = cached.nextPos;
  29221. return cached.result;
  29222. }
  29223. s0 = peg$currPos;
  29224. if (input.charCodeAt(peg$currPos) === 91) {
  29225. s1 = peg$c98;
  29226. peg$currPos++;
  29227. } else {
  29228. s1 = peg$FAILED;
  29229. if (peg$silentFails === 0) { peg$fail(peg$c99); }
  29230. }
  29231. if (s1 !== peg$FAILED) {
  29232. s2 = peg$parsewsBlockParamList();
  29233. if (s2 === peg$FAILED) {
  29234. s2 = null;
  29235. }
  29236. if (s2 !== peg$FAILED) {
  29237. s3 = peg$parsewsSequenceWs();
  29238. if (s3 !== peg$FAILED) {
  29239. if (input.charCodeAt(peg$currPos) === 93) {
  29240. s4 = peg$c100;
  29241. peg$currPos++;
  29242. } else {
  29243. s4 = peg$FAILED;
  29244. if (peg$silentFails === 0) { peg$fail(peg$c101); }
  29245. }
  29246. if (s4 !== peg$FAILED) {
  29247. peg$savedPos = s0;
  29248. s1 = peg$c102(s2, s3);
  29249. s0 = s1;
  29250. } else {
  29251. peg$currPos = s0;
  29252. s0 = peg$FAILED;
  29253. }
  29254. } else {
  29255. peg$currPos = s0;
  29256. s0 = peg$FAILED;
  29257. }
  29258. } else {
  29259. peg$currPos = s0;
  29260. s0 = peg$FAILED;
  29261. }
  29262. } else {
  29263. peg$currPos = s0;
  29264. s0 = peg$FAILED;
  29265. }
  29266. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29267. return s0;
  29268. }
  29269. function peg$parseoperand() {
  29270. var s0;
  29271. var key = peg$currPos * 63 + 47,
  29272. cached = peg$resultsCache[key];
  29273. if (cached) {
  29274. peg$currPos = cached.nextPos;
  29275. return cached.result;
  29276. }
  29277. s0 = peg$parseliteral();
  29278. if (s0 === peg$FAILED) {
  29279. s0 = peg$parsevariable();
  29280. if (s0 === peg$FAILED) {
  29281. s0 = peg$parsesubexpression();
  29282. }
  29283. }
  29284. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29285. return s0;
  29286. }
  29287. function peg$parsewsUnaryMessage() {
  29288. var s0, s1, s2, s3, s4;
  29289. var key = peg$currPos * 63 + 48,
  29290. cached = peg$resultsCache[key];
  29291. if (cached) {
  29292. peg$currPos = cached.nextPos;
  29293. return cached.result;
  29294. }
  29295. s0 = peg$currPos;
  29296. s1 = peg$parsews();
  29297. if (s1 !== peg$FAILED) {
  29298. s2 = peg$parseidentifier();
  29299. if (s2 !== peg$FAILED) {
  29300. s3 = peg$currPos;
  29301. peg$silentFails++;
  29302. if (input.charCodeAt(peg$currPos) === 58) {
  29303. s4 = peg$c12;
  29304. peg$currPos++;
  29305. } else {
  29306. s4 = peg$FAILED;
  29307. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29308. }
  29309. peg$silentFails--;
  29310. if (s4 === peg$FAILED) {
  29311. s3 = void 0;
  29312. } else {
  29313. peg$currPos = s3;
  29314. s3 = peg$FAILED;
  29315. }
  29316. if (s3 !== peg$FAILED) {
  29317. peg$savedPos = s0;
  29318. s1 = peg$c103(s2);
  29319. s0 = s1;
  29320. } else {
  29321. peg$currPos = s0;
  29322. s0 = peg$FAILED;
  29323. }
  29324. } else {
  29325. peg$currPos = s0;
  29326. s0 = peg$FAILED;
  29327. }
  29328. } else {
  29329. peg$currPos = s0;
  29330. s0 = peg$FAILED;
  29331. }
  29332. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29333. return s0;
  29334. }
  29335. function peg$parseunarySend() {
  29336. var s0, s1, s2, s3;
  29337. var key = peg$currPos * 63 + 49,
  29338. cached = peg$resultsCache[key];
  29339. if (cached) {
  29340. peg$currPos = cached.nextPos;
  29341. return cached.result;
  29342. }
  29343. s0 = peg$currPos;
  29344. s1 = peg$parseoperand();
  29345. if (s1 !== peg$FAILED) {
  29346. s2 = [];
  29347. s3 = peg$parsewsUnaryMessage();
  29348. while (s3 !== peg$FAILED) {
  29349. s2.push(s3);
  29350. s3 = peg$parsewsUnaryMessage();
  29351. }
  29352. if (s2 !== peg$FAILED) {
  29353. peg$savedPos = s0;
  29354. s1 = peg$c104(s1, s2);
  29355. s0 = s1;
  29356. } else {
  29357. peg$currPos = s0;
  29358. s0 = peg$FAILED;
  29359. }
  29360. } else {
  29361. peg$currPos = s0;
  29362. s0 = peg$FAILED;
  29363. }
  29364. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29365. return s0;
  29366. }
  29367. function peg$parsewsBinaryMessage() {
  29368. var s0, s1, s2, s3, s4;
  29369. var key = peg$currPos * 63 + 50,
  29370. cached = peg$resultsCache[key];
  29371. if (cached) {
  29372. peg$currPos = cached.nextPos;
  29373. return cached.result;
  29374. }
  29375. s0 = peg$currPos;
  29376. s1 = peg$parsews();
  29377. if (s1 !== peg$FAILED) {
  29378. s2 = peg$parsebinarySelector();
  29379. if (s2 !== peg$FAILED) {
  29380. s3 = peg$parsews();
  29381. if (s3 !== peg$FAILED) {
  29382. s4 = peg$parseunarySend();
  29383. if (s4 !== peg$FAILED) {
  29384. peg$savedPos = s0;
  29385. s1 = peg$c105(s2, s4);
  29386. s0 = s1;
  29387. } else {
  29388. peg$currPos = s0;
  29389. s0 = peg$FAILED;
  29390. }
  29391. } else {
  29392. peg$currPos = s0;
  29393. s0 = peg$FAILED;
  29394. }
  29395. } else {
  29396. peg$currPos = s0;
  29397. s0 = peg$FAILED;
  29398. }
  29399. } else {
  29400. peg$currPos = s0;
  29401. s0 = peg$FAILED;
  29402. }
  29403. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29404. return s0;
  29405. }
  29406. function peg$parsebinarySend() {
  29407. var s0, s1, s2, s3;
  29408. var key = peg$currPos * 63 + 51,
  29409. cached = peg$resultsCache[key];
  29410. if (cached) {
  29411. peg$currPos = cached.nextPos;
  29412. return cached.result;
  29413. }
  29414. s0 = peg$currPos;
  29415. s1 = peg$parseunarySend();
  29416. if (s1 !== peg$FAILED) {
  29417. s2 = [];
  29418. s3 = peg$parsewsBinaryMessage();
  29419. while (s3 !== peg$FAILED) {
  29420. s2.push(s3);
  29421. s3 = peg$parsewsBinaryMessage();
  29422. }
  29423. if (s2 !== peg$FAILED) {
  29424. peg$savedPos = s0;
  29425. s1 = peg$c104(s1, s2);
  29426. s0 = s1;
  29427. } else {
  29428. peg$currPos = s0;
  29429. s0 = peg$FAILED;
  29430. }
  29431. } else {
  29432. peg$currPos = s0;
  29433. s0 = peg$FAILED;
  29434. }
  29435. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29436. return s0;
  29437. }
  29438. function peg$parsewsKeywordMessage() {
  29439. var s0, s1, s2, s3, s4, s5, s6;
  29440. var key = peg$currPos * 63 + 52,
  29441. cached = peg$resultsCache[key];
  29442. if (cached) {
  29443. peg$currPos = cached.nextPos;
  29444. return cached.result;
  29445. }
  29446. s0 = peg$currPos;
  29447. s1 = [];
  29448. s2 = peg$currPos;
  29449. s3 = peg$parsews();
  29450. if (s3 !== peg$FAILED) {
  29451. s4 = peg$parsekeyword();
  29452. if (s4 !== peg$FAILED) {
  29453. s5 = peg$parsews();
  29454. if (s5 !== peg$FAILED) {
  29455. s6 = peg$parsebinarySend();
  29456. if (s6 !== peg$FAILED) {
  29457. peg$savedPos = s2;
  29458. s3 = peg$c75(s4, s6);
  29459. s2 = s3;
  29460. } else {
  29461. peg$currPos = s2;
  29462. s2 = peg$FAILED;
  29463. }
  29464. } else {
  29465. peg$currPos = s2;
  29466. s2 = peg$FAILED;
  29467. }
  29468. } else {
  29469. peg$currPos = s2;
  29470. s2 = peg$FAILED;
  29471. }
  29472. } else {
  29473. peg$currPos = s2;
  29474. s2 = peg$FAILED;
  29475. }
  29476. if (s2 !== peg$FAILED) {
  29477. while (s2 !== peg$FAILED) {
  29478. s1.push(s2);
  29479. s2 = peg$currPos;
  29480. s3 = peg$parsews();
  29481. if (s3 !== peg$FAILED) {
  29482. s4 = peg$parsekeyword();
  29483. if (s4 !== peg$FAILED) {
  29484. s5 = peg$parsews();
  29485. if (s5 !== peg$FAILED) {
  29486. s6 = peg$parsebinarySend();
  29487. if (s6 !== peg$FAILED) {
  29488. peg$savedPos = s2;
  29489. s3 = peg$c75(s4, s6);
  29490. s2 = s3;
  29491. } else {
  29492. peg$currPos = s2;
  29493. s2 = peg$FAILED;
  29494. }
  29495. } else {
  29496. peg$currPos = s2;
  29497. s2 = peg$FAILED;
  29498. }
  29499. } else {
  29500. peg$currPos = s2;
  29501. s2 = peg$FAILED;
  29502. }
  29503. } else {
  29504. peg$currPos = s2;
  29505. s2 = peg$FAILED;
  29506. }
  29507. }
  29508. } else {
  29509. s1 = peg$FAILED;
  29510. }
  29511. if (s1 !== peg$FAILED) {
  29512. peg$savedPos = s0;
  29513. s1 = peg$c106(s1);
  29514. }
  29515. s0 = s1;
  29516. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29517. return s0;
  29518. }
  29519. function peg$parsekeywordSend() {
  29520. var s0, s1, s2;
  29521. var key = peg$currPos * 63 + 53,
  29522. cached = peg$resultsCache[key];
  29523. if (cached) {
  29524. peg$currPos = cached.nextPos;
  29525. return cached.result;
  29526. }
  29527. s0 = peg$currPos;
  29528. s1 = peg$parsebinarySend();
  29529. if (s1 !== peg$FAILED) {
  29530. s2 = peg$parsewsKeywordMessage();
  29531. if (s2 === peg$FAILED) {
  29532. s2 = null;
  29533. }
  29534. if (s2 !== peg$FAILED) {
  29535. peg$savedPos = s0;
  29536. s1 = peg$c107(s1, s2);
  29537. s0 = s1;
  29538. } else {
  29539. peg$currPos = s0;
  29540. s0 = peg$FAILED;
  29541. }
  29542. } else {
  29543. peg$currPos = s0;
  29544. s0 = peg$FAILED;
  29545. }
  29546. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29547. return s0;
  29548. }
  29549. function peg$parsewsMessage() {
  29550. var s0;
  29551. var key = peg$currPos * 63 + 54,
  29552. cached = peg$resultsCache[key];
  29553. if (cached) {
  29554. peg$currPos = cached.nextPos;
  29555. return cached.result;
  29556. }
  29557. s0 = peg$parsewsBinaryMessage();
  29558. if (s0 === peg$FAILED) {
  29559. s0 = peg$parsewsUnaryMessage();
  29560. if (s0 === peg$FAILED) {
  29561. s0 = peg$parsewsKeywordMessage();
  29562. }
  29563. }
  29564. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29565. return s0;
  29566. }
  29567. function peg$parsecascade() {
  29568. var s0, s1, s2, s3, s4, s5, s6, s7;
  29569. var key = peg$currPos * 63 + 55,
  29570. cached = peg$resultsCache[key];
  29571. if (cached) {
  29572. peg$currPos = cached.nextPos;
  29573. return cached.result;
  29574. }
  29575. s0 = peg$currPos;
  29576. s1 = peg$parsekeywordSend();
  29577. if (s1 !== peg$FAILED) {
  29578. peg$savedPos = peg$currPos;
  29579. s2 = peg$c108(s1);
  29580. if (s2) {
  29581. s2 = void 0;
  29582. } else {
  29583. s2 = peg$FAILED;
  29584. }
  29585. if (s2 !== peg$FAILED) {
  29586. s3 = [];
  29587. s4 = peg$currPos;
  29588. s5 = peg$parsews();
  29589. if (s5 !== peg$FAILED) {
  29590. if (input.charCodeAt(peg$currPos) === 59) {
  29591. s6 = peg$c109;
  29592. peg$currPos++;
  29593. } else {
  29594. s6 = peg$FAILED;
  29595. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29596. }
  29597. if (s6 !== peg$FAILED) {
  29598. s7 = peg$parsewsMessage();
  29599. if (s7 !== peg$FAILED) {
  29600. peg$savedPos = s4;
  29601. s5 = peg$c111(s1, s7);
  29602. s4 = s5;
  29603. } else {
  29604. peg$currPos = s4;
  29605. s4 = peg$FAILED;
  29606. }
  29607. } else {
  29608. peg$currPos = s4;
  29609. s4 = peg$FAILED;
  29610. }
  29611. } else {
  29612. peg$currPos = s4;
  29613. s4 = peg$FAILED;
  29614. }
  29615. if (s4 !== peg$FAILED) {
  29616. while (s4 !== peg$FAILED) {
  29617. s3.push(s4);
  29618. s4 = peg$currPos;
  29619. s5 = peg$parsews();
  29620. if (s5 !== peg$FAILED) {
  29621. if (input.charCodeAt(peg$currPos) === 59) {
  29622. s6 = peg$c109;
  29623. peg$currPos++;
  29624. } else {
  29625. s6 = peg$FAILED;
  29626. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29627. }
  29628. if (s6 !== peg$FAILED) {
  29629. s7 = peg$parsewsMessage();
  29630. if (s7 !== peg$FAILED) {
  29631. peg$savedPos = s4;
  29632. s5 = peg$c111(s1, s7);
  29633. s4 = s5;
  29634. } else {
  29635. peg$currPos = s4;
  29636. s4 = peg$FAILED;
  29637. }
  29638. } else {
  29639. peg$currPos = s4;
  29640. s4 = peg$FAILED;
  29641. }
  29642. } else {
  29643. peg$currPos = s4;
  29644. s4 = peg$FAILED;
  29645. }
  29646. }
  29647. } else {
  29648. s3 = peg$FAILED;
  29649. }
  29650. if (s3 !== peg$FAILED) {
  29651. peg$savedPos = s0;
  29652. s1 = peg$c112(s1, s3);
  29653. s0 = s1;
  29654. } else {
  29655. peg$currPos = s0;
  29656. s0 = peg$FAILED;
  29657. }
  29658. } else {
  29659. peg$currPos = s0;
  29660. s0 = peg$FAILED;
  29661. }
  29662. } else {
  29663. peg$currPos = s0;
  29664. s0 = peg$FAILED;
  29665. }
  29666. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29667. return s0;
  29668. }
  29669. function peg$parsejsStatement() {
  29670. var s0;
  29671. var key = peg$currPos * 63 + 56,
  29672. cached = peg$resultsCache[key];
  29673. if (cached) {
  29674. peg$currPos = cached.nextPos;
  29675. return cached.result;
  29676. }
  29677. s0 = peg$parsepragmaJsStatement();
  29678. if (s0 === peg$FAILED) {
  29679. s0 = peg$parselegacyJsStatement();
  29680. }
  29681. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29682. return s0;
  29683. }
  29684. function peg$parselegacyJsStatement() {
  29685. var s0, s1, s2, s3, s4;
  29686. var key = peg$currPos * 63 + 57,
  29687. cached = peg$resultsCache[key];
  29688. if (cached) {
  29689. peg$currPos = cached.nextPos;
  29690. return cached.result;
  29691. }
  29692. s0 = peg$currPos;
  29693. if (input.charCodeAt(peg$currPos) === 60) {
  29694. s1 = peg$c113;
  29695. peg$currPos++;
  29696. } else {
  29697. s1 = peg$FAILED;
  29698. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29699. }
  29700. if (s1 !== peg$FAILED) {
  29701. s2 = [];
  29702. s3 = peg$currPos;
  29703. if (input.substr(peg$currPos, 2) === peg$c115) {
  29704. s4 = peg$c115;
  29705. peg$currPos += 2;
  29706. } else {
  29707. s4 = peg$FAILED;
  29708. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29709. }
  29710. if (s4 !== peg$FAILED) {
  29711. peg$savedPos = s3;
  29712. s4 = peg$c117();
  29713. }
  29714. s3 = s4;
  29715. if (s3 === peg$FAILED) {
  29716. if (peg$c118.test(input.charAt(peg$currPos))) {
  29717. s3 = input.charAt(peg$currPos);
  29718. peg$currPos++;
  29719. } else {
  29720. s3 = peg$FAILED;
  29721. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29722. }
  29723. }
  29724. while (s3 !== peg$FAILED) {
  29725. s2.push(s3);
  29726. s3 = peg$currPos;
  29727. if (input.substr(peg$currPos, 2) === peg$c115) {
  29728. s4 = peg$c115;
  29729. peg$currPos += 2;
  29730. } else {
  29731. s4 = peg$FAILED;
  29732. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29733. }
  29734. if (s4 !== peg$FAILED) {
  29735. peg$savedPos = s3;
  29736. s4 = peg$c117();
  29737. }
  29738. s3 = s4;
  29739. if (s3 === peg$FAILED) {
  29740. if (peg$c118.test(input.charAt(peg$currPos))) {
  29741. s3 = input.charAt(peg$currPos);
  29742. peg$currPos++;
  29743. } else {
  29744. s3 = peg$FAILED;
  29745. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29746. }
  29747. }
  29748. }
  29749. if (s2 !== peg$FAILED) {
  29750. if (input.charCodeAt(peg$currPos) === 62) {
  29751. s3 = peg$c120;
  29752. peg$currPos++;
  29753. } else {
  29754. s3 = peg$FAILED;
  29755. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29756. }
  29757. if (s3 !== peg$FAILED) {
  29758. peg$savedPos = peg$currPos;
  29759. s4 = peg$c122(s2);
  29760. if (s4) {
  29761. s4 = void 0;
  29762. } else {
  29763. s4 = peg$FAILED;
  29764. }
  29765. if (s4 !== peg$FAILED) {
  29766. peg$savedPos = s0;
  29767. s1 = peg$c123(s2);
  29768. s0 = s1;
  29769. } else {
  29770. peg$currPos = s0;
  29771. s0 = peg$FAILED;
  29772. }
  29773. } else {
  29774. peg$currPos = s0;
  29775. s0 = peg$FAILED;
  29776. }
  29777. } else {
  29778. peg$currPos = s0;
  29779. s0 = peg$FAILED;
  29780. }
  29781. } else {
  29782. peg$currPos = s0;
  29783. s0 = peg$FAILED;
  29784. }
  29785. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29786. return s0;
  29787. }
  29788. function peg$parsepragmaJsStatement() {
  29789. var s0, s1, s2, s3, s4, s5, s6, s7;
  29790. var key = peg$currPos * 63 + 58,
  29791. cached = peg$resultsCache[key];
  29792. if (cached) {
  29793. peg$currPos = cached.nextPos;
  29794. return cached.result;
  29795. }
  29796. s0 = peg$currPos;
  29797. if (input.charCodeAt(peg$currPos) === 60) {
  29798. s1 = peg$c113;
  29799. peg$currPos++;
  29800. } else {
  29801. s1 = peg$FAILED;
  29802. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29803. }
  29804. if (s1 !== peg$FAILED) {
  29805. s2 = peg$parsews();
  29806. if (s2 !== peg$FAILED) {
  29807. if (input.substr(peg$currPos, 9) === peg$c124) {
  29808. s3 = peg$c124;
  29809. peg$currPos += 9;
  29810. } else {
  29811. s3 = peg$FAILED;
  29812. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  29813. }
  29814. if (s3 !== peg$FAILED) {
  29815. s4 = peg$parsews();
  29816. if (s4 !== peg$FAILED) {
  29817. s5 = peg$parserawString();
  29818. if (s5 !== peg$FAILED) {
  29819. s6 = peg$parsews();
  29820. if (s6 !== peg$FAILED) {
  29821. if (input.charCodeAt(peg$currPos) === 62) {
  29822. s7 = peg$c120;
  29823. peg$currPos++;
  29824. } else {
  29825. s7 = peg$FAILED;
  29826. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29827. }
  29828. if (s7 !== peg$FAILED) {
  29829. peg$savedPos = s0;
  29830. s1 = peg$c126(s5);
  29831. s0 = s1;
  29832. } else {
  29833. peg$currPos = s0;
  29834. s0 = peg$FAILED;
  29835. }
  29836. } else {
  29837. peg$currPos = s0;
  29838. s0 = peg$FAILED;
  29839. }
  29840. } else {
  29841. peg$currPos = s0;
  29842. s0 = peg$FAILED;
  29843. }
  29844. } else {
  29845. peg$currPos = s0;
  29846. s0 = peg$FAILED;
  29847. }
  29848. } else {
  29849. peg$currPos = s0;
  29850. s0 = peg$FAILED;
  29851. }
  29852. } else {
  29853. peg$currPos = s0;
  29854. s0 = peg$FAILED;
  29855. }
  29856. } else {
  29857. peg$currPos = s0;
  29858. s0 = peg$FAILED;
  29859. }
  29860. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29861. return s0;
  29862. }
  29863. function peg$parsemethod() {
  29864. var s0, s1, s2;
  29865. var key = peg$currPos * 63 + 59,
  29866. cached = peg$resultsCache[key];
  29867. if (cached) {
  29868. peg$currPos = cached.nextPos;
  29869. return cached.result;
  29870. }
  29871. s0 = peg$currPos;
  29872. s1 = peg$parsewsKeywordPattern();
  29873. if (s1 === peg$FAILED) {
  29874. s1 = peg$parsewsBinaryPattern();
  29875. if (s1 === peg$FAILED) {
  29876. s1 = peg$parsewsUnaryPattern();
  29877. }
  29878. }
  29879. if (s1 !== peg$FAILED) {
  29880. s2 = peg$parsewsSequenceWs();
  29881. if (s2 !== peg$FAILED) {
  29882. peg$savedPos = s0;
  29883. s1 = peg$c127(s1, s2);
  29884. s0 = s1;
  29885. } else {
  29886. peg$currPos = s0;
  29887. s0 = peg$FAILED;
  29888. }
  29889. } else {
  29890. peg$currPos = s0;
  29891. s0 = peg$FAILED;
  29892. }
  29893. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29894. return s0;
  29895. }
  29896. function peg$parseassociationSend() {
  29897. var s0, s1, s2;
  29898. var key = peg$currPos * 63 + 60,
  29899. cached = peg$resultsCache[key];
  29900. if (cached) {
  29901. peg$currPos = cached.nextPos;
  29902. return cached.result;
  29903. }
  29904. s0 = peg$currPos;
  29905. s1 = peg$parsebinarySend();
  29906. if (s1 !== peg$FAILED) {
  29907. peg$savedPos = peg$currPos;
  29908. s2 = peg$c128(s1);
  29909. if (s2) {
  29910. s2 = void 0;
  29911. } else {
  29912. s2 = peg$FAILED;
  29913. }
  29914. if (s2 !== peg$FAILED) {
  29915. peg$savedPos = s0;
  29916. s1 = peg$c129(s1);
  29917. s0 = s1;
  29918. } else {
  29919. peg$currPos = s0;
  29920. s0 = peg$FAILED;
  29921. }
  29922. } else {
  29923. peg$currPos = s0;
  29924. s0 = peg$FAILED;
  29925. }
  29926. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29927. return s0;
  29928. }
  29929. function peg$parsewsAssociationsRest() {
  29930. var s0, s1, s2;
  29931. var key = peg$currPos * 63 + 61,
  29932. cached = peg$resultsCache[key];
  29933. if (cached) {
  29934. peg$currPos = cached.nextPos;
  29935. return cached.result;
  29936. }
  29937. s0 = peg$currPos;
  29938. s1 = peg$parsesomeDotsWs();
  29939. if (s1 !== peg$FAILED) {
  29940. s2 = peg$parseassociationSend();
  29941. if (s2 !== peg$FAILED) {
  29942. peg$savedPos = s0;
  29943. s1 = peg$c79(s2);
  29944. s0 = s1;
  29945. } else {
  29946. peg$currPos = s0;
  29947. s0 = peg$FAILED;
  29948. }
  29949. } else {
  29950. peg$currPos = s0;
  29951. s0 = peg$FAILED;
  29952. }
  29953. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29954. return s0;
  29955. }
  29956. function peg$parsewsAssociations() {
  29957. var s0, s1, s2, s3, s4;
  29958. var key = peg$currPos * 63 + 62,
  29959. cached = peg$resultsCache[key];
  29960. if (cached) {
  29961. peg$currPos = cached.nextPos;
  29962. return cached.result;
  29963. }
  29964. s0 = peg$currPos;
  29965. s1 = peg$parsemaybeDotsWs();
  29966. if (s1 !== peg$FAILED) {
  29967. s2 = peg$parseassociationSend();
  29968. if (s2 !== peg$FAILED) {
  29969. s3 = [];
  29970. s4 = peg$parsewsAssociationsRest();
  29971. while (s4 !== peg$FAILED) {
  29972. s3.push(s4);
  29973. s4 = peg$parsewsAssociationsRest();
  29974. }
  29975. if (s3 !== peg$FAILED) {
  29976. peg$savedPos = s0;
  29977. s1 = peg$c130(s2, s3);
  29978. s0 = s1;
  29979. } else {
  29980. peg$currPos = s0;
  29981. s0 = peg$FAILED;
  29982. }
  29983. } else {
  29984. peg$currPos = s0;
  29985. s0 = peg$FAILED;
  29986. }
  29987. } else {
  29988. peg$currPos = s0;
  29989. s0 = peg$FAILED;
  29990. }
  29991. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29992. return s0;
  29993. }
  29994. peg$result = peg$startRuleFunction();
  29995. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  29996. return peg$result;
  29997. } else {
  29998. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  29999. peg$fail({ type: "end", description: "end of input" });
  30000. }
  30001. throw peg$buildException(
  30002. null,
  30003. peg$maxFailExpected,
  30004. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30005. peg$maxFailPos < input.length
  30006. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30007. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30008. );
  30009. }
  30010. }
  30011. return {
  30012. SyntaxError: peg$SyntaxError,
  30013. parse: peg$parse
  30014. };
  30015. })();
  30016. });
  30017. 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";
  30018. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30019. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30020. $core.addPackage("Platform-ImportExport");
  30021. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30022. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30023. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30024. $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.";
  30025. $core.addMethod(
  30026. $core.method({
  30027. selector: "exportPackage:on:",
  30028. protocol: "output",
  30029. fn: function (aPackage,aStream){
  30030. var self=this,$self=this;
  30031. return $core.withContext(function($ctx1) {
  30032. $self._subclassResponsibility();
  30033. return self;
  30034. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30035. },
  30036. args: ["aPackage", "aStream"],
  30037. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30038. referencedClasses: [],
  30039. messageSends: ["subclassResponsibility"]
  30040. }),
  30041. $globals.AbstractExporter);
  30042. $core.addMethod(
  30043. $core.method({
  30044. selector: "extensionMethodsOfPackage:",
  30045. protocol: "accessing",
  30046. fn: function (aPackage){
  30047. var self=this,$self=this;
  30048. var result;
  30049. return $core.withContext(function($ctx1) {
  30050. result=$recv($globals.OrderedCollection)._new();
  30051. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30052. return $core.withContext(function($ctx2) {
  30053. return $recv(result)._addAll_($recv(each)._ownMethods());
  30054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30055. }));
  30056. return result;
  30057. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30058. },
  30059. args: ["aPackage"],
  30060. 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",
  30061. referencedClasses: ["OrderedCollection"],
  30062. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30063. }),
  30064. $globals.AbstractExporter);
  30065. $core.addMethod(
  30066. $core.method({
  30067. selector: "extensionProtocolsOfPackage:",
  30068. protocol: "accessing",
  30069. fn: function (aPackage){
  30070. var self=this,$self=this;
  30071. var extensionName,result;
  30072. return $core.withContext(function($ctx1) {
  30073. var $1,$2,$3;
  30074. $1=$recv(aPackage)._name();
  30075. $ctx1.sendIdx["name"]=1;
  30076. extensionName="*".__comma($1);
  30077. result=$recv($globals.OrderedCollection)._new();
  30078. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30079. return $core.withContext(function($ctx2) {
  30080. $2=$recv(a)._name();
  30081. $ctx2.sendIdx["name"]=2;
  30082. return $recv($2).__lt($recv(b)._name());
  30083. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30084. })))._do_((function(each){
  30085. return $core.withContext(function($ctx2) {
  30086. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30087. return $core.withContext(function($ctx3) {
  30088. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30089. if($core.assert($3)){
  30090. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30091. }
  30092. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30093. }));
  30094. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30095. }));
  30096. $ctx1.sendIdx["do:"]=1;
  30097. return result;
  30098. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30099. },
  30100. args: ["aPackage"],
  30101. 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",
  30102. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30103. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30104. }),
  30105. $globals.AbstractExporter);
  30106. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30107. $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.";
  30108. $core.addMethod(
  30109. $core.method({
  30110. selector: "chunkEscape:",
  30111. protocol: "convenience",
  30112. fn: function (aString){
  30113. var self=this,$self=this;
  30114. return $core.withContext(function($ctx1) {
  30115. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30116. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30117. },
  30118. args: ["aString"],
  30119. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30120. referencedClasses: [],
  30121. messageSends: ["trimBoth", "replace:with:"]
  30122. }),
  30123. $globals.ChunkExporter);
  30124. $core.addMethod(
  30125. $core.method({
  30126. selector: "exportBehavior:on:",
  30127. protocol: "output",
  30128. fn: function (aBehavior,aStream){
  30129. var self=this,$self=this;
  30130. return $core.withContext(function($ctx1) {
  30131. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30132. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30133. return self;
  30134. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30135. },
  30136. args: ["aBehavior", "aStream"],
  30137. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30138. referencedClasses: [],
  30139. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30140. }),
  30141. $globals.ChunkExporter);
  30142. $core.addMethod(
  30143. $core.method({
  30144. selector: "exportCategoryEpilogueOf:on:",
  30145. protocol: "output",
  30146. fn: function (aCategory,aStream){
  30147. var self=this,$self=this;
  30148. return $core.withContext(function($ctx1) {
  30149. $recv(aStream)._write_(" !");
  30150. $recv(aStream)._lf();
  30151. $ctx1.sendIdx["lf"]=1;
  30152. $recv(aStream)._lf();
  30153. return self;
  30154. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30155. },
  30156. args: ["aCategory", "aStream"],
  30157. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30158. referencedClasses: [],
  30159. messageSends: ["write:", "lf"]
  30160. }),
  30161. $globals.ChunkExporter);
  30162. $core.addMethod(
  30163. $core.method({
  30164. selector: "exportCategoryPrologueOf:on:",
  30165. protocol: "output",
  30166. fn: function (aCategory,aStream){
  30167. var self=this,$self=this;
  30168. return $core.withContext(function($ctx1) {
  30169. $recv(aStream)._write_("!");
  30170. $ctx1.sendIdx["write:"]=1;
  30171. $recv(aStream)._print_($recv(aCategory)._theClass());
  30172. $ctx1.sendIdx["print:"]=1;
  30173. $recv(aStream)._write_(" methodsFor: ");
  30174. $ctx1.sendIdx["write:"]=2;
  30175. $recv(aStream)._print_(aCategory);
  30176. $recv(aStream)._write_("!");
  30177. return self;
  30178. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30179. },
  30180. args: ["aCategory", "aStream"],
  30181. 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: '!'",
  30182. referencedClasses: [],
  30183. messageSends: ["write:", "print:", "theClass"]
  30184. }),
  30185. $globals.ChunkExporter);
  30186. $core.addMethod(
  30187. $core.method({
  30188. selector: "exportDefinitionOf:on:",
  30189. protocol: "output",
  30190. fn: function (aClass,aStream){
  30191. var self=this,$self=this;
  30192. return $core.withContext(function($ctx1) {
  30193. var $1,$2,$3,$4;
  30194. $recv(aStream)._print_($recv(aClass)._superclass());
  30195. $ctx1.sendIdx["print:"]=1;
  30196. $recv(aStream)._write_(" subclass: ");
  30197. $ctx1.sendIdx["write:"]=1;
  30198. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30199. $1=$recv(aStream)._lf();
  30200. $ctx1.sendIdx["lf"]=1;
  30201. $recv(aStream)._tab();
  30202. $ctx1.sendIdx["tab"]=1;
  30203. $recv(aStream)._write_("instanceVariableNames: ");
  30204. $ctx1.sendIdx["write:"]=2;
  30205. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30206. $ctx1.sendIdx["print:"]=2;
  30207. $recv(aStream)._lf();
  30208. $ctx1.sendIdx["lf"]=2;
  30209. $recv(aStream)._tab();
  30210. $recv(aStream)._write_("package: ");
  30211. $ctx1.sendIdx["write:"]=3;
  30212. $recv(aStream)._print_($recv(aClass)._category());
  30213. $ctx1.sendIdx["print:"]=3;
  30214. $recv(aStream)._write_("!");
  30215. $ctx1.sendIdx["write:"]=4;
  30216. $2=$recv(aStream)._lf();
  30217. $ctx1.sendIdx["lf"]=3;
  30218. $3=$recv(aClass)._comment();
  30219. $ctx1.sendIdx["comment"]=1;
  30220. $recv($3)._ifNotEmpty_((function(){
  30221. return $core.withContext(function($ctx2) {
  30222. $recv(aStream)._write_("!");
  30223. $ctx2.sendIdx["write:"]=5;
  30224. $recv(aStream)._print_(aClass);
  30225. $recv(aStream)._write_(" commentStamp!");
  30226. $ctx2.sendIdx["write:"]=6;
  30227. $recv(aStream)._lf();
  30228. $ctx2.sendIdx["lf"]=4;
  30229. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30230. $4=$recv(aStream)._lf();
  30231. $ctx2.sendIdx["lf"]=5;
  30232. return $4;
  30233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30234. }));
  30235. $recv(aStream)._lf();
  30236. return self;
  30237. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30238. },
  30239. args: ["aClass", "aStream"],
  30240. 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",
  30241. referencedClasses: [],
  30242. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30243. }),
  30244. $globals.ChunkExporter);
  30245. $core.addMethod(
  30246. $core.method({
  30247. selector: "exportMetaDefinitionOf:on:",
  30248. protocol: "output",
  30249. fn: function (aClass,aStream){
  30250. var self=this,$self=this;
  30251. var classIvars,classTraitComposition;
  30252. return $core.withContext(function($ctx1) {
  30253. var $1,$2;
  30254. $1=$recv(aClass)._class();
  30255. $ctx1.sendIdx["class"]=1;
  30256. classIvars=$recv($1)._instanceVariableNames();
  30257. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30258. $2=$recv(classIvars)._notEmpty();
  30259. if($core.assert($2)){
  30260. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30261. $ctx1.sendIdx["print:"]=1;
  30262. $recv(aStream)._space();
  30263. $recv(aStream)._write_("instanceVariableNames: ");
  30264. $ctx1.sendIdx["write:"]=1;
  30265. $recv(aStream)._print_(" "._join_(classIvars));
  30266. $recv(aStream)._write_("!");
  30267. $recv(aStream)._lf();
  30268. $ctx1.sendIdx["lf"]=1;
  30269. $recv(aStream)._lf();
  30270. }
  30271. return self;
  30272. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30273. },
  30274. args: ["aClass", "aStream"],
  30275. 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 ]",
  30276. referencedClasses: [],
  30277. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30278. }),
  30279. $globals.ChunkExporter);
  30280. $core.addMethod(
  30281. $core.method({
  30282. selector: "exportMethod:on:",
  30283. protocol: "output",
  30284. fn: function (aMethod,aStream){
  30285. var self=this,$self=this;
  30286. return $core.withContext(function($ctx1) {
  30287. $recv(aStream)._lf();
  30288. $ctx1.sendIdx["lf"]=1;
  30289. $recv(aStream)._lf();
  30290. $ctx1.sendIdx["lf"]=2;
  30291. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30292. $ctx1.sendIdx["write:"]=1;
  30293. $recv(aStream)._lf();
  30294. $recv(aStream)._write_("!");
  30295. return self;
  30296. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30297. },
  30298. args: ["aMethod", "aStream"],
  30299. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30300. referencedClasses: [],
  30301. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30302. }),
  30303. $globals.ChunkExporter);
  30304. $core.addMethod(
  30305. $core.method({
  30306. selector: "exportPackage:on:",
  30307. protocol: "output",
  30308. fn: function (aPackage,aStream){
  30309. var self=this,$self=this;
  30310. return $core.withContext(function($ctx1) {
  30311. var $1,$receiver;
  30312. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30313. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30314. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30315. return $core.withContext(function($ctx2) {
  30316. $self._exportBehavior_on_(each,aStream);
  30317. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30318. $1=$recv(each)._theMetaClass();
  30319. if(($receiver = $1) == null || $receiver.a$nil){
  30320. return $1;
  30321. } else {
  30322. var meta;
  30323. meta=$receiver;
  30324. return $self._exportBehavior_on_(meta,aStream);
  30325. }
  30326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30327. }));
  30328. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30329. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30330. return self;
  30331. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30332. },
  30333. args: ["aPackage", "aStream"],
  30334. 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",
  30335. referencedClasses: [],
  30336. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30337. }),
  30338. $globals.ChunkExporter);
  30339. $core.addMethod(
  30340. $core.method({
  30341. selector: "exportPackageDefinitionOf:on:",
  30342. protocol: "output",
  30343. fn: function (aPackage,aStream){
  30344. var self=this,$self=this;
  30345. return $core.withContext(function($ctx1) {
  30346. $recv(aStream)._write_("Smalltalk createPackage: ");
  30347. $ctx1.sendIdx["write:"]=1;
  30348. $recv(aStream)._print_($recv(aPackage)._name());
  30349. $recv(aStream)._write_("!");
  30350. $recv(aStream)._lf();
  30351. return self;
  30352. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30353. },
  30354. args: ["aPackage", "aStream"],
  30355. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30356. referencedClasses: [],
  30357. messageSends: ["write:", "print:", "name", "lf"]
  30358. }),
  30359. $globals.ChunkExporter);
  30360. $core.addMethod(
  30361. $core.method({
  30362. selector: "exportPackageImportsOf:on:",
  30363. protocol: "output",
  30364. fn: function (aPackage,aStream){
  30365. var self=this,$self=this;
  30366. return $core.withContext(function($ctx1) {
  30367. var $1;
  30368. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30369. return $core.withContext(function($ctx2) {
  30370. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30371. $ctx2.sendIdx["write:"]=1;
  30372. $1=$recv(aPackage)._name();
  30373. $ctx2.sendIdx["name"]=1;
  30374. $recv(aStream)._print_($1);
  30375. $ctx2.sendIdx["print:"]=1;
  30376. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30377. $ctx2.sendIdx["write:"]=2;
  30378. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30379. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30380. return $recv(aStream)._lf();
  30381. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30382. }));
  30383. return self;
  30384. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30385. },
  30386. args: ["aPackage", "aStream"],
  30387. 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 ]",
  30388. referencedClasses: [],
  30389. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30390. }),
  30391. $globals.ChunkExporter);
  30392. $core.addMethod(
  30393. $core.method({
  30394. selector: "exportPackageTraitCompositionsOf:on:",
  30395. protocol: "output",
  30396. fn: function (aPackage,aStream){
  30397. var self=this,$self=this;
  30398. return $core.withContext(function($ctx1) {
  30399. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30400. return $core.withContext(function($ctx2) {
  30401. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30402. return $core.withContext(function($ctx3) {
  30403. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30404. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30405. }));
  30406. $recv(aStream)._write_("! !");
  30407. $recv(aStream)._lf();
  30408. $ctx2.sendIdx["lf"]=1;
  30409. return $recv(aStream)._lf();
  30410. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30411. }));
  30412. return self;
  30413. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30414. },
  30415. args: ["aPackage", "aStream"],
  30416. 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 ]",
  30417. referencedClasses: [],
  30418. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30419. }),
  30420. $globals.ChunkExporter);
  30421. $core.addMethod(
  30422. $core.method({
  30423. selector: "exportProtocol:on:",
  30424. protocol: "output",
  30425. fn: function (aProtocol,aStream){
  30426. var self=this,$self=this;
  30427. return $core.withContext(function($ctx1) {
  30428. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30429. return $core.withContext(function($ctx2) {
  30430. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30431. $recv(methods)._do_((function(method){
  30432. return $core.withContext(function($ctx3) {
  30433. return $self._exportMethod_on_(method,aStream);
  30434. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30435. }));
  30436. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30437. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30438. }));
  30439. return self;
  30440. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30441. },
  30442. args: ["aProtocol", "aStream"],
  30443. 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 ]",
  30444. referencedClasses: [],
  30445. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30446. }),
  30447. $globals.ChunkExporter);
  30448. $core.addMethod(
  30449. $core.method({
  30450. selector: "exportProtocolEpilogueOf:on:",
  30451. protocol: "output",
  30452. fn: function (aProtocol,aStream){
  30453. var self=this,$self=this;
  30454. return $core.withContext(function($ctx1) {
  30455. $recv(aStream)._write_(" !");
  30456. $recv(aStream)._lf();
  30457. $ctx1.sendIdx["lf"]=1;
  30458. $recv(aStream)._lf();
  30459. return self;
  30460. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30461. },
  30462. args: ["aProtocol", "aStream"],
  30463. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30464. referencedClasses: [],
  30465. messageSends: ["write:", "lf"]
  30466. }),
  30467. $globals.ChunkExporter);
  30468. $core.addMethod(
  30469. $core.method({
  30470. selector: "exportProtocolPrologueOf:on:",
  30471. protocol: "output",
  30472. fn: function (aProtocol,aStream){
  30473. var self=this,$self=this;
  30474. return $core.withContext(function($ctx1) {
  30475. $recv(aStream)._write_("!");
  30476. $ctx1.sendIdx["write:"]=1;
  30477. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30478. $ctx1.sendIdx["print:"]=1;
  30479. $recv(aStream)._write_(" methodsFor: ");
  30480. $ctx1.sendIdx["write:"]=2;
  30481. $recv(aStream)._print_($recv(aProtocol)._name());
  30482. $recv(aStream)._write_("!");
  30483. return self;
  30484. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30485. },
  30486. args: ["aProtocol", "aStream"],
  30487. 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: '!'",
  30488. referencedClasses: [],
  30489. messageSends: ["write:", "print:", "theClass", "name"]
  30490. }),
  30491. $globals.ChunkExporter);
  30492. $core.addMethod(
  30493. $core.method({
  30494. selector: "exportProtocols:on:",
  30495. protocol: "output",
  30496. fn: function (aCollection,aStream){
  30497. var self=this,$self=this;
  30498. return $core.withContext(function($ctx1) {
  30499. $recv(aCollection)._do_((function(each){
  30500. return $core.withContext(function($ctx2) {
  30501. return $self._exportProtocol_on_(each,aStream);
  30502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30503. }));
  30504. return self;
  30505. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30506. },
  30507. args: ["aCollection", "aStream"],
  30508. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30509. referencedClasses: [],
  30510. messageSends: ["do:", "exportProtocol:on:"]
  30511. }),
  30512. $globals.ChunkExporter);
  30513. $core.addMethod(
  30514. $core.method({
  30515. selector: "exportTraitComposition:of:on:",
  30516. protocol: "output",
  30517. fn: function (aTraitComposition,aBehavior,aStream){
  30518. var self=this,$self=this;
  30519. return $core.withContext(function($ctx1) {
  30520. $recv(aStream)._print_(aBehavior);
  30521. $recv(aStream)._write_(" setTraitComposition: ");
  30522. $ctx1.sendIdx["write:"]=1;
  30523. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30524. $ctx1.sendIdx["write:"]=2;
  30525. $recv(aStream)._write_(" asTraitComposition!");
  30526. $recv(aStream)._lf();
  30527. return self;
  30528. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30529. },
  30530. args: ["aTraitComposition", "aBehavior", "aStream"],
  30531. 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",
  30532. referencedClasses: [],
  30533. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30534. }),
  30535. $globals.ChunkExporter);
  30536. $core.addMethod(
  30537. $core.method({
  30538. selector: "exportTraitDefinitionOf:on:",
  30539. protocol: "output",
  30540. fn: function (aClass,aStream){
  30541. var self=this,$self=this;
  30542. return $core.withContext(function($ctx1) {
  30543. var $1,$2,$3,$4;
  30544. $recv(aStream)._write_("Trait named: ");
  30545. $ctx1.sendIdx["write:"]=1;
  30546. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30547. $1=$recv(aStream)._lf();
  30548. $ctx1.sendIdx["lf"]=1;
  30549. $recv(aStream)._tab();
  30550. $recv(aStream)._write_("package: ");
  30551. $ctx1.sendIdx["write:"]=2;
  30552. $recv(aStream)._print_($recv(aClass)._category());
  30553. $ctx1.sendIdx["print:"]=1;
  30554. $recv(aStream)._write_("!");
  30555. $ctx1.sendIdx["write:"]=3;
  30556. $2=$recv(aStream)._lf();
  30557. $ctx1.sendIdx["lf"]=2;
  30558. $3=$recv(aClass)._comment();
  30559. $ctx1.sendIdx["comment"]=1;
  30560. $recv($3)._ifNotEmpty_((function(){
  30561. return $core.withContext(function($ctx2) {
  30562. $recv(aStream)._write_("!");
  30563. $ctx2.sendIdx["write:"]=4;
  30564. $recv(aStream)._print_(aClass);
  30565. $recv(aStream)._write_(" commentStamp!");
  30566. $ctx2.sendIdx["write:"]=5;
  30567. $recv(aStream)._lf();
  30568. $ctx2.sendIdx["lf"]=3;
  30569. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30570. $4=$recv(aStream)._lf();
  30571. $ctx2.sendIdx["lf"]=4;
  30572. return $4;
  30573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30574. }));
  30575. $recv(aStream)._lf();
  30576. return self;
  30577. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30578. },
  30579. args: ["aClass", "aStream"],
  30580. 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",
  30581. referencedClasses: [],
  30582. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30583. }),
  30584. $globals.ChunkExporter);
  30585. $core.addMethod(
  30586. $core.method({
  30587. selector: "extensionCategoriesOfPackage:",
  30588. protocol: "accessing",
  30589. fn: function (aPackage){
  30590. var self=this,$self=this;
  30591. var name,map,result;
  30592. return $core.withContext(function($ctx1) {
  30593. var $1;
  30594. name=$recv(aPackage)._name();
  30595. result=$recv($globals.OrderedCollection)._new();
  30596. $ctx1.sendIdx["new"]=1;
  30597. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30598. return $core.withContext(function($ctx2) {
  30599. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30600. return $core.withContext(function($ctx3) {
  30601. map=$recv($globals.Dictionary)._new();
  30602. map;
  30603. $recv(aClass)._protocolsDo_((function(category,methods){
  30604. return $core.withContext(function($ctx4) {
  30605. $1=$recv(category).__eq("*".__comma(name));
  30606. if($core.assert($1)){
  30607. return $recv(map)._at_put_(category,methods);
  30608. }
  30609. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30610. }));
  30611. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30612. return $core.withContext(function($ctx4) {
  30613. return $recv(a).__lt_eq(b);
  30614. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30615. })))._collect_((function(category){
  30616. return $core.withContext(function($ctx4) {
  30617. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30618. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30619. })));
  30620. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30621. }));
  30622. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30623. }));
  30624. $ctx1.sendIdx["do:"]=1;
  30625. return result;
  30626. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30627. },
  30628. args: ["aPackage"],
  30629. 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",
  30630. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30631. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30632. }),
  30633. $globals.ChunkExporter);
  30634. $core.addMethod(
  30635. $core.method({
  30636. selector: "ownCategoriesOfClass:",
  30637. protocol: "accessing",
  30638. fn: function (aClass){
  30639. var self=this,$self=this;
  30640. var map;
  30641. return $core.withContext(function($ctx1) {
  30642. var $1;
  30643. map=$recv($globals.Dictionary)._new();
  30644. $recv(aClass)._protocolsDo_((function(each,methods){
  30645. return $core.withContext(function($ctx2) {
  30646. $1=$recv(each)._match_("^\x5c*");
  30647. if(!$core.assert($1)){
  30648. return $recv(map)._at_put_(each,methods);
  30649. }
  30650. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30651. }));
  30652. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30653. return $core.withContext(function($ctx2) {
  30654. return $recv(a).__lt_eq(b);
  30655. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30656. })))._collect_((function(each){
  30657. return $core.withContext(function($ctx2) {
  30658. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30660. }));
  30661. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30662. },
  30663. args: ["aClass"],
  30664. 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) ]",
  30665. referencedClasses: ["Dictionary", "MethodCategory"],
  30666. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30667. }),
  30668. $globals.ChunkExporter);
  30669. $core.addMethod(
  30670. $core.method({
  30671. selector: "ownCategoriesOfMetaClass:",
  30672. protocol: "accessing",
  30673. fn: function (aClass){
  30674. var self=this,$self=this;
  30675. return $core.withContext(function($ctx1) {
  30676. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30677. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30678. },
  30679. args: ["aClass"],
  30680. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30681. referencedClasses: [],
  30682. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30683. }),
  30684. $globals.ChunkExporter);
  30685. $core.addMethod(
  30686. $core.method({
  30687. selector: "ownMethodProtocolsOfClass:",
  30688. protocol: "accessing",
  30689. fn: function (aClass){
  30690. var self=this,$self=this;
  30691. return $core.withContext(function($ctx1) {
  30692. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30693. return $core.withContext(function($ctx2) {
  30694. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30695. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30696. }));
  30697. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30698. },
  30699. args: ["aClass"],
  30700. 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 ]",
  30701. referencedClasses: ["ExportMethodProtocol"],
  30702. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30703. }),
  30704. $globals.ChunkExporter);
  30705. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30706. $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.).";
  30707. $core.addMethod(
  30708. $core.method({
  30709. selector: "exportBehavior:on:",
  30710. protocol: "output",
  30711. fn: function (aBehavior,aStream){
  30712. var self=this,$self=this;
  30713. return $core.withContext(function($ctx1) {
  30714. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30715. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30716. return $core.withContext(function($ctx2) {
  30717. return $self._exportMethod_on_(method,aStream);
  30718. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30719. }));
  30720. return self;
  30721. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30722. },
  30723. args: ["aBehavior", "aStream"],
  30724. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30725. referencedClasses: [],
  30726. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30727. }),
  30728. $globals.Exporter);
  30729. $core.addMethod(
  30730. $core.method({
  30731. selector: "exportDefinitionOf:on:",
  30732. protocol: "output",
  30733. fn: function (aClass,aStream){
  30734. var self=this,$self=this;
  30735. return $core.withContext(function($ctx1) {
  30736. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30737. $recv(aStream)._lf();
  30738. $ctx1.sendIdx["lf"]=1;
  30739. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30740. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30741. $5=$recv(aClass)._superclass();
  30742. if(($receiver = $5) == null || $receiver.a$nil){
  30743. $4="null";
  30744. } else {
  30745. var superclass;
  30746. superclass=$receiver;
  30747. $4=$recv(superclass)._asJavaScriptSource();
  30748. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30749. }
  30750. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30751. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30752. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30753. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30754. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30755. $1=$recv(aStream)._write_($2);
  30756. $ctx1.sendIdx["write:"]=1;
  30757. $8=$recv(aClass)._comment();
  30758. $ctx1.sendIdx["comment"]=1;
  30759. $recv($8)._ifNotEmpty_((function(){
  30760. return $core.withContext(function($ctx2) {
  30761. $recv(aStream)._lf();
  30762. $ctx2.sendIdx["lf"]=2;
  30763. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30764. $ctx2.sendIdx["write:"]=2;
  30765. $recv(aStream)._lf();
  30766. $ctx2.sendIdx["lf"]=3;
  30767. $10=$recv(aClass)._asJavaScriptSource();
  30768. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30769. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30770. $recv(aStream)._write_($9);
  30771. $ctx2.sendIdx["write:"]=3;
  30772. $recv(aStream)._lf();
  30773. $ctx2.sendIdx["lf"]=4;
  30774. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30776. }));
  30777. $recv(aStream)._lf();
  30778. return self;
  30779. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30780. },
  30781. args: ["aClass", "aStream"],
  30782. 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",
  30783. referencedClasses: [],
  30784. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30785. }),
  30786. $globals.Exporter);
  30787. $core.addMethod(
  30788. $core.method({
  30789. selector: "exportMetaDefinitionOf:on:",
  30790. protocol: "output",
  30791. fn: function (aClass,aStream){
  30792. var self=this,$self=this;
  30793. return $core.withContext(function($ctx1) {
  30794. var $2,$1,$4,$3;
  30795. $recv(aStream)._lf();
  30796. $ctx1.sendIdx["lf"]=1;
  30797. $2=$recv(aClass)._theMetaClass();
  30798. $ctx1.sendIdx["theMetaClass"]=1;
  30799. $1=$recv($2)._instanceVariableNames();
  30800. $recv($1)._ifNotEmpty_((function(classIvars){
  30801. return $core.withContext(function($ctx2) {
  30802. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  30803. $ctx2.sendIdx["asJavaScriptSource"]=1;
  30804. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  30805. $recv(aStream)._write_($3);
  30806. return $recv(aStream)._lf();
  30807. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  30808. }));
  30809. return self;
  30810. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30811. },
  30812. args: ["aClass", "aStream"],
  30813. 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 ]",
  30814. referencedClasses: [],
  30815. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  30816. }),
  30817. $globals.Exporter);
  30818. $core.addMethod(
  30819. $core.method({
  30820. selector: "exportMethod:on:",
  30821. protocol: "output",
  30822. fn: function (aMethod,aStream){
  30823. var self=this,$self=this;
  30824. return $core.withContext(function($ctx1) {
  30825. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  30826. $recv(aStream)._write_("$core.addMethod(");
  30827. $ctx1.sendIdx["write:"]=1;
  30828. $recv(aStream)._lf();
  30829. $ctx1.sendIdx["lf"]=1;
  30830. $recv(aStream)._write_("$core.method({");
  30831. $ctx1.sendIdx["write:"]=2;
  30832. $recv(aStream)._lf();
  30833. $ctx1.sendIdx["lf"]=2;
  30834. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  30835. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30836. $1=["selector: ",$2,","];
  30837. $recv(aStream)._write_($1);
  30838. $ctx1.sendIdx["write:"]=3;
  30839. $recv(aStream)._lf();
  30840. $ctx1.sendIdx["lf"]=3;
  30841. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  30842. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30843. $3=["protocol: ",$4,","];
  30844. $recv(aStream)._write_($3);
  30845. $ctx1.sendIdx["write:"]=4;
  30846. $recv(aStream)._lf();
  30847. $ctx1.sendIdx["lf"]=4;
  30848. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  30849. $ctx1.sendIdx["write:"]=5;
  30850. $recv(aStream)._lf();
  30851. $ctx1.sendIdx["lf"]=5;
  30852. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30853. $ctx1.sendIdx["write:"]=6;
  30854. $recv(aStream)._lf();
  30855. $ctx1.sendIdx["lf"]=6;
  30856. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  30857. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30858. $5=["args: ",$6,","];
  30859. $recv(aStream)._write_($5);
  30860. $ctx1.sendIdx["write:"]=7;
  30861. $recv(aStream)._lf();
  30862. $ctx1.sendIdx["lf"]=7;
  30863. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  30864. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30865. $7=["source: ",$8,","];
  30866. $recv(aStream)._write_($7);
  30867. $ctx1.sendIdx["write:"]=8;
  30868. $recv(aStream)._lf();
  30869. $ctx1.sendIdx["lf"]=8;
  30870. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  30871. $ctx1.sendIdx["asJavaScriptSource"]=5;
  30872. $9=["referencedClasses: ",$10,","];
  30873. $recv(aStream)._write_($9);
  30874. $ctx1.sendIdx["write:"]=9;
  30875. $recv(aStream)._lf();
  30876. $ctx1.sendIdx["lf"]=9;
  30877. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30878. $ctx1.sendIdx["write:"]=10;
  30879. $recv(aStream)._lf();
  30880. $ctx1.sendIdx["lf"]=10;
  30881. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  30882. $ctx1.sendIdx["asJavaScriptSource"]=6;
  30883. $11=["messageSends: ",$12];
  30884. $recv(aStream)._write_($11);
  30885. $ctx1.sendIdx["write:"]=11;
  30886. $recv(aStream)._lf();
  30887. $ctx1.sendIdx["lf"]=11;
  30888. $recv(aStream)._write_("}),");
  30889. $ctx1.sendIdx["write:"]=12;
  30890. $recv(aStream)._lf();
  30891. $ctx1.sendIdx["lf"]=12;
  30892. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  30893. $recv(aStream)._lf();
  30894. $ctx1.sendIdx["lf"]=13;
  30895. $recv(aStream)._lf();
  30896. return self;
  30897. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  30898. },
  30899. args: ["aMethod", "aStream"],
  30900. 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",
  30901. referencedClasses: [],
  30902. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  30903. }),
  30904. $globals.Exporter);
  30905. $core.addMethod(
  30906. $core.method({
  30907. selector: "exportPackage:on:",
  30908. protocol: "output",
  30909. fn: function (aPackage,aStream){
  30910. var self=this,$self=this;
  30911. return $core.withContext(function($ctx1) {
  30912. var $1,$receiver;
  30913. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  30914. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30915. $self._exportPackageContextOf_on_(aPackage,aStream);
  30916. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30917. $self._exportPackageTransportOf_on_(aPackage,aStream);
  30918. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30919. return $core.withContext(function($ctx2) {
  30920. $self._exportBehavior_on_(each,aStream);
  30921. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30922. $1=$recv(each)._theMetaClass();
  30923. if(($receiver = $1) == null || $receiver.a$nil){
  30924. return $1;
  30925. } else {
  30926. var meta;
  30927. meta=$receiver;
  30928. return $self._exportBehavior_on_(meta,aStream);
  30929. }
  30930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30931. }));
  30932. $ctx1.sendIdx["do:"]=1;
  30933. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30934. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  30935. return $core.withContext(function($ctx2) {
  30936. return $self._exportMethod_on_(each,aStream);
  30937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  30938. }));
  30939. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  30940. return self;
  30941. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30942. },
  30943. args: ["aPackage", "aStream"],
  30944. 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",
  30945. referencedClasses: [],
  30946. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  30947. }),
  30948. $globals.Exporter);
  30949. $core.addMethod(
  30950. $core.method({
  30951. selector: "exportPackageBodyBlockPrologueOf:on:",
  30952. protocol: "output",
  30953. fn: function (aPackage,aStream){
  30954. var self=this,$self=this;
  30955. return $core.withContext(function($ctx1) {
  30956. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  30957. $ctx1.sendIdx["write:"]=1;
  30958. $recv(aStream)._lf();
  30959. $ctx1.sendIdx["lf"]=1;
  30960. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  30961. $recv(aStream)._lf();
  30962. return self;
  30963. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30964. },
  30965. args: ["aPackage", "aStream"],
  30966. 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",
  30967. referencedClasses: [],
  30968. messageSends: ["write:", "lf"]
  30969. }),
  30970. $globals.Exporter);
  30971. $core.addMethod(
  30972. $core.method({
  30973. selector: "exportPackageContextOf:on:",
  30974. protocol: "output",
  30975. fn: function (aPackage,aStream){
  30976. var self=this,$self=this;
  30977. return $core.withContext(function($ctx1) {
  30978. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  30979. $recv(aStream)._lf();
  30980. return self;
  30981. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  30982. },
  30983. args: ["aPackage", "aStream"],
  30984. 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",
  30985. referencedClasses: [],
  30986. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  30987. }),
  30988. $globals.Exporter);
  30989. $core.addMethod(
  30990. $core.method({
  30991. selector: "exportPackageDefinitionOf:on:",
  30992. protocol: "output",
  30993. fn: function (aPackage,aStream){
  30994. var self=this,$self=this;
  30995. return $core.withContext(function($ctx1) {
  30996. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  30997. $recv(aStream)._lf();
  30998. return self;
  30999. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31000. },
  31001. args: ["aPackage", "aStream"],
  31002. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31003. referencedClasses: [],
  31004. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31005. }),
  31006. $globals.Exporter);
  31007. $core.addMethod(
  31008. $core.method({
  31009. selector: "exportPackageEpilogueOf:on:",
  31010. protocol: "output",
  31011. fn: function (aPackage,aStream){
  31012. var self=this,$self=this;
  31013. return $core.withContext(function($ctx1) {
  31014. $self._subclassResponsibility();
  31015. return self;
  31016. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31017. },
  31018. args: ["aPackage", "aStream"],
  31019. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31020. referencedClasses: [],
  31021. messageSends: ["subclassResponsibility"]
  31022. }),
  31023. $globals.Exporter);
  31024. $core.addMethod(
  31025. $core.method({
  31026. selector: "exportPackageImportsOf:on:",
  31027. protocol: "output",
  31028. fn: function (aPackage,aStream){
  31029. var self=this,$self=this;
  31030. return $core.withContext(function($ctx1) {
  31031. var $2,$1;
  31032. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31033. return $core.withContext(function($ctx2) {
  31034. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31035. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31036. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31037. $recv(aStream)._write_($1);
  31038. return $recv(aStream)._lf();
  31039. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31040. }));
  31041. return self;
  31042. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31043. },
  31044. args: ["aPackage", "aStream"],
  31045. 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 ]",
  31046. referencedClasses: [],
  31047. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31048. }),
  31049. $globals.Exporter);
  31050. $core.addMethod(
  31051. $core.method({
  31052. selector: "exportPackagePrologueOf:on:",
  31053. protocol: "output",
  31054. fn: function (aPackage,aStream){
  31055. var self=this,$self=this;
  31056. return $core.withContext(function($ctx1) {
  31057. $self._subclassResponsibility();
  31058. return self;
  31059. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31060. },
  31061. args: ["aPackage", "aStream"],
  31062. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31063. referencedClasses: [],
  31064. messageSends: ["subclassResponsibility"]
  31065. }),
  31066. $globals.Exporter);
  31067. $core.addMethod(
  31068. $core.method({
  31069. selector: "exportPackageTraitCompositionsOf:on:",
  31070. protocol: "output",
  31071. fn: function (aPackage,aStream){
  31072. var self=this,$self=this;
  31073. return $core.withContext(function($ctx1) {
  31074. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31075. return $core.withContext(function($ctx2) {
  31076. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31077. return $core.withContext(function($ctx3) {
  31078. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31079. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31080. }));
  31081. return $recv(aStream)._lf();
  31082. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31083. }));
  31084. return self;
  31085. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31086. },
  31087. args: ["aPackage", "aStream"],
  31088. 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 ]",
  31089. referencedClasses: [],
  31090. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31091. }),
  31092. $globals.Exporter);
  31093. $core.addMethod(
  31094. $core.method({
  31095. selector: "exportPackageTransportOf:on:",
  31096. protocol: "output",
  31097. fn: function (aPackage,aStream){
  31098. var self=this,$self=this;
  31099. return $core.withContext(function($ctx1) {
  31100. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31101. $recv(aStream)._lf();
  31102. return self;
  31103. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31104. },
  31105. args: ["aPackage", "aStream"],
  31106. 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",
  31107. referencedClasses: [],
  31108. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31109. }),
  31110. $globals.Exporter);
  31111. $core.addMethod(
  31112. $core.method({
  31113. selector: "exportTraitComposition:of:on:",
  31114. protocol: "output",
  31115. fn: function (aTraitComposition,aBehavior,aStream){
  31116. var self=this,$self=this;
  31117. return $core.withContext(function($ctx1) {
  31118. var $2,$1;
  31119. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31120. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31121. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31122. $recv(aStream)._write_($1);
  31123. $recv(aStream)._lf();
  31124. return self;
  31125. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31126. },
  31127. args: ["aTraitComposition", "aBehavior", "aStream"],
  31128. 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",
  31129. referencedClasses: [],
  31130. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31131. }),
  31132. $globals.Exporter);
  31133. $core.addMethod(
  31134. $core.method({
  31135. selector: "exportTraitDefinitionOf:on:",
  31136. protocol: "output",
  31137. fn: function (aClass,aStream){
  31138. var self=this,$self=this;
  31139. return $core.withContext(function($ctx1) {
  31140. var $3,$4,$2,$1,$5,$7,$6;
  31141. $recv(aStream)._lf();
  31142. $ctx1.sendIdx["lf"]=1;
  31143. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31144. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31145. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31146. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31147. $2=["$core.addTrait(",$3,", ",$4,");"];
  31148. $1=$recv(aStream)._write_($2);
  31149. $ctx1.sendIdx["write:"]=1;
  31150. $5=$recv(aClass)._comment();
  31151. $ctx1.sendIdx["comment"]=1;
  31152. $recv($5)._ifNotEmpty_((function(){
  31153. return $core.withContext(function($ctx2) {
  31154. $recv(aStream)._lf();
  31155. $ctx2.sendIdx["lf"]=2;
  31156. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31157. $ctx2.sendIdx["write:"]=2;
  31158. $recv(aStream)._lf();
  31159. $ctx2.sendIdx["lf"]=3;
  31160. $7=$recv(aClass)._asJavaScriptSource();
  31161. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31162. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31163. $recv(aStream)._write_($6);
  31164. $ctx2.sendIdx["write:"]=3;
  31165. $recv(aStream)._lf();
  31166. $ctx2.sendIdx["lf"]=4;
  31167. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31169. }));
  31170. $recv(aStream)._lf();
  31171. return self;
  31172. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31173. },
  31174. args: ["aClass", "aStream"],
  31175. 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",
  31176. referencedClasses: [],
  31177. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31178. }),
  31179. $globals.Exporter);
  31180. $core.addMethod(
  31181. $core.method({
  31182. selector: "ownMethodsOfClass:",
  31183. protocol: "accessing",
  31184. fn: function (aClass){
  31185. var self=this,$self=this;
  31186. return $core.withContext(function($ctx1) {
  31187. var $1;
  31188. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31189. return $core.withContext(function($ctx2) {
  31190. $1=$recv(a)._selector();
  31191. $ctx2.sendIdx["selector"]=1;
  31192. return $recv($1).__lt_eq($recv(b)._selector());
  31193. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31194. })))._reject_((function(each){
  31195. return $core.withContext(function($ctx2) {
  31196. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31198. }));
  31199. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31200. },
  31201. args: ["aClass"],
  31202. 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*') ]",
  31203. referencedClasses: [],
  31204. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31205. }),
  31206. $globals.Exporter);
  31207. $core.addMethod(
  31208. $core.method({
  31209. selector: "ownMethodsOfMetaClass:",
  31210. protocol: "accessing",
  31211. fn: function (aClass){
  31212. var self=this,$self=this;
  31213. return $core.withContext(function($ctx1) {
  31214. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31215. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31216. },
  31217. args: ["aClass"],
  31218. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31219. referencedClasses: [],
  31220. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31221. }),
  31222. $globals.Exporter);
  31223. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31224. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31225. $core.addMethod(
  31226. $core.method({
  31227. selector: "amdNamesOfPackages:",
  31228. protocol: "private",
  31229. fn: function (anArray){
  31230. var self=this,$self=this;
  31231. return $core.withContext(function($ctx1) {
  31232. var $1;
  31233. return $recv($recv(anArray)._select_((function(each){
  31234. return $core.withContext(function($ctx2) {
  31235. $1=$self._amdNamespaceOfPackage_(each);
  31236. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31237. return $recv($1)._notNil();
  31238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31239. })))._collect_((function(each){
  31240. return $core.withContext(function($ctx2) {
  31241. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31242. $ctx2.sendIdx[","]=1;
  31243. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31244. }));
  31245. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31246. },
  31247. args: ["anArray"],
  31248. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31249. referencedClasses: [],
  31250. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31251. }),
  31252. $globals.AmdExporter);
  31253. $core.addMethod(
  31254. $core.method({
  31255. selector: "amdNamespaceOfPackage:",
  31256. protocol: "private",
  31257. fn: function (aPackage){
  31258. var self=this,$self=this;
  31259. return $core.withContext(function($ctx1) {
  31260. var $3,$2,$1;
  31261. $3=$recv(aPackage)._transport();
  31262. $ctx1.sendIdx["transport"]=1;
  31263. $2=$recv($3)._type();
  31264. $1=$recv($2).__eq("amd");
  31265. if($core.assert($1)){
  31266. return $recv($recv(aPackage)._transport())._namespace();
  31267. } else {
  31268. return nil;
  31269. }
  31270. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31271. },
  31272. args: ["aPackage"],
  31273. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31274. referencedClasses: [],
  31275. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31276. }),
  31277. $globals.AmdExporter);
  31278. $core.addMethod(
  31279. $core.method({
  31280. selector: "exportPackageEpilogueOf:on:",
  31281. protocol: "output",
  31282. fn: function (aPackage,aStream){
  31283. var self=this,$self=this;
  31284. return $core.withContext(function($ctx1) {
  31285. $recv(aStream)._write_("});");
  31286. $recv(aStream)._lf();
  31287. return self;
  31288. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31289. },
  31290. args: ["aPackage", "aStream"],
  31291. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31292. referencedClasses: [],
  31293. messageSends: ["write:", "lf"]
  31294. }),
  31295. $globals.AmdExporter);
  31296. $core.addMethod(
  31297. $core.method({
  31298. selector: "exportPackagePrologueOf:on:",
  31299. protocol: "output",
  31300. fn: function (aPackage,aStream){
  31301. var self=this,$self=this;
  31302. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31303. return $core.withContext(function($ctx1) {
  31304. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31305. pragmaStart="";
  31306. pragmaEnd="";
  31307. importsForOutput=$self._importsForOutput_(aPackage);
  31308. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31309. $1=$recv(importsForOutput)._value();
  31310. $ctx1.sendIdx["value"]=1;
  31311. $recv($1)._ifNotEmpty_((function(){
  31312. return $core.withContext(function($ctx2) {
  31313. $3=$recv($globals.String)._lf();
  31314. $ctx2.sendIdx["lf"]=1;
  31315. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31316. $ctx2.sendIdx[","]=2;
  31317. $4=$recv($globals.String)._lf();
  31318. $ctx2.sendIdx["lf"]=2;
  31319. pragmaStart=$recv($2).__comma($4);
  31320. $ctx2.sendIdx[","]=1;
  31321. pragmaStart;
  31322. $6=$recv($globals.String)._lf();
  31323. $ctx2.sendIdx["lf"]=3;
  31324. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31325. $ctx2.sendIdx[","]=4;
  31326. $7=$recv($globals.String)._lf();
  31327. $ctx2.sendIdx["lf"]=4;
  31328. pragmaEnd=$recv($5).__comma($7);
  31329. $ctx2.sendIdx[","]=3;
  31330. return pragmaEnd;
  31331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31332. }));
  31333. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31334. $ctx1.sendIdx[","]=7;
  31335. $13=$recv($14).__comma([":2:"]);
  31336. $ctx1.sendIdx[","]=6;
  31337. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31338. $ctx1.sendIdx[","]=5;
  31339. $11=$recv($12)._asJavaScriptSource();
  31340. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31341. $ctx1.sendIdx["replace:with:"]=2;
  31342. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31343. $ctx1.sendIdx["replace:with:"]=1;
  31344. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31345. $ctx1.sendIdx[","]=8;
  31346. $17=$recv($18)._join_(",");
  31347. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31348. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31349. $ctx1.sendIdx["replace:with:"]=3;
  31350. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31351. $recv(aStream)._write_($8);
  31352. $recv(aStream)._lf();
  31353. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31354. return self;
  31355. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31356. },
  31357. args: ["aPackage", "aStream"],
  31358. 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",
  31359. referencedClasses: ["String"],
  31360. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31361. }),
  31362. $globals.AmdExporter);
  31363. $core.addMethod(
  31364. $core.method({
  31365. selector: "importsForOutput:",
  31366. protocol: "private",
  31367. fn: function (aPackage){
  31368. var self=this,$self=this;
  31369. var namedImports,anonImports,importVarNames;
  31370. return $core.withContext(function($ctx1) {
  31371. var $1;
  31372. namedImports=[];
  31373. anonImports=[];
  31374. importVarNames=[];
  31375. $recv($recv(aPackage)._imports())._do_((function(each){
  31376. return $core.withContext(function($ctx2) {
  31377. $1=$recv(each)._isString();
  31378. if($core.assert($1)){
  31379. return $recv(anonImports)._add_(each);
  31380. $ctx2.sendIdx["add:"]=1;
  31381. } else {
  31382. $recv(namedImports)._add_($recv(each)._value());
  31383. $ctx2.sendIdx["add:"]=2;
  31384. return $recv(importVarNames)._add_($recv(each)._key());
  31385. }
  31386. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31387. }));
  31388. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31389. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31390. },
  31391. args: ["aPackage"],
  31392. 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)",
  31393. referencedClasses: [],
  31394. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31395. }),
  31396. $globals.AmdExporter);
  31397. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31398. $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";
  31399. $core.addMethod(
  31400. $core.method({
  31401. selector: "last",
  31402. protocol: "accessing",
  31403. fn: function (){
  31404. var self=this,$self=this;
  31405. return $self["@last"];
  31406. },
  31407. args: [],
  31408. source: "last\x0a\x09^ last",
  31409. referencedClasses: [],
  31410. messageSends: []
  31411. }),
  31412. $globals.ChunkParser);
  31413. $core.addMethod(
  31414. $core.method({
  31415. selector: "nextChunk",
  31416. protocol: "reading",
  31417. fn: function (){
  31418. var self=this,$self=this;
  31419. var char,result,chunk;
  31420. return $core.withContext(function($ctx1) {
  31421. var $1,$2,$3,$4;
  31422. var $early={};
  31423. try {
  31424. result=""._writeStream();
  31425. $recv((function(){
  31426. return $core.withContext(function($ctx2) {
  31427. char=$recv($self["@stream"])._next();
  31428. $ctx2.sendIdx["next"]=1;
  31429. char;
  31430. return $recv(char)._notNil();
  31431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31432. }))._whileTrue_((function(){
  31433. return $core.withContext(function($ctx2) {
  31434. $1=$recv(char).__eq("!");
  31435. $ctx2.sendIdx["="]=1;
  31436. if($core.assert($1)){
  31437. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31438. if($core.assert($2)){
  31439. $recv($self["@stream"])._next();
  31440. } else {
  31441. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31442. $3=$self["@last"];
  31443. throw $early=[$3];
  31444. }
  31445. }
  31446. return $recv(result)._nextPut_(char);
  31447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31448. }));
  31449. $self["@last"]=nil;
  31450. $4=$self["@last"];
  31451. return $4;
  31452. }
  31453. catch(e) {if(e===$early)return e[0]; throw e}
  31454. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31455. },
  31456. args: [],
  31457. 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",
  31458. referencedClasses: [],
  31459. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31460. }),
  31461. $globals.ChunkParser);
  31462. $core.addMethod(
  31463. $core.method({
  31464. selector: "stream:",
  31465. protocol: "accessing",
  31466. fn: function (aStream){
  31467. var self=this,$self=this;
  31468. $self["@stream"]=aStream;
  31469. return self;
  31470. },
  31471. args: ["aStream"],
  31472. source: "stream: aStream\x0a\x09stream := aStream",
  31473. referencedClasses: [],
  31474. messageSends: []
  31475. }),
  31476. $globals.ChunkParser);
  31477. $core.addMethod(
  31478. $core.method({
  31479. selector: "on:",
  31480. protocol: "instance creation",
  31481. fn: function (aStream){
  31482. var self=this,$self=this;
  31483. return $core.withContext(function($ctx1) {
  31484. return $recv($self._new())._stream_(aStream);
  31485. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31486. },
  31487. args: ["aStream"],
  31488. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31489. referencedClasses: [],
  31490. messageSends: ["stream:", "new"]
  31491. }),
  31492. $globals.ChunkParser.a$cls);
  31493. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31494. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31495. $core.addMethod(
  31496. $core.method({
  31497. selector: "class:",
  31498. protocol: "accessing",
  31499. fn: function (aClass){
  31500. var self=this,$self=this;
  31501. $self["@class"]=aClass;
  31502. return self;
  31503. },
  31504. args: ["aClass"],
  31505. source: "class: aClass\x0a\x09class := aClass",
  31506. referencedClasses: [],
  31507. messageSends: []
  31508. }),
  31509. $globals.ClassCommentReader);
  31510. $core.addMethod(
  31511. $core.method({
  31512. selector: "initialize",
  31513. protocol: "initialization",
  31514. fn: function (){
  31515. var self=this,$self=this;
  31516. return $core.withContext(function($ctx1) {
  31517. (
  31518. $ctx1.supercall = true,
  31519. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31520. $ctx1.supercall = false;
  31521. return self;
  31522. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31523. },
  31524. args: [],
  31525. source: "initialize\x0a\x09super initialize.",
  31526. referencedClasses: [],
  31527. messageSends: ["initialize"]
  31528. }),
  31529. $globals.ClassCommentReader);
  31530. $core.addMethod(
  31531. $core.method({
  31532. selector: "scanFrom:",
  31533. protocol: "fileIn",
  31534. fn: function (aChunkParser){
  31535. var self=this,$self=this;
  31536. var chunk;
  31537. return $core.withContext(function($ctx1) {
  31538. chunk=$recv(aChunkParser)._nextChunk();
  31539. $recv(chunk)._ifNotEmpty_((function(){
  31540. return $core.withContext(function($ctx2) {
  31541. return $self._setComment_(chunk);
  31542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31543. }));
  31544. return self;
  31545. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31546. },
  31547. args: ["aChunkParser"],
  31548. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31549. referencedClasses: [],
  31550. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31551. }),
  31552. $globals.ClassCommentReader);
  31553. $core.addMethod(
  31554. $core.method({
  31555. selector: "setComment:",
  31556. protocol: "private",
  31557. fn: function (aString){
  31558. var self=this,$self=this;
  31559. return $core.withContext(function($ctx1) {
  31560. $recv($self["@class"])._comment_(aString);
  31561. return self;
  31562. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31563. },
  31564. args: ["aString"],
  31565. source: "setComment: aString\x0a\x09class comment: aString",
  31566. referencedClasses: [],
  31567. messageSends: ["comment:"]
  31568. }),
  31569. $globals.ClassCommentReader);
  31570. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31571. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31572. $core.addMethod(
  31573. $core.method({
  31574. selector: "class:category:",
  31575. protocol: "accessing",
  31576. fn: function (aClass,aString){
  31577. var self=this,$self=this;
  31578. $self["@class"]=aClass;
  31579. $self["@category"]=aString;
  31580. return self;
  31581. },
  31582. args: ["aClass", "aString"],
  31583. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31584. referencedClasses: [],
  31585. messageSends: []
  31586. }),
  31587. $globals.ClassProtocolReader);
  31588. $core.addMethod(
  31589. $core.method({
  31590. selector: "compileMethod:",
  31591. protocol: "private",
  31592. fn: function (aString){
  31593. var self=this,$self=this;
  31594. return $core.withContext(function($ctx1) {
  31595. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31596. return self;
  31597. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31598. },
  31599. args: ["aString"],
  31600. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31601. referencedClasses: ["Compiler"],
  31602. messageSends: ["install:forClass:protocol:", "new"]
  31603. }),
  31604. $globals.ClassProtocolReader);
  31605. $core.addMethod(
  31606. $core.method({
  31607. selector: "initialize",
  31608. protocol: "initialization",
  31609. fn: function (){
  31610. var self=this,$self=this;
  31611. return $core.withContext(function($ctx1) {
  31612. (
  31613. $ctx1.supercall = true,
  31614. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31615. $ctx1.supercall = false;
  31616. return self;
  31617. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31618. },
  31619. args: [],
  31620. source: "initialize\x0a\x09super initialize.",
  31621. referencedClasses: [],
  31622. messageSends: ["initialize"]
  31623. }),
  31624. $globals.ClassProtocolReader);
  31625. $core.addMethod(
  31626. $core.method({
  31627. selector: "scanFrom:",
  31628. protocol: "fileIn",
  31629. fn: function (aChunkParser){
  31630. var self=this,$self=this;
  31631. var chunk;
  31632. return $core.withContext(function($ctx1) {
  31633. $recv((function(){
  31634. return $core.withContext(function($ctx2) {
  31635. chunk=$recv(aChunkParser)._nextChunk();
  31636. chunk;
  31637. return $recv(chunk)._isEmpty();
  31638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31639. }))._whileFalse_((function(){
  31640. return $core.withContext(function($ctx2) {
  31641. return $self._compileMethod_(chunk);
  31642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31643. }));
  31644. return self;
  31645. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31646. },
  31647. args: ["aChunkParser"],
  31648. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31649. referencedClasses: [],
  31650. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31651. }),
  31652. $globals.ClassProtocolReader);
  31653. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31654. $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.";
  31655. $core.addMethod(
  31656. $core.method({
  31657. selector: "methods",
  31658. protocol: "accessing",
  31659. fn: function (){
  31660. var self=this,$self=this;
  31661. return $core.withContext(function($ctx1) {
  31662. var $1;
  31663. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31664. return $core.withContext(function($ctx2) {
  31665. $1=$recv(a)._selector();
  31666. $ctx2.sendIdx["selector"]=1;
  31667. return $recv($1).__lt_eq($recv(b)._selector());
  31668. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31669. }));
  31670. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31671. },
  31672. args: [],
  31673. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31674. referencedClasses: [],
  31675. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31676. }),
  31677. $globals.ExportMethodProtocol);
  31678. $core.addMethod(
  31679. $core.method({
  31680. selector: "name",
  31681. protocol: "accessing",
  31682. fn: function (){
  31683. var self=this,$self=this;
  31684. return $self["@name"];
  31685. },
  31686. args: [],
  31687. source: "name\x0a\x09^ name",
  31688. referencedClasses: [],
  31689. messageSends: []
  31690. }),
  31691. $globals.ExportMethodProtocol);
  31692. $core.addMethod(
  31693. $core.method({
  31694. selector: "name:",
  31695. protocol: "accessing",
  31696. fn: function (aString){
  31697. var self=this,$self=this;
  31698. $self["@name"]=aString;
  31699. return self;
  31700. },
  31701. args: ["aString"],
  31702. source: "name: aString\x0a\x09name := aString",
  31703. referencedClasses: [],
  31704. messageSends: []
  31705. }),
  31706. $globals.ExportMethodProtocol);
  31707. $core.addMethod(
  31708. $core.method({
  31709. selector: "ownMethods",
  31710. protocol: "accessing",
  31711. fn: function (){
  31712. var self=this,$self=this;
  31713. return $core.withContext(function($ctx1) {
  31714. var $1;
  31715. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31716. return $core.withContext(function($ctx2) {
  31717. $1=$recv(a)._selector();
  31718. $ctx2.sendIdx["selector"]=1;
  31719. return $recv($1).__lt_eq($recv(b)._selector());
  31720. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31721. }));
  31722. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31723. },
  31724. args: [],
  31725. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31726. referencedClasses: [],
  31727. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31728. }),
  31729. $globals.ExportMethodProtocol);
  31730. $core.addMethod(
  31731. $core.method({
  31732. selector: "theClass",
  31733. protocol: "accessing",
  31734. fn: function (){
  31735. var self=this,$self=this;
  31736. return $self["@theClass"];
  31737. },
  31738. args: [],
  31739. source: "theClass\x0a\x09^ theClass",
  31740. referencedClasses: [],
  31741. messageSends: []
  31742. }),
  31743. $globals.ExportMethodProtocol);
  31744. $core.addMethod(
  31745. $core.method({
  31746. selector: "theClass:",
  31747. protocol: "accessing",
  31748. fn: function (aClass){
  31749. var self=this,$self=this;
  31750. $self["@theClass"]=aClass;
  31751. return self;
  31752. },
  31753. args: ["aClass"],
  31754. source: "theClass: aClass\x0a\x09theClass := aClass",
  31755. referencedClasses: [],
  31756. messageSends: []
  31757. }),
  31758. $globals.ExportMethodProtocol);
  31759. $core.addMethod(
  31760. $core.method({
  31761. selector: "name:theClass:",
  31762. protocol: "instance creation",
  31763. fn: function (aString,aClass){
  31764. var self=this,$self=this;
  31765. return $core.withContext(function($ctx1) {
  31766. var $1;
  31767. $1=$self._new();
  31768. $recv($1)._name_(aString);
  31769. $recv($1)._theClass_(aClass);
  31770. return $recv($1)._yourself();
  31771. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31772. },
  31773. args: ["aString", "aClass"],
  31774. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31775. referencedClasses: [],
  31776. messageSends: ["name:", "new", "theClass:", "yourself"]
  31777. }),
  31778. $globals.ExportMethodProtocol.a$cls);
  31779. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31780. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31781. $core.addMethod(
  31782. $core.method({
  31783. selector: "import:",
  31784. protocol: "fileIn",
  31785. fn: function (aStream){
  31786. var self=this,$self=this;
  31787. var chunk,result,parser,lastEmpty;
  31788. return $core.withContext(function($ctx1) {
  31789. var $1;
  31790. parser=$recv($globals.ChunkParser)._on_(aStream);
  31791. lastEmpty=false;
  31792. $self["@lastSection"]="n/a, not started";
  31793. $self["@lastChunk"]=nil;
  31794. $recv((function(){
  31795. return $core.withContext(function($ctx2) {
  31796. $recv((function(){
  31797. return $core.withContext(function($ctx3) {
  31798. chunk=$recv(parser)._nextChunk();
  31799. chunk;
  31800. return $recv(chunk)._isNil();
  31801. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31802. }))._whileFalse_((function(){
  31803. return $core.withContext(function($ctx3) {
  31804. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  31805. lastEmpty=true;
  31806. return lastEmpty;
  31807. }),(function(){
  31808. return $core.withContext(function($ctx4) {
  31809. $self["@lastSection"]=chunk;
  31810. $self["@lastSection"];
  31811. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  31812. result;
  31813. $1=lastEmpty;
  31814. if($core.assert($1)){
  31815. lastEmpty=false;
  31816. lastEmpty;
  31817. return $recv(result)._scanFrom_(parser);
  31818. }
  31819. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  31820. }));
  31821. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31822. }));
  31823. $self["@lastSection"]="n/a, finished";
  31824. return $self["@lastSection"];
  31825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31826. }))._on_do_($globals.Error,(function(e){
  31827. return $core.withContext(function($ctx2) {
  31828. $self["@lastChunk"]=$recv(parser)._last();
  31829. $self["@lastChunk"];
  31830. return $recv(e)._resignal();
  31831. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  31832. }));
  31833. return self;
  31834. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  31835. },
  31836. args: ["aStream"],
  31837. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  31838. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  31839. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  31840. }),
  31841. $globals.Importer);
  31842. $core.addMethod(
  31843. $core.method({
  31844. selector: "lastChunk",
  31845. protocol: "accessing",
  31846. fn: function (){
  31847. var self=this,$self=this;
  31848. return $self["@lastChunk"];
  31849. },
  31850. args: [],
  31851. source: "lastChunk\x0a\x09^ lastChunk",
  31852. referencedClasses: [],
  31853. messageSends: []
  31854. }),
  31855. $globals.Importer);
  31856. $core.addMethod(
  31857. $core.method({
  31858. selector: "lastSection",
  31859. protocol: "accessing",
  31860. fn: function (){
  31861. var self=this,$self=this;
  31862. return $self["@lastSection"];
  31863. },
  31864. args: [],
  31865. source: "lastSection\x0a\x09^ lastSection",
  31866. referencedClasses: [],
  31867. messageSends: []
  31868. }),
  31869. $globals.Importer);
  31870. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  31871. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  31872. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  31873. $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.";
  31874. $core.addMethod(
  31875. $core.method({
  31876. selector: "ajaxPutAt:data:onSuccess:onError:",
  31877. protocol: "private",
  31878. fn: function (aURL,aString,aBlock,anotherBlock){
  31879. var self=this,$self=this;
  31880. var xhr;
  31881. return $core.withContext(function($ctx1) {
  31882. var $1,$4,$3,$2;
  31883. xhr=$recv($globals.Platform)._newXhr();
  31884. $recv(xhr)._open_url_async_("PUT",aURL,true);
  31885. $recv(xhr)._onreadystatechange_((function(){
  31886. return $core.withContext(function($ctx2) {
  31887. $1=$recv($recv(xhr)._readyState()).__eq((4));
  31888. if($core.assert($1)){
  31889. $4=$recv(xhr)._status();
  31890. $ctx2.sendIdx["status"]=1;
  31891. $3=$recv($4).__gt_eq((200));
  31892. $2=$recv($3)._and_((function(){
  31893. return $core.withContext(function($ctx3) {
  31894. return $recv($recv(xhr)._status()).__lt((300));
  31895. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31896. }));
  31897. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  31898. }
  31899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31900. }));
  31901. $recv(xhr)._send_(aString);
  31902. return self;
  31903. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  31904. },
  31905. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  31906. 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",
  31907. referencedClasses: ["Platform"],
  31908. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  31909. }),
  31910. $globals.PackageHandler);
  31911. $core.addMethod(
  31912. $core.method({
  31913. selector: "chunkContentsFor:",
  31914. protocol: "accessing",
  31915. fn: function (aPackage){
  31916. var self=this,$self=this;
  31917. return $core.withContext(function($ctx1) {
  31918. return $recv($globals.String)._streamContents_((function(str){
  31919. return $core.withContext(function($ctx2) {
  31920. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  31921. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  31922. }));
  31923. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  31924. },
  31925. args: ["aPackage"],
  31926. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  31927. referencedClasses: ["String"],
  31928. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  31929. }),
  31930. $globals.PackageHandler);
  31931. $core.addMethod(
  31932. $core.method({
  31933. selector: "chunkExporter",
  31934. protocol: "factory",
  31935. fn: function (){
  31936. var self=this,$self=this;
  31937. return $core.withContext(function($ctx1) {
  31938. return $recv($self._chunkExporterClass())._new();
  31939. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  31940. },
  31941. args: [],
  31942. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  31943. referencedClasses: [],
  31944. messageSends: ["new", "chunkExporterClass"]
  31945. }),
  31946. $globals.PackageHandler);
  31947. $core.addMethod(
  31948. $core.method({
  31949. selector: "chunkExporterClass",
  31950. protocol: "accessing",
  31951. fn: function (){
  31952. var self=this,$self=this;
  31953. return $globals.ChunkExporter;
  31954. },
  31955. args: [],
  31956. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  31957. referencedClasses: ["ChunkExporter"],
  31958. messageSends: []
  31959. }),
  31960. $globals.PackageHandler);
  31961. $core.addMethod(
  31962. $core.method({
  31963. selector: "commit:",
  31964. protocol: "committing",
  31965. fn: function (aPackage){
  31966. var self=this,$self=this;
  31967. return $core.withContext(function($ctx1) {
  31968. var $1,$2;
  31969. $self._commit_onSuccess_onError_(aPackage,(function(){
  31970. }),(function(error){
  31971. return $core.withContext(function($ctx2) {
  31972. $1=$recv($globals.PackageCommitError)._new();
  31973. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  31974. $ctx2.sendIdx[","]=1;
  31975. $recv($1)._messageText_($2);
  31976. return $recv($1)._signal();
  31977. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  31978. }));
  31979. return self;
  31980. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  31981. },
  31982. args: ["aPackage"],
  31983. 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 ]",
  31984. referencedClasses: ["PackageCommitError"],
  31985. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  31986. }),
  31987. $globals.PackageHandler);
  31988. $core.addMethod(
  31989. $core.method({
  31990. selector: "commit:onSuccess:onError:",
  31991. protocol: "committing",
  31992. fn: function (aPackage,aBlock,anotherBlock){
  31993. var self=this,$self=this;
  31994. return $core.withContext(function($ctx1) {
  31995. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  31996. return $core.withContext(function($ctx2) {
  31997. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  31998. return $core.withContext(function($ctx3) {
  31999. $recv(aPackage)._beClean();
  32000. return $recv(aBlock)._value();
  32001. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32002. }),anotherBlock);
  32003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32004. }),anotherBlock);
  32005. return self;
  32006. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32007. },
  32008. args: ["aPackage", "aBlock", "anotherBlock"],
  32009. 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",
  32010. referencedClasses: [],
  32011. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32012. }),
  32013. $globals.PackageHandler);
  32014. $core.addMethod(
  32015. $core.method({
  32016. selector: "commitJsFileFor:onSuccess:onError:",
  32017. protocol: "committing",
  32018. fn: function (aPackage,aBlock,anotherBlock){
  32019. var self=this,$self=this;
  32020. return $core.withContext(function($ctx1) {
  32021. var $2,$1;
  32022. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32023. $ctx1.sendIdx[","]=2;
  32024. $1=$recv($2).__comma(".js");
  32025. $ctx1.sendIdx[","]=1;
  32026. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32027. return self;
  32028. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32029. },
  32030. args: ["aPackage", "aBlock", "anotherBlock"],
  32031. 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",
  32032. referencedClasses: [],
  32033. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32034. }),
  32035. $globals.PackageHandler);
  32036. $core.addMethod(
  32037. $core.method({
  32038. selector: "commitPathJsFor:",
  32039. protocol: "accessing",
  32040. fn: function (aPackage){
  32041. var self=this,$self=this;
  32042. return $core.withContext(function($ctx1) {
  32043. $self._subclassResponsibility();
  32044. return self;
  32045. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32046. },
  32047. args: ["aPackage"],
  32048. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32049. referencedClasses: [],
  32050. messageSends: ["subclassResponsibility"]
  32051. }),
  32052. $globals.PackageHandler);
  32053. $core.addMethod(
  32054. $core.method({
  32055. selector: "commitPathStFor:",
  32056. protocol: "accessing",
  32057. fn: function (aPackage){
  32058. var self=this,$self=this;
  32059. return $core.withContext(function($ctx1) {
  32060. $self._subclassResponsibility();
  32061. return self;
  32062. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32063. },
  32064. args: ["aPackage"],
  32065. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32066. referencedClasses: [],
  32067. messageSends: ["subclassResponsibility"]
  32068. }),
  32069. $globals.PackageHandler);
  32070. $core.addMethod(
  32071. $core.method({
  32072. selector: "commitStFileFor:onSuccess:onError:",
  32073. protocol: "committing",
  32074. fn: function (aPackage,aBlock,anotherBlock){
  32075. var self=this,$self=this;
  32076. return $core.withContext(function($ctx1) {
  32077. var $2,$1;
  32078. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32079. $ctx1.sendIdx[","]=2;
  32080. $1=$recv($2).__comma(".st");
  32081. $ctx1.sendIdx[","]=1;
  32082. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32083. return self;
  32084. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32085. },
  32086. args: ["aPackage", "aBlock", "anotherBlock"],
  32087. 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",
  32088. referencedClasses: [],
  32089. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32090. }),
  32091. $globals.PackageHandler);
  32092. $core.addMethod(
  32093. $core.method({
  32094. selector: "contentsFor:",
  32095. protocol: "accessing",
  32096. fn: function (aPackage){
  32097. var self=this,$self=this;
  32098. return $core.withContext(function($ctx1) {
  32099. return $recv($globals.String)._streamContents_((function(str){
  32100. return $core.withContext(function($ctx2) {
  32101. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32102. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32103. }));
  32104. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32105. },
  32106. args: ["aPackage"],
  32107. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32108. referencedClasses: ["String"],
  32109. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32110. }),
  32111. $globals.PackageHandler);
  32112. $core.addMethod(
  32113. $core.method({
  32114. selector: "exporter",
  32115. protocol: "factory",
  32116. fn: function (){
  32117. var self=this,$self=this;
  32118. return $core.withContext(function($ctx1) {
  32119. return $recv($self._exporterClass())._new();
  32120. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32121. },
  32122. args: [],
  32123. source: "exporter\x0a\x09^ self exporterClass new",
  32124. referencedClasses: [],
  32125. messageSends: ["new", "exporterClass"]
  32126. }),
  32127. $globals.PackageHandler);
  32128. $core.addMethod(
  32129. $core.method({
  32130. selector: "exporterClass",
  32131. protocol: "accessing",
  32132. fn: function (){
  32133. var self=this,$self=this;
  32134. return $core.withContext(function($ctx1) {
  32135. $self._subclassResponsibility();
  32136. return self;
  32137. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32138. },
  32139. args: [],
  32140. source: "exporterClass\x0a\x09self subclassResponsibility",
  32141. referencedClasses: [],
  32142. messageSends: ["subclassResponsibility"]
  32143. }),
  32144. $globals.PackageHandler);
  32145. $core.addMethod(
  32146. $core.method({
  32147. selector: "load:",
  32148. protocol: "loading",
  32149. fn: function (aPackage){
  32150. var self=this,$self=this;
  32151. return $core.withContext(function($ctx1) {
  32152. $self._subclassResponsibility();
  32153. return self;
  32154. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32155. },
  32156. args: ["aPackage"],
  32157. source: "load: aPackage\x0a\x09self subclassResponsibility",
  32158. referencedClasses: [],
  32159. messageSends: ["subclassResponsibility"]
  32160. }),
  32161. $globals.PackageHandler);
  32162. $core.addMethod(
  32163. $core.method({
  32164. selector: "onCommitError:",
  32165. protocol: "error handling",
  32166. fn: function (anError){
  32167. var self=this,$self=this;
  32168. return $core.withContext(function($ctx1) {
  32169. var $1,$2;
  32170. $1=$recv($globals.PackageCommitError)._new();
  32171. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32172. $ctx1.sendIdx[","]=1;
  32173. $recv($1)._messageText_($2);
  32174. $recv($1)._signal();
  32175. return self;
  32176. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32177. },
  32178. args: ["anError"],
  32179. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32180. referencedClasses: ["PackageCommitError"],
  32181. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32182. }),
  32183. $globals.PackageHandler);
  32184. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32185. $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.";
  32186. $core.addMethod(
  32187. $core.method({
  32188. selector: "commitPathJsFor:",
  32189. protocol: "accessing",
  32190. fn: function (aPackage){
  32191. var self=this,$self=this;
  32192. return $core.withContext(function($ctx1) {
  32193. return $self._toUrl_($self._namespaceFor_(aPackage));
  32194. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32195. },
  32196. args: ["aPackage"],
  32197. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32198. referencedClasses: [],
  32199. messageSends: ["toUrl:", "namespaceFor:"]
  32200. }),
  32201. $globals.AmdPackageHandler);
  32202. $core.addMethod(
  32203. $core.method({
  32204. selector: "commitPathStFor:",
  32205. protocol: "accessing",
  32206. fn: function (aPackage){
  32207. var self=this,$self=this;
  32208. var path,pathWithout;
  32209. return $core.withContext(function($ctx1) {
  32210. var $1,$2;
  32211. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32212. $ctx1.sendIdx[","]=1;
  32213. path=$self._toUrl_($1);
  32214. pathWithout=$self._commitPathJsFor_(aPackage);
  32215. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32216. if($core.assert($2)){
  32217. return pathWithout;
  32218. } else {
  32219. return path;
  32220. }
  32221. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32222. },
  32223. args: ["aPackage"],
  32224. 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 ]",
  32225. referencedClasses: [],
  32226. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32227. }),
  32228. $globals.AmdPackageHandler);
  32229. $core.addMethod(
  32230. $core.method({
  32231. selector: "exporterClass",
  32232. protocol: "accessing",
  32233. fn: function (){
  32234. var self=this,$self=this;
  32235. return $globals.AmdExporter;
  32236. },
  32237. args: [],
  32238. source: "exporterClass\x0a\x09^ AmdExporter",
  32239. referencedClasses: ["AmdExporter"],
  32240. messageSends: []
  32241. }),
  32242. $globals.AmdPackageHandler);
  32243. $core.addMethod(
  32244. $core.method({
  32245. selector: "load:",
  32246. protocol: "loading",
  32247. fn: function (aPackage){
  32248. var self=this,$self=this;
  32249. return $core.withContext(function($ctx1) {
  32250. var $1,$3,$2,$receiver;
  32251. $1=$recv($globals.Smalltalk)._amdRequire();
  32252. if(($receiver = $1) == null || $receiver.a$nil){
  32253. $self._error_("AMD loader not present");
  32254. } else {
  32255. var require;
  32256. require=$receiver;
  32257. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32258. $ctx1.sendIdx[","]=1;
  32259. $2=$recv($globals.Array)._with_($3);
  32260. $recv(require)._value_($2);
  32261. }
  32262. return self;
  32263. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32264. },
  32265. args: ["aPackage"],
  32266. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  32267. referencedClasses: ["Smalltalk", "Array"],
  32268. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  32269. }),
  32270. $globals.AmdPackageHandler);
  32271. $core.addMethod(
  32272. $core.method({
  32273. selector: "namespaceFor:",
  32274. protocol: "committing",
  32275. fn: function (aPackage){
  32276. var self=this,$self=this;
  32277. return $core.withContext(function($ctx1) {
  32278. return $recv($recv(aPackage)._transport())._namespace();
  32279. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32280. },
  32281. args: ["aPackage"],
  32282. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32283. referencedClasses: [],
  32284. messageSends: ["namespace", "transport"]
  32285. }),
  32286. $globals.AmdPackageHandler);
  32287. $core.addMethod(
  32288. $core.method({
  32289. selector: "toUrl:",
  32290. protocol: "private",
  32291. fn: function (aString){
  32292. var self=this,$self=this;
  32293. return $core.withContext(function($ctx1) {
  32294. var $1,$receiver;
  32295. $1=$recv($globals.Smalltalk)._amdRequire();
  32296. if(($receiver = $1) == null || $receiver.a$nil){
  32297. return $self._error_("AMD loader not present");
  32298. } else {
  32299. var require;
  32300. require=$receiver;
  32301. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  32302. }
  32303. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32304. },
  32305. args: ["aString"],
  32306. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  32307. referencedClasses: ["Smalltalk"],
  32308. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  32309. }),
  32310. $globals.AmdPackageHandler);
  32311. $core.addMethod(
  32312. $core.method({
  32313. selector: "defaultNamespace",
  32314. protocol: "commit paths",
  32315. fn: function (){
  32316. var self=this,$self=this;
  32317. return $core.withContext(function($ctx1) {
  32318. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32319. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32320. },
  32321. args: [],
  32322. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32323. referencedClasses: ["Smalltalk"],
  32324. messageSends: ["defaultAmdNamespace"]
  32325. }),
  32326. $globals.AmdPackageHandler.a$cls);
  32327. $core.addMethod(
  32328. $core.method({
  32329. selector: "defaultNamespace:",
  32330. protocol: "commit paths",
  32331. fn: function (aString){
  32332. var self=this,$self=this;
  32333. return $core.withContext(function($ctx1) {
  32334. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32335. return self;
  32336. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32337. },
  32338. args: ["aString"],
  32339. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32340. referencedClasses: ["Smalltalk"],
  32341. messageSends: ["defaultAmdNamespace:"]
  32342. }),
  32343. $globals.AmdPackageHandler.a$cls);
  32344. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32345. $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.";
  32346. $core.addMethod(
  32347. $core.method({
  32348. selector: "asJavaScriptObject",
  32349. protocol: "converting",
  32350. fn: function (){
  32351. var self=this,$self=this;
  32352. return $core.withContext(function($ctx1) {
  32353. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32354. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32355. },
  32356. args: [],
  32357. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32358. referencedClasses: [],
  32359. messageSends: ["type"]
  32360. }),
  32361. $globals.PackageTransport);
  32362. $core.addMethod(
  32363. $core.method({
  32364. selector: "commit",
  32365. protocol: "committing",
  32366. fn: function (){
  32367. var self=this,$self=this;
  32368. return $core.withContext(function($ctx1) {
  32369. $recv($self._commitHandler())._commit_($self._package());
  32370. return self;
  32371. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32372. },
  32373. args: [],
  32374. source: "commit\x0a\x09self commitHandler commit: self package",
  32375. referencedClasses: [],
  32376. messageSends: ["commit:", "commitHandler", "package"]
  32377. }),
  32378. $globals.PackageTransport);
  32379. $core.addMethod(
  32380. $core.method({
  32381. selector: "commitHandler",
  32382. protocol: "factory",
  32383. fn: function (){
  32384. var self=this,$self=this;
  32385. return $core.withContext(function($ctx1) {
  32386. return $recv($self._commitHandlerClass())._new();
  32387. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32388. },
  32389. args: [],
  32390. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32391. referencedClasses: [],
  32392. messageSends: ["new", "commitHandlerClass"]
  32393. }),
  32394. $globals.PackageTransport);
  32395. $core.addMethod(
  32396. $core.method({
  32397. selector: "commitHandlerClass",
  32398. protocol: "accessing",
  32399. fn: function (){
  32400. var self=this,$self=this;
  32401. return $core.withContext(function($ctx1) {
  32402. $self._subclassResponsibility();
  32403. return self;
  32404. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32405. },
  32406. args: [],
  32407. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32408. referencedClasses: [],
  32409. messageSends: ["subclassResponsibility"]
  32410. }),
  32411. $globals.PackageTransport);
  32412. $core.addMethod(
  32413. $core.method({
  32414. selector: "commitOnSuccess:onError:",
  32415. protocol: "committing",
  32416. fn: function (aBlock,anotherBlock){
  32417. var self=this,$self=this;
  32418. return $core.withContext(function($ctx1) {
  32419. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32420. return self;
  32421. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32422. },
  32423. args: ["aBlock", "anotherBlock"],
  32424. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32425. referencedClasses: [],
  32426. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32427. }),
  32428. $globals.PackageTransport);
  32429. $core.addMethod(
  32430. $core.method({
  32431. selector: "definition",
  32432. protocol: "accessing",
  32433. fn: function (){
  32434. var self=this,$self=this;
  32435. return "";
  32436. },
  32437. args: [],
  32438. source: "definition\x0a\x09^ ''",
  32439. referencedClasses: [],
  32440. messageSends: []
  32441. }),
  32442. $globals.PackageTransport);
  32443. $core.addMethod(
  32444. $core.method({
  32445. selector: "load",
  32446. protocol: "loading",
  32447. fn: function (){
  32448. var self=this,$self=this;
  32449. return $core.withContext(function($ctx1) {
  32450. $recv($self._commitHandler())._load_($self._package());
  32451. return self;
  32452. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32453. },
  32454. args: [],
  32455. source: "load\x0a\x09self commitHandler load: self package",
  32456. referencedClasses: [],
  32457. messageSends: ["load:", "commitHandler", "package"]
  32458. }),
  32459. $globals.PackageTransport);
  32460. $core.addMethod(
  32461. $core.method({
  32462. selector: "package",
  32463. protocol: "accessing",
  32464. fn: function (){
  32465. var self=this,$self=this;
  32466. return $self["@package"];
  32467. },
  32468. args: [],
  32469. source: "package\x0a\x09^ package",
  32470. referencedClasses: [],
  32471. messageSends: []
  32472. }),
  32473. $globals.PackageTransport);
  32474. $core.addMethod(
  32475. $core.method({
  32476. selector: "package:",
  32477. protocol: "accessing",
  32478. fn: function (aPackage){
  32479. var self=this,$self=this;
  32480. $self["@package"]=aPackage;
  32481. return self;
  32482. },
  32483. args: ["aPackage"],
  32484. source: "package: aPackage\x0a\x09package := aPackage",
  32485. referencedClasses: [],
  32486. messageSends: []
  32487. }),
  32488. $globals.PackageTransport);
  32489. $core.addMethod(
  32490. $core.method({
  32491. selector: "setupFromJson:",
  32492. protocol: "initialization",
  32493. fn: function (anObject){
  32494. var self=this,$self=this;
  32495. return self;
  32496. },
  32497. args: ["anObject"],
  32498. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32499. referencedClasses: [],
  32500. messageSends: []
  32501. }),
  32502. $globals.PackageTransport);
  32503. $core.addMethod(
  32504. $core.method({
  32505. selector: "type",
  32506. protocol: "accessing",
  32507. fn: function (){
  32508. var self=this,$self=this;
  32509. return $core.withContext(function($ctx1) {
  32510. return $recv($self._class())._type();
  32511. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32512. },
  32513. args: [],
  32514. source: "type\x0a\x09^ self class type",
  32515. referencedClasses: [],
  32516. messageSends: ["type", "class"]
  32517. }),
  32518. $globals.PackageTransport);
  32519. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32520. $core.addMethod(
  32521. $core.method({
  32522. selector: "classRegisteredFor:",
  32523. protocol: "accessing",
  32524. fn: function (aString){
  32525. var self=this,$self=this;
  32526. return $core.withContext(function($ctx1) {
  32527. return $recv($self["@registry"])._at_(aString);
  32528. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32529. },
  32530. args: ["aString"],
  32531. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32532. referencedClasses: [],
  32533. messageSends: ["at:"]
  32534. }),
  32535. $globals.PackageTransport.a$cls);
  32536. $core.addMethod(
  32537. $core.method({
  32538. selector: "defaultType",
  32539. protocol: "accessing",
  32540. fn: function (){
  32541. var self=this,$self=this;
  32542. return $core.withContext(function($ctx1) {
  32543. return $recv($globals.AmdPackageTransport)._type();
  32544. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32545. },
  32546. args: [],
  32547. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32548. referencedClasses: ["AmdPackageTransport"],
  32549. messageSends: ["type"]
  32550. }),
  32551. $globals.PackageTransport.a$cls);
  32552. $core.addMethod(
  32553. $core.method({
  32554. selector: "for:",
  32555. protocol: "instance creation",
  32556. fn: function (aString){
  32557. var self=this,$self=this;
  32558. return $core.withContext(function($ctx1) {
  32559. return $recv($self._classRegisteredFor_(aString))._new();
  32560. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32561. },
  32562. args: ["aString"],
  32563. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32564. referencedClasses: [],
  32565. messageSends: ["new", "classRegisteredFor:"]
  32566. }),
  32567. $globals.PackageTransport.a$cls);
  32568. $core.addMethod(
  32569. $core.method({
  32570. selector: "fromJson:",
  32571. protocol: "instance creation",
  32572. fn: function (anObject){
  32573. var self=this,$self=this;
  32574. return $core.withContext(function($ctx1) {
  32575. var $1,$2,$receiver;
  32576. if(($receiver = anObject) == null || $receiver.a$nil){
  32577. $1=$self._for_($self._defaultType());
  32578. $ctx1.sendIdx["for:"]=1;
  32579. return $1;
  32580. } else {
  32581. anObject;
  32582. }
  32583. $2=$self._for_($recv(anObject)._type());
  32584. $recv($2)._setupFromJson_(anObject);
  32585. return $recv($2)._yourself();
  32586. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32587. },
  32588. args: ["anObject"],
  32589. 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",
  32590. referencedClasses: [],
  32591. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32592. }),
  32593. $globals.PackageTransport.a$cls);
  32594. $core.addMethod(
  32595. $core.method({
  32596. selector: "initialize",
  32597. protocol: "initialization",
  32598. fn: function (){
  32599. var self=this,$self=this;
  32600. return $core.withContext(function($ctx1) {
  32601. var $1;
  32602. (
  32603. $ctx1.supercall = true,
  32604. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32605. $ctx1.supercall = false;
  32606. $1=$self.__eq_eq($globals.PackageTransport);
  32607. if($core.assert($1)){
  32608. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32609. $self["@registry"];
  32610. } else {
  32611. $self._register();
  32612. }
  32613. return self;
  32614. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32615. },
  32616. args: [],
  32617. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32618. referencedClasses: ["PackageTransport"],
  32619. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32620. }),
  32621. $globals.PackageTransport.a$cls);
  32622. $core.addMethod(
  32623. $core.method({
  32624. selector: "register",
  32625. protocol: "registration",
  32626. fn: function (){
  32627. var self=this,$self=this;
  32628. return $core.withContext(function($ctx1) {
  32629. $recv($globals.PackageTransport)._register_(self);
  32630. return self;
  32631. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32632. },
  32633. args: [],
  32634. source: "register\x0a\x09PackageTransport register: self",
  32635. referencedClasses: ["PackageTransport"],
  32636. messageSends: ["register:"]
  32637. }),
  32638. $globals.PackageTransport.a$cls);
  32639. $core.addMethod(
  32640. $core.method({
  32641. selector: "register:",
  32642. protocol: "registration",
  32643. fn: function (aClass){
  32644. var self=this,$self=this;
  32645. return $core.withContext(function($ctx1) {
  32646. var $1,$receiver;
  32647. $1=$recv(aClass)._type();
  32648. $ctx1.sendIdx["type"]=1;
  32649. if(($receiver = $1) == null || $receiver.a$nil){
  32650. $1;
  32651. } else {
  32652. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32653. }
  32654. return self;
  32655. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32656. },
  32657. args: ["aClass"],
  32658. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32659. referencedClasses: [],
  32660. messageSends: ["ifNotNil:", "type", "at:put:"]
  32661. }),
  32662. $globals.PackageTransport.a$cls);
  32663. $core.addMethod(
  32664. $core.method({
  32665. selector: "type",
  32666. protocol: "accessing",
  32667. fn: function (){
  32668. var self=this,$self=this;
  32669. return nil;
  32670. },
  32671. args: [],
  32672. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32673. referencedClasses: [],
  32674. messageSends: []
  32675. }),
  32676. $globals.PackageTransport.a$cls);
  32677. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32678. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32679. $core.addMethod(
  32680. $core.method({
  32681. selector: "asJavaScriptObject",
  32682. protocol: "converting",
  32683. fn: function (){
  32684. var self=this,$self=this;
  32685. return $core.withContext(function($ctx1) {
  32686. var $1;
  32687. $1=(
  32688. $ctx1.supercall = true,
  32689. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32690. $ctx1.supercall = false;
  32691. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32692. return $recv($1)._yourself();
  32693. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32694. },
  32695. args: [],
  32696. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32697. referencedClasses: [],
  32698. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32699. }),
  32700. $globals.AmdPackageTransport);
  32701. $core.addMethod(
  32702. $core.method({
  32703. selector: "commitHandlerClass",
  32704. protocol: "accessing",
  32705. fn: function (){
  32706. var self=this,$self=this;
  32707. return $globals.AmdPackageHandler;
  32708. },
  32709. args: [],
  32710. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32711. referencedClasses: ["AmdPackageHandler"],
  32712. messageSends: []
  32713. }),
  32714. $globals.AmdPackageTransport);
  32715. $core.addMethod(
  32716. $core.method({
  32717. selector: "defaultNamespace",
  32718. protocol: "defaults",
  32719. fn: function (){
  32720. var self=this,$self=this;
  32721. return $core.withContext(function($ctx1) {
  32722. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32723. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32724. },
  32725. args: [],
  32726. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32727. referencedClasses: ["Smalltalk"],
  32728. messageSends: ["defaultAmdNamespace"]
  32729. }),
  32730. $globals.AmdPackageTransport);
  32731. $core.addMethod(
  32732. $core.method({
  32733. selector: "definition",
  32734. protocol: "accessing",
  32735. fn: function (){
  32736. var self=this,$self=this;
  32737. return $core.withContext(function($ctx1) {
  32738. return $recv($globals.String)._streamContents_((function(stream){
  32739. return $core.withContext(function($ctx2) {
  32740. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32741. return $recv(stream)._print_($self._namespace());
  32742. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32743. }));
  32744. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32745. },
  32746. args: [],
  32747. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32748. referencedClasses: ["String"],
  32749. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32750. }),
  32751. $globals.AmdPackageTransport);
  32752. $core.addMethod(
  32753. $core.method({
  32754. selector: "namespace",
  32755. protocol: "accessing",
  32756. fn: function (){
  32757. var self=this,$self=this;
  32758. return $core.withContext(function($ctx1) {
  32759. var $1,$receiver;
  32760. $1=$self["@namespace"];
  32761. if(($receiver = $1) == null || $receiver.a$nil){
  32762. return $self._defaultNamespace();
  32763. } else {
  32764. return $1;
  32765. }
  32766. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32767. },
  32768. args: [],
  32769. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32770. referencedClasses: [],
  32771. messageSends: ["ifNil:", "defaultNamespace"]
  32772. }),
  32773. $globals.AmdPackageTransport);
  32774. $core.addMethod(
  32775. $core.method({
  32776. selector: "namespace:",
  32777. protocol: "accessing",
  32778. fn: function (aString){
  32779. var self=this,$self=this;
  32780. $self["@namespace"]=aString;
  32781. return self;
  32782. },
  32783. args: ["aString"],
  32784. source: "namespace: aString\x0a\x09namespace := aString",
  32785. referencedClasses: [],
  32786. messageSends: []
  32787. }),
  32788. $globals.AmdPackageTransport);
  32789. $core.addMethod(
  32790. $core.method({
  32791. selector: "printOn:",
  32792. protocol: "printing",
  32793. fn: function (aStream){
  32794. var self=this,$self=this;
  32795. return $core.withContext(function($ctx1) {
  32796. (
  32797. $ctx1.supercall = true,
  32798. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  32799. $ctx1.supercall = false;
  32800. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  32801. $ctx1.sendIdx["nextPutAll:"]=1;
  32802. $recv(aStream)._nextPutAll_($self._namespace());
  32803. $ctx1.sendIdx["nextPutAll:"]=2;
  32804. $recv(aStream)._nextPutAll_(")");
  32805. return self;
  32806. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  32807. },
  32808. args: ["aStream"],
  32809. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  32810. referencedClasses: [],
  32811. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  32812. }),
  32813. $globals.AmdPackageTransport);
  32814. $core.addMethod(
  32815. $core.method({
  32816. selector: "setPath:",
  32817. protocol: "actions",
  32818. fn: function (aString){
  32819. var self=this,$self=this;
  32820. return $core.withContext(function($ctx1) {
  32821. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  32822. return self;
  32823. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  32824. },
  32825. args: ["aString"],
  32826. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  32827. referencedClasses: [],
  32828. messageSends: ["value:", "basicAt:", "namespace"]
  32829. }),
  32830. $globals.AmdPackageTransport);
  32831. $core.addMethod(
  32832. $core.method({
  32833. selector: "setupFromJson:",
  32834. protocol: "initialization",
  32835. fn: function (anObject){
  32836. var self=this,$self=this;
  32837. return $core.withContext(function($ctx1) {
  32838. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  32839. return self;
  32840. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  32841. },
  32842. args: ["anObject"],
  32843. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  32844. referencedClasses: [],
  32845. messageSends: ["namespace:", "at:"]
  32846. }),
  32847. $globals.AmdPackageTransport);
  32848. $core.addMethod(
  32849. $core.method({
  32850. selector: "namespace:",
  32851. protocol: "instance creation",
  32852. fn: function (aString){
  32853. var self=this,$self=this;
  32854. return $core.withContext(function($ctx1) {
  32855. var $1;
  32856. $1=$self._new();
  32857. $recv($1)._namespace_(aString);
  32858. return $recv($1)._yourself();
  32859. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  32860. },
  32861. args: ["aString"],
  32862. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  32863. referencedClasses: [],
  32864. messageSends: ["namespace:", "new", "yourself"]
  32865. }),
  32866. $globals.AmdPackageTransport.a$cls);
  32867. $core.addMethod(
  32868. $core.method({
  32869. selector: "type",
  32870. protocol: "accessing",
  32871. fn: function (){
  32872. var self=this,$self=this;
  32873. return "amd";
  32874. },
  32875. args: [],
  32876. source: "type\x0a\x09^ 'amd'",
  32877. referencedClasses: [],
  32878. messageSends: []
  32879. }),
  32880. $globals.AmdPackageTransport.a$cls);
  32881. $core.addMethod(
  32882. $core.method({
  32883. selector: "exportBehaviorDefinitionTo:using:",
  32884. protocol: "*Platform-ImportExport",
  32885. fn: function (aStream,anExporter){
  32886. var self=this,$self=this;
  32887. return $core.withContext(function($ctx1) {
  32888. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  32889. return self;
  32890. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  32891. },
  32892. args: ["aStream", "anExporter"],
  32893. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  32894. referencedClasses: [],
  32895. messageSends: ["exportDefinitionOf:on:"]
  32896. }),
  32897. $globals.Class);
  32898. $core.addMethod(
  32899. $core.method({
  32900. selector: "exportBehaviorDefinitionTo:using:",
  32901. protocol: "*Platform-ImportExport",
  32902. fn: function (aStream,anExporter){
  32903. var self=this,$self=this;
  32904. return $core.withContext(function($ctx1) {
  32905. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  32906. return self;
  32907. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  32908. },
  32909. args: ["aStream", "anExporter"],
  32910. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  32911. referencedClasses: [],
  32912. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  32913. }),
  32914. $globals.Metaclass);
  32915. $core.addMethod(
  32916. $core.method({
  32917. selector: "commit",
  32918. protocol: "*Platform-ImportExport",
  32919. fn: function (){
  32920. var self=this,$self=this;
  32921. return $core.withContext(function($ctx1) {
  32922. return $recv($self._transport())._commit();
  32923. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  32924. },
  32925. args: [],
  32926. source: "commit\x0a\x09^ self transport commit",
  32927. referencedClasses: [],
  32928. messageSends: ["commit", "transport"]
  32929. }),
  32930. $globals.Package);
  32931. $core.addMethod(
  32932. $core.method({
  32933. selector: "load",
  32934. protocol: "*Platform-ImportExport",
  32935. fn: function (){
  32936. var self=this,$self=this;
  32937. return $core.withContext(function($ctx1) {
  32938. return $recv($self._transport())._load();
  32939. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  32940. },
  32941. args: [],
  32942. source: "load\x0a\x09^ self transport load",
  32943. referencedClasses: [],
  32944. messageSends: ["load", "transport"]
  32945. }),
  32946. $globals.Package);
  32947. $core.addMethod(
  32948. $core.method({
  32949. selector: "loadFromNamespace:",
  32950. protocol: "*Platform-ImportExport",
  32951. fn: function (aString){
  32952. var self=this,$self=this;
  32953. return $core.withContext(function($ctx1) {
  32954. var $1;
  32955. $1=$self._transport();
  32956. $recv($1)._namespace_(aString);
  32957. return $recv($1)._load();
  32958. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  32959. },
  32960. args: ["aString"],
  32961. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  32962. referencedClasses: [],
  32963. messageSends: ["namespace:", "transport", "load"]
  32964. }),
  32965. $globals.Package);
  32966. $core.addMethod(
  32967. $core.method({
  32968. selector: "load:",
  32969. protocol: "*Platform-ImportExport",
  32970. fn: function (aPackageName){
  32971. var self=this,$self=this;
  32972. return $core.withContext(function($ctx1) {
  32973. $recv($self._named_(aPackageName))._load();
  32974. return self;
  32975. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  32976. },
  32977. args: ["aPackageName"],
  32978. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  32979. referencedClasses: [],
  32980. messageSends: ["load", "named:"]
  32981. }),
  32982. $globals.Package.a$cls);
  32983. $core.addMethod(
  32984. $core.method({
  32985. selector: "load:fromNamespace:",
  32986. protocol: "*Platform-ImportExport",
  32987. fn: function (aPackageName,aString){
  32988. var self=this,$self=this;
  32989. return $core.withContext(function($ctx1) {
  32990. $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  32991. return self;
  32992. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  32993. },
  32994. args: ["aPackageName", "aString"],
  32995. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  32996. referencedClasses: [],
  32997. messageSends: ["loadFromNamespace:", "named:"]
  32998. }),
  32999. $globals.Package.a$cls);
  33000. $core.addMethod(
  33001. $core.method({
  33002. selector: "methodsFor:",
  33003. protocol: "*Platform-ImportExport",
  33004. fn: function (aString){
  33005. var self=this,$self=this;
  33006. return $core.withContext(function($ctx1) {
  33007. var $1;
  33008. $1=$recv($globals.ClassProtocolReader)._new();
  33009. $recv($1)._class_category_(self,aString);
  33010. return $recv($1)._yourself();
  33011. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33012. },
  33013. args: ["aString"],
  33014. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33015. referencedClasses: ["ClassProtocolReader"],
  33016. messageSends: ["class:category:", "new", "yourself"]
  33017. }),
  33018. $globals.TBehaviorProvider);
  33019. $core.addMethod(
  33020. $core.method({
  33021. selector: "methodsFor:stamp:",
  33022. protocol: "*Platform-ImportExport",
  33023. fn: function (aString,aStamp){
  33024. var self=this,$self=this;
  33025. return $core.withContext(function($ctx1) {
  33026. return $self._methodsFor_(aString);
  33027. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33028. },
  33029. args: ["aString", "aStamp"],
  33030. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33031. referencedClasses: [],
  33032. messageSends: ["methodsFor:"]
  33033. }),
  33034. $globals.TBehaviorProvider);
  33035. $core.addMethod(
  33036. $core.method({
  33037. selector: "commentStamp",
  33038. protocol: "*Platform-ImportExport",
  33039. fn: function (){
  33040. var self=this,$self=this;
  33041. return $core.withContext(function($ctx1) {
  33042. var $1;
  33043. $1=$recv($globals.ClassCommentReader)._new();
  33044. $recv($1)._class_(self);
  33045. return $recv($1)._yourself();
  33046. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33047. },
  33048. args: [],
  33049. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33050. referencedClasses: ["ClassCommentReader"],
  33051. messageSends: ["class:", "new", "yourself"]
  33052. }),
  33053. $globals.TMasterBehavior);
  33054. $core.addMethod(
  33055. $core.method({
  33056. selector: "commentStamp:prior:",
  33057. protocol: "*Platform-ImportExport",
  33058. fn: function (aStamp,prior){
  33059. var self=this,$self=this;
  33060. return $core.withContext(function($ctx1) {
  33061. return $self._commentStamp();
  33062. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33063. },
  33064. args: ["aStamp", "prior"],
  33065. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33066. referencedClasses: [],
  33067. messageSends: ["commentStamp"]
  33068. }),
  33069. $globals.TMasterBehavior);
  33070. $core.addMethod(
  33071. $core.method({
  33072. selector: "exportBehaviorDefinitionTo:using:",
  33073. protocol: "*Platform-ImportExport",
  33074. fn: function (aStream,anExporter){
  33075. var self=this,$self=this;
  33076. return $core.withContext(function($ctx1) {
  33077. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33078. return self;
  33079. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33080. },
  33081. args: ["aStream", "anExporter"],
  33082. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33083. referencedClasses: [],
  33084. messageSends: ["exportTraitDefinitionOf:on:"]
  33085. }),
  33086. $globals.Trait);
  33087. });
  33088. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  33089. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33090. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33091. $core.addPackage("Compiler-Core");
  33092. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  33093. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33094. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  33095. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  33096. $core.addMethod(
  33097. $core.method({
  33098. selector: "compileNode:",
  33099. protocol: "compiling",
  33100. fn: function (aNode){
  33101. var self=this,$self=this;
  33102. return $core.withContext(function($ctx1) {
  33103. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  33104. return $core.withContext(function($ctx2) {
  33105. return $recv(transformer)._value_(input);
  33106. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  33107. }));
  33108. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  33109. },
  33110. args: ["aNode"],
  33111. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  33112. referencedClasses: [],
  33113. messageSends: ["inject:into:", "transformers", "value:"]
  33114. }),
  33115. $globals.AbstractCodeGenerator);
  33116. $core.addMethod(
  33117. $core.method({
  33118. selector: "currentClass",
  33119. protocol: "accessing",
  33120. fn: function (){
  33121. var self=this,$self=this;
  33122. return $self["@currentClass"];
  33123. },
  33124. args: [],
  33125. source: "currentClass\x0a\x09^ currentClass",
  33126. referencedClasses: [],
  33127. messageSends: []
  33128. }),
  33129. $globals.AbstractCodeGenerator);
  33130. $core.addMethod(
  33131. $core.method({
  33132. selector: "currentClass:",
  33133. protocol: "accessing",
  33134. fn: function (aClass){
  33135. var self=this,$self=this;
  33136. $self["@currentClass"]=aClass;
  33137. return self;
  33138. },
  33139. args: ["aClass"],
  33140. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33141. referencedClasses: [],
  33142. messageSends: []
  33143. }),
  33144. $globals.AbstractCodeGenerator);
  33145. $core.addMethod(
  33146. $core.method({
  33147. selector: "currentPackage",
  33148. protocol: "accessing",
  33149. fn: function (){
  33150. var self=this,$self=this;
  33151. return $self["@currentPackage"];
  33152. },
  33153. args: [],
  33154. source: "currentPackage\x0a\x09^ currentPackage",
  33155. referencedClasses: [],
  33156. messageSends: []
  33157. }),
  33158. $globals.AbstractCodeGenerator);
  33159. $core.addMethod(
  33160. $core.method({
  33161. selector: "currentPackage:",
  33162. protocol: "accessing",
  33163. fn: function (anObject){
  33164. var self=this,$self=this;
  33165. $self["@currentPackage"]=anObject;
  33166. return self;
  33167. },
  33168. args: ["anObject"],
  33169. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33170. referencedClasses: [],
  33171. messageSends: []
  33172. }),
  33173. $globals.AbstractCodeGenerator);
  33174. $core.addMethod(
  33175. $core.method({
  33176. selector: "pseudoVariables",
  33177. protocol: "accessing",
  33178. fn: function (){
  33179. var self=this,$self=this;
  33180. return $core.withContext(function($ctx1) {
  33181. return $recv($globals.Smalltalk)._pseudoVariableNames();
  33182. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  33183. },
  33184. args: [],
  33185. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  33186. referencedClasses: ["Smalltalk"],
  33187. messageSends: ["pseudoVariableNames"]
  33188. }),
  33189. $globals.AbstractCodeGenerator);
  33190. $core.addMethod(
  33191. $core.method({
  33192. selector: "source",
  33193. protocol: "accessing",
  33194. fn: function (){
  33195. var self=this,$self=this;
  33196. return $core.withContext(function($ctx1) {
  33197. var $1,$receiver;
  33198. $1=$self["@source"];
  33199. if(($receiver = $1) == null || $receiver.a$nil){
  33200. return "";
  33201. } else {
  33202. return $1;
  33203. }
  33204. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  33205. },
  33206. args: [],
  33207. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33208. referencedClasses: [],
  33209. messageSends: ["ifNil:"]
  33210. }),
  33211. $globals.AbstractCodeGenerator);
  33212. $core.addMethod(
  33213. $core.method({
  33214. selector: "source:",
  33215. protocol: "accessing",
  33216. fn: function (aString){
  33217. var self=this,$self=this;
  33218. $self["@source"]=aString;
  33219. return self;
  33220. },
  33221. args: ["aString"],
  33222. source: "source: aString\x0a\x09source := aString",
  33223. referencedClasses: [],
  33224. messageSends: []
  33225. }),
  33226. $globals.AbstractCodeGenerator);
  33227. $core.addMethod(
  33228. $core.method({
  33229. selector: "transformers",
  33230. protocol: "compiling",
  33231. fn: function (){
  33232. var self=this,$self=this;
  33233. var dict;
  33234. return $core.withContext(function($ctx1) {
  33235. dict=$self._transformersDictionary();
  33236. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  33237. return $core.withContext(function($ctx2) {
  33238. return $recv(dict)._at_(each);
  33239. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33240. }));
  33241. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  33242. },
  33243. args: [],
  33244. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  33245. referencedClasses: [],
  33246. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  33247. }),
  33248. $globals.AbstractCodeGenerator);
  33249. $core.addMethod(
  33250. $core.method({
  33251. selector: "transformersDictionary",
  33252. protocol: "compiling",
  33253. fn: function (){
  33254. var self=this,$self=this;
  33255. return $core.withContext(function($ctx1) {
  33256. $self._subclassResponsibility();
  33257. return self;
  33258. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  33259. },
  33260. args: [],
  33261. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  33262. referencedClasses: [],
  33263. messageSends: ["subclassResponsibility"]
  33264. }),
  33265. $globals.AbstractCodeGenerator);
  33266. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  33267. $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.";
  33268. $core.addMethod(
  33269. $core.method({
  33270. selector: "irTranslator",
  33271. protocol: "compiling",
  33272. fn: function (){
  33273. var self=this,$self=this;
  33274. return $core.withContext(function($ctx1) {
  33275. var $1;
  33276. $1=$recv($self._irTranslatorClass())._new();
  33277. $recv($1)._currentClass_($self._currentClass());
  33278. return $recv($1)._yourself();
  33279. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  33280. },
  33281. args: [],
  33282. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  33283. referencedClasses: [],
  33284. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  33285. }),
  33286. $globals.CodeGenerator);
  33287. $core.addMethod(
  33288. $core.method({
  33289. selector: "irTranslatorClass",
  33290. protocol: "compiling",
  33291. fn: function (){
  33292. var self=this,$self=this;
  33293. return $globals.IRJSTranslator;
  33294. },
  33295. args: [],
  33296. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  33297. referencedClasses: ["IRJSTranslator"],
  33298. messageSends: []
  33299. }),
  33300. $globals.CodeGenerator);
  33301. $core.addMethod(
  33302. $core.method({
  33303. selector: "semanticAnalyzer",
  33304. protocol: "compiling",
  33305. fn: function (){
  33306. var self=this,$self=this;
  33307. return $core.withContext(function($ctx1) {
  33308. var $1;
  33309. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  33310. $recv($1)._thePackage_($self._currentPackage());
  33311. return $recv($1)._yourself();
  33312. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  33313. },
  33314. args: [],
  33315. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  33316. referencedClasses: ["SemanticAnalyzer"],
  33317. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  33318. }),
  33319. $globals.CodeGenerator);
  33320. $core.addMethod(
  33321. $core.method({
  33322. selector: "transformersDictionary",
  33323. protocol: "compiling",
  33324. fn: function (){
  33325. var self=this,$self=this;
  33326. return $core.withContext(function($ctx1) {
  33327. var $1,$2,$receiver;
  33328. $1=$self["@transformersDictionary"];
  33329. if(($receiver = $1) == null || $receiver.a$nil){
  33330. $2=$recv($globals.Dictionary)._new();
  33331. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  33332. $ctx1.sendIdx["at:put:"]=1;
  33333. $recv($2)._at_put_("5000-astToIr",$self._translator());
  33334. $ctx1.sendIdx["at:put:"]=2;
  33335. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  33336. $self["@transformersDictionary"]=$recv($2)._yourself();
  33337. return $self["@transformersDictionary"];
  33338. } else {
  33339. return $1;
  33340. }
  33341. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  33342. },
  33343. args: [],
  33344. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  33345. referencedClasses: ["Dictionary"],
  33346. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  33347. }),
  33348. $globals.CodeGenerator);
  33349. $core.addMethod(
  33350. $core.method({
  33351. selector: "translator",
  33352. protocol: "compiling",
  33353. fn: function (){
  33354. var self=this,$self=this;
  33355. return $core.withContext(function($ctx1) {
  33356. var $1;
  33357. $1=$recv($globals.IRASTTranslator)._new();
  33358. $recv($1)._source_($self._source());
  33359. $recv($1)._theClass_($self._currentClass());
  33360. return $recv($1)._yourself();
  33361. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  33362. },
  33363. args: [],
  33364. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  33365. referencedClasses: ["IRASTTranslator"],
  33366. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  33367. }),
  33368. $globals.CodeGenerator);
  33369. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass"], "Compiler-Core");
  33370. $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`";
  33371. $core.addMethod(
  33372. $core.method({
  33373. selector: "codeGeneratorClass",
  33374. protocol: "accessing",
  33375. fn: function (){
  33376. var self=this,$self=this;
  33377. return $core.withContext(function($ctx1) {
  33378. var $1,$receiver;
  33379. $1=$self["@codeGeneratorClass"];
  33380. if(($receiver = $1) == null || $receiver.a$nil){
  33381. return $globals.InliningCodeGenerator;
  33382. } else {
  33383. return $1;
  33384. }
  33385. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  33386. },
  33387. args: [],
  33388. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  33389. referencedClasses: ["InliningCodeGenerator"],
  33390. messageSends: ["ifNil:"]
  33391. }),
  33392. $globals.Compiler);
  33393. $core.addMethod(
  33394. $core.method({
  33395. selector: "codeGeneratorClass:",
  33396. protocol: "accessing",
  33397. fn: function (aClass){
  33398. var self=this,$self=this;
  33399. $self["@codeGeneratorClass"]=aClass;
  33400. return self;
  33401. },
  33402. args: ["aClass"],
  33403. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  33404. referencedClasses: [],
  33405. messageSends: []
  33406. }),
  33407. $globals.Compiler);
  33408. $core.addMethod(
  33409. $core.method({
  33410. selector: "compile:forClass:protocol:",
  33411. protocol: "compiling",
  33412. fn: function (aString,aClass,anotherString){
  33413. var self=this,$self=this;
  33414. return $core.withContext(function($ctx1) {
  33415. $self._source_(aString);
  33416. return $self._compileNode_forClass_package_($self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  33417. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  33418. },
  33419. args: ["aString", "aClass", "anotherString"],
  33420. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  33421. referencedClasses: [],
  33422. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  33423. }),
  33424. $globals.Compiler);
  33425. $core.addMethod(
  33426. $core.method({
  33427. selector: "compileExpression:on:",
  33428. protocol: "compiling",
  33429. fn: function (aString,anObject){
  33430. var self=this,$self=this;
  33431. return $core.withContext(function($ctx1) {
  33432. var $1;
  33433. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  33434. $ctx1.sendIdx[","]=1;
  33435. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  33436. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  33437. },
  33438. args: ["aString", "anObject"],
  33439. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  33440. referencedClasses: [],
  33441. messageSends: ["compile:forClass:protocol:", ",", "class"]
  33442. }),
  33443. $globals.Compiler);
  33444. $core.addMethod(
  33445. $core.method({
  33446. selector: "compileNode:",
  33447. protocol: "compiling",
  33448. fn: function (aNode){
  33449. var self=this,$self=this;
  33450. var generator,result;
  33451. return $core.withContext(function($ctx1) {
  33452. var $1;
  33453. generator=$recv($self._codeGeneratorClass())._new();
  33454. $1=generator;
  33455. $recv($1)._source_($self._source());
  33456. $recv($1)._currentClass_($self._currentClass());
  33457. $recv($1)._currentPackage_($self._currentPackage());
  33458. result=$recv(generator)._compileNode_(aNode);
  33459. return result;
  33460. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  33461. },
  33462. args: ["aNode"],
  33463. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09^ result",
  33464. referencedClasses: [],
  33465. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:"]
  33466. }),
  33467. $globals.Compiler);
  33468. $core.addMethod(
  33469. $core.method({
  33470. selector: "compileNode:forClass:package:",
  33471. protocol: "compiling",
  33472. fn: function (aNode,aClass,aPackage){
  33473. var self=this,$self=this;
  33474. return $core.withContext(function($ctx1) {
  33475. $self._currentClass_(aClass);
  33476. $self._currentPackage_(aPackage);
  33477. return $self._compileNode_(aNode);
  33478. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  33479. },
  33480. args: ["aNode", "aClass", "aPackage"],
  33481. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  33482. referencedClasses: [],
  33483. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  33484. }),
  33485. $globals.Compiler);
  33486. $core.addMethod(
  33487. $core.method({
  33488. selector: "currentClass",
  33489. protocol: "accessing",
  33490. fn: function (){
  33491. var self=this,$self=this;
  33492. return $self["@currentClass"];
  33493. },
  33494. args: [],
  33495. source: "currentClass\x0a\x09^ currentClass",
  33496. referencedClasses: [],
  33497. messageSends: []
  33498. }),
  33499. $globals.Compiler);
  33500. $core.addMethod(
  33501. $core.method({
  33502. selector: "currentClass:",
  33503. protocol: "accessing",
  33504. fn: function (aClass){
  33505. var self=this,$self=this;
  33506. $self["@currentClass"]=aClass;
  33507. return self;
  33508. },
  33509. args: ["aClass"],
  33510. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33511. referencedClasses: [],
  33512. messageSends: []
  33513. }),
  33514. $globals.Compiler);
  33515. $core.addMethod(
  33516. $core.method({
  33517. selector: "currentPackage",
  33518. protocol: "accessing",
  33519. fn: function (){
  33520. var self=this,$self=this;
  33521. return $self["@currentPackage"];
  33522. },
  33523. args: [],
  33524. source: "currentPackage\x0a\x09^ currentPackage",
  33525. referencedClasses: [],
  33526. messageSends: []
  33527. }),
  33528. $globals.Compiler);
  33529. $core.addMethod(
  33530. $core.method({
  33531. selector: "currentPackage:",
  33532. protocol: "accessing",
  33533. fn: function (anObject){
  33534. var self=this,$self=this;
  33535. $self["@currentPackage"]=anObject;
  33536. return self;
  33537. },
  33538. args: ["anObject"],
  33539. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33540. referencedClasses: [],
  33541. messageSends: []
  33542. }),
  33543. $globals.Compiler);
  33544. $core.addMethod(
  33545. $core.method({
  33546. selector: "eval:",
  33547. protocol: "compiling",
  33548. fn: function (aString){
  33549. var self=this,$self=this;
  33550. return $core.withContext(function($ctx1) {
  33551. return eval(aString);
  33552. return self;
  33553. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  33554. },
  33555. args: ["aString"],
  33556. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  33557. referencedClasses: [],
  33558. messageSends: []
  33559. }),
  33560. $globals.Compiler);
  33561. $core.addMethod(
  33562. $core.method({
  33563. selector: "eval:forPackage:",
  33564. protocol: "compiling",
  33565. fn: function (aString,aPackage){
  33566. var self=this,$self=this;
  33567. return $core.withContext(function($ctx1) {
  33568. var $receiver;
  33569. if(($receiver = aPackage) == null || $receiver.a$nil){
  33570. return $self._eval_(aString);
  33571. $ctx1.sendIdx["eval:"]=1;
  33572. } else {
  33573. return $recv(aPackage)._eval_(aString);
  33574. }
  33575. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  33576. },
  33577. args: ["aString", "aPackage"],
  33578. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  33579. referencedClasses: [],
  33580. messageSends: ["ifNil:ifNotNil:", "eval:"]
  33581. }),
  33582. $globals.Compiler);
  33583. $core.addMethod(
  33584. $core.method({
  33585. selector: "evaluateExpression:",
  33586. protocol: "compiling",
  33587. fn: function (aString){
  33588. var self=this,$self=this;
  33589. return $core.withContext(function($ctx1) {
  33590. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  33591. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  33592. },
  33593. args: ["aString"],
  33594. 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",
  33595. referencedClasses: ["DoIt"],
  33596. messageSends: ["evaluateExpression:on:", "new"]
  33597. }),
  33598. $globals.Compiler);
  33599. $core.addMethod(
  33600. $core.method({
  33601. selector: "evaluateExpression:on:",
  33602. protocol: "compiling",
  33603. fn: function (aString,anObject){
  33604. var self=this,$self=this;
  33605. var result,method;
  33606. return $core.withContext(function($ctx1) {
  33607. var $1;
  33608. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  33609. $recv(method)._protocol_("**xxxDoIt");
  33610. $1=$recv(anObject)._class();
  33611. $ctx1.sendIdx["class"]=1;
  33612. $recv($1)._addCompiledMethod_(method);
  33613. result=$recv(anObject)._xxxDoIt();
  33614. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  33615. return result;
  33616. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  33617. },
  33618. args: ["aString", "anObject"],
  33619. 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",
  33620. referencedClasses: [],
  33621. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  33622. }),
  33623. $globals.Compiler);
  33624. $core.addMethod(
  33625. $core.method({
  33626. selector: "install:forClass:protocol:",
  33627. protocol: "compiling",
  33628. fn: function (aString,aBehavior,anotherString){
  33629. var self=this,$self=this;
  33630. var compiledMethod;
  33631. return $core.withContext(function($ctx1) {
  33632. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  33633. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  33634. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  33635. },
  33636. args: ["aString", "aBehavior", "anotherString"],
  33637. 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",
  33638. referencedClasses: ["ClassBuilder"],
  33639. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  33640. }),
  33641. $globals.Compiler);
  33642. $core.addMethod(
  33643. $core.method({
  33644. selector: "parse:",
  33645. protocol: "compiling",
  33646. fn: function (aString){
  33647. var self=this,$self=this;
  33648. return $core.withContext(function($ctx1) {
  33649. return $recv($globals.Smalltalk)._parse_(aString);
  33650. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  33651. },
  33652. args: ["aString"],
  33653. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  33654. referencedClasses: ["Smalltalk"],
  33655. messageSends: ["parse:"]
  33656. }),
  33657. $globals.Compiler);
  33658. $core.addMethod(
  33659. $core.method({
  33660. selector: "parseExpression:",
  33661. protocol: "compiling",
  33662. fn: function (aString){
  33663. var self=this,$self=this;
  33664. return $core.withContext(function($ctx1) {
  33665. var $1;
  33666. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  33667. $ctx1.sendIdx[","]=1;
  33668. return $self._parse_($1);
  33669. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  33670. },
  33671. args: ["aString"],
  33672. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  33673. referencedClasses: [],
  33674. messageSends: ["parse:", ","]
  33675. }),
  33676. $globals.Compiler);
  33677. $core.addMethod(
  33678. $core.method({
  33679. selector: "recompile:",
  33680. protocol: "compiling",
  33681. fn: function (aClass){
  33682. var self=this,$self=this;
  33683. return $core.withContext(function($ctx1) {
  33684. var $1,$2,$3,$receiver;
  33685. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  33686. return $core.withContext(function($ctx2) {
  33687. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  33688. $ctx2.sendIdx["="]=1;
  33689. if($core.assert($1)){
  33690. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  33691. }
  33692. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33693. }),"Recompiling ".__comma($recv(aClass)._name()));
  33694. $2=$recv(aClass)._theMetaClass();
  33695. if(($receiver = $2) == null || $receiver.a$nil){
  33696. $2;
  33697. } else {
  33698. var meta;
  33699. meta=$receiver;
  33700. $3=$recv(meta).__eq(aClass);
  33701. if(!$core.assert($3)){
  33702. $self._recompile_(meta);
  33703. }
  33704. }
  33705. return self;
  33706. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  33707. },
  33708. args: ["aClass"],
  33709. 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 ] ]",
  33710. referencedClasses: [],
  33711. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  33712. }),
  33713. $globals.Compiler);
  33714. $core.addMethod(
  33715. $core.method({
  33716. selector: "recompileAll",
  33717. protocol: "compiling",
  33718. fn: function (){
  33719. var self=this,$self=this;
  33720. return $core.withContext(function($ctx1) {
  33721. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  33722. return $core.withContext(function($ctx2) {
  33723. return $self._recompile_(each);
  33724. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33725. }),"Compiling all classes...");
  33726. return self;
  33727. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  33728. },
  33729. args: [],
  33730. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  33731. referencedClasses: ["Smalltalk"],
  33732. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  33733. }),
  33734. $globals.Compiler);
  33735. $core.addMethod(
  33736. $core.method({
  33737. selector: "source",
  33738. protocol: "accessing",
  33739. fn: function (){
  33740. var self=this,$self=this;
  33741. return $core.withContext(function($ctx1) {
  33742. var $1,$receiver;
  33743. $1=$self["@source"];
  33744. if(($receiver = $1) == null || $receiver.a$nil){
  33745. return "";
  33746. } else {
  33747. return $1;
  33748. }
  33749. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  33750. },
  33751. args: [],
  33752. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33753. referencedClasses: [],
  33754. messageSends: ["ifNil:"]
  33755. }),
  33756. $globals.Compiler);
  33757. $core.addMethod(
  33758. $core.method({
  33759. selector: "source:",
  33760. protocol: "accessing",
  33761. fn: function (aString){
  33762. var self=this,$self=this;
  33763. $self["@source"]=aString;
  33764. return self;
  33765. },
  33766. args: ["aString"],
  33767. source: "source: aString\x0a\x09source := aString",
  33768. referencedClasses: [],
  33769. messageSends: []
  33770. }),
  33771. $globals.Compiler);
  33772. $core.addMethod(
  33773. $core.method({
  33774. selector: "eval:",
  33775. protocol: "evaluating",
  33776. fn: function (aString){
  33777. var self=this,$self=this;
  33778. return $core.withContext(function($ctx1) {
  33779. return $recv($self._new())._eval_(aString);
  33780. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  33781. },
  33782. args: ["aString"],
  33783. source: "eval: aString\x0a\x09^ self new eval: aString",
  33784. referencedClasses: [],
  33785. messageSends: ["eval:", "new"]
  33786. }),
  33787. $globals.Compiler.a$cls);
  33788. $core.addMethod(
  33789. $core.method({
  33790. selector: "recompile:",
  33791. protocol: "compiling",
  33792. fn: function (aClass){
  33793. var self=this,$self=this;
  33794. return $core.withContext(function($ctx1) {
  33795. $recv($self._new())._recompile_(aClass);
  33796. return self;
  33797. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  33798. },
  33799. args: ["aClass"],
  33800. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  33801. referencedClasses: [],
  33802. messageSends: ["recompile:", "new"]
  33803. }),
  33804. $globals.Compiler.a$cls);
  33805. $core.addMethod(
  33806. $core.method({
  33807. selector: "recompileAll",
  33808. protocol: "compiling",
  33809. fn: function (){
  33810. var self=this,$self=this;
  33811. return $core.withContext(function($ctx1) {
  33812. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  33813. return $core.withContext(function($ctx2) {
  33814. return $self._recompile_(each);
  33815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33816. }));
  33817. return self;
  33818. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  33819. },
  33820. args: [],
  33821. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  33822. referencedClasses: ["Smalltalk"],
  33823. messageSends: ["do:", "classes", "recompile:"]
  33824. }),
  33825. $globals.Compiler.a$cls);
  33826. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  33827. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  33828. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  33829. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  33830. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  33831. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  33832. $core.addMethod(
  33833. $core.method({
  33834. selector: "evaluate:context:",
  33835. protocol: "evaluating",
  33836. fn: function (aString,aContext){
  33837. var self=this,$self=this;
  33838. var compiler,ast;
  33839. return $core.withContext(function($ctx1) {
  33840. var $1;
  33841. var $early={};
  33842. try {
  33843. compiler=$recv($globals.Compiler)._new();
  33844. $recv((function(){
  33845. return $core.withContext(function($ctx2) {
  33846. ast=$recv(compiler)._parseExpression_(aString);
  33847. return ast;
  33848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33849. }))._on_do_($globals.Error,(function(ex){
  33850. return $core.withContext(function($ctx2) {
  33851. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  33852. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  33853. }));
  33854. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  33855. $recv($1)._context_(aContext);
  33856. $recv($1)._visit_(ast);
  33857. return $recv(aContext)._evaluateNode_(ast);
  33858. }
  33859. catch(e) {if(e===$early)return e[0]; throw e}
  33860. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  33861. },
  33862. args: ["aString", "aContext"],
  33863. 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",
  33864. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  33865. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  33866. }),
  33867. $globals.Evaluator);
  33868. $core.addMethod(
  33869. $core.method({
  33870. selector: "evaluate:for:",
  33871. protocol: "evaluating",
  33872. fn: function (aString,anObject){
  33873. var self=this,$self=this;
  33874. return $core.withContext(function($ctx1) {
  33875. return $recv(anObject)._evaluate_on_(aString,self);
  33876. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  33877. },
  33878. args: ["aString", "anObject"],
  33879. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  33880. referencedClasses: [],
  33881. messageSends: ["evaluate:on:"]
  33882. }),
  33883. $globals.Evaluator);
  33884. $core.addMethod(
  33885. $core.method({
  33886. selector: "evaluate:receiver:",
  33887. protocol: "evaluating",
  33888. fn: function (aString,anObject){
  33889. var self=this,$self=this;
  33890. var compiler;
  33891. return $core.withContext(function($ctx1) {
  33892. var $early={};
  33893. try {
  33894. compiler=$recv($globals.Compiler)._new();
  33895. $recv((function(){
  33896. return $core.withContext(function($ctx2) {
  33897. return $recv(compiler)._parseExpression_(aString);
  33898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33899. }))._on_do_($globals.Error,(function(ex){
  33900. return $core.withContext(function($ctx2) {
  33901. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  33902. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  33903. }));
  33904. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  33905. }
  33906. catch(e) {if(e===$early)return e[0]; throw e}
  33907. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  33908. },
  33909. args: ["aString", "anObject"],
  33910. 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",
  33911. referencedClasses: ["Compiler", "Error", "Terminal"],
  33912. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  33913. }),
  33914. $globals.Evaluator);
  33915. $core.addMethod(
  33916. $core.method({
  33917. selector: "evaluate:for:",
  33918. protocol: "instance creation",
  33919. fn: function (aString,anObject){
  33920. var self=this,$self=this;
  33921. return $core.withContext(function($ctx1) {
  33922. return $recv($self._new())._evaluate_for_(aString,anObject);
  33923. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  33924. },
  33925. args: ["aString", "anObject"],
  33926. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  33927. referencedClasses: [],
  33928. messageSends: ["evaluate:for:", "new"]
  33929. }),
  33930. $globals.Evaluator.a$cls);
  33931. $core.addMethod(
  33932. $core.method({
  33933. selector: "asVariableName",
  33934. protocol: "*Compiler-Core",
  33935. fn: function (){
  33936. var self=this,$self=this;
  33937. return $core.withContext(function($ctx1) {
  33938. var $1;
  33939. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  33940. if($core.assert($1)){
  33941. return $self.__comma("_");
  33942. } else {
  33943. return self;
  33944. }
  33945. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  33946. },
  33947. args: [],
  33948. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  33949. referencedClasses: ["Smalltalk"],
  33950. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  33951. }),
  33952. $globals.String);
  33953. });
  33954. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33955. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33956. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33957. $core.addPackage("Compiler-AST");
  33958. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  33959. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33960. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33961. $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.";
  33962. $core.addMethod(
  33963. $core.method({
  33964. selector: "inPosition:",
  33965. protocol: "testing",
  33966. fn: function (aPoint){
  33967. var self=this,$self=this;
  33968. return $core.withContext(function($ctx1) {
  33969. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33970. return $core.withContext(function($ctx2) {
  33971. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33973. }));
  33974. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33975. },
  33976. args: ["aPoint"],
  33977. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33978. referencedClasses: [],
  33979. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33980. }),
  33981. $globals.ASTNode);
  33982. $core.addMethod(
  33983. $core.method({
  33984. selector: "isAssignmentNode",
  33985. protocol: "testing",
  33986. fn: function (){
  33987. var self=this,$self=this;
  33988. return false;
  33989. },
  33990. args: [],
  33991. source: "isAssignmentNode\x0a\x09^ false",
  33992. referencedClasses: [],
  33993. messageSends: []
  33994. }),
  33995. $globals.ASTNode);
  33996. $core.addMethod(
  33997. $core.method({
  33998. selector: "isBlockNode",
  33999. protocol: "testing",
  34000. fn: function (){
  34001. var self=this,$self=this;
  34002. return false;
  34003. },
  34004. args: [],
  34005. source: "isBlockNode\x0a\x09^ false",
  34006. referencedClasses: [],
  34007. messageSends: []
  34008. }),
  34009. $globals.ASTNode);
  34010. $core.addMethod(
  34011. $core.method({
  34012. selector: "isBlockSequenceNode",
  34013. protocol: "testing",
  34014. fn: function (){
  34015. var self=this,$self=this;
  34016. return false;
  34017. },
  34018. args: [],
  34019. source: "isBlockSequenceNode\x0a\x09^ false",
  34020. referencedClasses: [],
  34021. messageSends: []
  34022. }),
  34023. $globals.ASTNode);
  34024. $core.addMethod(
  34025. $core.method({
  34026. selector: "isCascadeNode",
  34027. protocol: "testing",
  34028. fn: function (){
  34029. var self=this,$self=this;
  34030. return false;
  34031. },
  34032. args: [],
  34033. source: "isCascadeNode\x0a\x09^ false",
  34034. referencedClasses: [],
  34035. messageSends: []
  34036. }),
  34037. $globals.ASTNode);
  34038. $core.addMethod(
  34039. $core.method({
  34040. selector: "isImmutable",
  34041. protocol: "testing",
  34042. fn: function (){
  34043. var self=this,$self=this;
  34044. return false;
  34045. },
  34046. args: [],
  34047. source: "isImmutable\x0a\x09^ false",
  34048. referencedClasses: [],
  34049. messageSends: []
  34050. }),
  34051. $globals.ASTNode);
  34052. $core.addMethod(
  34053. $core.method({
  34054. selector: "isJSStatementNode",
  34055. protocol: "testing",
  34056. fn: function (){
  34057. var self=this,$self=this;
  34058. return false;
  34059. },
  34060. args: [],
  34061. source: "isJSStatementNode\x0a\x09^ false",
  34062. referencedClasses: [],
  34063. messageSends: []
  34064. }),
  34065. $globals.ASTNode);
  34066. $core.addMethod(
  34067. $core.method({
  34068. selector: "isNavigationNode",
  34069. protocol: "testing",
  34070. fn: function (){
  34071. var self=this,$self=this;
  34072. return false;
  34073. },
  34074. args: [],
  34075. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  34076. referencedClasses: [],
  34077. messageSends: []
  34078. }),
  34079. $globals.ASTNode);
  34080. $core.addMethod(
  34081. $core.method({
  34082. selector: "isReturnNode",
  34083. protocol: "testing",
  34084. fn: function (){
  34085. var self=this,$self=this;
  34086. return false;
  34087. },
  34088. args: [],
  34089. source: "isReturnNode\x0a\x09^ false",
  34090. referencedClasses: [],
  34091. messageSends: []
  34092. }),
  34093. $globals.ASTNode);
  34094. $core.addMethod(
  34095. $core.method({
  34096. selector: "isSendNode",
  34097. protocol: "testing",
  34098. fn: function (){
  34099. var self=this,$self=this;
  34100. return false;
  34101. },
  34102. args: [],
  34103. source: "isSendNode\x0a\x09^ false",
  34104. referencedClasses: [],
  34105. messageSends: []
  34106. }),
  34107. $globals.ASTNode);
  34108. $core.addMethod(
  34109. $core.method({
  34110. selector: "isSequenceNode",
  34111. protocol: "testing",
  34112. fn: function (){
  34113. var self=this,$self=this;
  34114. return false;
  34115. },
  34116. args: [],
  34117. source: "isSequenceNode\x0a\x09^ false",
  34118. referencedClasses: [],
  34119. messageSends: []
  34120. }),
  34121. $globals.ASTNode);
  34122. $core.addMethod(
  34123. $core.method({
  34124. selector: "isSuperKeyword",
  34125. protocol: "testing",
  34126. fn: function (){
  34127. var self=this,$self=this;
  34128. return false;
  34129. },
  34130. args: [],
  34131. source: "isSuperKeyword\x0a\x09^ false",
  34132. referencedClasses: [],
  34133. messageSends: []
  34134. }),
  34135. $globals.ASTNode);
  34136. $core.addMethod(
  34137. $core.method({
  34138. selector: "isValueNode",
  34139. protocol: "testing",
  34140. fn: function (){
  34141. var self=this,$self=this;
  34142. return false;
  34143. },
  34144. args: [],
  34145. source: "isValueNode\x0a\x09^ false",
  34146. referencedClasses: [],
  34147. messageSends: []
  34148. }),
  34149. $globals.ASTNode);
  34150. $core.addMethod(
  34151. $core.method({
  34152. selector: "isVariableNode",
  34153. protocol: "testing",
  34154. fn: function (){
  34155. var self=this,$self=this;
  34156. return false;
  34157. },
  34158. args: [],
  34159. source: "isVariableNode\x0a\x09^ false",
  34160. referencedClasses: [],
  34161. messageSends: []
  34162. }),
  34163. $globals.ASTNode);
  34164. $core.addMethod(
  34165. $core.method({
  34166. selector: "location:",
  34167. protocol: "accessing",
  34168. fn: function (aLocation){
  34169. var self=this,$self=this;
  34170. return $core.withContext(function($ctx1) {
  34171. var $3,$2,$1;
  34172. $3=$recv(aLocation)._start();
  34173. $ctx1.sendIdx["start"]=1;
  34174. $2=$recv($3)._line();
  34175. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  34176. $self._position_($1);
  34177. return self;
  34178. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  34179. },
  34180. args: ["aLocation"],
  34181. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  34182. referencedClasses: [],
  34183. messageSends: ["position:", "@", "line", "start", "column"]
  34184. }),
  34185. $globals.ASTNode);
  34186. $core.addMethod(
  34187. $core.method({
  34188. selector: "method",
  34189. protocol: "accessing",
  34190. fn: function (){
  34191. var self=this,$self=this;
  34192. return $core.withContext(function($ctx1) {
  34193. var $1,$receiver;
  34194. $1=$self._parent();
  34195. if(($receiver = $1) == null || $receiver.a$nil){
  34196. return $1;
  34197. } else {
  34198. var node;
  34199. node=$receiver;
  34200. return $recv(node)._method();
  34201. }
  34202. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  34203. },
  34204. args: [],
  34205. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  34206. referencedClasses: [],
  34207. messageSends: ["ifNotNil:", "parent", "method"]
  34208. }),
  34209. $globals.ASTNode);
  34210. $core.addMethod(
  34211. $core.method({
  34212. selector: "navigationNodeAt:ifAbsent:",
  34213. protocol: "accessing",
  34214. fn: function (aPoint,aBlock){
  34215. var self=this,$self=this;
  34216. var children;
  34217. return $core.withContext(function($ctx1) {
  34218. var $2,$1;
  34219. var $early={};
  34220. try {
  34221. children=$recv($self._allDagChildren())._select_((function(each){
  34222. return $core.withContext(function($ctx2) {
  34223. return $recv($recv(each)._isNavigationNode())._and_((function(){
  34224. return $core.withContext(function($ctx3) {
  34225. return $recv(each)._inPosition_(aPoint);
  34226. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34227. }));
  34228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34229. }));
  34230. $recv(children)._ifEmpty_((function(){
  34231. return $core.withContext(function($ctx2) {
  34232. throw $early=[$recv(aBlock)._value()];
  34233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  34234. }));
  34235. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  34236. return $core.withContext(function($ctx2) {
  34237. $2=$recv(a)._positionStart();
  34238. $ctx2.sendIdx["positionStart"]=1;
  34239. $1=$recv($2)._dist_(aPoint);
  34240. $ctx2.sendIdx["dist:"]=1;
  34241. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  34242. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  34243. })))._first();
  34244. }
  34245. catch(e) {if(e===$early)return e[0]; throw e}
  34246. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  34247. },
  34248. args: ["aPoint", "aBlock"],
  34249. 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",
  34250. referencedClasses: [],
  34251. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  34252. }),
  34253. $globals.ASTNode);
  34254. $core.addMethod(
  34255. $core.method({
  34256. selector: "parent",
  34257. protocol: "accessing",
  34258. fn: function (){
  34259. var self=this,$self=this;
  34260. return $self["@parent"];
  34261. },
  34262. args: [],
  34263. source: "parent\x0a\x09^ parent",
  34264. referencedClasses: [],
  34265. messageSends: []
  34266. }),
  34267. $globals.ASTNode);
  34268. $core.addMethod(
  34269. $core.method({
  34270. selector: "parent:",
  34271. protocol: "accessing",
  34272. fn: function (aNode){
  34273. var self=this,$self=this;
  34274. $self["@parent"]=aNode;
  34275. return self;
  34276. },
  34277. args: ["aNode"],
  34278. source: "parent: aNode\x0a\x09parent := aNode",
  34279. referencedClasses: [],
  34280. messageSends: []
  34281. }),
  34282. $globals.ASTNode);
  34283. $core.addMethod(
  34284. $core.method({
  34285. selector: "position",
  34286. protocol: "accessing",
  34287. fn: function (){
  34288. var self=this,$self=this;
  34289. return $core.withContext(function($ctx1) {
  34290. var $1,$2,$receiver;
  34291. $1=$self["@position"];
  34292. if(($receiver = $1) == null || $receiver.a$nil){
  34293. $2=$self._parent();
  34294. if(($receiver = $2) == null || $receiver.a$nil){
  34295. return $2;
  34296. } else {
  34297. var node;
  34298. node=$receiver;
  34299. return $recv(node)._position();
  34300. }
  34301. } else {
  34302. return $1;
  34303. }
  34304. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  34305. },
  34306. args: [],
  34307. 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 ] ]",
  34308. referencedClasses: [],
  34309. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  34310. }),
  34311. $globals.ASTNode);
  34312. $core.addMethod(
  34313. $core.method({
  34314. selector: "position:",
  34315. protocol: "accessing",
  34316. fn: function (aPosition){
  34317. var self=this,$self=this;
  34318. $self["@position"]=aPosition;
  34319. return self;
  34320. },
  34321. args: ["aPosition"],
  34322. source: "position: aPosition\x0a\x09position := aPosition",
  34323. referencedClasses: [],
  34324. messageSends: []
  34325. }),
  34326. $globals.ASTNode);
  34327. $core.addMethod(
  34328. $core.method({
  34329. selector: "positionEnd",
  34330. protocol: "accessing",
  34331. fn: function (){
  34332. var self=this,$self=this;
  34333. return $core.withContext(function($ctx1) {
  34334. var $1,$6,$5,$4,$3,$2;
  34335. $1=$self._positionStart();
  34336. $6=$self._source();
  34337. $ctx1.sendIdx["source"]=1;
  34338. $5=$recv($6)._lines();
  34339. $ctx1.sendIdx["lines"]=1;
  34340. $4=$recv($5)._size();
  34341. $ctx1.sendIdx["size"]=1;
  34342. $3=$recv($4).__minus((1));
  34343. $ctx1.sendIdx["-"]=1;
  34344. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  34345. return $recv($1).__plus($2);
  34346. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  34347. },
  34348. args: [],
  34349. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  34350. referencedClasses: [],
  34351. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  34352. }),
  34353. $globals.ASTNode);
  34354. $core.addMethod(
  34355. $core.method({
  34356. selector: "positionStart",
  34357. protocol: "accessing",
  34358. fn: function (){
  34359. var self=this,$self=this;
  34360. return $core.withContext(function($ctx1) {
  34361. return $self._position();
  34362. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  34363. },
  34364. args: [],
  34365. source: "positionStart\x0a\x09^ self position",
  34366. referencedClasses: [],
  34367. messageSends: ["position"]
  34368. }),
  34369. $globals.ASTNode);
  34370. $core.addMethod(
  34371. $core.method({
  34372. selector: "requiresSmalltalkContext",
  34373. protocol: "testing",
  34374. fn: function (){
  34375. var self=this,$self=this;
  34376. return $core.withContext(function($ctx1) {
  34377. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  34378. return $core.withContext(function($ctx2) {
  34379. return $recv(each)._requiresSmalltalkContext();
  34380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34381. }),(function(){
  34382. return nil;
  34383. })))._notNil();
  34384. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  34385. },
  34386. args: [],
  34387. 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",
  34388. referencedClasses: [],
  34389. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  34390. }),
  34391. $globals.ASTNode);
  34392. $core.addMethod(
  34393. $core.method({
  34394. selector: "shouldBeAliased",
  34395. protocol: "accessing",
  34396. fn: function (){
  34397. var self=this,$self=this;
  34398. return $core.withContext(function($ctx1) {
  34399. var $1,$receiver;
  34400. $1=$self["@shouldBeAliased"];
  34401. if(($receiver = $1) == null || $receiver.a$nil){
  34402. return false;
  34403. } else {
  34404. return $1;
  34405. }
  34406. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  34407. },
  34408. args: [],
  34409. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  34410. referencedClasses: [],
  34411. messageSends: ["ifNil:"]
  34412. }),
  34413. $globals.ASTNode);
  34414. $core.addMethod(
  34415. $core.method({
  34416. selector: "shouldBeAliased:",
  34417. protocol: "accessing",
  34418. fn: function (aBoolean){
  34419. var self=this,$self=this;
  34420. $self["@shouldBeAliased"]=aBoolean;
  34421. return self;
  34422. },
  34423. args: ["aBoolean"],
  34424. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  34425. referencedClasses: [],
  34426. messageSends: []
  34427. }),
  34428. $globals.ASTNode);
  34429. $core.addMethod(
  34430. $core.method({
  34431. selector: "size",
  34432. protocol: "accessing",
  34433. fn: function (){
  34434. var self=this,$self=this;
  34435. return $core.withContext(function($ctx1) {
  34436. return $recv($self._source())._size();
  34437. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  34438. },
  34439. args: [],
  34440. source: "size\x0a\x09^ self source size",
  34441. referencedClasses: [],
  34442. messageSends: ["size", "source"]
  34443. }),
  34444. $globals.ASTNode);
  34445. $core.addMethod(
  34446. $core.method({
  34447. selector: "source",
  34448. protocol: "accessing",
  34449. fn: function (){
  34450. var self=this,$self=this;
  34451. return $core.withContext(function($ctx1) {
  34452. var $1,$receiver;
  34453. $1=$self["@source"];
  34454. if(($receiver = $1) == null || $receiver.a$nil){
  34455. return "";
  34456. } else {
  34457. return $1;
  34458. }
  34459. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  34460. },
  34461. args: [],
  34462. source: "source\x0a\x09^ source ifNil: [ '' ]",
  34463. referencedClasses: [],
  34464. messageSends: ["ifNil:"]
  34465. }),
  34466. $globals.ASTNode);
  34467. $core.addMethod(
  34468. $core.method({
  34469. selector: "source:",
  34470. protocol: "accessing",
  34471. fn: function (aString){
  34472. var self=this,$self=this;
  34473. $self["@source"]=aString;
  34474. return self;
  34475. },
  34476. args: ["aString"],
  34477. source: "source: aString\x0a\x09source := aString",
  34478. referencedClasses: [],
  34479. messageSends: []
  34480. }),
  34481. $globals.ASTNode);
  34482. $core.addMethod(
  34483. $core.method({
  34484. selector: "withTail:",
  34485. protocol: "building",
  34486. fn: function (aCollection){
  34487. var self=this,$self=this;
  34488. return $core.withContext(function($ctx1) {
  34489. var $1;
  34490. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  34491. return $core.withContext(function($ctx2) {
  34492. $1=$recv($globals.SendNode)._new();
  34493. $recv($1)._position_($recv(send)._position());
  34494. $recv($1)._source_($recv(send)._source());
  34495. $recv($1)._receiver_(receiver);
  34496. $recv($1)._selector_($recv(send)._selector());
  34497. $recv($1)._arguments_($recv(send)._arguments());
  34498. return $recv($1)._yourself();
  34499. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  34500. }));
  34501. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  34502. },
  34503. args: ["aCollection"],
  34504. 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 ]",
  34505. referencedClasses: ["SendNode"],
  34506. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  34507. }),
  34508. $globals.ASTNode);
  34509. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  34510. $globals.AssignmentNode.comment="I represent an assignment node.";
  34511. $core.addMethod(
  34512. $core.method({
  34513. selector: "acceptDagVisitor:",
  34514. protocol: "visiting",
  34515. fn: function (aVisitor){
  34516. var self=this,$self=this;
  34517. return $core.withContext(function($ctx1) {
  34518. return $recv(aVisitor)._visitAssignmentNode_(self);
  34519. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  34520. },
  34521. args: ["aVisitor"],
  34522. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  34523. referencedClasses: [],
  34524. messageSends: ["visitAssignmentNode:"]
  34525. }),
  34526. $globals.AssignmentNode);
  34527. $core.addMethod(
  34528. $core.method({
  34529. selector: "dagChildren",
  34530. protocol: "accessing",
  34531. fn: function (){
  34532. var self=this,$self=this;
  34533. return $core.withContext(function($ctx1) {
  34534. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  34535. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  34536. },
  34537. args: [],
  34538. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  34539. referencedClasses: ["Array"],
  34540. messageSends: ["with:with:", "left", "right"]
  34541. }),
  34542. $globals.AssignmentNode);
  34543. $core.addMethod(
  34544. $core.method({
  34545. selector: "isAssignmentNode",
  34546. protocol: "testing",
  34547. fn: function (){
  34548. var self=this,$self=this;
  34549. return true;
  34550. },
  34551. args: [],
  34552. source: "isAssignmentNode\x0a\x09^ true",
  34553. referencedClasses: [],
  34554. messageSends: []
  34555. }),
  34556. $globals.AssignmentNode);
  34557. $core.addMethod(
  34558. $core.method({
  34559. selector: "left",
  34560. protocol: "accessing",
  34561. fn: function (){
  34562. var self=this,$self=this;
  34563. return $self["@left"];
  34564. },
  34565. args: [],
  34566. source: "left\x0a\x09^ left",
  34567. referencedClasses: [],
  34568. messageSends: []
  34569. }),
  34570. $globals.AssignmentNode);
  34571. $core.addMethod(
  34572. $core.method({
  34573. selector: "left:",
  34574. protocol: "accessing",
  34575. fn: function (aNode){
  34576. var self=this,$self=this;
  34577. $self["@left"]=aNode;
  34578. return self;
  34579. },
  34580. args: ["aNode"],
  34581. source: "left: aNode\x0a\x09left := aNode",
  34582. referencedClasses: [],
  34583. messageSends: []
  34584. }),
  34585. $globals.AssignmentNode);
  34586. $core.addMethod(
  34587. $core.method({
  34588. selector: "right",
  34589. protocol: "accessing",
  34590. fn: function (){
  34591. var self=this,$self=this;
  34592. return $self["@right"];
  34593. },
  34594. args: [],
  34595. source: "right\x0a\x09^ right",
  34596. referencedClasses: [],
  34597. messageSends: []
  34598. }),
  34599. $globals.AssignmentNode);
  34600. $core.addMethod(
  34601. $core.method({
  34602. selector: "right:",
  34603. protocol: "accessing",
  34604. fn: function (aNode){
  34605. var self=this,$self=this;
  34606. $self["@right"]=aNode;
  34607. return self;
  34608. },
  34609. args: ["aNode"],
  34610. source: "right: aNode\x0a\x09right := aNode",
  34611. referencedClasses: [],
  34612. messageSends: []
  34613. }),
  34614. $globals.AssignmentNode);
  34615. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34616. $globals.BlockNode.comment="I represent an block closure node.";
  34617. $core.addMethod(
  34618. $core.method({
  34619. selector: "acceptDagVisitor:",
  34620. protocol: "visiting",
  34621. fn: function (aVisitor){
  34622. var self=this,$self=this;
  34623. return $core.withContext(function($ctx1) {
  34624. return $recv(aVisitor)._visitBlockNode_(self);
  34625. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34626. },
  34627. args: ["aVisitor"],
  34628. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34629. referencedClasses: [],
  34630. messageSends: ["visitBlockNode:"]
  34631. }),
  34632. $globals.BlockNode);
  34633. $core.addMethod(
  34634. $core.method({
  34635. selector: "isBlockNode",
  34636. protocol: "testing",
  34637. fn: function (){
  34638. var self=this,$self=this;
  34639. return true;
  34640. },
  34641. args: [],
  34642. source: "isBlockNode\x0a\x09^ true",
  34643. referencedClasses: [],
  34644. messageSends: []
  34645. }),
  34646. $globals.BlockNode);
  34647. $core.addMethod(
  34648. $core.method({
  34649. selector: "parameters",
  34650. protocol: "accessing",
  34651. fn: function (){
  34652. var self=this,$self=this;
  34653. return $core.withContext(function($ctx1) {
  34654. var $1,$receiver;
  34655. $1=$self["@parameters"];
  34656. if(($receiver = $1) == null || $receiver.a$nil){
  34657. $self["@parameters"]=$recv($globals.Array)._new();
  34658. return $self["@parameters"];
  34659. } else {
  34660. return $1;
  34661. }
  34662. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34663. },
  34664. args: [],
  34665. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34666. referencedClasses: ["Array"],
  34667. messageSends: ["ifNil:", "new"]
  34668. }),
  34669. $globals.BlockNode);
  34670. $core.addMethod(
  34671. $core.method({
  34672. selector: "parameters:",
  34673. protocol: "accessing",
  34674. fn: function (aCollection){
  34675. var self=this,$self=this;
  34676. $self["@parameters"]=aCollection;
  34677. return self;
  34678. },
  34679. args: ["aCollection"],
  34680. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34681. referencedClasses: [],
  34682. messageSends: []
  34683. }),
  34684. $globals.BlockNode);
  34685. $core.addMethod(
  34686. $core.method({
  34687. selector: "scope",
  34688. protocol: "accessing",
  34689. fn: function (){
  34690. var self=this,$self=this;
  34691. return $self["@scope"];
  34692. },
  34693. args: [],
  34694. source: "scope\x0a\x09^ scope",
  34695. referencedClasses: [],
  34696. messageSends: []
  34697. }),
  34698. $globals.BlockNode);
  34699. $core.addMethod(
  34700. $core.method({
  34701. selector: "scope:",
  34702. protocol: "accessing",
  34703. fn: function (aLexicalScope){
  34704. var self=this,$self=this;
  34705. $self["@scope"]=aLexicalScope;
  34706. return self;
  34707. },
  34708. args: ["aLexicalScope"],
  34709. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34710. referencedClasses: [],
  34711. messageSends: []
  34712. }),
  34713. $globals.BlockNode);
  34714. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34715. $globals.CascadeNode.comment="I represent an cascade node.";
  34716. $core.addMethod(
  34717. $core.method({
  34718. selector: "acceptDagVisitor:",
  34719. protocol: "visiting",
  34720. fn: function (aVisitor){
  34721. var self=this,$self=this;
  34722. return $core.withContext(function($ctx1) {
  34723. return $recv(aVisitor)._visitCascadeNode_(self);
  34724. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34725. },
  34726. args: ["aVisitor"],
  34727. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34728. referencedClasses: [],
  34729. messageSends: ["visitCascadeNode:"]
  34730. }),
  34731. $globals.CascadeNode);
  34732. $core.addMethod(
  34733. $core.method({
  34734. selector: "isCascadeNode",
  34735. protocol: "testing",
  34736. fn: function (){
  34737. var self=this,$self=this;
  34738. return true;
  34739. },
  34740. args: [],
  34741. source: "isCascadeNode\x0a\x09^ true",
  34742. referencedClasses: [],
  34743. messageSends: []
  34744. }),
  34745. $globals.CascadeNode);
  34746. $core.addMethod(
  34747. $core.method({
  34748. selector: "receiver",
  34749. protocol: "accessing",
  34750. fn: function (){
  34751. var self=this,$self=this;
  34752. return $self["@receiver"];
  34753. },
  34754. args: [],
  34755. source: "receiver\x0a\x09^ receiver",
  34756. referencedClasses: [],
  34757. messageSends: []
  34758. }),
  34759. $globals.CascadeNode);
  34760. $core.addMethod(
  34761. $core.method({
  34762. selector: "receiver:",
  34763. protocol: "accessing",
  34764. fn: function (aNode){
  34765. var self=this,$self=this;
  34766. $self["@receiver"]=aNode;
  34767. return self;
  34768. },
  34769. args: ["aNode"],
  34770. source: "receiver: aNode\x0a\x09receiver := aNode",
  34771. referencedClasses: [],
  34772. messageSends: []
  34773. }),
  34774. $globals.CascadeNode);
  34775. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34776. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34777. $core.addMethod(
  34778. $core.method({
  34779. selector: "acceptDagVisitor:",
  34780. protocol: "visiting",
  34781. fn: function (aVisitor){
  34782. var self=this,$self=this;
  34783. return $core.withContext(function($ctx1) {
  34784. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34785. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34786. },
  34787. args: ["aVisitor"],
  34788. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34789. referencedClasses: [],
  34790. messageSends: ["visitDynamicArrayNode:"]
  34791. }),
  34792. $globals.DynamicArrayNode);
  34793. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34794. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34795. $core.addMethod(
  34796. $core.method({
  34797. selector: "acceptDagVisitor:",
  34798. protocol: "visiting",
  34799. fn: function (aVisitor){
  34800. var self=this,$self=this;
  34801. return $core.withContext(function($ctx1) {
  34802. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34803. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34804. },
  34805. args: ["aVisitor"],
  34806. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34807. referencedClasses: [],
  34808. messageSends: ["visitDynamicDictionaryNode:"]
  34809. }),
  34810. $globals.DynamicDictionaryNode);
  34811. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34812. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34813. $core.addMethod(
  34814. $core.method({
  34815. selector: "acceptDagVisitor:",
  34816. protocol: "visiting",
  34817. fn: function (aVisitor){
  34818. var self=this,$self=this;
  34819. return $core.withContext(function($ctx1) {
  34820. return $recv(aVisitor)._visitJSStatementNode_(self);
  34821. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34822. },
  34823. args: ["aVisitor"],
  34824. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34825. referencedClasses: [],
  34826. messageSends: ["visitJSStatementNode:"]
  34827. }),
  34828. $globals.JSStatementNode);
  34829. $core.addMethod(
  34830. $core.method({
  34831. selector: "isJSStatementNode",
  34832. protocol: "testing",
  34833. fn: function (){
  34834. var self=this,$self=this;
  34835. return true;
  34836. },
  34837. args: [],
  34838. source: "isJSStatementNode\x0a\x09^ true",
  34839. referencedClasses: [],
  34840. messageSends: []
  34841. }),
  34842. $globals.JSStatementNode);
  34843. $core.addMethod(
  34844. $core.method({
  34845. selector: "requiresSmalltalkContext",
  34846. protocol: "testing",
  34847. fn: function (){
  34848. var self=this,$self=this;
  34849. return true;
  34850. },
  34851. args: [],
  34852. source: "requiresSmalltalkContext\x0a\x09^ true",
  34853. referencedClasses: [],
  34854. messageSends: []
  34855. }),
  34856. $globals.JSStatementNode);
  34857. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34858. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34859. $core.addMethod(
  34860. $core.method({
  34861. selector: "acceptDagVisitor:",
  34862. protocol: "visiting",
  34863. fn: function (aVisitor){
  34864. var self=this,$self=this;
  34865. return $core.withContext(function($ctx1) {
  34866. return $recv(aVisitor)._visitMethodNode_(self);
  34867. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34868. },
  34869. args: ["aVisitor"],
  34870. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34871. referencedClasses: [],
  34872. messageSends: ["visitMethodNode:"]
  34873. }),
  34874. $globals.MethodNode);
  34875. $core.addMethod(
  34876. $core.method({
  34877. selector: "arguments",
  34878. protocol: "accessing",
  34879. fn: function (){
  34880. var self=this,$self=this;
  34881. return $core.withContext(function($ctx1) {
  34882. var $1,$receiver;
  34883. $1=$self["@arguments"];
  34884. if(($receiver = $1) == null || $receiver.a$nil){
  34885. return [];
  34886. } else {
  34887. return $1;
  34888. }
  34889. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34890. },
  34891. args: [],
  34892. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34893. referencedClasses: [],
  34894. messageSends: ["ifNil:"]
  34895. }),
  34896. $globals.MethodNode);
  34897. $core.addMethod(
  34898. $core.method({
  34899. selector: "arguments:",
  34900. protocol: "accessing",
  34901. fn: function (aCollection){
  34902. var self=this,$self=this;
  34903. $self["@arguments"]=aCollection;
  34904. return self;
  34905. },
  34906. args: ["aCollection"],
  34907. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34908. referencedClasses: [],
  34909. messageSends: []
  34910. }),
  34911. $globals.MethodNode);
  34912. $core.addMethod(
  34913. $core.method({
  34914. selector: "classReferences",
  34915. protocol: "accessing",
  34916. fn: function (){
  34917. var self=this,$self=this;
  34918. return $self["@classReferences"];
  34919. },
  34920. args: [],
  34921. source: "classReferences\x0a\x09^ classReferences",
  34922. referencedClasses: [],
  34923. messageSends: []
  34924. }),
  34925. $globals.MethodNode);
  34926. $core.addMethod(
  34927. $core.method({
  34928. selector: "classReferences:",
  34929. protocol: "accessing",
  34930. fn: function (aCollection){
  34931. var self=this,$self=this;
  34932. $self["@classReferences"]=aCollection;
  34933. return self;
  34934. },
  34935. args: ["aCollection"],
  34936. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34937. referencedClasses: [],
  34938. messageSends: []
  34939. }),
  34940. $globals.MethodNode);
  34941. $core.addMethod(
  34942. $core.method({
  34943. selector: "messageSends",
  34944. protocol: "accessing",
  34945. fn: function (){
  34946. var self=this,$self=this;
  34947. return $core.withContext(function($ctx1) {
  34948. return $recv($self._sendIndexes())._keys();
  34949. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34950. },
  34951. args: [],
  34952. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34953. referencedClasses: [],
  34954. messageSends: ["keys", "sendIndexes"]
  34955. }),
  34956. $globals.MethodNode);
  34957. $core.addMethod(
  34958. $core.method({
  34959. selector: "method",
  34960. protocol: "accessing",
  34961. fn: function (){
  34962. var self=this,$self=this;
  34963. return self;
  34964. },
  34965. args: [],
  34966. source: "method\x0a\x09^ self",
  34967. referencedClasses: [],
  34968. messageSends: []
  34969. }),
  34970. $globals.MethodNode);
  34971. $core.addMethod(
  34972. $core.method({
  34973. selector: "scope",
  34974. protocol: "accessing",
  34975. fn: function (){
  34976. var self=this,$self=this;
  34977. return $self["@scope"];
  34978. },
  34979. args: [],
  34980. source: "scope\x0a\x09^ scope",
  34981. referencedClasses: [],
  34982. messageSends: []
  34983. }),
  34984. $globals.MethodNode);
  34985. $core.addMethod(
  34986. $core.method({
  34987. selector: "scope:",
  34988. protocol: "accessing",
  34989. fn: function (aMethodScope){
  34990. var self=this,$self=this;
  34991. $self["@scope"]=aMethodScope;
  34992. return self;
  34993. },
  34994. args: ["aMethodScope"],
  34995. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34996. referencedClasses: [],
  34997. messageSends: []
  34998. }),
  34999. $globals.MethodNode);
  35000. $core.addMethod(
  35001. $core.method({
  35002. selector: "selector",
  35003. protocol: "accessing",
  35004. fn: function (){
  35005. var self=this,$self=this;
  35006. return $self["@selector"];
  35007. },
  35008. args: [],
  35009. source: "selector\x0a\x09^ selector",
  35010. referencedClasses: [],
  35011. messageSends: []
  35012. }),
  35013. $globals.MethodNode);
  35014. $core.addMethod(
  35015. $core.method({
  35016. selector: "selector:",
  35017. protocol: "accessing",
  35018. fn: function (aString){
  35019. var self=this,$self=this;
  35020. $self["@selector"]=aString;
  35021. return self;
  35022. },
  35023. args: ["aString"],
  35024. source: "selector: aString\x0a\x09selector := aString",
  35025. referencedClasses: [],
  35026. messageSends: []
  35027. }),
  35028. $globals.MethodNode);
  35029. $core.addMethod(
  35030. $core.method({
  35031. selector: "sendIndexes",
  35032. protocol: "accessing",
  35033. fn: function (){
  35034. var self=this,$self=this;
  35035. return $self["@sendIndexes"];
  35036. },
  35037. args: [],
  35038. source: "sendIndexes\x0a\x09^ sendIndexes",
  35039. referencedClasses: [],
  35040. messageSends: []
  35041. }),
  35042. $globals.MethodNode);
  35043. $core.addMethod(
  35044. $core.method({
  35045. selector: "sendIndexes:",
  35046. protocol: "accessing",
  35047. fn: function (aDictionary){
  35048. var self=this,$self=this;
  35049. $self["@sendIndexes"]=aDictionary;
  35050. return self;
  35051. },
  35052. args: ["aDictionary"],
  35053. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  35054. referencedClasses: [],
  35055. messageSends: []
  35056. }),
  35057. $globals.MethodNode);
  35058. $core.addMethod(
  35059. $core.method({
  35060. selector: "sequenceNode",
  35061. protocol: "accessing",
  35062. fn: function (){
  35063. var self=this,$self=this;
  35064. return $core.withContext(function($ctx1) {
  35065. var $1;
  35066. var $early={};
  35067. try {
  35068. $recv($self._dagChildren())._do_((function(each){
  35069. return $core.withContext(function($ctx2) {
  35070. $1=$recv(each)._isSequenceNode();
  35071. if($core.assert($1)){
  35072. throw $early=[each];
  35073. }
  35074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35075. }));
  35076. return nil;
  35077. }
  35078. catch(e) {if(e===$early)return e[0]; throw e}
  35079. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  35080. },
  35081. args: [],
  35082. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  35083. referencedClasses: [],
  35084. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  35085. }),
  35086. $globals.MethodNode);
  35087. $core.addMethod(
  35088. $core.method({
  35089. selector: "source",
  35090. protocol: "accessing",
  35091. fn: function (){
  35092. var self=this,$self=this;
  35093. return $self["@source"];
  35094. },
  35095. args: [],
  35096. source: "source\x0a\x09^ source",
  35097. referencedClasses: [],
  35098. messageSends: []
  35099. }),
  35100. $globals.MethodNode);
  35101. $core.addMethod(
  35102. $core.method({
  35103. selector: "source:",
  35104. protocol: "accessing",
  35105. fn: function (aString){
  35106. var self=this,$self=this;
  35107. $self["@source"]=aString;
  35108. return self;
  35109. },
  35110. args: ["aString"],
  35111. source: "source: aString\x0a\x09source := aString",
  35112. referencedClasses: [],
  35113. messageSends: []
  35114. }),
  35115. $globals.MethodNode);
  35116. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  35117. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  35118. $core.addMethod(
  35119. $core.method({
  35120. selector: "acceptDagVisitor:",
  35121. protocol: "visiting",
  35122. fn: function (aVisitor){
  35123. var self=this,$self=this;
  35124. return $core.withContext(function($ctx1) {
  35125. return $recv(aVisitor)._visitReturnNode_(self);
  35126. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  35127. },
  35128. args: ["aVisitor"],
  35129. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  35130. referencedClasses: [],
  35131. messageSends: ["visitReturnNode:"]
  35132. }),
  35133. $globals.ReturnNode);
  35134. $core.addMethod(
  35135. $core.method({
  35136. selector: "isReturnNode",
  35137. protocol: "testing",
  35138. fn: function (){
  35139. var self=this,$self=this;
  35140. return true;
  35141. },
  35142. args: [],
  35143. source: "isReturnNode\x0a\x09^ true",
  35144. referencedClasses: [],
  35145. messageSends: []
  35146. }),
  35147. $globals.ReturnNode);
  35148. $core.addMethod(
  35149. $core.method({
  35150. selector: "nonLocalReturn",
  35151. protocol: "testing",
  35152. fn: function (){
  35153. var self=this,$self=this;
  35154. return $core.withContext(function($ctx1) {
  35155. return $recv($recv($self._scope())._isMethodScope())._not();
  35156. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  35157. },
  35158. args: [],
  35159. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  35160. referencedClasses: [],
  35161. messageSends: ["not", "isMethodScope", "scope"]
  35162. }),
  35163. $globals.ReturnNode);
  35164. $core.addMethod(
  35165. $core.method({
  35166. selector: "scope",
  35167. protocol: "accessing",
  35168. fn: function (){
  35169. var self=this,$self=this;
  35170. return $self["@scope"];
  35171. },
  35172. args: [],
  35173. source: "scope\x0a\x09^ scope",
  35174. referencedClasses: [],
  35175. messageSends: []
  35176. }),
  35177. $globals.ReturnNode);
  35178. $core.addMethod(
  35179. $core.method({
  35180. selector: "scope:",
  35181. protocol: "accessing",
  35182. fn: function (aLexicalScope){
  35183. var self=this,$self=this;
  35184. $self["@scope"]=aLexicalScope;
  35185. return self;
  35186. },
  35187. args: ["aLexicalScope"],
  35188. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35189. referencedClasses: [],
  35190. messageSends: []
  35191. }),
  35192. $globals.ReturnNode);
  35193. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  35194. $globals.SendNode.comment="I represent an message send node.";
  35195. $core.addMethod(
  35196. $core.method({
  35197. selector: "acceptDagVisitor:",
  35198. protocol: "visiting",
  35199. fn: function (aVisitor){
  35200. var self=this,$self=this;
  35201. return $core.withContext(function($ctx1) {
  35202. return $recv(aVisitor)._visitSendNode_(self);
  35203. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  35204. },
  35205. args: ["aVisitor"],
  35206. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  35207. referencedClasses: [],
  35208. messageSends: ["visitSendNode:"]
  35209. }),
  35210. $globals.SendNode);
  35211. $core.addMethod(
  35212. $core.method({
  35213. selector: "arguments",
  35214. protocol: "accessing",
  35215. fn: function (){
  35216. var self=this,$self=this;
  35217. return $core.withContext(function($ctx1) {
  35218. var $1,$receiver;
  35219. $1=$self["@arguments"];
  35220. if(($receiver = $1) == null || $receiver.a$nil){
  35221. $self["@arguments"]=[];
  35222. return $self["@arguments"];
  35223. } else {
  35224. return $1;
  35225. }
  35226. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  35227. },
  35228. args: [],
  35229. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  35230. referencedClasses: [],
  35231. messageSends: ["ifNil:"]
  35232. }),
  35233. $globals.SendNode);
  35234. $core.addMethod(
  35235. $core.method({
  35236. selector: "arguments:",
  35237. protocol: "accessing",
  35238. fn: function (aCollection){
  35239. var self=this,$self=this;
  35240. $self["@arguments"]=aCollection;
  35241. return self;
  35242. },
  35243. args: ["aCollection"],
  35244. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35245. referencedClasses: [],
  35246. messageSends: []
  35247. }),
  35248. $globals.SendNode);
  35249. $core.addMethod(
  35250. $core.method({
  35251. selector: "dagChildren",
  35252. protocol: "accessing",
  35253. fn: function (){
  35254. var self=this,$self=this;
  35255. return $core.withContext(function($ctx1) {
  35256. var $1,$2,$3,$receiver;
  35257. $1=$self._receiver();
  35258. $ctx1.sendIdx["receiver"]=1;
  35259. if(($receiver = $1) == null || $receiver.a$nil){
  35260. $2=$self._arguments();
  35261. $ctx1.sendIdx["arguments"]=1;
  35262. return $recv($2)._copy();
  35263. } else {
  35264. $1;
  35265. }
  35266. $3=$recv($globals.Array)._with_($self._receiver());
  35267. $recv($3)._addAll_($self._arguments());
  35268. return $recv($3)._yourself();
  35269. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  35270. },
  35271. args: [],
  35272. 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",
  35273. referencedClasses: ["Array"],
  35274. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  35275. }),
  35276. $globals.SendNode);
  35277. $core.addMethod(
  35278. $core.method({
  35279. selector: "index",
  35280. protocol: "accessing",
  35281. fn: function (){
  35282. var self=this,$self=this;
  35283. return $self["@index"];
  35284. },
  35285. args: [],
  35286. source: "index\x0a\x09^ index",
  35287. referencedClasses: [],
  35288. messageSends: []
  35289. }),
  35290. $globals.SendNode);
  35291. $core.addMethod(
  35292. $core.method({
  35293. selector: "index:",
  35294. protocol: "accessing",
  35295. fn: function (anInteger){
  35296. var self=this,$self=this;
  35297. $self["@index"]=anInteger;
  35298. return self;
  35299. },
  35300. args: ["anInteger"],
  35301. source: "index: anInteger\x0a\x09index := anInteger",
  35302. referencedClasses: [],
  35303. messageSends: []
  35304. }),
  35305. $globals.SendNode);
  35306. $core.addMethod(
  35307. $core.method({
  35308. selector: "isNavigationNode",
  35309. protocol: "testing",
  35310. fn: function (){
  35311. var self=this,$self=this;
  35312. return true;
  35313. },
  35314. args: [],
  35315. source: "isNavigationNode\x0a\x09^ true",
  35316. referencedClasses: [],
  35317. messageSends: []
  35318. }),
  35319. $globals.SendNode);
  35320. $core.addMethod(
  35321. $core.method({
  35322. selector: "isSendNode",
  35323. protocol: "testing",
  35324. fn: function (){
  35325. var self=this,$self=this;
  35326. return true;
  35327. },
  35328. args: [],
  35329. source: "isSendNode\x0a\x09^ true",
  35330. referencedClasses: [],
  35331. messageSends: []
  35332. }),
  35333. $globals.SendNode);
  35334. $core.addMethod(
  35335. $core.method({
  35336. selector: "navigationLink",
  35337. protocol: "accessing",
  35338. fn: function (){
  35339. var self=this,$self=this;
  35340. return $core.withContext(function($ctx1) {
  35341. return $self._selector();
  35342. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  35343. },
  35344. args: [],
  35345. source: "navigationLink\x0a\x09^ self selector",
  35346. referencedClasses: [],
  35347. messageSends: ["selector"]
  35348. }),
  35349. $globals.SendNode);
  35350. $core.addMethod(
  35351. $core.method({
  35352. selector: "receiver",
  35353. protocol: "accessing",
  35354. fn: function (){
  35355. var self=this,$self=this;
  35356. return $self["@receiver"];
  35357. },
  35358. args: [],
  35359. source: "receiver\x0a\x09^ receiver",
  35360. referencedClasses: [],
  35361. messageSends: []
  35362. }),
  35363. $globals.SendNode);
  35364. $core.addMethod(
  35365. $core.method({
  35366. selector: "receiver:",
  35367. protocol: "accessing",
  35368. fn: function (aNode){
  35369. var self=this,$self=this;
  35370. $self["@receiver"]=aNode;
  35371. return self;
  35372. },
  35373. args: ["aNode"],
  35374. source: "receiver: aNode\x0a\x09receiver := aNode",
  35375. referencedClasses: [],
  35376. messageSends: []
  35377. }),
  35378. $globals.SendNode);
  35379. $core.addMethod(
  35380. $core.method({
  35381. selector: "requiresSmalltalkContext",
  35382. protocol: "testing",
  35383. fn: function (){
  35384. var self=this,$self=this;
  35385. return true;
  35386. },
  35387. args: [],
  35388. source: "requiresSmalltalkContext\x0a\x09^ true",
  35389. referencedClasses: [],
  35390. messageSends: []
  35391. }),
  35392. $globals.SendNode);
  35393. $core.addMethod(
  35394. $core.method({
  35395. selector: "selector",
  35396. protocol: "accessing",
  35397. fn: function (){
  35398. var self=this,$self=this;
  35399. return $self["@selector"];
  35400. },
  35401. args: [],
  35402. source: "selector\x0a\x09^ selector",
  35403. referencedClasses: [],
  35404. messageSends: []
  35405. }),
  35406. $globals.SendNode);
  35407. $core.addMethod(
  35408. $core.method({
  35409. selector: "selector:",
  35410. protocol: "accessing",
  35411. fn: function (aString){
  35412. var self=this,$self=this;
  35413. $self["@selector"]=aString;
  35414. return self;
  35415. },
  35416. args: ["aString"],
  35417. source: "selector: aString\x0a\x09selector := aString",
  35418. referencedClasses: [],
  35419. messageSends: []
  35420. }),
  35421. $globals.SendNode);
  35422. $core.addMethod(
  35423. $core.method({
  35424. selector: "shouldBeInlined",
  35425. protocol: "accessing",
  35426. fn: function (){
  35427. var self=this,$self=this;
  35428. return $core.withContext(function($ctx1) {
  35429. var $1,$receiver;
  35430. $1=$self["@shouldBeInlined"];
  35431. if(($receiver = $1) == null || $receiver.a$nil){
  35432. return false;
  35433. } else {
  35434. return $1;
  35435. }
  35436. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  35437. },
  35438. args: [],
  35439. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  35440. referencedClasses: [],
  35441. messageSends: ["ifNil:"]
  35442. }),
  35443. $globals.SendNode);
  35444. $core.addMethod(
  35445. $core.method({
  35446. selector: "shouldBeInlined:",
  35447. protocol: "accessing",
  35448. fn: function (aBoolean){
  35449. var self=this,$self=this;
  35450. $self["@shouldBeInlined"]=aBoolean;
  35451. return self;
  35452. },
  35453. args: ["aBoolean"],
  35454. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  35455. referencedClasses: [],
  35456. messageSends: []
  35457. }),
  35458. $globals.SendNode);
  35459. $core.addMethod(
  35460. $core.method({
  35461. selector: "superSend",
  35462. protocol: "accessing",
  35463. fn: function (){
  35464. var self=this,$self=this;
  35465. return $core.withContext(function($ctx1) {
  35466. var $2,$1;
  35467. $2=$self._receiver();
  35468. $ctx1.sendIdx["receiver"]=1;
  35469. $1=$recv($2)._notNil();
  35470. return $recv($1)._and_((function(){
  35471. return $core.withContext(function($ctx2) {
  35472. return $recv($self._receiver())._isSuperKeyword();
  35473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35474. }));
  35475. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  35476. },
  35477. args: [],
  35478. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  35479. referencedClasses: [],
  35480. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  35481. }),
  35482. $globals.SendNode);
  35483. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  35484. $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).";
  35485. $core.addMethod(
  35486. $core.method({
  35487. selector: "acceptDagVisitor:",
  35488. protocol: "visiting",
  35489. fn: function (aVisitor){
  35490. var self=this,$self=this;
  35491. return $core.withContext(function($ctx1) {
  35492. return $recv(aVisitor)._visitSequenceNode_(self);
  35493. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  35494. },
  35495. args: ["aVisitor"],
  35496. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  35497. referencedClasses: [],
  35498. messageSends: ["visitSequenceNode:"]
  35499. }),
  35500. $globals.SequenceNode);
  35501. $core.addMethod(
  35502. $core.method({
  35503. selector: "asBlockSequenceNode",
  35504. protocol: "building",
  35505. fn: function (){
  35506. var self=this,$self=this;
  35507. return $core.withContext(function($ctx1) {
  35508. var $1;
  35509. $1=$recv($globals.BlockSequenceNode)._new();
  35510. $recv($1)._position_($self._position());
  35511. $recv($1)._source_($self._source());
  35512. $recv($1)._dagChildren_($self._dagChildren());
  35513. $recv($1)._temps_($self._temps());
  35514. return $recv($1)._yourself();
  35515. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  35516. },
  35517. args: [],
  35518. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  35519. referencedClasses: ["BlockSequenceNode"],
  35520. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  35521. }),
  35522. $globals.SequenceNode);
  35523. $core.addMethod(
  35524. $core.method({
  35525. selector: "isSequenceNode",
  35526. protocol: "testing",
  35527. fn: function (){
  35528. var self=this,$self=this;
  35529. return true;
  35530. },
  35531. args: [],
  35532. source: "isSequenceNode\x0a\x09^ true",
  35533. referencedClasses: [],
  35534. messageSends: []
  35535. }),
  35536. $globals.SequenceNode);
  35537. $core.addMethod(
  35538. $core.method({
  35539. selector: "scope",
  35540. protocol: "accessing",
  35541. fn: function (){
  35542. var self=this,$self=this;
  35543. return $self["@scope"];
  35544. },
  35545. args: [],
  35546. source: "scope\x0a\x09^ scope",
  35547. referencedClasses: [],
  35548. messageSends: []
  35549. }),
  35550. $globals.SequenceNode);
  35551. $core.addMethod(
  35552. $core.method({
  35553. selector: "scope:",
  35554. protocol: "accessing",
  35555. fn: function (aLexicalScope){
  35556. var self=this,$self=this;
  35557. $self["@scope"]=aLexicalScope;
  35558. return self;
  35559. },
  35560. args: ["aLexicalScope"],
  35561. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35562. referencedClasses: [],
  35563. messageSends: []
  35564. }),
  35565. $globals.SequenceNode);
  35566. $core.addMethod(
  35567. $core.method({
  35568. selector: "temps",
  35569. protocol: "accessing",
  35570. fn: function (){
  35571. var self=this,$self=this;
  35572. return $core.withContext(function($ctx1) {
  35573. var $1,$receiver;
  35574. $1=$self["@temps"];
  35575. if(($receiver = $1) == null || $receiver.a$nil){
  35576. return [];
  35577. } else {
  35578. return $1;
  35579. }
  35580. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35581. },
  35582. args: [],
  35583. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35584. referencedClasses: [],
  35585. messageSends: ["ifNil:"]
  35586. }),
  35587. $globals.SequenceNode);
  35588. $core.addMethod(
  35589. $core.method({
  35590. selector: "temps:",
  35591. protocol: "accessing",
  35592. fn: function (aCollection){
  35593. var self=this,$self=this;
  35594. $self["@temps"]=aCollection;
  35595. return self;
  35596. },
  35597. args: ["aCollection"],
  35598. source: "temps: aCollection\x0a\x09temps := aCollection",
  35599. referencedClasses: [],
  35600. messageSends: []
  35601. }),
  35602. $globals.SequenceNode);
  35603. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35604. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35605. $core.addMethod(
  35606. $core.method({
  35607. selector: "acceptDagVisitor:",
  35608. protocol: "visiting",
  35609. fn: function (aVisitor){
  35610. var self=this,$self=this;
  35611. return $core.withContext(function($ctx1) {
  35612. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35613. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35614. },
  35615. args: ["aVisitor"],
  35616. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35617. referencedClasses: [],
  35618. messageSends: ["visitBlockSequenceNode:"]
  35619. }),
  35620. $globals.BlockSequenceNode);
  35621. $core.addMethod(
  35622. $core.method({
  35623. selector: "isBlockSequenceNode",
  35624. protocol: "testing",
  35625. fn: function (){
  35626. var self=this,$self=this;
  35627. return true;
  35628. },
  35629. args: [],
  35630. source: "isBlockSequenceNode\x0a\x09^ true",
  35631. referencedClasses: [],
  35632. messageSends: []
  35633. }),
  35634. $globals.BlockSequenceNode);
  35635. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35636. $globals.ValueNode.comment="I represent a value node.";
  35637. $core.addMethod(
  35638. $core.method({
  35639. selector: "acceptDagVisitor:",
  35640. protocol: "visiting",
  35641. fn: function (aVisitor){
  35642. var self=this,$self=this;
  35643. return $core.withContext(function($ctx1) {
  35644. return $recv(aVisitor)._visitValueNode_(self);
  35645. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35646. },
  35647. args: ["aVisitor"],
  35648. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35649. referencedClasses: [],
  35650. messageSends: ["visitValueNode:"]
  35651. }),
  35652. $globals.ValueNode);
  35653. $core.addMethod(
  35654. $core.method({
  35655. selector: "isImmutable",
  35656. protocol: "testing",
  35657. fn: function (){
  35658. var self=this,$self=this;
  35659. return $core.withContext(function($ctx1) {
  35660. return $recv($self._value())._isImmutable();
  35661. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35662. },
  35663. args: [],
  35664. source: "isImmutable\x0a\x09^ self value isImmutable",
  35665. referencedClasses: [],
  35666. messageSends: ["isImmutable", "value"]
  35667. }),
  35668. $globals.ValueNode);
  35669. $core.addMethod(
  35670. $core.method({
  35671. selector: "isValueNode",
  35672. protocol: "testing",
  35673. fn: function (){
  35674. var self=this,$self=this;
  35675. return true;
  35676. },
  35677. args: [],
  35678. source: "isValueNode\x0a\x09^ true",
  35679. referencedClasses: [],
  35680. messageSends: []
  35681. }),
  35682. $globals.ValueNode);
  35683. $core.addMethod(
  35684. $core.method({
  35685. selector: "value",
  35686. protocol: "accessing",
  35687. fn: function (){
  35688. var self=this,$self=this;
  35689. return $self["@value"];
  35690. },
  35691. args: [],
  35692. source: "value\x0a\x09^ value",
  35693. referencedClasses: [],
  35694. messageSends: []
  35695. }),
  35696. $globals.ValueNode);
  35697. $core.addMethod(
  35698. $core.method({
  35699. selector: "value:",
  35700. protocol: "accessing",
  35701. fn: function (anObject){
  35702. var self=this,$self=this;
  35703. $self["@value"]=anObject;
  35704. return self;
  35705. },
  35706. args: ["anObject"],
  35707. source: "value: anObject\x0a\x09value := anObject",
  35708. referencedClasses: [],
  35709. messageSends: []
  35710. }),
  35711. $globals.ValueNode);
  35712. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35713. $globals.VariableNode.comment="I represent an variable node.";
  35714. $core.addMethod(
  35715. $core.method({
  35716. selector: "acceptDagVisitor:",
  35717. protocol: "visiting",
  35718. fn: function (aVisitor){
  35719. var self=this,$self=this;
  35720. return $core.withContext(function($ctx1) {
  35721. return $recv(aVisitor)._visitVariableNode_(self);
  35722. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35723. },
  35724. args: ["aVisitor"],
  35725. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35726. referencedClasses: [],
  35727. messageSends: ["visitVariableNode:"]
  35728. }),
  35729. $globals.VariableNode);
  35730. $core.addMethod(
  35731. $core.method({
  35732. selector: "alias",
  35733. protocol: "accessing",
  35734. fn: function (){
  35735. var self=this,$self=this;
  35736. return $core.withContext(function($ctx1) {
  35737. return $recv($self._binding())._alias();
  35738. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35739. },
  35740. args: [],
  35741. source: "alias\x0a\x09^ self binding alias",
  35742. referencedClasses: [],
  35743. messageSends: ["alias", "binding"]
  35744. }),
  35745. $globals.VariableNode);
  35746. $core.addMethod(
  35747. $core.method({
  35748. selector: "assigned",
  35749. protocol: "accessing",
  35750. fn: function (){
  35751. var self=this,$self=this;
  35752. return $core.withContext(function($ctx1) {
  35753. var $1,$receiver;
  35754. $1=$self["@assigned"];
  35755. if(($receiver = $1) == null || $receiver.a$nil){
  35756. return false;
  35757. } else {
  35758. return $1;
  35759. }
  35760. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35761. },
  35762. args: [],
  35763. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35764. referencedClasses: [],
  35765. messageSends: ["ifNil:"]
  35766. }),
  35767. $globals.VariableNode);
  35768. $core.addMethod(
  35769. $core.method({
  35770. selector: "assigned:",
  35771. protocol: "accessing",
  35772. fn: function (aBoolean){
  35773. var self=this,$self=this;
  35774. $self["@assigned"]=aBoolean;
  35775. return self;
  35776. },
  35777. args: ["aBoolean"],
  35778. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35779. referencedClasses: [],
  35780. messageSends: []
  35781. }),
  35782. $globals.VariableNode);
  35783. $core.addMethod(
  35784. $core.method({
  35785. selector: "beAssigned",
  35786. protocol: "accessing",
  35787. fn: function (){
  35788. var self=this,$self=this;
  35789. return $core.withContext(function($ctx1) {
  35790. $recv($self._binding())._validateAssignment();
  35791. $self["@assigned"]=true;
  35792. return self;
  35793. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35794. },
  35795. args: [],
  35796. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35797. referencedClasses: [],
  35798. messageSends: ["validateAssignment", "binding"]
  35799. }),
  35800. $globals.VariableNode);
  35801. $core.addMethod(
  35802. $core.method({
  35803. selector: "binding",
  35804. protocol: "accessing",
  35805. fn: function (){
  35806. var self=this,$self=this;
  35807. return $self["@binding"];
  35808. },
  35809. args: [],
  35810. source: "binding\x0a\x09^ binding",
  35811. referencedClasses: [],
  35812. messageSends: []
  35813. }),
  35814. $globals.VariableNode);
  35815. $core.addMethod(
  35816. $core.method({
  35817. selector: "binding:",
  35818. protocol: "accessing",
  35819. fn: function (aScopeVar){
  35820. var self=this,$self=this;
  35821. $self["@binding"]=aScopeVar;
  35822. return self;
  35823. },
  35824. args: ["aScopeVar"],
  35825. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35826. referencedClasses: [],
  35827. messageSends: []
  35828. }),
  35829. $globals.VariableNode);
  35830. $core.addMethod(
  35831. $core.method({
  35832. selector: "isArgument",
  35833. protocol: "testing",
  35834. fn: function (){
  35835. var self=this,$self=this;
  35836. return $core.withContext(function($ctx1) {
  35837. return $recv($self._binding())._isArgVar();
  35838. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35839. },
  35840. args: [],
  35841. source: "isArgument\x0a\x09^ self binding isArgVar",
  35842. referencedClasses: [],
  35843. messageSends: ["isArgVar", "binding"]
  35844. }),
  35845. $globals.VariableNode);
  35846. $core.addMethod(
  35847. $core.method({
  35848. selector: "isImmutable",
  35849. protocol: "testing",
  35850. fn: function (){
  35851. var self=this,$self=this;
  35852. return $core.withContext(function($ctx1) {
  35853. return $recv($self._binding())._isImmutable();
  35854. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35855. },
  35856. args: [],
  35857. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35858. referencedClasses: [],
  35859. messageSends: ["isImmutable", "binding"]
  35860. }),
  35861. $globals.VariableNode);
  35862. $core.addMethod(
  35863. $core.method({
  35864. selector: "isNavigationNode",
  35865. protocol: "testing",
  35866. fn: function (){
  35867. var self=this,$self=this;
  35868. return true;
  35869. },
  35870. args: [],
  35871. source: "isNavigationNode\x0a\x09^ true",
  35872. referencedClasses: [],
  35873. messageSends: []
  35874. }),
  35875. $globals.VariableNode);
  35876. $core.addMethod(
  35877. $core.method({
  35878. selector: "isSuperKeyword",
  35879. protocol: "testing",
  35880. fn: function (){
  35881. var self=this,$self=this;
  35882. return $core.withContext(function($ctx1) {
  35883. return $recv($self._value()).__eq("super");
  35884. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35885. },
  35886. args: [],
  35887. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35888. referencedClasses: [],
  35889. messageSends: ["=", "value"]
  35890. }),
  35891. $globals.VariableNode);
  35892. $core.addMethod(
  35893. $core.method({
  35894. selector: "isVariableNode",
  35895. protocol: "testing",
  35896. fn: function (){
  35897. var self=this,$self=this;
  35898. return true;
  35899. },
  35900. args: [],
  35901. source: "isVariableNode\x0a\x09^ true",
  35902. referencedClasses: [],
  35903. messageSends: []
  35904. }),
  35905. $globals.VariableNode);
  35906. $core.addMethod(
  35907. $core.method({
  35908. selector: "navigationLink",
  35909. protocol: "accessing",
  35910. fn: function (){
  35911. var self=this,$self=this;
  35912. return $core.withContext(function($ctx1) {
  35913. return $self._value();
  35914. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35915. },
  35916. args: [],
  35917. source: "navigationLink\x0a\x09^ self value",
  35918. referencedClasses: [],
  35919. messageSends: ["value"]
  35920. }),
  35921. $globals.VariableNode);
  35922. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35923. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35924. $core.addMethod(
  35925. $core.method({
  35926. selector: "visit:",
  35927. protocol: "visiting",
  35928. fn: function (aNode){
  35929. var self=this,$self=this;
  35930. return $core.withContext(function($ctx1) {
  35931. var $1;
  35932. $recv($self._path())._ifNotEmpty_((function(p){
  35933. return $core.withContext(function($ctx2) {
  35934. return $recv(aNode)._parent_($recv(p)._last());
  35935. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35936. }));
  35937. $1=(
  35938. $ctx1.supercall = true,
  35939. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35940. $ctx1.supercall = false;
  35941. return $1;
  35942. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35943. },
  35944. args: ["aNode"],
  35945. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35946. referencedClasses: [],
  35947. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35948. }),
  35949. $globals.ParentFakingPathDagVisitor);
  35950. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35951. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35952. $core.addMethod(
  35953. $core.method({
  35954. selector: "visitAssignmentNode:",
  35955. protocol: "visiting",
  35956. fn: function (aNode){
  35957. var self=this,$self=this;
  35958. return $core.withContext(function($ctx1) {
  35959. return $self._visitDagNode_(aNode);
  35960. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35961. },
  35962. args: ["aNode"],
  35963. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35964. referencedClasses: [],
  35965. messageSends: ["visitDagNode:"]
  35966. }),
  35967. $globals.NodeVisitor);
  35968. $core.addMethod(
  35969. $core.method({
  35970. selector: "visitBlockNode:",
  35971. protocol: "visiting",
  35972. fn: function (aNode){
  35973. var self=this,$self=this;
  35974. return $core.withContext(function($ctx1) {
  35975. return $self._visitDagNode_(aNode);
  35976. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35977. },
  35978. args: ["aNode"],
  35979. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35980. referencedClasses: [],
  35981. messageSends: ["visitDagNode:"]
  35982. }),
  35983. $globals.NodeVisitor);
  35984. $core.addMethod(
  35985. $core.method({
  35986. selector: "visitBlockSequenceNode:",
  35987. protocol: "visiting",
  35988. fn: function (aNode){
  35989. var self=this,$self=this;
  35990. return $core.withContext(function($ctx1) {
  35991. return $self._visitSequenceNode_(aNode);
  35992. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35993. },
  35994. args: ["aNode"],
  35995. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35996. referencedClasses: [],
  35997. messageSends: ["visitSequenceNode:"]
  35998. }),
  35999. $globals.NodeVisitor);
  36000. $core.addMethod(
  36001. $core.method({
  36002. selector: "visitCascadeNode:",
  36003. protocol: "visiting",
  36004. fn: function (aNode){
  36005. var self=this,$self=this;
  36006. return $core.withContext(function($ctx1) {
  36007. return $self._visitDagNode_(aNode);
  36008. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  36009. },
  36010. args: ["aNode"],
  36011. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36012. referencedClasses: [],
  36013. messageSends: ["visitDagNode:"]
  36014. }),
  36015. $globals.NodeVisitor);
  36016. $core.addMethod(
  36017. $core.method({
  36018. selector: "visitDagNode:",
  36019. protocol: "visiting",
  36020. fn: function (aNode){
  36021. var self=this,$self=this;
  36022. return $core.withContext(function($ctx1) {
  36023. return $self._visitDagNodeVariantSimple_(aNode);
  36024. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  36025. },
  36026. args: ["aNode"],
  36027. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  36028. referencedClasses: [],
  36029. messageSends: ["visitDagNodeVariantSimple:"]
  36030. }),
  36031. $globals.NodeVisitor);
  36032. $core.addMethod(
  36033. $core.method({
  36034. selector: "visitDynamicArrayNode:",
  36035. protocol: "visiting",
  36036. fn: function (aNode){
  36037. var self=this,$self=this;
  36038. return $core.withContext(function($ctx1) {
  36039. return $self._visitDagNode_(aNode);
  36040. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  36041. },
  36042. args: ["aNode"],
  36043. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36044. referencedClasses: [],
  36045. messageSends: ["visitDagNode:"]
  36046. }),
  36047. $globals.NodeVisitor);
  36048. $core.addMethod(
  36049. $core.method({
  36050. selector: "visitDynamicDictionaryNode:",
  36051. protocol: "visiting",
  36052. fn: function (aNode){
  36053. var self=this,$self=this;
  36054. return $core.withContext(function($ctx1) {
  36055. return $self._visitDagNode_(aNode);
  36056. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  36057. },
  36058. args: ["aNode"],
  36059. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36060. referencedClasses: [],
  36061. messageSends: ["visitDagNode:"]
  36062. }),
  36063. $globals.NodeVisitor);
  36064. $core.addMethod(
  36065. $core.method({
  36066. selector: "visitJSStatementNode:",
  36067. protocol: "visiting",
  36068. fn: function (aNode){
  36069. var self=this,$self=this;
  36070. return $core.withContext(function($ctx1) {
  36071. return $self._visitDagNode_(aNode);
  36072. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  36073. },
  36074. args: ["aNode"],
  36075. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36076. referencedClasses: [],
  36077. messageSends: ["visitDagNode:"]
  36078. }),
  36079. $globals.NodeVisitor);
  36080. $core.addMethod(
  36081. $core.method({
  36082. selector: "visitMethodNode:",
  36083. protocol: "visiting",
  36084. fn: function (aNode){
  36085. var self=this,$self=this;
  36086. return $core.withContext(function($ctx1) {
  36087. return $self._visitDagNode_(aNode);
  36088. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  36089. },
  36090. args: ["aNode"],
  36091. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36092. referencedClasses: [],
  36093. messageSends: ["visitDagNode:"]
  36094. }),
  36095. $globals.NodeVisitor);
  36096. $core.addMethod(
  36097. $core.method({
  36098. selector: "visitReturnNode:",
  36099. protocol: "visiting",
  36100. fn: function (aNode){
  36101. var self=this,$self=this;
  36102. return $core.withContext(function($ctx1) {
  36103. return $self._visitDagNode_(aNode);
  36104. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  36105. },
  36106. args: ["aNode"],
  36107. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36108. referencedClasses: [],
  36109. messageSends: ["visitDagNode:"]
  36110. }),
  36111. $globals.NodeVisitor);
  36112. $core.addMethod(
  36113. $core.method({
  36114. selector: "visitSendNode:",
  36115. protocol: "visiting",
  36116. fn: function (aNode){
  36117. var self=this,$self=this;
  36118. return $core.withContext(function($ctx1) {
  36119. return $self._visitDagNode_(aNode);
  36120. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  36121. },
  36122. args: ["aNode"],
  36123. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36124. referencedClasses: [],
  36125. messageSends: ["visitDagNode:"]
  36126. }),
  36127. $globals.NodeVisitor);
  36128. $core.addMethod(
  36129. $core.method({
  36130. selector: "visitSequenceNode:",
  36131. protocol: "visiting",
  36132. fn: function (aNode){
  36133. var self=this,$self=this;
  36134. return $core.withContext(function($ctx1) {
  36135. return $self._visitDagNode_(aNode);
  36136. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  36137. },
  36138. args: ["aNode"],
  36139. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36140. referencedClasses: [],
  36141. messageSends: ["visitDagNode:"]
  36142. }),
  36143. $globals.NodeVisitor);
  36144. $core.addMethod(
  36145. $core.method({
  36146. selector: "visitValueNode:",
  36147. protocol: "visiting",
  36148. fn: function (aNode){
  36149. var self=this,$self=this;
  36150. return $core.withContext(function($ctx1) {
  36151. return $self._visitDagNode_(aNode);
  36152. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  36153. },
  36154. args: ["aNode"],
  36155. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36156. referencedClasses: [],
  36157. messageSends: ["visitDagNode:"]
  36158. }),
  36159. $globals.NodeVisitor);
  36160. $core.addMethod(
  36161. $core.method({
  36162. selector: "visitVariableNode:",
  36163. protocol: "visiting",
  36164. fn: function (aNode){
  36165. var self=this,$self=this;
  36166. return $core.withContext(function($ctx1) {
  36167. return $self._visitDagNode_(aNode);
  36168. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  36169. },
  36170. args: ["aNode"],
  36171. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36172. referencedClasses: [],
  36173. messageSends: ["visitDagNode:"]
  36174. }),
  36175. $globals.NodeVisitor);
  36176. $core.addMethod(
  36177. $core.method({
  36178. selector: "ast",
  36179. protocol: "*Compiler-AST",
  36180. fn: function (){
  36181. var self=this,$self=this;
  36182. return $core.withContext(function($ctx1) {
  36183. var $1;
  36184. $1=$self._source();
  36185. $ctx1.sendIdx["source"]=1;
  36186. $recv($1)._ifEmpty_((function(){
  36187. return $core.withContext(function($ctx2) {
  36188. return $self._error_("Method source is empty");
  36189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36190. }));
  36191. return $recv($globals.Smalltalk)._parse_($self._source());
  36192. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  36193. },
  36194. args: [],
  36195. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  36196. referencedClasses: ["Smalltalk"],
  36197. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  36198. }),
  36199. $globals.CompiledMethod);
  36200. });
  36201. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36202. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36203. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36204. $core.addPackage("Compiler-Semantic");
  36205. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36206. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36207. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36208. $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.";
  36209. $core.addMethod(
  36210. $core.method({
  36211. selector: "addArg:",
  36212. protocol: "adding",
  36213. fn: function (aString){
  36214. var self=this,$self=this;
  36215. return $core.withContext(function($ctx1) {
  36216. var $1;
  36217. $1=$self._args();
  36218. $ctx1.sendIdx["args"]=1;
  36219. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36220. $recv($recv($self._args())._at_(aString))._scope_(self);
  36221. return self;
  36222. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36223. },
  36224. args: ["aString"],
  36225. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36226. referencedClasses: ["ArgVar"],
  36227. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36228. }),
  36229. $globals.LexicalScope);
  36230. $core.addMethod(
  36231. $core.method({
  36232. selector: "addTemp:",
  36233. protocol: "adding",
  36234. fn: function (aString){
  36235. var self=this,$self=this;
  36236. return $core.withContext(function($ctx1) {
  36237. var $1;
  36238. $1=$self._temps();
  36239. $ctx1.sendIdx["temps"]=1;
  36240. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36241. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36242. return self;
  36243. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36244. },
  36245. args: ["aString"],
  36246. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36247. referencedClasses: ["TempVar"],
  36248. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36249. }),
  36250. $globals.LexicalScope);
  36251. $core.addMethod(
  36252. $core.method({
  36253. selector: "alias",
  36254. protocol: "accessing",
  36255. fn: function (){
  36256. var self=this,$self=this;
  36257. return $core.withContext(function($ctx1) {
  36258. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36259. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36260. },
  36261. args: [],
  36262. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36263. referencedClasses: [],
  36264. messageSends: [",", "asString", "scopeLevel"]
  36265. }),
  36266. $globals.LexicalScope);
  36267. $core.addMethod(
  36268. $core.method({
  36269. selector: "allVariableNames",
  36270. protocol: "accessing",
  36271. fn: function (){
  36272. var self=this,$self=this;
  36273. return $core.withContext(function($ctx1) {
  36274. var $1;
  36275. $1=$recv($self._args())._keys();
  36276. $ctx1.sendIdx["keys"]=1;
  36277. return $recv($1).__comma($recv($self._temps())._keys());
  36278. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36279. },
  36280. args: [],
  36281. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36282. referencedClasses: [],
  36283. messageSends: [",", "keys", "args", "temps"]
  36284. }),
  36285. $globals.LexicalScope);
  36286. $core.addMethod(
  36287. $core.method({
  36288. selector: "args",
  36289. protocol: "accessing",
  36290. fn: function (){
  36291. var self=this,$self=this;
  36292. return $core.withContext(function($ctx1) {
  36293. var $1,$receiver;
  36294. $1=$self["@args"];
  36295. if(($receiver = $1) == null || $receiver.a$nil){
  36296. $self["@args"]=$recv($globals.Dictionary)._new();
  36297. return $self["@args"];
  36298. } else {
  36299. return $1;
  36300. }
  36301. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36302. },
  36303. args: [],
  36304. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36305. referencedClasses: ["Dictionary"],
  36306. messageSends: ["ifNil:", "new"]
  36307. }),
  36308. $globals.LexicalScope);
  36309. $core.addMethod(
  36310. $core.method({
  36311. selector: "bindingFor:",
  36312. protocol: "accessing",
  36313. fn: function (aStringOrNode){
  36314. var self=this,$self=this;
  36315. return $core.withContext(function($ctx1) {
  36316. var $2,$3,$4,$5,$1;
  36317. $2=$self._pseudoVars();
  36318. $3=$recv(aStringOrNode)._value();
  36319. $ctx1.sendIdx["value"]=1;
  36320. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36321. return $core.withContext(function($ctx2) {
  36322. $4=$self._args();
  36323. $5=$recv(aStringOrNode)._value();
  36324. $ctx2.sendIdx["value"]=2;
  36325. return $recv($4)._at_ifAbsent_($5,(function(){
  36326. return $core.withContext(function($ctx3) {
  36327. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36328. return nil;
  36329. }));
  36330. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36331. }));
  36332. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36334. }));
  36335. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36336. return $1;
  36337. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36338. },
  36339. args: ["aStringOrNode"],
  36340. 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 ]]]",
  36341. referencedClasses: [],
  36342. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36343. }),
  36344. $globals.LexicalScope);
  36345. $core.addMethod(
  36346. $core.method({
  36347. selector: "blockIndex",
  36348. protocol: "accessing",
  36349. fn: function (){
  36350. var self=this,$self=this;
  36351. return $core.withContext(function($ctx1) {
  36352. var $1,$receiver;
  36353. $1=$self["@blockIndex"];
  36354. if(($receiver = $1) == null || $receiver.a$nil){
  36355. return (0);
  36356. } else {
  36357. return $1;
  36358. }
  36359. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36360. },
  36361. args: [],
  36362. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36363. referencedClasses: [],
  36364. messageSends: ["ifNil:"]
  36365. }),
  36366. $globals.LexicalScope);
  36367. $core.addMethod(
  36368. $core.method({
  36369. selector: "blockIndex:",
  36370. protocol: "accessing",
  36371. fn: function (anInteger){
  36372. var self=this,$self=this;
  36373. $self["@blockIndex"]=anInteger;
  36374. return self;
  36375. },
  36376. args: ["anInteger"],
  36377. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36378. referencedClasses: [],
  36379. messageSends: []
  36380. }),
  36381. $globals.LexicalScope);
  36382. $core.addMethod(
  36383. $core.method({
  36384. selector: "canInlineNonLocalReturns",
  36385. protocol: "testing",
  36386. fn: function (){
  36387. var self=this,$self=this;
  36388. return $core.withContext(function($ctx1) {
  36389. return $recv($self._isInlined())._and_((function(){
  36390. return $core.withContext(function($ctx2) {
  36391. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36393. }));
  36394. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36395. },
  36396. args: [],
  36397. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36398. referencedClasses: [],
  36399. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36400. }),
  36401. $globals.LexicalScope);
  36402. $core.addMethod(
  36403. $core.method({
  36404. selector: "instruction",
  36405. protocol: "accessing",
  36406. fn: function (){
  36407. var self=this,$self=this;
  36408. return $self["@instruction"];
  36409. },
  36410. args: [],
  36411. source: "instruction\x0a\x09^ instruction",
  36412. referencedClasses: [],
  36413. messageSends: []
  36414. }),
  36415. $globals.LexicalScope);
  36416. $core.addMethod(
  36417. $core.method({
  36418. selector: "instruction:",
  36419. protocol: "accessing",
  36420. fn: function (anIRInstruction){
  36421. var self=this,$self=this;
  36422. $self["@instruction"]=anIRInstruction;
  36423. return self;
  36424. },
  36425. args: ["anIRInstruction"],
  36426. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36427. referencedClasses: [],
  36428. messageSends: []
  36429. }),
  36430. $globals.LexicalScope);
  36431. $core.addMethod(
  36432. $core.method({
  36433. selector: "isBlockScope",
  36434. protocol: "testing",
  36435. fn: function (){
  36436. var self=this,$self=this;
  36437. return $core.withContext(function($ctx1) {
  36438. return $recv($self._isMethodScope())._not();
  36439. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36440. },
  36441. args: [],
  36442. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36443. referencedClasses: [],
  36444. messageSends: ["not", "isMethodScope"]
  36445. }),
  36446. $globals.LexicalScope);
  36447. $core.addMethod(
  36448. $core.method({
  36449. selector: "isInlined",
  36450. protocol: "testing",
  36451. fn: function (){
  36452. var self=this,$self=this;
  36453. return $core.withContext(function($ctx1) {
  36454. var $2,$1;
  36455. $2=$self._instruction();
  36456. $ctx1.sendIdx["instruction"]=1;
  36457. $1=$recv($2)._notNil();
  36458. return $recv($1)._and_((function(){
  36459. return $core.withContext(function($ctx2) {
  36460. return $recv($self._instruction())._isInlined();
  36461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36462. }));
  36463. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36464. },
  36465. args: [],
  36466. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36467. referencedClasses: [],
  36468. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36469. }),
  36470. $globals.LexicalScope);
  36471. $core.addMethod(
  36472. $core.method({
  36473. selector: "isMethodScope",
  36474. protocol: "testing",
  36475. fn: function (){
  36476. var self=this,$self=this;
  36477. return false;
  36478. },
  36479. args: [],
  36480. source: "isMethodScope\x0a\x09^ false",
  36481. referencedClasses: [],
  36482. messageSends: []
  36483. }),
  36484. $globals.LexicalScope);
  36485. $core.addMethod(
  36486. $core.method({
  36487. selector: "lookupVariable:",
  36488. protocol: "accessing",
  36489. fn: function (aNode){
  36490. var self=this,$self=this;
  36491. var lookup;
  36492. return $core.withContext(function($ctx1) {
  36493. var $1,$2,$receiver;
  36494. lookup=$self._bindingFor_(aNode);
  36495. $1=lookup;
  36496. if(($receiver = $1) == null || $receiver.a$nil){
  36497. $2=$self._outerScope();
  36498. $ctx1.sendIdx["outerScope"]=1;
  36499. if(($receiver = $2) == null || $receiver.a$nil){
  36500. lookup=$2;
  36501. } else {
  36502. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36503. }
  36504. lookup;
  36505. } else {
  36506. $1;
  36507. }
  36508. return lookup;
  36509. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  36510. },
  36511. args: ["aNode"],
  36512. 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",
  36513. referencedClasses: [],
  36514. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  36515. }),
  36516. $globals.LexicalScope);
  36517. $core.addMethod(
  36518. $core.method({
  36519. selector: "methodScope",
  36520. protocol: "accessing",
  36521. fn: function (){
  36522. var self=this,$self=this;
  36523. return $core.withContext(function($ctx1) {
  36524. var $1,$receiver;
  36525. $1=$self._outerScope();
  36526. $ctx1.sendIdx["outerScope"]=1;
  36527. if(($receiver = $1) == null || $receiver.a$nil){
  36528. return $1;
  36529. } else {
  36530. return $recv($self._outerScope())._methodScope();
  36531. }
  36532. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  36533. },
  36534. args: [],
  36535. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  36536. referencedClasses: [],
  36537. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  36538. }),
  36539. $globals.LexicalScope);
  36540. $core.addMethod(
  36541. $core.method({
  36542. selector: "node",
  36543. protocol: "accessing",
  36544. fn: function (){
  36545. var self=this,$self=this;
  36546. return $self["@node"];
  36547. },
  36548. args: [],
  36549. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  36550. referencedClasses: [],
  36551. messageSends: []
  36552. }),
  36553. $globals.LexicalScope);
  36554. $core.addMethod(
  36555. $core.method({
  36556. selector: "node:",
  36557. protocol: "accessing",
  36558. fn: function (aNode){
  36559. var self=this,$self=this;
  36560. $self["@node"]=aNode;
  36561. return self;
  36562. },
  36563. args: ["aNode"],
  36564. source: "node: aNode\x0a\x09node := aNode",
  36565. referencedClasses: [],
  36566. messageSends: []
  36567. }),
  36568. $globals.LexicalScope);
  36569. $core.addMethod(
  36570. $core.method({
  36571. selector: "outerScope",
  36572. protocol: "accessing",
  36573. fn: function (){
  36574. var self=this,$self=this;
  36575. return $self["@outerScope"];
  36576. },
  36577. args: [],
  36578. source: "outerScope\x0a\x09^ outerScope",
  36579. referencedClasses: [],
  36580. messageSends: []
  36581. }),
  36582. $globals.LexicalScope);
  36583. $core.addMethod(
  36584. $core.method({
  36585. selector: "outerScope:",
  36586. protocol: "accessing",
  36587. fn: function (aLexicalScope){
  36588. var self=this,$self=this;
  36589. $self["@outerScope"]=aLexicalScope;
  36590. return self;
  36591. },
  36592. args: ["aLexicalScope"],
  36593. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  36594. referencedClasses: [],
  36595. messageSends: []
  36596. }),
  36597. $globals.LexicalScope);
  36598. $core.addMethod(
  36599. $core.method({
  36600. selector: "pseudoVars",
  36601. protocol: "accessing",
  36602. fn: function (){
  36603. var self=this,$self=this;
  36604. return $core.withContext(function($ctx1) {
  36605. return $recv($self._methodScope())._pseudoVars();
  36606. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  36607. },
  36608. args: [],
  36609. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  36610. referencedClasses: [],
  36611. messageSends: ["pseudoVars", "methodScope"]
  36612. }),
  36613. $globals.LexicalScope);
  36614. $core.addMethod(
  36615. $core.method({
  36616. selector: "scopeLevel",
  36617. protocol: "accessing",
  36618. fn: function (){
  36619. var self=this,$self=this;
  36620. return $core.withContext(function($ctx1) {
  36621. var $1,$2,$4,$3,$receiver;
  36622. $1=$self._outerScope();
  36623. $ctx1.sendIdx["outerScope"]=1;
  36624. if(($receiver = $1) == null || $receiver.a$nil){
  36625. return (1);
  36626. } else {
  36627. $1;
  36628. }
  36629. $2=$self._isInlined();
  36630. if($core.assert($2)){
  36631. $4=$self._outerScope();
  36632. $ctx1.sendIdx["outerScope"]=2;
  36633. $3=$recv($4)._scopeLevel();
  36634. $ctx1.sendIdx["scopeLevel"]=1;
  36635. return $3;
  36636. }
  36637. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  36638. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  36639. },
  36640. args: [],
  36641. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  36642. referencedClasses: [],
  36643. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  36644. }),
  36645. $globals.LexicalScope);
  36646. $core.addMethod(
  36647. $core.method({
  36648. selector: "temps",
  36649. protocol: "accessing",
  36650. fn: function (){
  36651. var self=this,$self=this;
  36652. return $core.withContext(function($ctx1) {
  36653. var $1,$receiver;
  36654. $1=$self["@temps"];
  36655. if(($receiver = $1) == null || $receiver.a$nil){
  36656. $self["@temps"]=$recv($globals.Dictionary)._new();
  36657. return $self["@temps"];
  36658. } else {
  36659. return $1;
  36660. }
  36661. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  36662. },
  36663. args: [],
  36664. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  36665. referencedClasses: ["Dictionary"],
  36666. messageSends: ["ifNil:", "new"]
  36667. }),
  36668. $globals.LexicalScope);
  36669. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  36670. $globals.MethodLexicalScope.comment="I represent a method scope.";
  36671. $core.addMethod(
  36672. $core.method({
  36673. selector: "addIVar:",
  36674. protocol: "adding",
  36675. fn: function (aString){
  36676. var self=this,$self=this;
  36677. return $core.withContext(function($ctx1) {
  36678. var $1;
  36679. $1=$self._iVars();
  36680. $ctx1.sendIdx["iVars"]=1;
  36681. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  36682. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  36683. return self;
  36684. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  36685. },
  36686. args: ["aString"],
  36687. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  36688. referencedClasses: ["InstanceVar"],
  36689. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  36690. }),
  36691. $globals.MethodLexicalScope);
  36692. $core.addMethod(
  36693. $core.method({
  36694. selector: "addNonLocalReturn:",
  36695. protocol: "adding",
  36696. fn: function (aScope){
  36697. var self=this,$self=this;
  36698. return $core.withContext(function($ctx1) {
  36699. $recv($self._nonLocalReturns())._add_(aScope);
  36700. return self;
  36701. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  36702. },
  36703. args: ["aScope"],
  36704. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  36705. referencedClasses: [],
  36706. messageSends: ["add:", "nonLocalReturns"]
  36707. }),
  36708. $globals.MethodLexicalScope);
  36709. $core.addMethod(
  36710. $core.method({
  36711. selector: "allVariableNames",
  36712. protocol: "accessing",
  36713. fn: function (){
  36714. var self=this,$self=this;
  36715. return $core.withContext(function($ctx1) {
  36716. var $1;
  36717. $1=(
  36718. $ctx1.supercall = true,
  36719. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  36720. $ctx1.supercall = false;
  36721. return $recv($1).__comma($recv($self._iVars())._keys());
  36722. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  36723. },
  36724. args: [],
  36725. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  36726. referencedClasses: [],
  36727. messageSends: [",", "allVariableNames", "keys", "iVars"]
  36728. }),
  36729. $globals.MethodLexicalScope);
  36730. $core.addMethod(
  36731. $core.method({
  36732. selector: "bindingFor:",
  36733. protocol: "accessing",
  36734. fn: function (aNode){
  36735. var self=this,$self=this;
  36736. return $core.withContext(function($ctx1) {
  36737. var $1,$receiver;
  36738. $1=(
  36739. $ctx1.supercall = true,
  36740. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  36741. $ctx1.supercall = false;
  36742. if(($receiver = $1) == null || $receiver.a$nil){
  36743. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  36744. return nil;
  36745. }));
  36746. } else {
  36747. return $1;
  36748. }
  36749. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  36750. },
  36751. args: ["aNode"],
  36752. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  36753. referencedClasses: [],
  36754. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  36755. }),
  36756. $globals.MethodLexicalScope);
  36757. $core.addMethod(
  36758. $core.method({
  36759. selector: "canInlineNonLocalReturns",
  36760. protocol: "testing",
  36761. fn: function (){
  36762. var self=this,$self=this;
  36763. return true;
  36764. },
  36765. args: [],
  36766. source: "canInlineNonLocalReturns\x0a\x09^ true",
  36767. referencedClasses: [],
  36768. messageSends: []
  36769. }),
  36770. $globals.MethodLexicalScope);
  36771. $core.addMethod(
  36772. $core.method({
  36773. selector: "hasLocalReturn",
  36774. protocol: "testing",
  36775. fn: function (){
  36776. var self=this,$self=this;
  36777. return $core.withContext(function($ctx1) {
  36778. return $self._localReturn();
  36779. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  36780. },
  36781. args: [],
  36782. source: "hasLocalReturn\x0a\x09^ self localReturn",
  36783. referencedClasses: [],
  36784. messageSends: ["localReturn"]
  36785. }),
  36786. $globals.MethodLexicalScope);
  36787. $core.addMethod(
  36788. $core.method({
  36789. selector: "hasNonLocalReturn",
  36790. protocol: "testing",
  36791. fn: function (){
  36792. var self=this,$self=this;
  36793. return $core.withContext(function($ctx1) {
  36794. return $recv($self._nonLocalReturns())._notEmpty();
  36795. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  36796. },
  36797. args: [],
  36798. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  36799. referencedClasses: [],
  36800. messageSends: ["notEmpty", "nonLocalReturns"]
  36801. }),
  36802. $globals.MethodLexicalScope);
  36803. $core.addMethod(
  36804. $core.method({
  36805. selector: "iVars",
  36806. protocol: "accessing",
  36807. fn: function (){
  36808. var self=this,$self=this;
  36809. return $core.withContext(function($ctx1) {
  36810. var $1,$receiver;
  36811. $1=$self["@iVars"];
  36812. if(($receiver = $1) == null || $receiver.a$nil){
  36813. $self["@iVars"]=$recv($globals.Dictionary)._new();
  36814. return $self["@iVars"];
  36815. } else {
  36816. return $1;
  36817. }
  36818. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  36819. },
  36820. args: [],
  36821. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  36822. referencedClasses: ["Dictionary"],
  36823. messageSends: ["ifNil:", "new"]
  36824. }),
  36825. $globals.MethodLexicalScope);
  36826. $core.addMethod(
  36827. $core.method({
  36828. selector: "isMethodScope",
  36829. protocol: "testing",
  36830. fn: function (){
  36831. var self=this,$self=this;
  36832. return true;
  36833. },
  36834. args: [],
  36835. source: "isMethodScope\x0a\x09^ true",
  36836. referencedClasses: [],
  36837. messageSends: []
  36838. }),
  36839. $globals.MethodLexicalScope);
  36840. $core.addMethod(
  36841. $core.method({
  36842. selector: "localReturn",
  36843. protocol: "accessing",
  36844. fn: function (){
  36845. var self=this,$self=this;
  36846. return $core.withContext(function($ctx1) {
  36847. var $1,$receiver;
  36848. $1=$self["@localReturn"];
  36849. if(($receiver = $1) == null || $receiver.a$nil){
  36850. return false;
  36851. } else {
  36852. return $1;
  36853. }
  36854. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  36855. },
  36856. args: [],
  36857. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  36858. referencedClasses: [],
  36859. messageSends: ["ifNil:"]
  36860. }),
  36861. $globals.MethodLexicalScope);
  36862. $core.addMethod(
  36863. $core.method({
  36864. selector: "localReturn:",
  36865. protocol: "accessing",
  36866. fn: function (aBoolean){
  36867. var self=this,$self=this;
  36868. $self["@localReturn"]=aBoolean;
  36869. return self;
  36870. },
  36871. args: ["aBoolean"],
  36872. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  36873. referencedClasses: [],
  36874. messageSends: []
  36875. }),
  36876. $globals.MethodLexicalScope);
  36877. $core.addMethod(
  36878. $core.method({
  36879. selector: "methodScope",
  36880. protocol: "accessing",
  36881. fn: function (){
  36882. var self=this,$self=this;
  36883. return self;
  36884. },
  36885. args: [],
  36886. source: "methodScope\x0a\x09^ self",
  36887. referencedClasses: [],
  36888. messageSends: []
  36889. }),
  36890. $globals.MethodLexicalScope);
  36891. $core.addMethod(
  36892. $core.method({
  36893. selector: "nonLocalReturns",
  36894. protocol: "accessing",
  36895. fn: function (){
  36896. var self=this,$self=this;
  36897. return $core.withContext(function($ctx1) {
  36898. var $1,$receiver;
  36899. $1=$self["@nonLocalReturns"];
  36900. if(($receiver = $1) == null || $receiver.a$nil){
  36901. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  36902. return $self["@nonLocalReturns"];
  36903. } else {
  36904. return $1;
  36905. }
  36906. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  36907. },
  36908. args: [],
  36909. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  36910. referencedClasses: ["OrderedCollection"],
  36911. messageSends: ["ifNil:", "new"]
  36912. }),
  36913. $globals.MethodLexicalScope);
  36914. $core.addMethod(
  36915. $core.method({
  36916. selector: "pseudoVars",
  36917. protocol: "accessing",
  36918. fn: function (){
  36919. var self=this,$self=this;
  36920. return $core.withContext(function($ctx1) {
  36921. var $1,$2,$4,$3,$receiver;
  36922. $1=$self["@pseudoVars"];
  36923. if(($receiver = $1) == null || $receiver.a$nil){
  36924. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  36925. $self["@pseudoVars"];
  36926. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  36927. return $core.withContext(function($ctx2) {
  36928. $2=$self["@pseudoVars"];
  36929. $4=$recv($globals.PseudoVar)._on_(each);
  36930. $recv($4)._scope_($self._methodScope());
  36931. $3=$recv($4)._yourself();
  36932. return $recv($2)._at_put_(each,$3);
  36933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36934. }));
  36935. } else {
  36936. $1;
  36937. }
  36938. return $self["@pseudoVars"];
  36939. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  36940. },
  36941. args: [],
  36942. 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",
  36943. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  36944. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  36945. }),
  36946. $globals.MethodLexicalScope);
  36947. $core.addMethod(
  36948. $core.method({
  36949. selector: "removeNonLocalReturn:",
  36950. protocol: "adding",
  36951. fn: function (aScope){
  36952. var self=this,$self=this;
  36953. return $core.withContext(function($ctx1) {
  36954. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  36955. }));
  36956. return self;
  36957. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  36958. },
  36959. args: ["aScope"],
  36960. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  36961. referencedClasses: [],
  36962. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  36963. }),
  36964. $globals.MethodLexicalScope);
  36965. $core.addMethod(
  36966. $core.method({
  36967. selector: "unknownVariables",
  36968. protocol: "accessing",
  36969. fn: function (){
  36970. var self=this,$self=this;
  36971. return $core.withContext(function($ctx1) {
  36972. var $1,$receiver;
  36973. $1=$self["@unknownVariables"];
  36974. if(($receiver = $1) == null || $receiver.a$nil){
  36975. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  36976. return $self["@unknownVariables"];
  36977. } else {
  36978. return $1;
  36979. }
  36980. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  36981. },
  36982. args: [],
  36983. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  36984. referencedClasses: ["OrderedCollection"],
  36985. messageSends: ["ifNil:", "new"]
  36986. }),
  36987. $globals.MethodLexicalScope);
  36988. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  36989. $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.";
  36990. $core.addMethod(
  36991. $core.method({
  36992. selector: "alias",
  36993. protocol: "accessing",
  36994. fn: function (){
  36995. var self=this,$self=this;
  36996. return $core.withContext(function($ctx1) {
  36997. return $recv($self._name())._asVariableName();
  36998. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  36999. },
  37000. args: [],
  37001. source: "alias\x0a\x09^ self name asVariableName",
  37002. referencedClasses: [],
  37003. messageSends: ["asVariableName", "name"]
  37004. }),
  37005. $globals.ScopeVar);
  37006. $core.addMethod(
  37007. $core.method({
  37008. selector: "isArgVar",
  37009. protocol: "testing",
  37010. fn: function (){
  37011. var self=this,$self=this;
  37012. return false;
  37013. },
  37014. args: [],
  37015. source: "isArgVar\x0a\x09^ false",
  37016. referencedClasses: [],
  37017. messageSends: []
  37018. }),
  37019. $globals.ScopeVar);
  37020. $core.addMethod(
  37021. $core.method({
  37022. selector: "isClassRefVar",
  37023. protocol: "testing",
  37024. fn: function (){
  37025. var self=this,$self=this;
  37026. return false;
  37027. },
  37028. args: [],
  37029. source: "isClassRefVar\x0a\x09^ false",
  37030. referencedClasses: [],
  37031. messageSends: []
  37032. }),
  37033. $globals.ScopeVar);
  37034. $core.addMethod(
  37035. $core.method({
  37036. selector: "isImmutable",
  37037. protocol: "testing",
  37038. fn: function (){
  37039. var self=this,$self=this;
  37040. return false;
  37041. },
  37042. args: [],
  37043. source: "isImmutable\x0a\x09^ false",
  37044. referencedClasses: [],
  37045. messageSends: []
  37046. }),
  37047. $globals.ScopeVar);
  37048. $core.addMethod(
  37049. $core.method({
  37050. selector: "isInstanceVar",
  37051. protocol: "testing",
  37052. fn: function (){
  37053. var self=this,$self=this;
  37054. return false;
  37055. },
  37056. args: [],
  37057. source: "isInstanceVar\x0a\x09^ false",
  37058. referencedClasses: [],
  37059. messageSends: []
  37060. }),
  37061. $globals.ScopeVar);
  37062. $core.addMethod(
  37063. $core.method({
  37064. selector: "isPseudoVar",
  37065. protocol: "testing",
  37066. fn: function (){
  37067. var self=this,$self=this;
  37068. return false;
  37069. },
  37070. args: [],
  37071. source: "isPseudoVar\x0a\x09^ false",
  37072. referencedClasses: [],
  37073. messageSends: []
  37074. }),
  37075. $globals.ScopeVar);
  37076. $core.addMethod(
  37077. $core.method({
  37078. selector: "isSelf",
  37079. protocol: "testing",
  37080. fn: function (){
  37081. var self=this,$self=this;
  37082. return false;
  37083. },
  37084. args: [],
  37085. source: "isSelf\x0a\x09^ false",
  37086. referencedClasses: [],
  37087. messageSends: []
  37088. }),
  37089. $globals.ScopeVar);
  37090. $core.addMethod(
  37091. $core.method({
  37092. selector: "isSuper",
  37093. protocol: "testing",
  37094. fn: function (){
  37095. var self=this,$self=this;
  37096. return false;
  37097. },
  37098. args: [],
  37099. source: "isSuper\x0a\x09^ false",
  37100. referencedClasses: [],
  37101. messageSends: []
  37102. }),
  37103. $globals.ScopeVar);
  37104. $core.addMethod(
  37105. $core.method({
  37106. selector: "isTempVar",
  37107. protocol: "testing",
  37108. fn: function (){
  37109. var self=this,$self=this;
  37110. return false;
  37111. },
  37112. args: [],
  37113. source: "isTempVar\x0a\x09^ false",
  37114. referencedClasses: [],
  37115. messageSends: []
  37116. }),
  37117. $globals.ScopeVar);
  37118. $core.addMethod(
  37119. $core.method({
  37120. selector: "isUnknownVar",
  37121. protocol: "testing",
  37122. fn: function (){
  37123. var self=this,$self=this;
  37124. return false;
  37125. },
  37126. args: [],
  37127. source: "isUnknownVar\x0a\x09^ false",
  37128. referencedClasses: [],
  37129. messageSends: []
  37130. }),
  37131. $globals.ScopeVar);
  37132. $core.addMethod(
  37133. $core.method({
  37134. selector: "name",
  37135. protocol: "accessing",
  37136. fn: function (){
  37137. var self=this,$self=this;
  37138. return $self["@name"];
  37139. },
  37140. args: [],
  37141. source: "name\x0a\x09^ name",
  37142. referencedClasses: [],
  37143. messageSends: []
  37144. }),
  37145. $globals.ScopeVar);
  37146. $core.addMethod(
  37147. $core.method({
  37148. selector: "name:",
  37149. protocol: "accessing",
  37150. fn: function (aString){
  37151. var self=this,$self=this;
  37152. $self["@name"]=aString;
  37153. return self;
  37154. },
  37155. args: ["aString"],
  37156. source: "name: aString\x0a\x09name := aString",
  37157. referencedClasses: [],
  37158. messageSends: []
  37159. }),
  37160. $globals.ScopeVar);
  37161. $core.addMethod(
  37162. $core.method({
  37163. selector: "scope",
  37164. protocol: "accessing",
  37165. fn: function (){
  37166. var self=this,$self=this;
  37167. return $self["@scope"];
  37168. },
  37169. args: [],
  37170. source: "scope\x0a\x09^ scope",
  37171. referencedClasses: [],
  37172. messageSends: []
  37173. }),
  37174. $globals.ScopeVar);
  37175. $core.addMethod(
  37176. $core.method({
  37177. selector: "scope:",
  37178. protocol: "accessing",
  37179. fn: function (aScope){
  37180. var self=this,$self=this;
  37181. $self["@scope"]=aScope;
  37182. return self;
  37183. },
  37184. args: ["aScope"],
  37185. source: "scope: aScope\x0a\x09scope := aScope",
  37186. referencedClasses: [],
  37187. messageSends: []
  37188. }),
  37189. $globals.ScopeVar);
  37190. $core.addMethod(
  37191. $core.method({
  37192. selector: "validateAssignment",
  37193. protocol: "testing",
  37194. fn: function (){
  37195. var self=this,$self=this;
  37196. return $core.withContext(function($ctx1) {
  37197. var $1,$2;
  37198. $1=$recv($self._isArgVar())._or_((function(){
  37199. return $core.withContext(function($ctx2) {
  37200. return $self._isPseudoVar();
  37201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37202. }));
  37203. if($core.assert($1)){
  37204. $2=$recv($globals.InvalidAssignmentError)._new();
  37205. $recv($2)._variableName_($self._name());
  37206. $recv($2)._signal();
  37207. }
  37208. return self;
  37209. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37210. },
  37211. args: [],
  37212. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37213. referencedClasses: ["InvalidAssignmentError"],
  37214. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37215. }),
  37216. $globals.ScopeVar);
  37217. $core.addMethod(
  37218. $core.method({
  37219. selector: "on:",
  37220. protocol: "instance creation",
  37221. fn: function (aString){
  37222. var self=this,$self=this;
  37223. return $core.withContext(function($ctx1) {
  37224. var $1;
  37225. $1=$self._new();
  37226. $recv($1)._name_(aString);
  37227. return $recv($1)._yourself();
  37228. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37229. },
  37230. args: ["aString"],
  37231. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37232. referencedClasses: [],
  37233. messageSends: ["name:", "new", "yourself"]
  37234. }),
  37235. $globals.ScopeVar.a$cls);
  37236. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37237. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37238. $core.addMethod(
  37239. $core.method({
  37240. selector: "isImmutable",
  37241. protocol: "testing",
  37242. fn: function (){
  37243. var self=this,$self=this;
  37244. return true;
  37245. },
  37246. args: [],
  37247. source: "isImmutable\x0a\x09^ true",
  37248. referencedClasses: [],
  37249. messageSends: []
  37250. }),
  37251. $globals.AliasVar);
  37252. $core.addMethod(
  37253. $core.method({
  37254. selector: "node",
  37255. protocol: "accessing",
  37256. fn: function (){
  37257. var self=this,$self=this;
  37258. return $self["@node"];
  37259. },
  37260. args: [],
  37261. source: "node\x0a\x09^ node",
  37262. referencedClasses: [],
  37263. messageSends: []
  37264. }),
  37265. $globals.AliasVar);
  37266. $core.addMethod(
  37267. $core.method({
  37268. selector: "node:",
  37269. protocol: "accessing",
  37270. fn: function (aNode){
  37271. var self=this,$self=this;
  37272. $self["@node"]=aNode;
  37273. return self;
  37274. },
  37275. args: ["aNode"],
  37276. source: "node: aNode\x0a\x09node := aNode",
  37277. referencedClasses: [],
  37278. messageSends: []
  37279. }),
  37280. $globals.AliasVar);
  37281. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37282. $globals.ArgVar.comment="I am an argument of a method or block.";
  37283. $core.addMethod(
  37284. $core.method({
  37285. selector: "isArgVar",
  37286. protocol: "testing",
  37287. fn: function (){
  37288. var self=this,$self=this;
  37289. return true;
  37290. },
  37291. args: [],
  37292. source: "isArgVar\x0a\x09^ true",
  37293. referencedClasses: [],
  37294. messageSends: []
  37295. }),
  37296. $globals.ArgVar);
  37297. $core.addMethod(
  37298. $core.method({
  37299. selector: "isImmutable",
  37300. protocol: "testing",
  37301. fn: function (){
  37302. var self=this,$self=this;
  37303. return true;
  37304. },
  37305. args: [],
  37306. source: "isImmutable\x0a\x09^ true",
  37307. referencedClasses: [],
  37308. messageSends: []
  37309. }),
  37310. $globals.ArgVar);
  37311. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37312. $globals.ClassRefVar.comment="I am an class reference variable";
  37313. $core.addMethod(
  37314. $core.method({
  37315. selector: "alias",
  37316. protocol: "accessing",
  37317. fn: function (){
  37318. var self=this,$self=this;
  37319. return $core.withContext(function($ctx1) {
  37320. return "$globals.".__comma($self._name());
  37321. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37322. },
  37323. args: [],
  37324. 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",
  37325. referencedClasses: [],
  37326. messageSends: [",", "name"]
  37327. }),
  37328. $globals.ClassRefVar);
  37329. $core.addMethod(
  37330. $core.method({
  37331. selector: "isClassRefVar",
  37332. protocol: "testing",
  37333. fn: function (){
  37334. var self=this,$self=this;
  37335. return true;
  37336. },
  37337. args: [],
  37338. source: "isClassRefVar\x0a\x09^ true",
  37339. referencedClasses: [],
  37340. messageSends: []
  37341. }),
  37342. $globals.ClassRefVar);
  37343. $core.addMethod(
  37344. $core.method({
  37345. selector: "isImmutable",
  37346. protocol: "testing",
  37347. fn: function (){
  37348. var self=this,$self=this;
  37349. return true;
  37350. },
  37351. args: [],
  37352. source: "isImmutable\x0a\x09^ true",
  37353. referencedClasses: [],
  37354. messageSends: []
  37355. }),
  37356. $globals.ClassRefVar);
  37357. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37358. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37359. $core.addMethod(
  37360. $core.method({
  37361. selector: "alias",
  37362. protocol: "testing",
  37363. fn: function (){
  37364. var self=this,$self=this;
  37365. return $core.withContext(function($ctx1) {
  37366. var $1;
  37367. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37368. $ctx1.sendIdx[","]=1;
  37369. return $1;
  37370. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37371. },
  37372. args: [],
  37373. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37374. referencedClasses: [],
  37375. messageSends: [",", "name"]
  37376. }),
  37377. $globals.InstanceVar);
  37378. $core.addMethod(
  37379. $core.method({
  37380. selector: "isInstanceVar",
  37381. protocol: "testing",
  37382. fn: function (){
  37383. var self=this,$self=this;
  37384. return true;
  37385. },
  37386. args: [],
  37387. source: "isInstanceVar\x0a\x09^ true",
  37388. referencedClasses: [],
  37389. messageSends: []
  37390. }),
  37391. $globals.InstanceVar);
  37392. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37393. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37394. $core.addMethod(
  37395. $core.method({
  37396. selector: "alias",
  37397. protocol: "accessing",
  37398. fn: function (){
  37399. var self=this,$self=this;
  37400. return $core.withContext(function($ctx1) {
  37401. return $self._name();
  37402. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37403. },
  37404. args: [],
  37405. source: "alias\x0a\x09^ self name",
  37406. referencedClasses: [],
  37407. messageSends: ["name"]
  37408. }),
  37409. $globals.PseudoVar);
  37410. $core.addMethod(
  37411. $core.method({
  37412. selector: "isImmutable",
  37413. protocol: "testing",
  37414. fn: function (){
  37415. var self=this,$self=this;
  37416. return true;
  37417. },
  37418. args: [],
  37419. source: "isImmutable\x0a\x09^ true",
  37420. referencedClasses: [],
  37421. messageSends: []
  37422. }),
  37423. $globals.PseudoVar);
  37424. $core.addMethod(
  37425. $core.method({
  37426. selector: "isPseudoVar",
  37427. protocol: "testing",
  37428. fn: function (){
  37429. var self=this,$self=this;
  37430. return true;
  37431. },
  37432. args: [],
  37433. source: "isPseudoVar\x0a\x09^ true",
  37434. referencedClasses: [],
  37435. messageSends: []
  37436. }),
  37437. $globals.PseudoVar);
  37438. $core.addMethod(
  37439. $core.method({
  37440. selector: "isSelf",
  37441. protocol: "testing",
  37442. fn: function (){
  37443. var self=this,$self=this;
  37444. return $core.withContext(function($ctx1) {
  37445. return $recv($self["@name"]).__eq("self");
  37446. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37447. },
  37448. args: [],
  37449. source: "isSelf\x0a\x09^ name = 'self'",
  37450. referencedClasses: [],
  37451. messageSends: ["="]
  37452. }),
  37453. $globals.PseudoVar);
  37454. $core.addMethod(
  37455. $core.method({
  37456. selector: "isSuper",
  37457. protocol: "testing",
  37458. fn: function (){
  37459. var self=this,$self=this;
  37460. return $core.withContext(function($ctx1) {
  37461. return $recv($self["@name"]).__eq("super");
  37462. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37463. },
  37464. args: [],
  37465. source: "isSuper\x0a\x09^ name = 'super'",
  37466. referencedClasses: [],
  37467. messageSends: ["="]
  37468. }),
  37469. $globals.PseudoVar);
  37470. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37471. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37472. $core.addMethod(
  37473. $core.method({
  37474. selector: "isTempVar",
  37475. protocol: "testing",
  37476. fn: function (){
  37477. var self=this,$self=this;
  37478. return true;
  37479. },
  37480. args: [],
  37481. source: "isTempVar\x0a\x09^ true",
  37482. referencedClasses: [],
  37483. messageSends: []
  37484. }),
  37485. $globals.TempVar);
  37486. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37487. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37488. $core.addMethod(
  37489. $core.method({
  37490. selector: "isUnknownVar",
  37491. protocol: "testing",
  37492. fn: function (){
  37493. var self=this,$self=this;
  37494. return true;
  37495. },
  37496. args: [],
  37497. source: "isUnknownVar\x0a\x09^ true",
  37498. referencedClasses: [],
  37499. messageSends: []
  37500. }),
  37501. $globals.UnknownVar);
  37502. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37503. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37504. $core.addMethod(
  37505. $core.method({
  37506. selector: "classReferences",
  37507. protocol: "accessing",
  37508. fn: function (){
  37509. var self=this,$self=this;
  37510. return $core.withContext(function($ctx1) {
  37511. var $1,$receiver;
  37512. $1=$self["@classReferences"];
  37513. if(($receiver = $1) == null || $receiver.a$nil){
  37514. $self["@classReferences"]=$recv($globals.Set)._new();
  37515. return $self["@classReferences"];
  37516. } else {
  37517. return $1;
  37518. }
  37519. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  37520. },
  37521. args: [],
  37522. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  37523. referencedClasses: ["Set"],
  37524. messageSends: ["ifNil:", "new"]
  37525. }),
  37526. $globals.SemanticAnalyzer);
  37527. $core.addMethod(
  37528. $core.method({
  37529. selector: "errorShadowingVariable:",
  37530. protocol: "error handling",
  37531. fn: function (aString){
  37532. var self=this,$self=this;
  37533. return $core.withContext(function($ctx1) {
  37534. var $1;
  37535. $1=$recv($globals.ShadowingVariableError)._new();
  37536. $recv($1)._variableName_(aString);
  37537. $recv($1)._signal();
  37538. return self;
  37539. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  37540. },
  37541. args: ["aString"],
  37542. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  37543. referencedClasses: ["ShadowingVariableError"],
  37544. messageSends: ["variableName:", "new", "signal"]
  37545. }),
  37546. $globals.SemanticAnalyzer);
  37547. $core.addMethod(
  37548. $core.method({
  37549. selector: "errorUnknownVariable:",
  37550. protocol: "error handling",
  37551. fn: function (aNode){
  37552. var self=this,$self=this;
  37553. var identifier;
  37554. return $core.withContext(function($ctx1) {
  37555. var $1,$2,$3;
  37556. identifier=$recv(aNode)._value();
  37557. $ctx1.sendIdx["value"]=1;
  37558. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  37559. return $core.withContext(function($ctx2) {
  37560. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  37561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37562. }));
  37563. if($core.assert($1)){
  37564. $2=$recv($globals.UnknownVariableError)._new();
  37565. $3=$recv(aNode)._value();
  37566. $ctx1.sendIdx["value"]=2;
  37567. $recv($2)._variableName_($3);
  37568. $recv($2)._signal();
  37569. } else {
  37570. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  37571. }
  37572. return self;
  37573. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  37574. },
  37575. args: ["aNode"],
  37576. 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 ]",
  37577. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  37578. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  37579. }),
  37580. $globals.SemanticAnalyzer);
  37581. $core.addMethod(
  37582. $core.method({
  37583. selector: "isVariableUndefined:inPackage:",
  37584. protocol: "testing",
  37585. fn: function (aString,aPackage){
  37586. var self=this,$self=this;
  37587. return $core.withContext(function($ctx1) {
  37588. var $1,$2,$receiver;
  37589. if(($receiver = aPackage) == null || $receiver.a$nil){
  37590. aPackage;
  37591. } else {
  37592. var packageKnownVars;
  37593. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  37594. packageKnownVars;
  37595. $1=$recv(packageKnownVars)._includes_(aString);
  37596. if($core.assert($1)){
  37597. return false;
  37598. }
  37599. }
  37600. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  37601. $ctx1.sendIdx[","]=1;
  37602. return $recv($globals.Compiler)._eval_($2);
  37603. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  37604. },
  37605. args: ["aString", "aPackage"],
  37606. 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'",
  37607. referencedClasses: ["Compiler"],
  37608. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  37609. }),
  37610. $globals.SemanticAnalyzer);
  37611. $core.addMethod(
  37612. $core.method({
  37613. selector: "messageSends",
  37614. protocol: "accessing",
  37615. fn: function (){
  37616. var self=this,$self=this;
  37617. return $core.withContext(function($ctx1) {
  37618. var $1,$receiver;
  37619. $1=$self["@messageSends"];
  37620. if(($receiver = $1) == null || $receiver.a$nil){
  37621. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  37622. return $self["@messageSends"];
  37623. } else {
  37624. return $1;
  37625. }
  37626. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  37627. },
  37628. args: [],
  37629. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  37630. referencedClasses: ["Dictionary"],
  37631. messageSends: ["ifNil:", "new"]
  37632. }),
  37633. $globals.SemanticAnalyzer);
  37634. $core.addMethod(
  37635. $core.method({
  37636. selector: "newBlockScope",
  37637. protocol: "factory",
  37638. fn: function (){
  37639. var self=this,$self=this;
  37640. return $core.withContext(function($ctx1) {
  37641. return $self._newScopeOfClass_($globals.LexicalScope);
  37642. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  37643. },
  37644. args: [],
  37645. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  37646. referencedClasses: ["LexicalScope"],
  37647. messageSends: ["newScopeOfClass:"]
  37648. }),
  37649. $globals.SemanticAnalyzer);
  37650. $core.addMethod(
  37651. $core.method({
  37652. selector: "newMethodScope",
  37653. protocol: "factory",
  37654. fn: function (){
  37655. var self=this,$self=this;
  37656. return $core.withContext(function($ctx1) {
  37657. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  37658. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  37659. },
  37660. args: [],
  37661. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  37662. referencedClasses: ["MethodLexicalScope"],
  37663. messageSends: ["newScopeOfClass:"]
  37664. }),
  37665. $globals.SemanticAnalyzer);
  37666. $core.addMethod(
  37667. $core.method({
  37668. selector: "newScopeOfClass:",
  37669. protocol: "factory",
  37670. fn: function (aLexicalScopeClass){
  37671. var self=this,$self=this;
  37672. return $core.withContext(function($ctx1) {
  37673. var $1;
  37674. $1=$recv(aLexicalScopeClass)._new();
  37675. $recv($1)._outerScope_($self["@currentScope"]);
  37676. return $recv($1)._yourself();
  37677. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  37678. },
  37679. args: ["aLexicalScopeClass"],
  37680. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  37681. referencedClasses: [],
  37682. messageSends: ["outerScope:", "new", "yourself"]
  37683. }),
  37684. $globals.SemanticAnalyzer);
  37685. $core.addMethod(
  37686. $core.method({
  37687. selector: "nextBlockIndex",
  37688. protocol: "private",
  37689. fn: function (){
  37690. var self=this,$self=this;
  37691. return $core.withContext(function($ctx1) {
  37692. var $1,$receiver;
  37693. $1=$self["@blockIndex"];
  37694. if(($receiver = $1) == null || $receiver.a$nil){
  37695. $self["@blockIndex"]=(0);
  37696. $self["@blockIndex"];
  37697. } else {
  37698. $1;
  37699. }
  37700. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  37701. return $self["@blockIndex"];
  37702. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  37703. },
  37704. args: [],
  37705. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  37706. referencedClasses: [],
  37707. messageSends: ["ifNil:", "+"]
  37708. }),
  37709. $globals.SemanticAnalyzer);
  37710. $core.addMethod(
  37711. $core.method({
  37712. selector: "popScope",
  37713. protocol: "scope",
  37714. fn: function (){
  37715. var self=this,$self=this;
  37716. return $core.withContext(function($ctx1) {
  37717. var $1,$receiver;
  37718. $1=$self["@currentScope"];
  37719. if(($receiver = $1) == null || $receiver.a$nil){
  37720. $1;
  37721. } else {
  37722. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  37723. $self["@currentScope"];
  37724. }
  37725. return self;
  37726. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  37727. },
  37728. args: [],
  37729. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  37730. referencedClasses: [],
  37731. messageSends: ["ifNotNil:", "outerScope"]
  37732. }),
  37733. $globals.SemanticAnalyzer);
  37734. $core.addMethod(
  37735. $core.method({
  37736. selector: "pushScope:",
  37737. protocol: "scope",
  37738. fn: function (aScope){
  37739. var self=this,$self=this;
  37740. return $core.withContext(function($ctx1) {
  37741. $recv(aScope)._outerScope_($self["@currentScope"]);
  37742. $self["@currentScope"]=aScope;
  37743. return self;
  37744. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  37745. },
  37746. args: ["aScope"],
  37747. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  37748. referencedClasses: [],
  37749. messageSends: ["outerScope:"]
  37750. }),
  37751. $globals.SemanticAnalyzer);
  37752. $core.addMethod(
  37753. $core.method({
  37754. selector: "theClass",
  37755. protocol: "accessing",
  37756. fn: function (){
  37757. var self=this,$self=this;
  37758. return $self["@theClass"];
  37759. },
  37760. args: [],
  37761. source: "theClass\x0a\x09^ theClass",
  37762. referencedClasses: [],
  37763. messageSends: []
  37764. }),
  37765. $globals.SemanticAnalyzer);
  37766. $core.addMethod(
  37767. $core.method({
  37768. selector: "theClass:",
  37769. protocol: "accessing",
  37770. fn: function (aClass){
  37771. var self=this,$self=this;
  37772. $self["@theClass"]=aClass;
  37773. return self;
  37774. },
  37775. args: ["aClass"],
  37776. source: "theClass: aClass\x0a\x09theClass := aClass",
  37777. referencedClasses: [],
  37778. messageSends: []
  37779. }),
  37780. $globals.SemanticAnalyzer);
  37781. $core.addMethod(
  37782. $core.method({
  37783. selector: "thePackage",
  37784. protocol: "accessing",
  37785. fn: function (){
  37786. var self=this,$self=this;
  37787. return $self["@thePackage"];
  37788. },
  37789. args: [],
  37790. source: "thePackage\x0a\x09^ thePackage",
  37791. referencedClasses: [],
  37792. messageSends: []
  37793. }),
  37794. $globals.SemanticAnalyzer);
  37795. $core.addMethod(
  37796. $core.method({
  37797. selector: "thePackage:",
  37798. protocol: "accessing",
  37799. fn: function (aPackage){
  37800. var self=this,$self=this;
  37801. $self["@thePackage"]=aPackage;
  37802. return self;
  37803. },
  37804. args: ["aPackage"],
  37805. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  37806. referencedClasses: [],
  37807. messageSends: []
  37808. }),
  37809. $globals.SemanticAnalyzer);
  37810. $core.addMethod(
  37811. $core.method({
  37812. selector: "validateVariableScope:",
  37813. protocol: "scope",
  37814. fn: function (aString){
  37815. var self=this,$self=this;
  37816. return $core.withContext(function($ctx1) {
  37817. var $1,$receiver;
  37818. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  37819. if(($receiver = $1) == null || $receiver.a$nil){
  37820. $1;
  37821. } else {
  37822. $self._errorShadowingVariable_(aString);
  37823. }
  37824. return self;
  37825. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  37826. },
  37827. args: ["aString"],
  37828. 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 ]",
  37829. referencedClasses: [],
  37830. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  37831. }),
  37832. $globals.SemanticAnalyzer);
  37833. $core.addMethod(
  37834. $core.method({
  37835. selector: "visitAssignmentNode:",
  37836. protocol: "visiting",
  37837. fn: function (aNode){
  37838. var self=this,$self=this;
  37839. return $core.withContext(function($ctx1) {
  37840. (
  37841. $ctx1.supercall = true,
  37842. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  37843. $ctx1.supercall = false;
  37844. $recv($recv(aNode)._left())._beAssigned();
  37845. return self;
  37846. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37847. },
  37848. args: ["aNode"],
  37849. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  37850. referencedClasses: [],
  37851. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  37852. }),
  37853. $globals.SemanticAnalyzer);
  37854. $core.addMethod(
  37855. $core.method({
  37856. selector: "visitBlockNode:",
  37857. protocol: "visiting",
  37858. fn: function (aNode){
  37859. var self=this,$self=this;
  37860. return $core.withContext(function($ctx1) {
  37861. $self._pushScope_($self._newBlockScope());
  37862. $recv(aNode)._scope_($self["@currentScope"]);
  37863. $recv($self["@currentScope"])._node_(aNode);
  37864. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  37865. $recv($recv(aNode)._parameters())._do_((function(each){
  37866. return $core.withContext(function($ctx2) {
  37867. $self._validateVariableScope_(each);
  37868. return $recv($self["@currentScope"])._addArg_(each);
  37869. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37870. }));
  37871. (
  37872. $ctx1.supercall = true,
  37873. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  37874. $ctx1.supercall = false;
  37875. $self._popScope();
  37876. return self;
  37877. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37878. },
  37879. args: ["aNode"],
  37880. 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",
  37881. referencedClasses: [],
  37882. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  37883. }),
  37884. $globals.SemanticAnalyzer);
  37885. $core.addMethod(
  37886. $core.method({
  37887. selector: "visitCascadeNode:",
  37888. protocol: "visiting",
  37889. fn: function (aNode){
  37890. var self=this,$self=this;
  37891. return $core.withContext(function($ctx1) {
  37892. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  37893. (
  37894. $ctx1.supercall = true,
  37895. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  37896. $ctx1.supercall = false;
  37897. return self;
  37898. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37899. },
  37900. args: ["aNode"],
  37901. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  37902. referencedClasses: [],
  37903. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  37904. }),
  37905. $globals.SemanticAnalyzer);
  37906. $core.addMethod(
  37907. $core.method({
  37908. selector: "visitMethodNode:",
  37909. protocol: "visiting",
  37910. fn: function (aNode){
  37911. var self=this,$self=this;
  37912. return $core.withContext(function($ctx1) {
  37913. $self._pushScope_($self._newMethodScope());
  37914. $recv(aNode)._scope_($self["@currentScope"]);
  37915. $recv($self["@currentScope"])._node_(aNode);
  37916. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  37917. return $core.withContext(function($ctx2) {
  37918. return $recv($self["@currentScope"])._addIVar_(each);
  37919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37920. }));
  37921. $ctx1.sendIdx["do:"]=1;
  37922. $recv($recv(aNode)._arguments())._do_((function(each){
  37923. return $core.withContext(function($ctx2) {
  37924. $self._validateVariableScope_(each);
  37925. return $recv($self["@currentScope"])._addArg_(each);
  37926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37927. }));
  37928. (
  37929. $ctx1.supercall = true,
  37930. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  37931. $ctx1.supercall = false;
  37932. $recv(aNode)._classReferences_($self._classReferences());
  37933. $recv(aNode)._sendIndexes_($self._messageSends());
  37934. $self._popScope();
  37935. return aNode;
  37936. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37937. },
  37938. args: ["aNode"],
  37939. 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",
  37940. referencedClasses: [],
  37941. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  37942. }),
  37943. $globals.SemanticAnalyzer);
  37944. $core.addMethod(
  37945. $core.method({
  37946. selector: "visitReturnNode:",
  37947. protocol: "visiting",
  37948. fn: function (aNode){
  37949. var self=this,$self=this;
  37950. return $core.withContext(function($ctx1) {
  37951. var $1;
  37952. $recv(aNode)._scope_($self["@currentScope"]);
  37953. $1=$recv($self["@currentScope"])._isMethodScope();
  37954. if($core.assert($1)){
  37955. $recv($self["@currentScope"])._localReturn_(true);
  37956. } else {
  37957. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  37958. }
  37959. (
  37960. $ctx1.supercall = true,
  37961. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  37962. $ctx1.supercall = false;
  37963. return self;
  37964. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37965. },
  37966. args: ["aNode"],
  37967. 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",
  37968. referencedClasses: [],
  37969. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  37970. }),
  37971. $globals.SemanticAnalyzer);
  37972. $core.addMethod(
  37973. $core.method({
  37974. selector: "visitSendNode:",
  37975. protocol: "visiting",
  37976. fn: function (aNode){
  37977. var self=this,$self=this;
  37978. var sends;
  37979. return $core.withContext(function($ctx1) {
  37980. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  37981. return $core.withContext(function($ctx2) {
  37982. return $recv($globals.OrderedCollection)._new();
  37983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37984. }));
  37985. $recv(sends)._add_(aNode);
  37986. $recv(aNode)._index_($recv(sends)._size());
  37987. (
  37988. $ctx1.supercall = true,
  37989. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  37990. $ctx1.supercall = false;
  37991. return self;
  37992. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  37993. },
  37994. args: ["aNode"],
  37995. 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",
  37996. referencedClasses: ["OrderedCollection"],
  37997. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  37998. }),
  37999. $globals.SemanticAnalyzer);
  38000. $core.addMethod(
  38001. $core.method({
  38002. selector: "visitSequenceNode:",
  38003. protocol: "visiting",
  38004. fn: function (aNode){
  38005. var self=this,$self=this;
  38006. return $core.withContext(function($ctx1) {
  38007. $recv($recv(aNode)._temps())._do_((function(each){
  38008. return $core.withContext(function($ctx2) {
  38009. $self._validateVariableScope_(each);
  38010. return $recv($self["@currentScope"])._addTemp_(each);
  38011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38012. }));
  38013. (
  38014. $ctx1.supercall = true,
  38015. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38016. $ctx1.supercall = false;
  38017. return self;
  38018. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38019. },
  38020. args: ["aNode"],
  38021. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38022. referencedClasses: [],
  38023. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38024. }),
  38025. $globals.SemanticAnalyzer);
  38026. $core.addMethod(
  38027. $core.method({
  38028. selector: "visitVariableNode:",
  38029. protocol: "visiting",
  38030. fn: function (aNode){
  38031. var self=this,$self=this;
  38032. var binding;
  38033. return $core.withContext(function($ctx1) {
  38034. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38035. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38036. $1=binding;
  38037. if(($receiver = $1) == null || $receiver.a$nil){
  38038. $3=$recv(aNode)._value();
  38039. $ctx1.sendIdx["value"]=1;
  38040. $2=$recv($3)._isCapitalized();
  38041. if($core.assert($2)){
  38042. $4=$recv($globals.ClassRefVar)._new();
  38043. $ctx1.sendIdx["new"]=1;
  38044. $5=$recv(aNode)._value();
  38045. $ctx1.sendIdx["value"]=2;
  38046. $recv($4)._name_($5);
  38047. $ctx1.sendIdx["name:"]=1;
  38048. $6=$recv($4)._yourself();
  38049. $ctx1.sendIdx["yourself"]=1;
  38050. binding=$6;
  38051. binding;
  38052. $7=$self._classReferences();
  38053. $8=$recv(aNode)._value();
  38054. $ctx1.sendIdx["value"]=3;
  38055. $recv($7)._add_($8);
  38056. } else {
  38057. $self._errorUnknownVariable_(aNode);
  38058. $9=$recv($globals.UnknownVar)._new();
  38059. $recv($9)._name_($recv(aNode)._value());
  38060. binding=$recv($9)._yourself();
  38061. binding;
  38062. }
  38063. } else {
  38064. $1;
  38065. }
  38066. $recv(aNode)._binding_(binding);
  38067. return self;
  38068. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38069. },
  38070. args: ["aNode"],
  38071. 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.",
  38072. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38073. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38074. }),
  38075. $globals.SemanticAnalyzer);
  38076. $core.addMethod(
  38077. $core.method({
  38078. selector: "on:",
  38079. protocol: "instance creation",
  38080. fn: function (aClass){
  38081. var self=this,$self=this;
  38082. return $core.withContext(function($ctx1) {
  38083. var $1;
  38084. $1=$self._new();
  38085. $recv($1)._theClass_(aClass);
  38086. return $recv($1)._yourself();
  38087. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38088. },
  38089. args: ["aClass"],
  38090. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38091. referencedClasses: [],
  38092. messageSends: ["theClass:", "new", "yourself"]
  38093. }),
  38094. $globals.SemanticAnalyzer.a$cls);
  38095. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38096. $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";
  38097. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38098. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38099. $core.addMethod(
  38100. $core.method({
  38101. selector: "messageText",
  38102. protocol: "accessing",
  38103. fn: function (){
  38104. var self=this,$self=this;
  38105. return $core.withContext(function($ctx1) {
  38106. return " Invalid assignment to variable: ".__comma($self._variableName());
  38107. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38108. },
  38109. args: [],
  38110. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38111. referencedClasses: [],
  38112. messageSends: [",", "variableName"]
  38113. }),
  38114. $globals.InvalidAssignmentError);
  38115. $core.addMethod(
  38116. $core.method({
  38117. selector: "variableName",
  38118. protocol: "accessing",
  38119. fn: function (){
  38120. var self=this,$self=this;
  38121. return $self["@variableName"];
  38122. },
  38123. args: [],
  38124. source: "variableName\x0a\x09^ variableName",
  38125. referencedClasses: [],
  38126. messageSends: []
  38127. }),
  38128. $globals.InvalidAssignmentError);
  38129. $core.addMethod(
  38130. $core.method({
  38131. selector: "variableName:",
  38132. protocol: "accessing",
  38133. fn: function (aString){
  38134. var self=this,$self=this;
  38135. $self["@variableName"]=aString;
  38136. return self;
  38137. },
  38138. args: ["aString"],
  38139. source: "variableName: aString\x0a\x09variableName := aString",
  38140. referencedClasses: [],
  38141. messageSends: []
  38142. }),
  38143. $globals.InvalidAssignmentError);
  38144. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38145. $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.";
  38146. $core.addMethod(
  38147. $core.method({
  38148. selector: "messageText",
  38149. protocol: "accessing",
  38150. fn: function (){
  38151. var self=this,$self=this;
  38152. return $core.withContext(function($ctx1) {
  38153. var $1;
  38154. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38155. $ctx1.sendIdx[","]=1;
  38156. return $1;
  38157. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38158. },
  38159. args: [],
  38160. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38161. referencedClasses: [],
  38162. messageSends: [",", "variableName"]
  38163. }),
  38164. $globals.ShadowingVariableError);
  38165. $core.addMethod(
  38166. $core.method({
  38167. selector: "variableName",
  38168. protocol: "accessing",
  38169. fn: function (){
  38170. var self=this,$self=this;
  38171. return $self["@variableName"];
  38172. },
  38173. args: [],
  38174. source: "variableName\x0a\x09^ variableName",
  38175. referencedClasses: [],
  38176. messageSends: []
  38177. }),
  38178. $globals.ShadowingVariableError);
  38179. $core.addMethod(
  38180. $core.method({
  38181. selector: "variableName:",
  38182. protocol: "accessing",
  38183. fn: function (aString){
  38184. var self=this,$self=this;
  38185. $self["@variableName"]=aString;
  38186. return self;
  38187. },
  38188. args: ["aString"],
  38189. source: "variableName: aString\x0a\x09variableName := aString",
  38190. referencedClasses: [],
  38191. messageSends: []
  38192. }),
  38193. $globals.ShadowingVariableError);
  38194. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38195. $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.";
  38196. $core.addMethod(
  38197. $core.method({
  38198. selector: "messageText",
  38199. protocol: "accessing",
  38200. fn: function (){
  38201. var self=this,$self=this;
  38202. return $core.withContext(function($ctx1) {
  38203. var $1;
  38204. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38205. $ctx1.sendIdx[","]=1;
  38206. return $1;
  38207. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38208. },
  38209. args: [],
  38210. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38211. referencedClasses: [],
  38212. messageSends: [",", "variableName"]
  38213. }),
  38214. $globals.UnknownVariableError);
  38215. $core.addMethod(
  38216. $core.method({
  38217. selector: "variableName",
  38218. protocol: "accessing",
  38219. fn: function (){
  38220. var self=this,$self=this;
  38221. return $self["@variableName"];
  38222. },
  38223. args: [],
  38224. source: "variableName\x0a\x09^ variableName",
  38225. referencedClasses: [],
  38226. messageSends: []
  38227. }),
  38228. $globals.UnknownVariableError);
  38229. $core.addMethod(
  38230. $core.method({
  38231. selector: "variableName:",
  38232. protocol: "accessing",
  38233. fn: function (aString){
  38234. var self=this,$self=this;
  38235. $self["@variableName"]=aString;
  38236. return self;
  38237. },
  38238. args: ["aString"],
  38239. source: "variableName: aString\x0a\x09variableName := aString",
  38240. referencedClasses: [],
  38241. messageSends: []
  38242. }),
  38243. $globals.UnknownVariableError);
  38244. });
  38245. 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";
  38246. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38247. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38248. $core.addPackage("Compiler-IR");
  38249. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38250. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38251. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38252. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38253. $core.addMethod(
  38254. $core.method({
  38255. selector: "alias:",
  38256. protocol: "visiting",
  38257. fn: function (aNode){
  38258. var self=this,$self=this;
  38259. var variable;
  38260. return $core.withContext(function($ctx1) {
  38261. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  38262. $1=$recv(aNode)._isImmutable();
  38263. if($core.assert($1)){
  38264. $2=$self._visit_(aNode);
  38265. $ctx1.sendIdx["visit:"]=1;
  38266. return $2;
  38267. }
  38268. $3=$recv($globals.IRVariable)._new();
  38269. $ctx1.sendIdx["new"]=1;
  38270. $5=$recv($globals.AliasVar)._new();
  38271. $ctx1.sendIdx["new"]=2;
  38272. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38273. $recv($3)._variable_($4);
  38274. $6=$recv($3)._yourself();
  38275. $ctx1.sendIdx["yourself"]=1;
  38276. variable=$6;
  38277. $7=$self._sequence();
  38278. $9=$recv($globals.IRAssignment)._new();
  38279. $recv($9)._add_(variable);
  38280. $ctx1.sendIdx["add:"]=2;
  38281. $recv($9)._add_($self._visit_(aNode));
  38282. $ctx1.sendIdx["add:"]=3;
  38283. $8=$recv($9)._yourself();
  38284. $recv($7)._add_($8);
  38285. $ctx1.sendIdx["add:"]=1;
  38286. $recv($recv($self._method())._internalVariables())._add_(variable);
  38287. return variable;
  38288. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38289. },
  38290. args: ["aNode"],
  38291. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38292. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38293. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  38294. }),
  38295. $globals.IRASTTranslator);
  38296. $core.addMethod(
  38297. $core.method({
  38298. selector: "aliasTemporally:",
  38299. protocol: "visiting",
  38300. fn: function (aCollection){
  38301. var self=this,$self=this;
  38302. var threshold,result;
  38303. return $core.withContext(function($ctx1) {
  38304. var $1,$2,$4,$3;
  38305. threshold=(0);
  38306. $recv(aCollection)._withIndexDo_((function(each,i){
  38307. return $core.withContext(function($ctx2) {
  38308. $1=$recv(each)._subtreeNeedsAliasing();
  38309. if($core.assert($1)){
  38310. threshold=i;
  38311. return threshold;
  38312. }
  38313. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38314. }));
  38315. $ctx1.sendIdx["withIndexDo:"]=1;
  38316. result=$recv($globals.OrderedCollection)._new();
  38317. $recv(aCollection)._withIndexDo_((function(each,i){
  38318. return $core.withContext(function($ctx2) {
  38319. $2=result;
  38320. $4=$recv(i).__lt_eq(threshold);
  38321. if($core.assert($4)){
  38322. $3=$self._alias_(each);
  38323. } else {
  38324. $3=$self._visit_(each);
  38325. }
  38326. return $recv($2)._add_($3);
  38327. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38328. }));
  38329. return result;
  38330. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38331. },
  38332. args: ["aCollection"],
  38333. 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",
  38334. referencedClasses: ["OrderedCollection"],
  38335. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38336. }),
  38337. $globals.IRASTTranslator);
  38338. $core.addMethod(
  38339. $core.method({
  38340. selector: "method",
  38341. protocol: "accessing",
  38342. fn: function (){
  38343. var self=this,$self=this;
  38344. return $self["@method"];
  38345. },
  38346. args: [],
  38347. source: "method\x0a\x09^ method",
  38348. referencedClasses: [],
  38349. messageSends: []
  38350. }),
  38351. $globals.IRASTTranslator);
  38352. $core.addMethod(
  38353. $core.method({
  38354. selector: "method:",
  38355. protocol: "accessing",
  38356. fn: function (anIRMethod){
  38357. var self=this,$self=this;
  38358. $self["@method"]=anIRMethod;
  38359. return self;
  38360. },
  38361. args: ["anIRMethod"],
  38362. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38363. referencedClasses: [],
  38364. messageSends: []
  38365. }),
  38366. $globals.IRASTTranslator);
  38367. $core.addMethod(
  38368. $core.method({
  38369. selector: "nextAlias",
  38370. protocol: "accessing",
  38371. fn: function (){
  38372. var self=this,$self=this;
  38373. return $core.withContext(function($ctx1) {
  38374. var $1,$receiver;
  38375. $1=$self["@nextAlias"];
  38376. if(($receiver = $1) == null || $receiver.a$nil){
  38377. $self["@nextAlias"]=(0);
  38378. $self["@nextAlias"];
  38379. } else {
  38380. $1;
  38381. }
  38382. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38383. return $recv($self["@nextAlias"])._asString();
  38384. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38385. },
  38386. args: [],
  38387. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38388. referencedClasses: [],
  38389. messageSends: ["ifNil:", "+", "asString"]
  38390. }),
  38391. $globals.IRASTTranslator);
  38392. $core.addMethod(
  38393. $core.method({
  38394. selector: "sequence",
  38395. protocol: "accessing",
  38396. fn: function (){
  38397. var self=this,$self=this;
  38398. return $self["@sequence"];
  38399. },
  38400. args: [],
  38401. source: "sequence\x0a\x09^ sequence",
  38402. referencedClasses: [],
  38403. messageSends: []
  38404. }),
  38405. $globals.IRASTTranslator);
  38406. $core.addMethod(
  38407. $core.method({
  38408. selector: "sequence:",
  38409. protocol: "accessing",
  38410. fn: function (anIRSequence){
  38411. var self=this,$self=this;
  38412. $self["@sequence"]=anIRSequence;
  38413. return self;
  38414. },
  38415. args: ["anIRSequence"],
  38416. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38417. referencedClasses: [],
  38418. messageSends: []
  38419. }),
  38420. $globals.IRASTTranslator);
  38421. $core.addMethod(
  38422. $core.method({
  38423. selector: "source",
  38424. protocol: "accessing",
  38425. fn: function (){
  38426. var self=this,$self=this;
  38427. return $self["@source"];
  38428. },
  38429. args: [],
  38430. source: "source\x0a\x09^ source",
  38431. referencedClasses: [],
  38432. messageSends: []
  38433. }),
  38434. $globals.IRASTTranslator);
  38435. $core.addMethod(
  38436. $core.method({
  38437. selector: "source:",
  38438. protocol: "accessing",
  38439. fn: function (aString){
  38440. var self=this,$self=this;
  38441. $self["@source"]=aString;
  38442. return self;
  38443. },
  38444. args: ["aString"],
  38445. source: "source: aString\x0a\x09source := aString",
  38446. referencedClasses: [],
  38447. messageSends: []
  38448. }),
  38449. $globals.IRASTTranslator);
  38450. $core.addMethod(
  38451. $core.method({
  38452. selector: "theClass",
  38453. protocol: "accessing",
  38454. fn: function (){
  38455. var self=this,$self=this;
  38456. return $self["@theClass"];
  38457. },
  38458. args: [],
  38459. source: "theClass\x0a\x09^ theClass",
  38460. referencedClasses: [],
  38461. messageSends: []
  38462. }),
  38463. $globals.IRASTTranslator);
  38464. $core.addMethod(
  38465. $core.method({
  38466. selector: "theClass:",
  38467. protocol: "accessing",
  38468. fn: function (aClass){
  38469. var self=this,$self=this;
  38470. $self["@theClass"]=aClass;
  38471. return self;
  38472. },
  38473. args: ["aClass"],
  38474. source: "theClass: aClass\x0a\x09theClass := aClass",
  38475. referencedClasses: [],
  38476. messageSends: []
  38477. }),
  38478. $globals.IRASTTranslator);
  38479. $core.addMethod(
  38480. $core.method({
  38481. selector: "visitAssignmentNode:",
  38482. protocol: "visiting",
  38483. fn: function (aNode){
  38484. var self=this,$self=this;
  38485. var left,right,assignment;
  38486. return $core.withContext(function($ctx1) {
  38487. var $1,$3,$2;
  38488. right=$self._visit_($recv(aNode)._right());
  38489. $ctx1.sendIdx["visit:"]=1;
  38490. left=$self._visit_($recv(aNode)._left());
  38491. $1=$self._sequence();
  38492. $3=$recv($globals.IRAssignment)._new();
  38493. $recv($3)._add_(left);
  38494. $ctx1.sendIdx["add:"]=2;
  38495. $recv($3)._add_(right);
  38496. $2=$recv($3)._yourself();
  38497. $recv($1)._add_($2);
  38498. $ctx1.sendIdx["add:"]=1;
  38499. return left;
  38500. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  38501. },
  38502. args: ["aNode"],
  38503. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  38504. referencedClasses: ["IRAssignment"],
  38505. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  38506. }),
  38507. $globals.IRASTTranslator);
  38508. $core.addMethod(
  38509. $core.method({
  38510. selector: "visitBlockNode:",
  38511. protocol: "visiting",
  38512. fn: function (aNode){
  38513. var self=this,$self=this;
  38514. var closure;
  38515. return $core.withContext(function($ctx1) {
  38516. var $1,$2,$3,$5,$4,$6,$8,$7;
  38517. $1=$recv($globals.IRClosure)._new();
  38518. $ctx1.sendIdx["new"]=1;
  38519. $recv($1)._arguments_($recv(aNode)._parameters());
  38520. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38521. $2=$recv(aNode)._scope();
  38522. $ctx1.sendIdx["scope"]=1;
  38523. $recv($1)._scope_($2);
  38524. $ctx1.sendIdx["scope:"]=1;
  38525. $3=$recv($1)._yourself();
  38526. $ctx1.sendIdx["yourself"]=1;
  38527. closure=$3;
  38528. $5=$recv(aNode)._scope();
  38529. $ctx1.sendIdx["scope"]=2;
  38530. $4=$recv($5)._temps();
  38531. $recv($4)._do_((function(each){
  38532. return $core.withContext(function($ctx2) {
  38533. $6=closure;
  38534. $8=$recv($globals.IRTempDeclaration)._new();
  38535. $recv($8)._name_($recv(each)._name());
  38536. $recv($8)._scope_($recv(aNode)._scope());
  38537. $7=$recv($8)._yourself();
  38538. return $recv($6)._add_($7);
  38539. $ctx2.sendIdx["add:"]=1;
  38540. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38541. }));
  38542. $ctx1.sendIdx["do:"]=1;
  38543. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38544. return $core.withContext(function($ctx2) {
  38545. return $recv(closure)._add_($self._visit_(each));
  38546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38547. }));
  38548. return closure;
  38549. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  38550. },
  38551. args: ["aNode"],
  38552. 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",
  38553. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  38554. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  38555. }),
  38556. $globals.IRASTTranslator);
  38557. $core.addMethod(
  38558. $core.method({
  38559. selector: "visitBlockSequenceNode:",
  38560. protocol: "visiting",
  38561. fn: function (aNode){
  38562. var self=this,$self=this;
  38563. return $core.withContext(function($ctx1) {
  38564. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  38565. $1=$recv($globals.IRBlockSequence)._new();
  38566. $ctx1.sendIdx["new"]=1;
  38567. return $self._withSequence_do_($1,(function(){
  38568. return $core.withContext(function($ctx2) {
  38569. $2=$recv(aNode)._dagChildren();
  38570. $ctx2.sendIdx["dagChildren"]=1;
  38571. return $recv($2)._ifNotEmpty_((function(){
  38572. return $core.withContext(function($ctx3) {
  38573. $4=$recv(aNode)._dagChildren();
  38574. $ctx3.sendIdx["dagChildren"]=2;
  38575. $3=$recv($4)._allButLast();
  38576. $recv($3)._do_((function(each){
  38577. return $core.withContext(function($ctx4) {
  38578. $5=$self._sequence();
  38579. $ctx4.sendIdx["sequence"]=1;
  38580. $6=$self._visitOrAlias_(each);
  38581. $ctx4.sendIdx["visitOrAlias:"]=1;
  38582. return $recv($5)._add_($6);
  38583. $ctx4.sendIdx["add:"]=1;
  38584. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38585. }));
  38586. $9=$recv(aNode)._dagChildren();
  38587. $ctx3.sendIdx["dagChildren"]=3;
  38588. $8=$recv($9)._last();
  38589. $ctx3.sendIdx["last"]=1;
  38590. $7=$recv($8)._isReturnNode();
  38591. if($core.assert($7)){
  38592. return $recv($self._sequence())._add_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  38593. } else {
  38594. $10=$self._sequence();
  38595. $ctx3.sendIdx["sequence"]=2;
  38596. $12=$recv($globals.IRBlockReturn)._new();
  38597. $15=$recv(aNode)._dagChildren();
  38598. $ctx3.sendIdx["dagChildren"]=4;
  38599. $14=$recv($15)._last();
  38600. $ctx3.sendIdx["last"]=2;
  38601. $13=$self._visitOrAlias_($14);
  38602. $ctx3.sendIdx["visitOrAlias:"]=2;
  38603. $recv($12)._add_($13);
  38604. $ctx3.sendIdx["add:"]=3;
  38605. $11=$recv($12)._yourself();
  38606. return $recv($10)._add_($11);
  38607. $ctx3.sendIdx["add:"]=2;
  38608. }
  38609. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38610. }));
  38611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38612. }));
  38613. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38614. },
  38615. args: ["aNode"],
  38616. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  38617. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  38618. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  38619. }),
  38620. $globals.IRASTTranslator);
  38621. $core.addMethod(
  38622. $core.method({
  38623. selector: "visitCascadeNode:",
  38624. protocol: "visiting",
  38625. fn: function (aNode){
  38626. var self=this,$self=this;
  38627. var receiver;
  38628. return $core.withContext(function($ctx1) {
  38629. var $1,$2,$4,$3;
  38630. receiver=$recv(aNode)._receiver();
  38631. $1=$recv(receiver)._isImmutable();
  38632. if(!$core.assert($1)){
  38633. var alias;
  38634. alias=$self._alias_(receiver);
  38635. alias;
  38636. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  38637. receiver;
  38638. }
  38639. $2=$recv(aNode)._dagChildren();
  38640. $ctx1.sendIdx["dagChildren"]=1;
  38641. $recv($2)._do_((function(each){
  38642. return $core.withContext(function($ctx2) {
  38643. return $recv(each)._receiver_(receiver);
  38644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38645. }));
  38646. $ctx1.sendIdx["do:"]=1;
  38647. $4=$recv(aNode)._dagChildren();
  38648. $ctx1.sendIdx["dagChildren"]=2;
  38649. $3=$recv($4)._allButLast();
  38650. $recv($3)._do_((function(each){
  38651. return $core.withContext(function($ctx2) {
  38652. return $recv($self._sequence())._add_($self._visit_(each));
  38653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  38654. }));
  38655. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  38656. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  38657. },
  38658. args: ["aNode"],
  38659. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  38660. referencedClasses: ["VariableNode"],
  38661. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  38662. }),
  38663. $globals.IRASTTranslator);
  38664. $core.addMethod(
  38665. $core.method({
  38666. selector: "visitDynamicArrayNode:",
  38667. protocol: "visiting",
  38668. fn: function (aNode){
  38669. var self=this,$self=this;
  38670. var array;
  38671. return $core.withContext(function($ctx1) {
  38672. array=$recv($globals.IRDynamicArray)._new();
  38673. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38674. return $core.withContext(function($ctx2) {
  38675. return $recv(array)._add_(each);
  38676. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38677. }));
  38678. return array;
  38679. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  38680. },
  38681. args: ["aNode"],
  38682. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  38683. referencedClasses: ["IRDynamicArray"],
  38684. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38685. }),
  38686. $globals.IRASTTranslator);
  38687. $core.addMethod(
  38688. $core.method({
  38689. selector: "visitDynamicDictionaryNode:",
  38690. protocol: "visiting",
  38691. fn: function (aNode){
  38692. var self=this,$self=this;
  38693. var dictionary;
  38694. return $core.withContext(function($ctx1) {
  38695. dictionary=$recv($globals.IRDynamicDictionary)._new();
  38696. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38697. return $core.withContext(function($ctx2) {
  38698. return $recv(dictionary)._add_(each);
  38699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38700. }));
  38701. return dictionary;
  38702. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  38703. },
  38704. args: ["aNode"],
  38705. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  38706. referencedClasses: ["IRDynamicDictionary"],
  38707. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38708. }),
  38709. $globals.IRASTTranslator);
  38710. $core.addMethod(
  38711. $core.method({
  38712. selector: "visitJSStatementNode:",
  38713. protocol: "visiting",
  38714. fn: function (aNode){
  38715. var self=this,$self=this;
  38716. return $core.withContext(function($ctx1) {
  38717. var $1;
  38718. $1=$recv($globals.IRVerbatim)._new();
  38719. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  38720. return $recv($1)._yourself();
  38721. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38722. },
  38723. args: ["aNode"],
  38724. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  38725. referencedClasses: ["IRVerbatim"],
  38726. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  38727. }),
  38728. $globals.IRASTTranslator);
  38729. $core.addMethod(
  38730. $core.method({
  38731. selector: "visitMethodNode:",
  38732. protocol: "visiting",
  38733. fn: function (aNode){
  38734. var self=this,$self=this;
  38735. return $core.withContext(function($ctx1) {
  38736. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  38737. $2=$recv($globals.IRMethod)._new();
  38738. $ctx1.sendIdx["new"]=1;
  38739. $recv($2)._source_($recv($self._source())._crlfSanitized());
  38740. $ctx1.sendIdx["source:"]=1;
  38741. $recv($2)._theClass_($self._theClass());
  38742. $recv($2)._arguments_($recv(aNode)._arguments());
  38743. $recv($2)._selector_($recv(aNode)._selector());
  38744. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  38745. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38746. $recv($2)._classReferences_($recv(aNode)._classReferences());
  38747. $3=$recv(aNode)._scope();
  38748. $ctx1.sendIdx["scope"]=1;
  38749. $recv($2)._scope_($3);
  38750. $ctx1.sendIdx["scope:"]=1;
  38751. $4=$recv($2)._yourself();
  38752. $ctx1.sendIdx["yourself"]=1;
  38753. $1=$4;
  38754. $self._method_($1);
  38755. $6=$recv(aNode)._scope();
  38756. $ctx1.sendIdx["scope"]=2;
  38757. $5=$recv($6)._temps();
  38758. $recv($5)._do_((function(each){
  38759. return $core.withContext(function($ctx2) {
  38760. $7=$self._method();
  38761. $ctx2.sendIdx["method"]=1;
  38762. $9=$recv($globals.IRTempDeclaration)._new();
  38763. $ctx2.sendIdx["new"]=2;
  38764. $recv($9)._name_($recv(each)._name());
  38765. $10=$recv(aNode)._scope();
  38766. $ctx2.sendIdx["scope"]=3;
  38767. $recv($9)._scope_($10);
  38768. $11=$recv($9)._yourself();
  38769. $ctx2.sendIdx["yourself"]=2;
  38770. $8=$11;
  38771. return $recv($7)._add_($8);
  38772. $ctx2.sendIdx["add:"]=1;
  38773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38774. }));
  38775. $ctx1.sendIdx["do:"]=1;
  38776. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38777. return $core.withContext(function($ctx2) {
  38778. $12=$self._method();
  38779. $ctx2.sendIdx["method"]=2;
  38780. return $recv($12)._add_($self._visit_(each));
  38781. $ctx2.sendIdx["add:"]=2;
  38782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38783. }));
  38784. $14=$recv(aNode)._scope();
  38785. $ctx1.sendIdx["scope"]=4;
  38786. $13=$recv($14)._hasLocalReturn();
  38787. if(!$core.assert($13)){
  38788. $15=$self._method();
  38789. $ctx1.sendIdx["method"]=3;
  38790. $17=$recv($globals.IRReturn)._new();
  38791. $ctx1.sendIdx["new"]=3;
  38792. $19=$recv($globals.IRVariable)._new();
  38793. $ctx1.sendIdx["new"]=4;
  38794. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  38795. $20=$recv($19)._yourself();
  38796. $ctx1.sendIdx["yourself"]=3;
  38797. $18=$20;
  38798. $recv($17)._add_($18);
  38799. $ctx1.sendIdx["add:"]=4;
  38800. $21=$recv($17)._yourself();
  38801. $ctx1.sendIdx["yourself"]=4;
  38802. $16=$21;
  38803. $recv($15)._add_($16);
  38804. $ctx1.sendIdx["add:"]=3;
  38805. $23=$recv($globals.IRVerbatim)._new();
  38806. $recv($23)._source_("");
  38807. $22=$recv($23)._yourself();
  38808. $recv($15)._add_($22);
  38809. }
  38810. return $self._method();
  38811. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38812. },
  38813. args: ["aNode"],
  38814. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  38815. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  38816. 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"]
  38817. }),
  38818. $globals.IRASTTranslator);
  38819. $core.addMethod(
  38820. $core.method({
  38821. selector: "visitOrAlias:",
  38822. protocol: "visiting",
  38823. fn: function (aNode){
  38824. var self=this,$self=this;
  38825. return $core.withContext(function($ctx1) {
  38826. var $1;
  38827. $1=$recv(aNode)._shouldBeAliased();
  38828. if($core.assert($1)){
  38829. return $self._alias_(aNode);
  38830. } else {
  38831. return $self._visit_(aNode);
  38832. }
  38833. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  38834. },
  38835. args: ["aNode"],
  38836. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  38837. referencedClasses: [],
  38838. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  38839. }),
  38840. $globals.IRASTTranslator);
  38841. $core.addMethod(
  38842. $core.method({
  38843. selector: "visitReturnNode:",
  38844. protocol: "visiting",
  38845. fn: function (aNode){
  38846. var self=this,$self=this;
  38847. var return_;
  38848. return $core.withContext(function($ctx1) {
  38849. var $1;
  38850. $1=$recv(aNode)._nonLocalReturn();
  38851. if($core.assert($1)){
  38852. return_=$recv($globals.IRNonLocalReturn)._new();
  38853. $ctx1.sendIdx["new"]=1;
  38854. } else {
  38855. return_=$recv($globals.IRReturn)._new();
  38856. }
  38857. $recv(return_)._scope_($recv(aNode)._scope());
  38858. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38859. return $core.withContext(function($ctx2) {
  38860. return $recv(return_)._add_($self._visitOrAlias_(each));
  38861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  38862. }));
  38863. return return_;
  38864. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  38865. },
  38866. args: ["aNode"],
  38867. 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",
  38868. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  38869. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  38870. }),
  38871. $globals.IRASTTranslator);
  38872. $core.addMethod(
  38873. $core.method({
  38874. selector: "visitSendNode:",
  38875. protocol: "visiting",
  38876. fn: function (aNode){
  38877. var self=this,$self=this;
  38878. var send;
  38879. return $core.withContext(function($ctx1) {
  38880. var $1;
  38881. send=$recv($globals.IRSend)._new();
  38882. $1=send;
  38883. $recv($1)._selector_($recv(aNode)._selector());
  38884. $recv($1)._index_($recv(aNode)._index());
  38885. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38886. return $core.withContext(function($ctx2) {
  38887. return $recv(send)._add_(each);
  38888. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38889. }));
  38890. return send;
  38891. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  38892. },
  38893. args: ["aNode"],
  38894. 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",
  38895. referencedClasses: ["IRSend"],
  38896. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38897. }),
  38898. $globals.IRASTTranslator);
  38899. $core.addMethod(
  38900. $core.method({
  38901. selector: "visitSequenceNode:",
  38902. protocol: "visiting",
  38903. fn: function (aNode){
  38904. var self=this,$self=this;
  38905. return $core.withContext(function($ctx1) {
  38906. var $1;
  38907. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  38908. return $core.withContext(function($ctx2) {
  38909. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  38910. var instruction;
  38911. return $core.withContext(function($ctx3) {
  38912. instruction=$self._visitOrAlias_(each);
  38913. instruction;
  38914. $1=$recv(instruction)._isVariable();
  38915. if(!$core.assert($1)){
  38916. return $recv($self._sequence())._add_(instruction);
  38917. }
  38918. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  38919. }));
  38920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38921. }));
  38922. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38923. },
  38924. args: ["aNode"],
  38925. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  38926. referencedClasses: ["IRSequence"],
  38927. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  38928. }),
  38929. $globals.IRASTTranslator);
  38930. $core.addMethod(
  38931. $core.method({
  38932. selector: "visitValueNode:",
  38933. protocol: "visiting",
  38934. fn: function (aNode){
  38935. var self=this,$self=this;
  38936. return $core.withContext(function($ctx1) {
  38937. var $1;
  38938. $1=$recv($globals.IRValue)._new();
  38939. $recv($1)._value_($recv(aNode)._value());
  38940. return $recv($1)._yourself();
  38941. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38942. },
  38943. args: ["aNode"],
  38944. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  38945. referencedClasses: ["IRValue"],
  38946. messageSends: ["value:", "new", "value", "yourself"]
  38947. }),
  38948. $globals.IRASTTranslator);
  38949. $core.addMethod(
  38950. $core.method({
  38951. selector: "visitVariableNode:",
  38952. protocol: "visiting",
  38953. fn: function (aNode){
  38954. var self=this,$self=this;
  38955. return $core.withContext(function($ctx1) {
  38956. var $1;
  38957. $1=$recv($globals.IRVariable)._new();
  38958. $recv($1)._variable_($recv(aNode)._binding());
  38959. return $recv($1)._yourself();
  38960. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38961. },
  38962. args: ["aNode"],
  38963. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  38964. referencedClasses: ["IRVariable"],
  38965. messageSends: ["variable:", "new", "binding", "yourself"]
  38966. }),
  38967. $globals.IRASTTranslator);
  38968. $core.addMethod(
  38969. $core.method({
  38970. selector: "withSequence:do:",
  38971. protocol: "accessing",
  38972. fn: function (aSequence,aBlock){
  38973. var self=this,$self=this;
  38974. var outerSequence;
  38975. return $core.withContext(function($ctx1) {
  38976. outerSequence=$self._sequence();
  38977. $self._sequence_(aSequence);
  38978. $ctx1.sendIdx["sequence:"]=1;
  38979. $recv(aBlock)._value();
  38980. $self._sequence_(outerSequence);
  38981. return aSequence;
  38982. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  38983. },
  38984. args: ["aSequence", "aBlock"],
  38985. 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",
  38986. referencedClasses: [],
  38987. messageSends: ["sequence", "sequence:", "value"]
  38988. }),
  38989. $globals.IRASTTranslator);
  38990. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  38991. $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.";
  38992. $core.addMethod(
  38993. $core.method({
  38994. selector: "add:",
  38995. protocol: "building",
  38996. fn: function (anObject){
  38997. var self=this,$self=this;
  38998. return $core.withContext(function($ctx1) {
  38999. $recv(anObject)._parent_(self);
  39000. return $recv($self._dagChildren())._add_(anObject);
  39001. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39002. },
  39003. args: ["anObject"],
  39004. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39005. referencedClasses: [],
  39006. messageSends: ["parent:", "add:", "dagChildren"]
  39007. }),
  39008. $globals.IRInstruction);
  39009. $core.addMethod(
  39010. $core.method({
  39011. selector: "isClosure",
  39012. protocol: "testing",
  39013. fn: function (){
  39014. var self=this,$self=this;
  39015. return false;
  39016. },
  39017. args: [],
  39018. source: "isClosure\x0a\x09^ false",
  39019. referencedClasses: [],
  39020. messageSends: []
  39021. }),
  39022. $globals.IRInstruction);
  39023. $core.addMethod(
  39024. $core.method({
  39025. selector: "isInlined",
  39026. protocol: "testing",
  39027. fn: function (){
  39028. var self=this,$self=this;
  39029. return false;
  39030. },
  39031. args: [],
  39032. source: "isInlined\x0a\x09^ false",
  39033. referencedClasses: [],
  39034. messageSends: []
  39035. }),
  39036. $globals.IRInstruction);
  39037. $core.addMethod(
  39038. $core.method({
  39039. selector: "isMethod",
  39040. protocol: "testing",
  39041. fn: function (){
  39042. var self=this,$self=this;
  39043. return false;
  39044. },
  39045. args: [],
  39046. source: "isMethod\x0a\x09^ false",
  39047. referencedClasses: [],
  39048. messageSends: []
  39049. }),
  39050. $globals.IRInstruction);
  39051. $core.addMethod(
  39052. $core.method({
  39053. selector: "isSelf",
  39054. protocol: "testing",
  39055. fn: function (){
  39056. var self=this,$self=this;
  39057. return false;
  39058. },
  39059. args: [],
  39060. source: "isSelf\x0a\x09^ false",
  39061. referencedClasses: [],
  39062. messageSends: []
  39063. }),
  39064. $globals.IRInstruction);
  39065. $core.addMethod(
  39066. $core.method({
  39067. selector: "isSend",
  39068. protocol: "testing",
  39069. fn: function (){
  39070. var self=this,$self=this;
  39071. return false;
  39072. },
  39073. args: [],
  39074. source: "isSend\x0a\x09^ false",
  39075. referencedClasses: [],
  39076. messageSends: []
  39077. }),
  39078. $globals.IRInstruction);
  39079. $core.addMethod(
  39080. $core.method({
  39081. selector: "isSequence",
  39082. protocol: "testing",
  39083. fn: function (){
  39084. var self=this,$self=this;
  39085. return false;
  39086. },
  39087. args: [],
  39088. source: "isSequence\x0a\x09^ false",
  39089. referencedClasses: [],
  39090. messageSends: []
  39091. }),
  39092. $globals.IRInstruction);
  39093. $core.addMethod(
  39094. $core.method({
  39095. selector: "isSuper",
  39096. protocol: "testing",
  39097. fn: function (){
  39098. var self=this,$self=this;
  39099. return false;
  39100. },
  39101. args: [],
  39102. source: "isSuper\x0a\x09^ false",
  39103. referencedClasses: [],
  39104. messageSends: []
  39105. }),
  39106. $globals.IRInstruction);
  39107. $core.addMethod(
  39108. $core.method({
  39109. selector: "isTempDeclaration",
  39110. protocol: "testing",
  39111. fn: function (){
  39112. var self=this,$self=this;
  39113. return false;
  39114. },
  39115. args: [],
  39116. source: "isTempDeclaration\x0a\x09^ false",
  39117. referencedClasses: [],
  39118. messageSends: []
  39119. }),
  39120. $globals.IRInstruction);
  39121. $core.addMethod(
  39122. $core.method({
  39123. selector: "isVariable",
  39124. protocol: "testing",
  39125. fn: function (){
  39126. var self=this,$self=this;
  39127. return false;
  39128. },
  39129. args: [],
  39130. source: "isVariable\x0a\x09^ false",
  39131. referencedClasses: [],
  39132. messageSends: []
  39133. }),
  39134. $globals.IRInstruction);
  39135. $core.addMethod(
  39136. $core.method({
  39137. selector: "method",
  39138. protocol: "accessing",
  39139. fn: function (){
  39140. var self=this,$self=this;
  39141. return $core.withContext(function($ctx1) {
  39142. return $recv($self._parent())._method();
  39143. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39144. },
  39145. args: [],
  39146. source: "method\x0a\x09^ self parent method",
  39147. referencedClasses: [],
  39148. messageSends: ["method", "parent"]
  39149. }),
  39150. $globals.IRInstruction);
  39151. $core.addMethod(
  39152. $core.method({
  39153. selector: "needsBoxingAsReceiver",
  39154. protocol: "testing",
  39155. fn: function (){
  39156. var self=this,$self=this;
  39157. return true;
  39158. },
  39159. args: [],
  39160. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39161. referencedClasses: [],
  39162. messageSends: []
  39163. }),
  39164. $globals.IRInstruction);
  39165. $core.addMethod(
  39166. $core.method({
  39167. selector: "parent",
  39168. protocol: "accessing",
  39169. fn: function (){
  39170. var self=this,$self=this;
  39171. return $self["@parent"];
  39172. },
  39173. args: [],
  39174. source: "parent\x0a\x09^ parent",
  39175. referencedClasses: [],
  39176. messageSends: []
  39177. }),
  39178. $globals.IRInstruction);
  39179. $core.addMethod(
  39180. $core.method({
  39181. selector: "parent:",
  39182. protocol: "accessing",
  39183. fn: function (anIRInstruction){
  39184. var self=this,$self=this;
  39185. $self["@parent"]=anIRInstruction;
  39186. return self;
  39187. },
  39188. args: ["anIRInstruction"],
  39189. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39190. referencedClasses: [],
  39191. messageSends: []
  39192. }),
  39193. $globals.IRInstruction);
  39194. $core.addMethod(
  39195. $core.method({
  39196. selector: "remove:",
  39197. protocol: "building",
  39198. fn: function (anIRInstruction){
  39199. var self=this,$self=this;
  39200. return $core.withContext(function($ctx1) {
  39201. $recv($self._dagChildren())._remove_(anIRInstruction);
  39202. return self;
  39203. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39204. },
  39205. args: ["anIRInstruction"],
  39206. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39207. referencedClasses: [],
  39208. messageSends: ["remove:", "dagChildren"]
  39209. }),
  39210. $globals.IRInstruction);
  39211. $core.addMethod(
  39212. $core.method({
  39213. selector: "replace:with:",
  39214. protocol: "building",
  39215. fn: function (anIRInstruction,anotherIRInstruction){
  39216. var self=this,$self=this;
  39217. return $core.withContext(function($ctx1) {
  39218. var $1;
  39219. $recv(anotherIRInstruction)._parent_(self);
  39220. $1=$self._dagChildren();
  39221. $ctx1.sendIdx["dagChildren"]=1;
  39222. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39223. return self;
  39224. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39225. },
  39226. args: ["anIRInstruction", "anotherIRInstruction"],
  39227. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39228. referencedClasses: [],
  39229. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39230. }),
  39231. $globals.IRInstruction);
  39232. $core.addMethod(
  39233. $core.method({
  39234. selector: "replaceWith:",
  39235. protocol: "building",
  39236. fn: function (anIRInstruction){
  39237. var self=this,$self=this;
  39238. return $core.withContext(function($ctx1) {
  39239. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39240. return self;
  39241. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39242. },
  39243. args: ["anIRInstruction"],
  39244. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39245. referencedClasses: [],
  39246. messageSends: ["replace:with:", "parent"]
  39247. }),
  39248. $globals.IRInstruction);
  39249. $core.addMethod(
  39250. $core.method({
  39251. selector: "scope",
  39252. protocol: "accessing",
  39253. fn: function (){
  39254. var self=this,$self=this;
  39255. return $core.withContext(function($ctx1) {
  39256. var $1,$receiver;
  39257. $1=$self._parent();
  39258. if(($receiver = $1) == null || $receiver.a$nil){
  39259. return $1;
  39260. } else {
  39261. var node;
  39262. node=$receiver;
  39263. return $recv(node)._scope();
  39264. }
  39265. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39266. },
  39267. args: [],
  39268. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39269. referencedClasses: [],
  39270. messageSends: ["ifNotNil:", "parent", "scope"]
  39271. }),
  39272. $globals.IRInstruction);
  39273. $core.addMethod(
  39274. $core.method({
  39275. selector: "yieldsValue",
  39276. protocol: "testing",
  39277. fn: function (){
  39278. var self=this,$self=this;
  39279. return true;
  39280. },
  39281. args: [],
  39282. source: "yieldsValue\x0a\x09^ true",
  39283. referencedClasses: [],
  39284. messageSends: []
  39285. }),
  39286. $globals.IRInstruction);
  39287. $core.addMethod(
  39288. $core.method({
  39289. selector: "on:",
  39290. protocol: "instance creation",
  39291. fn: function (aBuilder){
  39292. var self=this,$self=this;
  39293. return $core.withContext(function($ctx1) {
  39294. var $1;
  39295. $1=$self._new();
  39296. $recv($1)._builder_(aBuilder);
  39297. return $recv($1)._yourself();
  39298. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39299. },
  39300. args: ["aBuilder"],
  39301. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39302. referencedClasses: [],
  39303. messageSends: ["builder:", "new", "yourself"]
  39304. }),
  39305. $globals.IRInstruction.a$cls);
  39306. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39307. $core.addMethod(
  39308. $core.method({
  39309. selector: "acceptDagVisitor:",
  39310. protocol: "visiting",
  39311. fn: function (aVisitor){
  39312. var self=this,$self=this;
  39313. return $core.withContext(function($ctx1) {
  39314. return $recv(aVisitor)._visitIRAssignment_(self);
  39315. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39316. },
  39317. args: ["aVisitor"],
  39318. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39319. referencedClasses: [],
  39320. messageSends: ["visitIRAssignment:"]
  39321. }),
  39322. $globals.IRAssignment);
  39323. $core.addMethod(
  39324. $core.method({
  39325. selector: "left",
  39326. protocol: "accessing",
  39327. fn: function (){
  39328. var self=this,$self=this;
  39329. return $core.withContext(function($ctx1) {
  39330. return $recv($self._dagChildren())._first();
  39331. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39332. },
  39333. args: [],
  39334. source: "left\x0a\x09^ self dagChildren first",
  39335. referencedClasses: [],
  39336. messageSends: ["first", "dagChildren"]
  39337. }),
  39338. $globals.IRAssignment);
  39339. $core.addMethod(
  39340. $core.method({
  39341. selector: "right",
  39342. protocol: "accessing",
  39343. fn: function (){
  39344. var self=this,$self=this;
  39345. return $core.withContext(function($ctx1) {
  39346. return $recv($self._dagChildren())._last();
  39347. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39348. },
  39349. args: [],
  39350. source: "right\x0a\x09^ self dagChildren last",
  39351. referencedClasses: [],
  39352. messageSends: ["last", "dagChildren"]
  39353. }),
  39354. $globals.IRAssignment);
  39355. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39356. $core.addMethod(
  39357. $core.method({
  39358. selector: "acceptDagVisitor:",
  39359. protocol: "visiting",
  39360. fn: function (aVisitor){
  39361. var self=this,$self=this;
  39362. return $core.withContext(function($ctx1) {
  39363. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39364. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39365. },
  39366. args: ["aVisitor"],
  39367. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39368. referencedClasses: [],
  39369. messageSends: ["visitIRDynamicArray:"]
  39370. }),
  39371. $globals.IRDynamicArray);
  39372. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39373. $core.addMethod(
  39374. $core.method({
  39375. selector: "acceptDagVisitor:",
  39376. protocol: "visiting",
  39377. fn: function (aVisitor){
  39378. var self=this,$self=this;
  39379. return $core.withContext(function($ctx1) {
  39380. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39381. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39382. },
  39383. args: ["aVisitor"],
  39384. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39385. referencedClasses: [],
  39386. messageSends: ["visitIRDynamicDictionary:"]
  39387. }),
  39388. $globals.IRDynamicDictionary);
  39389. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39390. $core.addMethod(
  39391. $core.method({
  39392. selector: "scope",
  39393. protocol: "accessing",
  39394. fn: function (){
  39395. var self=this,$self=this;
  39396. return $self["@scope"];
  39397. },
  39398. args: [],
  39399. source: "scope\x0a\x09^ scope",
  39400. referencedClasses: [],
  39401. messageSends: []
  39402. }),
  39403. $globals.IRScopedInstruction);
  39404. $core.addMethod(
  39405. $core.method({
  39406. selector: "scope:",
  39407. protocol: "accessing",
  39408. fn: function (aScope){
  39409. var self=this,$self=this;
  39410. $self["@scope"]=aScope;
  39411. return self;
  39412. },
  39413. args: ["aScope"],
  39414. source: "scope: aScope\x0a\x09scope := aScope",
  39415. referencedClasses: [],
  39416. messageSends: []
  39417. }),
  39418. $globals.IRScopedInstruction);
  39419. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39420. $core.addMethod(
  39421. $core.method({
  39422. selector: "arguments",
  39423. protocol: "accessing",
  39424. fn: function (){
  39425. var self=this,$self=this;
  39426. return $core.withContext(function($ctx1) {
  39427. var $1,$receiver;
  39428. $1=$self["@arguments"];
  39429. if(($receiver = $1) == null || $receiver.a$nil){
  39430. return [];
  39431. } else {
  39432. return $1;
  39433. }
  39434. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39435. },
  39436. args: [],
  39437. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39438. referencedClasses: [],
  39439. messageSends: ["ifNil:"]
  39440. }),
  39441. $globals.IRClosureInstruction);
  39442. $core.addMethod(
  39443. $core.method({
  39444. selector: "arguments:",
  39445. protocol: "accessing",
  39446. fn: function (aCollection){
  39447. var self=this,$self=this;
  39448. $self["@arguments"]=aCollection;
  39449. return self;
  39450. },
  39451. args: ["aCollection"],
  39452. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39453. referencedClasses: [],
  39454. messageSends: []
  39455. }),
  39456. $globals.IRClosureInstruction);
  39457. $core.addMethod(
  39458. $core.method({
  39459. selector: "locals",
  39460. protocol: "accessing",
  39461. fn: function (){
  39462. var self=this,$self=this;
  39463. return $core.withContext(function($ctx1) {
  39464. var $1;
  39465. $1=$recv($self._arguments())._copy();
  39466. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39467. return $core.withContext(function($ctx2) {
  39468. return $recv(each)._name();
  39469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39470. })));
  39471. return $recv($1)._yourself();
  39472. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  39473. },
  39474. args: [],
  39475. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  39476. referencedClasses: [],
  39477. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  39478. }),
  39479. $globals.IRClosureInstruction);
  39480. $core.addMethod(
  39481. $core.method({
  39482. selector: "requiresSmalltalkContext",
  39483. protocol: "accessing",
  39484. fn: function (){
  39485. var self=this,$self=this;
  39486. return $core.withContext(function($ctx1) {
  39487. var $1,$receiver;
  39488. $1=$self["@requiresSmalltalkContext"];
  39489. if(($receiver = $1) == null || $receiver.a$nil){
  39490. return false;
  39491. } else {
  39492. return $1;
  39493. }
  39494. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  39495. },
  39496. args: [],
  39497. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  39498. referencedClasses: [],
  39499. messageSends: ["ifNil:"]
  39500. }),
  39501. $globals.IRClosureInstruction);
  39502. $core.addMethod(
  39503. $core.method({
  39504. selector: "requiresSmalltalkContext:",
  39505. protocol: "accessing",
  39506. fn: function (anObject){
  39507. var self=this,$self=this;
  39508. $self["@requiresSmalltalkContext"]=anObject;
  39509. return self;
  39510. },
  39511. args: ["anObject"],
  39512. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  39513. referencedClasses: [],
  39514. messageSends: []
  39515. }),
  39516. $globals.IRClosureInstruction);
  39517. $core.addMethod(
  39518. $core.method({
  39519. selector: "scope:",
  39520. protocol: "accessing",
  39521. fn: function (aScope){
  39522. var self=this,$self=this;
  39523. return $core.withContext(function($ctx1) {
  39524. (
  39525. $ctx1.supercall = true,
  39526. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  39527. $ctx1.supercall = false;
  39528. $recv(aScope)._instruction_(self);
  39529. return self;
  39530. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  39531. },
  39532. args: ["aScope"],
  39533. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  39534. referencedClasses: [],
  39535. messageSends: ["scope:", "instruction:"]
  39536. }),
  39537. $globals.IRClosureInstruction);
  39538. $core.addMethod(
  39539. $core.method({
  39540. selector: "tempDeclarations",
  39541. protocol: "accessing",
  39542. fn: function (){
  39543. var self=this,$self=this;
  39544. return $core.withContext(function($ctx1) {
  39545. return $recv($self._dagChildren())._select_((function(each){
  39546. return $core.withContext(function($ctx2) {
  39547. return $recv(each)._isTempDeclaration();
  39548. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39549. }));
  39550. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  39551. },
  39552. args: [],
  39553. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  39554. referencedClasses: [],
  39555. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  39556. }),
  39557. $globals.IRClosureInstruction);
  39558. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  39559. $core.addMethod(
  39560. $core.method({
  39561. selector: "acceptDagVisitor:",
  39562. protocol: "visiting",
  39563. fn: function (aVisitor){
  39564. var self=this,$self=this;
  39565. return $core.withContext(function($ctx1) {
  39566. return $recv(aVisitor)._visitIRClosure_(self);
  39567. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  39568. },
  39569. args: ["aVisitor"],
  39570. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  39571. referencedClasses: [],
  39572. messageSends: ["visitIRClosure:"]
  39573. }),
  39574. $globals.IRClosure);
  39575. $core.addMethod(
  39576. $core.method({
  39577. selector: "isClosure",
  39578. protocol: "testing",
  39579. fn: function (){
  39580. var self=this,$self=this;
  39581. return true;
  39582. },
  39583. args: [],
  39584. source: "isClosure\x0a\x09^ true",
  39585. referencedClasses: [],
  39586. messageSends: []
  39587. }),
  39588. $globals.IRClosure);
  39589. $core.addMethod(
  39590. $core.method({
  39591. selector: "sequence",
  39592. protocol: "accessing",
  39593. fn: function (){
  39594. var self=this,$self=this;
  39595. return $core.withContext(function($ctx1) {
  39596. return $recv($self._dagChildren())._last();
  39597. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  39598. },
  39599. args: [],
  39600. source: "sequence\x0a\x09^ self dagChildren last",
  39601. referencedClasses: [],
  39602. messageSends: ["last", "dagChildren"]
  39603. }),
  39604. $globals.IRClosure);
  39605. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  39606. $globals.IRMethod.comment="I am a method instruction";
  39607. $core.addMethod(
  39608. $core.method({
  39609. selector: "acceptDagVisitor:",
  39610. protocol: "visiting",
  39611. fn: function (aVisitor){
  39612. var self=this,$self=this;
  39613. return $core.withContext(function($ctx1) {
  39614. return $recv(aVisitor)._visitIRMethod_(self);
  39615. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  39616. },
  39617. args: ["aVisitor"],
  39618. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  39619. referencedClasses: [],
  39620. messageSends: ["visitIRMethod:"]
  39621. }),
  39622. $globals.IRMethod);
  39623. $core.addMethod(
  39624. $core.method({
  39625. selector: "classReferences",
  39626. protocol: "accessing",
  39627. fn: function (){
  39628. var self=this,$self=this;
  39629. return $self["@classReferences"];
  39630. },
  39631. args: [],
  39632. source: "classReferences\x0a\x09^ classReferences",
  39633. referencedClasses: [],
  39634. messageSends: []
  39635. }),
  39636. $globals.IRMethod);
  39637. $core.addMethod(
  39638. $core.method({
  39639. selector: "classReferences:",
  39640. protocol: "accessing",
  39641. fn: function (aCollection){
  39642. var self=this,$self=this;
  39643. $self["@classReferences"]=aCollection;
  39644. return self;
  39645. },
  39646. args: ["aCollection"],
  39647. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  39648. referencedClasses: [],
  39649. messageSends: []
  39650. }),
  39651. $globals.IRMethod);
  39652. $core.addMethod(
  39653. $core.method({
  39654. selector: "internalVariables",
  39655. protocol: "accessing",
  39656. fn: function (){
  39657. var self=this,$self=this;
  39658. return $core.withContext(function($ctx1) {
  39659. var $1,$receiver;
  39660. $1=$self["@internalVariables"];
  39661. if(($receiver = $1) == null || $receiver.a$nil){
  39662. $self["@internalVariables"]=$recv($globals.Set)._new();
  39663. return $self["@internalVariables"];
  39664. } else {
  39665. return $1;
  39666. }
  39667. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  39668. },
  39669. args: [],
  39670. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  39671. referencedClasses: ["Set"],
  39672. messageSends: ["ifNil:", "new"]
  39673. }),
  39674. $globals.IRMethod);
  39675. $core.addMethod(
  39676. $core.method({
  39677. selector: "isMethod",
  39678. protocol: "testing",
  39679. fn: function (){
  39680. var self=this,$self=this;
  39681. return true;
  39682. },
  39683. args: [],
  39684. source: "isMethod\x0a\x09^ true",
  39685. referencedClasses: [],
  39686. messageSends: []
  39687. }),
  39688. $globals.IRMethod);
  39689. $core.addMethod(
  39690. $core.method({
  39691. selector: "messageSends",
  39692. protocol: "accessing",
  39693. fn: function (){
  39694. var self=this,$self=this;
  39695. return $core.withContext(function($ctx1) {
  39696. return $recv($self._sendIndexes())._keys();
  39697. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  39698. },
  39699. args: [],
  39700. source: "messageSends\x0a\x09^ self sendIndexes keys",
  39701. referencedClasses: [],
  39702. messageSends: ["keys", "sendIndexes"]
  39703. }),
  39704. $globals.IRMethod);
  39705. $core.addMethod(
  39706. $core.method({
  39707. selector: "method",
  39708. protocol: "accessing",
  39709. fn: function (){
  39710. var self=this,$self=this;
  39711. return self;
  39712. },
  39713. args: [],
  39714. source: "method\x0a\x09^ self",
  39715. referencedClasses: [],
  39716. messageSends: []
  39717. }),
  39718. $globals.IRMethod);
  39719. $core.addMethod(
  39720. $core.method({
  39721. selector: "selector",
  39722. protocol: "accessing",
  39723. fn: function (){
  39724. var self=this,$self=this;
  39725. return $self["@selector"];
  39726. },
  39727. args: [],
  39728. source: "selector\x0a\x09^ selector",
  39729. referencedClasses: [],
  39730. messageSends: []
  39731. }),
  39732. $globals.IRMethod);
  39733. $core.addMethod(
  39734. $core.method({
  39735. selector: "selector:",
  39736. protocol: "accessing",
  39737. fn: function (aString){
  39738. var self=this,$self=this;
  39739. $self["@selector"]=aString;
  39740. return self;
  39741. },
  39742. args: ["aString"],
  39743. source: "selector: aString\x0a\x09selector := aString",
  39744. referencedClasses: [],
  39745. messageSends: []
  39746. }),
  39747. $globals.IRMethod);
  39748. $core.addMethod(
  39749. $core.method({
  39750. selector: "sendIndexes",
  39751. protocol: "accessing",
  39752. fn: function (){
  39753. var self=this,$self=this;
  39754. return $self["@sendIndexes"];
  39755. },
  39756. args: [],
  39757. source: "sendIndexes\x0a\x09^ sendIndexes",
  39758. referencedClasses: [],
  39759. messageSends: []
  39760. }),
  39761. $globals.IRMethod);
  39762. $core.addMethod(
  39763. $core.method({
  39764. selector: "sendIndexes:",
  39765. protocol: "accessing",
  39766. fn: function (aDictionary){
  39767. var self=this,$self=this;
  39768. $self["@sendIndexes"]=aDictionary;
  39769. return self;
  39770. },
  39771. args: ["aDictionary"],
  39772. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  39773. referencedClasses: [],
  39774. messageSends: []
  39775. }),
  39776. $globals.IRMethod);
  39777. $core.addMethod(
  39778. $core.method({
  39779. selector: "source",
  39780. protocol: "accessing",
  39781. fn: function (){
  39782. var self=this,$self=this;
  39783. return $self["@source"];
  39784. },
  39785. args: [],
  39786. source: "source\x0a\x09^ source",
  39787. referencedClasses: [],
  39788. messageSends: []
  39789. }),
  39790. $globals.IRMethod);
  39791. $core.addMethod(
  39792. $core.method({
  39793. selector: "source:",
  39794. protocol: "accessing",
  39795. fn: function (aString){
  39796. var self=this,$self=this;
  39797. $self["@source"]=aString;
  39798. return self;
  39799. },
  39800. args: ["aString"],
  39801. source: "source: aString\x0a\x09source := aString",
  39802. referencedClasses: [],
  39803. messageSends: []
  39804. }),
  39805. $globals.IRMethod);
  39806. $core.addMethod(
  39807. $core.method({
  39808. selector: "theClass",
  39809. protocol: "accessing",
  39810. fn: function (){
  39811. var self=this,$self=this;
  39812. return $self["@theClass"];
  39813. },
  39814. args: [],
  39815. source: "theClass\x0a\x09^ theClass",
  39816. referencedClasses: [],
  39817. messageSends: []
  39818. }),
  39819. $globals.IRMethod);
  39820. $core.addMethod(
  39821. $core.method({
  39822. selector: "theClass:",
  39823. protocol: "accessing",
  39824. fn: function (aClass){
  39825. var self=this,$self=this;
  39826. $self["@theClass"]=aClass;
  39827. return self;
  39828. },
  39829. args: ["aClass"],
  39830. source: "theClass: aClass\x0a\x09theClass := aClass",
  39831. referencedClasses: [],
  39832. messageSends: []
  39833. }),
  39834. $globals.IRMethod);
  39835. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  39836. $globals.IRReturn.comment="I am a local return instruction.";
  39837. $core.addMethod(
  39838. $core.method({
  39839. selector: "acceptDagVisitor:",
  39840. protocol: "visiting",
  39841. fn: function (aVisitor){
  39842. var self=this,$self=this;
  39843. return $core.withContext(function($ctx1) {
  39844. return $recv(aVisitor)._visitIRReturn_(self);
  39845. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  39846. },
  39847. args: ["aVisitor"],
  39848. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  39849. referencedClasses: [],
  39850. messageSends: ["visitIRReturn:"]
  39851. }),
  39852. $globals.IRReturn);
  39853. $core.addMethod(
  39854. $core.method({
  39855. selector: "expression",
  39856. protocol: "accessing",
  39857. fn: function (){
  39858. var self=this,$self=this;
  39859. return $core.withContext(function($ctx1) {
  39860. return $recv($self._dagChildren())._single();
  39861. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  39862. },
  39863. args: [],
  39864. source: "expression\x0a\x09^ self dagChildren single",
  39865. referencedClasses: [],
  39866. messageSends: ["single", "dagChildren"]
  39867. }),
  39868. $globals.IRReturn);
  39869. $core.addMethod(
  39870. $core.method({
  39871. selector: "scope",
  39872. protocol: "accessing",
  39873. fn: function (){
  39874. var self=this,$self=this;
  39875. return $core.withContext(function($ctx1) {
  39876. var $1,$receiver;
  39877. $1=$self["@scope"];
  39878. if(($receiver = $1) == null || $receiver.a$nil){
  39879. return $recv($self._parent())._scope();
  39880. } else {
  39881. return $1;
  39882. }
  39883. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  39884. },
  39885. args: [],
  39886. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  39887. referencedClasses: [],
  39888. messageSends: ["ifNil:", "scope", "parent"]
  39889. }),
  39890. $globals.IRReturn);
  39891. $core.addMethod(
  39892. $core.method({
  39893. selector: "yieldsValue",
  39894. protocol: "testing",
  39895. fn: function (){
  39896. var self=this,$self=this;
  39897. return false;
  39898. },
  39899. args: [],
  39900. source: "yieldsValue\x0a\x09^ false",
  39901. referencedClasses: [],
  39902. messageSends: []
  39903. }),
  39904. $globals.IRReturn);
  39905. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  39906. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  39907. $core.addMethod(
  39908. $core.method({
  39909. selector: "acceptDagVisitor:",
  39910. protocol: "visiting",
  39911. fn: function (aVisitor){
  39912. var self=this,$self=this;
  39913. return $core.withContext(function($ctx1) {
  39914. return $recv(aVisitor)._visitIRBlockReturn_(self);
  39915. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  39916. },
  39917. args: ["aVisitor"],
  39918. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  39919. referencedClasses: [],
  39920. messageSends: ["visitIRBlockReturn:"]
  39921. }),
  39922. $globals.IRBlockReturn);
  39923. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  39924. $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.";
  39925. $core.addMethod(
  39926. $core.method({
  39927. selector: "acceptDagVisitor:",
  39928. protocol: "visiting",
  39929. fn: function (aVisitor){
  39930. var self=this,$self=this;
  39931. return $core.withContext(function($ctx1) {
  39932. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  39933. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  39934. },
  39935. args: ["aVisitor"],
  39936. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  39937. referencedClasses: [],
  39938. messageSends: ["visitIRNonLocalReturn:"]
  39939. }),
  39940. $globals.IRNonLocalReturn);
  39941. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  39942. $core.addMethod(
  39943. $core.method({
  39944. selector: "acceptDagVisitor:",
  39945. protocol: "visiting",
  39946. fn: function (aVisitor){
  39947. var self=this,$self=this;
  39948. return $core.withContext(function($ctx1) {
  39949. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  39950. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  39951. },
  39952. args: ["aVisitor"],
  39953. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  39954. referencedClasses: [],
  39955. messageSends: ["visitIRTempDeclaration:"]
  39956. }),
  39957. $globals.IRTempDeclaration);
  39958. $core.addMethod(
  39959. $core.method({
  39960. selector: "isTempDeclaration",
  39961. protocol: "testing",
  39962. fn: function (){
  39963. var self=this,$self=this;
  39964. return true;
  39965. },
  39966. args: [],
  39967. source: "isTempDeclaration\x0a\x09^ true",
  39968. referencedClasses: [],
  39969. messageSends: []
  39970. }),
  39971. $globals.IRTempDeclaration);
  39972. $core.addMethod(
  39973. $core.method({
  39974. selector: "name",
  39975. protocol: "accessing",
  39976. fn: function (){
  39977. var self=this,$self=this;
  39978. return $self["@name"];
  39979. },
  39980. args: [],
  39981. source: "name\x0a\x09^ name",
  39982. referencedClasses: [],
  39983. messageSends: []
  39984. }),
  39985. $globals.IRTempDeclaration);
  39986. $core.addMethod(
  39987. $core.method({
  39988. selector: "name:",
  39989. protocol: "accessing",
  39990. fn: function (aString){
  39991. var self=this,$self=this;
  39992. $self["@name"]=aString;
  39993. return self;
  39994. },
  39995. args: ["aString"],
  39996. source: "name: aString\x0a\x09name := aString",
  39997. referencedClasses: [],
  39998. messageSends: []
  39999. }),
  40000. $globals.IRTempDeclaration);
  40001. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40002. $globals.IRSend.comment="I am a message send instruction.";
  40003. $core.addMethod(
  40004. $core.method({
  40005. selector: "acceptDagVisitor:",
  40006. protocol: "visiting",
  40007. fn: function (aVisitor){
  40008. var self=this,$self=this;
  40009. return $core.withContext(function($ctx1) {
  40010. return $recv(aVisitor)._visitIRSend_(self);
  40011. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40012. },
  40013. args: ["aVisitor"],
  40014. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40015. referencedClasses: [],
  40016. messageSends: ["visitIRSend:"]
  40017. }),
  40018. $globals.IRSend);
  40019. $core.addMethod(
  40020. $core.method({
  40021. selector: "arguments",
  40022. protocol: "accessing",
  40023. fn: function (){
  40024. var self=this,$self=this;
  40025. return $core.withContext(function($ctx1) {
  40026. return $recv($self._dagChildren())._allButFirst();
  40027. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40028. },
  40029. args: [],
  40030. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40031. referencedClasses: [],
  40032. messageSends: ["allButFirst", "dagChildren"]
  40033. }),
  40034. $globals.IRSend);
  40035. $core.addMethod(
  40036. $core.method({
  40037. selector: "index",
  40038. protocol: "accessing",
  40039. fn: function (){
  40040. var self=this,$self=this;
  40041. return $self["@index"];
  40042. },
  40043. args: [],
  40044. source: "index\x0a\x09^ index",
  40045. referencedClasses: [],
  40046. messageSends: []
  40047. }),
  40048. $globals.IRSend);
  40049. $core.addMethod(
  40050. $core.method({
  40051. selector: "index:",
  40052. protocol: "accessing",
  40053. fn: function (anInteger){
  40054. var self=this,$self=this;
  40055. $self["@index"]=anInteger;
  40056. return self;
  40057. },
  40058. args: ["anInteger"],
  40059. source: "index: anInteger\x0a\x09index := anInteger",
  40060. referencedClasses: [],
  40061. messageSends: []
  40062. }),
  40063. $globals.IRSend);
  40064. $core.addMethod(
  40065. $core.method({
  40066. selector: "isSend",
  40067. protocol: "testing",
  40068. fn: function (){
  40069. var self=this,$self=this;
  40070. return true;
  40071. },
  40072. args: [],
  40073. source: "isSend\x0a\x09^ true",
  40074. referencedClasses: [],
  40075. messageSends: []
  40076. }),
  40077. $globals.IRSend);
  40078. $core.addMethod(
  40079. $core.method({
  40080. selector: "receiver",
  40081. protocol: "accessing",
  40082. fn: function (){
  40083. var self=this,$self=this;
  40084. return $core.withContext(function($ctx1) {
  40085. return $recv($self._dagChildren())._first();
  40086. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40087. },
  40088. args: [],
  40089. source: "receiver\x0a\x09^ self dagChildren first",
  40090. referencedClasses: [],
  40091. messageSends: ["first", "dagChildren"]
  40092. }),
  40093. $globals.IRSend);
  40094. $core.addMethod(
  40095. $core.method({
  40096. selector: "selector",
  40097. protocol: "accessing",
  40098. fn: function (){
  40099. var self=this,$self=this;
  40100. return $self["@selector"];
  40101. },
  40102. args: [],
  40103. source: "selector\x0a\x09^ selector",
  40104. referencedClasses: [],
  40105. messageSends: []
  40106. }),
  40107. $globals.IRSend);
  40108. $core.addMethod(
  40109. $core.method({
  40110. selector: "selector:",
  40111. protocol: "accessing",
  40112. fn: function (aString){
  40113. var self=this,$self=this;
  40114. $self["@selector"]=aString;
  40115. return self;
  40116. },
  40117. args: ["aString"],
  40118. source: "selector: aString\x0a\x09selector := aString",
  40119. referencedClasses: [],
  40120. messageSends: []
  40121. }),
  40122. $globals.IRSend);
  40123. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40124. $core.addMethod(
  40125. $core.method({
  40126. selector: "acceptDagVisitor:",
  40127. protocol: "visiting",
  40128. fn: function (aVisitor){
  40129. var self=this,$self=this;
  40130. return $core.withContext(function($ctx1) {
  40131. return $recv(aVisitor)._visitIRSequence_(self);
  40132. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40133. },
  40134. args: ["aVisitor"],
  40135. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40136. referencedClasses: [],
  40137. messageSends: ["visitIRSequence:"]
  40138. }),
  40139. $globals.IRSequence);
  40140. $core.addMethod(
  40141. $core.method({
  40142. selector: "isSequence",
  40143. protocol: "testing",
  40144. fn: function (){
  40145. var self=this,$self=this;
  40146. return true;
  40147. },
  40148. args: [],
  40149. source: "isSequence\x0a\x09^ true",
  40150. referencedClasses: [],
  40151. messageSends: []
  40152. }),
  40153. $globals.IRSequence);
  40154. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40155. $core.addMethod(
  40156. $core.method({
  40157. selector: "acceptDagVisitor:",
  40158. protocol: "visiting",
  40159. fn: function (aVisitor){
  40160. var self=this,$self=this;
  40161. return $core.withContext(function($ctx1) {
  40162. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40163. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40164. },
  40165. args: ["aVisitor"],
  40166. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40167. referencedClasses: [],
  40168. messageSends: ["visitIRBlockSequence:"]
  40169. }),
  40170. $globals.IRBlockSequence);
  40171. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40172. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40173. $core.addMethod(
  40174. $core.method({
  40175. selector: "acceptDagVisitor:",
  40176. protocol: "visiting",
  40177. fn: function (aVisitor){
  40178. var self=this,$self=this;
  40179. return $core.withContext(function($ctx1) {
  40180. return $recv(aVisitor)._visitIRValue_(self);
  40181. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40182. },
  40183. args: ["aVisitor"],
  40184. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40185. referencedClasses: [],
  40186. messageSends: ["visitIRValue:"]
  40187. }),
  40188. $globals.IRValue);
  40189. $core.addMethod(
  40190. $core.method({
  40191. selector: "needsBoxingAsReceiver",
  40192. protocol: "testing",
  40193. fn: function (){
  40194. var self=this,$self=this;
  40195. return false;
  40196. },
  40197. args: [],
  40198. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40199. referencedClasses: [],
  40200. messageSends: []
  40201. }),
  40202. $globals.IRValue);
  40203. $core.addMethod(
  40204. $core.method({
  40205. selector: "value",
  40206. protocol: "accessing",
  40207. fn: function (){
  40208. var self=this,$self=this;
  40209. return $self["@value"];
  40210. },
  40211. args: [],
  40212. source: "value\x0a\x09^ value",
  40213. referencedClasses: [],
  40214. messageSends: []
  40215. }),
  40216. $globals.IRValue);
  40217. $core.addMethod(
  40218. $core.method({
  40219. selector: "value:",
  40220. protocol: "accessing",
  40221. fn: function (aString){
  40222. var self=this,$self=this;
  40223. $self["@value"]=aString;
  40224. return self;
  40225. },
  40226. args: ["aString"],
  40227. source: "value: aString\x0a\x09value := aString",
  40228. referencedClasses: [],
  40229. messageSends: []
  40230. }),
  40231. $globals.IRValue);
  40232. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40233. $globals.IRVariable.comment="I am a variable instruction.";
  40234. $core.addMethod(
  40235. $core.method({
  40236. selector: "acceptDagVisitor:",
  40237. protocol: "visiting",
  40238. fn: function (aVisitor){
  40239. var self=this,$self=this;
  40240. return $core.withContext(function($ctx1) {
  40241. return $recv(aVisitor)._visitIRVariable_(self);
  40242. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40243. },
  40244. args: ["aVisitor"],
  40245. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40246. referencedClasses: [],
  40247. messageSends: ["visitIRVariable:"]
  40248. }),
  40249. $globals.IRVariable);
  40250. $core.addMethod(
  40251. $core.method({
  40252. selector: "isSelf",
  40253. protocol: "testing",
  40254. fn: function (){
  40255. var self=this,$self=this;
  40256. return $core.withContext(function($ctx1) {
  40257. return $recv($self._variable())._isSelf();
  40258. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40259. },
  40260. args: [],
  40261. source: "isSelf\x0a\x09^ self variable isSelf",
  40262. referencedClasses: [],
  40263. messageSends: ["isSelf", "variable"]
  40264. }),
  40265. $globals.IRVariable);
  40266. $core.addMethod(
  40267. $core.method({
  40268. selector: "isSuper",
  40269. protocol: "testing",
  40270. fn: function (){
  40271. var self=this,$self=this;
  40272. return $core.withContext(function($ctx1) {
  40273. return $recv($self._variable())._isSuper();
  40274. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40275. },
  40276. args: [],
  40277. source: "isSuper\x0a\x09^ self variable isSuper",
  40278. referencedClasses: [],
  40279. messageSends: ["isSuper", "variable"]
  40280. }),
  40281. $globals.IRVariable);
  40282. $core.addMethod(
  40283. $core.method({
  40284. selector: "isVariable",
  40285. protocol: "testing",
  40286. fn: function (){
  40287. var self=this,$self=this;
  40288. return true;
  40289. },
  40290. args: [],
  40291. source: "isVariable\x0a\x09^ true",
  40292. referencedClasses: [],
  40293. messageSends: []
  40294. }),
  40295. $globals.IRVariable);
  40296. $core.addMethod(
  40297. $core.method({
  40298. selector: "needsBoxingAsReceiver",
  40299. protocol: "testing",
  40300. fn: function (){
  40301. var self=this,$self=this;
  40302. return $core.withContext(function($ctx1) {
  40303. return $recv($recv($self._variable())._isPseudoVar())._not();
  40304. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40305. },
  40306. args: [],
  40307. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40308. referencedClasses: [],
  40309. messageSends: ["not", "isPseudoVar", "variable"]
  40310. }),
  40311. $globals.IRVariable);
  40312. $core.addMethod(
  40313. $core.method({
  40314. selector: "variable",
  40315. protocol: "accessing",
  40316. fn: function (){
  40317. var self=this,$self=this;
  40318. return $self["@variable"];
  40319. },
  40320. args: [],
  40321. source: "variable\x0a\x09^ variable",
  40322. referencedClasses: [],
  40323. messageSends: []
  40324. }),
  40325. $globals.IRVariable);
  40326. $core.addMethod(
  40327. $core.method({
  40328. selector: "variable:",
  40329. protocol: "accessing",
  40330. fn: function (aScopeVariable){
  40331. var self=this,$self=this;
  40332. $self["@variable"]=aScopeVariable;
  40333. return self;
  40334. },
  40335. args: ["aScopeVariable"],
  40336. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40337. referencedClasses: [],
  40338. messageSends: []
  40339. }),
  40340. $globals.IRVariable);
  40341. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40342. $core.addMethod(
  40343. $core.method({
  40344. selector: "acceptDagVisitor:",
  40345. protocol: "visiting",
  40346. fn: function (aVisitor){
  40347. var self=this,$self=this;
  40348. return $core.withContext(function($ctx1) {
  40349. return $recv(aVisitor)._visitIRVerbatim_(self);
  40350. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40351. },
  40352. args: ["aVisitor"],
  40353. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40354. referencedClasses: [],
  40355. messageSends: ["visitIRVerbatim:"]
  40356. }),
  40357. $globals.IRVerbatim);
  40358. $core.addMethod(
  40359. $core.method({
  40360. selector: "source",
  40361. protocol: "accessing",
  40362. fn: function (){
  40363. var self=this,$self=this;
  40364. return $self["@source"];
  40365. },
  40366. args: [],
  40367. source: "source\x0a\x09^ source",
  40368. referencedClasses: [],
  40369. messageSends: []
  40370. }),
  40371. $globals.IRVerbatim);
  40372. $core.addMethod(
  40373. $core.method({
  40374. selector: "source:",
  40375. protocol: "accessing",
  40376. fn: function (aString){
  40377. var self=this,$self=this;
  40378. $self["@source"]=aString;
  40379. return self;
  40380. },
  40381. args: ["aString"],
  40382. source: "source: aString\x0a\x09source := aString",
  40383. referencedClasses: [],
  40384. messageSends: []
  40385. }),
  40386. $globals.IRVerbatim);
  40387. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40388. $core.addMethod(
  40389. $core.method({
  40390. selector: "visitDagNode:",
  40391. protocol: "visiting",
  40392. fn: function (aNode){
  40393. var self=this,$self=this;
  40394. return $core.withContext(function($ctx1) {
  40395. return $self._visitDagNodeVariantSimple_(aNode);
  40396. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40397. },
  40398. args: ["aNode"],
  40399. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40400. referencedClasses: [],
  40401. messageSends: ["visitDagNodeVariantSimple:"]
  40402. }),
  40403. $globals.IRVisitor);
  40404. $core.addMethod(
  40405. $core.method({
  40406. selector: "visitIRAssignment:",
  40407. protocol: "visiting",
  40408. fn: function (anIRAssignment){
  40409. var self=this,$self=this;
  40410. return $core.withContext(function($ctx1) {
  40411. return $self._visitDagNode_(anIRAssignment);
  40412. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40413. },
  40414. args: ["anIRAssignment"],
  40415. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40416. referencedClasses: [],
  40417. messageSends: ["visitDagNode:"]
  40418. }),
  40419. $globals.IRVisitor);
  40420. $core.addMethod(
  40421. $core.method({
  40422. selector: "visitIRBlockReturn:",
  40423. protocol: "visiting",
  40424. fn: function (anIRBlockReturn){
  40425. var self=this,$self=this;
  40426. return $core.withContext(function($ctx1) {
  40427. return $self._visitIRReturn_(anIRBlockReturn);
  40428. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40429. },
  40430. args: ["anIRBlockReturn"],
  40431. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40432. referencedClasses: [],
  40433. messageSends: ["visitIRReturn:"]
  40434. }),
  40435. $globals.IRVisitor);
  40436. $core.addMethod(
  40437. $core.method({
  40438. selector: "visitIRBlockSequence:",
  40439. protocol: "visiting",
  40440. fn: function (anIRBlockSequence){
  40441. var self=this,$self=this;
  40442. return $core.withContext(function($ctx1) {
  40443. return $self._visitIRSequence_(anIRBlockSequence);
  40444. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40445. },
  40446. args: ["anIRBlockSequence"],
  40447. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40448. referencedClasses: [],
  40449. messageSends: ["visitIRSequence:"]
  40450. }),
  40451. $globals.IRVisitor);
  40452. $core.addMethod(
  40453. $core.method({
  40454. selector: "visitIRClosure:",
  40455. protocol: "visiting",
  40456. fn: function (anIRClosure){
  40457. var self=this,$self=this;
  40458. return $core.withContext(function($ctx1) {
  40459. return $self._visitDagNode_(anIRClosure);
  40460. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40461. },
  40462. args: ["anIRClosure"],
  40463. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40464. referencedClasses: [],
  40465. messageSends: ["visitDagNode:"]
  40466. }),
  40467. $globals.IRVisitor);
  40468. $core.addMethod(
  40469. $core.method({
  40470. selector: "visitIRDynamicArray:",
  40471. protocol: "visiting",
  40472. fn: function (anIRDynamicArray){
  40473. var self=this,$self=this;
  40474. return $core.withContext(function($ctx1) {
  40475. return $self._visitDagNode_(anIRDynamicArray);
  40476. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  40477. },
  40478. args: ["anIRDynamicArray"],
  40479. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  40480. referencedClasses: [],
  40481. messageSends: ["visitDagNode:"]
  40482. }),
  40483. $globals.IRVisitor);
  40484. $core.addMethod(
  40485. $core.method({
  40486. selector: "visitIRDynamicDictionary:",
  40487. protocol: "visiting",
  40488. fn: function (anIRDynamicDictionary){
  40489. var self=this,$self=this;
  40490. return $core.withContext(function($ctx1) {
  40491. return $self._visitDagNode_(anIRDynamicDictionary);
  40492. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  40493. },
  40494. args: ["anIRDynamicDictionary"],
  40495. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  40496. referencedClasses: [],
  40497. messageSends: ["visitDagNode:"]
  40498. }),
  40499. $globals.IRVisitor);
  40500. $core.addMethod(
  40501. $core.method({
  40502. selector: "visitIRInlinedClosure:",
  40503. protocol: "visiting",
  40504. fn: function (anIRInlinedClosure){
  40505. var self=this,$self=this;
  40506. return $core.withContext(function($ctx1) {
  40507. return $self._visitIRClosure_(anIRInlinedClosure);
  40508. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  40509. },
  40510. args: ["anIRInlinedClosure"],
  40511. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  40512. referencedClasses: [],
  40513. messageSends: ["visitIRClosure:"]
  40514. }),
  40515. $globals.IRVisitor);
  40516. $core.addMethod(
  40517. $core.method({
  40518. selector: "visitIRInlinedSequence:",
  40519. protocol: "visiting",
  40520. fn: function (anIRInlinedSequence){
  40521. var self=this,$self=this;
  40522. return $core.withContext(function($ctx1) {
  40523. return $self._visitIRSequence_(anIRInlinedSequence);
  40524. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  40525. },
  40526. args: ["anIRInlinedSequence"],
  40527. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  40528. referencedClasses: [],
  40529. messageSends: ["visitIRSequence:"]
  40530. }),
  40531. $globals.IRVisitor);
  40532. $core.addMethod(
  40533. $core.method({
  40534. selector: "visitIRMethod:",
  40535. protocol: "visiting",
  40536. fn: function (anIRMethod){
  40537. var self=this,$self=this;
  40538. return $core.withContext(function($ctx1) {
  40539. return $self._visitDagNode_(anIRMethod);
  40540. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  40541. },
  40542. args: ["anIRMethod"],
  40543. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  40544. referencedClasses: [],
  40545. messageSends: ["visitDagNode:"]
  40546. }),
  40547. $globals.IRVisitor);
  40548. $core.addMethod(
  40549. $core.method({
  40550. selector: "visitIRNonLocalReturn:",
  40551. protocol: "visiting",
  40552. fn: function (anIRNonLocalReturn){
  40553. var self=this,$self=this;
  40554. return $core.withContext(function($ctx1) {
  40555. return $self._visitDagNode_(anIRNonLocalReturn);
  40556. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  40557. },
  40558. args: ["anIRNonLocalReturn"],
  40559. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  40560. referencedClasses: [],
  40561. messageSends: ["visitDagNode:"]
  40562. }),
  40563. $globals.IRVisitor);
  40564. $core.addMethod(
  40565. $core.method({
  40566. selector: "visitIRNonLocalReturnHandling:",
  40567. protocol: "visiting",
  40568. fn: function (anIRNonLocalReturnHandling){
  40569. var self=this,$self=this;
  40570. return $core.withContext(function($ctx1) {
  40571. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  40572. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  40573. },
  40574. args: ["anIRNonLocalReturnHandling"],
  40575. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  40576. referencedClasses: [],
  40577. messageSends: ["visitDagNode:"]
  40578. }),
  40579. $globals.IRVisitor);
  40580. $core.addMethod(
  40581. $core.method({
  40582. selector: "visitIRReturn:",
  40583. protocol: "visiting",
  40584. fn: function (anIRReturn){
  40585. var self=this,$self=this;
  40586. return $core.withContext(function($ctx1) {
  40587. return $self._visitDagNode_(anIRReturn);
  40588. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  40589. },
  40590. args: ["anIRReturn"],
  40591. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  40592. referencedClasses: [],
  40593. messageSends: ["visitDagNode:"]
  40594. }),
  40595. $globals.IRVisitor);
  40596. $core.addMethod(
  40597. $core.method({
  40598. selector: "visitIRSend:",
  40599. protocol: "visiting",
  40600. fn: function (anIRSend){
  40601. var self=this,$self=this;
  40602. return $core.withContext(function($ctx1) {
  40603. return $self._visitDagNode_(anIRSend);
  40604. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  40605. },
  40606. args: ["anIRSend"],
  40607. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  40608. referencedClasses: [],
  40609. messageSends: ["visitDagNode:"]
  40610. }),
  40611. $globals.IRVisitor);
  40612. $core.addMethod(
  40613. $core.method({
  40614. selector: "visitIRSequence:",
  40615. protocol: "visiting",
  40616. fn: function (anIRSequence){
  40617. var self=this,$self=this;
  40618. return $core.withContext(function($ctx1) {
  40619. return $self._visitDagNode_(anIRSequence);
  40620. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  40621. },
  40622. args: ["anIRSequence"],
  40623. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  40624. referencedClasses: [],
  40625. messageSends: ["visitDagNode:"]
  40626. }),
  40627. $globals.IRVisitor);
  40628. $core.addMethod(
  40629. $core.method({
  40630. selector: "visitIRTempDeclaration:",
  40631. protocol: "visiting",
  40632. fn: function (anIRTempDeclaration){
  40633. var self=this,$self=this;
  40634. return $core.withContext(function($ctx1) {
  40635. return $self._visitDagNode_(anIRTempDeclaration);
  40636. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  40637. },
  40638. args: ["anIRTempDeclaration"],
  40639. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  40640. referencedClasses: [],
  40641. messageSends: ["visitDagNode:"]
  40642. }),
  40643. $globals.IRVisitor);
  40644. $core.addMethod(
  40645. $core.method({
  40646. selector: "visitIRValue:",
  40647. protocol: "visiting",
  40648. fn: function (anIRValue){
  40649. var self=this,$self=this;
  40650. return $core.withContext(function($ctx1) {
  40651. return $self._visitDagNode_(anIRValue);
  40652. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  40653. },
  40654. args: ["anIRValue"],
  40655. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  40656. referencedClasses: [],
  40657. messageSends: ["visitDagNode:"]
  40658. }),
  40659. $globals.IRVisitor);
  40660. $core.addMethod(
  40661. $core.method({
  40662. selector: "visitIRVariable:",
  40663. protocol: "visiting",
  40664. fn: function (anIRVariable){
  40665. var self=this,$self=this;
  40666. return $core.withContext(function($ctx1) {
  40667. return $self._visitDagNode_(anIRVariable);
  40668. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  40669. },
  40670. args: ["anIRVariable"],
  40671. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  40672. referencedClasses: [],
  40673. messageSends: ["visitDagNode:"]
  40674. }),
  40675. $globals.IRVisitor);
  40676. $core.addMethod(
  40677. $core.method({
  40678. selector: "visitIRVerbatim:",
  40679. protocol: "visiting",
  40680. fn: function (anIRVerbatim){
  40681. var self=this,$self=this;
  40682. return $core.withContext(function($ctx1) {
  40683. return $self._visitDagNode_(anIRVerbatim);
  40684. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  40685. },
  40686. args: ["anIRVerbatim"],
  40687. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  40688. referencedClasses: [],
  40689. messageSends: ["visitDagNode:"]
  40690. }),
  40691. $globals.IRVisitor);
  40692. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  40693. $core.addMethod(
  40694. $core.method({
  40695. selector: "contents",
  40696. protocol: "accessing",
  40697. fn: function (){
  40698. var self=this,$self=this;
  40699. return $core.withContext(function($ctx1) {
  40700. return $recv($self._stream())._contents();
  40701. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  40702. },
  40703. args: [],
  40704. source: "contents\x0a\x09^ self stream contents",
  40705. referencedClasses: [],
  40706. messageSends: ["contents", "stream"]
  40707. }),
  40708. $globals.IRJSTranslator);
  40709. $core.addMethod(
  40710. $core.method({
  40711. selector: "currentClass",
  40712. protocol: "accessing",
  40713. fn: function (){
  40714. var self=this,$self=this;
  40715. return $self["@currentClass"];
  40716. },
  40717. args: [],
  40718. source: "currentClass\x0a\x09^ currentClass",
  40719. referencedClasses: [],
  40720. messageSends: []
  40721. }),
  40722. $globals.IRJSTranslator);
  40723. $core.addMethod(
  40724. $core.method({
  40725. selector: "currentClass:",
  40726. protocol: "accessing",
  40727. fn: function (aClass){
  40728. var self=this,$self=this;
  40729. $self["@currentClass"]=aClass;
  40730. return self;
  40731. },
  40732. args: ["aClass"],
  40733. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  40734. referencedClasses: [],
  40735. messageSends: []
  40736. }),
  40737. $globals.IRJSTranslator);
  40738. $core.addMethod(
  40739. $core.method({
  40740. selector: "initialize",
  40741. protocol: "initialization",
  40742. fn: function (){
  40743. var self=this,$self=this;
  40744. return $core.withContext(function($ctx1) {
  40745. (
  40746. $ctx1.supercall = true,
  40747. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  40748. $ctx1.supercall = false;
  40749. $self["@stream"]=$recv($globals.JSStream)._new();
  40750. return self;
  40751. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  40752. },
  40753. args: [],
  40754. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  40755. referencedClasses: ["JSStream"],
  40756. messageSends: ["initialize", "new"]
  40757. }),
  40758. $globals.IRJSTranslator);
  40759. $core.addMethod(
  40760. $core.method({
  40761. selector: "stream",
  40762. protocol: "accessing",
  40763. fn: function (){
  40764. var self=this,$self=this;
  40765. return $self["@stream"];
  40766. },
  40767. args: [],
  40768. source: "stream\x0a\x09^ stream",
  40769. referencedClasses: [],
  40770. messageSends: []
  40771. }),
  40772. $globals.IRJSTranslator);
  40773. $core.addMethod(
  40774. $core.method({
  40775. selector: "stream:",
  40776. protocol: "accessing",
  40777. fn: function (aStream){
  40778. var self=this,$self=this;
  40779. $self["@stream"]=aStream;
  40780. return self;
  40781. },
  40782. args: ["aStream"],
  40783. source: "stream: aStream\x0a\x09stream := aStream",
  40784. referencedClasses: [],
  40785. messageSends: []
  40786. }),
  40787. $globals.IRJSTranslator);
  40788. $core.addMethod(
  40789. $core.method({
  40790. selector: "visitIRAssignment:",
  40791. protocol: "visiting",
  40792. fn: function (anIRAssignment){
  40793. var self=this,$self=this;
  40794. return $core.withContext(function($ctx1) {
  40795. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  40796. return $core.withContext(function($ctx2) {
  40797. return $self._visit_($recv(anIRAssignment)._left());
  40798. $ctx2.sendIdx["visit:"]=1;
  40799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40800. }),(function(){
  40801. return $core.withContext(function($ctx2) {
  40802. return $self._visit_($recv(anIRAssignment)._right());
  40803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40804. }));
  40805. return self;
  40806. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  40807. },
  40808. args: ["anIRAssignment"],
  40809. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  40810. referencedClasses: [],
  40811. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  40812. }),
  40813. $globals.IRJSTranslator);
  40814. $core.addMethod(
  40815. $core.method({
  40816. selector: "visitIRClosure:",
  40817. protocol: "visiting",
  40818. fn: function (anIRClosure){
  40819. var self=this,$self=this;
  40820. return $core.withContext(function($ctx1) {
  40821. var $1,$2;
  40822. $1=$self._stream();
  40823. $ctx1.sendIdx["stream"]=1;
  40824. $recv($1)._nextPutClosureWith_arguments_((function(){
  40825. return $core.withContext(function($ctx2) {
  40826. $2=$self._stream();
  40827. $ctx2.sendIdx["stream"]=2;
  40828. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  40829. return $core.withContext(function($ctx3) {
  40830. return $recv($recv(each)._name())._asVariableName();
  40831. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40832. })));
  40833. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  40834. return $core.withContext(function($ctx3) {
  40835. return (
  40836. $ctx3.supercall = true,
  40837. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  40838. $ctx3.supercall = false;
  40839. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40840. }));
  40841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40842. }),$recv(anIRClosure)._arguments());
  40843. return self;
  40844. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  40845. },
  40846. args: ["anIRClosure"],
  40847. 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",
  40848. referencedClasses: [],
  40849. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  40850. }),
  40851. $globals.IRJSTranslator);
  40852. $core.addMethod(
  40853. $core.method({
  40854. selector: "visitIRDynamicArray:",
  40855. protocol: "visiting",
  40856. fn: function (anIRDynamicArray){
  40857. var self=this,$self=this;
  40858. return $core.withContext(function($ctx1) {
  40859. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  40860. return self;
  40861. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  40862. },
  40863. args: ["anIRDynamicArray"],
  40864. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  40865. referencedClasses: [],
  40866. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  40867. }),
  40868. $globals.IRJSTranslator);
  40869. $core.addMethod(
  40870. $core.method({
  40871. selector: "visitIRDynamicDictionary:",
  40872. protocol: "visiting",
  40873. fn: function (anIRDynamicDictionary){
  40874. var self=this,$self=this;
  40875. return $core.withContext(function($ctx1) {
  40876. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  40877. return self;
  40878. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  40879. },
  40880. args: ["anIRDynamicDictionary"],
  40881. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  40882. referencedClasses: [],
  40883. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  40884. }),
  40885. $globals.IRJSTranslator);
  40886. $core.addMethod(
  40887. $core.method({
  40888. selector: "visitIRMethod:",
  40889. protocol: "visiting",
  40890. fn: function (anIRMethod){
  40891. var self=this,$self=this;
  40892. return $core.withContext(function($ctx1) {
  40893. var $1,$2,$3,$4,$5,$6,$7;
  40894. $1=$self._stream();
  40895. $ctx1.sendIdx["stream"]=1;
  40896. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  40897. return $core.withContext(function($ctx2) {
  40898. $2=$self._stream();
  40899. $ctx2.sendIdx["stream"]=2;
  40900. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  40901. return $core.withContext(function($ctx3) {
  40902. $3=$self._stream();
  40903. $ctx3.sendIdx["stream"]=3;
  40904. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  40905. return $core.withContext(function($ctx4) {
  40906. return $recv($recv(each)._name())._asVariableName();
  40907. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  40908. }));
  40909. $ctx3.sendIdx["collect:"]=1;
  40910. $recv($3)._nextPutVars_($4);
  40911. $ctx3.sendIdx["nextPutVars:"]=1;
  40912. $5=$self._stream();
  40913. $ctx3.sendIdx["stream"]=4;
  40914. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  40915. return $core.withContext(function($ctx4) {
  40916. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  40917. return $core.withContext(function($ctx5) {
  40918. $6=$self._stream();
  40919. $ctx5.sendIdx["stream"]=5;
  40920. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  40921. return $core.withContext(function($ctx6) {
  40922. return $recv($recv(each)._variable())._alias();
  40923. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  40924. })));
  40925. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  40926. }));
  40927. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  40928. if($core.assert($7)){
  40929. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  40930. return $core.withContext(function($ctx5) {
  40931. return (
  40932. $ctx5.supercall = true,
  40933. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  40934. $ctx5.supercall = false;
  40935. $ctx5.sendIdx["visitIRMethod:"]=1;
  40936. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  40937. }));
  40938. } else {
  40939. return (
  40940. $ctx4.supercall = true,
  40941. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  40942. $ctx4.supercall = false;
  40943. }
  40944. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  40945. }));
  40946. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40947. }),$recv(anIRMethod)._arguments());
  40948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40949. }));
  40950. return $self._contents();
  40951. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  40952. },
  40953. args: ["anIRMethod"],
  40954. 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",
  40955. referencedClasses: [],
  40956. 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"]
  40957. }),
  40958. $globals.IRJSTranslator);
  40959. $core.addMethod(
  40960. $core.method({
  40961. selector: "visitIRNonLocalReturn:",
  40962. protocol: "visiting",
  40963. fn: function (anIRNonLocalReturn){
  40964. var self=this,$self=this;
  40965. return $core.withContext(function($ctx1) {
  40966. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  40967. return $core.withContext(function($ctx2) {
  40968. return (
  40969. $ctx2.supercall = true,
  40970. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  40971. $ctx2.supercall = false;
  40972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40973. }));
  40974. return self;
  40975. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  40976. },
  40977. args: ["anIRNonLocalReturn"],
  40978. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  40979. referencedClasses: [],
  40980. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  40981. }),
  40982. $globals.IRJSTranslator);
  40983. $core.addMethod(
  40984. $core.method({
  40985. selector: "visitIRReturn:",
  40986. protocol: "visiting",
  40987. fn: function (anIRReturn){
  40988. var self=this,$self=this;
  40989. return $core.withContext(function($ctx1) {
  40990. $recv($self._stream())._nextPutReturnWith_((function(){
  40991. return $core.withContext(function($ctx2) {
  40992. return (
  40993. $ctx2.supercall = true,
  40994. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  40995. $ctx2.supercall = false;
  40996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40997. }));
  40998. return self;
  40999. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41000. },
  41001. args: ["anIRReturn"],
  41002. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41003. referencedClasses: [],
  41004. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41005. }),
  41006. $globals.IRJSTranslator);
  41007. $core.addMethod(
  41008. $core.method({
  41009. selector: "visitIRSend:",
  41010. protocol: "visiting",
  41011. fn: function (anIRSend){
  41012. var self=this,$self=this;
  41013. var sends,superclass;
  41014. return $core.withContext(function($ctx1) {
  41015. var $1,$2;
  41016. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41017. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41018. if($core.assert($1)){
  41019. $self._visitSuperSend_(anIRSend);
  41020. } else {
  41021. $self._visitSend_(anIRSend);
  41022. }
  41023. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41024. if($core.assert($2)){
  41025. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41026. }
  41027. return self;
  41028. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41029. },
  41030. args: ["anIRSend"],
  41031. 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 ]",
  41032. referencedClasses: [],
  41033. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41034. }),
  41035. $globals.IRJSTranslator);
  41036. $core.addMethod(
  41037. $core.method({
  41038. selector: "visitIRSequence:",
  41039. protocol: "visiting",
  41040. fn: function (anIRSequence){
  41041. var self=this,$self=this;
  41042. return $core.withContext(function($ctx1) {
  41043. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41044. return $core.withContext(function($ctx2) {
  41045. return $recv($self._stream())._nextPutStatementWith_((function(){
  41046. return $core.withContext(function($ctx3) {
  41047. return $self._visit_(each);
  41048. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41049. }));
  41050. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41051. }));
  41052. return self;
  41053. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41054. },
  41055. args: ["anIRSequence"],
  41056. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41057. referencedClasses: [],
  41058. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41059. }),
  41060. $globals.IRJSTranslator);
  41061. $core.addMethod(
  41062. $core.method({
  41063. selector: "visitIRTempDeclaration:",
  41064. protocol: "visiting",
  41065. fn: function (anIRTempDeclaration){
  41066. var self=this,$self=this;
  41067. return self;
  41068. },
  41069. args: ["anIRTempDeclaration"],
  41070. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41071. referencedClasses: [],
  41072. messageSends: []
  41073. }),
  41074. $globals.IRJSTranslator);
  41075. $core.addMethod(
  41076. $core.method({
  41077. selector: "visitIRValue:",
  41078. protocol: "visiting",
  41079. fn: function (anIRValue){
  41080. var self=this,$self=this;
  41081. return $core.withContext(function($ctx1) {
  41082. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41083. return self;
  41084. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41085. },
  41086. args: ["anIRValue"],
  41087. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41088. referencedClasses: [],
  41089. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41090. }),
  41091. $globals.IRJSTranslator);
  41092. $core.addMethod(
  41093. $core.method({
  41094. selector: "visitIRVariable:",
  41095. protocol: "visiting",
  41096. fn: function (anIRVariable){
  41097. var self=this,$self=this;
  41098. return $core.withContext(function($ctx1) {
  41099. var $3,$2,$1,$4;
  41100. $3=$recv(anIRVariable)._variable();
  41101. $ctx1.sendIdx["variable"]=1;
  41102. $2=$recv($3)._name();
  41103. $1=$recv($2).__eq("thisContext");
  41104. if($core.assert($1)){
  41105. $4=$self._stream();
  41106. $ctx1.sendIdx["stream"]=1;
  41107. $recv($4)._nextPutAll_("$core.getThisContext()");
  41108. $ctx1.sendIdx["nextPutAll:"]=1;
  41109. } else {
  41110. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41111. }
  41112. return self;
  41113. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41114. },
  41115. args: ["anIRVariable"],
  41116. 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 ]",
  41117. referencedClasses: [],
  41118. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41119. }),
  41120. $globals.IRJSTranslator);
  41121. $core.addMethod(
  41122. $core.method({
  41123. selector: "visitIRVerbatim:",
  41124. protocol: "visiting",
  41125. fn: function (anIRVerbatim){
  41126. var self=this,$self=this;
  41127. return $core.withContext(function($ctx1) {
  41128. var $1;
  41129. $1=$self._stream();
  41130. $ctx1.sendIdx["stream"]=1;
  41131. $recv($1)._nextPutStatementWith_((function(){
  41132. return $core.withContext(function($ctx2) {
  41133. return $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41135. }));
  41136. return self;
  41137. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41138. },
  41139. args: ["anIRVerbatim"],
  41140. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  41141. referencedClasses: [],
  41142. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  41143. }),
  41144. $globals.IRJSTranslator);
  41145. $core.addMethod(
  41146. $core.method({
  41147. selector: "visitInstructionList:enclosedBetween:and:",
  41148. protocol: "visiting",
  41149. fn: function (anArray,aString,anotherString){
  41150. var self=this,$self=this;
  41151. return $core.withContext(function($ctx1) {
  41152. var $1;
  41153. $1=$self._stream();
  41154. $ctx1.sendIdx["stream"]=1;
  41155. $recv($1)._nextPutAll_(aString);
  41156. $ctx1.sendIdx["nextPutAll:"]=1;
  41157. $recv(anArray)._do_separatedBy_((function(each){
  41158. return $core.withContext(function($ctx2) {
  41159. return $self._visit_(each);
  41160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41161. }),(function(){
  41162. return $core.withContext(function($ctx2) {
  41163. return $recv($self._stream())._nextPutAll_(",");
  41164. $ctx2.sendIdx["nextPutAll:"]=2;
  41165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41166. }));
  41167. $recv($self["@stream"])._nextPutAll_(anotherString);
  41168. return self;
  41169. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41170. },
  41171. args: ["anArray", "aString", "anotherString"],
  41172. 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",
  41173. referencedClasses: [],
  41174. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41175. }),
  41176. $globals.IRJSTranslator);
  41177. $core.addMethod(
  41178. $core.method({
  41179. selector: "visitReceiver:",
  41180. protocol: "visiting",
  41181. fn: function (anIRInstruction){
  41182. var self=this,$self=this;
  41183. var instr;
  41184. return $core.withContext(function($ctx1) {
  41185. var $1,$2,$4,$5,$3,$6,$7,$8;
  41186. $1=$recv(anIRInstruction)._isSelf();
  41187. if($core.assert($1)){
  41188. $2=$recv(anIRInstruction)._copy();
  41189. $ctx1.sendIdx["copy"]=1;
  41190. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41191. $recv($4)._name_("$self");
  41192. $5=$recv($4)._yourself();
  41193. $ctx1.sendIdx["yourself"]=1;
  41194. $3=$5;
  41195. $recv($2)._variable_($3);
  41196. instr=$recv($2)._yourself();
  41197. instr;
  41198. } else {
  41199. instr=anIRInstruction;
  41200. instr;
  41201. }
  41202. $6=$recv(instr)._needsBoxingAsReceiver();
  41203. if(!$core.assert($6)){
  41204. $7=$self._visit_(instr);
  41205. $ctx1.sendIdx["visit:"]=1;
  41206. return $7;
  41207. }
  41208. $8=$self._stream();
  41209. $ctx1.sendIdx["stream"]=1;
  41210. $recv($8)._nextPutAll_("$recv(");
  41211. $ctx1.sendIdx["nextPutAll:"]=1;
  41212. $self._visit_(instr);
  41213. $recv($self._stream())._nextPutAll_(")");
  41214. return self;
  41215. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41216. },
  41217. args: ["anIRInstruction"],
  41218. 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: ')'",
  41219. referencedClasses: [],
  41220. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41221. }),
  41222. $globals.IRJSTranslator);
  41223. $core.addMethod(
  41224. $core.method({
  41225. selector: "visitSend:",
  41226. protocol: "visiting",
  41227. fn: function (anIRSend){
  41228. var self=this,$self=this;
  41229. return $core.withContext(function($ctx1) {
  41230. $self._visitReceiver_($recv(anIRSend)._receiver());
  41231. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41232. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41233. return self;
  41234. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41235. },
  41236. args: ["anIRSend"],
  41237. 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: ')'",
  41238. referencedClasses: [],
  41239. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41240. }),
  41241. $globals.IRJSTranslator);
  41242. $core.addMethod(
  41243. $core.method({
  41244. selector: "visitSuperSend:",
  41245. protocol: "visiting",
  41246. fn: function (anIRSend){
  41247. var self=this,$self=this;
  41248. return $core.withContext(function($ctx1) {
  41249. var $1,$4,$3,$2,$5,$6,$7,$8;
  41250. $1=$self._stream();
  41251. $ctx1.sendIdx["stream"]=1;
  41252. $recv($1)._nextPutAll_("(");
  41253. $ctx1.sendIdx["nextPutAll:"]=1;
  41254. $recv($1)._lf();
  41255. $ctx1.sendIdx["lf"]=1;
  41256. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41257. $ctx1.sendIdx["nextPutAll:"]=2;
  41258. $recv($1)._lf();
  41259. $ctx1.sendIdx["lf"]=2;
  41260. $4=$recv(anIRSend)._scope();
  41261. $ctx1.sendIdx["scope"]=1;
  41262. $3=$recv($4)._alias();
  41263. $ctx1.sendIdx["alias"]=1;
  41264. $2=$recv($3).__comma(".supercall = true,");
  41265. $ctx1.sendIdx[","]=1;
  41266. $recv($1)._nextPutAll_($2);
  41267. $ctx1.sendIdx["nextPutAll:"]=3;
  41268. $recv($1)._lf();
  41269. $ctx1.sendIdx["lf"]=3;
  41270. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41271. $ctx1.sendIdx["nextPutAll:"]=4;
  41272. $recv($1)._lf();
  41273. $ctx1.sendIdx["lf"]=4;
  41274. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41275. $ctx1.sendIdx[","]=2;
  41276. $recv($1)._nextPutAll_($5);
  41277. $ctx1.sendIdx["nextPutAll:"]=5;
  41278. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41279. $ctx1.sendIdx["nextPutAll:"]=6;
  41280. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41281. $ctx1.sendIdx[","]=3;
  41282. $recv($1)._nextPutAll_($6);
  41283. $ctx1.sendIdx["nextPutAll:"]=7;
  41284. $7=$recv($1)._nextPutAll_("$self, ");
  41285. $ctx1.sendIdx["nextPutAll:"]=8;
  41286. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41287. $8=$self._stream();
  41288. $recv($8)._nextPutAll_("));");
  41289. $ctx1.sendIdx["nextPutAll:"]=9;
  41290. $recv($8)._lf();
  41291. $ctx1.sendIdx["lf"]=5;
  41292. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41293. $ctx1.sendIdx["nextPutAll:"]=10;
  41294. $recv($8)._lf();
  41295. $ctx1.sendIdx["lf"]=6;
  41296. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41297. $ctx1.sendIdx["nextPutAll:"]=11;
  41298. $recv($8)._lf();
  41299. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41300. return self;
  41301. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41302. },
  41303. args: ["anIRSend"],
  41304. 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);'",
  41305. referencedClasses: [],
  41306. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41307. }),
  41308. $globals.IRJSTranslator);
  41309. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41310. $core.addMethod(
  41311. $core.method({
  41312. selector: "contents",
  41313. protocol: "accessing",
  41314. fn: function (){
  41315. var self=this,$self=this;
  41316. return $core.withContext(function($ctx1) {
  41317. return $recv($self["@stream"])._contents();
  41318. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41319. },
  41320. args: [],
  41321. source: "contents\x0a\x09^ stream contents",
  41322. referencedClasses: [],
  41323. messageSends: ["contents"]
  41324. }),
  41325. $globals.JSStream);
  41326. $core.addMethod(
  41327. $core.method({
  41328. selector: "initialize",
  41329. protocol: "initialization",
  41330. fn: function (){
  41331. var self=this,$self=this;
  41332. return $core.withContext(function($ctx1) {
  41333. (
  41334. $ctx1.supercall = true,
  41335. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41336. $ctx1.supercall = false;
  41337. $self["@stream"]=""._writeStream();
  41338. return self;
  41339. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41340. },
  41341. args: [],
  41342. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41343. referencedClasses: [],
  41344. messageSends: ["initialize", "writeStream"]
  41345. }),
  41346. $globals.JSStream);
  41347. $core.addMethod(
  41348. $core.method({
  41349. selector: "lf",
  41350. protocol: "streaming",
  41351. fn: function (){
  41352. var self=this,$self=this;
  41353. return $core.withContext(function($ctx1) {
  41354. $recv($self["@stream"])._lf();
  41355. return self;
  41356. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41357. },
  41358. args: [],
  41359. source: "lf\x0a\x09stream lf",
  41360. referencedClasses: [],
  41361. messageSends: ["lf"]
  41362. }),
  41363. $globals.JSStream);
  41364. $core.addMethod(
  41365. $core.method({
  41366. selector: "nextPut:",
  41367. protocol: "streaming",
  41368. fn: function (aString){
  41369. var self=this,$self=this;
  41370. return $core.withContext(function($ctx1) {
  41371. $recv($self["@stream"])._nextPut_(aString);
  41372. return self;
  41373. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41374. },
  41375. args: ["aString"],
  41376. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41377. referencedClasses: [],
  41378. messageSends: ["nextPut:"]
  41379. }),
  41380. $globals.JSStream);
  41381. $core.addMethod(
  41382. $core.method({
  41383. selector: "nextPutAll:",
  41384. protocol: "streaming",
  41385. fn: function (aString){
  41386. var self=this,$self=this;
  41387. return $core.withContext(function($ctx1) {
  41388. $recv($self["@stream"])._nextPutAll_(aString);
  41389. return self;
  41390. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41391. },
  41392. args: ["aString"],
  41393. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41394. referencedClasses: [],
  41395. messageSends: ["nextPutAll:"]
  41396. }),
  41397. $globals.JSStream);
  41398. $core.addMethod(
  41399. $core.method({
  41400. selector: "nextPutAssignLhs:rhs:",
  41401. protocol: "streaming",
  41402. fn: function (aBlock,anotherBlock){
  41403. var self=this,$self=this;
  41404. return $core.withContext(function($ctx1) {
  41405. $recv(aBlock)._value();
  41406. $ctx1.sendIdx["value"]=1;
  41407. $recv($self["@stream"])._nextPutAll_("=");
  41408. $recv(anotherBlock)._value();
  41409. return self;
  41410. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41411. },
  41412. args: ["aBlock", "anotherBlock"],
  41413. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41414. referencedClasses: [],
  41415. messageSends: ["value", "nextPutAll:"]
  41416. }),
  41417. $globals.JSStream);
  41418. $core.addMethod(
  41419. $core.method({
  41420. selector: "nextPutBlockContextFor:during:",
  41421. protocol: "streaming",
  41422. fn: function (anIRClosure,aBlock){
  41423. var self=this,$self=this;
  41424. return $core.withContext(function($ctx1) {
  41425. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41426. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41427. if(!$core.assert($1)){
  41428. $2=$recv(aBlock)._value();
  41429. $ctx1.sendIdx["value"]=1;
  41430. return $2;
  41431. }
  41432. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41433. $ctx1.sendIdx["nextPutAll:"]=1;
  41434. $self._lf();
  41435. $ctx1.sendIdx["lf"]=1;
  41436. $6=$recv(anIRClosure)._scope();
  41437. $ctx1.sendIdx["scope"]=1;
  41438. $5=$recv($6)._alias();
  41439. $ctx1.sendIdx["alias"]=1;
  41440. $4="return $core.withContext(function(".__comma($5);
  41441. $ctx1.sendIdx[","]=2;
  41442. $3=$recv($4).__comma(") {");
  41443. $ctx1.sendIdx[","]=1;
  41444. $self._nextPutAll_($3);
  41445. $ctx1.sendIdx["nextPutAll:"]=2;
  41446. $self._lf();
  41447. $ctx1.sendIdx["lf"]=2;
  41448. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41449. $ctx1.sendIdx["nextPutAll:"]=3;
  41450. $7=$self._lf();
  41451. $ctx1.sendIdx["lf"]=3;
  41452. $recv(aBlock)._value();
  41453. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41454. $ctx1.sendIdx["nextPutAll:"]=4;
  41455. $self._lf();
  41456. $ctx1.sendIdx["lf"]=4;
  41457. $11=$recv(anIRClosure)._scope();
  41458. $ctx1.sendIdx["scope"]=2;
  41459. $10=$recv($11)._alias();
  41460. $ctx1.sendIdx["alias"]=2;
  41461. $9="}, function(".__comma($10);
  41462. $ctx1.sendIdx[","]=4;
  41463. $8=$recv($9).__comma(") {");
  41464. $ctx1.sendIdx[","]=3;
  41465. $self._nextPutAll_($8);
  41466. $ctx1.sendIdx["nextPutAll:"]=5;
  41467. $15=$recv(anIRClosure)._scope();
  41468. $ctx1.sendIdx["scope"]=3;
  41469. $14=$recv($15)._alias();
  41470. $ctx1.sendIdx["alias"]=3;
  41471. $13=$recv($14).__comma(".fillBlock({");
  41472. $ctx1.sendIdx[","]=5;
  41473. $12=$self._nextPutAll_($13);
  41474. $ctx1.sendIdx["nextPutAll:"]=6;
  41475. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  41476. return $core.withContext(function($ctx2) {
  41477. $16=$recv(each)._asVariableName();
  41478. $ctx2.sendIdx["asVariableName"]=1;
  41479. $self._nextPutAll_($16);
  41480. $ctx2.sendIdx["nextPutAll:"]=7;
  41481. $self._nextPutAll_(":");
  41482. $ctx2.sendIdx["nextPutAll:"]=8;
  41483. $17=$self._nextPutAll_($recv(each)._asVariableName());
  41484. $ctx2.sendIdx["nextPutAll:"]=9;
  41485. return $17;
  41486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41487. }),(function(){
  41488. return $core.withContext(function($ctx2) {
  41489. return $self._nextPutAll_(",");
  41490. $ctx2.sendIdx["nextPutAll:"]=10;
  41491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41492. }));
  41493. $self._nextPutAll_("},");
  41494. $ctx1.sendIdx["nextPutAll:"]=11;
  41495. $23=$recv(anIRClosure)._scope();
  41496. $ctx1.sendIdx["scope"]=4;
  41497. $22=$recv($23)._outerScope();
  41498. $21=$recv($22)._alias();
  41499. $20=$recv($21).__comma(",");
  41500. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  41501. $ctx1.sendIdx[","]=7;
  41502. $18=$recv($19).__comma(")});");
  41503. $ctx1.sendIdx[","]=6;
  41504. $self._nextPutAll_($18);
  41505. $ctx1.sendIdx["nextPutAll:"]=12;
  41506. $self._lf();
  41507. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41508. return self;
  41509. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  41510. },
  41511. args: ["anIRClosure", "aBlock"],
  41512. 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);'",
  41513. referencedClasses: [],
  41514. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  41515. }),
  41516. $globals.JSStream);
  41517. $core.addMethod(
  41518. $core.method({
  41519. selector: "nextPutClosureWith:arguments:",
  41520. protocol: "streaming",
  41521. fn: function (aBlock,anArray){
  41522. var self=this,$self=this;
  41523. return $core.withContext(function($ctx1) {
  41524. var $1,$2,$3;
  41525. $recv($self["@stream"])._nextPutAll_("(function(");
  41526. $ctx1.sendIdx["nextPutAll:"]=1;
  41527. $recv(anArray)._do_separatedBy_((function(each){
  41528. return $core.withContext(function($ctx2) {
  41529. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41530. $ctx2.sendIdx["nextPutAll:"]=2;
  41531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41532. }),(function(){
  41533. return $core.withContext(function($ctx2) {
  41534. return $recv($self["@stream"])._nextPut_(",");
  41535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41536. }));
  41537. $1=$self["@stream"];
  41538. $recv($1)._nextPutAll_("){");
  41539. $ctx1.sendIdx["nextPutAll:"]=3;
  41540. $2=$recv($1)._lf();
  41541. $ctx1.sendIdx["lf"]=1;
  41542. $recv(aBlock)._value();
  41543. $3=$self["@stream"];
  41544. $recv($3)._lf();
  41545. $recv($3)._nextPutAll_("})");
  41546. return self;
  41547. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41548. },
  41549. args: ["aBlock", "anArray"],
  41550. 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: '})'",
  41551. referencedClasses: [],
  41552. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41553. }),
  41554. $globals.JSStream);
  41555. $core.addMethod(
  41556. $core.method({
  41557. selector: "nextPutContextFor:during:",
  41558. protocol: "streaming",
  41559. fn: function (aMethod,aBlock){
  41560. var self=this,$self=this;
  41561. return $core.withContext(function($ctx1) {
  41562. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  41563. $1=$recv(aMethod)._requiresSmalltalkContext();
  41564. if(!$core.assert($1)){
  41565. $2=$recv(aBlock)._value();
  41566. $ctx1.sendIdx["value"]=1;
  41567. return $2;
  41568. }
  41569. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41570. $ctx1.sendIdx["nextPutAll:"]=1;
  41571. $self._lf();
  41572. $ctx1.sendIdx["lf"]=1;
  41573. $6=$recv(aMethod)._scope();
  41574. $ctx1.sendIdx["scope"]=1;
  41575. $5=$recv($6)._alias();
  41576. $ctx1.sendIdx["alias"]=1;
  41577. $4="return $core.withContext(function(".__comma($5);
  41578. $ctx1.sendIdx[","]=2;
  41579. $3=$recv($4).__comma(") {");
  41580. $ctx1.sendIdx[","]=1;
  41581. $self._nextPutAll_($3);
  41582. $ctx1.sendIdx["nextPutAll:"]=2;
  41583. $self._lf();
  41584. $ctx1.sendIdx["lf"]=2;
  41585. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41586. $ctx1.sendIdx["nextPutAll:"]=3;
  41587. $7=$self._lf();
  41588. $ctx1.sendIdx["lf"]=3;
  41589. $recv(aBlock)._value();
  41590. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41591. $ctx1.sendIdx["nextPutAll:"]=4;
  41592. $self._lf();
  41593. $ctx1.sendIdx["lf"]=4;
  41594. $12=$recv(aMethod)._scope();
  41595. $ctx1.sendIdx["scope"]=2;
  41596. $11=$recv($12)._alias();
  41597. $ctx1.sendIdx["alias"]=2;
  41598. $10="}, function(".__comma($11);
  41599. $ctx1.sendIdx[","]=5;
  41600. $9=$recv($10).__comma(") {");
  41601. $ctx1.sendIdx[","]=4;
  41602. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  41603. $ctx1.sendIdx[","]=3;
  41604. $self._nextPutAll_($8);
  41605. $ctx1.sendIdx["nextPutAll:"]=5;
  41606. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41607. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41608. $15=".fill(self,".__comma($16);
  41609. $14=$recv($15).__comma(",{");
  41610. $ctx1.sendIdx[","]=6;
  41611. $13=$self._nextPutAll_($14);
  41612. $ctx1.sendIdx["nextPutAll:"]=6;
  41613. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  41614. return $core.withContext(function($ctx2) {
  41615. $17=$recv(each)._asVariableName();
  41616. $ctx2.sendIdx["asVariableName"]=1;
  41617. $self._nextPutAll_($17);
  41618. $ctx2.sendIdx["nextPutAll:"]=7;
  41619. $self._nextPutAll_(":");
  41620. $ctx2.sendIdx["nextPutAll:"]=8;
  41621. $18=$self._nextPutAll_($recv(each)._asVariableName());
  41622. $ctx2.sendIdx["nextPutAll:"]=9;
  41623. return $18;
  41624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41625. }),(function(){
  41626. return $core.withContext(function($ctx2) {
  41627. return $self._nextPutAll_(",");
  41628. $ctx2.sendIdx["nextPutAll:"]=10;
  41629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41630. }));
  41631. $self._nextPutAll_("},");
  41632. $ctx1.sendIdx["nextPutAll:"]=11;
  41633. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  41634. $ctx1.sendIdx["nextPutAll:"]=12;
  41635. $self._nextPutAll_(")});");
  41636. $ctx1.sendIdx["nextPutAll:"]=13;
  41637. $self._lf();
  41638. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41639. return self;
  41640. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41641. },
  41642. args: ["aMethod", "aBlock"],
  41643. 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);'",
  41644. referencedClasses: [],
  41645. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  41646. }),
  41647. $globals.JSStream);
  41648. $core.addMethod(
  41649. $core.method({
  41650. selector: "nextPutFunctionWith:arguments:",
  41651. protocol: "streaming",
  41652. fn: function (aBlock,anArray){
  41653. var self=this,$self=this;
  41654. return $core.withContext(function($ctx1) {
  41655. var $1,$2,$3,$4,$5;
  41656. $recv($self["@stream"])._nextPutAll_("fn: function(");
  41657. $ctx1.sendIdx["nextPutAll:"]=1;
  41658. $recv(anArray)._do_separatedBy_((function(each){
  41659. return $core.withContext(function($ctx2) {
  41660. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41661. $ctx2.sendIdx["nextPutAll:"]=2;
  41662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41663. }),(function(){
  41664. return $core.withContext(function($ctx2) {
  41665. return $recv($self["@stream"])._nextPut_(",");
  41666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41667. }));
  41668. $1=$self["@stream"];
  41669. $recv($1)._nextPutAll_("){");
  41670. $ctx1.sendIdx["nextPutAll:"]=3;
  41671. $2=$recv($1)._lf();
  41672. $ctx1.sendIdx["lf"]=1;
  41673. $3=$self["@stream"];
  41674. $recv($3)._nextPutAll_("var self=this,$self=this;");
  41675. $ctx1.sendIdx["nextPutAll:"]=4;
  41676. $4=$recv($3)._lf();
  41677. $ctx1.sendIdx["lf"]=2;
  41678. $recv(aBlock)._value();
  41679. $5=$self["@stream"];
  41680. $recv($5)._lf();
  41681. $recv($5)._nextPutAll_("}");
  41682. return self;
  41683. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41684. },
  41685. args: ["aBlock", "anArray"],
  41686. 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: '}'",
  41687. referencedClasses: [],
  41688. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41689. }),
  41690. $globals.JSStream);
  41691. $core.addMethod(
  41692. $core.method({
  41693. selector: "nextPutIf:then:",
  41694. protocol: "streaming",
  41695. fn: function (aBlock,anotherBlock){
  41696. var self=this,$self=this;
  41697. return $core.withContext(function($ctx1) {
  41698. var $1;
  41699. $recv($self["@stream"])._nextPutAll_("if(");
  41700. $ctx1.sendIdx["nextPutAll:"]=1;
  41701. $recv(aBlock)._value();
  41702. $ctx1.sendIdx["value"]=1;
  41703. $1=$self["@stream"];
  41704. $recv($1)._nextPutAll_("){");
  41705. $ctx1.sendIdx["nextPutAll:"]=2;
  41706. $recv($1)._lf();
  41707. $recv(anotherBlock)._value();
  41708. $recv($self["@stream"])._nextPutAll_("}");
  41709. $self._omitSemicolon_(true);
  41710. return self;
  41711. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41712. },
  41713. args: ["aBlock", "anotherBlock"],
  41714. 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",
  41715. referencedClasses: [],
  41716. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41717. }),
  41718. $globals.JSStream);
  41719. $core.addMethod(
  41720. $core.method({
  41721. selector: "nextPutIf:then:else:",
  41722. protocol: "streaming",
  41723. fn: function (aBlock,ifBlock,elseBlock){
  41724. var self=this,$self=this;
  41725. return $core.withContext(function($ctx1) {
  41726. var $1,$2,$3;
  41727. $recv($self["@stream"])._nextPutAll_("if(");
  41728. $ctx1.sendIdx["nextPutAll:"]=1;
  41729. $recv(aBlock)._value();
  41730. $ctx1.sendIdx["value"]=1;
  41731. $1=$self["@stream"];
  41732. $recv($1)._nextPutAll_("){");
  41733. $ctx1.sendIdx["nextPutAll:"]=2;
  41734. $2=$recv($1)._lf();
  41735. $ctx1.sendIdx["lf"]=1;
  41736. $recv(ifBlock)._value();
  41737. $ctx1.sendIdx["value"]=2;
  41738. $3=$self["@stream"];
  41739. $recv($3)._nextPutAll_("} else {");
  41740. $ctx1.sendIdx["nextPutAll:"]=3;
  41741. $recv($3)._lf();
  41742. $recv(elseBlock)._value();
  41743. $recv($self["@stream"])._nextPutAll_("}");
  41744. $self._omitSemicolon_(true);
  41745. return self;
  41746. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  41747. },
  41748. args: ["aBlock", "ifBlock", "elseBlock"],
  41749. 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",
  41750. referencedClasses: [],
  41751. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41752. }),
  41753. $globals.JSStream);
  41754. $core.addMethod(
  41755. $core.method({
  41756. selector: "nextPutMethodDeclaration:with:",
  41757. protocol: "streaming",
  41758. fn: function (aMethod,aBlock){
  41759. var self=this,$self=this;
  41760. return $core.withContext(function($ctx1) {
  41761. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  41762. $1=$self["@stream"];
  41763. $recv($1)._nextPutAll_("$core.method({");
  41764. $ctx1.sendIdx["nextPutAll:"]=1;
  41765. $recv($1)._lf();
  41766. $ctx1.sendIdx["lf"]=1;
  41767. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41768. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41769. $3="selector: ".__comma($4);
  41770. $ctx1.sendIdx[","]=2;
  41771. $2=$recv($3).__comma(",");
  41772. $ctx1.sendIdx[","]=1;
  41773. $recv($1)._nextPutAll_($2);
  41774. $ctx1.sendIdx["nextPutAll:"]=2;
  41775. $recv($1)._lf();
  41776. $ctx1.sendIdx["lf"]=2;
  41777. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  41778. $ctx1.sendIdx["asJavaScriptSource"]=2;
  41779. $6="source: ".__comma($7);
  41780. $ctx1.sendIdx[","]=4;
  41781. $5=$recv($6).__comma(",");
  41782. $ctx1.sendIdx[","]=3;
  41783. $recv($1)._nextPutAll_($5);
  41784. $ctx1.sendIdx["nextPutAll:"]=3;
  41785. $8=$recv($1)._lf();
  41786. $ctx1.sendIdx["lf"]=3;
  41787. $recv(aBlock)._value();
  41788. $ctx1.sendIdx["value"]=1;
  41789. $9=$self["@stream"];
  41790. $12=$recv($globals.String)._lf();
  41791. $ctx1.sendIdx["lf"]=4;
  41792. $11=",".__comma($12);
  41793. $ctx1.sendIdx[","]=6;
  41794. $10=$recv($11).__comma("messageSends: ");
  41795. $ctx1.sendIdx[","]=5;
  41796. $recv($9)._nextPutAll_($10);
  41797. $ctx1.sendIdx["nextPutAll:"]=4;
  41798. $15=$recv($recv(aMethod)._messageSends())._asArray();
  41799. $ctx1.sendIdx["asArray"]=1;
  41800. $14=$recv($15)._asJavaScriptSource();
  41801. $ctx1.sendIdx["asJavaScriptSource"]=3;
  41802. $13=$recv($14).__comma(",");
  41803. $ctx1.sendIdx[","]=7;
  41804. $recv($9)._nextPutAll_($13);
  41805. $ctx1.sendIdx["nextPutAll:"]=5;
  41806. $recv($9)._lf();
  41807. $ctx1.sendIdx["lf"]=5;
  41808. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  41809. return $core.withContext(function($ctx2) {
  41810. return $recv(each)._value();
  41811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41812. })))._asArray())._asJavaScriptSource();
  41813. $ctx1.sendIdx["asJavaScriptSource"]=4;
  41814. $17="args: ".__comma($18);
  41815. $16=$recv($17).__comma(",");
  41816. $ctx1.sendIdx[","]=8;
  41817. $recv($9)._nextPutAll_($16);
  41818. $ctx1.sendIdx["nextPutAll:"]=6;
  41819. $recv($9)._lf();
  41820. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  41821. $ctx1.sendIdx["nextPutAll:"]=7;
  41822. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  41823. return $core.withContext(function($ctx2) {
  41824. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  41825. $ctx2.sendIdx["nextPutAll:"]=8;
  41826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41827. }),(function(){
  41828. return $core.withContext(function($ctx2) {
  41829. return $recv($self["@stream"])._nextPutAll_(",");
  41830. $ctx2.sendIdx["nextPutAll:"]=9;
  41831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41832. }));
  41833. $20=$self["@stream"];
  41834. $recv($20)._nextPutAll_("]");
  41835. $ctx1.sendIdx["nextPutAll:"]=10;
  41836. $recv($20)._nextPutAll_("})");
  41837. return self;
  41838. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41839. },
  41840. args: ["aMethod", "aBlock"],
  41841. 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: '})'",
  41842. referencedClasses: ["String"],
  41843. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  41844. }),
  41845. $globals.JSStream);
  41846. $core.addMethod(
  41847. $core.method({
  41848. selector: "nextPutNonLocalReturnHandlingWith:",
  41849. protocol: "streaming",
  41850. fn: function (aBlock){
  41851. var self=this,$self=this;
  41852. return $core.withContext(function($ctx1) {
  41853. var $1,$2,$3;
  41854. $1=$self["@stream"];
  41855. $recv($1)._nextPutAll_("var $early={};");
  41856. $ctx1.sendIdx["nextPutAll:"]=1;
  41857. $recv($1)._lf();
  41858. $ctx1.sendIdx["lf"]=1;
  41859. $recv($1)._nextPutAll_("try {");
  41860. $ctx1.sendIdx["nextPutAll:"]=2;
  41861. $2=$recv($1)._lf();
  41862. $ctx1.sendIdx["lf"]=2;
  41863. $recv(aBlock)._value();
  41864. $3=$self["@stream"];
  41865. $recv($3)._nextPutAll_("}");
  41866. $ctx1.sendIdx["nextPutAll:"]=3;
  41867. $recv($3)._lf();
  41868. $ctx1.sendIdx["lf"]=3;
  41869. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  41870. $recv($3)._lf();
  41871. return self;
  41872. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  41873. },
  41874. args: ["aBlock"],
  41875. 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",
  41876. referencedClasses: [],
  41877. messageSends: ["nextPutAll:", "lf", "value"]
  41878. }),
  41879. $globals.JSStream);
  41880. $core.addMethod(
  41881. $core.method({
  41882. selector: "nextPutNonLocalReturnWith:",
  41883. protocol: "streaming",
  41884. fn: function (aBlock){
  41885. var self=this,$self=this;
  41886. return $core.withContext(function($ctx1) {
  41887. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  41888. $ctx1.sendIdx["nextPutAll:"]=1;
  41889. $recv(aBlock)._value();
  41890. $recv($self["@stream"])._nextPutAll_("]");
  41891. return self;
  41892. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  41893. },
  41894. args: ["aBlock"],
  41895. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  41896. referencedClasses: [],
  41897. messageSends: ["nextPutAll:", "value"]
  41898. }),
  41899. $globals.JSStream);
  41900. $core.addMethod(
  41901. $core.method({
  41902. selector: "nextPutReturnWith:",
  41903. protocol: "streaming",
  41904. fn: function (aBlock){
  41905. var self=this,$self=this;
  41906. return $core.withContext(function($ctx1) {
  41907. $recv($self["@stream"])._nextPutAll_("return ");
  41908. $recv(aBlock)._value();
  41909. return self;
  41910. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  41911. },
  41912. args: ["aBlock"],
  41913. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  41914. referencedClasses: [],
  41915. messageSends: ["nextPutAll:", "value"]
  41916. }),
  41917. $globals.JSStream);
  41918. $core.addMethod(
  41919. $core.method({
  41920. selector: "nextPutSendIndexFor:",
  41921. protocol: "streaming",
  41922. fn: function (anIRSend){
  41923. var self=this,$self=this;
  41924. return $core.withContext(function($ctx1) {
  41925. $self._nextPutAll_(";");
  41926. $ctx1.sendIdx["nextPutAll:"]=1;
  41927. $self._lf();
  41928. $ctx1.sendIdx["lf"]=1;
  41929. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41930. $ctx1.sendIdx["nextPutAll:"]=2;
  41931. $self._lf();
  41932. $ctx1.sendIdx["lf"]=2;
  41933. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  41934. $ctx1.sendIdx["nextPutAll:"]=3;
  41935. $self._nextPutAll_(".sendIdx[");
  41936. $ctx1.sendIdx["nextPutAll:"]=4;
  41937. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  41938. $ctx1.sendIdx["nextPutAll:"]=5;
  41939. $self._nextPutAll_("]=");
  41940. $ctx1.sendIdx["nextPutAll:"]=6;
  41941. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  41942. $ctx1.sendIdx["nextPutAll:"]=7;
  41943. $self._nextPutAll_(";");
  41944. $ctx1.sendIdx["nextPutAll:"]=8;
  41945. $self._lf();
  41946. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  41947. return self;
  41948. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  41949. },
  41950. args: ["anIRSend"],
  41951. 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)'",
  41952. referencedClasses: [],
  41953. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  41954. }),
  41955. $globals.JSStream);
  41956. $core.addMethod(
  41957. $core.method({
  41958. selector: "nextPutStatementWith:",
  41959. protocol: "streaming",
  41960. fn: function (aBlock){
  41961. var self=this,$self=this;
  41962. return $core.withContext(function($ctx1) {
  41963. var $1;
  41964. $self._omitSemicolon_(false);
  41965. $ctx1.sendIdx["omitSemicolon:"]=1;
  41966. $recv(aBlock)._value();
  41967. $1=$self._omitSemicolon();
  41968. if(!$core.assert($1)){
  41969. $recv($self["@stream"])._nextPutAll_(";");
  41970. }
  41971. $self._omitSemicolon_(false);
  41972. $recv($self["@stream"])._lf();
  41973. return self;
  41974. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  41975. },
  41976. args: ["aBlock"],
  41977. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  41978. referencedClasses: [],
  41979. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  41980. }),
  41981. $globals.JSStream);
  41982. $core.addMethod(
  41983. $core.method({
  41984. selector: "nextPutVars:",
  41985. protocol: "streaming",
  41986. fn: function (aCollection){
  41987. var self=this,$self=this;
  41988. return $core.withContext(function($ctx1) {
  41989. var $1;
  41990. $recv(aCollection)._ifNotEmpty_((function(){
  41991. return $core.withContext(function($ctx2) {
  41992. $recv($self["@stream"])._nextPutAll_("var ");
  41993. $ctx2.sendIdx["nextPutAll:"]=1;
  41994. $recv(aCollection)._do_separatedBy_((function(each){
  41995. return $core.withContext(function($ctx3) {
  41996. return $recv($self["@stream"])._nextPutAll_(each);
  41997. $ctx3.sendIdx["nextPutAll:"]=2;
  41998. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41999. }),(function(){
  42000. return $core.withContext(function($ctx3) {
  42001. return $recv($self["@stream"])._nextPutAll_(",");
  42002. $ctx3.sendIdx["nextPutAll:"]=3;
  42003. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42004. }));
  42005. $1=$self["@stream"];
  42006. $recv($1)._nextPutAll_(";");
  42007. return $recv($1)._lf();
  42008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42009. }));
  42010. return self;
  42011. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42012. },
  42013. args: ["aCollection"],
  42014. 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 ]",
  42015. referencedClasses: [],
  42016. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42017. }),
  42018. $globals.JSStream);
  42019. $core.addMethod(
  42020. $core.method({
  42021. selector: "omitSemicolon",
  42022. protocol: "accessing",
  42023. fn: function (){
  42024. var self=this,$self=this;
  42025. return $self["@omitSemicolon"];
  42026. },
  42027. args: [],
  42028. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42029. referencedClasses: [],
  42030. messageSends: []
  42031. }),
  42032. $globals.JSStream);
  42033. $core.addMethod(
  42034. $core.method({
  42035. selector: "omitSemicolon:",
  42036. protocol: "accessing",
  42037. fn: function (aBoolean){
  42038. var self=this,$self=this;
  42039. $self["@omitSemicolon"]=aBoolean;
  42040. return self;
  42041. },
  42042. args: ["aBoolean"],
  42043. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42044. referencedClasses: [],
  42045. messageSends: []
  42046. }),
  42047. $globals.JSStream);
  42048. $core.addMethod(
  42049. $core.method({
  42050. selector: "isReferenced",
  42051. protocol: "*Compiler-IR",
  42052. fn: function (){
  42053. var self=this,$self=this;
  42054. return $core.withContext(function($ctx1) {
  42055. var $3,$2,$1;
  42056. $3=$self._parent();
  42057. $ctx1.sendIdx["parent"]=1;
  42058. $2=$recv($3)._isSequenceNode();
  42059. $1=$recv($2)._or_((function(){
  42060. return $core.withContext(function($ctx2) {
  42061. return $recv($self._parent())._isAssignmentNode();
  42062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42063. }));
  42064. return $recv($1)._not();
  42065. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42066. },
  42067. args: [],
  42068. 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",
  42069. referencedClasses: [],
  42070. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42071. }),
  42072. $globals.ASTNode);
  42073. $core.addMethod(
  42074. $core.method({
  42075. selector: "subtreeNeedsAliasing",
  42076. protocol: "*Compiler-IR",
  42077. fn: function (){
  42078. var self=this,$self=this;
  42079. return $core.withContext(function($ctx1) {
  42080. return $recv($self._shouldBeAliased())._or_((function(){
  42081. return $core.withContext(function($ctx2) {
  42082. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42083. return $core.withContext(function($ctx3) {
  42084. return $recv(each)._subtreeNeedsAliasing();
  42085. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42086. }));
  42087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42088. }));
  42089. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42090. },
  42091. args: [],
  42092. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42093. referencedClasses: [],
  42094. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42095. }),
  42096. $globals.ASTNode);
  42097. $core.addMethod(
  42098. $core.method({
  42099. selector: "shouldBeAliased",
  42100. protocol: "*Compiler-IR",
  42101. fn: function (){
  42102. var self=this,$self=this;
  42103. return $core.withContext(function($ctx1) {
  42104. var $1;
  42105. $1=(
  42106. $ctx1.supercall = true,
  42107. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42108. $ctx1.supercall = false;
  42109. return $recv($1)._or_((function(){
  42110. return $core.withContext(function($ctx2) {
  42111. return $self._isReferenced();
  42112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42113. }));
  42114. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42115. },
  42116. args: [],
  42117. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42118. referencedClasses: [],
  42119. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42120. }),
  42121. $globals.AssignmentNode);
  42122. $core.addMethod(
  42123. $core.method({
  42124. selector: "appendToInstruction:",
  42125. protocol: "*Compiler-IR",
  42126. fn: function (anIRInstruction){
  42127. var self=this,$self=this;
  42128. return $core.withContext(function($ctx1) {
  42129. $recv(anIRInstruction)._appendBlock_(self);
  42130. return self;
  42131. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42132. },
  42133. args: ["anIRInstruction"],
  42134. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42135. referencedClasses: [],
  42136. messageSends: ["appendBlock:"]
  42137. }),
  42138. $globals.BlockClosure);
  42139. $core.addMethod(
  42140. $core.method({
  42141. selector: "subtreeNeedsAliasing",
  42142. protocol: "*Compiler-IR",
  42143. fn: function (){
  42144. var self=this,$self=this;
  42145. return $core.withContext(function($ctx1) {
  42146. return $self._shouldBeAliased();
  42147. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42148. },
  42149. args: [],
  42150. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42151. referencedClasses: [],
  42152. messageSends: ["shouldBeAliased"]
  42153. }),
  42154. $globals.BlockNode);
  42155. $core.addMethod(
  42156. $core.method({
  42157. selector: "subtreeNeedsAliasing",
  42158. protocol: "*Compiler-IR",
  42159. fn: function (){
  42160. var self=this,$self=this;
  42161. return $core.withContext(function($ctx1) {
  42162. return $recv($recv($self._parent())._isSequenceNode())._not();
  42163. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42164. },
  42165. args: [],
  42166. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42167. referencedClasses: [],
  42168. messageSends: ["not", "isSequenceNode", "parent"]
  42169. }),
  42170. $globals.CascadeNode);
  42171. $core.addMethod(
  42172. $core.method({
  42173. selector: "shouldBeAliased",
  42174. protocol: "*Compiler-IR",
  42175. fn: function (){
  42176. var self=this,$self=this;
  42177. var sends;
  42178. return $core.withContext(function($ctx1) {
  42179. var $2,$1;
  42180. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42181. $2=(
  42182. $ctx1.supercall = true,
  42183. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42184. $ctx1.supercall = false;
  42185. $1=$recv($2)._or_((function(){
  42186. return $core.withContext(function($ctx2) {
  42187. return $recv($self._isReferenced())._and_((function(){
  42188. return $core.withContext(function($ctx3) {
  42189. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42190. return $core.withContext(function($ctx4) {
  42191. return $self._superSend();
  42192. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42193. }));
  42194. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42195. }));
  42196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42197. }));
  42198. $ctx1.sendIdx["or:"]=1;
  42199. return $1;
  42200. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42201. },
  42202. args: [],
  42203. 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 ] ] ])",
  42204. referencedClasses: [],
  42205. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42206. }),
  42207. $globals.SendNode);
  42208. $core.addMethod(
  42209. $core.method({
  42210. selector: "subtreeNeedsAliasing",
  42211. protocol: "*Compiler-IR",
  42212. fn: function (){
  42213. var self=this,$self=this;
  42214. return $core.withContext(function($ctx1) {
  42215. return $recv($self._shouldBeInlined())._or_((function(){
  42216. return $core.withContext(function($ctx2) {
  42217. return (
  42218. $ctx2.supercall = true,
  42219. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42220. $ctx2.supercall = false;
  42221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42222. }));
  42223. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42224. },
  42225. args: [],
  42226. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42227. referencedClasses: [],
  42228. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42229. }),
  42230. $globals.SendNode);
  42231. });
  42232. 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";
  42233. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42234. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42235. $core.addPackage("Compiler-Inlining");
  42236. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42237. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42238. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42239. $core.addMethod(
  42240. $core.method({
  42241. selector: "visitSendNode:",
  42242. protocol: "visiting",
  42243. fn: function (aNode){
  42244. var self=this,$self=this;
  42245. return $core.withContext(function($ctx1) {
  42246. var $1,$2,$3,$4,$receiver;
  42247. $1=$recv(aNode)._superSend();
  42248. if(!$core.assert($1)){
  42249. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42250. if($core.assert($2)){
  42251. $recv(aNode)._shouldBeInlined_(true);
  42252. $3=$recv(aNode)._receiver();
  42253. if(($receiver = $3) == null || $receiver.a$nil){
  42254. $3;
  42255. } else {
  42256. var receiver;
  42257. receiver=$receiver;
  42258. $recv(receiver)._shouldBeAliased_(true);
  42259. }
  42260. }
  42261. }
  42262. $4=(
  42263. $ctx1.supercall = true,
  42264. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42265. $ctx1.supercall = false;
  42266. return $4;
  42267. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42268. },
  42269. args: ["aNode"],
  42270. 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",
  42271. referencedClasses: ["IRSendInliner"],
  42272. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42273. }),
  42274. $globals.ASTPreInliner);
  42275. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42276. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42277. $core.addMethod(
  42278. $core.method({
  42279. selector: "acceptDagVisitor:",
  42280. protocol: "visiting",
  42281. fn: function (aVisitor){
  42282. var self=this,$self=this;
  42283. return $core.withContext(function($ctx1) {
  42284. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42285. return self;
  42286. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42287. },
  42288. args: ["aVisitor"],
  42289. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42290. referencedClasses: [],
  42291. messageSends: ["visitIRInlinedClosure:"]
  42292. }),
  42293. $globals.IRInlinedClosure);
  42294. $core.addMethod(
  42295. $core.method({
  42296. selector: "isInlined",
  42297. protocol: "testing",
  42298. fn: function (){
  42299. var self=this,$self=this;
  42300. return true;
  42301. },
  42302. args: [],
  42303. source: "isInlined\x0a\x09^ true",
  42304. referencedClasses: [],
  42305. messageSends: []
  42306. }),
  42307. $globals.IRInlinedClosure);
  42308. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42309. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42310. $core.addMethod(
  42311. $core.method({
  42312. selector: "acceptDagVisitor:",
  42313. protocol: "visiting",
  42314. fn: function (aVisitor){
  42315. var self=this,$self=this;
  42316. return $core.withContext(function($ctx1) {
  42317. $recv(aVisitor)._visitInlinedSend_(self);
  42318. return self;
  42319. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42320. },
  42321. args: ["aVisitor"],
  42322. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42323. referencedClasses: [],
  42324. messageSends: ["visitInlinedSend:"]
  42325. }),
  42326. $globals.IRInlinedSend);
  42327. $core.addMethod(
  42328. $core.method({
  42329. selector: "internalVariables",
  42330. protocol: "accessing",
  42331. fn: function (){
  42332. var self=this,$self=this;
  42333. return [];
  42334. },
  42335. args: [],
  42336. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42337. referencedClasses: [],
  42338. messageSends: []
  42339. }),
  42340. $globals.IRInlinedSend);
  42341. $core.addMethod(
  42342. $core.method({
  42343. selector: "isInlined",
  42344. protocol: "testing",
  42345. fn: function (){
  42346. var self=this,$self=this;
  42347. return true;
  42348. },
  42349. args: [],
  42350. source: "isInlined\x0a\x09^ true",
  42351. referencedClasses: [],
  42352. messageSends: []
  42353. }),
  42354. $globals.IRInlinedSend);
  42355. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42356. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42357. $core.addMethod(
  42358. $core.method({
  42359. selector: "acceptDagVisitor:",
  42360. protocol: "visiting",
  42361. fn: function (aVisitor){
  42362. var self=this,$self=this;
  42363. return $core.withContext(function($ctx1) {
  42364. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42365. return self;
  42366. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42367. },
  42368. args: ["aVisitor"],
  42369. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42370. referencedClasses: [],
  42371. messageSends: ["visitIRInlinedIfFalse:"]
  42372. }),
  42373. $globals.IRInlinedIfFalse);
  42374. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42375. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42376. $core.addMethod(
  42377. $core.method({
  42378. selector: "acceptDagVisitor:",
  42379. protocol: "visiting",
  42380. fn: function (aVisitor){
  42381. var self=this,$self=this;
  42382. return $core.withContext(function($ctx1) {
  42383. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42384. return self;
  42385. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42386. },
  42387. args: ["aVisitor"],
  42388. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42389. referencedClasses: [],
  42390. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42391. }),
  42392. $globals.IRInlinedIfNilIfNotNil);
  42393. $core.addMethod(
  42394. $core.method({
  42395. selector: "internalVariables",
  42396. protocol: "accessing",
  42397. fn: function (){
  42398. var self=this,$self=this;
  42399. return $core.withContext(function($ctx1) {
  42400. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42401. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42402. },
  42403. args: [],
  42404. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42405. referencedClasses: ["Array"],
  42406. messageSends: ["with:", "receiverInternalVariable"]
  42407. }),
  42408. $globals.IRInlinedIfNilIfNotNil);
  42409. $core.addMethod(
  42410. $core.method({
  42411. selector: "receiverInternalVariable",
  42412. protocol: "accessing",
  42413. fn: function (){
  42414. var self=this,$self=this;
  42415. return $core.withContext(function($ctx1) {
  42416. var $1;
  42417. $1=$recv($globals.IRVariable)._new();
  42418. $ctx1.sendIdx["new"]=1;
  42419. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42420. return $recv($1)._yourself();
  42421. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42422. },
  42423. args: [],
  42424. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42425. referencedClasses: ["IRVariable", "AliasVar"],
  42426. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42427. }),
  42428. $globals.IRInlinedIfNilIfNotNil);
  42429. $core.addMethod(
  42430. $core.method({
  42431. selector: "receiverInternalVariableName",
  42432. protocol: "accessing",
  42433. fn: function (){
  42434. var self=this,$self=this;
  42435. return "$receiver";
  42436. },
  42437. args: [],
  42438. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42439. referencedClasses: [],
  42440. messageSends: []
  42441. }),
  42442. $globals.IRInlinedIfNilIfNotNil);
  42443. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42444. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42445. $core.addMethod(
  42446. $core.method({
  42447. selector: "acceptDagVisitor:",
  42448. protocol: "visiting",
  42449. fn: function (aVisitor){
  42450. var self=this,$self=this;
  42451. return $core.withContext(function($ctx1) {
  42452. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42453. return self;
  42454. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42455. },
  42456. args: ["aVisitor"],
  42457. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42458. referencedClasses: [],
  42459. messageSends: ["visitIRInlinedIfTrue:"]
  42460. }),
  42461. $globals.IRInlinedIfTrue);
  42462. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42463. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42464. $core.addMethod(
  42465. $core.method({
  42466. selector: "acceptDagVisitor:",
  42467. protocol: "visiting",
  42468. fn: function (aVisitor){
  42469. var self=this,$self=this;
  42470. return $core.withContext(function($ctx1) {
  42471. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42472. return self;
  42473. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42474. },
  42475. args: ["aVisitor"],
  42476. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  42477. referencedClasses: [],
  42478. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  42479. }),
  42480. $globals.IRInlinedIfTrueIfFalse);
  42481. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  42482. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  42483. $core.addMethod(
  42484. $core.method({
  42485. selector: "acceptDagVisitor:",
  42486. protocol: "visiting",
  42487. fn: function (aVisitor){
  42488. var self=this,$self=this;
  42489. return $core.withContext(function($ctx1) {
  42490. $recv(aVisitor)._visitIRInlinedSequence_(self);
  42491. return self;
  42492. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  42493. },
  42494. args: ["aVisitor"],
  42495. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  42496. referencedClasses: [],
  42497. messageSends: ["visitIRInlinedSequence:"]
  42498. }),
  42499. $globals.IRInlinedSequence);
  42500. $core.addMethod(
  42501. $core.method({
  42502. selector: "isInlined",
  42503. protocol: "testing",
  42504. fn: function (){
  42505. var self=this,$self=this;
  42506. return true;
  42507. },
  42508. args: [],
  42509. source: "isInlined\x0a\x09^ true",
  42510. referencedClasses: [],
  42511. messageSends: []
  42512. }),
  42513. $globals.IRInlinedSequence);
  42514. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  42515. $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`";
  42516. $core.addMethod(
  42517. $core.method({
  42518. selector: "assignmentInliner",
  42519. protocol: "factory",
  42520. fn: function (){
  42521. var self=this,$self=this;
  42522. return $core.withContext(function($ctx1) {
  42523. var $1;
  42524. $1=$recv($globals.IRAssignmentInliner)._new();
  42525. $recv($1)._translator_(self);
  42526. return $recv($1)._yourself();
  42527. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  42528. },
  42529. args: [],
  42530. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42531. referencedClasses: ["IRAssignmentInliner"],
  42532. messageSends: ["translator:", "new", "yourself"]
  42533. }),
  42534. $globals.IRInliner);
  42535. $core.addMethod(
  42536. $core.method({
  42537. selector: "returnInliner",
  42538. protocol: "factory",
  42539. fn: function (){
  42540. var self=this,$self=this;
  42541. return $core.withContext(function($ctx1) {
  42542. var $1;
  42543. $1=$recv($globals.IRReturnInliner)._new();
  42544. $recv($1)._translator_(self);
  42545. return $recv($1)._yourself();
  42546. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  42547. },
  42548. args: [],
  42549. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42550. referencedClasses: ["IRReturnInliner"],
  42551. messageSends: ["translator:", "new", "yourself"]
  42552. }),
  42553. $globals.IRInliner);
  42554. $core.addMethod(
  42555. $core.method({
  42556. selector: "sendInliner",
  42557. protocol: "factory",
  42558. fn: function (){
  42559. var self=this,$self=this;
  42560. return $core.withContext(function($ctx1) {
  42561. var $1;
  42562. $1=$recv($globals.IRSendInliner)._new();
  42563. $recv($1)._translator_(self);
  42564. return $recv($1)._yourself();
  42565. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  42566. },
  42567. args: [],
  42568. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42569. referencedClasses: ["IRSendInliner"],
  42570. messageSends: ["translator:", "new", "yourself"]
  42571. }),
  42572. $globals.IRInliner);
  42573. $core.addMethod(
  42574. $core.method({
  42575. selector: "shouldInlineAssignment:",
  42576. protocol: "testing",
  42577. fn: function (anIRAssignment){
  42578. var self=this,$self=this;
  42579. return $core.withContext(function($ctx1) {
  42580. var $3,$2,$1;
  42581. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  42582. return $core.withContext(function($ctx2) {
  42583. $3=$recv(anIRAssignment)._right();
  42584. $ctx2.sendIdx["right"]=1;
  42585. $2=$recv($3)._isSend();
  42586. return $recv($2)._and_((function(){
  42587. return $core.withContext(function($ctx3) {
  42588. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  42589. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42590. }));
  42591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42592. }));
  42593. $ctx1.sendIdx["and:"]=1;
  42594. return $1;
  42595. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42596. },
  42597. args: ["anIRAssignment"],
  42598. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  42599. referencedClasses: [],
  42600. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  42601. }),
  42602. $globals.IRInliner);
  42603. $core.addMethod(
  42604. $core.method({
  42605. selector: "shouldInlineReturn:",
  42606. protocol: "testing",
  42607. fn: function (anIRReturn){
  42608. var self=this,$self=this;
  42609. return $core.withContext(function($ctx1) {
  42610. var $3,$2,$1;
  42611. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  42612. return $core.withContext(function($ctx2) {
  42613. $3=$recv(anIRReturn)._expression();
  42614. $ctx2.sendIdx["expression"]=1;
  42615. $2=$recv($3)._isSend();
  42616. return $recv($2)._and_((function(){
  42617. return $core.withContext(function($ctx3) {
  42618. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  42619. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42620. }));
  42621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42622. }));
  42623. $ctx1.sendIdx["and:"]=1;
  42624. return $1;
  42625. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42626. },
  42627. args: ["anIRReturn"],
  42628. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  42629. referencedClasses: [],
  42630. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  42631. }),
  42632. $globals.IRInliner);
  42633. $core.addMethod(
  42634. $core.method({
  42635. selector: "shouldInlineSend:",
  42636. protocol: "testing",
  42637. fn: function (anIRSend){
  42638. var self=this,$self=this;
  42639. return $core.withContext(function($ctx1) {
  42640. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  42641. return $core.withContext(function($ctx2) {
  42642. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  42643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42644. }));
  42645. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42646. },
  42647. args: ["anIRSend"],
  42648. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  42649. referencedClasses: ["IRSendInliner"],
  42650. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  42651. }),
  42652. $globals.IRInliner);
  42653. $core.addMethod(
  42654. $core.method({
  42655. selector: "visitIRAssignment:",
  42656. protocol: "visiting",
  42657. fn: function (anIRAssignment){
  42658. var self=this,$self=this;
  42659. return $core.withContext(function($ctx1) {
  42660. var $1;
  42661. $1=$self._shouldInlineAssignment_(anIRAssignment);
  42662. if($core.assert($1)){
  42663. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  42664. } else {
  42665. return (
  42666. $ctx1.supercall = true,
  42667. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  42668. $ctx1.supercall = false;
  42669. }
  42670. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42671. },
  42672. args: ["anIRAssignment"],
  42673. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  42674. referencedClasses: [],
  42675. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  42676. }),
  42677. $globals.IRInliner);
  42678. $core.addMethod(
  42679. $core.method({
  42680. selector: "visitIRNonLocalReturn:",
  42681. protocol: "visiting",
  42682. fn: function (anIRNonLocalReturn){
  42683. var self=this,$self=this;
  42684. var localReturn;
  42685. return $core.withContext(function($ctx1) {
  42686. var $2,$1,$4,$3,$5,$6,$7;
  42687. $2=$recv(anIRNonLocalReturn)._scope();
  42688. $ctx1.sendIdx["scope"]=1;
  42689. $1=$recv($2)._canInlineNonLocalReturns();
  42690. if($core.assert($1)){
  42691. $4=$recv(anIRNonLocalReturn)._scope();
  42692. $ctx1.sendIdx["scope"]=2;
  42693. $3=$recv($4)._methodScope();
  42694. $5=$recv(anIRNonLocalReturn)._scope();
  42695. $ctx1.sendIdx["scope"]=3;
  42696. $recv($3)._removeNonLocalReturn_($5);
  42697. $6=$recv($globals.IRReturn)._new();
  42698. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  42699. localReturn=$recv($6)._yourself();
  42700. localReturn;
  42701. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  42702. return $core.withContext(function($ctx2) {
  42703. return $recv(localReturn)._add_(each);
  42704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42705. }));
  42706. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  42707. return $self._visitIRReturn_(localReturn);
  42708. }
  42709. $7=(
  42710. $ctx1.supercall = true,
  42711. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  42712. $ctx1.supercall = false;
  42713. return $7;
  42714. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  42715. },
  42716. args: ["anIRNonLocalReturn"],
  42717. 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",
  42718. referencedClasses: ["IRReturn"],
  42719. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  42720. }),
  42721. $globals.IRInliner);
  42722. $core.addMethod(
  42723. $core.method({
  42724. selector: "visitIRReturn:",
  42725. protocol: "visiting",
  42726. fn: function (anIRReturn){
  42727. var self=this,$self=this;
  42728. return $core.withContext(function($ctx1) {
  42729. var $1;
  42730. $1=$self._shouldInlineReturn_(anIRReturn);
  42731. if($core.assert($1)){
  42732. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  42733. } else {
  42734. return (
  42735. $ctx1.supercall = true,
  42736. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  42737. $ctx1.supercall = false;
  42738. }
  42739. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42740. },
  42741. args: ["anIRReturn"],
  42742. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  42743. referencedClasses: [],
  42744. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  42745. }),
  42746. $globals.IRInliner);
  42747. $core.addMethod(
  42748. $core.method({
  42749. selector: "visitIRSend:",
  42750. protocol: "visiting",
  42751. fn: function (anIRSend){
  42752. var self=this,$self=this;
  42753. return $core.withContext(function($ctx1) {
  42754. var $1;
  42755. $1=$self._shouldInlineSend_(anIRSend);
  42756. if($core.assert($1)){
  42757. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  42758. } else {
  42759. return (
  42760. $ctx1.supercall = true,
  42761. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  42762. $ctx1.supercall = false;
  42763. }
  42764. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42765. },
  42766. args: ["anIRSend"],
  42767. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  42768. referencedClasses: [],
  42769. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  42770. }),
  42771. $globals.IRInliner);
  42772. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  42773. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  42774. $core.addMethod(
  42775. $core.method({
  42776. selector: "visitIRInlinedClosure:",
  42777. protocol: "visiting",
  42778. fn: function (anIRInlinedClosure){
  42779. var self=this,$self=this;
  42780. return $core.withContext(function($ctx1) {
  42781. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  42782. return $core.withContext(function($ctx2) {
  42783. return $recv($recv(each)._name())._asVariableName();
  42784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42785. })));
  42786. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  42787. return self;
  42788. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  42789. },
  42790. args: ["anIRInlinedClosure"],
  42791. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  42792. referencedClasses: [],
  42793. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  42794. }),
  42795. $globals.IRInliningJSTranslator);
  42796. $core.addMethod(
  42797. $core.method({
  42798. selector: "visitIRInlinedIfFalse:",
  42799. protocol: "visiting",
  42800. fn: function (anIRInlinedIfFalse){
  42801. var self=this,$self=this;
  42802. return $core.withContext(function($ctx1) {
  42803. var $1,$2,$4,$3;
  42804. $1=$self._stream();
  42805. $ctx1.sendIdx["stream"]=1;
  42806. $recv($1)._nextPutIf_then_((function(){
  42807. return $core.withContext(function($ctx2) {
  42808. $2=$self._stream();
  42809. $ctx2.sendIdx["stream"]=2;
  42810. $recv($2)._nextPutAll_("!$core.assert(");
  42811. $ctx2.sendIdx["nextPutAll:"]=1;
  42812. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  42813. $ctx2.sendIdx["dagChildren"]=1;
  42814. $3=$recv($4)._first();
  42815. $self._visit_($3);
  42816. $ctx2.sendIdx["visit:"]=1;
  42817. return $recv($self._stream())._nextPutAll_(")");
  42818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42819. }),(function(){
  42820. return $core.withContext(function($ctx2) {
  42821. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  42822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42823. }));
  42824. return self;
  42825. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  42826. },
  42827. args: ["anIRInlinedIfFalse"],
  42828. 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 ]",
  42829. referencedClasses: [],
  42830. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  42831. }),
  42832. $globals.IRInliningJSTranslator);
  42833. $core.addMethod(
  42834. $core.method({
  42835. selector: "visitIRInlinedIfNilIfNotNil:",
  42836. protocol: "visiting",
  42837. fn: function (anIRInlinedIfNilIfNotNil){
  42838. var self=this,$self=this;
  42839. return $core.withContext(function($ctx1) {
  42840. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  42841. $1=$self._stream();
  42842. $ctx1.sendIdx["stream"]=1;
  42843. $recv($1)._nextPutIf_then_else_((function(){
  42844. var recvVarName;
  42845. return $core.withContext(function($ctx2) {
  42846. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  42847. recvVarName;
  42848. $2=$self._stream();
  42849. $ctx2.sendIdx["stream"]=2;
  42850. $4="(".__comma(recvVarName);
  42851. $ctx2.sendIdx[","]=2;
  42852. $3=$recv($4).__comma(" = ");
  42853. $ctx2.sendIdx[","]=1;
  42854. $recv($2)._nextPutAll_($3);
  42855. $ctx2.sendIdx["nextPutAll:"]=1;
  42856. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  42857. $ctx2.sendIdx["dagChildren"]=1;
  42858. $5=$recv($6)._first();
  42859. $self._visit_($5);
  42860. $ctx2.sendIdx["visit:"]=1;
  42861. $7=$self._stream();
  42862. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  42863. $ctx2.sendIdx[","]=3;
  42864. return $recv($7)._nextPutAll_($8);
  42865. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  42866. }),(function(){
  42867. return $core.withContext(function($ctx2) {
  42868. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  42869. $ctx2.sendIdx["dagChildren"]=2;
  42870. $9=$recv($10)._second();
  42871. return $self._visit_($9);
  42872. $ctx2.sendIdx["visit:"]=2;
  42873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42874. }),(function(){
  42875. return $core.withContext(function($ctx2) {
  42876. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  42877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42878. }));
  42879. return self;
  42880. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  42881. },
  42882. args: ["anIRInlinedIfNilIfNotNil"],
  42883. 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 ]",
  42884. referencedClasses: [],
  42885. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  42886. }),
  42887. $globals.IRInliningJSTranslator);
  42888. $core.addMethod(
  42889. $core.method({
  42890. selector: "visitIRInlinedIfTrue:",
  42891. protocol: "visiting",
  42892. fn: function (anIRInlinedIfTrue){
  42893. var self=this,$self=this;
  42894. return $core.withContext(function($ctx1) {
  42895. var $1,$2,$4,$3;
  42896. $1=$self._stream();
  42897. $ctx1.sendIdx["stream"]=1;
  42898. $recv($1)._nextPutIf_then_((function(){
  42899. return $core.withContext(function($ctx2) {
  42900. $2=$self._stream();
  42901. $ctx2.sendIdx["stream"]=2;
  42902. $recv($2)._nextPutAll_("$core.assert(");
  42903. $ctx2.sendIdx["nextPutAll:"]=1;
  42904. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  42905. $ctx2.sendIdx["dagChildren"]=1;
  42906. $3=$recv($4)._first();
  42907. $self._visit_($3);
  42908. $ctx2.sendIdx["visit:"]=1;
  42909. return $recv($self._stream())._nextPutAll_(")");
  42910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42911. }),(function(){
  42912. return $core.withContext(function($ctx2) {
  42913. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  42914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42915. }));
  42916. return self;
  42917. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  42918. },
  42919. args: ["anIRInlinedIfTrue"],
  42920. 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 ]",
  42921. referencedClasses: [],
  42922. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  42923. }),
  42924. $globals.IRInliningJSTranslator);
  42925. $core.addMethod(
  42926. $core.method({
  42927. selector: "visitIRInlinedIfTrueIfFalse:",
  42928. protocol: "visiting",
  42929. fn: function (anIRInlinedIfTrueIfFalse){
  42930. var self=this,$self=this;
  42931. return $core.withContext(function($ctx1) {
  42932. var $1,$2,$4,$3,$6,$5;
  42933. $1=$self._stream();
  42934. $ctx1.sendIdx["stream"]=1;
  42935. $recv($1)._nextPutIf_then_else_((function(){
  42936. return $core.withContext(function($ctx2) {
  42937. $2=$self._stream();
  42938. $ctx2.sendIdx["stream"]=2;
  42939. $recv($2)._nextPutAll_("$core.assert(");
  42940. $ctx2.sendIdx["nextPutAll:"]=1;
  42941. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  42942. $ctx2.sendIdx["dagChildren"]=1;
  42943. $3=$recv($4)._first();
  42944. $self._visit_($3);
  42945. $ctx2.sendIdx["visit:"]=1;
  42946. return $recv($self._stream())._nextPutAll_(")");
  42947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42948. }),(function(){
  42949. return $core.withContext(function($ctx2) {
  42950. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  42951. $ctx2.sendIdx["dagChildren"]=2;
  42952. $5=$recv($6)._second();
  42953. return $self._visit_($5);
  42954. $ctx2.sendIdx["visit:"]=2;
  42955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42956. }),(function(){
  42957. return $core.withContext(function($ctx2) {
  42958. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  42959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42960. }));
  42961. return self;
  42962. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  42963. },
  42964. args: ["anIRInlinedIfTrueIfFalse"],
  42965. 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 ]",
  42966. referencedClasses: [],
  42967. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  42968. }),
  42969. $globals.IRInliningJSTranslator);
  42970. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  42971. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  42972. $core.addMethod(
  42973. $core.method({
  42974. selector: "ifFalse:",
  42975. protocol: "inlining",
  42976. fn: function (anIRInstruction){
  42977. var self=this,$self=this;
  42978. return $core.withContext(function($ctx1) {
  42979. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  42980. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  42981. },
  42982. args: ["anIRInstruction"],
  42983. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  42984. referencedClasses: ["IRInlinedIfFalse"],
  42985. messageSends: ["inlinedSend:withBlock:", "new"]
  42986. }),
  42987. $globals.IRSendInliner);
  42988. $core.addMethod(
  42989. $core.method({
  42990. selector: "ifFalse:ifTrue:",
  42991. protocol: "inlining",
  42992. fn: function (anIRInstruction,anotherIRInstruction){
  42993. var self=this,$self=this;
  42994. return $core.withContext(function($ctx1) {
  42995. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  42996. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  42997. },
  42998. args: ["anIRInstruction", "anotherIRInstruction"],
  42999. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43000. referencedClasses: [],
  43001. messageSends: ["perform:withArguments:"]
  43002. }),
  43003. $globals.IRSendInliner);
  43004. $core.addMethod(
  43005. $core.method({
  43006. selector: "ifNil:",
  43007. protocol: "inlining",
  43008. fn: function (anIRInstruction){
  43009. var self=this,$self=this;
  43010. return $core.withContext(function($ctx1) {
  43011. var $1,$3,$5,$6,$4,$2;
  43012. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43013. $ctx1.sendIdx["new"]=1;
  43014. $3=$recv($globals.IRClosure)._new();
  43015. $ctx1.sendIdx["new"]=2;
  43016. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43017. $5=$recv($globals.IRBlockSequence)._new();
  43018. $recv($5)._add_($recv($self._send())._receiver());
  43019. $6=$recv($5)._yourself();
  43020. $ctx1.sendIdx["yourself"]=1;
  43021. $4=$6;
  43022. $recv($3)._add_($4);
  43023. $ctx1.sendIdx["add:"]=1;
  43024. $2=$recv($3)._yourself();
  43025. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43026. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43027. },
  43028. args: ["anIRInstruction"],
  43029. 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)",
  43030. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43031. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43032. }),
  43033. $globals.IRSendInliner);
  43034. $core.addMethod(
  43035. $core.method({
  43036. selector: "ifNil:ifNotNil:",
  43037. protocol: "inlining",
  43038. fn: function (anIRInstruction,anotherIRInstruction){
  43039. var self=this,$self=this;
  43040. return $core.withContext(function($ctx1) {
  43041. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43042. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43043. },
  43044. args: ["anIRInstruction", "anotherIRInstruction"],
  43045. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43046. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43047. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43048. }),
  43049. $globals.IRSendInliner);
  43050. $core.addMethod(
  43051. $core.method({
  43052. selector: "ifNotNil:",
  43053. protocol: "inlining",
  43054. fn: function (anIRInstruction){
  43055. var self=this,$self=this;
  43056. return $core.withContext(function($ctx1) {
  43057. var $1,$3,$5,$6,$4,$2;
  43058. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43059. $ctx1.sendIdx["new"]=1;
  43060. $3=$recv($globals.IRClosure)._new();
  43061. $ctx1.sendIdx["new"]=2;
  43062. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43063. $5=$recv($globals.IRBlockSequence)._new();
  43064. $recv($5)._add_($recv($self._send())._receiver());
  43065. $6=$recv($5)._yourself();
  43066. $ctx1.sendIdx["yourself"]=1;
  43067. $4=$6;
  43068. $recv($3)._add_($4);
  43069. $ctx1.sendIdx["add:"]=1;
  43070. $2=$recv($3)._yourself();
  43071. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43072. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43073. },
  43074. args: ["anIRInstruction"],
  43075. 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",
  43076. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43077. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43078. }),
  43079. $globals.IRSendInliner);
  43080. $core.addMethod(
  43081. $core.method({
  43082. selector: "ifNotNil:ifNil:",
  43083. protocol: "inlining",
  43084. fn: function (anIRInstruction,anotherIRInstruction){
  43085. var self=this,$self=this;
  43086. return $core.withContext(function($ctx1) {
  43087. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43088. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43089. },
  43090. args: ["anIRInstruction", "anotherIRInstruction"],
  43091. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43092. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43093. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43094. }),
  43095. $globals.IRSendInliner);
  43096. $core.addMethod(
  43097. $core.method({
  43098. selector: "ifTrue:",
  43099. protocol: "inlining",
  43100. fn: function (anIRInstruction){
  43101. var self=this,$self=this;
  43102. return $core.withContext(function($ctx1) {
  43103. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43104. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43105. },
  43106. args: ["anIRInstruction"],
  43107. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43108. referencedClasses: ["IRInlinedIfTrue"],
  43109. messageSends: ["inlinedSend:withBlock:", "new"]
  43110. }),
  43111. $globals.IRSendInliner);
  43112. $core.addMethod(
  43113. $core.method({
  43114. selector: "ifTrue:ifFalse:",
  43115. protocol: "inlining",
  43116. fn: function (anIRInstruction,anotherIRInstruction){
  43117. var self=this,$self=this;
  43118. return $core.withContext(function($ctx1) {
  43119. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43120. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43121. },
  43122. args: ["anIRInstruction", "anotherIRInstruction"],
  43123. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43124. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43125. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43126. }),
  43127. $globals.IRSendInliner);
  43128. $core.addMethod(
  43129. $core.method({
  43130. selector: "inlineClosure:",
  43131. protocol: "inlining",
  43132. fn: function (anIRClosure){
  43133. var self=this,$self=this;
  43134. var inlinedClosure,sequence,statements;
  43135. return $core.withContext(function($ctx1) {
  43136. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43137. inlinedClosure=$self._inlinedClosure();
  43138. $1=inlinedClosure;
  43139. $2=$recv(anIRClosure)._scope();
  43140. $ctx1.sendIdx["scope"]=1;
  43141. $recv($1)._scope_($2);
  43142. $ctx1.sendIdx["scope:"]=1;
  43143. $recv($1)._parent_($recv(anIRClosure)._parent());
  43144. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43145. return $core.withContext(function($ctx2) {
  43146. return $recv(inlinedClosure)._add_(each);
  43147. $ctx2.sendIdx["add:"]=1;
  43148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43149. }));
  43150. $ctx1.sendIdx["do:"]=1;
  43151. sequence=$self._inlinedSequence();
  43152. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43153. return $core.withContext(function($ctx2) {
  43154. $3=inlinedClosure;
  43155. $5=$recv($globals.IRTempDeclaration)._new();
  43156. $ctx2.sendIdx["new"]=1;
  43157. $recv($5)._name_(each);
  43158. $ctx2.sendIdx["name:"]=1;
  43159. $6=$recv($5)._yourself();
  43160. $ctx2.sendIdx["yourself"]=1;
  43161. $4=$6;
  43162. $recv($3)._add_($4);
  43163. $ctx2.sendIdx["add:"]=2;
  43164. $7=sequence;
  43165. $9=$recv($globals.IRAssignment)._new();
  43166. $ctx2.sendIdx["new"]=2;
  43167. $11=$recv($globals.IRVariable)._new();
  43168. $ctx2.sendIdx["new"]=3;
  43169. $13=$recv($globals.AliasVar)._new();
  43170. $ctx2.sendIdx["new"]=4;
  43171. $14=$recv(inlinedClosure)._scope();
  43172. $ctx2.sendIdx["scope"]=2;
  43173. $recv($13)._scope_($14);
  43174. $ctx2.sendIdx["scope:"]=2;
  43175. $recv($13)._name_(each);
  43176. $ctx2.sendIdx["name:"]=2;
  43177. $15=$recv($13)._yourself();
  43178. $ctx2.sendIdx["yourself"]=2;
  43179. $12=$15;
  43180. $10=$recv($11)._variable_($12);
  43181. $ctx2.sendIdx["variable:"]=1;
  43182. $recv($9)._add_($10);
  43183. $ctx2.sendIdx["add:"]=4;
  43184. $17=$recv($globals.IRVariable)._new();
  43185. $ctx2.sendIdx["new"]=5;
  43186. $19=$recv($globals.AliasVar)._new();
  43187. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43188. $recv($19)._name_("$receiver");
  43189. $20=$recv($19)._yourself();
  43190. $ctx2.sendIdx["yourself"]=3;
  43191. $18=$20;
  43192. $16=$recv($17)._variable_($18);
  43193. $recv($9)._add_($16);
  43194. $ctx2.sendIdx["add:"]=5;
  43195. $8=$recv($9)._yourself();
  43196. return $recv($7)._add_($8);
  43197. $ctx2.sendIdx["add:"]=3;
  43198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43199. }));
  43200. $ctx1.sendIdx["do:"]=2;
  43201. $recv(inlinedClosure)._add_(sequence);
  43202. $ctx1.sendIdx["add:"]=6;
  43203. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43204. $recv(statements)._ifNotEmpty_((function(){
  43205. return $core.withContext(function($ctx2) {
  43206. $recv($recv(statements)._allButLast())._do_((function(each){
  43207. return $core.withContext(function($ctx3) {
  43208. return $recv(sequence)._add_(each);
  43209. $ctx3.sendIdx["add:"]=7;
  43210. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43211. }));
  43212. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43214. }));
  43215. return inlinedClosure;
  43216. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43217. },
  43218. args: ["anIRClosure"],
  43219. 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",
  43220. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43221. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43222. }),
  43223. $globals.IRSendInliner);
  43224. $core.addMethod(
  43225. $core.method({
  43226. selector: "inlineSend:",
  43227. protocol: "inlining",
  43228. fn: function (anIRSend){
  43229. var self=this,$self=this;
  43230. return $core.withContext(function($ctx1) {
  43231. var $2,$1;
  43232. $self._send_(anIRSend);
  43233. $2=$self._send();
  43234. $ctx1.sendIdx["send"]=1;
  43235. $1=$recv($2)._selector();
  43236. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43237. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43238. },
  43239. args: ["anIRSend"],
  43240. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43241. referencedClasses: [],
  43242. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43243. }),
  43244. $globals.IRSendInliner);
  43245. $core.addMethod(
  43246. $core.method({
  43247. selector: "inlineSend:andReplace:",
  43248. protocol: "private",
  43249. fn: function (anIRSend,anIRInstruction){
  43250. var self=this,$self=this;
  43251. return $core.withContext(function($ctx1) {
  43252. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43253. return $self._inlineSend_(anIRSend);
  43254. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43255. },
  43256. args: ["anIRSend", "anIRInstruction"],
  43257. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43258. referencedClasses: [],
  43259. messageSends: ["replaceWith:", "inlineSend:"]
  43260. }),
  43261. $globals.IRSendInliner);
  43262. $core.addMethod(
  43263. $core.method({
  43264. selector: "inlinedClosure",
  43265. protocol: "factory",
  43266. fn: function (){
  43267. var self=this,$self=this;
  43268. return $core.withContext(function($ctx1) {
  43269. return $recv($globals.IRInlinedClosure)._new();
  43270. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43271. },
  43272. args: [],
  43273. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43274. referencedClasses: ["IRInlinedClosure"],
  43275. messageSends: ["new"]
  43276. }),
  43277. $globals.IRSendInliner);
  43278. $core.addMethod(
  43279. $core.method({
  43280. selector: "inlinedSend:withBlock:",
  43281. protocol: "private",
  43282. fn: function (inlinedSend,anIRInstruction){
  43283. var self=this,$self=this;
  43284. var inlinedClosure;
  43285. return $core.withContext(function($ctx1) {
  43286. var $1,$2,$4,$3,$5;
  43287. $1=$recv(anIRInstruction)._isClosure();
  43288. if(!$core.assert($1)){
  43289. $self._inliningError_("Message argument should be a block");
  43290. $ctx1.sendIdx["inliningError:"]=1;
  43291. }
  43292. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43293. if(!$core.assert($2)){
  43294. $self._inliningError_("Inlined block should have zero argument");
  43295. }
  43296. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43297. $4=$self._send();
  43298. $ctx1.sendIdx["send"]=1;
  43299. $3=$recv($4)._receiver();
  43300. $recv(inlinedSend)._add_($3);
  43301. $ctx1.sendIdx["add:"]=1;
  43302. $recv(inlinedSend)._add_(inlinedClosure);
  43303. $recv($self._send())._replaceWith_(inlinedSend);
  43304. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43305. $ctx1.sendIdx["internalVariables"]=1;
  43306. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43307. return inlinedSend;
  43308. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43309. },
  43310. args: ["inlinedSend", "anIRInstruction"],
  43311. 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",
  43312. referencedClasses: [],
  43313. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43314. }),
  43315. $globals.IRSendInliner);
  43316. $core.addMethod(
  43317. $core.method({
  43318. selector: "inlinedSend:withBlock:withBlock:",
  43319. protocol: "private",
  43320. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43321. var self=this,$self=this;
  43322. var inlinedClosure1,inlinedClosure2;
  43323. return $core.withContext(function($ctx1) {
  43324. var $1,$2,$3,$4,$6,$5,$7;
  43325. $1=$recv(anIRInstruction)._isClosure();
  43326. $ctx1.sendIdx["isClosure"]=1;
  43327. if(!$core.assert($1)){
  43328. $self._inliningError_("Message argument should be a block");
  43329. $ctx1.sendIdx["inliningError:"]=1;
  43330. }
  43331. $2=$recv(anotherIRInstruction)._isClosure();
  43332. if(!$core.assert($2)){
  43333. $self._inliningError_("Message argument should be a block");
  43334. }
  43335. $3=$self._translator();
  43336. $ctx1.sendIdx["translator"]=1;
  43337. $4=$self._inlineClosure_(anIRInstruction);
  43338. $ctx1.sendIdx["inlineClosure:"]=1;
  43339. inlinedClosure1=$recv($3)._visit_($4);
  43340. $ctx1.sendIdx["visit:"]=1;
  43341. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43342. $6=$self._send();
  43343. $ctx1.sendIdx["send"]=1;
  43344. $5=$recv($6)._receiver();
  43345. $recv(inlinedSend)._add_($5);
  43346. $ctx1.sendIdx["add:"]=1;
  43347. $recv(inlinedSend)._add_(inlinedClosure1);
  43348. $ctx1.sendIdx["add:"]=2;
  43349. $recv(inlinedSend)._add_(inlinedClosure2);
  43350. $recv($self._send())._replaceWith_(inlinedSend);
  43351. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43352. $ctx1.sendIdx["internalVariables"]=1;
  43353. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43354. return inlinedSend;
  43355. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43356. },
  43357. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43358. 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",
  43359. referencedClasses: [],
  43360. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43361. }),
  43362. $globals.IRSendInliner);
  43363. $core.addMethod(
  43364. $core.method({
  43365. selector: "inlinedSequence",
  43366. protocol: "factory",
  43367. fn: function (){
  43368. var self=this,$self=this;
  43369. return $core.withContext(function($ctx1) {
  43370. return $recv($globals.IRInlinedSequence)._new();
  43371. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43372. },
  43373. args: [],
  43374. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43375. referencedClasses: ["IRInlinedSequence"],
  43376. messageSends: ["new"]
  43377. }),
  43378. $globals.IRSendInliner);
  43379. $core.addMethod(
  43380. $core.method({
  43381. selector: "inliningError:",
  43382. protocol: "error handling",
  43383. fn: function (aString){
  43384. var self=this,$self=this;
  43385. return $core.withContext(function($ctx1) {
  43386. $recv($globals.InliningError)._signal_(aString);
  43387. return self;
  43388. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43389. },
  43390. args: ["aString"],
  43391. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43392. referencedClasses: ["InliningError"],
  43393. messageSends: ["signal:"]
  43394. }),
  43395. $globals.IRSendInliner);
  43396. $core.addMethod(
  43397. $core.method({
  43398. selector: "send",
  43399. protocol: "accessing",
  43400. fn: function (){
  43401. var self=this,$self=this;
  43402. return $self["@send"];
  43403. },
  43404. args: [],
  43405. source: "send\x0a\x09^ send",
  43406. referencedClasses: [],
  43407. messageSends: []
  43408. }),
  43409. $globals.IRSendInliner);
  43410. $core.addMethod(
  43411. $core.method({
  43412. selector: "send:",
  43413. protocol: "accessing",
  43414. fn: function (anIRSend){
  43415. var self=this,$self=this;
  43416. $self["@send"]=anIRSend;
  43417. return self;
  43418. },
  43419. args: ["anIRSend"],
  43420. source: "send: anIRSend\x0a\x09send := anIRSend",
  43421. referencedClasses: [],
  43422. messageSends: []
  43423. }),
  43424. $globals.IRSendInliner);
  43425. $core.addMethod(
  43426. $core.method({
  43427. selector: "translator",
  43428. protocol: "accessing",
  43429. fn: function (){
  43430. var self=this,$self=this;
  43431. return $self["@translator"];
  43432. },
  43433. args: [],
  43434. source: "translator\x0a\x09^ translator",
  43435. referencedClasses: [],
  43436. messageSends: []
  43437. }),
  43438. $globals.IRSendInliner);
  43439. $core.addMethod(
  43440. $core.method({
  43441. selector: "translator:",
  43442. protocol: "accessing",
  43443. fn: function (anASTTranslator){
  43444. var self=this,$self=this;
  43445. $self["@translator"]=anASTTranslator;
  43446. return self;
  43447. },
  43448. args: ["anASTTranslator"],
  43449. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43450. referencedClasses: [],
  43451. messageSends: []
  43452. }),
  43453. $globals.IRSendInliner);
  43454. $core.addMethod(
  43455. $core.method({
  43456. selector: "inlinedSelectors",
  43457. protocol: "accessing",
  43458. fn: function (){
  43459. var self=this,$self=this;
  43460. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43461. },
  43462. args: [],
  43463. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43464. referencedClasses: [],
  43465. messageSends: []
  43466. }),
  43467. $globals.IRSendInliner.a$cls);
  43468. $core.addMethod(
  43469. $core.method({
  43470. selector: "shouldInline:",
  43471. protocol: "accessing",
  43472. fn: function (anIRSend){
  43473. var self=this,$self=this;
  43474. return $core.withContext(function($ctx1) {
  43475. var $1;
  43476. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43477. if(!$core.assert($1)){
  43478. return false;
  43479. }
  43480. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  43481. return $core.withContext(function($ctx2) {
  43482. return $recv(each)._isClosure();
  43483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43484. }));
  43485. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  43486. },
  43487. args: ["anIRSend"],
  43488. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  43489. referencedClasses: [],
  43490. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  43491. }),
  43492. $globals.IRSendInliner.a$cls);
  43493. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  43494. $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};";
  43495. $core.addMethod(
  43496. $core.method({
  43497. selector: "inlineAssignment:",
  43498. protocol: "inlining",
  43499. fn: function (anIRAssignment){
  43500. var self=this,$self=this;
  43501. return $core.withContext(function($ctx1) {
  43502. $self._target_($recv(anIRAssignment)._left());
  43503. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  43504. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  43505. },
  43506. args: ["anIRAssignment"],
  43507. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  43508. referencedClasses: [],
  43509. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  43510. }),
  43511. $globals.IRAssignmentInliner);
  43512. $core.addMethod(
  43513. $core.method({
  43514. selector: "inlineClosure:",
  43515. protocol: "inlining",
  43516. fn: function (anIRClosure){
  43517. var self=this,$self=this;
  43518. var closure,sequence,statements;
  43519. return $core.withContext(function($ctx1) {
  43520. var $1,$2,$3,$5,$4;
  43521. closure=(
  43522. $ctx1.supercall = true,
  43523. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43524. $ctx1.supercall = false;
  43525. sequence=$recv(closure)._sequence();
  43526. statements=$recv(sequence)._dagChildren();
  43527. $recv(statements)._ifNotEmpty_((function(){
  43528. var final;
  43529. return $core.withContext(function($ctx2) {
  43530. final=$recv(statements)._last();
  43531. final;
  43532. $1=$recv(final)._yieldsValue();
  43533. if($core.assert($1)){
  43534. $2=sequence;
  43535. $3=final;
  43536. $5=$recv($globals.IRAssignment)._new();
  43537. $recv($5)._add_($self._target());
  43538. $ctx2.sendIdx["add:"]=1;
  43539. $recv($5)._add_($recv(final)._copy());
  43540. $4=$recv($5)._yourself();
  43541. return $recv($2)._replace_with_($3,$4);
  43542. }
  43543. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43544. }));
  43545. return closure;
  43546. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  43547. },
  43548. args: ["anIRClosure"],
  43549. 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",
  43550. referencedClasses: ["IRAssignment"],
  43551. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  43552. }),
  43553. $globals.IRAssignmentInliner);
  43554. $core.addMethod(
  43555. $core.method({
  43556. selector: "target",
  43557. protocol: "accessing",
  43558. fn: function (){
  43559. var self=this,$self=this;
  43560. return $self["@target"];
  43561. },
  43562. args: [],
  43563. source: "target\x0a\x09^ target",
  43564. referencedClasses: [],
  43565. messageSends: []
  43566. }),
  43567. $globals.IRAssignmentInliner);
  43568. $core.addMethod(
  43569. $core.method({
  43570. selector: "target:",
  43571. protocol: "accessing",
  43572. fn: function (anObject){
  43573. var self=this,$self=this;
  43574. $self["@target"]=anObject;
  43575. return self;
  43576. },
  43577. args: ["anObject"],
  43578. source: "target: anObject\x0a\x09target := anObject",
  43579. referencedClasses: [],
  43580. messageSends: []
  43581. }),
  43582. $globals.IRAssignmentInliner);
  43583. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  43584. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  43585. $core.addMethod(
  43586. $core.method({
  43587. selector: "inlineClosure:",
  43588. protocol: "inlining",
  43589. fn: function (anIRClosure){
  43590. var self=this,$self=this;
  43591. var closure,sequence,statements;
  43592. return $core.withContext(function($ctx1) {
  43593. var $1,$2,$3,$5,$4;
  43594. closure=(
  43595. $ctx1.supercall = true,
  43596. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43597. $ctx1.supercall = false;
  43598. sequence=$recv(closure)._sequence();
  43599. statements=$recv(sequence)._dagChildren();
  43600. $recv(statements)._ifNotEmpty_((function(){
  43601. var final;
  43602. return $core.withContext(function($ctx2) {
  43603. final=$recv(statements)._last();
  43604. final;
  43605. $1=$recv(final)._yieldsValue();
  43606. if($core.assert($1)){
  43607. $2=sequence;
  43608. $3=final;
  43609. $5=$recv($globals.IRReturn)._new();
  43610. $recv($5)._add_($recv(final)._copy());
  43611. $4=$recv($5)._yourself();
  43612. return $recv($2)._replace_with_($3,$4);
  43613. }
  43614. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43615. }));
  43616. return closure;
  43617. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  43618. },
  43619. args: ["anIRClosure"],
  43620. 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",
  43621. referencedClasses: ["IRReturn"],
  43622. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  43623. }),
  43624. $globals.IRReturnInliner);
  43625. $core.addMethod(
  43626. $core.method({
  43627. selector: "inlineReturn:",
  43628. protocol: "inlining",
  43629. fn: function (anIRReturn){
  43630. var self=this,$self=this;
  43631. return $core.withContext(function($ctx1) {
  43632. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  43633. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  43634. },
  43635. args: ["anIRReturn"],
  43636. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  43637. referencedClasses: [],
  43638. messageSends: ["inlineSend:andReplace:", "expression"]
  43639. }),
  43640. $globals.IRReturnInliner);
  43641. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  43642. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  43643. $core.addMethod(
  43644. $core.method({
  43645. selector: "inliner",
  43646. protocol: "compiling",
  43647. fn: function (){
  43648. var self=this,$self=this;
  43649. return $core.withContext(function($ctx1) {
  43650. return $recv($globals.IRInliner)._new();
  43651. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  43652. },
  43653. args: [],
  43654. source: "inliner\x0a\x09^ IRInliner new",
  43655. referencedClasses: ["IRInliner"],
  43656. messageSends: ["new"]
  43657. }),
  43658. $globals.InliningCodeGenerator);
  43659. $core.addMethod(
  43660. $core.method({
  43661. selector: "irTranslatorClass",
  43662. protocol: "compiling",
  43663. fn: function (){
  43664. var self=this,$self=this;
  43665. return $globals.IRInliningJSTranslator;
  43666. },
  43667. args: [],
  43668. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  43669. referencedClasses: ["IRInliningJSTranslator"],
  43670. messageSends: []
  43671. }),
  43672. $globals.InliningCodeGenerator);
  43673. $core.addMethod(
  43674. $core.method({
  43675. selector: "preInliner",
  43676. protocol: "compiling",
  43677. fn: function (){
  43678. var self=this,$self=this;
  43679. return $core.withContext(function($ctx1) {
  43680. return $recv($globals.ASTPreInliner)._new();
  43681. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  43682. },
  43683. args: [],
  43684. source: "preInliner\x0a\x09^ ASTPreInliner new",
  43685. referencedClasses: ["ASTPreInliner"],
  43686. messageSends: ["new"]
  43687. }),
  43688. $globals.InliningCodeGenerator);
  43689. $core.addMethod(
  43690. $core.method({
  43691. selector: "transformersDictionary",
  43692. protocol: "compiling",
  43693. fn: function (){
  43694. var self=this,$self=this;
  43695. return $core.withContext(function($ctx1) {
  43696. var $1,$2,$receiver;
  43697. $1=$self["@transformersDictionary"];
  43698. if(($receiver = $1) == null || $receiver.a$nil){
  43699. $2=(
  43700. $ctx1.supercall = true,
  43701. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  43702. $ctx1.supercall = false;
  43703. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  43704. $ctx1.sendIdx["at:put:"]=1;
  43705. $recv($2)._at_put_("6000-inliner",$self._inliner());
  43706. $ctx1.sendIdx["at:put:"]=2;
  43707. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  43708. $self["@transformersDictionary"]=$recv($2)._yourself();
  43709. return $self["@transformersDictionary"];
  43710. } else {
  43711. return $1;
  43712. }
  43713. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  43714. },
  43715. args: [],
  43716. 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 ]",
  43717. referencedClasses: [],
  43718. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  43719. }),
  43720. $globals.InliningCodeGenerator);
  43721. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  43722. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  43723. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  43724. $core.addMethod(
  43725. $core.method({
  43726. selector: "visitSendNode:",
  43727. protocol: "visiting",
  43728. fn: function (aNode){
  43729. var self=this,$self=this;
  43730. return $core.withContext(function($ctx1) {
  43731. var $1,$2,$3,$receiver;
  43732. $1=$recv(aNode)._superSend();
  43733. if(!$core.assert($1)){
  43734. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  43735. if($core.assert($2)){
  43736. $recv(aNode)._shouldBeInlined_(true);
  43737. $3=$recv(aNode)._receiver();
  43738. if(($receiver = $3) == null || $receiver.a$nil){
  43739. $3;
  43740. } else {
  43741. var receiver;
  43742. receiver=$receiver;
  43743. $recv(receiver)._shouldBeAliased_(true);
  43744. }
  43745. }
  43746. }
  43747. (
  43748. $ctx1.supercall = true,
  43749. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  43750. $ctx1.supercall = false;
  43751. return self;
  43752. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  43753. },
  43754. args: ["aNode"],
  43755. 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",
  43756. referencedClasses: ["IRSendInliner"],
  43757. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  43758. }),
  43759. $globals.InliningSemanticAnalyzer);
  43760. $core.addMethod(
  43761. $core.method({
  43762. selector: "asInlinedBlockResult",
  43763. protocol: "*Compiler-Inlining",
  43764. fn: function (){
  43765. var self=this,$self=this;
  43766. return $core.withContext(function($ctx1) {
  43767. return $self._expression();
  43768. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  43769. },
  43770. args: [],
  43771. source: "asInlinedBlockResult\x0a\x09^ self expression",
  43772. referencedClasses: [],
  43773. messageSends: ["expression"]
  43774. }),
  43775. $globals.IRBlockReturn);
  43776. $core.addMethod(
  43777. $core.method({
  43778. selector: "asInlinedBlockResult",
  43779. protocol: "*Compiler-Inlining",
  43780. fn: function (){
  43781. var self=this,$self=this;
  43782. return self;
  43783. },
  43784. args: [],
  43785. source: "asInlinedBlockResult\x0a\x09^ self",
  43786. referencedClasses: [],
  43787. messageSends: []
  43788. }),
  43789. $globals.IRInstruction);
  43790. });
  43791. 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";
  43792. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  43793. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43794. $core.addPackage("Compiler-Interpreter");
  43795. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  43796. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43797. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  43798. $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`).";
  43799. $core.addMethod(
  43800. $core.method({
  43801. selector: "applyTo:arguments:",
  43802. protocol: "evaluating",
  43803. fn: function (anObject,aCollection){
  43804. var self=this,$self=this;
  43805. return $core.withContext(function($ctx1) {
  43806. $self._interpreterError();
  43807. return self;
  43808. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  43809. },
  43810. args: ["anObject", "aCollection"],
  43811. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  43812. referencedClasses: [],
  43813. messageSends: ["interpreterError"]
  43814. }),
  43815. $globals.AIBlockClosure);
  43816. $core.addMethod(
  43817. $core.method({
  43818. selector: "compiledSource",
  43819. protocol: "accessing",
  43820. fn: function (){
  43821. var self=this,$self=this;
  43822. return "[ AST Block closure ]";
  43823. },
  43824. args: [],
  43825. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  43826. referencedClasses: [],
  43827. messageSends: []
  43828. }),
  43829. $globals.AIBlockClosure);
  43830. $core.addMethod(
  43831. $core.method({
  43832. selector: "currySelf",
  43833. protocol: "converting",
  43834. fn: function (){
  43835. var self=this,$self=this;
  43836. return $core.withContext(function($ctx1) {
  43837. $self._interpreterError();
  43838. return self;
  43839. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  43840. },
  43841. args: [],
  43842. source: "currySelf\x0a\x09self interpreterError",
  43843. referencedClasses: [],
  43844. messageSends: ["interpreterError"]
  43845. }),
  43846. $globals.AIBlockClosure);
  43847. $core.addMethod(
  43848. $core.method({
  43849. selector: "initializeWithContext:node:",
  43850. protocol: "initialization",
  43851. fn: function (aContext,aNode){
  43852. var self=this,$self=this;
  43853. $self["@node"]=aNode;
  43854. $self["@outerContext"]=aContext;
  43855. return self;
  43856. },
  43857. args: ["aContext", "aNode"],
  43858. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  43859. referencedClasses: [],
  43860. messageSends: []
  43861. }),
  43862. $globals.AIBlockClosure);
  43863. $core.addMethod(
  43864. $core.method({
  43865. selector: "interpreterError",
  43866. protocol: "error handling",
  43867. fn: function (){
  43868. var self=this,$self=this;
  43869. return $core.withContext(function($ctx1) {
  43870. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  43871. return self;
  43872. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  43873. },
  43874. args: [],
  43875. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  43876. referencedClasses: ["ASTInterpreterError"],
  43877. messageSends: ["signal:"]
  43878. }),
  43879. $globals.AIBlockClosure);
  43880. $core.addMethod(
  43881. $core.method({
  43882. selector: "numArgs",
  43883. protocol: "accessing",
  43884. fn: function (){
  43885. var self=this,$self=this;
  43886. return $core.withContext(function($ctx1) {
  43887. return $recv($recv($self["@node"])._temps())._size();
  43888. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  43889. },
  43890. args: [],
  43891. source: "numArgs\x0a\x09^ node temps size",
  43892. referencedClasses: [],
  43893. messageSends: ["size", "temps"]
  43894. }),
  43895. $globals.AIBlockClosure);
  43896. $core.addMethod(
  43897. $core.method({
  43898. selector: "value",
  43899. protocol: "evaluating",
  43900. fn: function (){
  43901. var self=this,$self=this;
  43902. return $core.withContext(function($ctx1) {
  43903. return $self._valueWithPossibleArguments_([]);
  43904. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  43905. },
  43906. args: [],
  43907. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  43908. referencedClasses: [],
  43909. messageSends: ["valueWithPossibleArguments:"]
  43910. }),
  43911. $globals.AIBlockClosure);
  43912. $core.addMethod(
  43913. $core.method({
  43914. selector: "value:",
  43915. protocol: "evaluating",
  43916. fn: function (anArgument){
  43917. var self=this,$self=this;
  43918. return $core.withContext(function($ctx1) {
  43919. return $self._valueWithPossibleArguments_([anArgument]);
  43920. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  43921. },
  43922. args: ["anArgument"],
  43923. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  43924. referencedClasses: [],
  43925. messageSends: ["valueWithPossibleArguments:"]
  43926. }),
  43927. $globals.AIBlockClosure);
  43928. $core.addMethod(
  43929. $core.method({
  43930. selector: "value:value:",
  43931. protocol: "evaluating",
  43932. fn: function (firstArgument,secondArgument){
  43933. var self=this,$self=this;
  43934. return $core.withContext(function($ctx1) {
  43935. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  43936. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  43937. },
  43938. args: ["firstArgument", "secondArgument"],
  43939. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  43940. referencedClasses: [],
  43941. messageSends: ["valueWithPossibleArguments:"]
  43942. }),
  43943. $globals.AIBlockClosure);
  43944. $core.addMethod(
  43945. $core.method({
  43946. selector: "value:value:value:",
  43947. protocol: "evaluating",
  43948. fn: function (firstArgument,secondArgument,thirdArgument){
  43949. var self=this,$self=this;
  43950. return $core.withContext(function($ctx1) {
  43951. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  43952. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  43953. },
  43954. args: ["firstArgument", "secondArgument", "thirdArgument"],
  43955. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  43956. referencedClasses: [],
  43957. messageSends: ["valueWithPossibleArguments:"]
  43958. }),
  43959. $globals.AIBlockClosure);
  43960. $core.addMethod(
  43961. $core.method({
  43962. selector: "valueWithPossibleArguments:",
  43963. protocol: "evaluating",
  43964. fn: function (aCollection){
  43965. var self=this,$self=this;
  43966. var context,sequenceNode;
  43967. return $core.withContext(function($ctx1) {
  43968. var $1,$2,$3;
  43969. context=$recv($self["@outerContext"])._newInnerContext();
  43970. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  43971. $recv($1)._parent_(nil);
  43972. sequenceNode=$recv($1)._yourself();
  43973. $recv($recv(sequenceNode)._temps())._do_((function(each){
  43974. return $core.withContext(function($ctx2) {
  43975. return $recv(context)._defineLocal_(each);
  43976. $ctx2.sendIdx["defineLocal:"]=1;
  43977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43978. }));
  43979. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  43980. return $core.withContext(function($ctx2) {
  43981. $recv(context)._defineLocal_(each);
  43982. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  43983. return nil;
  43984. })));
  43985. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  43986. }));
  43987. $2=$recv(context)._interpreter();
  43988. $ctx1.sendIdx["interpreter"]=1;
  43989. $recv($2)._node_(sequenceNode);
  43990. $recv($2)._enterNode();
  43991. $recv($2)._proceed();
  43992. $3=$recv($self["@outerContext"])._interpreter();
  43993. $ctx1.sendIdx["interpreter"]=2;
  43994. $recv($3)._setNonLocalReturnFromContext_(context);
  43995. return $recv($recv(context)._interpreter())._pop();
  43996. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  43997. },
  43998. args: ["aCollection"],
  43999. 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",
  44000. referencedClasses: [],
  44001. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44002. }),
  44003. $globals.AIBlockClosure);
  44004. $core.addMethod(
  44005. $core.method({
  44006. selector: "forContext:node:",
  44007. protocol: "instance creation",
  44008. fn: function (aContext,aNode){
  44009. var self=this,$self=this;
  44010. return $core.withContext(function($ctx1) {
  44011. var $1;
  44012. $1=$self._new();
  44013. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44014. return $recv($1)._yourself();
  44015. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44016. },
  44017. args: ["aContext", "aNode"],
  44018. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44019. referencedClasses: [],
  44020. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44021. }),
  44022. $globals.AIBlockClosure.a$cls);
  44023. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44024. $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)";
  44025. $core.addMethod(
  44026. $core.method({
  44027. selector: "arguments",
  44028. protocol: "interpreting",
  44029. fn: function (){
  44030. var self=this,$self=this;
  44031. return $core.withContext(function($ctx1) {
  44032. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44033. return $core.withContext(function($ctx2) {
  44034. return $self._localAt_ifAbsent_(each,(function(){
  44035. return $core.withContext(function($ctx3) {
  44036. return $self._error_("Argument not in context");
  44037. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44038. }));
  44039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44040. }));
  44041. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44042. },
  44043. args: [],
  44044. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44045. referencedClasses: [],
  44046. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44047. }),
  44048. $globals.AIContext);
  44049. $core.addMethod(
  44050. $core.method({
  44051. selector: "ast",
  44052. protocol: "interpreting",
  44053. fn: function (){
  44054. var self=this,$self=this;
  44055. return $core.withContext(function($ctx1) {
  44056. var $1,$2,$3,$receiver;
  44057. $1=$self._isBlockContext();
  44058. if($core.assert($1)){
  44059. $2=$self._outerContext();
  44060. if(($receiver = $2) == null || $receiver.a$nil){
  44061. return $2;
  44062. } else {
  44063. var context;
  44064. context=$receiver;
  44065. return $recv(context)._ast();
  44066. }
  44067. }
  44068. $3=$self["@ast"];
  44069. if(($receiver = $3) == null || $receiver.a$nil){
  44070. $self._initializeAST();
  44071. } else {
  44072. $3;
  44073. }
  44074. return $self["@ast"];
  44075. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44076. },
  44077. args: [],
  44078. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44079. referencedClasses: [],
  44080. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44081. }),
  44082. $globals.AIContext);
  44083. $core.addMethod(
  44084. $core.method({
  44085. selector: "basicLocalAt:",
  44086. protocol: "private",
  44087. fn: function (aString){
  44088. var self=this,$self=this;
  44089. return $core.withContext(function($ctx1) {
  44090. return $recv($self._locals())._at_(aString);
  44091. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44092. },
  44093. args: ["aString"],
  44094. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44095. referencedClasses: [],
  44096. messageSends: ["at:", "locals"]
  44097. }),
  44098. $globals.AIContext);
  44099. $core.addMethod(
  44100. $core.method({
  44101. selector: "basicLocalAt:put:",
  44102. protocol: "private",
  44103. fn: function (aString,anObject){
  44104. var self=this,$self=this;
  44105. return $core.withContext(function($ctx1) {
  44106. $recv($self._locals())._at_put_(aString,anObject);
  44107. return self;
  44108. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44109. },
  44110. args: ["aString", "anObject"],
  44111. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44112. referencedClasses: [],
  44113. messageSends: ["at:put:", "locals"]
  44114. }),
  44115. $globals.AIContext);
  44116. $core.addMethod(
  44117. $core.method({
  44118. selector: "basicReceiver",
  44119. protocol: "interpreting",
  44120. fn: function (){
  44121. var self=this,$self=this;
  44122. return $core.withContext(function($ctx1) {
  44123. return $self._localAt_("self");
  44124. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44125. },
  44126. args: [],
  44127. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44128. referencedClasses: [],
  44129. messageSends: ["localAt:"]
  44130. }),
  44131. $globals.AIContext);
  44132. $core.addMethod(
  44133. $core.method({
  44134. selector: "defineLocal:",
  44135. protocol: "accessing",
  44136. fn: function (aString){
  44137. var self=this,$self=this;
  44138. return $core.withContext(function($ctx1) {
  44139. $recv($self._locals())._at_put_(aString,nil);
  44140. return self;
  44141. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44142. },
  44143. args: ["aString"],
  44144. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44145. referencedClasses: [],
  44146. messageSends: ["at:put:", "locals"]
  44147. }),
  44148. $globals.AIContext);
  44149. $core.addMethod(
  44150. $core.method({
  44151. selector: "evaluate:on:",
  44152. protocol: "evaluating",
  44153. fn: function (aString,anEvaluator){
  44154. var self=this,$self=this;
  44155. return $core.withContext(function($ctx1) {
  44156. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44157. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44158. },
  44159. args: ["aString", "anEvaluator"],
  44160. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44161. referencedClasses: [],
  44162. messageSends: ["evaluate:context:"]
  44163. }),
  44164. $globals.AIContext);
  44165. $core.addMethod(
  44166. $core.method({
  44167. selector: "evaluateNode:",
  44168. protocol: "evaluating",
  44169. fn: function (aNode){
  44170. var self=this,$self=this;
  44171. return $core.withContext(function($ctx1) {
  44172. var $1;
  44173. $1=$recv($globals.ASTInterpreter)._new();
  44174. $recv($1)._context_(self);
  44175. $recv($1)._node_(aNode);
  44176. $recv($1)._enterNode();
  44177. $recv($1)._proceed();
  44178. return $recv($1)._result();
  44179. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44180. },
  44181. args: ["aNode"],
  44182. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44183. referencedClasses: ["ASTInterpreter"],
  44184. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44185. }),
  44186. $globals.AIContext);
  44187. $core.addMethod(
  44188. $core.method({
  44189. selector: "evaluatedSelector",
  44190. protocol: "accessing",
  44191. fn: function (){
  44192. var self=this,$self=this;
  44193. return $self["@evaluatedSelector"];
  44194. },
  44195. args: [],
  44196. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44197. referencedClasses: [],
  44198. messageSends: []
  44199. }),
  44200. $globals.AIContext);
  44201. $core.addMethod(
  44202. $core.method({
  44203. selector: "evaluatedSelector:",
  44204. protocol: "accessing",
  44205. fn: function (aString){
  44206. var self=this,$self=this;
  44207. $self["@evaluatedSelector"]=aString;
  44208. return self;
  44209. },
  44210. args: ["aString"],
  44211. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44212. referencedClasses: [],
  44213. messageSends: []
  44214. }),
  44215. $globals.AIContext);
  44216. $core.addMethod(
  44217. $core.method({
  44218. selector: "index",
  44219. protocol: "accessing",
  44220. fn: function (){
  44221. var self=this,$self=this;
  44222. return $core.withContext(function($ctx1) {
  44223. var $1,$receiver;
  44224. $1=$self["@index"];
  44225. if(($receiver = $1) == null || $receiver.a$nil){
  44226. return (0);
  44227. } else {
  44228. return $1;
  44229. }
  44230. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44231. },
  44232. args: [],
  44233. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44234. referencedClasses: [],
  44235. messageSends: ["ifNil:"]
  44236. }),
  44237. $globals.AIContext);
  44238. $core.addMethod(
  44239. $core.method({
  44240. selector: "index:",
  44241. protocol: "accessing",
  44242. fn: function (anInteger){
  44243. var self=this,$self=this;
  44244. $self["@index"]=anInteger;
  44245. return self;
  44246. },
  44247. args: ["anInteger"],
  44248. source: "index: anInteger\x0a\x09index := anInteger",
  44249. referencedClasses: [],
  44250. messageSends: []
  44251. }),
  44252. $globals.AIContext);
  44253. $core.addMethod(
  44254. $core.method({
  44255. selector: "initializeAST",
  44256. protocol: "initialization",
  44257. fn: function (){
  44258. var self=this,$self=this;
  44259. return $core.withContext(function($ctx1) {
  44260. var $1;
  44261. $1=$self._method();
  44262. $ctx1.sendIdx["method"]=1;
  44263. $self["@ast"]=$recv($1)._ast();
  44264. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44265. return self;
  44266. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44267. },
  44268. args: [],
  44269. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44270. referencedClasses: ["SemanticAnalyzer"],
  44271. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44272. }),
  44273. $globals.AIContext);
  44274. $core.addMethod(
  44275. $core.method({
  44276. selector: "initializeFromMethodContext:",
  44277. protocol: "initialization",
  44278. fn: function (aMethodContext){
  44279. var self=this,$self=this;
  44280. return $core.withContext(function($ctx1) {
  44281. var $1,$2,$3,$receiver;
  44282. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44283. $self._index_($recv(aMethodContext)._index());
  44284. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44285. $self._receiver_($recv(aMethodContext)._receiver());
  44286. $self._supercall_($recv(aMethodContext)._supercall());
  44287. $self._selector_($recv(aMethodContext)._selector());
  44288. $1=$recv(aMethodContext)._outerContext();
  44289. $ctx1.sendIdx["outerContext"]=1;
  44290. if(($receiver = $1) == null || $receiver.a$nil){
  44291. $1;
  44292. } else {
  44293. var outer;
  44294. outer=$receiver;
  44295. $2=$recv(outer)._methodContext();
  44296. if(($receiver = $2) == null || $receiver.a$nil){
  44297. $2;
  44298. } else {
  44299. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44300. }
  44301. $3=$recv(aMethodContext)._locals();
  44302. $ctx1.sendIdx["locals"]=1;
  44303. $recv($3)._keysAndValuesDo_((function(key,value){
  44304. return $core.withContext(function($ctx2) {
  44305. return $recv($self._locals())._at_put_(key,value);
  44306. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44307. }));
  44308. }
  44309. return self;
  44310. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44311. },
  44312. args: ["aMethodContext"],
  44313. 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 ] ]",
  44314. referencedClasses: [],
  44315. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44316. }),
  44317. $globals.AIContext);
  44318. $core.addMethod(
  44319. $core.method({
  44320. selector: "initializeInterpreter",
  44321. protocol: "initialization",
  44322. fn: function (){
  44323. var self=this,$self=this;
  44324. return $core.withContext(function($ctx1) {
  44325. var $1,$2,$receiver;
  44326. $1=$recv($globals.ASTInterpreter)._new();
  44327. $recv($1)._context_(self);
  44328. $self["@interpreter"]=$recv($1)._yourself();
  44329. $2=$self._innerContext();
  44330. if(($receiver = $2) == null || $receiver.a$nil){
  44331. $2;
  44332. } else {
  44333. $self._setupInterpreter_($self["@interpreter"]);
  44334. }
  44335. return self;
  44336. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44337. },
  44338. args: [],
  44339. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44340. referencedClasses: ["ASTInterpreter"],
  44341. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44342. }),
  44343. $globals.AIContext);
  44344. $core.addMethod(
  44345. $core.method({
  44346. selector: "initializeLocals",
  44347. protocol: "initialization",
  44348. fn: function (){
  44349. var self=this,$self=this;
  44350. return $core.withContext(function($ctx1) {
  44351. $self["@locals"]=$recv($globals.Dictionary)._new();
  44352. $recv($self["@locals"])._at_put_("thisContext",self);
  44353. return self;
  44354. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44355. },
  44356. args: [],
  44357. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44358. referencedClasses: ["Dictionary"],
  44359. messageSends: ["new", "at:put:"]
  44360. }),
  44361. $globals.AIContext);
  44362. $core.addMethod(
  44363. $core.method({
  44364. selector: "innerContext",
  44365. protocol: "accessing",
  44366. fn: function (){
  44367. var self=this,$self=this;
  44368. return $self["@innerContext"];
  44369. },
  44370. args: [],
  44371. source: "innerContext\x0a\x09^ innerContext",
  44372. referencedClasses: [],
  44373. messageSends: []
  44374. }),
  44375. $globals.AIContext);
  44376. $core.addMethod(
  44377. $core.method({
  44378. selector: "innerContext:",
  44379. protocol: "accessing",
  44380. fn: function (anAIContext){
  44381. var self=this,$self=this;
  44382. $self["@innerContext"]=anAIContext;
  44383. return self;
  44384. },
  44385. args: ["anAIContext"],
  44386. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44387. referencedClasses: [],
  44388. messageSends: []
  44389. }),
  44390. $globals.AIContext);
  44391. $core.addMethod(
  44392. $core.method({
  44393. selector: "interpreter",
  44394. protocol: "interpreting",
  44395. fn: function (){
  44396. var self=this,$self=this;
  44397. return $core.withContext(function($ctx1) {
  44398. var $1,$receiver;
  44399. $1=$self["@interpreter"];
  44400. if(($receiver = $1) == null || $receiver.a$nil){
  44401. $self._initializeInterpreter();
  44402. } else {
  44403. $1;
  44404. }
  44405. return $self["@interpreter"];
  44406. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44407. },
  44408. args: [],
  44409. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44410. referencedClasses: [],
  44411. messageSends: ["ifNil:", "initializeInterpreter"]
  44412. }),
  44413. $globals.AIContext);
  44414. $core.addMethod(
  44415. $core.method({
  44416. selector: "interpreter:",
  44417. protocol: "interpreting",
  44418. fn: function (anInterpreter){
  44419. var self=this,$self=this;
  44420. $self["@interpreter"]=anInterpreter;
  44421. return self;
  44422. },
  44423. args: ["anInterpreter"],
  44424. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44425. referencedClasses: [],
  44426. messageSends: []
  44427. }),
  44428. $globals.AIContext);
  44429. $core.addMethod(
  44430. $core.method({
  44431. selector: "isTopContext",
  44432. protocol: "testing",
  44433. fn: function (){
  44434. var self=this,$self=this;
  44435. return $core.withContext(function($ctx1) {
  44436. return $recv($self._innerContext())._isNil();
  44437. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44438. },
  44439. args: [],
  44440. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44441. referencedClasses: [],
  44442. messageSends: ["isNil", "innerContext"]
  44443. }),
  44444. $globals.AIContext);
  44445. $core.addMethod(
  44446. $core.method({
  44447. selector: "localAt:",
  44448. protocol: "accessing",
  44449. fn: function (aString){
  44450. var self=this,$self=this;
  44451. var context;
  44452. return $core.withContext(function($ctx1) {
  44453. context=$self._lookupContextForLocal_(aString);
  44454. return $recv(context)._basicLocalAt_(aString);
  44455. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44456. },
  44457. args: ["aString"],
  44458. 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",
  44459. referencedClasses: [],
  44460. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44461. }),
  44462. $globals.AIContext);
  44463. $core.addMethod(
  44464. $core.method({
  44465. selector: "localAt:ifAbsent:",
  44466. protocol: "accessing",
  44467. fn: function (aString,aBlock){
  44468. var self=this,$self=this;
  44469. var context;
  44470. return $core.withContext(function($ctx1) {
  44471. var $early={};
  44472. try {
  44473. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44474. return $core.withContext(function($ctx2) {
  44475. throw $early=[$recv(aBlock)._value()];
  44476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44477. }));
  44478. return $recv(context)._basicLocalAt_(aString);
  44479. }
  44480. catch(e) {if(e===$early)return e[0]; throw e}
  44481. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  44482. },
  44483. args: ["aString", "aBlock"],
  44484. 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",
  44485. referencedClasses: [],
  44486. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  44487. }),
  44488. $globals.AIContext);
  44489. $core.addMethod(
  44490. $core.method({
  44491. selector: "localAt:put:",
  44492. protocol: "accessing",
  44493. fn: function (aString,anObject){
  44494. var self=this,$self=this;
  44495. var context;
  44496. return $core.withContext(function($ctx1) {
  44497. context=$self._lookupContextForLocal_(aString);
  44498. $recv(context)._basicLocalAt_put_(aString,anObject);
  44499. return self;
  44500. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  44501. },
  44502. args: ["aString", "anObject"],
  44503. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  44504. referencedClasses: [],
  44505. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  44506. }),
  44507. $globals.AIContext);
  44508. $core.addMethod(
  44509. $core.method({
  44510. selector: "locals",
  44511. protocol: "accessing",
  44512. fn: function (){
  44513. var self=this,$self=this;
  44514. return $core.withContext(function($ctx1) {
  44515. var $1,$receiver;
  44516. $1=$self["@locals"];
  44517. if(($receiver = $1) == null || $receiver.a$nil){
  44518. $self._initializeLocals();
  44519. } else {
  44520. $1;
  44521. }
  44522. return $self["@locals"];
  44523. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  44524. },
  44525. args: [],
  44526. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  44527. referencedClasses: [],
  44528. messageSends: ["ifNil:", "initializeLocals"]
  44529. }),
  44530. $globals.AIContext);
  44531. $core.addMethod(
  44532. $core.method({
  44533. selector: "lookupContextForLocal:",
  44534. protocol: "private",
  44535. fn: function (aString){
  44536. var self=this,$self=this;
  44537. return $core.withContext(function($ctx1) {
  44538. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  44539. return $core.withContext(function($ctx2) {
  44540. return $self._variableNotFound();
  44541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44542. }));
  44543. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  44544. },
  44545. args: ["aString"],
  44546. 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 ]",
  44547. referencedClasses: [],
  44548. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  44549. }),
  44550. $globals.AIContext);
  44551. $core.addMethod(
  44552. $core.method({
  44553. selector: "lookupContextForLocal:ifNone:",
  44554. protocol: "private",
  44555. fn: function (aString,aBlock){
  44556. var self=this,$self=this;
  44557. return $core.withContext(function($ctx1) {
  44558. var $1;
  44559. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  44560. return self;
  44561. }),(function(){
  44562. return $core.withContext(function($ctx2) {
  44563. $1=$self._outerContext();
  44564. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  44565. return $core.withContext(function($ctx3) {
  44566. return $recv(context)._lookupContextForLocal_(aString);
  44567. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  44568. }));
  44569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44570. }));
  44571. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  44572. },
  44573. args: ["aString", "aBlock"],
  44574. 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 ] ]",
  44575. referencedClasses: [],
  44576. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  44577. }),
  44578. $globals.AIContext);
  44579. $core.addMethod(
  44580. $core.method({
  44581. selector: "newInnerContext",
  44582. protocol: "factory",
  44583. fn: function (){
  44584. var self=this,$self=this;
  44585. return $core.withContext(function($ctx1) {
  44586. var $1;
  44587. $1=$recv($self._class())._new();
  44588. $recv($1)._outerContext_(self);
  44589. return $recv($1)._yourself();
  44590. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  44591. },
  44592. args: [],
  44593. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  44594. referencedClasses: [],
  44595. messageSends: ["outerContext:", "new", "class", "yourself"]
  44596. }),
  44597. $globals.AIContext);
  44598. $core.addMethod(
  44599. $core.method({
  44600. selector: "outerContext",
  44601. protocol: "accessing",
  44602. fn: function (){
  44603. var self=this,$self=this;
  44604. return $self["@outerContext"];
  44605. },
  44606. args: [],
  44607. source: "outerContext\x0a\x09^ outerContext",
  44608. referencedClasses: [],
  44609. messageSends: []
  44610. }),
  44611. $globals.AIContext);
  44612. $core.addMethod(
  44613. $core.method({
  44614. selector: "outerContext:",
  44615. protocol: "accessing",
  44616. fn: function (anAIContext){
  44617. var self=this,$self=this;
  44618. return $core.withContext(function($ctx1) {
  44619. var $1,$receiver;
  44620. $self["@outerContext"]=anAIContext;
  44621. $1=$self["@outerContext"];
  44622. if(($receiver = $1) == null || $receiver.a$nil){
  44623. $1;
  44624. } else {
  44625. var context;
  44626. context=$receiver;
  44627. $recv(context)._innerContext_(self);
  44628. }
  44629. return self;
  44630. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  44631. },
  44632. args: ["anAIContext"],
  44633. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  44634. referencedClasses: [],
  44635. messageSends: ["ifNotNil:", "innerContext:"]
  44636. }),
  44637. $globals.AIContext);
  44638. $core.addMethod(
  44639. $core.method({
  44640. selector: "receiver:",
  44641. protocol: "interpreting",
  44642. fn: function (anObject){
  44643. var self=this,$self=this;
  44644. return $core.withContext(function($ctx1) {
  44645. $recv($self._locals())._at_put_("self",anObject);
  44646. return self;
  44647. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  44648. },
  44649. args: ["anObject"],
  44650. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  44651. referencedClasses: [],
  44652. messageSends: ["at:put:", "locals"]
  44653. }),
  44654. $globals.AIContext);
  44655. $core.addMethod(
  44656. $core.method({
  44657. selector: "selector",
  44658. protocol: "accessing",
  44659. fn: function (){
  44660. var self=this,$self=this;
  44661. return $self["@selector"];
  44662. },
  44663. args: [],
  44664. source: "selector\x0a\x09^ selector",
  44665. referencedClasses: [],
  44666. messageSends: []
  44667. }),
  44668. $globals.AIContext);
  44669. $core.addMethod(
  44670. $core.method({
  44671. selector: "selector:",
  44672. protocol: "accessing",
  44673. fn: function (aString){
  44674. var self=this,$self=this;
  44675. $self["@selector"]=aString;
  44676. return self;
  44677. },
  44678. args: ["aString"],
  44679. source: "selector: aString\x0a\x09selector := aString",
  44680. referencedClasses: [],
  44681. messageSends: []
  44682. }),
  44683. $globals.AIContext);
  44684. $core.addMethod(
  44685. $core.method({
  44686. selector: "sendIndexAt:",
  44687. protocol: "accessing",
  44688. fn: function (aString){
  44689. var self=this,$self=this;
  44690. return $core.withContext(function($ctx1) {
  44691. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  44692. return (0);
  44693. }));
  44694. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  44695. },
  44696. args: ["aString"],
  44697. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  44698. referencedClasses: [],
  44699. messageSends: ["at:ifAbsent:", "sendIndexes"]
  44700. }),
  44701. $globals.AIContext);
  44702. $core.addMethod(
  44703. $core.method({
  44704. selector: "sendIndexes",
  44705. protocol: "accessing",
  44706. fn: function (){
  44707. var self=this,$self=this;
  44708. return $core.withContext(function($ctx1) {
  44709. var $1,$receiver;
  44710. $1=$self["@sendIndexes"];
  44711. if(($receiver = $1) == null || $receiver.a$nil){
  44712. return $recv($globals.Dictionary)._new();
  44713. } else {
  44714. return $1;
  44715. }
  44716. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  44717. },
  44718. args: [],
  44719. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  44720. referencedClasses: ["Dictionary"],
  44721. messageSends: ["ifNil:", "new"]
  44722. }),
  44723. $globals.AIContext);
  44724. $core.addMethod(
  44725. $core.method({
  44726. selector: "sendIndexes:",
  44727. protocol: "accessing",
  44728. fn: function (aDictionary){
  44729. var self=this,$self=this;
  44730. $self["@sendIndexes"]=aDictionary;
  44731. return self;
  44732. },
  44733. args: ["aDictionary"],
  44734. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  44735. referencedClasses: [],
  44736. messageSends: []
  44737. }),
  44738. $globals.AIContext);
  44739. $core.addMethod(
  44740. $core.method({
  44741. selector: "setupInterpreter:",
  44742. protocol: "interpreting",
  44743. fn: function (anInterpreter){
  44744. var self=this,$self=this;
  44745. var currentNode;
  44746. return $core.withContext(function($ctx1) {
  44747. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  44748. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44749. $2=$self._evaluatedSelector();
  44750. $ctx1.sendIdx["evaluatedSelector"]=1;
  44751. $recv($1)._selector_($2);
  44752. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  44753. $3=$self._ast();
  44754. $ctx1.sendIdx["ast"]=1;
  44755. $recv($1)._visit_($3);
  44756. currentNode=$recv($1)._currentNode();
  44757. $4=$recv($self._ast())._sequenceNode();
  44758. if(($receiver = $4) == null || $receiver.a$nil){
  44759. $4;
  44760. } else {
  44761. var sequence;
  44762. sequence=$receiver;
  44763. $recv($recv(sequence)._temps())._do_((function(each){
  44764. return $core.withContext(function($ctx2) {
  44765. return $self._defineLocal_(each);
  44766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44767. }));
  44768. $ctx1.sendIdx["do:"]=1;
  44769. }
  44770. $recv(anInterpreter)._node_(currentNode);
  44771. $7=$self._innerContext();
  44772. $ctx1.sendIdx["innerContext"]=1;
  44773. $6=$recv($7)._arguments();
  44774. $5=$recv($6)._reversed();
  44775. $recv($5)._do_((function(each){
  44776. return $core.withContext(function($ctx2) {
  44777. return $recv(anInterpreter)._push_(each);
  44778. $ctx2.sendIdx["push:"]=1;
  44779. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  44780. }));
  44781. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  44782. return self;
  44783. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  44784. },
  44785. args: ["anInterpreter"],
  44786. 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)",
  44787. referencedClasses: ["ASTPCNodeVisitor"],
  44788. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  44789. }),
  44790. $globals.AIContext);
  44791. $core.addMethod(
  44792. $core.method({
  44793. selector: "supercall",
  44794. protocol: "interpreting",
  44795. fn: function (){
  44796. var self=this,$self=this;
  44797. return $core.withContext(function($ctx1) {
  44798. var $1,$receiver;
  44799. $1=$self["@supercall"];
  44800. if(($receiver = $1) == null || $receiver.a$nil){
  44801. return false;
  44802. } else {
  44803. return $1;
  44804. }
  44805. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  44806. },
  44807. args: [],
  44808. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  44809. referencedClasses: [],
  44810. messageSends: ["ifNil:"]
  44811. }),
  44812. $globals.AIContext);
  44813. $core.addMethod(
  44814. $core.method({
  44815. selector: "supercall:",
  44816. protocol: "interpreting",
  44817. fn: function (aBoolean){
  44818. var self=this,$self=this;
  44819. $self["@supercall"]=aBoolean;
  44820. return self;
  44821. },
  44822. args: ["aBoolean"],
  44823. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  44824. referencedClasses: [],
  44825. messageSends: []
  44826. }),
  44827. $globals.AIContext);
  44828. $core.addMethod(
  44829. $core.method({
  44830. selector: "variableNotFound",
  44831. protocol: "error handling",
  44832. fn: function (){
  44833. var self=this,$self=this;
  44834. return $core.withContext(function($ctx1) {
  44835. $self._error_("Variable missing");
  44836. return self;
  44837. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  44838. },
  44839. args: [],
  44840. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  44841. referencedClasses: [],
  44842. messageSends: ["error:"]
  44843. }),
  44844. $globals.AIContext);
  44845. $core.addMethod(
  44846. $core.method({
  44847. selector: "fromMethodContext:",
  44848. protocol: "instance creation",
  44849. fn: function (aMethodContext){
  44850. var self=this,$self=this;
  44851. return $core.withContext(function($ctx1) {
  44852. var $1;
  44853. $1=$self._new();
  44854. $recv($1)._initializeFromMethodContext_(aMethodContext);
  44855. return $recv($1)._yourself();
  44856. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  44857. },
  44858. args: ["aMethodContext"],
  44859. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  44860. referencedClasses: [],
  44861. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  44862. }),
  44863. $globals.AIContext.a$cls);
  44864. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  44865. $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.";
  44866. $core.addMethod(
  44867. $core.method({
  44868. selector: "context",
  44869. protocol: "accessing",
  44870. fn: function (){
  44871. var self=this,$self=this;
  44872. return $self["@context"];
  44873. },
  44874. args: [],
  44875. source: "context\x0a\x09^ context",
  44876. referencedClasses: [],
  44877. messageSends: []
  44878. }),
  44879. $globals.AISemanticAnalyzer);
  44880. $core.addMethod(
  44881. $core.method({
  44882. selector: "context:",
  44883. protocol: "accessing",
  44884. fn: function (anAIContext){
  44885. var self=this,$self=this;
  44886. $self["@context"]=anAIContext;
  44887. return self;
  44888. },
  44889. args: ["anAIContext"],
  44890. source: "context: anAIContext\x0a\x09context := anAIContext",
  44891. referencedClasses: [],
  44892. messageSends: []
  44893. }),
  44894. $globals.AISemanticAnalyzer);
  44895. $core.addMethod(
  44896. $core.method({
  44897. selector: "visitVariableNode:",
  44898. protocol: "visiting",
  44899. fn: function (aNode){
  44900. var self=this,$self=this;
  44901. return $core.withContext(function($ctx1) {
  44902. var $1;
  44903. var $early={};
  44904. try {
  44905. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  44906. return $core.withContext(function($ctx2) {
  44907. $1=(
  44908. $ctx2.supercall = true,
  44909. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  44910. $ctx2.supercall = false;
  44911. throw $early=[$1];
  44912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44913. }));
  44914. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  44915. return self;
  44916. }
  44917. catch(e) {if(e===$early)return e[0]; throw e}
  44918. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  44919. },
  44920. args: ["aNode"],
  44921. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  44922. referencedClasses: ["ASTContextVar"],
  44923. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  44924. }),
  44925. $globals.AISemanticAnalyzer);
  44926. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  44927. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  44928. $core.addMethod(
  44929. $core.method({
  44930. selector: "context",
  44931. protocol: "accessing",
  44932. fn: function (){
  44933. var self=this,$self=this;
  44934. return $self["@context"];
  44935. },
  44936. args: [],
  44937. source: "context\x0a\x09^ context",
  44938. referencedClasses: [],
  44939. messageSends: []
  44940. }),
  44941. $globals.ASTContextVar);
  44942. $core.addMethod(
  44943. $core.method({
  44944. selector: "context:",
  44945. protocol: "accessing",
  44946. fn: function (anObject){
  44947. var self=this,$self=this;
  44948. $self["@context"]=anObject;
  44949. return self;
  44950. },
  44951. args: ["anObject"],
  44952. source: "context: anObject\x0a\x09context := anObject",
  44953. referencedClasses: [],
  44954. messageSends: []
  44955. }),
  44956. $globals.ASTContextVar);
  44957. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  44958. $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.";
  44959. $core.addMethod(
  44960. $core.method({
  44961. selector: "atEnd",
  44962. protocol: "testing",
  44963. fn: function (){
  44964. var self=this,$self=this;
  44965. return $core.withContext(function($ctx1) {
  44966. var $1,$receiver;
  44967. $1=$self._context();
  44968. $ctx1.sendIdx["context"]=1;
  44969. if(($receiver = $1) == null || $receiver.a$nil){
  44970. return true;
  44971. } else {
  44972. $1;
  44973. }
  44974. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  44975. return $core.withContext(function($ctx2) {
  44976. return $recv($self._context())._isTopContext();
  44977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44978. }));
  44979. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  44980. },
  44981. args: [],
  44982. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  44983. referencedClasses: [],
  44984. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  44985. }),
  44986. $globals.ASTDebugger);
  44987. $core.addMethod(
  44988. $core.method({
  44989. selector: "context",
  44990. protocol: "accessing",
  44991. fn: function (){
  44992. var self=this,$self=this;
  44993. return $self["@context"];
  44994. },
  44995. args: [],
  44996. source: "context\x0a\x09^ context",
  44997. referencedClasses: [],
  44998. messageSends: []
  44999. }),
  45000. $globals.ASTDebugger);
  45001. $core.addMethod(
  45002. $core.method({
  45003. selector: "context:",
  45004. protocol: "accessing",
  45005. fn: function (aContext){
  45006. var self=this,$self=this;
  45007. $self["@context"]=aContext;
  45008. return self;
  45009. },
  45010. args: ["aContext"],
  45011. source: "context: aContext\x0a\x09context := aContext",
  45012. referencedClasses: [],
  45013. messageSends: []
  45014. }),
  45015. $globals.ASTDebugger);
  45016. $core.addMethod(
  45017. $core.method({
  45018. selector: "flushInnerContexts",
  45019. protocol: "actions",
  45020. fn: function (){
  45021. var self=this,$self=this;
  45022. return $core.withContext(function($ctx1) {
  45023. var $1,$receiver;
  45024. $1=$self._context();
  45025. if(($receiver = $1) == null || $receiver.a$nil){
  45026. $1;
  45027. } else {
  45028. var cxt;
  45029. cxt=$receiver;
  45030. $recv(cxt)._innerContext_(nil);
  45031. }
  45032. return self;
  45033. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45034. },
  45035. args: [],
  45036. 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 ]",
  45037. referencedClasses: [],
  45038. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45039. }),
  45040. $globals.ASTDebugger);
  45041. $core.addMethod(
  45042. $core.method({
  45043. selector: "interpreter",
  45044. protocol: "accessing",
  45045. fn: function (){
  45046. var self=this,$self=this;
  45047. return $core.withContext(function($ctx1) {
  45048. var $1,$receiver;
  45049. $1=$self._context();
  45050. if(($receiver = $1) == null || $receiver.a$nil){
  45051. return $1;
  45052. } else {
  45053. var ctx;
  45054. ctx=$receiver;
  45055. return $recv(ctx)._interpreter();
  45056. }
  45057. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45058. },
  45059. args: [],
  45060. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45061. referencedClasses: [],
  45062. messageSends: ["ifNotNil:", "context", "interpreter"]
  45063. }),
  45064. $globals.ASTDebugger);
  45065. $core.addMethod(
  45066. $core.method({
  45067. selector: "method",
  45068. protocol: "accessing",
  45069. fn: function (){
  45070. var self=this,$self=this;
  45071. return $core.withContext(function($ctx1) {
  45072. return $recv($self._context())._method();
  45073. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45074. },
  45075. args: [],
  45076. source: "method\x0a\x09^ self context method",
  45077. referencedClasses: [],
  45078. messageSends: ["method", "context"]
  45079. }),
  45080. $globals.ASTDebugger);
  45081. $core.addMethod(
  45082. $core.method({
  45083. selector: "node",
  45084. protocol: "accessing",
  45085. fn: function (){
  45086. var self=this,$self=this;
  45087. return $core.withContext(function($ctx1) {
  45088. var $1,$receiver;
  45089. $1=$self._interpreter();
  45090. $ctx1.sendIdx["interpreter"]=1;
  45091. if(($receiver = $1) == null || $receiver.a$nil){
  45092. return $1;
  45093. } else {
  45094. return $recv($self._interpreter())._node();
  45095. }
  45096. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45097. },
  45098. args: [],
  45099. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45100. referencedClasses: [],
  45101. messageSends: ["ifNotNil:", "interpreter", "node"]
  45102. }),
  45103. $globals.ASTDebugger);
  45104. $core.addMethod(
  45105. $core.method({
  45106. selector: "onStep",
  45107. protocol: "private",
  45108. fn: function (){
  45109. var self=this,$self=this;
  45110. return $core.withContext(function($ctx1) {
  45111. var $1,$3,$2,$4,$6,$5,$receiver;
  45112. $1=$self._interpreter();
  45113. $ctx1.sendIdx["interpreter"]=1;
  45114. $self["@result"]=$recv($1)._result();
  45115. $3=$self._interpreter();
  45116. $ctx1.sendIdx["interpreter"]=2;
  45117. $2=$recv($3)._atEnd();
  45118. $ctx1.sendIdx["atEnd"]=1;
  45119. if($core.assert($2)){
  45120. $4=$recv($self._context())._outerContext();
  45121. if(($receiver = $4) == null || $receiver.a$nil){
  45122. $4;
  45123. } else {
  45124. var outerContext;
  45125. outerContext=$receiver;
  45126. $self._context_(outerContext);
  45127. }
  45128. $6=$self._interpreter();
  45129. $ctx1.sendIdx["interpreter"]=3;
  45130. $5=$recv($6)._atEnd();
  45131. if(!$core.assert($5)){
  45132. $recv($self._interpreter())._skip();
  45133. }
  45134. }
  45135. $self._flushInnerContexts();
  45136. return self;
  45137. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45138. },
  45139. args: [],
  45140. 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",
  45141. referencedClasses: [],
  45142. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45143. }),
  45144. $globals.ASTDebugger);
  45145. $core.addMethod(
  45146. $core.method({
  45147. selector: "proceed",
  45148. protocol: "stepping",
  45149. fn: function (){
  45150. var self=this,$self=this;
  45151. return $core.withContext(function($ctx1) {
  45152. $recv((function(){
  45153. return $core.withContext(function($ctx2) {
  45154. return $self._atEnd();
  45155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45156. }))._whileFalse_((function(){
  45157. return $core.withContext(function($ctx2) {
  45158. return $self._stepOver();
  45159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45160. }));
  45161. return self;
  45162. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45163. },
  45164. args: [],
  45165. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45166. referencedClasses: [],
  45167. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45168. }),
  45169. $globals.ASTDebugger);
  45170. $core.addMethod(
  45171. $core.method({
  45172. selector: "restart",
  45173. protocol: "stepping",
  45174. fn: function (){
  45175. var self=this,$self=this;
  45176. return $core.withContext(function($ctx1) {
  45177. $recv($self._interpreter())._restart();
  45178. $self._flushInnerContexts();
  45179. return self;
  45180. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45181. },
  45182. args: [],
  45183. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45184. referencedClasses: [],
  45185. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45186. }),
  45187. $globals.ASTDebugger);
  45188. $core.addMethod(
  45189. $core.method({
  45190. selector: "result",
  45191. protocol: "accessing",
  45192. fn: function (){
  45193. var self=this,$self=this;
  45194. return $self["@result"];
  45195. },
  45196. args: [],
  45197. source: "result\x0a\x09^ result",
  45198. referencedClasses: [],
  45199. messageSends: []
  45200. }),
  45201. $globals.ASTDebugger);
  45202. $core.addMethod(
  45203. $core.method({
  45204. selector: "stepInto",
  45205. protocol: "stepping",
  45206. fn: function (){
  45207. var self=this,$self=this;
  45208. return $core.withContext(function($ctx1) {
  45209. $self._shouldBeImplemented();
  45210. return self;
  45211. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45212. },
  45213. args: [],
  45214. source: "stepInto\x0a\x09self shouldBeImplemented",
  45215. referencedClasses: [],
  45216. messageSends: ["shouldBeImplemented"]
  45217. }),
  45218. $globals.ASTDebugger);
  45219. $core.addMethod(
  45220. $core.method({
  45221. selector: "stepOver",
  45222. protocol: "stepping",
  45223. fn: function (){
  45224. var self=this,$self=this;
  45225. return $core.withContext(function($ctx1) {
  45226. var $1,$2;
  45227. $1=$recv($self._context())._isTopContext();
  45228. if($core.assert($1)){
  45229. $recv($self._interpreter())._stepOver();
  45230. } else {
  45231. $2=$self._interpreter();
  45232. $ctx1.sendIdx["interpreter"]=1;
  45233. $recv($2)._skip();
  45234. }
  45235. $self._onStep();
  45236. return self;
  45237. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45238. },
  45239. args: [],
  45240. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45241. referencedClasses: [],
  45242. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45243. }),
  45244. $globals.ASTDebugger);
  45245. $core.addMethod(
  45246. $core.method({
  45247. selector: "context:",
  45248. protocol: "instance creation",
  45249. fn: function (aContext){
  45250. var self=this,$self=this;
  45251. return $core.withContext(function($ctx1) {
  45252. var $1;
  45253. $1=$self._new();
  45254. $recv($1)._context_(aContext);
  45255. return $recv($1)._yourself();
  45256. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45257. },
  45258. args: ["aContext"],
  45259. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45260. referencedClasses: [],
  45261. messageSends: ["context:", "new", "yourself"]
  45262. }),
  45263. $globals.ASTDebugger.a$cls);
  45264. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45265. $core.addMethod(
  45266. $core.method({
  45267. selector: "interpreter",
  45268. protocol: "accessing",
  45269. fn: function (){
  45270. var self=this,$self=this;
  45271. return $self["@interpreter"];
  45272. },
  45273. args: [],
  45274. source: "interpreter\x0a\x09^ interpreter",
  45275. referencedClasses: [],
  45276. messageSends: []
  45277. }),
  45278. $globals.ASTEnterNode);
  45279. $core.addMethod(
  45280. $core.method({
  45281. selector: "interpreter:",
  45282. protocol: "accessing",
  45283. fn: function (anObject){
  45284. var self=this,$self=this;
  45285. $self["@interpreter"]=anObject;
  45286. return self;
  45287. },
  45288. args: ["anObject"],
  45289. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45290. referencedClasses: [],
  45291. messageSends: []
  45292. }),
  45293. $globals.ASTEnterNode);
  45294. $core.addMethod(
  45295. $core.method({
  45296. selector: "visitBlockNode:",
  45297. protocol: "visiting",
  45298. fn: function (aNode){
  45299. var self=this,$self=this;
  45300. return aNode;
  45301. },
  45302. args: ["aNode"],
  45303. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45304. referencedClasses: [],
  45305. messageSends: []
  45306. }),
  45307. $globals.ASTEnterNode);
  45308. $core.addMethod(
  45309. $core.method({
  45310. selector: "visitDagNode:",
  45311. protocol: "visiting",
  45312. fn: function (aNode){
  45313. var self=this,$self=this;
  45314. return $core.withContext(function($ctx1) {
  45315. var $early={};
  45316. try {
  45317. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45318. throw $early=[aNode];
  45319. }),(function(nodes){
  45320. return $core.withContext(function($ctx2) {
  45321. throw $early=[$self._visit_($recv(nodes)._first())];
  45322. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45323. }));
  45324. return self;
  45325. }
  45326. catch(e) {if(e===$early)return e[0]; throw e}
  45327. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45328. },
  45329. args: ["aNode"],
  45330. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45331. referencedClasses: [],
  45332. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45333. }),
  45334. $globals.ASTEnterNode);
  45335. $core.addMethod(
  45336. $core.method({
  45337. selector: "visitSequenceNode:",
  45338. protocol: "visiting",
  45339. fn: function (aNode){
  45340. var self=this,$self=this;
  45341. return $core.withContext(function($ctx1) {
  45342. var $1;
  45343. $recv($recv(aNode)._temps())._do_((function(each){
  45344. return $core.withContext(function($ctx2) {
  45345. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45346. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45347. }));
  45348. $1=(
  45349. $ctx1.supercall = true,
  45350. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45351. $ctx1.supercall = false;
  45352. return $1;
  45353. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45354. },
  45355. args: ["aNode"],
  45356. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45357. referencedClasses: [],
  45358. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45359. }),
  45360. $globals.ASTEnterNode);
  45361. $core.addMethod(
  45362. $core.method({
  45363. selector: "on:",
  45364. protocol: "instance creation",
  45365. fn: function (anInterpreter){
  45366. var self=this,$self=this;
  45367. return $core.withContext(function($ctx1) {
  45368. var $1;
  45369. $1=$self._new();
  45370. $recv($1)._interpreter_(anInterpreter);
  45371. return $recv($1)._yourself();
  45372. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45373. },
  45374. args: ["anInterpreter"],
  45375. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45376. referencedClasses: [],
  45377. messageSends: ["interpreter:", "new", "yourself"]
  45378. }),
  45379. $globals.ASTEnterNode.a$cls);
  45380. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45381. $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";
  45382. $core.addMethod(
  45383. $core.method({
  45384. selector: "assign:to:",
  45385. protocol: "private",
  45386. fn: function (aNode,anObject){
  45387. var self=this,$self=this;
  45388. return $core.withContext(function($ctx1) {
  45389. var $1,$3,$2,$4;
  45390. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45391. if($core.assert($1)){
  45392. $3=$self._context();
  45393. $ctx1.sendIdx["context"]=1;
  45394. $2=$recv($3)._receiver();
  45395. $4=$recv(aNode)._value();
  45396. $ctx1.sendIdx["value"]=1;
  45397. $recv($2)._instVarAt_put_($4,anObject);
  45398. } else {
  45399. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45400. }
  45401. return self;
  45402. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45403. },
  45404. args: ["aNode", "anObject"],
  45405. 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 ]",
  45406. referencedClasses: [],
  45407. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45408. }),
  45409. $globals.ASTInterpreter);
  45410. $core.addMethod(
  45411. $core.method({
  45412. selector: "atEnd",
  45413. protocol: "testing",
  45414. fn: function (){
  45415. var self=this,$self=this;
  45416. return $core.withContext(function($ctx1) {
  45417. var $1;
  45418. $1=$self["@forceAtEnd"];
  45419. if($core.assert($1)){
  45420. return true;
  45421. }
  45422. return $recv($self._hasReturned())._or_((function(){
  45423. return $core.withContext(function($ctx2) {
  45424. return $recv($self._node())._isNil();
  45425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45426. }));
  45427. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45428. },
  45429. args: [],
  45430. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45431. referencedClasses: [],
  45432. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45433. }),
  45434. $globals.ASTInterpreter);
  45435. $core.addMethod(
  45436. $core.method({
  45437. selector: "context",
  45438. protocol: "accessing",
  45439. fn: function (){
  45440. var self=this,$self=this;
  45441. return $self["@context"];
  45442. },
  45443. args: [],
  45444. source: "context\x0a\x09^ context",
  45445. referencedClasses: [],
  45446. messageSends: []
  45447. }),
  45448. $globals.ASTInterpreter);
  45449. $core.addMethod(
  45450. $core.method({
  45451. selector: "context:",
  45452. protocol: "accessing",
  45453. fn: function (aContext){
  45454. var self=this,$self=this;
  45455. $self["@context"]=aContext;
  45456. return self;
  45457. },
  45458. args: ["aContext"],
  45459. source: "context: aContext\x0a\x09context := aContext",
  45460. referencedClasses: [],
  45461. messageSends: []
  45462. }),
  45463. $globals.ASTInterpreter);
  45464. $core.addMethod(
  45465. $core.method({
  45466. selector: "enterNode",
  45467. protocol: "interpreting",
  45468. fn: function (){
  45469. var self=this,$self=this;
  45470. return $core.withContext(function($ctx1) {
  45471. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45472. return self;
  45473. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45474. },
  45475. args: [],
  45476. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45477. referencedClasses: ["ASTEnterNode"],
  45478. messageSends: ["node:", "visit:", "on:", "node"]
  45479. }),
  45480. $globals.ASTInterpreter);
  45481. $core.addMethod(
  45482. $core.method({
  45483. selector: "eval:",
  45484. protocol: "private",
  45485. fn: function (aString){
  45486. var self=this,$self=this;
  45487. var source,function_;
  45488. return $core.withContext(function($ctx1) {
  45489. var $3,$2,$1;
  45490. source=$recv($globals.String)._streamContents_((function(str){
  45491. return $core.withContext(function($ctx2) {
  45492. $recv(str)._nextPutAll_("0,(function(");
  45493. $ctx2.sendIdx["nextPutAll:"]=1;
  45494. $3=$self._context();
  45495. $ctx2.sendIdx["context"]=1;
  45496. $2=$recv($3)._locals();
  45497. $ctx2.sendIdx["locals"]=1;
  45498. $1=$recv($2)._keys();
  45499. $recv($1)._do_separatedBy_((function(each){
  45500. return $core.withContext(function($ctx3) {
  45501. return $recv(str)._nextPutAll_(each);
  45502. $ctx3.sendIdx["nextPutAll:"]=2;
  45503. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  45504. }),(function(){
  45505. return $core.withContext(function($ctx3) {
  45506. return $recv(str)._nextPutAll_(",");
  45507. $ctx3.sendIdx["nextPutAll:"]=3;
  45508. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45509. }));
  45510. $recv(str)._nextPutAll_("){ return (function() {");
  45511. $ctx2.sendIdx["nextPutAll:"]=4;
  45512. $recv(str)._nextPutAll_(aString);
  45513. $ctx2.sendIdx["nextPutAll:"]=5;
  45514. return $recv(str)._nextPutAll_("})()})");
  45515. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  45516. }));
  45517. function_=$recv($globals.Compiler)._eval_(source);
  45518. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  45519. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  45520. },
  45521. args: ["aString"],
  45522. 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",
  45523. referencedClasses: ["String", "Compiler"],
  45524. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  45525. }),
  45526. $globals.ASTInterpreter);
  45527. $core.addMethod(
  45528. $core.method({
  45529. selector: "hasReturned",
  45530. protocol: "testing",
  45531. fn: function (){
  45532. var self=this,$self=this;
  45533. return $core.withContext(function($ctx1) {
  45534. var $1,$receiver;
  45535. $1=$self["@returned"];
  45536. if(($receiver = $1) == null || $receiver.a$nil){
  45537. return false;
  45538. } else {
  45539. return $1;
  45540. }
  45541. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  45542. },
  45543. args: [],
  45544. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  45545. referencedClasses: [],
  45546. messageSends: ["ifNil:"]
  45547. }),
  45548. $globals.ASTInterpreter);
  45549. $core.addMethod(
  45550. $core.method({
  45551. selector: "initialize",
  45552. protocol: "initialization",
  45553. fn: function (){
  45554. var self=this,$self=this;
  45555. return $core.withContext(function($ctx1) {
  45556. (
  45557. $ctx1.supercall = true,
  45558. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  45559. $ctx1.supercall = false;
  45560. $self["@forceAtEnd"]=false;
  45561. return self;
  45562. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  45563. },
  45564. args: [],
  45565. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  45566. referencedClasses: [],
  45567. messageSends: ["initialize"]
  45568. }),
  45569. $globals.ASTInterpreter);
  45570. $core.addMethod(
  45571. $core.method({
  45572. selector: "interpret",
  45573. protocol: "interpreting",
  45574. fn: function (){
  45575. var self=this,$self=this;
  45576. return $core.withContext(function($ctx1) {
  45577. $self._visit_($self._node());
  45578. return self;
  45579. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  45580. },
  45581. args: [],
  45582. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  45583. referencedClasses: [],
  45584. messageSends: ["visit:", "node"]
  45585. }),
  45586. $globals.ASTInterpreter);
  45587. $core.addMethod(
  45588. $core.method({
  45589. selector: "messageFromSendNode:arguments:",
  45590. protocol: "private",
  45591. fn: function (aSendNode,aCollection){
  45592. var self=this,$self=this;
  45593. return $core.withContext(function($ctx1) {
  45594. var $1;
  45595. $1=$recv($globals.Message)._new();
  45596. $recv($1)._selector_($recv(aSendNode)._selector());
  45597. $recv($1)._arguments_(aCollection);
  45598. return $recv($1)._yourself();
  45599. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  45600. },
  45601. args: ["aSendNode", "aCollection"],
  45602. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  45603. referencedClasses: ["Message"],
  45604. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  45605. }),
  45606. $globals.ASTInterpreter);
  45607. $core.addMethod(
  45608. $core.method({
  45609. selector: "messageNotUnderstood:receiver:",
  45610. protocol: "private",
  45611. fn: function (aMessage,anObject){
  45612. var self=this,$self=this;
  45613. return $core.withContext(function($ctx1) {
  45614. var $1;
  45615. $1=$recv($globals.MessageNotUnderstood)._new();
  45616. $recv($1)._message_(aMessage);
  45617. $recv($1)._receiver_(anObject);
  45618. $recv($1)._signal();
  45619. return self;
  45620. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  45621. },
  45622. args: ["aMessage", "anObject"],
  45623. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  45624. referencedClasses: ["MessageNotUnderstood"],
  45625. messageSends: ["message:", "new", "receiver:", "signal"]
  45626. }),
  45627. $globals.ASTInterpreter);
  45628. $core.addMethod(
  45629. $core.method({
  45630. selector: "next",
  45631. protocol: "interpreting",
  45632. fn: function (){
  45633. var self=this,$self=this;
  45634. var nd,nextNode;
  45635. return $core.withContext(function($ctx1) {
  45636. var $1,$2,$receiver;
  45637. nd=$self._node();
  45638. $1=$recv(nd)._parent();
  45639. if(($receiver = $1) == null || $receiver.a$nil){
  45640. nextNode=$1;
  45641. } else {
  45642. var parent;
  45643. parent=$receiver;
  45644. $2=$recv(parent)._nextSiblingNode_(nd);
  45645. if(($receiver = $2) == null || $receiver.a$nil){
  45646. nextNode=parent;
  45647. } else {
  45648. var sibling;
  45649. sibling=$receiver;
  45650. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  45651. }
  45652. }
  45653. $self._node_(nextNode);
  45654. return self;
  45655. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  45656. },
  45657. args: [],
  45658. 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",
  45659. referencedClasses: ["ASTEnterNode"],
  45660. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  45661. }),
  45662. $globals.ASTInterpreter);
  45663. $core.addMethod(
  45664. $core.method({
  45665. selector: "node",
  45666. protocol: "accessing",
  45667. fn: function (){
  45668. var self=this,$self=this;
  45669. return $self["@node"];
  45670. },
  45671. args: [],
  45672. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  45673. referencedClasses: [],
  45674. messageSends: []
  45675. }),
  45676. $globals.ASTInterpreter);
  45677. $core.addMethod(
  45678. $core.method({
  45679. selector: "node:",
  45680. protocol: "accessing",
  45681. fn: function (aNode){
  45682. var self=this,$self=this;
  45683. $self["@node"]=aNode;
  45684. return self;
  45685. },
  45686. args: ["aNode"],
  45687. source: "node: aNode\x0a\x09node := aNode",
  45688. referencedClasses: [],
  45689. messageSends: []
  45690. }),
  45691. $globals.ASTInterpreter);
  45692. $core.addMethod(
  45693. $core.method({
  45694. selector: "peek",
  45695. protocol: "stack",
  45696. fn: function (){
  45697. var self=this,$self=this;
  45698. return $core.withContext(function($ctx1) {
  45699. var $1;
  45700. var $early={};
  45701. try {
  45702. $1=$self._stack();
  45703. $ctx1.sendIdx["stack"]=1;
  45704. $recv($1)._ifEmpty_((function(){
  45705. throw $early=[nil];
  45706. }));
  45707. return $recv($self._stack())._last();
  45708. }
  45709. catch(e) {if(e===$early)return e[0]; throw e}
  45710. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  45711. },
  45712. args: [],
  45713. 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",
  45714. referencedClasses: [],
  45715. messageSends: ["ifEmpty:", "stack", "last"]
  45716. }),
  45717. $globals.ASTInterpreter);
  45718. $core.addMethod(
  45719. $core.method({
  45720. selector: "pop",
  45721. protocol: "stack",
  45722. fn: function (){
  45723. var self=this,$self=this;
  45724. var peekedValue;
  45725. return $core.withContext(function($ctx1) {
  45726. peekedValue=$self._peek();
  45727. $recv($self._stack())._removeLast();
  45728. return peekedValue;
  45729. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  45730. },
  45731. args: [],
  45732. 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",
  45733. referencedClasses: [],
  45734. messageSends: ["peek", "removeLast", "stack"]
  45735. }),
  45736. $globals.ASTInterpreter);
  45737. $core.addMethod(
  45738. $core.method({
  45739. selector: "proceed",
  45740. protocol: "interpreting",
  45741. fn: function (){
  45742. var self=this,$self=this;
  45743. return $core.withContext(function($ctx1) {
  45744. $recv((function(){
  45745. return $core.withContext(function($ctx2) {
  45746. return $self._atEnd();
  45747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45748. }))._whileFalse_((function(){
  45749. return $core.withContext(function($ctx2) {
  45750. return $self._step();
  45751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45752. }));
  45753. return self;
  45754. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  45755. },
  45756. args: [],
  45757. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  45758. referencedClasses: [],
  45759. messageSends: ["whileFalse:", "atEnd", "step"]
  45760. }),
  45761. $globals.ASTInterpreter);
  45762. $core.addMethod(
  45763. $core.method({
  45764. selector: "push:",
  45765. protocol: "stack",
  45766. fn: function (anObject){
  45767. var self=this,$self=this;
  45768. return $core.withContext(function($ctx1) {
  45769. return $recv($self._stack())._add_(anObject);
  45770. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  45771. },
  45772. args: ["anObject"],
  45773. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  45774. referencedClasses: [],
  45775. messageSends: ["add:", "stack"]
  45776. }),
  45777. $globals.ASTInterpreter);
  45778. $core.addMethod(
  45779. $core.method({
  45780. selector: "restart",
  45781. protocol: "interpreting",
  45782. fn: function (){
  45783. var self=this,$self=this;
  45784. return $core.withContext(function($ctx1) {
  45785. $self._node_($recv($self._context())._ast());
  45786. $self._enterNode();
  45787. return self;
  45788. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  45789. },
  45790. args: [],
  45791. source: "restart\x0a\x09self node: self context ast; enterNode",
  45792. referencedClasses: [],
  45793. messageSends: ["node:", "ast", "context", "enterNode"]
  45794. }),
  45795. $globals.ASTInterpreter);
  45796. $core.addMethod(
  45797. $core.method({
  45798. selector: "result",
  45799. protocol: "accessing",
  45800. fn: function (){
  45801. var self=this,$self=this;
  45802. return $core.withContext(function($ctx1) {
  45803. var $1;
  45804. $1=$self._hasReturned();
  45805. if($core.assert($1)){
  45806. return $self._returnValue();
  45807. } else {
  45808. return $recv($self._context())._receiver();
  45809. }
  45810. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  45811. },
  45812. args: [],
  45813. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  45814. referencedClasses: [],
  45815. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  45816. }),
  45817. $globals.ASTInterpreter);
  45818. $core.addMethod(
  45819. $core.method({
  45820. selector: "returnValue",
  45821. protocol: "accessing",
  45822. fn: function (){
  45823. var self=this,$self=this;
  45824. return $self["@returnValue"];
  45825. },
  45826. args: [],
  45827. source: "returnValue\x0a\x09^ returnValue",
  45828. referencedClasses: [],
  45829. messageSends: []
  45830. }),
  45831. $globals.ASTInterpreter);
  45832. $core.addMethod(
  45833. $core.method({
  45834. selector: "returnValue:",
  45835. protocol: "accessing",
  45836. fn: function (anObject){
  45837. var self=this,$self=this;
  45838. $self["@returnValue"]=anObject;
  45839. return self;
  45840. },
  45841. args: ["anObject"],
  45842. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  45843. referencedClasses: [],
  45844. messageSends: []
  45845. }),
  45846. $globals.ASTInterpreter);
  45847. $core.addMethod(
  45848. $core.method({
  45849. selector: "sendMessage:to:superSend:",
  45850. protocol: "private",
  45851. fn: function (aMessage,anObject,aBoolean){
  45852. var self=this,$self=this;
  45853. var method;
  45854. return $core.withContext(function($ctx1) {
  45855. var $2,$1,$3,$receiver;
  45856. var $early={};
  45857. try {
  45858. if(!$core.assert(aBoolean)){
  45859. return $recv(aMessage)._sendTo_(anObject);
  45860. }
  45861. $2=$recv(anObject)._class();
  45862. $ctx1.sendIdx["class"]=1;
  45863. $1=$recv($2)._superclass();
  45864. $ctx1.sendIdx["superclass"]=1;
  45865. if(($receiver = $1) == null || $receiver.a$nil){
  45866. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  45867. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  45868. return $3;
  45869. } else {
  45870. $1;
  45871. }
  45872. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  45873. return $core.withContext(function($ctx2) {
  45874. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  45875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45876. }));
  45877. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  45878. }
  45879. catch(e) {if(e===$early)return e[0]; throw e}
  45880. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  45881. },
  45882. args: ["aMessage", "anObject", "aBoolean"],
  45883. 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",
  45884. referencedClasses: [],
  45885. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  45886. }),
  45887. $globals.ASTInterpreter);
  45888. $core.addMethod(
  45889. $core.method({
  45890. selector: "setNonLocalReturnFromContext:",
  45891. protocol: "interpreting",
  45892. fn: function (aContext){
  45893. var self=this,$self=this;
  45894. return $core.withContext(function($ctx1) {
  45895. var $2,$1;
  45896. $2=$recv(aContext)._interpreter();
  45897. $ctx1.sendIdx["interpreter"]=1;
  45898. $1=$recv($2)._hasReturned();
  45899. if($core.assert($1)){
  45900. $self["@returned"]=true;
  45901. $self["@returned"];
  45902. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  45903. }
  45904. return self;
  45905. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  45906. },
  45907. args: ["aContext"],
  45908. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  45909. referencedClasses: [],
  45910. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  45911. }),
  45912. $globals.ASTInterpreter);
  45913. $core.addMethod(
  45914. $core.method({
  45915. selector: "skip",
  45916. protocol: "interpreting",
  45917. fn: function (){
  45918. var self=this,$self=this;
  45919. return $core.withContext(function($ctx1) {
  45920. $self._next();
  45921. return self;
  45922. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  45923. },
  45924. args: [],
  45925. source: "skip\x0a\x09self next",
  45926. referencedClasses: [],
  45927. messageSends: ["next"]
  45928. }),
  45929. $globals.ASTInterpreter);
  45930. $core.addMethod(
  45931. $core.method({
  45932. selector: "stack",
  45933. protocol: "accessing",
  45934. fn: function (){
  45935. var self=this,$self=this;
  45936. return $core.withContext(function($ctx1) {
  45937. var $1,$receiver;
  45938. $1=$self["@stack"];
  45939. if(($receiver = $1) == null || $receiver.a$nil){
  45940. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  45941. return $self["@stack"];
  45942. } else {
  45943. return $1;
  45944. }
  45945. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  45946. },
  45947. args: [],
  45948. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  45949. referencedClasses: ["OrderedCollection"],
  45950. messageSends: ["ifNil:", "new"]
  45951. }),
  45952. $globals.ASTInterpreter);
  45953. $core.addMethod(
  45954. $core.method({
  45955. selector: "step",
  45956. protocol: "interpreting",
  45957. fn: function (){
  45958. var self=this,$self=this;
  45959. return $core.withContext(function($ctx1) {
  45960. $self._interpret();
  45961. $self._next();
  45962. return self;
  45963. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  45964. },
  45965. args: [],
  45966. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  45967. referencedClasses: [],
  45968. messageSends: ["interpret", "next"]
  45969. }),
  45970. $globals.ASTInterpreter);
  45971. $core.addMethod(
  45972. $core.method({
  45973. selector: "stepOver",
  45974. protocol: "interpreting",
  45975. fn: function (){
  45976. var self=this,$self=this;
  45977. return $core.withContext(function($ctx1) {
  45978. var $2,$1;
  45979. $self._step();
  45980. $ctx1.sendIdx["step"]=1;
  45981. $recv((function(){
  45982. return $core.withContext(function($ctx2) {
  45983. $2=$self._node();
  45984. $ctx2.sendIdx["node"]=1;
  45985. $1=$recv($2)._isNil();
  45986. return $recv($1)._or_((function(){
  45987. return $core.withContext(function($ctx3) {
  45988. return $recv($self._node())._isSteppingNode();
  45989. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45990. }));
  45991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45992. }))._whileFalse_((function(){
  45993. return $core.withContext(function($ctx2) {
  45994. return $self._step();
  45995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45996. }));
  45997. return self;
  45998. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  45999. },
  46000. args: [],
  46001. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46002. referencedClasses: [],
  46003. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46004. }),
  46005. $globals.ASTInterpreter);
  46006. $core.addMethod(
  46007. $core.method({
  46008. selector: "visit:",
  46009. protocol: "visiting",
  46010. fn: function (aNode){
  46011. var self=this,$self=this;
  46012. return $core.withContext(function($ctx1) {
  46013. var $1;
  46014. $1=$self._hasReturned();
  46015. if(!$core.assert($1)){
  46016. (
  46017. $ctx1.supercall = true,
  46018. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46019. $ctx1.supercall = false;
  46020. }
  46021. return self;
  46022. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46023. },
  46024. args: ["aNode"],
  46025. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46026. referencedClasses: [],
  46027. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46028. }),
  46029. $globals.ASTInterpreter);
  46030. $core.addMethod(
  46031. $core.method({
  46032. selector: "visitAssignmentNode:",
  46033. protocol: "visiting",
  46034. fn: function (aNode){
  46035. var self=this,$self=this;
  46036. var poppedValue;
  46037. return $core.withContext(function($ctx1) {
  46038. poppedValue=$self._pop();
  46039. $ctx1.sendIdx["pop"]=1;
  46040. $self._pop();
  46041. $self._push_(poppedValue);
  46042. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46043. return self;
  46044. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46045. },
  46046. args: ["aNode"],
  46047. 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",
  46048. referencedClasses: [],
  46049. messageSends: ["pop", "push:", "assign:to:", "left"]
  46050. }),
  46051. $globals.ASTInterpreter);
  46052. $core.addMethod(
  46053. $core.method({
  46054. selector: "visitBlockNode:",
  46055. protocol: "visiting",
  46056. fn: function (aNode){
  46057. var self=this,$self=this;
  46058. var block;
  46059. return $core.withContext(function($ctx1) {
  46060. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46061. $self._push_(block);
  46062. return self;
  46063. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46064. },
  46065. args: ["aNode"],
  46066. 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",
  46067. referencedClasses: ["AIBlockClosure"],
  46068. messageSends: ["forContext:node:", "context", "push:"]
  46069. }),
  46070. $globals.ASTInterpreter);
  46071. $core.addMethod(
  46072. $core.method({
  46073. selector: "visitBlockSequenceNode:",
  46074. protocol: "visiting",
  46075. fn: function (aNode){
  46076. var self=this,$self=this;
  46077. return $core.withContext(function($ctx1) {
  46078. (
  46079. $ctx1.supercall = true,
  46080. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46081. $ctx1.supercall = false;
  46082. $self["@forceAtEnd"]=true;
  46083. return self;
  46084. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46085. },
  46086. args: ["aNode"],
  46087. 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",
  46088. referencedClasses: [],
  46089. messageSends: ["visitBlockSequenceNode:"]
  46090. }),
  46091. $globals.ASTInterpreter);
  46092. $core.addMethod(
  46093. $core.method({
  46094. selector: "visitDagNode:",
  46095. protocol: "visiting",
  46096. fn: function (aNode){
  46097. var self=this,$self=this;
  46098. return self;
  46099. },
  46100. args: ["aNode"],
  46101. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46102. referencedClasses: [],
  46103. messageSends: []
  46104. }),
  46105. $globals.ASTInterpreter);
  46106. $core.addMethod(
  46107. $core.method({
  46108. selector: "visitDynamicArrayNode:",
  46109. protocol: "visiting",
  46110. fn: function (aNode){
  46111. var self=this,$self=this;
  46112. var array;
  46113. return $core.withContext(function($ctx1) {
  46114. array=[];
  46115. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46116. return $core.withContext(function($ctx2) {
  46117. return $recv(array)._addFirst_($self._pop());
  46118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46119. }));
  46120. $self._push_(array);
  46121. return self;
  46122. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46123. },
  46124. args: ["aNode"],
  46125. 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",
  46126. referencedClasses: [],
  46127. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46128. }),
  46129. $globals.ASTInterpreter);
  46130. $core.addMethod(
  46131. $core.method({
  46132. selector: "visitDynamicDictionaryNode:",
  46133. protocol: "visiting",
  46134. fn: function (aNode){
  46135. var self=this,$self=this;
  46136. var keyValueList;
  46137. return $core.withContext(function($ctx1) {
  46138. keyValueList=$recv($globals.OrderedCollection)._new();
  46139. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46140. return $core.withContext(function($ctx2) {
  46141. return $recv(keyValueList)._add_($self._pop());
  46142. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46143. }));
  46144. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46145. return self;
  46146. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46147. },
  46148. args: ["aNode"],
  46149. 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)",
  46150. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46151. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46152. }),
  46153. $globals.ASTInterpreter);
  46154. $core.addMethod(
  46155. $core.method({
  46156. selector: "visitJSStatementNode:",
  46157. protocol: "visiting",
  46158. fn: function (aNode){
  46159. var self=this,$self=this;
  46160. return $core.withContext(function($ctx1) {
  46161. $self["@returned"]=true;
  46162. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46163. return self;
  46164. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46165. },
  46166. args: ["aNode"],
  46167. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46168. referencedClasses: [],
  46169. messageSends: ["returnValue:", "eval:", "source"]
  46170. }),
  46171. $globals.ASTInterpreter);
  46172. $core.addMethod(
  46173. $core.method({
  46174. selector: "visitReturnNode:",
  46175. protocol: "visiting",
  46176. fn: function (aNode){
  46177. var self=this,$self=this;
  46178. return $core.withContext(function($ctx1) {
  46179. $self["@returned"]=true;
  46180. $self._returnValue_($self._pop());
  46181. return self;
  46182. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46183. },
  46184. args: ["aNode"],
  46185. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46186. referencedClasses: [],
  46187. messageSends: ["returnValue:", "pop"]
  46188. }),
  46189. $globals.ASTInterpreter);
  46190. $core.addMethod(
  46191. $core.method({
  46192. selector: "visitSendNode:",
  46193. protocol: "visiting",
  46194. fn: function (aNode){
  46195. var self=this,$self=this;
  46196. var receiver,args,message,result;
  46197. return $core.withContext(function($ctx1) {
  46198. var $1;
  46199. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46200. return $core.withContext(function($ctx2) {
  46201. return $self._pop();
  46202. $ctx2.sendIdx["pop"]=1;
  46203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46204. }));
  46205. receiver=$self._peek();
  46206. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46207. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46208. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46209. return $core.withContext(function($ctx2) {
  46210. return $recv($recv(aNode)._isLastChild())._not();
  46211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46212. }));
  46213. if(!$core.assert($1)){
  46214. $self._pop();
  46215. $self._push_(result);
  46216. }
  46217. return self;
  46218. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46219. },
  46220. args: ["aNode"],
  46221. 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 ]",
  46222. referencedClasses: [],
  46223. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46224. }),
  46225. $globals.ASTInterpreter);
  46226. $core.addMethod(
  46227. $core.method({
  46228. selector: "visitValueNode:",
  46229. protocol: "visiting",
  46230. fn: function (aNode){
  46231. var self=this,$self=this;
  46232. return $core.withContext(function($ctx1) {
  46233. $self._push_($recv(aNode)._value());
  46234. return self;
  46235. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46236. },
  46237. args: ["aNode"],
  46238. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46239. referencedClasses: [],
  46240. messageSends: ["push:", "value"]
  46241. }),
  46242. $globals.ASTInterpreter);
  46243. $core.addMethod(
  46244. $core.method({
  46245. selector: "visitVariableNode:",
  46246. protocol: "visiting",
  46247. fn: function (aNode){
  46248. var self=this,$self=this;
  46249. return $core.withContext(function($ctx1) {
  46250. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46251. $2=$recv(aNode)._binding();
  46252. $ctx1.sendIdx["binding"]=1;
  46253. $1=$recv($2)._isUnknownVar();
  46254. if($core.assert($1)){
  46255. $5=$recv($globals.Platform)._globals();
  46256. $ctx1.sendIdx["globals"]=1;
  46257. $6=$recv(aNode)._value();
  46258. $ctx1.sendIdx["value"]=1;
  46259. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46260. return $core.withContext(function($ctx2) {
  46261. return $self._error_("Unknown variable");
  46262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46263. }));
  46264. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46265. $3=$self._push_($4);
  46266. $ctx1.sendIdx["push:"]=1;
  46267. return $3;
  46268. }
  46269. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46270. if($core.assert($8)){
  46271. $10=$self._context();
  46272. $ctx1.sendIdx["context"]=1;
  46273. $9=$recv($10)._receiver();
  46274. $11=$recv(aNode)._value();
  46275. $ctx1.sendIdx["value"]=2;
  46276. $7=$recv($9)._instVarAt_($11);
  46277. } else {
  46278. $12=$self._context();
  46279. $13=$recv(aNode)._value();
  46280. $ctx1.sendIdx["value"]=3;
  46281. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46282. return $core.withContext(function($ctx2) {
  46283. $15=$recv(aNode)._value();
  46284. $ctx2.sendIdx["value"]=4;
  46285. $14=$recv($15)._isCapitalized();
  46286. if($core.assert($14)){
  46287. $16=$recv($globals.Smalltalk)._globals();
  46288. $ctx2.sendIdx["globals"]=2;
  46289. $17=$recv(aNode)._value();
  46290. $ctx2.sendIdx["value"]=5;
  46291. return $recv($16)._at_ifAbsent_($17,(function(){
  46292. return $core.withContext(function($ctx3) {
  46293. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46294. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46295. }));
  46296. }
  46297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46298. }));
  46299. }
  46300. $self._push_($7);
  46301. return self;
  46302. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46303. },
  46304. args: ["aNode"],
  46305. 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 ] ] ] ])",
  46306. referencedClasses: ["Platform", "Smalltalk"],
  46307. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46308. }),
  46309. $globals.ASTInterpreter);
  46310. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46311. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46312. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46313. $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`";
  46314. $core.addMethod(
  46315. $core.method({
  46316. selector: "currentNode",
  46317. protocol: "accessing",
  46318. fn: function (){
  46319. var self=this,$self=this;
  46320. return $self["@currentNode"];
  46321. },
  46322. args: [],
  46323. source: "currentNode\x0a\x09^ currentNode",
  46324. referencedClasses: [],
  46325. messageSends: []
  46326. }),
  46327. $globals.ASTPCNodeVisitor);
  46328. $core.addMethod(
  46329. $core.method({
  46330. selector: "increaseTrackedIndex",
  46331. protocol: "accessing",
  46332. fn: function (){
  46333. var self=this,$self=this;
  46334. return $core.withContext(function($ctx1) {
  46335. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46336. return self;
  46337. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46338. },
  46339. args: [],
  46340. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46341. referencedClasses: [],
  46342. messageSends: ["+", "trackedIndex"]
  46343. }),
  46344. $globals.ASTPCNodeVisitor);
  46345. $core.addMethod(
  46346. $core.method({
  46347. selector: "index",
  46348. protocol: "accessing",
  46349. fn: function (){
  46350. var self=this,$self=this;
  46351. return $self["@index"];
  46352. },
  46353. args: [],
  46354. source: "index\x0a\x09^ index",
  46355. referencedClasses: [],
  46356. messageSends: []
  46357. }),
  46358. $globals.ASTPCNodeVisitor);
  46359. $core.addMethod(
  46360. $core.method({
  46361. selector: "index:",
  46362. protocol: "accessing",
  46363. fn: function (aNumber){
  46364. var self=this,$self=this;
  46365. $self["@index"]=aNumber;
  46366. return self;
  46367. },
  46368. args: ["aNumber"],
  46369. source: "index: aNumber\x0a\x09index := aNumber",
  46370. referencedClasses: [],
  46371. messageSends: []
  46372. }),
  46373. $globals.ASTPCNodeVisitor);
  46374. $core.addMethod(
  46375. $core.method({
  46376. selector: "selector",
  46377. protocol: "accessing",
  46378. fn: function (){
  46379. var self=this,$self=this;
  46380. return $self["@selector"];
  46381. },
  46382. args: [],
  46383. source: "selector\x0a\x09^ selector",
  46384. referencedClasses: [],
  46385. messageSends: []
  46386. }),
  46387. $globals.ASTPCNodeVisitor);
  46388. $core.addMethod(
  46389. $core.method({
  46390. selector: "selector:",
  46391. protocol: "accessing",
  46392. fn: function (aString){
  46393. var self=this,$self=this;
  46394. $self["@selector"]=aString;
  46395. return self;
  46396. },
  46397. args: ["aString"],
  46398. source: "selector: aString\x0a\x09selector := aString",
  46399. referencedClasses: [],
  46400. messageSends: []
  46401. }),
  46402. $globals.ASTPCNodeVisitor);
  46403. $core.addMethod(
  46404. $core.method({
  46405. selector: "trackedIndex",
  46406. protocol: "accessing",
  46407. fn: function (){
  46408. var self=this,$self=this;
  46409. return $core.withContext(function($ctx1) {
  46410. var $1,$receiver;
  46411. $1=$self["@trackedIndex"];
  46412. if(($receiver = $1) == null || $receiver.a$nil){
  46413. $self["@trackedIndex"]=(0);
  46414. return $self["@trackedIndex"];
  46415. } else {
  46416. return $1;
  46417. }
  46418. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46419. },
  46420. args: [],
  46421. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46422. referencedClasses: [],
  46423. messageSends: ["ifNil:"]
  46424. }),
  46425. $globals.ASTPCNodeVisitor);
  46426. $core.addMethod(
  46427. $core.method({
  46428. selector: "visitJSStatementNode:",
  46429. protocol: "visiting",
  46430. fn: function (aNode){
  46431. var self=this,$self=this;
  46432. $self["@currentNode"]=aNode;
  46433. return self;
  46434. },
  46435. args: ["aNode"],
  46436. 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",
  46437. referencedClasses: [],
  46438. messageSends: []
  46439. }),
  46440. $globals.ASTPCNodeVisitor);
  46441. $core.addMethod(
  46442. $core.method({
  46443. selector: "visitSendNode:",
  46444. protocol: "visiting",
  46445. fn: function (aNode){
  46446. var self=this,$self=this;
  46447. return $core.withContext(function($ctx1) {
  46448. var $2,$1,$3;
  46449. (
  46450. $ctx1.supercall = true,
  46451. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46452. $ctx1.supercall = false;
  46453. $2=$self._selector();
  46454. $ctx1.sendIdx["selector"]=1;
  46455. $1=$recv($2).__eq($recv(aNode)._selector());
  46456. $ctx1.sendIdx["="]=1;
  46457. if($core.assert($1)){
  46458. $3=$recv($self._trackedIndex()).__eq($self._index());
  46459. if($core.assert($3)){
  46460. $self["@currentNode"]=aNode;
  46461. $self["@currentNode"];
  46462. }
  46463. $self._increaseTrackedIndex();
  46464. }
  46465. return self;
  46466. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46467. },
  46468. args: ["aNode"],
  46469. 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 ]",
  46470. referencedClasses: [],
  46471. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46472. }),
  46473. $globals.ASTPCNodeVisitor);
  46474. $core.addMethod(
  46475. $core.method({
  46476. selector: "isLastChild",
  46477. protocol: "*Compiler-Interpreter",
  46478. fn: function (){
  46479. var self=this,$self=this;
  46480. return $core.withContext(function($ctx1) {
  46481. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  46482. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  46483. },
  46484. args: [],
  46485. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  46486. referencedClasses: [],
  46487. messageSends: ["=", "last", "dagChildren", "parent"]
  46488. }),
  46489. $globals.ASTNode);
  46490. $core.addMethod(
  46491. $core.method({
  46492. selector: "isSteppingNode",
  46493. protocol: "*Compiler-Interpreter",
  46494. fn: function (){
  46495. var self=this,$self=this;
  46496. return false;
  46497. },
  46498. args: [],
  46499. source: "isSteppingNode\x0a\x09^ false",
  46500. referencedClasses: [],
  46501. messageSends: []
  46502. }),
  46503. $globals.ASTNode);
  46504. $core.addMethod(
  46505. $core.method({
  46506. selector: "nextSiblingNode:",
  46507. protocol: "*Compiler-Interpreter",
  46508. fn: function (aNode){
  46509. var self=this,$self=this;
  46510. return $core.withContext(function($ctx1) {
  46511. var $1;
  46512. var $early={};
  46513. try {
  46514. $1=$self._dagChildren();
  46515. $ctx1.sendIdx["dagChildren"]=1;
  46516. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  46517. throw $early=[nil];
  46518. }));
  46519. }
  46520. catch(e) {if(e===$early)return e[0]; throw e}
  46521. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  46522. },
  46523. args: ["aNode"],
  46524. 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 ]",
  46525. referencedClasses: [],
  46526. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  46527. }),
  46528. $globals.ASTNode);
  46529. $core.addMethod(
  46530. $core.method({
  46531. selector: "isSteppingNode",
  46532. protocol: "*Compiler-Interpreter",
  46533. fn: function (){
  46534. var self=this,$self=this;
  46535. return true;
  46536. },
  46537. args: [],
  46538. source: "isSteppingNode\x0a\x09^ true",
  46539. referencedClasses: [],
  46540. messageSends: []
  46541. }),
  46542. $globals.AssignmentNode);
  46543. $core.addMethod(
  46544. $core.method({
  46545. selector: "isSteppingNode",
  46546. protocol: "*Compiler-Interpreter",
  46547. fn: function (){
  46548. var self=this,$self=this;
  46549. return true;
  46550. },
  46551. args: [],
  46552. source: "isSteppingNode\x0a\x09^ true",
  46553. referencedClasses: [],
  46554. messageSends: []
  46555. }),
  46556. $globals.BlockNode);
  46557. $core.addMethod(
  46558. $core.method({
  46559. selector: "nextSiblingNode:",
  46560. protocol: "*Compiler-Interpreter",
  46561. fn: function (aNode){
  46562. var self=this,$self=this;
  46563. return nil;
  46564. },
  46565. args: ["aNode"],
  46566. 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",
  46567. referencedClasses: [],
  46568. messageSends: []
  46569. }),
  46570. $globals.BlockNode);
  46571. $core.addMethod(
  46572. $core.method({
  46573. selector: "isSteppingNode",
  46574. protocol: "*Compiler-Interpreter",
  46575. fn: function (){
  46576. var self=this,$self=this;
  46577. return true;
  46578. },
  46579. args: [],
  46580. source: "isSteppingNode\x0a\x09^ true",
  46581. referencedClasses: [],
  46582. messageSends: []
  46583. }),
  46584. $globals.DynamicArrayNode);
  46585. $core.addMethod(
  46586. $core.method({
  46587. selector: "isSteppingNode",
  46588. protocol: "*Compiler-Interpreter",
  46589. fn: function (){
  46590. var self=this,$self=this;
  46591. return true;
  46592. },
  46593. args: [],
  46594. source: "isSteppingNode\x0a\x09^ true",
  46595. referencedClasses: [],
  46596. messageSends: []
  46597. }),
  46598. $globals.DynamicDictionaryNode);
  46599. $core.addMethod(
  46600. $core.method({
  46601. selector: "isSteppingNode",
  46602. protocol: "*Compiler-Interpreter",
  46603. fn: function (){
  46604. var self=this,$self=this;
  46605. return true;
  46606. },
  46607. args: [],
  46608. source: "isSteppingNode\x0a\x09^ true",
  46609. referencedClasses: [],
  46610. messageSends: []
  46611. }),
  46612. $globals.JSStatementNode);
  46613. $core.addMethod(
  46614. $core.method({
  46615. selector: "isCascadeSendNode",
  46616. protocol: "*Compiler-Interpreter",
  46617. fn: function (){
  46618. var self=this,$self=this;
  46619. return $core.withContext(function($ctx1) {
  46620. return $recv($self._parent())._isCascadeNode();
  46621. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  46622. },
  46623. args: [],
  46624. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  46625. referencedClasses: [],
  46626. messageSends: ["isCascadeNode", "parent"]
  46627. }),
  46628. $globals.SendNode);
  46629. $core.addMethod(
  46630. $core.method({
  46631. selector: "isSteppingNode",
  46632. protocol: "*Compiler-Interpreter",
  46633. fn: function (){
  46634. var self=this,$self=this;
  46635. return true;
  46636. },
  46637. args: [],
  46638. source: "isSteppingNode\x0a\x09^ true",
  46639. referencedClasses: [],
  46640. messageSends: []
  46641. }),
  46642. $globals.SendNode);
  46643. });
  46644. define('amber/lang',[
  46645. './deploy',
  46646. './boot', // pre-fetch, dep of ./helpers
  46647. './helpers', // pre-fetch, dep of ./deploy
  46648. './parser',
  46649. // --- packages for the Amber reflection begin here ---
  46650. 'amber_core/Platform-ImportExport',
  46651. 'amber_core/Compiler-Core',
  46652. 'amber_core/Compiler-AST',
  46653. 'amber_core/Compiler-Semantic',
  46654. 'amber_core/Compiler-IR',
  46655. 'amber_core/Compiler-Inlining',
  46656. 'amber_core/Compiler-Interpreter'
  46657. // --- packages for the Amber reflection end here ---
  46658. ], function (amber) {
  46659. return amber;
  46660. });
  46661. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  46662. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46663. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46664. $core.addPackage("Platform-DOM");
  46665. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  46666. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46667. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  46668. $core.addMethod(
  46669. $core.method({
  46670. selector: "isDomNode:",
  46671. protocol: "testing",
  46672. fn: function (anObject){
  46673. var self=this,$self=this;
  46674. return $core.withContext(function($ctx1) {
  46675. return anObject.nodeType > 0 &&
  46676. Object.prototype.toString.call(anObject) !== "[object Object]";
  46677. return self;
  46678. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  46679. },
  46680. args: ["anObject"],
  46681. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  46682. referencedClasses: [],
  46683. messageSends: []
  46684. }),
  46685. $globals.PlatformDom.a$cls);
  46686. $core.addMethod(
  46687. $core.method({
  46688. selector: "isFeasible",
  46689. protocol: "testing",
  46690. fn: function (){
  46691. var self=this,$self=this;
  46692. return $core.withContext(function($ctx1) {
  46693. if (typeof document === "undefined") return false;
  46694. try {
  46695. var d = document.createElement("div"),
  46696. f = document.createDocumentFragment(),
  46697. t = document.createTextNode("Hello, Amber!");
  46698. f.appendChild(t);
  46699. d.insertBefore(f, null);
  46700. return d.innerHTML === "Hello, Amber!";
  46701. } catch (e) {
  46702. return false;
  46703. };
  46704. return self;
  46705. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  46706. },
  46707. args: [],
  46708. 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'>",
  46709. referencedClasses: [],
  46710. messageSends: []
  46711. }),
  46712. $globals.PlatformDom.a$cls);
  46713. $core.addMethod(
  46714. $core.method({
  46715. selector: "newCustomEvent:detail:",
  46716. protocol: "creation",
  46717. fn: function (aString,anObject){
  46718. var self=this,$self=this;
  46719. return $core.withContext(function($ctx1) {
  46720. return new CustomEvent(aString, {detail: anObject});
  46721. return self;
  46722. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  46723. },
  46724. args: ["aString", "anObject"],
  46725. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  46726. referencedClasses: [],
  46727. messageSends: []
  46728. }),
  46729. $globals.PlatformDom.a$cls);
  46730. $core.addMethod(
  46731. $core.method({
  46732. selector: "toArray:",
  46733. protocol: "converting",
  46734. fn: function (aDomList){
  46735. var self=this,$self=this;
  46736. return $core.withContext(function($ctx1) {
  46737. return Array.prototype.slice.call(aDomList);
  46738. return self;
  46739. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  46740. },
  46741. args: ["aDomList"],
  46742. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  46743. referencedClasses: [],
  46744. messageSends: []
  46745. }),
  46746. $globals.PlatformDom.a$cls);
  46747. $core.addMethod(
  46748. $core.method({
  46749. selector: "asDomNode",
  46750. protocol: "*Platform-DOM",
  46751. fn: function (){
  46752. var self=this,$self=this;
  46753. return $core.withContext(function($ctx1) {
  46754. return $recv(document)._createTextNode_($self._asString());
  46755. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  46756. },
  46757. args: [],
  46758. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  46759. referencedClasses: [],
  46760. messageSends: ["createTextNode:", "asString"]
  46761. }),
  46762. $globals.CharacterArray);
  46763. $core.addMethod(
  46764. $core.method({
  46765. selector: "asDomNode",
  46766. protocol: "*Platform-DOM",
  46767. fn: function (){
  46768. var self=this,$self=this;
  46769. var fragment;
  46770. return $core.withContext(function($ctx1) {
  46771. fragment=$recv(document)._createDocumentFragment();
  46772. $self._do_((function(each){
  46773. return $core.withContext(function($ctx2) {
  46774. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  46775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46776. }));
  46777. return fragment;
  46778. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  46779. },
  46780. args: [],
  46781. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  46782. referencedClasses: [],
  46783. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  46784. }),
  46785. $globals.Collection);
  46786. $core.addMethod(
  46787. $core.method({
  46788. selector: "asDomNode",
  46789. protocol: "*Platform-DOM",
  46790. fn: function (){
  46791. var self=this,$self=this;
  46792. return $core.withContext(function($ctx1) {
  46793. var $1,$2;
  46794. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  46795. if($core.assert($1)){
  46796. return $self["@jsObject"];
  46797. } else {
  46798. $2=(
  46799. $ctx1.supercall = true,
  46800. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  46801. $ctx1.supercall = false;
  46802. return $2;
  46803. }
  46804. return self;
  46805. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  46806. },
  46807. args: [],
  46808. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  46809. referencedClasses: ["PlatformDom"],
  46810. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  46811. }),
  46812. $globals.JSObjectProxy);
  46813. $core.addMethod(
  46814. $core.method({
  46815. selector: "htmlTextContent",
  46816. protocol: "*Platform-DOM",
  46817. fn: function (){
  46818. var self=this,$self=this;
  46819. return $core.withContext(function($ctx1) {
  46820. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  46821. return self;
  46822. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  46823. },
  46824. args: [],
  46825. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  46826. referencedClasses: [],
  46827. messageSends: []
  46828. }),
  46829. $globals.String);
  46830. });
  46831. 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";
  46832. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46833. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46834. $core.addPackage("SUnit");
  46835. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  46836. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46837. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  46838. $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.";
  46839. $core.addMethod(
  46840. $core.method({
  46841. selector: "result",
  46842. protocol: "accessing",
  46843. fn: function (){
  46844. var self=this,$self=this;
  46845. return $self["@result"];
  46846. },
  46847. args: [],
  46848. source: "result\x0a\x09^ result",
  46849. referencedClasses: [],
  46850. messageSends: []
  46851. }),
  46852. $globals.ResultAnnouncement);
  46853. $core.addMethod(
  46854. $core.method({
  46855. selector: "result:",
  46856. protocol: "accessing",
  46857. fn: function (aTestResult){
  46858. var self=this,$self=this;
  46859. $self["@result"]=aTestResult;
  46860. return self;
  46861. },
  46862. args: ["aTestResult"],
  46863. source: "result: aTestResult\x0a\x09result := aTestResult",
  46864. referencedClasses: [],
  46865. messageSends: []
  46866. }),
  46867. $globals.ResultAnnouncement);
  46868. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  46869. $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.";
  46870. $core.addMethod(
  46871. $core.method({
  46872. selector: "assert:",
  46873. protocol: "testing",
  46874. fn: function (aBoolean){
  46875. var self=this,$self=this;
  46876. return $core.withContext(function($ctx1) {
  46877. $self._assert_description_(aBoolean,"Assertion failed");
  46878. return self;
  46879. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  46880. },
  46881. args: ["aBoolean"],
  46882. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  46883. referencedClasses: [],
  46884. messageSends: ["assert:description:"]
  46885. }),
  46886. $globals.TestCase);
  46887. $core.addMethod(
  46888. $core.method({
  46889. selector: "assert:description:",
  46890. protocol: "testing",
  46891. fn: function (aBoolean,aString){
  46892. var self=this,$self=this;
  46893. return $core.withContext(function($ctx1) {
  46894. if(!$core.assert(aBoolean)){
  46895. $self._signalFailure_(aString);
  46896. }
  46897. return self;
  46898. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  46899. },
  46900. args: ["aBoolean", "aString"],
  46901. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  46902. referencedClasses: [],
  46903. messageSends: ["ifFalse:", "signalFailure:"]
  46904. }),
  46905. $globals.TestCase);
  46906. $core.addMethod(
  46907. $core.method({
  46908. selector: "assert:equals:",
  46909. protocol: "testing",
  46910. fn: function (actual,expected){
  46911. var self=this,$self=this;
  46912. return $core.withContext(function($ctx1) {
  46913. var $1,$5,$4,$3,$2;
  46914. $1=$recv(actual).__eq(expected);
  46915. $5=$recv(expected)._printString();
  46916. $ctx1.sendIdx["printString"]=1;
  46917. $4="Expected: ".__comma($5);
  46918. $3=$recv($4).__comma(" but was: ");
  46919. $ctx1.sendIdx[","]=2;
  46920. $2=$recv($3).__comma($recv(actual)._printString());
  46921. $ctx1.sendIdx[","]=1;
  46922. return $self._assert_description_($1,$2);
  46923. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  46924. },
  46925. args: ["actual", "expected"],
  46926. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  46927. referencedClasses: [],
  46928. messageSends: ["assert:description:", "=", ",", "printString"]
  46929. }),
  46930. $globals.TestCase);
  46931. $core.addMethod(
  46932. $core.method({
  46933. selector: "async:",
  46934. protocol: "async",
  46935. fn: function (aBlock){
  46936. var self=this,$self=this;
  46937. var c;
  46938. return $core.withContext(function($ctx1) {
  46939. var $1;
  46940. $self._errorIfNotAsync_("#async");
  46941. c=$self["@context"];
  46942. return (function(){
  46943. return $core.withContext(function($ctx2) {
  46944. $1=$self._isAsync();
  46945. if($core.assert($1)){
  46946. return $recv(c)._execute_(aBlock);
  46947. }
  46948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46949. });
  46950. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  46951. },
  46952. args: ["aBlock"],
  46953. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  46954. referencedClasses: [],
  46955. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  46956. }),
  46957. $globals.TestCase);
  46958. $core.addMethod(
  46959. $core.method({
  46960. selector: "context:",
  46961. protocol: "accessing",
  46962. fn: function (aRunningTestContext){
  46963. var self=this,$self=this;
  46964. $self["@context"]=aRunningTestContext;
  46965. return self;
  46966. },
  46967. args: ["aRunningTestContext"],
  46968. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  46969. referencedClasses: [],
  46970. messageSends: []
  46971. }),
  46972. $globals.TestCase);
  46973. $core.addMethod(
  46974. $core.method({
  46975. selector: "deny:",
  46976. protocol: "testing",
  46977. fn: function (aBoolean){
  46978. var self=this,$self=this;
  46979. return $core.withContext(function($ctx1) {
  46980. $self._assert_($recv(aBoolean)._not());
  46981. return self;
  46982. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  46983. },
  46984. args: ["aBoolean"],
  46985. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  46986. referencedClasses: [],
  46987. messageSends: ["assert:", "not"]
  46988. }),
  46989. $globals.TestCase);
  46990. $core.addMethod(
  46991. $core.method({
  46992. selector: "errorIfNotAsync:",
  46993. protocol: "error handling",
  46994. fn: function (aString){
  46995. var self=this,$self=this;
  46996. return $core.withContext(function($ctx1) {
  46997. var $1;
  46998. $1=$self._isAsync();
  46999. if(!$core.assert($1)){
  47000. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47001. }
  47002. return self;
  47003. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47004. },
  47005. args: ["aString"],
  47006. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47007. referencedClasses: [],
  47008. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47009. }),
  47010. $globals.TestCase);
  47011. $core.addMethod(
  47012. $core.method({
  47013. selector: "finished",
  47014. protocol: "async",
  47015. fn: function (){
  47016. var self=this,$self=this;
  47017. return $core.withContext(function($ctx1) {
  47018. $self._errorIfNotAsync_("#finished");
  47019. $self["@asyncTimeout"]=nil;
  47020. return self;
  47021. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47022. },
  47023. args: [],
  47024. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47025. referencedClasses: [],
  47026. messageSends: ["errorIfNotAsync:"]
  47027. }),
  47028. $globals.TestCase);
  47029. $core.addMethod(
  47030. $core.method({
  47031. selector: "isAsync",
  47032. protocol: "testing",
  47033. fn: function (){
  47034. var self=this,$self=this;
  47035. return $core.withContext(function($ctx1) {
  47036. return $recv($self["@asyncTimeout"])._notNil();
  47037. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47038. },
  47039. args: [],
  47040. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47041. referencedClasses: [],
  47042. messageSends: ["notNil"]
  47043. }),
  47044. $globals.TestCase);
  47045. $core.addMethod(
  47046. $core.method({
  47047. selector: "performTest",
  47048. protocol: "running",
  47049. fn: function (){
  47050. var self=this,$self=this;
  47051. return $core.withContext(function($ctx1) {
  47052. $self["@asyncTimeout"]=nil;
  47053. $self._perform_($self._selector());
  47054. return self;
  47055. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47056. },
  47057. args: [],
  47058. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47059. referencedClasses: [],
  47060. messageSends: ["perform:", "selector"]
  47061. }),
  47062. $globals.TestCase);
  47063. $core.addMethod(
  47064. $core.method({
  47065. selector: "runCase",
  47066. protocol: "running",
  47067. fn: function (){
  47068. var self=this,$self=this;
  47069. return $core.withContext(function($ctx1) {
  47070. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47071. return self;
  47072. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47073. },
  47074. args: [],
  47075. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47076. referencedClasses: ["TestContext"],
  47077. messageSends: ["start", "testCase:"]
  47078. }),
  47079. $globals.TestCase);
  47080. $core.addMethod(
  47081. $core.method({
  47082. selector: "selector",
  47083. protocol: "accessing",
  47084. fn: function (){
  47085. var self=this,$self=this;
  47086. return $self["@testSelector"];
  47087. },
  47088. args: [],
  47089. source: "selector\x0a\x09^ testSelector",
  47090. referencedClasses: [],
  47091. messageSends: []
  47092. }),
  47093. $globals.TestCase);
  47094. $core.addMethod(
  47095. $core.method({
  47096. selector: "setTestSelector:",
  47097. protocol: "accessing",
  47098. fn: function (aSelector){
  47099. var self=this,$self=this;
  47100. $self["@testSelector"]=aSelector;
  47101. return self;
  47102. },
  47103. args: ["aSelector"],
  47104. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47105. referencedClasses: [],
  47106. messageSends: []
  47107. }),
  47108. $globals.TestCase);
  47109. $core.addMethod(
  47110. $core.method({
  47111. selector: "setUp",
  47112. protocol: "running",
  47113. fn: function (){
  47114. var self=this,$self=this;
  47115. return self;
  47116. },
  47117. args: [],
  47118. source: "setUp",
  47119. referencedClasses: [],
  47120. messageSends: []
  47121. }),
  47122. $globals.TestCase);
  47123. $core.addMethod(
  47124. $core.method({
  47125. selector: "should:",
  47126. protocol: "testing",
  47127. fn: function (aBlock){
  47128. var self=this,$self=this;
  47129. return $core.withContext(function($ctx1) {
  47130. $self._assert_($recv(aBlock)._value());
  47131. return self;
  47132. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47133. },
  47134. args: ["aBlock"],
  47135. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47136. referencedClasses: [],
  47137. messageSends: ["assert:", "value"]
  47138. }),
  47139. $globals.TestCase);
  47140. $core.addMethod(
  47141. $core.method({
  47142. selector: "should:raise:",
  47143. protocol: "testing",
  47144. fn: function (aBlock,anExceptionClass){
  47145. var self=this,$self=this;
  47146. return $core.withContext(function($ctx1) {
  47147. $self._assert_($recv((function(){
  47148. return $core.withContext(function($ctx2) {
  47149. $recv(aBlock)._value();
  47150. return false;
  47151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47152. }))._on_do_(anExceptionClass,(function(ex){
  47153. return true;
  47154. })));
  47155. return self;
  47156. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47157. },
  47158. args: ["aBlock", "anExceptionClass"],
  47159. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47160. referencedClasses: [],
  47161. messageSends: ["assert:", "on:do:", "value"]
  47162. }),
  47163. $globals.TestCase);
  47164. $core.addMethod(
  47165. $core.method({
  47166. selector: "shouldnt:raise:",
  47167. protocol: "testing",
  47168. fn: function (aBlock,anExceptionClass){
  47169. var self=this,$self=this;
  47170. return $core.withContext(function($ctx1) {
  47171. $self._assert_($recv((function(){
  47172. return $core.withContext(function($ctx2) {
  47173. $recv(aBlock)._value();
  47174. return true;
  47175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47176. }))._on_do_(anExceptionClass,(function(ex){
  47177. return false;
  47178. })));
  47179. return self;
  47180. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47181. },
  47182. args: ["aBlock", "anExceptionClass"],
  47183. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47184. referencedClasses: [],
  47185. messageSends: ["assert:", "on:do:", "value"]
  47186. }),
  47187. $globals.TestCase);
  47188. $core.addMethod(
  47189. $core.method({
  47190. selector: "signalFailure:",
  47191. protocol: "private",
  47192. fn: function (aString){
  47193. var self=this,$self=this;
  47194. return $core.withContext(function($ctx1) {
  47195. var $1;
  47196. $1=$recv($globals.TestFailure)._new();
  47197. $recv($1)._messageText_(aString);
  47198. $recv($1)._signal();
  47199. return self;
  47200. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47201. },
  47202. args: ["aString"],
  47203. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47204. referencedClasses: ["TestFailure"],
  47205. messageSends: ["messageText:", "new", "signal"]
  47206. }),
  47207. $globals.TestCase);
  47208. $core.addMethod(
  47209. $core.method({
  47210. selector: "tearDown",
  47211. protocol: "running",
  47212. fn: function (){
  47213. var self=this,$self=this;
  47214. return self;
  47215. },
  47216. args: [],
  47217. source: "tearDown",
  47218. referencedClasses: [],
  47219. messageSends: []
  47220. }),
  47221. $globals.TestCase);
  47222. $core.addMethod(
  47223. $core.method({
  47224. selector: "timeout:",
  47225. protocol: "async",
  47226. fn: function (aNumber){
  47227. var self=this,$self=this;
  47228. return $core.withContext(function($ctx1) {
  47229. var $1,$receiver;
  47230. $1=$self["@asyncTimeout"];
  47231. if(($receiver = $1) == null || $receiver.a$nil){
  47232. $1;
  47233. } else {
  47234. $recv($self["@asyncTimeout"])._clearTimeout();
  47235. }
  47236. $self["@asyncTimeout"]=(0);
  47237. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47238. return $core.withContext(function($ctx2) {
  47239. return $self._assert_description_(false,"SUnit grace time exhausted");
  47240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47241. })))._valueWithTimeout_(aNumber);
  47242. return self;
  47243. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47244. },
  47245. args: ["aNumber"],
  47246. 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",
  47247. referencedClasses: [],
  47248. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47249. }),
  47250. $globals.TestCase);
  47251. $core.addMethod(
  47252. $core.method({
  47253. selector: "allTestSelectors",
  47254. protocol: "accessing",
  47255. fn: function (){
  47256. var self=this,$self=this;
  47257. var selectors;
  47258. return $core.withContext(function($ctx1) {
  47259. var $1;
  47260. selectors=$self._testSelectors();
  47261. $1=$self._shouldInheritSelectors();
  47262. if($core.assert($1)){
  47263. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47264. }
  47265. return selectors;
  47266. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47267. },
  47268. args: [],
  47269. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47270. referencedClasses: [],
  47271. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47272. }),
  47273. $globals.TestCase.a$cls);
  47274. $core.addMethod(
  47275. $core.method({
  47276. selector: "buildSuite",
  47277. protocol: "accessing",
  47278. fn: function (){
  47279. var self=this,$self=this;
  47280. return $core.withContext(function($ctx1) {
  47281. return $recv($self._allTestSelectors())._collect_((function(each){
  47282. return $core.withContext(function($ctx2) {
  47283. return $self._selector_(each);
  47284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47285. }));
  47286. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47287. },
  47288. args: [],
  47289. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47290. referencedClasses: [],
  47291. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47292. }),
  47293. $globals.TestCase.a$cls);
  47294. $core.addMethod(
  47295. $core.method({
  47296. selector: "classTag",
  47297. protocol: "accessing",
  47298. fn: function (){
  47299. var self=this,$self=this;
  47300. return "test";
  47301. },
  47302. args: [],
  47303. 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'",
  47304. referencedClasses: [],
  47305. messageSends: []
  47306. }),
  47307. $globals.TestCase.a$cls);
  47308. $core.addMethod(
  47309. $core.method({
  47310. selector: "isAbstract",
  47311. protocol: "testing",
  47312. fn: function (){
  47313. var self=this,$self=this;
  47314. return $core.withContext(function($ctx1) {
  47315. return $recv($self._name()).__eq("TestCase");
  47316. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47317. },
  47318. args: [],
  47319. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47320. referencedClasses: [],
  47321. messageSends: ["=", "name"]
  47322. }),
  47323. $globals.TestCase.a$cls);
  47324. $core.addMethod(
  47325. $core.method({
  47326. selector: "isTestClass",
  47327. protocol: "testing",
  47328. fn: function (){
  47329. var self=this,$self=this;
  47330. return $core.withContext(function($ctx1) {
  47331. return $recv($self._isAbstract())._not();
  47332. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47333. },
  47334. args: [],
  47335. source: "isTestClass\x0a\x09^ self isAbstract not",
  47336. referencedClasses: [],
  47337. messageSends: ["not", "isAbstract"]
  47338. }),
  47339. $globals.TestCase.a$cls);
  47340. $core.addMethod(
  47341. $core.method({
  47342. selector: "lookupHierarchyRoot",
  47343. protocol: "accessing",
  47344. fn: function (){
  47345. var self=this,$self=this;
  47346. return $globals.TestCase;
  47347. },
  47348. args: [],
  47349. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47350. referencedClasses: ["TestCase"],
  47351. messageSends: []
  47352. }),
  47353. $globals.TestCase.a$cls);
  47354. $core.addMethod(
  47355. $core.method({
  47356. selector: "selector:",
  47357. protocol: "accessing",
  47358. fn: function (aSelector){
  47359. var self=this,$self=this;
  47360. return $core.withContext(function($ctx1) {
  47361. var $1;
  47362. $1=$self._new();
  47363. $recv($1)._setTestSelector_(aSelector);
  47364. return $recv($1)._yourself();
  47365. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47366. },
  47367. args: ["aSelector"],
  47368. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47369. referencedClasses: [],
  47370. messageSends: ["setTestSelector:", "new", "yourself"]
  47371. }),
  47372. $globals.TestCase.a$cls);
  47373. $core.addMethod(
  47374. $core.method({
  47375. selector: "shouldInheritSelectors",
  47376. protocol: "testing",
  47377. fn: function (){
  47378. var self=this,$self=this;
  47379. return $core.withContext(function($ctx1) {
  47380. return $self.__tild_eq($self._lookupHierarchyRoot());
  47381. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47382. },
  47383. args: [],
  47384. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47385. referencedClasses: [],
  47386. messageSends: ["~=", "lookupHierarchyRoot"]
  47387. }),
  47388. $globals.TestCase.a$cls);
  47389. $core.addMethod(
  47390. $core.method({
  47391. selector: "testSelectors",
  47392. protocol: "accessing",
  47393. fn: function (){
  47394. var self=this,$self=this;
  47395. return $core.withContext(function($ctx1) {
  47396. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47397. return $core.withContext(function($ctx2) {
  47398. return $recv(each)._match_("^test");
  47399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47400. }));
  47401. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47402. },
  47403. args: [],
  47404. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47405. referencedClasses: [],
  47406. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47407. }),
  47408. $globals.TestCase.a$cls);
  47409. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47410. $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).";
  47411. $core.addMethod(
  47412. $core.method({
  47413. selector: "execute:",
  47414. protocol: "running",
  47415. fn: function (aBlock){
  47416. var self=this,$self=this;
  47417. var failed;
  47418. return $core.withContext(function($ctx1) {
  47419. var $1,$2;
  47420. $recv($self["@testCase"])._context_(self);
  47421. $ctx1.sendIdx["context:"]=1;
  47422. $recv((function(){
  47423. return $core.withContext(function($ctx2) {
  47424. failed=true;
  47425. failed;
  47426. $recv(aBlock)._value();
  47427. failed=false;
  47428. return failed;
  47429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47430. }))._ensure_((function(){
  47431. return $core.withContext(function($ctx2) {
  47432. $recv($self["@testCase"])._context_(nil);
  47433. $1=$recv(failed)._and_((function(){
  47434. return $core.withContext(function($ctx3) {
  47435. return $recv($self["@testCase"])._isAsync();
  47436. $ctx3.sendIdx["isAsync"]=1;
  47437. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47438. }));
  47439. if($core.assert($1)){
  47440. $recv($self["@testCase"])._finished();
  47441. }
  47442. $2=$recv($self["@testCase"])._isAsync();
  47443. if(!$core.assert($2)){
  47444. return $recv($self["@testCase"])._tearDown();
  47445. }
  47446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47447. }));
  47448. return self;
  47449. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47450. },
  47451. args: ["aBlock"],
  47452. 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 ] ]",
  47453. referencedClasses: [],
  47454. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47455. }),
  47456. $globals.TestContext);
  47457. $core.addMethod(
  47458. $core.method({
  47459. selector: "start",
  47460. protocol: "running",
  47461. fn: function (){
  47462. var self=this,$self=this;
  47463. return $core.withContext(function($ctx1) {
  47464. $self._execute_((function(){
  47465. return $core.withContext(function($ctx2) {
  47466. $recv($self["@testCase"])._setUp();
  47467. return $recv($self["@testCase"])._performTest();
  47468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47469. }));
  47470. return self;
  47471. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47472. },
  47473. args: [],
  47474. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47475. referencedClasses: [],
  47476. messageSends: ["execute:", "setUp", "performTest"]
  47477. }),
  47478. $globals.TestContext);
  47479. $core.addMethod(
  47480. $core.method({
  47481. selector: "testCase:",
  47482. protocol: "accessing",
  47483. fn: function (aTestCase){
  47484. var self=this,$self=this;
  47485. $self["@testCase"]=aTestCase;
  47486. return self;
  47487. },
  47488. args: ["aTestCase"],
  47489. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  47490. referencedClasses: [],
  47491. messageSends: []
  47492. }),
  47493. $globals.TestContext);
  47494. $core.addMethod(
  47495. $core.method({
  47496. selector: "testCase:",
  47497. protocol: "instance creation",
  47498. fn: function (aTestCase){
  47499. var self=this,$self=this;
  47500. return $core.withContext(function($ctx1) {
  47501. var $1;
  47502. $1=$self._new();
  47503. $recv($1)._testCase_(aTestCase);
  47504. return $recv($1)._yourself();
  47505. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  47506. },
  47507. args: ["aTestCase"],
  47508. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  47509. referencedClasses: [],
  47510. messageSends: ["testCase:", "new", "yourself"]
  47511. }),
  47512. $globals.TestContext.a$cls);
  47513. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  47514. $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`.";
  47515. $core.addMethod(
  47516. $core.method({
  47517. selector: "execute:",
  47518. protocol: "running",
  47519. fn: function (aBlock){
  47520. var self=this,$self=this;
  47521. return $core.withContext(function($ctx1) {
  47522. var $1;
  47523. $recv((function(){
  47524. return $core.withContext(function($ctx2) {
  47525. return $self._withErrorReporting_((function(){
  47526. return $core.withContext(function($ctx3) {
  47527. return (
  47528. $ctx3.supercall = true,
  47529. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  47530. $ctx3.supercall = false;
  47531. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47532. }));
  47533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47534. }))._ensure_((function(){
  47535. return $core.withContext(function($ctx2) {
  47536. $1=$recv($self["@testCase"])._isAsync();
  47537. if(!$core.assert($1)){
  47538. $recv($self["@result"])._increaseRuns();
  47539. return $recv($self["@finished"])._value();
  47540. }
  47541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47542. }));
  47543. return self;
  47544. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47545. },
  47546. args: ["aBlock"],
  47547. 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 ] ]",
  47548. referencedClasses: [],
  47549. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  47550. }),
  47551. $globals.ReportingTestContext);
  47552. $core.addMethod(
  47553. $core.method({
  47554. selector: "finished:",
  47555. protocol: "accessing",
  47556. fn: function (aBlock){
  47557. var self=this,$self=this;
  47558. $self["@finished"]=aBlock;
  47559. return self;
  47560. },
  47561. args: ["aBlock"],
  47562. source: "finished: aBlock\x0a\x09finished := aBlock",
  47563. referencedClasses: [],
  47564. messageSends: []
  47565. }),
  47566. $globals.ReportingTestContext);
  47567. $core.addMethod(
  47568. $core.method({
  47569. selector: "result:",
  47570. protocol: "accessing",
  47571. fn: function (aTestResult){
  47572. var self=this,$self=this;
  47573. $self["@result"]=aTestResult;
  47574. return self;
  47575. },
  47576. args: ["aTestResult"],
  47577. source: "result: aTestResult\x0a\x09result := aTestResult",
  47578. referencedClasses: [],
  47579. messageSends: []
  47580. }),
  47581. $globals.ReportingTestContext);
  47582. $core.addMethod(
  47583. $core.method({
  47584. selector: "withErrorReporting:",
  47585. protocol: "private",
  47586. fn: function (aBlock){
  47587. var self=this,$self=this;
  47588. return $core.withContext(function($ctx1) {
  47589. $recv((function(){
  47590. return $core.withContext(function($ctx2) {
  47591. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  47592. return $core.withContext(function($ctx3) {
  47593. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  47594. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  47595. }));
  47596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47597. }))._on_do_($globals.Error,(function(ex){
  47598. return $core.withContext(function($ctx2) {
  47599. return $recv($self["@result"])._addError_($self["@testCase"]);
  47600. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  47601. }));
  47602. $ctx1.sendIdx["on:do:"]=1;
  47603. return self;
  47604. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47605. },
  47606. args: ["aBlock"],
  47607. 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 ]",
  47608. referencedClasses: ["TestFailure", "Error"],
  47609. messageSends: ["on:do:", "addFailure:", "addError:"]
  47610. }),
  47611. $globals.ReportingTestContext);
  47612. $core.addMethod(
  47613. $core.method({
  47614. selector: "testCase:result:finished:",
  47615. protocol: "instance creation",
  47616. fn: function (aTestCase,aTestResult,aBlock){
  47617. var self=this,$self=this;
  47618. return $core.withContext(function($ctx1) {
  47619. var $1;
  47620. $1=(
  47621. $ctx1.supercall = true,
  47622. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  47623. $ctx1.supercall = false;
  47624. $recv($1)._result_(aTestResult);
  47625. $recv($1)._finished_(aBlock);
  47626. return $recv($1)._yourself();
  47627. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  47628. },
  47629. args: ["aTestCase", "aTestResult", "aBlock"],
  47630. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  47631. referencedClasses: [],
  47632. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  47633. }),
  47634. $globals.ReportingTestContext.a$cls);
  47635. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  47636. $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.";
  47637. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  47638. $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";
  47639. $core.addMethod(
  47640. $core.method({
  47641. selector: "addError:",
  47642. protocol: "accessing",
  47643. fn: function (anError){
  47644. var self=this,$self=this;
  47645. return $core.withContext(function($ctx1) {
  47646. $recv($self._errors())._add_(anError);
  47647. return self;
  47648. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  47649. },
  47650. args: ["anError"],
  47651. source: "addError: anError\x0a\x09self errors add: anError",
  47652. referencedClasses: [],
  47653. messageSends: ["add:", "errors"]
  47654. }),
  47655. $globals.TestResult);
  47656. $core.addMethod(
  47657. $core.method({
  47658. selector: "addFailure:",
  47659. protocol: "accessing",
  47660. fn: function (aFailure){
  47661. var self=this,$self=this;
  47662. return $core.withContext(function($ctx1) {
  47663. $recv($self._failures())._add_(aFailure);
  47664. return self;
  47665. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  47666. },
  47667. args: ["aFailure"],
  47668. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  47669. referencedClasses: [],
  47670. messageSends: ["add:", "failures"]
  47671. }),
  47672. $globals.TestResult);
  47673. $core.addMethod(
  47674. $core.method({
  47675. selector: "errors",
  47676. protocol: "accessing",
  47677. fn: function (){
  47678. var self=this,$self=this;
  47679. return $self["@errors"];
  47680. },
  47681. args: [],
  47682. source: "errors\x0a\x09^ errors",
  47683. referencedClasses: [],
  47684. messageSends: []
  47685. }),
  47686. $globals.TestResult);
  47687. $core.addMethod(
  47688. $core.method({
  47689. selector: "failures",
  47690. protocol: "accessing",
  47691. fn: function (){
  47692. var self=this,$self=this;
  47693. return $self["@failures"];
  47694. },
  47695. args: [],
  47696. source: "failures\x0a\x09^ failures",
  47697. referencedClasses: [],
  47698. messageSends: []
  47699. }),
  47700. $globals.TestResult);
  47701. $core.addMethod(
  47702. $core.method({
  47703. selector: "increaseRuns",
  47704. protocol: "accessing",
  47705. fn: function (){
  47706. var self=this,$self=this;
  47707. return $core.withContext(function($ctx1) {
  47708. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  47709. return self;
  47710. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  47711. },
  47712. args: [],
  47713. source: "increaseRuns\x0a\x09runs := runs + 1",
  47714. referencedClasses: [],
  47715. messageSends: ["+"]
  47716. }),
  47717. $globals.TestResult);
  47718. $core.addMethod(
  47719. $core.method({
  47720. selector: "initialize",
  47721. protocol: "initialization",
  47722. fn: function (){
  47723. var self=this,$self=this;
  47724. return $core.withContext(function($ctx1) {
  47725. (
  47726. $ctx1.supercall = true,
  47727. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  47728. $ctx1.supercall = false;
  47729. $self["@timestamp"]=$recv($globals.Date)._now();
  47730. $self["@runs"]=(0);
  47731. $self["@errors"]=$recv($globals.Array)._new();
  47732. $ctx1.sendIdx["new"]=1;
  47733. $self["@failures"]=$recv($globals.Array)._new();
  47734. $self["@total"]=(0);
  47735. return self;
  47736. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  47737. },
  47738. args: [],
  47739. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  47740. referencedClasses: ["Date", "Array"],
  47741. messageSends: ["initialize", "now", "new"]
  47742. }),
  47743. $globals.TestResult);
  47744. $core.addMethod(
  47745. $core.method({
  47746. selector: "nextRunDo:",
  47747. protocol: "running",
  47748. fn: function (aBlock){
  47749. var self=this,$self=this;
  47750. return $core.withContext(function($ctx1) {
  47751. var $2,$1;
  47752. $2=$self._runs();
  47753. $ctx1.sendIdx["runs"]=1;
  47754. $1=$recv($2).__eq_eq($self._total());
  47755. if(!$core.assert($1)){
  47756. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  47757. }
  47758. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  47759. },
  47760. args: ["aBlock"],
  47761. 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 ]",
  47762. referencedClasses: [],
  47763. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  47764. }),
  47765. $globals.TestResult);
  47766. $core.addMethod(
  47767. $core.method({
  47768. selector: "runCase:",
  47769. protocol: "running",
  47770. fn: function (aTestCase){
  47771. var self=this,$self=this;
  47772. return $core.withContext(function($ctx1) {
  47773. $recv((function(){
  47774. return $core.withContext(function($ctx2) {
  47775. return $recv((function(){
  47776. return $core.withContext(function($ctx3) {
  47777. $self._increaseRuns();
  47778. return $recv(aTestCase)._runCase();
  47779. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47780. }))._on_do_($globals.TestFailure,(function(ex){
  47781. return $core.withContext(function($ctx3) {
  47782. return $self._addFailure_(aTestCase);
  47783. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47784. }));
  47785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47786. }))._on_do_($globals.Error,(function(ex){
  47787. return $core.withContext(function($ctx2) {
  47788. return $self._addError_(aTestCase);
  47789. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  47790. }));
  47791. $ctx1.sendIdx["on:do:"]=1;
  47792. return self;
  47793. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  47794. },
  47795. args: ["aTestCase"],
  47796. 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 ]",
  47797. referencedClasses: ["TestFailure", "Error"],
  47798. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  47799. }),
  47800. $globals.TestResult);
  47801. $core.addMethod(
  47802. $core.method({
  47803. selector: "runs",
  47804. protocol: "accessing",
  47805. fn: function (){
  47806. var self=this,$self=this;
  47807. return $self["@runs"];
  47808. },
  47809. args: [],
  47810. source: "runs\x0a\x09^ runs",
  47811. referencedClasses: [],
  47812. messageSends: []
  47813. }),
  47814. $globals.TestResult);
  47815. $core.addMethod(
  47816. $core.method({
  47817. selector: "status",
  47818. protocol: "accessing",
  47819. fn: function (){
  47820. var self=this,$self=this;
  47821. return $core.withContext(function($ctx1) {
  47822. var $1;
  47823. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  47824. return "error";
  47825. }),(function(){
  47826. return $core.withContext(function($ctx2) {
  47827. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  47828. return "failure";
  47829. }),(function(){
  47830. return "success";
  47831. }));
  47832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47833. }));
  47834. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  47835. return $1;
  47836. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  47837. },
  47838. args: [],
  47839. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  47840. referencedClasses: [],
  47841. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  47842. }),
  47843. $globals.TestResult);
  47844. $core.addMethod(
  47845. $core.method({
  47846. selector: "timestamp",
  47847. protocol: "accessing",
  47848. fn: function (){
  47849. var self=this,$self=this;
  47850. return $self["@timestamp"];
  47851. },
  47852. args: [],
  47853. source: "timestamp\x0a\x09^ timestamp",
  47854. referencedClasses: [],
  47855. messageSends: []
  47856. }),
  47857. $globals.TestResult);
  47858. $core.addMethod(
  47859. $core.method({
  47860. selector: "total",
  47861. protocol: "accessing",
  47862. fn: function (){
  47863. var self=this,$self=this;
  47864. return $self["@total"];
  47865. },
  47866. args: [],
  47867. source: "total\x0a\x09^ total",
  47868. referencedClasses: [],
  47869. messageSends: []
  47870. }),
  47871. $globals.TestResult);
  47872. $core.addMethod(
  47873. $core.method({
  47874. selector: "total:",
  47875. protocol: "accessing",
  47876. fn: function (aNumber){
  47877. var self=this,$self=this;
  47878. $self["@total"]=aNumber;
  47879. return self;
  47880. },
  47881. args: ["aNumber"],
  47882. source: "total: aNumber\x0a\x09total := aNumber",
  47883. referencedClasses: [],
  47884. messageSends: []
  47885. }),
  47886. $globals.TestResult);
  47887. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  47888. $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`.";
  47889. $core.addMethod(
  47890. $core.method({
  47891. selector: "announcer",
  47892. protocol: "accessing",
  47893. fn: function (){
  47894. var self=this,$self=this;
  47895. return $self["@announcer"];
  47896. },
  47897. args: [],
  47898. source: "announcer\x0a\x09^ announcer",
  47899. referencedClasses: [],
  47900. messageSends: []
  47901. }),
  47902. $globals.TestSuiteRunner);
  47903. $core.addMethod(
  47904. $core.method({
  47905. selector: "contextOf:",
  47906. protocol: "private",
  47907. fn: function (anInteger){
  47908. var self=this,$self=this;
  47909. return $core.withContext(function($ctx1) {
  47910. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  47911. return $core.withContext(function($ctx2) {
  47912. return $self._resume();
  47913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47914. }));
  47915. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  47916. },
  47917. args: ["anInteger"],
  47918. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  47919. referencedClasses: ["ReportingTestContext"],
  47920. messageSends: ["testCase:result:finished:", "at:", "resume"]
  47921. }),
  47922. $globals.TestSuiteRunner);
  47923. $core.addMethod(
  47924. $core.method({
  47925. selector: "initialize",
  47926. protocol: "initialization",
  47927. fn: function (){
  47928. var self=this,$self=this;
  47929. return $core.withContext(function($ctx1) {
  47930. var $1;
  47931. (
  47932. $ctx1.supercall = true,
  47933. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  47934. $ctx1.supercall = false;
  47935. $self["@announcer"]=$recv($globals.Announcer)._new();
  47936. $ctx1.sendIdx["new"]=1;
  47937. $self["@result"]=$recv($globals.TestResult)._new();
  47938. $self["@runNextTest"]=(function(){
  47939. var runs;
  47940. return $core.withContext(function($ctx2) {
  47941. runs=$recv($self["@result"])._runs();
  47942. runs;
  47943. $1=$recv(runs).__lt($recv($self["@result"])._total());
  47944. if($core.assert($1)){
  47945. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  47946. }
  47947. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  47948. });
  47949. return self;
  47950. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  47951. },
  47952. args: [],
  47953. 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 ] ].",
  47954. referencedClasses: ["Announcer", "TestResult"],
  47955. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  47956. }),
  47957. $globals.TestSuiteRunner);
  47958. $core.addMethod(
  47959. $core.method({
  47960. selector: "result",
  47961. protocol: "accessing",
  47962. fn: function (){
  47963. var self=this,$self=this;
  47964. return $self["@result"];
  47965. },
  47966. args: [],
  47967. source: "result\x0a\x09^ result",
  47968. referencedClasses: [],
  47969. messageSends: []
  47970. }),
  47971. $globals.TestSuiteRunner);
  47972. $core.addMethod(
  47973. $core.method({
  47974. selector: "resume",
  47975. protocol: "actions",
  47976. fn: function (){
  47977. var self=this,$self=this;
  47978. return $core.withContext(function($ctx1) {
  47979. $recv($self["@runNextTest"])._fork();
  47980. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  47981. return self;
  47982. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  47983. },
  47984. args: [],
  47985. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  47986. referencedClasses: ["ResultAnnouncement"],
  47987. messageSends: ["fork", "announce:", "result:", "new"]
  47988. }),
  47989. $globals.TestSuiteRunner);
  47990. $core.addMethod(
  47991. $core.method({
  47992. selector: "run",
  47993. protocol: "actions",
  47994. fn: function (){
  47995. var self=this,$self=this;
  47996. return $core.withContext(function($ctx1) {
  47997. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  47998. $self._resume();
  47999. return self;
  48000. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48001. },
  48002. args: [],
  48003. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48004. referencedClasses: [],
  48005. messageSends: ["total:", "size", "resume"]
  48006. }),
  48007. $globals.TestSuiteRunner);
  48008. $core.addMethod(
  48009. $core.method({
  48010. selector: "suite:",
  48011. protocol: "accessing",
  48012. fn: function (aCollection){
  48013. var self=this,$self=this;
  48014. $self["@suite"]=aCollection;
  48015. return self;
  48016. },
  48017. args: ["aCollection"],
  48018. source: "suite: aCollection\x0a\x09suite := aCollection",
  48019. referencedClasses: [],
  48020. messageSends: []
  48021. }),
  48022. $globals.TestSuiteRunner);
  48023. $core.addMethod(
  48024. $core.method({
  48025. selector: "new",
  48026. protocol: "instance creation",
  48027. fn: function (){
  48028. var self=this,$self=this;
  48029. return $core.withContext(function($ctx1) {
  48030. $self._shouldNotImplement();
  48031. return self;
  48032. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48033. },
  48034. args: [],
  48035. source: "new\x0a\x09self shouldNotImplement",
  48036. referencedClasses: [],
  48037. messageSends: ["shouldNotImplement"]
  48038. }),
  48039. $globals.TestSuiteRunner.a$cls);
  48040. $core.addMethod(
  48041. $core.method({
  48042. selector: "on:",
  48043. protocol: "instance creation",
  48044. fn: function (aCollection){
  48045. var self=this,$self=this;
  48046. return $core.withContext(function($ctx1) {
  48047. var $1;
  48048. $1=(
  48049. $ctx1.supercall = true,
  48050. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48051. $ctx1.supercall = false;
  48052. return $recv($1)._suite_(aCollection);
  48053. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48054. },
  48055. args: ["aCollection"],
  48056. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48057. referencedClasses: [],
  48058. messageSends: ["suite:", "new"]
  48059. }),
  48060. $globals.TestSuiteRunner.a$cls);
  48061. $core.addMethod(
  48062. $core.method({
  48063. selector: "isTestPackage",
  48064. protocol: "*SUnit",
  48065. fn: function (){
  48066. var self=this,$self=this;
  48067. return $core.withContext(function($ctx1) {
  48068. return $recv($self._classes())._anySatisfy_((function(each){
  48069. return $core.withContext(function($ctx2) {
  48070. return $recv(each)._isTestClass();
  48071. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48072. }));
  48073. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48074. },
  48075. args: [],
  48076. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48077. referencedClasses: [],
  48078. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48079. }),
  48080. $globals.Package);
  48081. $core.addMethod(
  48082. $core.method({
  48083. selector: "isTestClass",
  48084. protocol: "*SUnit",
  48085. fn: function (){
  48086. var self=this,$self=this;
  48087. return false;
  48088. },
  48089. args: [],
  48090. source: "isTestClass\x0a\x09^ false",
  48091. referencedClasses: [],
  48092. messageSends: []
  48093. }),
  48094. $globals.TBehaviorDefaults);
  48095. });
  48096. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48097. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48098. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48099. $core.addPackage("Compiler-Tests");
  48100. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48101. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48102. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48103. $core.addMethod(
  48104. $core.method({
  48105. selector: "analyze:forClass:",
  48106. protocol: "convenience",
  48107. fn: function (aNode,aClass){
  48108. var self=this,$self=this;
  48109. return $core.withContext(function($ctx1) {
  48110. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  48111. return aNode;
  48112. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  48113. },
  48114. args: ["aNode", "aClass"],
  48115. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  48116. referencedClasses: ["SemanticAnalyzer"],
  48117. messageSends: ["visit:", "on:"]
  48118. }),
  48119. $globals.ASTParsingTest);
  48120. $core.addMethod(
  48121. $core.method({
  48122. selector: "parse:",
  48123. protocol: "parsing",
  48124. fn: function (aString){
  48125. var self=this,$self=this;
  48126. return $core.withContext(function($ctx1) {
  48127. return $recv($globals.Smalltalk)._parse_(aString);
  48128. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  48129. },
  48130. args: ["aString"],
  48131. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  48132. referencedClasses: ["Smalltalk"],
  48133. messageSends: ["parse:"]
  48134. }),
  48135. $globals.ASTParsingTest);
  48136. $core.addMethod(
  48137. $core.method({
  48138. selector: "parse:forClass:",
  48139. protocol: "parsing",
  48140. fn: function (aString,aClass){
  48141. var self=this,$self=this;
  48142. return $core.withContext(function($ctx1) {
  48143. return $self._analyze_forClass_($self._parse_(aString),aClass);
  48144. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48145. },
  48146. args: ["aString", "aClass"],
  48147. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  48148. referencedClasses: [],
  48149. messageSends: ["analyze:forClass:", "parse:"]
  48150. }),
  48151. $globals.ASTParsingTest);
  48152. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48153. $core.addMethod(
  48154. $core.method({
  48155. selector: "astPCNodeVisitor",
  48156. protocol: "factory",
  48157. fn: function (){
  48158. var self=this,$self=this;
  48159. return $core.withContext(function($ctx1) {
  48160. var $1;
  48161. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48162. $recv($1)._index_((0));
  48163. return $recv($1)._yourself();
  48164. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48165. },
  48166. args: [],
  48167. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48168. referencedClasses: ["ASTPCNodeVisitor"],
  48169. messageSends: ["index:", "new", "yourself"]
  48170. }),
  48171. $globals.ASTPCNodeVisitorTest);
  48172. $core.addMethod(
  48173. $core.method({
  48174. selector: "astPCNodeVisitorForSelector:",
  48175. protocol: "factory",
  48176. fn: function (aString){
  48177. var self=this,$self=this;
  48178. return $core.withContext(function($ctx1) {
  48179. var $1;
  48180. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48181. $recv($1)._selector_(aString);
  48182. $recv($1)._index_((0));
  48183. return $recv($1)._yourself();
  48184. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48185. },
  48186. args: ["aString"],
  48187. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48188. referencedClasses: ["ASTPCNodeVisitor"],
  48189. messageSends: ["selector:", "new", "index:", "yourself"]
  48190. }),
  48191. $globals.ASTPCNodeVisitorTest);
  48192. $core.addMethod(
  48193. $core.method({
  48194. selector: "testJSStatementNode",
  48195. protocol: "tests",
  48196. fn: function (){
  48197. var self=this,$self=this;
  48198. var ast,visitor;
  48199. return $core.withContext(function($ctx1) {
  48200. var $3,$2,$1;
  48201. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48202. $3=$self._astPCNodeVisitor();
  48203. $recv($3)._visit_(ast);
  48204. $2=$recv($3)._currentNode();
  48205. $1=$recv($2)._isJSStatementNode();
  48206. $self._assert_($1);
  48207. return self;
  48208. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48209. },
  48210. args: [],
  48211. 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",
  48212. referencedClasses: ["Object"],
  48213. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48214. }),
  48215. $globals.ASTPCNodeVisitorTest);
  48216. $core.addMethod(
  48217. $core.method({
  48218. selector: "testLegacyJSStatementNode",
  48219. protocol: "tests",
  48220. fn: function (){
  48221. var self=this,$self=this;
  48222. var ast,visitor;
  48223. return $core.withContext(function($ctx1) {
  48224. var $3,$2,$1;
  48225. ast=$self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  48226. $3=$self._astPCNodeVisitor();
  48227. $recv($3)._visit_(ast);
  48228. $2=$recv($3)._currentNode();
  48229. $1=$recv($2)._isJSStatementNode();
  48230. $self._assert_($1);
  48231. return self;
  48232. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48233. },
  48234. args: [],
  48235. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  48236. referencedClasses: ["Object"],
  48237. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48238. }),
  48239. $globals.ASTPCNodeVisitorTest);
  48240. $core.addMethod(
  48241. $core.method({
  48242. selector: "testMessageSend",
  48243. protocol: "tests",
  48244. fn: function (){
  48245. var self=this,$self=this;
  48246. var ast;
  48247. return $core.withContext(function($ctx1) {
  48248. var $3,$2,$1;
  48249. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48250. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48251. $recv($3)._visit_(ast);
  48252. $2=$recv($3)._currentNode();
  48253. $1=$recv($2)._selector();
  48254. $self._assert_equals_($1,"yourself");
  48255. return self;
  48256. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48257. },
  48258. args: [],
  48259. 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'",
  48260. referencedClasses: ["Object"],
  48261. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48262. }),
  48263. $globals.ASTPCNodeVisitorTest);
  48264. $core.addMethod(
  48265. $core.method({
  48266. selector: "testMessageSendWithBlocks",
  48267. protocol: "tests",
  48268. fn: function (){
  48269. var self=this,$self=this;
  48270. var ast;
  48271. return $core.withContext(function($ctx1) {
  48272. var $3,$2,$1;
  48273. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48274. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48275. $recv($3)._visit_(ast);
  48276. $2=$recv($3)._currentNode();
  48277. $1=$recv($2)._selector();
  48278. $self._assert_equals_($1,"yourself");
  48279. return self;
  48280. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48281. },
  48282. args: [],
  48283. 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'",
  48284. referencedClasses: ["Object"],
  48285. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48286. }),
  48287. $globals.ASTPCNodeVisitorTest);
  48288. $core.addMethod(
  48289. $core.method({
  48290. selector: "testMessageSendWithInlining",
  48291. protocol: "tests",
  48292. fn: function (){
  48293. var self=this,$self=this;
  48294. var ast;
  48295. return $core.withContext(function($ctx1) {
  48296. var $3,$4,$2,$1,$7,$6,$5;
  48297. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48298. $ctx1.sendIdx["parse:forClass:"]=1;
  48299. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48300. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48301. $recv($3)._visit_(ast);
  48302. $ctx1.sendIdx["visit:"]=1;
  48303. $4=$recv($3)._currentNode();
  48304. $ctx1.sendIdx["currentNode"]=1;
  48305. $2=$4;
  48306. $1=$recv($2)._selector();
  48307. $ctx1.sendIdx["selector"]=1;
  48308. $self._assert_equals_($1,"yourself");
  48309. $ctx1.sendIdx["assert:equals:"]=1;
  48310. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48311. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48312. $recv($7)._visit_(ast);
  48313. $6=$recv($7)._currentNode();
  48314. $5=$recv($6)._selector();
  48315. $self._assert_equals_($5,"asBoolean");
  48316. return self;
  48317. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48318. },
  48319. args: [],
  48320. 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'",
  48321. referencedClasses: ["Object"],
  48322. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48323. }),
  48324. $globals.ASTPCNodeVisitorTest);
  48325. $core.addMethod(
  48326. $core.method({
  48327. selector: "testNoMessageSend",
  48328. protocol: "tests",
  48329. fn: function (){
  48330. var self=this,$self=this;
  48331. var ast;
  48332. return $core.withContext(function($ctx1) {
  48333. var $3,$2,$1;
  48334. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48335. $3=$self._astPCNodeVisitor();
  48336. $recv($3)._visit_(ast);
  48337. $2=$recv($3)._currentNode();
  48338. $1=$recv($2)._isNil();
  48339. $self._assert_($1);
  48340. return self;
  48341. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48342. },
  48343. args: [],
  48344. 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",
  48345. referencedClasses: ["Object"],
  48346. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48347. }),
  48348. $globals.ASTPCNodeVisitorTest);
  48349. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48350. $core.addMethod(
  48351. $core.method({
  48352. selector: "testNodeAtPosition",
  48353. protocol: "tests",
  48354. fn: function (){
  48355. var self=this,$self=this;
  48356. var node;
  48357. return $core.withContext(function($ctx1) {
  48358. var $3,$4,$2,$1,$7,$8,$6,$5;
  48359. node=$self._parse_("yourself\x0a\x09^ self");
  48360. $ctx1.sendIdx["parse:"]=1;
  48361. $3=node;
  48362. $4=(2).__at((4));
  48363. $ctx1.sendIdx["@"]=1;
  48364. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48365. return nil;
  48366. }));
  48367. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48368. $1=$recv($2)._source();
  48369. $self._assert_equals_($1,"self");
  48370. $ctx1.sendIdx["assert:equals:"]=1;
  48371. node=$self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  48372. $ctx1.sendIdx["parse:"]=2;
  48373. $7=node;
  48374. $8=(2).__at((7));
  48375. $ctx1.sendIdx["@"]=2;
  48376. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48377. return nil;
  48378. }));
  48379. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48380. $5=$recv($6)._selector();
  48381. $ctx1.sendIdx["selector"]=1;
  48382. $self._assert_equals_($5,"ifTrue:");
  48383. $ctx1.sendIdx["assert:equals:"]=2;
  48384. node=$self._parse_("foo\x0a\x09self foo; bar; baz");
  48385. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48386. return nil;
  48387. })))._selector(),"foo");
  48388. return self;
  48389. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48390. },
  48391. args: [],
  48392. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48393. referencedClasses: [],
  48394. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48395. }),
  48396. $globals.ASTPositionTest);
  48397. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48398. $core.addMethod(
  48399. $core.method({
  48400. selector: "codeGeneratorClass",
  48401. protocol: "accessing",
  48402. fn: function (){
  48403. var self=this,$self=this;
  48404. return $globals.CodeGenerator;
  48405. },
  48406. args: [],
  48407. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48408. referencedClasses: ["CodeGenerator"],
  48409. messageSends: []
  48410. }),
  48411. $globals.CodeGeneratorTest);
  48412. $core.addMethod(
  48413. $core.method({
  48414. selector: "compiler",
  48415. protocol: "factory",
  48416. fn: function (){
  48417. var self=this,$self=this;
  48418. return $core.withContext(function($ctx1) {
  48419. var $1;
  48420. $1=$recv($globals.Compiler)._new();
  48421. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48422. return $recv($1)._yourself();
  48423. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48424. },
  48425. args: [],
  48426. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48427. referencedClasses: ["Compiler"],
  48428. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48429. }),
  48430. $globals.CodeGeneratorTest);
  48431. $core.addMethod(
  48432. $core.method({
  48433. selector: "setUp",
  48434. protocol: "initialization",
  48435. fn: function (){
  48436. var self=this,$self=this;
  48437. return $core.withContext(function($ctx1) {
  48438. $self["@receiver"]=$recv($globals.DoIt)._new();
  48439. return self;
  48440. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48441. },
  48442. args: [],
  48443. source: "setUp\x0a\x09receiver := DoIt new",
  48444. referencedClasses: ["DoIt"],
  48445. messageSends: ["new"]
  48446. }),
  48447. $globals.CodeGeneratorTest);
  48448. $core.addMethod(
  48449. $core.method({
  48450. selector: "should:receiver:raise:",
  48451. protocol: "testing",
  48452. fn: function (aString,anObject,anErrorClass){
  48453. var self=this,$self=this;
  48454. var method,result;
  48455. return $core.withContext(function($ctx1) {
  48456. var $1,$2,$3,$receiver;
  48457. $self["@receiver"]=anObject;
  48458. $recv((function(){
  48459. return $core.withContext(function($ctx2) {
  48460. return $self._should_raise_((function(){
  48461. return $core.withContext(function($ctx3) {
  48462. $1=$self._compiler();
  48463. $2=$recv(anObject)._class();
  48464. $ctx3.sendIdx["class"]=1;
  48465. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48466. method;
  48467. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48468. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48469. }),anErrorClass);
  48470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48471. }))._ensure_((function(){
  48472. return $core.withContext(function($ctx2) {
  48473. $3=method;
  48474. if(($receiver = $3) == null || $receiver.a$nil){
  48475. return $3;
  48476. } else {
  48477. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48478. }
  48479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48480. }));
  48481. return self;
  48482. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48483. },
  48484. args: ["aString", "anObject", "anErrorClass"],
  48485. 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 ] ]",
  48486. referencedClasses: [],
  48487. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48488. }),
  48489. $globals.CodeGeneratorTest);
  48490. $core.addMethod(
  48491. $core.method({
  48492. selector: "should:receiver:return:",
  48493. protocol: "testing",
  48494. fn: function (aString,anObject,aResult){
  48495. var self=this,$self=this;
  48496. var method,result;
  48497. return $core.withContext(function($ctx1) {
  48498. var $1,$2;
  48499. $self["@receiver"]=anObject;
  48500. $1=$self._compiler();
  48501. $2=$recv(anObject)._class();
  48502. $ctx1.sendIdx["class"]=1;
  48503. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48504. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48505. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48506. $self._assert_equals_(aResult,result);
  48507. return self;
  48508. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48509. },
  48510. args: ["aString", "anObject", "aResult"],
  48511. 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",
  48512. referencedClasses: [],
  48513. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48514. }),
  48515. $globals.CodeGeneratorTest);
  48516. $core.addMethod(
  48517. $core.method({
  48518. selector: "should:return:",
  48519. protocol: "testing",
  48520. fn: function (aString,anObject){
  48521. var self=this,$self=this;
  48522. return $core.withContext(function($ctx1) {
  48523. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48524. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48525. },
  48526. args: ["aString", "anObject"],
  48527. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48528. referencedClasses: [],
  48529. messageSends: ["should:receiver:return:"]
  48530. }),
  48531. $globals.CodeGeneratorTest);
  48532. $core.addMethod(
  48533. $core.method({
  48534. selector: "tearDown",
  48535. protocol: "initialization",
  48536. fn: function (){
  48537. var self=this,$self=this;
  48538. return self;
  48539. },
  48540. args: [],
  48541. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  48542. referencedClasses: [],
  48543. messageSends: []
  48544. }),
  48545. $globals.CodeGeneratorTest);
  48546. $core.addMethod(
  48547. $core.method({
  48548. selector: "testAssignment",
  48549. protocol: "tests",
  48550. fn: function (){
  48551. var self=this,$self=this;
  48552. return $core.withContext(function($ctx1) {
  48553. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  48554. $ctx1.sendIdx["should:return:"]=1;
  48555. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  48556. $ctx1.sendIdx["should:return:"]=2;
  48557. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  48558. return self;
  48559. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  48560. },
  48561. args: [],
  48562. 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",
  48563. referencedClasses: [],
  48564. messageSends: ["should:return:"]
  48565. }),
  48566. $globals.CodeGeneratorTest);
  48567. $core.addMethod(
  48568. $core.method({
  48569. selector: "testBackslashSelectors",
  48570. protocol: "tests",
  48571. fn: function (){
  48572. var self=this,$self=this;
  48573. return $core.withContext(function($ctx1) {
  48574. $self._should_return_("\x5c arg ^ 4",(4));
  48575. $ctx1.sendIdx["should:return:"]=1;
  48576. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  48577. return self;
  48578. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  48579. },
  48580. args: [],
  48581. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  48582. referencedClasses: [],
  48583. messageSends: ["should:return:"]
  48584. }),
  48585. $globals.CodeGeneratorTest);
  48586. $core.addMethod(
  48587. $core.method({
  48588. selector: "testBlockReturn",
  48589. protocol: "tests",
  48590. fn: function (){
  48591. var self=this,$self=this;
  48592. return $core.withContext(function($ctx1) {
  48593. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  48594. $ctx1.sendIdx["should:return:"]=1;
  48595. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  48596. $ctx1.sendIdx["should:return:"]=2;
  48597. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  48598. return self;
  48599. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  48600. },
  48601. args: [],
  48602. 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).",
  48603. referencedClasses: [],
  48604. messageSends: ["should:return:"]
  48605. }),
  48606. $globals.CodeGeneratorTest);
  48607. $core.addMethod(
  48608. $core.method({
  48609. selector: "testCascades",
  48610. protocol: "tests",
  48611. fn: function (){
  48612. var self=this,$self=this;
  48613. return $core.withContext(function($ctx1) {
  48614. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  48615. return self;
  48616. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  48617. },
  48618. args: [],
  48619. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  48620. referencedClasses: [],
  48621. messageSends: ["should:return:"]
  48622. }),
  48623. $globals.CodeGeneratorTest);
  48624. $core.addMethod(
  48625. $core.method({
  48626. selector: "testCascadesInDynamicArray",
  48627. protocol: "tests",
  48628. fn: function (){
  48629. var self=this,$self=this;
  48630. return $core.withContext(function($ctx1) {
  48631. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  48632. return self;
  48633. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  48634. },
  48635. args: [],
  48636. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  48637. referencedClasses: [],
  48638. messageSends: ["should:return:"]
  48639. }),
  48640. $globals.CodeGeneratorTest);
  48641. $core.addMethod(
  48642. $core.method({
  48643. selector: "testCascadesInDynamicDictioary",
  48644. protocol: "tests",
  48645. fn: function (){
  48646. var self=this,$self=this;
  48647. return $core.withContext(function($ctx1) {
  48648. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  48649. return self;
  48650. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  48651. },
  48652. args: [],
  48653. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  48654. referencedClasses: [],
  48655. messageSends: ["should:return:"]
  48656. }),
  48657. $globals.CodeGeneratorTest);
  48658. $core.addMethod(
  48659. $core.method({
  48660. selector: "testCascadesInSend",
  48661. protocol: "tests",
  48662. fn: function (){
  48663. var self=this,$self=this;
  48664. return $core.withContext(function($ctx1) {
  48665. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  48666. return self;
  48667. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  48668. },
  48669. args: [],
  48670. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  48671. referencedClasses: [],
  48672. messageSends: ["should:return:"]
  48673. }),
  48674. $globals.CodeGeneratorTest);
  48675. $core.addMethod(
  48676. $core.method({
  48677. selector: "testCascadesWithInlining",
  48678. protocol: "tests",
  48679. fn: function (){
  48680. var self=this,$self=this;
  48681. return $core.withContext(function($ctx1) {
  48682. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  48683. $ctx1.sendIdx["should:return:"]=1;
  48684. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  48685. return self;
  48686. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  48687. },
  48688. args: [],
  48689. 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",
  48690. referencedClasses: [],
  48691. messageSends: ["should:return:"]
  48692. }),
  48693. $globals.CodeGeneratorTest);
  48694. $core.addMethod(
  48695. $core.method({
  48696. selector: "testDynamicArrayElementsOrdered",
  48697. protocol: "tests",
  48698. fn: function (){
  48699. var self=this,$self=this;
  48700. return $core.withContext(function($ctx1) {
  48701. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  48702. $ctx1.sendIdx["should:return:"]=1;
  48703. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  48704. return self;
  48705. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  48706. },
  48707. args: [],
  48708. 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).",
  48709. referencedClasses: [],
  48710. messageSends: ["should:return:"]
  48711. }),
  48712. $globals.CodeGeneratorTest);
  48713. $core.addMethod(
  48714. $core.method({
  48715. selector: "testDynamicDictionaryElementsOrdered",
  48716. protocol: "tests",
  48717. fn: function (){
  48718. var self=this,$self=this;
  48719. return $core.withContext(function($ctx1) {
  48720. $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)]));
  48721. return self;
  48722. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  48723. },
  48724. args: [],
  48725. 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}.",
  48726. referencedClasses: [],
  48727. messageSends: ["should:return:"]
  48728. }),
  48729. $globals.CodeGeneratorTest);
  48730. $core.addMethod(
  48731. $core.method({
  48732. selector: "testDynamicDictionaryWithMoreArrows",
  48733. protocol: "tests",
  48734. fn: function (){
  48735. var self=this,$self=this;
  48736. return $core.withContext(function($ctx1) {
  48737. var $2,$1;
  48738. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  48739. $ctx1.sendIdx["->"]=1;
  48740. $1=$recv($globals.HashedCollection)._with_($2);
  48741. $self._should_return_("foo ^ #{1->2->3}",$1);
  48742. return self;
  48743. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  48744. },
  48745. args: [],
  48746. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  48747. referencedClasses: ["HashedCollection"],
  48748. messageSends: ["should:return:", "with:", "->"]
  48749. }),
  48750. $globals.CodeGeneratorTest);
  48751. $core.addMethod(
  48752. $core.method({
  48753. selector: "testGlobalVar",
  48754. protocol: "tests",
  48755. fn: function (){
  48756. var self=this,$self=this;
  48757. return $core.withContext(function($ctx1) {
  48758. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  48759. $ctx1.sendIdx["should:return:"]=1;
  48760. $self._should_return_("foo ^ Math cos: 0",(1));
  48761. $ctx1.sendIdx["should:return:"]=2;
  48762. $self._should_return_("foo ^ NonExistingVar",nil);
  48763. return self;
  48764. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  48765. },
  48766. args: [],
  48767. 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",
  48768. referencedClasses: ["BlockClosure"],
  48769. messageSends: ["should:return:"]
  48770. }),
  48771. $globals.CodeGeneratorTest);
  48772. $core.addMethod(
  48773. $core.method({
  48774. selector: "testInnerTemporalDependentElementsOrdered",
  48775. protocol: "tests",
  48776. fn: function (){
  48777. var self=this,$self=this;
  48778. return $core.withContext(function($ctx1) {
  48779. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  48780. $2="foo".__minus_gt($globals.Array);
  48781. $ctx1.sendIdx["->"]=1;
  48782. $3="bar".__minus_gt((2));
  48783. $ctx1.sendIdx["->"]=2;
  48784. $1=[$2,$3];
  48785. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  48786. $ctx1.sendIdx["should:return:"]=1;
  48787. $5="foo".__minus_gt($globals.Array);
  48788. $ctx1.sendIdx["->"]=3;
  48789. $6="bar".__minus_gt((2));
  48790. $ctx1.sendIdx["->"]=4;
  48791. $4=[$5,$6];
  48792. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  48793. $ctx1.sendIdx["should:return:"]=2;
  48794. $8="foo".__minus_gt((1));
  48795. $ctx1.sendIdx["->"]=5;
  48796. $9="bar".__minus_gt((2));
  48797. $ctx1.sendIdx["->"]=6;
  48798. $7=[$8,$9];
  48799. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  48800. $ctx1.sendIdx["should:return:"]=3;
  48801. $11="foo".__minus_gt((1));
  48802. $ctx1.sendIdx["->"]=7;
  48803. $10=[$11,"bar".__minus_gt((2))];
  48804. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  48805. $ctx1.sendIdx["should:return:"]=4;
  48806. $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)]));
  48807. return self;
  48808. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  48809. },
  48810. args: [],
  48811. 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}.",
  48812. referencedClasses: ["Array"],
  48813. messageSends: ["should:return:", "->"]
  48814. }),
  48815. $globals.CodeGeneratorTest);
  48816. $core.addMethod(
  48817. $core.method({
  48818. selector: "testJSStatement",
  48819. protocol: "tests",
  48820. fn: function (){
  48821. var self=this,$self=this;
  48822. return $core.withContext(function($ctx1) {
  48823. $self._should_return_("foo <return 2+3>",(5));
  48824. return self;
  48825. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  48826. },
  48827. args: [],
  48828. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  48829. referencedClasses: [],
  48830. messageSends: ["should:return:"]
  48831. }),
  48832. $globals.CodeGeneratorTest);
  48833. $core.addMethod(
  48834. $core.method({
  48835. selector: "testLexicalScope",
  48836. protocol: "tests",
  48837. fn: function (){
  48838. var self=this,$self=this;
  48839. return $core.withContext(function($ctx1) {
  48840. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  48841. return self;
  48842. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  48843. },
  48844. args: [],
  48845. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  48846. referencedClasses: [],
  48847. messageSends: ["should:return:"]
  48848. }),
  48849. $globals.CodeGeneratorTest);
  48850. $core.addMethod(
  48851. $core.method({
  48852. selector: "testLiterals",
  48853. protocol: "tests",
  48854. fn: function (){
  48855. var self=this,$self=this;
  48856. return $core.withContext(function($ctx1) {
  48857. $self._should_return_("foo ^ 1",(1));
  48858. $ctx1.sendIdx["should:return:"]=1;
  48859. $self._should_return_("foo ^ 'hello'","hello");
  48860. $ctx1.sendIdx["should:return:"]=2;
  48861. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  48862. $ctx1.sendIdx["should:return:"]=3;
  48863. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  48864. $ctx1.sendIdx["should:return:"]=4;
  48865. $self._should_return_("foo ^ true",true);
  48866. $ctx1.sendIdx["should:return:"]=5;
  48867. $self._should_return_("foo ^ false",false);
  48868. $ctx1.sendIdx["should:return:"]=6;
  48869. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  48870. $ctx1.sendIdx["should:return:"]=7;
  48871. $self._should_return_("foo ^ #hello","hello");
  48872. $ctx1.sendIdx["should:return:"]=8;
  48873. $self._should_return_("foo ^ $h","h");
  48874. $ctx1.sendIdx["should:return:"]=9;
  48875. $self._should_return_("foo ^ -123.456",(-123.456));
  48876. $ctx1.sendIdx["should:return:"]=10;
  48877. $self._should_return_("foo ^ -2.5e4",(-25000));
  48878. return self;
  48879. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  48880. },
  48881. args: [],
  48882. 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.",
  48883. referencedClasses: [],
  48884. messageSends: ["should:return:"]
  48885. }),
  48886. $globals.CodeGeneratorTest);
  48887. $core.addMethod(
  48888. $core.method({
  48889. selector: "testLocalReturn",
  48890. protocol: "tests",
  48891. fn: function (){
  48892. var self=this,$self=this;
  48893. return $core.withContext(function($ctx1) {
  48894. $self._should_return_("foo ^ 1",(1));
  48895. $ctx1.sendIdx["should:return:"]=1;
  48896. $self._should_return_("foo ^ 1 + 1",(2));
  48897. $ctx1.sendIdx["should:return:"]=2;
  48898. $self._should_return_("foo ",$self["@receiver"]);
  48899. $ctx1.sendIdx["should:return:"]=3;
  48900. $self._should_return_("foo self asString",$self["@receiver"]);
  48901. $ctx1.sendIdx["should:return:"]=4;
  48902. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  48903. return self;
  48904. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  48905. },
  48906. args: [],
  48907. 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",
  48908. referencedClasses: [],
  48909. messageSends: ["should:return:"]
  48910. }),
  48911. $globals.CodeGeneratorTest);
  48912. $core.addMethod(
  48913. $core.method({
  48914. selector: "testMessageSends",
  48915. protocol: "tests",
  48916. fn: function (){
  48917. var self=this,$self=this;
  48918. return $core.withContext(function($ctx1) {
  48919. $self._should_return_("foo ^ 1 asString","1");
  48920. $ctx1.sendIdx["should:return:"]=1;
  48921. $self._should_return_("foo ^ 1 + 1",(2));
  48922. $ctx1.sendIdx["should:return:"]=2;
  48923. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  48924. $ctx1.sendIdx["should:return:"]=3;
  48925. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  48926. $ctx1.sendIdx["should:return:"]=4;
  48927. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  48928. return self;
  48929. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  48930. },
  48931. args: [],
  48932. 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)",
  48933. referencedClasses: [],
  48934. messageSends: ["should:return:"]
  48935. }),
  48936. $globals.CodeGeneratorTest);
  48937. $core.addMethod(
  48938. $core.method({
  48939. selector: "testMistypedPragmaJSStatement",
  48940. protocol: "tests",
  48941. fn: function (){
  48942. var self=this,$self=this;
  48943. return $core.withContext(function($ctx1) {
  48944. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  48945. return self;
  48946. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  48947. },
  48948. args: [],
  48949. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  48950. referencedClasses: ["ParseError"],
  48951. messageSends: ["should:receiver:raise:"]
  48952. }),
  48953. $globals.CodeGeneratorTest);
  48954. $core.addMethod(
  48955. $core.method({
  48956. selector: "testMultipleSequences",
  48957. protocol: "tests",
  48958. fn: function (){
  48959. var self=this,$self=this;
  48960. return $core.withContext(function($ctx1) {
  48961. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  48962. return self;
  48963. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  48964. },
  48965. args: [],
  48966. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  48967. referencedClasses: [],
  48968. messageSends: ["should:return:"]
  48969. }),
  48970. $globals.CodeGeneratorTest);
  48971. $core.addMethod(
  48972. $core.method({
  48973. selector: "testMutableLiterals",
  48974. protocol: "tests",
  48975. fn: function (){
  48976. var self=this,$self=this;
  48977. return $core.withContext(function($ctx1) {
  48978. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  48979. return self;
  48980. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  48981. },
  48982. args: [],
  48983. 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)",
  48984. referencedClasses: [],
  48985. messageSends: ["should:return:"]
  48986. }),
  48987. $globals.CodeGeneratorTest);
  48988. $core.addMethod(
  48989. $core.method({
  48990. selector: "testNestedIfTrue",
  48991. protocol: "tests",
  48992. fn: function (){
  48993. var self=this,$self=this;
  48994. return $core.withContext(function($ctx1) {
  48995. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  48996. $ctx1.sendIdx["should:return:"]=1;
  48997. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  48998. $ctx1.sendIdx["should:return:"]=2;
  48999. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49000. $ctx1.sendIdx["should:return:"]=3;
  49001. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49002. return self;
  49003. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49004. },
  49005. args: [],
  49006. 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.",
  49007. referencedClasses: [],
  49008. messageSends: ["should:return:"]
  49009. }),
  49010. $globals.CodeGeneratorTest);
  49011. $core.addMethod(
  49012. $core.method({
  49013. selector: "testNestedSends",
  49014. protocol: "tests",
  49015. fn: function (){
  49016. var self=this,$self=this;
  49017. return $core.withContext(function($ctx1) {
  49018. $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());
  49019. return self;
  49020. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49021. },
  49022. args: [],
  49023. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49024. referencedClasses: ["Point"],
  49025. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49026. }),
  49027. $globals.CodeGeneratorTest);
  49028. $core.addMethod(
  49029. $core.method({
  49030. selector: "testNonLocalReturn",
  49031. protocol: "tests",
  49032. fn: function (){
  49033. var self=this,$self=this;
  49034. return $core.withContext(function($ctx1) {
  49035. $self._should_return_("foo [ ^ 1 ] value",(1));
  49036. $ctx1.sendIdx["should:return:"]=1;
  49037. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49038. $ctx1.sendIdx["should:return:"]=2;
  49039. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49040. $ctx1.sendIdx["should:return:"]=3;
  49041. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49042. return self;
  49043. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49044. },
  49045. args: [],
  49046. 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",
  49047. referencedClasses: [],
  49048. messageSends: ["should:return:"]
  49049. }),
  49050. $globals.CodeGeneratorTest);
  49051. $core.addMethod(
  49052. $core.method({
  49053. selector: "testPascalCaseGlobal",
  49054. protocol: "tests",
  49055. fn: function (){
  49056. var self=this,$self=this;
  49057. return $core.withContext(function($ctx1) {
  49058. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49059. $ctx1.sendIdx["should:return:"]=1;
  49060. $self._should_return_("foo ^NonExistent",nil);
  49061. return self;
  49062. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49063. },
  49064. args: [],
  49065. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49066. referencedClasses: ["Smalltalk"],
  49067. messageSends: ["should:return:", "at:", "globals"]
  49068. }),
  49069. $globals.CodeGeneratorTest);
  49070. $core.addMethod(
  49071. $core.method({
  49072. selector: "testPragmaJSStatement",
  49073. protocol: "tests",
  49074. fn: function (){
  49075. var self=this,$self=this;
  49076. return $core.withContext(function($ctx1) {
  49077. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49078. return self;
  49079. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49080. },
  49081. args: [],
  49082. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49083. referencedClasses: [],
  49084. messageSends: ["should:return:"]
  49085. }),
  49086. $globals.CodeGeneratorTest);
  49087. $core.addMethod(
  49088. $core.method({
  49089. selector: "testRootSuperSend",
  49090. protocol: "tests",
  49091. fn: function (){
  49092. var self=this,$self=this;
  49093. return $core.withContext(function($ctx1) {
  49094. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49095. return self;
  49096. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49097. },
  49098. args: [],
  49099. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49100. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49101. messageSends: ["should:receiver:raise:", "new"]
  49102. }),
  49103. $globals.CodeGeneratorTest);
  49104. $core.addMethod(
  49105. $core.method({
  49106. selector: "testSendReceiverAndArgumentsOrdered",
  49107. protocol: "tests",
  49108. fn: function (){
  49109. var self=this,$self=this;
  49110. return $core.withContext(function($ctx1) {
  49111. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49112. $ctx1.sendIdx["should:return:"]=1;
  49113. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49114. return self;
  49115. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49116. },
  49117. args: [],
  49118. 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}.",
  49119. referencedClasses: ["Array"],
  49120. messageSends: ["should:return:"]
  49121. }),
  49122. $globals.CodeGeneratorTest);
  49123. $core.addMethod(
  49124. $core.method({
  49125. selector: "testSuperSend",
  49126. protocol: "tests",
  49127. fn: function (){
  49128. var self=this,$self=this;
  49129. return $core.withContext(function($ctx1) {
  49130. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49131. return self;
  49132. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49133. },
  49134. args: [],
  49135. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49136. referencedClasses: [],
  49137. messageSends: ["should:receiver:return:"]
  49138. }),
  49139. $globals.CodeGeneratorTest);
  49140. $core.addMethod(
  49141. $core.method({
  49142. selector: "testTempVariables",
  49143. protocol: "tests",
  49144. fn: function (){
  49145. var self=this,$self=this;
  49146. return $core.withContext(function($ctx1) {
  49147. $self._should_return_("foo | a | ^ a",nil);
  49148. $ctx1.sendIdx["should:return:"]=1;
  49149. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49150. $ctx1.sendIdx["should:return:"]=2;
  49151. $self._should_return_("foo | a b c | ^ c",nil);
  49152. $ctx1.sendIdx["should:return:"]=3;
  49153. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49154. $ctx1.sendIdx["should:return:"]=4;
  49155. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49156. $ctx1.sendIdx["should:return:"]=5;
  49157. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49158. return self;
  49159. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49160. },
  49161. args: [],
  49162. 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.",
  49163. referencedClasses: [],
  49164. messageSends: ["should:return:"]
  49165. }),
  49166. $globals.CodeGeneratorTest);
  49167. $core.addMethod(
  49168. $core.method({
  49169. selector: "testThisContext",
  49170. protocol: "tests",
  49171. fn: function (){
  49172. var self=this,$self=this;
  49173. return $core.withContext(function($ctx1) {
  49174. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49175. return self;
  49176. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49177. },
  49178. args: [],
  49179. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49180. referencedClasses: [],
  49181. messageSends: ["should:return:"]
  49182. }),
  49183. $globals.CodeGeneratorTest);
  49184. $core.addMethod(
  49185. $core.method({
  49186. selector: "testifFalse",
  49187. protocol: "tests",
  49188. fn: function (){
  49189. var self=this,$self=this;
  49190. return $core.withContext(function($ctx1) {
  49191. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49192. $ctx1.sendIdx["should:return:"]=1;
  49193. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49194. $ctx1.sendIdx["should:return:"]=2;
  49195. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49196. $ctx1.sendIdx["should:return:"]=3;
  49197. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49198. return self;
  49199. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49200. },
  49201. args: [],
  49202. 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.",
  49203. referencedClasses: [],
  49204. messageSends: ["should:return:"]
  49205. }),
  49206. $globals.CodeGeneratorTest);
  49207. $core.addMethod(
  49208. $core.method({
  49209. selector: "testifFalseIfTrue",
  49210. protocol: "tests",
  49211. fn: function (){
  49212. var self=this,$self=this;
  49213. return $core.withContext(function($ctx1) {
  49214. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49215. $ctx1.sendIdx["should:return:"]=1;
  49216. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49217. $ctx1.sendIdx["should:return:"]=2;
  49218. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49219. $ctx1.sendIdx["should:return:"]=3;
  49220. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49221. return self;
  49222. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49223. },
  49224. args: [],
  49225. 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.",
  49226. referencedClasses: [],
  49227. messageSends: ["should:return:"]
  49228. }),
  49229. $globals.CodeGeneratorTest);
  49230. $core.addMethod(
  49231. $core.method({
  49232. selector: "testifNil",
  49233. protocol: "tests",
  49234. fn: function (){
  49235. var self=this,$self=this;
  49236. return $core.withContext(function($ctx1) {
  49237. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49238. $ctx1.sendIdx["should:return:"]=1;
  49239. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49240. $ctx1.sendIdx["should:return:"]=2;
  49241. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49242. $ctx1.sendIdx["should:return:"]=3;
  49243. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49244. return self;
  49245. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49246. },
  49247. args: [],
  49248. 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.",
  49249. referencedClasses: [],
  49250. messageSends: ["should:return:"]
  49251. }),
  49252. $globals.CodeGeneratorTest);
  49253. $core.addMethod(
  49254. $core.method({
  49255. selector: "testifNilIfNotNil",
  49256. protocol: "tests",
  49257. fn: function (){
  49258. var self=this,$self=this;
  49259. return $core.withContext(function($ctx1) {
  49260. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49261. $ctx1.sendIdx["should:return:"]=1;
  49262. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49263. $ctx1.sendIdx["should:return:"]=2;
  49264. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49265. $ctx1.sendIdx["should:return:"]=3;
  49266. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49267. return self;
  49268. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49269. },
  49270. args: [],
  49271. 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.",
  49272. referencedClasses: [],
  49273. messageSends: ["should:return:"]
  49274. }),
  49275. $globals.CodeGeneratorTest);
  49276. $core.addMethod(
  49277. $core.method({
  49278. selector: "testifNotNil",
  49279. protocol: "tests",
  49280. fn: function (){
  49281. var self=this,$self=this;
  49282. return $core.withContext(function($ctx1) {
  49283. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49284. $ctx1.sendIdx["should:return:"]=1;
  49285. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49286. $ctx1.sendIdx["should:return:"]=2;
  49287. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49288. $ctx1.sendIdx["should:return:"]=3;
  49289. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49290. return self;
  49291. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49292. },
  49293. args: [],
  49294. 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.",
  49295. referencedClasses: [],
  49296. messageSends: ["should:return:"]
  49297. }),
  49298. $globals.CodeGeneratorTest);
  49299. $core.addMethod(
  49300. $core.method({
  49301. selector: "testifNotNilWithArgument",
  49302. protocol: "tests",
  49303. fn: function (){
  49304. var self=this,$self=this;
  49305. return $core.withContext(function($ctx1) {
  49306. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49307. $ctx1.sendIdx["should:return:"]=1;
  49308. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49309. $ctx1.sendIdx["should:return:"]=2;
  49310. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49311. $ctx1.sendIdx["should:return:"]=3;
  49312. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49313. $ctx1.sendIdx["should:return:"]=4;
  49314. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49315. $ctx1.sendIdx["should:return:"]=5;
  49316. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49317. return self;
  49318. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49319. },
  49320. args: [],
  49321. 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",
  49322. referencedClasses: [],
  49323. messageSends: ["should:return:"]
  49324. }),
  49325. $globals.CodeGeneratorTest);
  49326. $core.addMethod(
  49327. $core.method({
  49328. selector: "testifTrue",
  49329. protocol: "tests",
  49330. fn: function (){
  49331. var self=this,$self=this;
  49332. return $core.withContext(function($ctx1) {
  49333. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49334. $ctx1.sendIdx["should:return:"]=1;
  49335. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49336. $ctx1.sendIdx["should:return:"]=2;
  49337. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49338. $ctx1.sendIdx["should:return:"]=3;
  49339. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49340. return self;
  49341. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49342. },
  49343. args: [],
  49344. 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.",
  49345. referencedClasses: [],
  49346. messageSends: ["should:return:"]
  49347. }),
  49348. $globals.CodeGeneratorTest);
  49349. $core.addMethod(
  49350. $core.method({
  49351. selector: "testifTrueIfFalse",
  49352. protocol: "tests",
  49353. fn: function (){
  49354. var self=this,$self=this;
  49355. return $core.withContext(function($ctx1) {
  49356. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49357. $ctx1.sendIdx["should:return:"]=1;
  49358. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49359. $ctx1.sendIdx["should:return:"]=2;
  49360. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49361. $ctx1.sendIdx["should:return:"]=3;
  49362. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49363. return self;
  49364. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49365. },
  49366. args: [],
  49367. 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.",
  49368. referencedClasses: [],
  49369. messageSends: ["should:return:"]
  49370. }),
  49371. $globals.CodeGeneratorTest);
  49372. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49373. $core.addMethod(
  49374. $core.method({
  49375. selector: "analyze:forClass:",
  49376. protocol: "parsing",
  49377. fn: function (aNode,aClass){
  49378. var self=this,$self=this;
  49379. return $core.withContext(function($ctx1) {
  49380. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  49381. return aNode;
  49382. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  49383. },
  49384. args: ["aNode", "aClass"],
  49385. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  49386. referencedClasses: ["SemanticAnalyzer"],
  49387. messageSends: ["visit:", "on:"]
  49388. }),
  49389. $globals.ASTInterpreterTest);
  49390. $core.addMethod(
  49391. $core.method({
  49392. selector: "interpret:receiver:withArguments:",
  49393. protocol: "private",
  49394. fn: function (aString,anObject,aDictionary){
  49395. var self=this,$self=this;
  49396. var ctx,ast,interpreter;
  49397. return $core.withContext(function($ctx1) {
  49398. var $1,$2,$3,$receiver;
  49399. interpreter=$recv($globals.ASTInterpreter)._new();
  49400. $ctx1.sendIdx["new"]=1;
  49401. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49402. $1=$recv($globals.AIContext)._new();
  49403. $recv($1)._receiver_(anObject);
  49404. $recv($1)._interpreter_(interpreter);
  49405. ctx=$recv($1)._yourself();
  49406. $2=$recv(ast)._sequenceNode();
  49407. if(($receiver = $2) == null || $receiver.a$nil){
  49408. $2;
  49409. } else {
  49410. var sequence;
  49411. sequence=$receiver;
  49412. $recv($recv(sequence)._temps())._do_((function(each){
  49413. return $core.withContext(function($ctx2) {
  49414. return $recv(ctx)._defineLocal_(each);
  49415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49416. }));
  49417. }
  49418. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49419. return $core.withContext(function($ctx2) {
  49420. return $recv(ctx)._localAt_put_(key,value);
  49421. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49422. }));
  49423. $3=interpreter;
  49424. $recv($3)._context_(ctx);
  49425. $recv($3)._node_(ast);
  49426. $recv($3)._enterNode();
  49427. $recv($3)._proceed();
  49428. return $recv($3)._result();
  49429. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49430. },
  49431. args: ["aString", "anObject", "aDictionary"],
  49432. 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",
  49433. referencedClasses: ["ASTInterpreter", "AIContext"],
  49434. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49435. }),
  49436. $globals.ASTInterpreterTest);
  49437. $core.addMethod(
  49438. $core.method({
  49439. selector: "parse:",
  49440. protocol: "parsing",
  49441. fn: function (aString){
  49442. var self=this,$self=this;
  49443. return $core.withContext(function($ctx1) {
  49444. return $recv($globals.Smalltalk)._parse_(aString);
  49445. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  49446. },
  49447. args: ["aString"],
  49448. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  49449. referencedClasses: ["Smalltalk"],
  49450. messageSends: ["parse:"]
  49451. }),
  49452. $globals.ASTInterpreterTest);
  49453. $core.addMethod(
  49454. $core.method({
  49455. selector: "parse:forClass:",
  49456. protocol: "parsing",
  49457. fn: function (aString,aClass){
  49458. var self=this,$self=this;
  49459. return $core.withContext(function($ctx1) {
  49460. return $self._analyze_forClass_($self._parse_(aString),aClass);
  49461. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  49462. },
  49463. args: ["aString", "aClass"],
  49464. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  49465. referencedClasses: [],
  49466. messageSends: ["analyze:forClass:", "parse:"]
  49467. }),
  49468. $globals.ASTInterpreterTest);
  49469. $core.addMethod(
  49470. $core.method({
  49471. selector: "should:receiver:return:",
  49472. protocol: "testing",
  49473. fn: function (aString,anObject,aResult){
  49474. var self=this,$self=this;
  49475. return $core.withContext(function($ctx1) {
  49476. $self["@receiver"]=anObject;
  49477. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49478. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49479. },
  49480. args: ["aString", "anObject", "aResult"],
  49481. 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",
  49482. referencedClasses: [],
  49483. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49484. }),
  49485. $globals.ASTInterpreterTest);
  49486. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49487. $core.addMethod(
  49488. $core.method({
  49489. selector: "interpret:receiver:withArguments:",
  49490. protocol: "private",
  49491. fn: function (aString,anObject,aDictionary){
  49492. var self=this,$self=this;
  49493. var ctx,ast,debugger_;
  49494. return $core.withContext(function($ctx1) {
  49495. var $1,$2,$3,$4,$5,$receiver;
  49496. $1=$recv($globals.AIContext)._new();
  49497. $ctx1.sendIdx["new"]=1;
  49498. $recv($1)._receiver_(anObject);
  49499. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49500. ctx=$recv($1)._yourself();
  49501. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49502. $2=$recv(ast)._sequenceNode();
  49503. if(($receiver = $2) == null || $receiver.a$nil){
  49504. $2;
  49505. } else {
  49506. var sequence;
  49507. sequence=$receiver;
  49508. $recv($recv(sequence)._temps())._do_((function(each){
  49509. return $core.withContext(function($ctx2) {
  49510. return $recv(ctx)._defineLocal_(each);
  49511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49512. }));
  49513. }
  49514. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49515. return $core.withContext(function($ctx2) {
  49516. return $recv(ctx)._localAt_put_(key,value);
  49517. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49518. }));
  49519. $3=$recv(ctx)._interpreter();
  49520. $ctx1.sendIdx["interpreter"]=1;
  49521. $recv($3)._context_(ctx);
  49522. $ctx1.sendIdx["context:"]=1;
  49523. $4=$recv(ctx)._interpreter();
  49524. $recv($4)._node_(ast);
  49525. $recv($4)._enterNode();
  49526. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49527. $5=debugger_;
  49528. $recv($5)._proceed();
  49529. return $recv($5)._result();
  49530. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49531. },
  49532. args: ["aString", "anObject", "aDictionary"],
  49533. 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",
  49534. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49535. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49536. }),
  49537. $globals.ASTDebuggerTest);
  49538. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49539. $core.addMethod(
  49540. $core.method({
  49541. selector: "codeGeneratorClass",
  49542. protocol: "accessing",
  49543. fn: function (){
  49544. var self=this,$self=this;
  49545. return $globals.InliningCodeGenerator;
  49546. },
  49547. args: [],
  49548. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49549. referencedClasses: ["InliningCodeGenerator"],
  49550. messageSends: []
  49551. }),
  49552. $globals.InliningCodeGeneratorTest);
  49553. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49554. $core.addMethod(
  49555. $core.method({
  49556. selector: "testClassRefVar",
  49557. protocol: "tests",
  49558. fn: function (){
  49559. var self=this,$self=this;
  49560. var node;
  49561. return $core.withContext(function($ctx1) {
  49562. var $1,$2;
  49563. $1=$recv($globals.VariableNode)._new();
  49564. $ctx1.sendIdx["new"]=1;
  49565. $recv($1)._value_("Object");
  49566. node=$recv($1)._yourself();
  49567. $2=$recv($globals.SemanticAnalyzer)._new();
  49568. $ctx1.sendIdx["new"]=2;
  49569. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49570. $recv($2)._visit_(node);
  49571. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  49572. return self;
  49573. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  49574. },
  49575. args: [],
  49576. 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",
  49577. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  49578. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  49579. }),
  49580. $globals.ScopeVarTest);
  49581. $core.addMethod(
  49582. $core.method({
  49583. selector: "testInstanceVar",
  49584. protocol: "tests",
  49585. fn: function (){
  49586. var self=this,$self=this;
  49587. var node,scope;
  49588. return $core.withContext(function($ctx1) {
  49589. var $1;
  49590. $1=$recv($globals.VariableNode)._new();
  49591. $ctx1.sendIdx["new"]=1;
  49592. $recv($1)._value_("bzzz");
  49593. node=$recv($1)._yourself();
  49594. scope=$recv($globals.MethodLexicalScope)._new();
  49595. $recv(scope)._addIVar_("bzzz");
  49596. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  49597. return self;
  49598. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49599. },
  49600. args: [],
  49601. 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",
  49602. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49603. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  49604. }),
  49605. $globals.ScopeVarTest);
  49606. $core.addMethod(
  49607. $core.method({
  49608. selector: "testPseudoVar",
  49609. protocol: "tests",
  49610. fn: function (){
  49611. var self=this,$self=this;
  49612. var node,pseudoVars;
  49613. return $core.withContext(function($ctx1) {
  49614. var $1;
  49615. pseudoVars=["self", "super", "true", "false", "nil"];
  49616. $recv(pseudoVars)._do_((function(each){
  49617. return $core.withContext(function($ctx2) {
  49618. $1=$recv($globals.VariableNode)._new();
  49619. $ctx2.sendIdx["new"]=1;
  49620. $recv($1)._value_(each);
  49621. node=$recv($1)._yourself();
  49622. node;
  49623. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  49624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49625. }));
  49626. return self;
  49627. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  49628. },
  49629. args: [],
  49630. 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]",
  49631. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49632. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  49633. }),
  49634. $globals.ScopeVarTest);
  49635. $core.addMethod(
  49636. $core.method({
  49637. selector: "testTempVar",
  49638. protocol: "tests",
  49639. fn: function (){
  49640. var self=this,$self=this;
  49641. var node,scope;
  49642. return $core.withContext(function($ctx1) {
  49643. var $1;
  49644. $1=$recv($globals.VariableNode)._new();
  49645. $ctx1.sendIdx["new"]=1;
  49646. $recv($1)._value_("bzzz");
  49647. node=$recv($1)._yourself();
  49648. scope=$recv($globals.MethodLexicalScope)._new();
  49649. $recv(scope)._addTemp_("bzzz");
  49650. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  49651. return self;
  49652. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49653. },
  49654. args: [],
  49655. 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",
  49656. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49657. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  49658. }),
  49659. $globals.ScopeVarTest);
  49660. $core.addMethod(
  49661. $core.method({
  49662. selector: "testUnknownVar",
  49663. protocol: "tests",
  49664. fn: function (){
  49665. var self=this,$self=this;
  49666. var node;
  49667. return $core.withContext(function($ctx1) {
  49668. var $1;
  49669. $1=$recv($globals.VariableNode)._new();
  49670. $ctx1.sendIdx["new"]=1;
  49671. $recv($1)._value_("bzzz");
  49672. node=$recv($1)._yourself();
  49673. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  49674. return self;
  49675. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  49676. },
  49677. args: [],
  49678. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  49679. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49680. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  49681. }),
  49682. $globals.ScopeVarTest);
  49683. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  49684. $core.addMethod(
  49685. $core.method({
  49686. selector: "setUp",
  49687. protocol: "running",
  49688. fn: function (){
  49689. var self=this,$self=this;
  49690. return $core.withContext(function($ctx1) {
  49691. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  49692. return self;
  49693. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  49694. },
  49695. args: [],
  49696. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  49697. referencedClasses: ["SemanticAnalyzer", "Object"],
  49698. messageSends: ["on:"]
  49699. }),
  49700. $globals.SemanticAnalyzerTest);
  49701. $core.addMethod(
  49702. $core.method({
  49703. selector: "testAssignment",
  49704. protocol: "tests",
  49705. fn: function (){
  49706. var self=this,$self=this;
  49707. var src,ast;
  49708. return $core.withContext(function($ctx1) {
  49709. src="foo self := 1";
  49710. ast=$recv($globals.Smalltalk)._parse_(src);
  49711. $self._should_raise_((function(){
  49712. return $core.withContext(function($ctx2) {
  49713. return $recv($self["@analyzer"])._visit_(ast);
  49714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49715. }),$globals.InvalidAssignmentError);
  49716. return self;
  49717. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49718. },
  49719. args: [],
  49720. 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",
  49721. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  49722. messageSends: ["parse:", "should:raise:", "visit:"]
  49723. }),
  49724. $globals.SemanticAnalyzerTest);
  49725. $core.addMethod(
  49726. $core.method({
  49727. selector: "testNonLocalReturn",
  49728. protocol: "tests",
  49729. fn: function (){
  49730. var self=this,$self=this;
  49731. var src,ast;
  49732. return $core.withContext(function($ctx1) {
  49733. src="foo | a | a + 1. ^ a";
  49734. ast=$recv($globals.Smalltalk)._parse_(src);
  49735. $recv($self["@analyzer"])._visit_(ast);
  49736. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49737. return self;
  49738. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49739. },
  49740. args: [],
  49741. 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",
  49742. referencedClasses: ["Smalltalk"],
  49743. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  49744. }),
  49745. $globals.SemanticAnalyzerTest);
  49746. $core.addMethod(
  49747. $core.method({
  49748. selector: "testNonLocalReturn2",
  49749. protocol: "tests",
  49750. fn: function (){
  49751. var self=this,$self=this;
  49752. var src,ast;
  49753. return $core.withContext(function($ctx1) {
  49754. src="foo | a | a + 1. [ [ ^ a] ]";
  49755. ast=$recv($globals.Smalltalk)._parse_(src);
  49756. $recv($self["@analyzer"])._visit_(ast);
  49757. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49758. return self;
  49759. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49760. },
  49761. args: [],
  49762. 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",
  49763. referencedClasses: ["Smalltalk"],
  49764. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  49765. }),
  49766. $globals.SemanticAnalyzerTest);
  49767. $core.addMethod(
  49768. $core.method({
  49769. selector: "testScope",
  49770. protocol: "tests",
  49771. fn: function (){
  49772. var self=this,$self=this;
  49773. var src,ast;
  49774. return $core.withContext(function($ctx1) {
  49775. var $4,$3,$2,$1;
  49776. src="foo | a | a + 1. [ | b | b := a ]";
  49777. ast=$recv($globals.Smalltalk)._parse_(src);
  49778. $recv($self["@analyzer"])._visit_(ast);
  49779. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49780. $ctx1.sendIdx["dagChildren"]=1;
  49781. $3=$recv($4)._last();
  49782. $2=$recv($3)._scope();
  49783. $ctx1.sendIdx["scope"]=1;
  49784. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49785. $self._deny_($1);
  49786. return self;
  49787. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49788. },
  49789. args: [],
  49790. 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.",
  49791. referencedClasses: ["Smalltalk"],
  49792. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  49793. }),
  49794. $globals.SemanticAnalyzerTest);
  49795. $core.addMethod(
  49796. $core.method({
  49797. selector: "testScope2",
  49798. protocol: "tests",
  49799. fn: function (){
  49800. var self=this,$self=this;
  49801. var src,ast;
  49802. return $core.withContext(function($ctx1) {
  49803. var $8,$7,$6,$5,$4,$3,$2,$1;
  49804. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49805. ast=$recv($globals.Smalltalk)._parse_(src);
  49806. $recv($self["@analyzer"])._visit_(ast);
  49807. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49808. $ctx1.sendIdx["dagChildren"]=3;
  49809. $7=$recv($8)._last();
  49810. $6=$recv($7)._dagChildren();
  49811. $ctx1.sendIdx["dagChildren"]=2;
  49812. $5=$recv($6)._first();
  49813. $ctx1.sendIdx["first"]=2;
  49814. $4=$recv($5)._dagChildren();
  49815. $ctx1.sendIdx["dagChildren"]=1;
  49816. $3=$recv($4)._first();
  49817. $ctx1.sendIdx["first"]=1;
  49818. $2=$recv($3)._scope();
  49819. $ctx1.sendIdx["scope"]=1;
  49820. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49821. $self._deny_($1);
  49822. return self;
  49823. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49824. },
  49825. args: [],
  49826. 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.",
  49827. referencedClasses: ["Smalltalk"],
  49828. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  49829. }),
  49830. $globals.SemanticAnalyzerTest);
  49831. $core.addMethod(
  49832. $core.method({
  49833. selector: "testScopeLevel",
  49834. protocol: "tests",
  49835. fn: function (){
  49836. var self=this,$self=this;
  49837. var src,ast;
  49838. return $core.withContext(function($ctx1) {
  49839. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  49840. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49841. ast=$recv($globals.Smalltalk)._parse_(src);
  49842. $recv($self["@analyzer"])._visit_(ast);
  49843. $2=$recv(ast)._scope();
  49844. $ctx1.sendIdx["scope"]=1;
  49845. $1=$recv($2)._scopeLevel();
  49846. $ctx1.sendIdx["scopeLevel"]=1;
  49847. $self._assert_equals_($1,(1));
  49848. $ctx1.sendIdx["assert:equals:"]=1;
  49849. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49850. $ctx1.sendIdx["dagChildren"]=3;
  49851. $9=$recv($10)._last();
  49852. $8=$recv($9)._dagChildren();
  49853. $ctx1.sendIdx["dagChildren"]=2;
  49854. $7=$recv($8)._first();
  49855. $ctx1.sendIdx["first"]=2;
  49856. $6=$recv($7)._dagChildren();
  49857. $ctx1.sendIdx["dagChildren"]=1;
  49858. $5=$recv($6)._first();
  49859. $ctx1.sendIdx["first"]=1;
  49860. $4=$recv($5)._scope();
  49861. $3=$recv($4)._scopeLevel();
  49862. $self._assert_equals_($3,(3));
  49863. return self;
  49864. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49865. },
  49866. args: [],
  49867. 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",
  49868. referencedClasses: ["Smalltalk"],
  49869. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  49870. }),
  49871. $globals.SemanticAnalyzerTest);
  49872. $core.addMethod(
  49873. $core.method({
  49874. selector: "testUnknownVariables",
  49875. protocol: "tests",
  49876. fn: function (){
  49877. var self=this,$self=this;
  49878. var src,ast;
  49879. return $core.withContext(function($ctx1) {
  49880. src="foo | a | b + a";
  49881. ast=$recv($globals.Smalltalk)._parse_(src);
  49882. $self._should_raise_((function(){
  49883. return $core.withContext(function($ctx2) {
  49884. return $recv($self["@analyzer"])._visit_(ast);
  49885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49886. }),$globals.UnknownVariableError);
  49887. return self;
  49888. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49889. },
  49890. args: [],
  49891. 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",
  49892. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  49893. messageSends: ["parse:", "should:raise:", "visit:"]
  49894. }),
  49895. $globals.SemanticAnalyzerTest);
  49896. $core.addMethod(
  49897. $core.method({
  49898. selector: "testUnknownVariablesWithScope",
  49899. protocol: "tests",
  49900. fn: function (){
  49901. var self=this,$self=this;
  49902. var src,ast;
  49903. return $core.withContext(function($ctx1) {
  49904. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  49905. ast=$recv($globals.Smalltalk)._parse_(src);
  49906. $self._should_raise_((function(){
  49907. return $core.withContext(function($ctx2) {
  49908. return $recv($self["@analyzer"])._visit_(ast);
  49909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49910. }),$globals.UnknownVariableError);
  49911. return self;
  49912. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49913. },
  49914. args: [],
  49915. 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",
  49916. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  49917. messageSends: ["parse:", "should:raise:", "visit:"]
  49918. }),
  49919. $globals.SemanticAnalyzerTest);
  49920. $core.addMethod(
  49921. $core.method({
  49922. selector: "testVariableShadowing",
  49923. protocol: "tests",
  49924. fn: function (){
  49925. var self=this,$self=this;
  49926. var src,ast;
  49927. return $core.withContext(function($ctx1) {
  49928. src="foo | a | a + 1";
  49929. ast=$recv($globals.Smalltalk)._parse_(src);
  49930. $recv($self["@analyzer"])._visit_(ast);
  49931. return self;
  49932. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49933. },
  49934. args: [],
  49935. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  49936. referencedClasses: ["Smalltalk"],
  49937. messageSends: ["parse:", "visit:"]
  49938. }),
  49939. $globals.SemanticAnalyzerTest);
  49940. $core.addMethod(
  49941. $core.method({
  49942. selector: "testVariableShadowing2",
  49943. protocol: "tests",
  49944. fn: function (){
  49945. var self=this,$self=this;
  49946. var src,ast;
  49947. return $core.withContext(function($ctx1) {
  49948. src="foo | a | a + 1. [ | a | a := 2 ]";
  49949. ast=$recv($globals.Smalltalk)._parse_(src);
  49950. $self._should_raise_((function(){
  49951. return $core.withContext(function($ctx2) {
  49952. return $recv($self["@analyzer"])._visit_(ast);
  49953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49954. }),$globals.ShadowingVariableError);
  49955. return self;
  49956. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49957. },
  49958. args: [],
  49959. 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",
  49960. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  49961. messageSends: ["parse:", "should:raise:", "visit:"]
  49962. }),
  49963. $globals.SemanticAnalyzerTest);
  49964. $core.addMethod(
  49965. $core.method({
  49966. selector: "testVariableShadowing3",
  49967. protocol: "tests",
  49968. fn: function (){
  49969. var self=this,$self=this;
  49970. var src,ast;
  49971. return $core.withContext(function($ctx1) {
  49972. src="foo | a | a + 1. [ | b | b := 2 ]";
  49973. ast=$recv($globals.Smalltalk)._parse_(src);
  49974. $recv($self["@analyzer"])._visit_(ast);
  49975. return self;
  49976. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49977. },
  49978. args: [],
  49979. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  49980. referencedClasses: ["Smalltalk"],
  49981. messageSends: ["parse:", "visit:"]
  49982. }),
  49983. $globals.SemanticAnalyzerTest);
  49984. $core.addMethod(
  49985. $core.method({
  49986. selector: "testVariableShadowing4",
  49987. protocol: "tests",
  49988. fn: function (){
  49989. var self=this,$self=this;
  49990. var src,ast;
  49991. return $core.withContext(function($ctx1) {
  49992. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  49993. ast=$recv($globals.Smalltalk)._parse_(src);
  49994. $recv($self["@analyzer"])._visit_(ast);
  49995. return self;
  49996. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49997. },
  49998. args: [],
  49999. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50000. referencedClasses: ["Smalltalk"],
  50001. messageSends: ["parse:", "visit:"]
  50002. }),
  50003. $globals.SemanticAnalyzerTest);
  50004. $core.addMethod(
  50005. $core.method({
  50006. selector: "testVariableShadowing5",
  50007. protocol: "tests",
  50008. fn: function (){
  50009. var self=this,$self=this;
  50010. var src,ast;
  50011. return $core.withContext(function($ctx1) {
  50012. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50013. ast=$recv($globals.Smalltalk)._parse_(src);
  50014. $self._should_raise_((function(){
  50015. return $core.withContext(function($ctx2) {
  50016. return $recv($self["@analyzer"])._visit_(ast);
  50017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50018. }),$globals.ShadowingVariableError);
  50019. return self;
  50020. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50021. },
  50022. args: [],
  50023. 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",
  50024. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50025. messageSends: ["parse:", "should:raise:", "visit:"]
  50026. }),
  50027. $globals.SemanticAnalyzerTest);
  50028. $core.addMethod(
  50029. $core.method({
  50030. selector: "testVariablesLookup",
  50031. protocol: "tests",
  50032. fn: function (){
  50033. var self=this,$self=this;
  50034. var src,ast;
  50035. return $core.withContext(function($ctx1) {
  50036. 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;
  50037. src="foo | a | a + 1. [ | b | b := a ]";
  50038. ast=$recv($globals.Smalltalk)._parse_(src);
  50039. $recv($self["@analyzer"])._visit_(ast);
  50040. $7=$recv(ast)._dagChildren();
  50041. $ctx1.sendIdx["dagChildren"]=2;
  50042. $6=$recv($7)._first();
  50043. $ctx1.sendIdx["first"]=2;
  50044. $5=$recv($6)._dagChildren();
  50045. $ctx1.sendIdx["dagChildren"]=1;
  50046. $4=$recv($5)._first();
  50047. $ctx1.sendIdx["first"]=1;
  50048. $3=$recv($4)._receiver();
  50049. $ctx1.sendIdx["receiver"]=1;
  50050. $2=$recv($3)._binding();
  50051. $ctx1.sendIdx["binding"]=1;
  50052. $1=$recv($2)._isTempVar();
  50053. $ctx1.sendIdx["isTempVar"]=1;
  50054. $self._assert_($1);
  50055. $ctx1.sendIdx["assert:"]=1;
  50056. $15=$recv(ast)._dagChildren();
  50057. $ctx1.sendIdx["dagChildren"]=4;
  50058. $14=$recv($15)._first();
  50059. $ctx1.sendIdx["first"]=4;
  50060. $13=$recv($14)._dagChildren();
  50061. $ctx1.sendIdx["dagChildren"]=3;
  50062. $12=$recv($13)._first();
  50063. $ctx1.sendIdx["first"]=3;
  50064. $11=$recv($12)._receiver();
  50065. $10=$recv($11)._binding();
  50066. $ctx1.sendIdx["binding"]=2;
  50067. $9=$recv($10)._scope();
  50068. $ctx1.sendIdx["scope"]=1;
  50069. $16=$recv(ast)._scope();
  50070. $ctx1.sendIdx["scope"]=2;
  50071. $8=$recv($9).__eq_eq($16);
  50072. $ctx1.sendIdx["=="]=1;
  50073. $self._assert_($8);
  50074. $ctx1.sendIdx["assert:"]=2;
  50075. $27=$recv(ast)._dagChildren();
  50076. $ctx1.sendIdx["dagChildren"]=8;
  50077. $26=$recv($27)._first();
  50078. $ctx1.sendIdx["first"]=7;
  50079. $25=$recv($26)._dagChildren();
  50080. $ctx1.sendIdx["dagChildren"]=7;
  50081. $24=$recv($25)._last();
  50082. $ctx1.sendIdx["last"]=1;
  50083. $23=$recv($24)._dagChildren();
  50084. $ctx1.sendIdx["dagChildren"]=6;
  50085. $22=$recv($23)._first();
  50086. $ctx1.sendIdx["first"]=6;
  50087. $21=$recv($22)._dagChildren();
  50088. $ctx1.sendIdx["dagChildren"]=5;
  50089. $20=$recv($21)._first();
  50090. $ctx1.sendIdx["first"]=5;
  50091. $19=$recv($20)._left();
  50092. $ctx1.sendIdx["left"]=1;
  50093. $18=$recv($19)._binding();
  50094. $ctx1.sendIdx["binding"]=3;
  50095. $17=$recv($18)._isTempVar();
  50096. $self._assert_($17);
  50097. $ctx1.sendIdx["assert:"]=3;
  50098. $39=$recv(ast)._dagChildren();
  50099. $ctx1.sendIdx["dagChildren"]=12;
  50100. $38=$recv($39)._first();
  50101. $ctx1.sendIdx["first"]=10;
  50102. $37=$recv($38)._dagChildren();
  50103. $ctx1.sendIdx["dagChildren"]=11;
  50104. $36=$recv($37)._last();
  50105. $ctx1.sendIdx["last"]=2;
  50106. $35=$recv($36)._dagChildren();
  50107. $ctx1.sendIdx["dagChildren"]=10;
  50108. $34=$recv($35)._first();
  50109. $ctx1.sendIdx["first"]=9;
  50110. $33=$recv($34)._dagChildren();
  50111. $ctx1.sendIdx["dagChildren"]=9;
  50112. $32=$recv($33)._first();
  50113. $ctx1.sendIdx["first"]=8;
  50114. $31=$recv($32)._left();
  50115. $30=$recv($31)._binding();
  50116. $29=$recv($30)._scope();
  50117. $ctx1.sendIdx["scope"]=3;
  50118. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50119. $ctx1.sendIdx["dagChildren"]=13;
  50120. $41=$recv($42)._last();
  50121. $40=$recv($41)._scope();
  50122. $28=$recv($29).__eq_eq($40);
  50123. $self._assert_($28);
  50124. return self;
  50125. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50126. },
  50127. args: [],
  50128. 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.",
  50129. referencedClasses: ["Smalltalk"],
  50130. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50131. }),
  50132. $globals.SemanticAnalyzerTest);
  50133. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50134. $core.addMethod(
  50135. $core.method({
  50136. selector: "setUp",
  50137. protocol: "running",
  50138. fn: function (){
  50139. var self=this,$self=this;
  50140. return $core.withContext(function($ctx1) {
  50141. var $1,$3,$4,$2;
  50142. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50143. $3=$recv($globals.AIContext)._new();
  50144. $recv($3)._defineLocal_("local");
  50145. $recv($3)._localAt_put_("local",(3));
  50146. $4=$recv($3)._yourself();
  50147. $ctx1.sendIdx["yourself"]=1;
  50148. $2=$4;
  50149. $recv($1)._context_($2);
  50150. $self["@analyzer"]=$recv($1)._yourself();
  50151. return self;
  50152. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50153. },
  50154. args: [],
  50155. 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",
  50156. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50157. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50158. }),
  50159. $globals.AISemanticAnalyzerTest);
  50160. $core.addMethod(
  50161. $core.method({
  50162. selector: "testContextVariables",
  50163. protocol: "tests",
  50164. fn: function (){
  50165. var self=this,$self=this;
  50166. var src,ast;
  50167. return $core.withContext(function($ctx1) {
  50168. src="foo | a | local + a";
  50169. ast=$recv($globals.Smalltalk)._parse_(src);
  50170. $self._shouldnt_raise_((function(){
  50171. return $core.withContext(function($ctx2) {
  50172. return $recv($self["@analyzer"])._visit_(ast);
  50173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50174. }),$globals.UnknownVariableError);
  50175. return self;
  50176. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50177. },
  50178. args: [],
  50179. 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",
  50180. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50181. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50182. }),
  50183. $globals.AISemanticAnalyzerTest);
  50184. });
  50185. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50186. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50187. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50188. $core.addPackage("Kernel-Tests");
  50189. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50190. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50191. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50192. $core.addMethod(
  50193. $core.method({
  50194. selector: "testAddExtensionMethod",
  50195. protocol: "tests",
  50196. fn: function (){
  50197. var self=this,$self=this;
  50198. var method,dirty;
  50199. return $core.withContext(function($ctx1) {
  50200. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50201. $2=$self._class();
  50202. $ctx1.sendIdx["class"]=1;
  50203. $1=$recv($2)._package();
  50204. $ctx1.sendIdx["package"]=1;
  50205. dirty=$recv($1)._isDirty();
  50206. $ctx1.sendIdx["isDirty"]=1;
  50207. $4=$self._class();
  50208. $ctx1.sendIdx["class"]=2;
  50209. $3=$recv($4)._package();
  50210. $ctx1.sendIdx["package"]=2;
  50211. $recv($3)._beClean();
  50212. $5=$self._class();
  50213. $ctx1.sendIdx["class"]=3;
  50214. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50215. $8=$self._class();
  50216. $ctx1.sendIdx["class"]=4;
  50217. $7=$recv($8)._package();
  50218. $ctx1.sendIdx["package"]=3;
  50219. $6=$recv($7)._isDirty();
  50220. $self._deny_($6);
  50221. $9=$self._class();
  50222. $ctx1.sendIdx["class"]=5;
  50223. $recv($9)._removeCompiledMethod_(method);
  50224. $10=dirty;
  50225. if($core.assert($10)){
  50226. $recv($recv($self._class())._package())._beDirty();
  50227. }
  50228. return self;
  50229. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50230. },
  50231. args: [],
  50232. 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 ]",
  50233. referencedClasses: [],
  50234. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50235. }),
  50236. $globals.AnnouncementSubscriptionTest);
  50237. $core.addMethod(
  50238. $core.method({
  50239. selector: "testHandlesAnnouncement",
  50240. protocol: "tests",
  50241. fn: function (){
  50242. var self=this,$self=this;
  50243. var subscription,announcementClass1,announcementClass2,classBuilder;
  50244. return $core.withContext(function($ctx1) {
  50245. var $1,$2;
  50246. classBuilder=$recv($globals.ClassBuilder)._new();
  50247. $ctx1.sendIdx["new"]=1;
  50248. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50249. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50250. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50251. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50252. $self._assert_equals_($1,true);
  50253. $ctx1.sendIdx["assert:equals:"]=1;
  50254. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50255. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50256. $self._assert_equals_($2,true);
  50257. $ctx1.sendIdx["assert:equals:"]=2;
  50258. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50259. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50260. return self;
  50261. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50262. },
  50263. args: [],
  50264. 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.",
  50265. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50266. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50267. }),
  50268. $globals.AnnouncementSubscriptionTest);
  50269. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50270. $core.addMethod(
  50271. $core.method({
  50272. selector: "testOnDo",
  50273. protocol: "tests",
  50274. fn: function (){
  50275. var self=this,$self=this;
  50276. var counter,announcer;
  50277. return $core.withContext(function($ctx1) {
  50278. var $1,$2;
  50279. counter=(0);
  50280. announcer=$recv($globals.Announcer)._new();
  50281. $ctx1.sendIdx["new"]=1;
  50282. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50283. return $core.withContext(function($ctx2) {
  50284. counter=$recv(counter).__plus((1));
  50285. return counter;
  50286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50287. }));
  50288. $1=announcer;
  50289. $2=$recv($globals.SystemAnnouncement)._new();
  50290. $ctx1.sendIdx["new"]=2;
  50291. $recv($1)._announce_($2);
  50292. $ctx1.sendIdx["announce:"]=1;
  50293. $self._assert_equals_(counter,(1));
  50294. $ctx1.sendIdx["assert:equals:"]=1;
  50295. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50296. $self._assert_equals_(counter,(2));
  50297. return self;
  50298. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50299. },
  50300. args: [],
  50301. 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.",
  50302. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50303. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50304. }),
  50305. $globals.AnnouncerTest);
  50306. $core.addMethod(
  50307. $core.method({
  50308. selector: "testOnDoFor",
  50309. protocol: "tests",
  50310. fn: function (){
  50311. var self=this,$self=this;
  50312. var counter,announcer;
  50313. return $core.withContext(function($ctx1) {
  50314. var $1,$2,$3,$4;
  50315. counter=(0);
  50316. announcer=$recv($globals.Announcer)._new();
  50317. $ctx1.sendIdx["new"]=1;
  50318. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50319. return $core.withContext(function($ctx2) {
  50320. counter=$recv(counter).__plus((1));
  50321. return counter;
  50322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50323. }),self);
  50324. $1=announcer;
  50325. $2=$recv($globals.SystemAnnouncement)._new();
  50326. $ctx1.sendIdx["new"]=2;
  50327. $recv($1)._announce_($2);
  50328. $ctx1.sendIdx["announce:"]=1;
  50329. $self._assert_equals_(counter,(1));
  50330. $ctx1.sendIdx["assert:equals:"]=1;
  50331. $3=announcer;
  50332. $4=$recv($globals.SystemAnnouncement)._new();
  50333. $ctx1.sendIdx["new"]=3;
  50334. $recv($3)._announce_($4);
  50335. $ctx1.sendIdx["announce:"]=2;
  50336. $self._assert_equals_(counter,(2));
  50337. $ctx1.sendIdx["assert:equals:"]=2;
  50338. $recv(announcer)._unsubscribe_(self);
  50339. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50340. $self._assert_equals_(counter,(2));
  50341. return self;
  50342. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50343. },
  50344. args: [],
  50345. 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.",
  50346. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50347. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50348. }),
  50349. $globals.AnnouncerTest);
  50350. $core.addMethod(
  50351. $core.method({
  50352. selector: "testOnDoOnce",
  50353. protocol: "tests",
  50354. fn: function (){
  50355. var self=this,$self=this;
  50356. var counter,announcer;
  50357. return $core.withContext(function($ctx1) {
  50358. var $1,$2;
  50359. counter=(0);
  50360. announcer=$recv($globals.Announcer)._new();
  50361. $ctx1.sendIdx["new"]=1;
  50362. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50363. return $core.withContext(function($ctx2) {
  50364. counter=$recv(counter).__plus((1));
  50365. return counter;
  50366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50367. }));
  50368. $1=announcer;
  50369. $2=$recv($globals.SystemAnnouncement)._new();
  50370. $ctx1.sendIdx["new"]=2;
  50371. $recv($1)._announce_($2);
  50372. $ctx1.sendIdx["announce:"]=1;
  50373. $self._assert_equals_(counter,(1));
  50374. $ctx1.sendIdx["assert:equals:"]=1;
  50375. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50376. $self._assert_equals_(counter,(1));
  50377. return self;
  50378. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50379. },
  50380. args: [],
  50381. 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.",
  50382. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50383. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50384. }),
  50385. $globals.AnnouncerTest);
  50386. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50387. $core.addMethod(
  50388. $core.method({
  50389. selector: "localReturnOnDoCatch",
  50390. protocol: "fixture",
  50391. fn: function (){
  50392. var self=this,$self=this;
  50393. return $core.withContext(function($ctx1) {
  50394. var $early={};
  50395. try {
  50396. $recv((function(){
  50397. throw $early=[(2)];
  50398. }))._on_do_($globals.Error,(function(){
  50399. }));
  50400. return (3);
  50401. }
  50402. catch(e) {if(e===$early)return e[0]; throw e}
  50403. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50404. },
  50405. args: [],
  50406. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50407. referencedClasses: ["Error"],
  50408. messageSends: ["on:do:"]
  50409. }),
  50410. $globals.BlockClosureTest);
  50411. $core.addMethod(
  50412. $core.method({
  50413. selector: "localReturnOnDoMiss",
  50414. protocol: "fixture",
  50415. fn: function (){
  50416. var self=this,$self=this;
  50417. return $core.withContext(function($ctx1) {
  50418. var $early={};
  50419. try {
  50420. $recv((function(){
  50421. throw $early=[(2)];
  50422. }))._on_do_($globals.Class,(function(){
  50423. }));
  50424. return (3);
  50425. }
  50426. catch(e) {if(e===$early)return e[0]; throw e}
  50427. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50428. },
  50429. args: [],
  50430. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50431. referencedClasses: ["Class"],
  50432. messageSends: ["on:do:"]
  50433. }),
  50434. $globals.BlockClosureTest);
  50435. $core.addMethod(
  50436. $core.method({
  50437. selector: "testCanClearInterval",
  50438. protocol: "tests",
  50439. fn: function (){
  50440. var self=this,$self=this;
  50441. return $core.withContext(function($ctx1) {
  50442. $self._shouldnt_raise_((function(){
  50443. return $core.withContext(function($ctx2) {
  50444. return $recv($recv((function(){
  50445. return $core.withContext(function($ctx3) {
  50446. return $recv($recv($globals.Error)._new())._signal();
  50447. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50448. }))._valueWithInterval_((0)))._clearInterval();
  50449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50450. }),$globals.Error);
  50451. return self;
  50452. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50453. },
  50454. args: [],
  50455. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50456. referencedClasses: ["Error"],
  50457. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50458. }),
  50459. $globals.BlockClosureTest);
  50460. $core.addMethod(
  50461. $core.method({
  50462. selector: "testCanClearTimeout",
  50463. protocol: "tests",
  50464. fn: function (){
  50465. var self=this,$self=this;
  50466. return $core.withContext(function($ctx1) {
  50467. $self._shouldnt_raise_((function(){
  50468. return $core.withContext(function($ctx2) {
  50469. return $recv($recv((function(){
  50470. return $core.withContext(function($ctx3) {
  50471. return $recv($recv($globals.Error)._new())._signal();
  50472. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50473. }))._valueWithTimeout_((0)))._clearTimeout();
  50474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50475. }),$globals.Error);
  50476. return self;
  50477. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50478. },
  50479. args: [],
  50480. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50481. referencedClasses: ["Error"],
  50482. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50483. }),
  50484. $globals.BlockClosureTest);
  50485. $core.addMethod(
  50486. $core.method({
  50487. selector: "testCompiledSource",
  50488. protocol: "tests",
  50489. fn: function (){
  50490. var self=this,$self=this;
  50491. return $core.withContext(function($ctx1) {
  50492. $self._assert_($recv($recv((function(){
  50493. return $core.withContext(function($ctx2) {
  50494. return (1).__plus((1));
  50495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50496. }))._compiledSource())._includesSubString_("function"));
  50497. return self;
  50498. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50499. },
  50500. args: [],
  50501. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50502. referencedClasses: [],
  50503. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50504. }),
  50505. $globals.BlockClosureTest);
  50506. $core.addMethod(
  50507. $core.method({
  50508. selector: "testCurrySelf",
  50509. protocol: "tests",
  50510. fn: function (){
  50511. var self=this,$self=this;
  50512. var curriedMethod,array;
  50513. return $core.withContext(function($ctx1) {
  50514. curriedMethod=$recv($recv((function(selfarg,x){
  50515. return $core.withContext(function($ctx2) {
  50516. return $recv(selfarg)._at_(x);
  50517. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50518. }))._currySelf())._asCompiledMethod_("foo:");
  50519. array=[(3), (1), (4)];
  50520. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50521. $recv((function(){
  50522. return $core.withContext(function($ctx2) {
  50523. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50525. }))._ensure_((function(){
  50526. return $core.withContext(function($ctx2) {
  50527. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50529. }));
  50530. return self;
  50531. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50532. },
  50533. args: [],
  50534. 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 ]",
  50535. referencedClasses: ["ClassBuilder", "Array"],
  50536. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50537. }),
  50538. $globals.BlockClosureTest);
  50539. $core.addMethod(
  50540. $core.method({
  50541. selector: "testEnsure",
  50542. protocol: "tests",
  50543. fn: function (){
  50544. var self=this,$self=this;
  50545. return $core.withContext(function($ctx1) {
  50546. $self._assert_equals_($recv((function(){
  50547. return (3);
  50548. }))._ensure_((function(){
  50549. return (4);
  50550. })),(3));
  50551. return self;
  50552. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50553. },
  50554. args: [],
  50555. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50556. referencedClasses: [],
  50557. messageSends: ["assert:equals:", "ensure:"]
  50558. }),
  50559. $globals.BlockClosureTest);
  50560. $core.addMethod(
  50561. $core.method({
  50562. selector: "testEnsureRaises",
  50563. protocol: "tests",
  50564. fn: function (){
  50565. var self=this,$self=this;
  50566. return $core.withContext(function($ctx1) {
  50567. $self._should_raise_((function(){
  50568. return $core.withContext(function($ctx2) {
  50569. return $recv((function(){
  50570. return $core.withContext(function($ctx3) {
  50571. return $recv($recv($globals.Error)._new())._signal();
  50572. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50573. }))._ensure_((function(){
  50574. return true;
  50575. }));
  50576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50577. }),$globals.Error);
  50578. return self;
  50579. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  50580. },
  50581. args: [],
  50582. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50583. referencedClasses: ["Error"],
  50584. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50585. }),
  50586. $globals.BlockClosureTest);
  50587. $core.addMethod(
  50588. $core.method({
  50589. selector: "testExceptionSemantics",
  50590. protocol: "tests",
  50591. fn: function (){
  50592. var self=this,$self=this;
  50593. return $core.withContext(function($ctx1) {
  50594. $self._timeout_((100));
  50595. $recv($self._async_((function(){
  50596. return $core.withContext(function($ctx2) {
  50597. return $recv((function(){
  50598. return $core.withContext(function($ctx3) {
  50599. $self._assert_(true);
  50600. $recv($globals.Error)._signal();
  50601. $self._deny_(true);
  50602. return $self._finished();
  50603. $ctx3.sendIdx["finished"]=1;
  50604. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50605. }))._on_do_($globals.Error,(function(ex){
  50606. return $core.withContext(function($ctx3) {
  50607. return $self._finished();
  50608. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50609. }));
  50610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50611. })))._valueWithTimeout_((0));
  50612. return self;
  50613. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  50614. },
  50615. args: [],
  50616. 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",
  50617. referencedClasses: ["Error"],
  50618. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  50619. }),
  50620. $globals.BlockClosureTest);
  50621. $core.addMethod(
  50622. $core.method({
  50623. selector: "testLocalReturnOnDoCatch",
  50624. protocol: "tests",
  50625. fn: function (){
  50626. var self=this,$self=this;
  50627. return $core.withContext(function($ctx1) {
  50628. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  50629. return self;
  50630. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50631. },
  50632. args: [],
  50633. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  50634. referencedClasses: [],
  50635. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  50636. }),
  50637. $globals.BlockClosureTest);
  50638. $core.addMethod(
  50639. $core.method({
  50640. selector: "testLocalReturnOnDoMiss",
  50641. protocol: "tests",
  50642. fn: function (){
  50643. var self=this,$self=this;
  50644. return $core.withContext(function($ctx1) {
  50645. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  50646. return self;
  50647. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50648. },
  50649. args: [],
  50650. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  50651. referencedClasses: [],
  50652. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  50653. }),
  50654. $globals.BlockClosureTest);
  50655. $core.addMethod(
  50656. $core.method({
  50657. selector: "testNewWithValues",
  50658. protocol: "tests",
  50659. fn: function (){
  50660. var self=this,$self=this;
  50661. return $core.withContext(function($ctx1) {
  50662. function TestConstructor(arg1, arg2, arg3) {}
  50663. TestConstructor.prototype.name = "theTestPrototype";
  50664. var wrappedConstructor = $recv(TestConstructor);
  50665. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  50666. $self._assert_(result instanceof TestConstructor);
  50667. $self._assert_equals_(result.name, "theTestPrototype");
  50668. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  50669. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  50670. return self;
  50671. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  50672. },
  50673. args: [],
  50674. 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'>",
  50675. referencedClasses: [],
  50676. messageSends: []
  50677. }),
  50678. $globals.BlockClosureTest);
  50679. $core.addMethod(
  50680. $core.method({
  50681. selector: "testNumArgs",
  50682. protocol: "tests",
  50683. fn: function (){
  50684. var self=this,$self=this;
  50685. return $core.withContext(function($ctx1) {
  50686. var $1;
  50687. $1=$recv((function(){
  50688. }))._numArgs();
  50689. $ctx1.sendIdx["numArgs"]=1;
  50690. $self._assert_equals_($1,(0));
  50691. $ctx1.sendIdx["assert:equals:"]=1;
  50692. $self._assert_equals_($recv((function(a,b){
  50693. }))._numArgs(),(2));
  50694. return self;
  50695. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  50696. },
  50697. args: [],
  50698. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  50699. referencedClasses: [],
  50700. messageSends: ["assert:equals:", "numArgs"]
  50701. }),
  50702. $globals.BlockClosureTest);
  50703. $core.addMethod(
  50704. $core.method({
  50705. selector: "testOnDo",
  50706. protocol: "tests",
  50707. fn: function (){
  50708. var self=this,$self=this;
  50709. return $core.withContext(function($ctx1) {
  50710. $self._assert_($recv((function(){
  50711. return $core.withContext(function($ctx2) {
  50712. return $recv($recv($globals.Error)._new())._signal();
  50713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50714. }))._on_do_($globals.Error,(function(ex){
  50715. return true;
  50716. })));
  50717. return self;
  50718. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  50719. },
  50720. args: [],
  50721. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  50722. referencedClasses: ["Error"],
  50723. messageSends: ["assert:", "on:do:", "signal", "new"]
  50724. }),
  50725. $globals.BlockClosureTest);
  50726. $core.addMethod(
  50727. $core.method({
  50728. selector: "testValue",
  50729. protocol: "tests",
  50730. fn: function (){
  50731. var self=this,$self=this;
  50732. return $core.withContext(function($ctx1) {
  50733. var $1;
  50734. $1=$recv((function(){
  50735. return $core.withContext(function($ctx2) {
  50736. return (1).__plus((1));
  50737. $ctx2.sendIdx["+"]=1;
  50738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50739. }))._value();
  50740. $ctx1.sendIdx["value"]=1;
  50741. $self._assert_equals_($1,(2));
  50742. $ctx1.sendIdx["assert:equals:"]=1;
  50743. $self._assert_equals_($recv((function(x){
  50744. return $core.withContext(function($ctx2) {
  50745. return $recv(x).__plus((1));
  50746. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  50747. }))._value_((2)),(3));
  50748. $ctx1.sendIdx["assert:equals:"]=2;
  50749. $self._assert_equals_($recv((function(x,y){
  50750. return $core.withContext(function($ctx2) {
  50751. return $recv(x).__star(y);
  50752. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  50753. }))._value_value_((2),(4)),(8));
  50754. $ctx1.sendIdx["assert:equals:"]=3;
  50755. $self._assert_equals_($recv((function(a,b,c){
  50756. return (1);
  50757. }))._value(),(1));
  50758. return self;
  50759. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  50760. },
  50761. args: [],
  50762. 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",
  50763. referencedClasses: [],
  50764. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  50765. }),
  50766. $globals.BlockClosureTest);
  50767. $core.addMethod(
  50768. $core.method({
  50769. selector: "testValueWithPossibleArguments",
  50770. protocol: "tests",
  50771. fn: function (){
  50772. var self=this,$self=this;
  50773. return $core.withContext(function($ctx1) {
  50774. var $1,$2;
  50775. $1=$recv((function(){
  50776. return (1);
  50777. }))._valueWithPossibleArguments_([(3), (4)]);
  50778. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  50779. $self._assert_equals_($1,(1));
  50780. $ctx1.sendIdx["assert:equals:"]=1;
  50781. $2=$recv((function(a){
  50782. return $core.withContext(function($ctx2) {
  50783. return $recv(a).__plus((4));
  50784. $ctx2.sendIdx["+"]=1;
  50785. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  50786. }))._valueWithPossibleArguments_([(3), (4)]);
  50787. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  50788. $self._assert_equals_($2,(7));
  50789. $ctx1.sendIdx["assert:equals:"]=2;
  50790. $self._assert_equals_($recv((function(a,b){
  50791. return $core.withContext(function($ctx2) {
  50792. return $recv(a).__plus(b);
  50793. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  50794. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  50795. return self;
  50796. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  50797. },
  50798. args: [],
  50799. 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.",
  50800. referencedClasses: [],
  50801. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  50802. }),
  50803. $globals.BlockClosureTest);
  50804. $core.addMethod(
  50805. $core.method({
  50806. selector: "testWhileFalse",
  50807. protocol: "tests",
  50808. fn: function (){
  50809. var self=this,$self=this;
  50810. var i;
  50811. return $core.withContext(function($ctx1) {
  50812. i=(0);
  50813. $recv((function(){
  50814. return $core.withContext(function($ctx2) {
  50815. return $recv(i).__gt((5));
  50816. $ctx2.sendIdx[">"]=1;
  50817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50818. }))._whileFalse_((function(){
  50819. return $core.withContext(function($ctx2) {
  50820. i=$recv(i).__plus((1));
  50821. $ctx2.sendIdx["+"]=1;
  50822. return i;
  50823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50824. }));
  50825. $self._assert_equals_(i,(6));
  50826. $ctx1.sendIdx["assert:equals:"]=1;
  50827. i=(0);
  50828. $recv((function(){
  50829. return $core.withContext(function($ctx2) {
  50830. i=$recv(i).__plus((1));
  50831. i;
  50832. return $recv(i).__gt((5));
  50833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50834. }))._whileFalse();
  50835. $self._assert_equals_(i,(6));
  50836. return self;
  50837. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  50838. },
  50839. args: [],
  50840. 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",
  50841. referencedClasses: [],
  50842. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  50843. }),
  50844. $globals.BlockClosureTest);
  50845. $core.addMethod(
  50846. $core.method({
  50847. selector: "testWhileTrue",
  50848. protocol: "tests",
  50849. fn: function (){
  50850. var self=this,$self=this;
  50851. var i;
  50852. return $core.withContext(function($ctx1) {
  50853. i=(0);
  50854. $recv((function(){
  50855. return $core.withContext(function($ctx2) {
  50856. return $recv(i).__lt((5));
  50857. $ctx2.sendIdx["<"]=1;
  50858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50859. }))._whileTrue_((function(){
  50860. return $core.withContext(function($ctx2) {
  50861. i=$recv(i).__plus((1));
  50862. $ctx2.sendIdx["+"]=1;
  50863. return i;
  50864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50865. }));
  50866. $self._assert_equals_(i,(5));
  50867. $ctx1.sendIdx["assert:equals:"]=1;
  50868. i=(0);
  50869. $recv((function(){
  50870. return $core.withContext(function($ctx2) {
  50871. i=$recv(i).__plus((1));
  50872. i;
  50873. return $recv(i).__lt((5));
  50874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50875. }))._whileTrue();
  50876. $self._assert_equals_(i,(5));
  50877. return self;
  50878. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  50879. },
  50880. args: [],
  50881. 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",
  50882. referencedClasses: [],
  50883. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  50884. }),
  50885. $globals.BlockClosureTest);
  50886. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  50887. $core.addMethod(
  50888. $core.method({
  50889. selector: "testEquality",
  50890. protocol: "tests",
  50891. fn: function (){
  50892. var self=this,$self=this;
  50893. return $core.withContext(function($ctx1) {
  50894. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  50895. $1=(0).__eq(false);
  50896. $ctx1.sendIdx["="]=1;
  50897. $self._deny_($1);
  50898. $ctx1.sendIdx["deny:"]=1;
  50899. $2=false.__eq((0));
  50900. $ctx1.sendIdx["="]=2;
  50901. $self._deny_($2);
  50902. $ctx1.sendIdx["deny:"]=2;
  50903. $3="".__eq(false);
  50904. $ctx1.sendIdx["="]=3;
  50905. $self._deny_($3);
  50906. $ctx1.sendIdx["deny:"]=3;
  50907. $4=false.__eq("");
  50908. $ctx1.sendIdx["="]=4;
  50909. $self._deny_($4);
  50910. $ctx1.sendIdx["deny:"]=4;
  50911. $5=true.__eq(true);
  50912. $ctx1.sendIdx["="]=5;
  50913. $self._assert_($5);
  50914. $ctx1.sendIdx["assert:"]=1;
  50915. $6=false.__eq(true);
  50916. $ctx1.sendIdx["="]=6;
  50917. $self._deny_($6);
  50918. $ctx1.sendIdx["deny:"]=5;
  50919. $7=true.__eq(false);
  50920. $ctx1.sendIdx["="]=7;
  50921. $self._deny_($7);
  50922. $8=false.__eq(false);
  50923. $ctx1.sendIdx["="]=8;
  50924. $self._assert_($8);
  50925. $ctx1.sendIdx["assert:"]=2;
  50926. $10=true._yourself();
  50927. $ctx1.sendIdx["yourself"]=1;
  50928. $9=$recv($10).__eq(true);
  50929. $ctx1.sendIdx["="]=9;
  50930. $self._assert_($9);
  50931. $ctx1.sendIdx["assert:"]=3;
  50932. $12=true._yourself();
  50933. $ctx1.sendIdx["yourself"]=2;
  50934. $11=$recv($12).__eq(true._yourself());
  50935. $self._assert_($11);
  50936. return self;
  50937. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  50938. },
  50939. args: [],
  50940. 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)",
  50941. referencedClasses: [],
  50942. messageSends: ["deny:", "=", "assert:", "yourself"]
  50943. }),
  50944. $globals.BooleanTest);
  50945. $core.addMethod(
  50946. $core.method({
  50947. selector: "testIdentity",
  50948. protocol: "tests",
  50949. fn: function (){
  50950. var self=this,$self=this;
  50951. return $core.withContext(function($ctx1) {
  50952. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  50953. $1=(0).__eq_eq(false);
  50954. $ctx1.sendIdx["=="]=1;
  50955. $self._deny_($1);
  50956. $ctx1.sendIdx["deny:"]=1;
  50957. $2=false.__eq_eq((0));
  50958. $ctx1.sendIdx["=="]=2;
  50959. $self._deny_($2);
  50960. $ctx1.sendIdx["deny:"]=2;
  50961. $3="".__eq_eq(false);
  50962. $ctx1.sendIdx["=="]=3;
  50963. $self._deny_($3);
  50964. $ctx1.sendIdx["deny:"]=3;
  50965. $4=false.__eq_eq("");
  50966. $ctx1.sendIdx["=="]=4;
  50967. $self._deny_($4);
  50968. $ctx1.sendIdx["deny:"]=4;
  50969. $5=true.__eq_eq(true);
  50970. $ctx1.sendIdx["=="]=5;
  50971. $self._assert_($5);
  50972. $ctx1.sendIdx["assert:"]=1;
  50973. $6=false.__eq_eq(true);
  50974. $ctx1.sendIdx["=="]=6;
  50975. $self._deny_($6);
  50976. $ctx1.sendIdx["deny:"]=5;
  50977. $7=true.__eq_eq(false);
  50978. $ctx1.sendIdx["=="]=7;
  50979. $self._deny_($7);
  50980. $8=false.__eq_eq(false);
  50981. $ctx1.sendIdx["=="]=8;
  50982. $self._assert_($8);
  50983. $ctx1.sendIdx["assert:"]=2;
  50984. $10=true._yourself();
  50985. $ctx1.sendIdx["yourself"]=1;
  50986. $9=$recv($10).__eq_eq(true);
  50987. $ctx1.sendIdx["=="]=9;
  50988. $self._assert_($9);
  50989. $ctx1.sendIdx["assert:"]=3;
  50990. $12=true._yourself();
  50991. $ctx1.sendIdx["yourself"]=2;
  50992. $11=$recv($12).__eq_eq(true._yourself());
  50993. $self._assert_($11);
  50994. return self;
  50995. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  50996. },
  50997. args: [],
  50998. 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",
  50999. referencedClasses: [],
  51000. messageSends: ["deny:", "==", "assert:", "yourself"]
  51001. }),
  51002. $globals.BooleanTest);
  51003. $core.addMethod(
  51004. $core.method({
  51005. selector: "testIfTrueIfFalse",
  51006. protocol: "tests",
  51007. fn: function (){
  51008. var self=this,$self=this;
  51009. return $core.withContext(function($ctx1) {
  51010. var $1,$2,$3,$4,$5,$6,$7,$8;
  51011. if($core.assert(true)){
  51012. $1="alternative block";
  51013. }
  51014. $self._assert_equals_($1,"alternative block");
  51015. $ctx1.sendIdx["assert:equals:"]=1;
  51016. if(!$core.assert(true)){
  51017. $2="alternative block";
  51018. }
  51019. $self._assert_equals_($2,nil);
  51020. $ctx1.sendIdx["assert:equals:"]=2;
  51021. if($core.assert(false)){
  51022. $3="alternative block";
  51023. }
  51024. $self._assert_equals_($3,nil);
  51025. $ctx1.sendIdx["assert:equals:"]=3;
  51026. if(!$core.assert(false)){
  51027. $4="alternative block";
  51028. }
  51029. $self._assert_equals_($4,"alternative block");
  51030. $ctx1.sendIdx["assert:equals:"]=4;
  51031. if($core.assert(false)){
  51032. $5="alternative block";
  51033. } else {
  51034. $5="alternative block2";
  51035. }
  51036. $self._assert_equals_($5,"alternative block2");
  51037. $ctx1.sendIdx["assert:equals:"]=5;
  51038. if($core.assert(false)){
  51039. $6="alternative block2";
  51040. } else {
  51041. $6="alternative block";
  51042. }
  51043. $self._assert_equals_($6,"alternative block");
  51044. $ctx1.sendIdx["assert:equals:"]=6;
  51045. if($core.assert(true)){
  51046. $7="alternative block";
  51047. } else {
  51048. $7="alternative block2";
  51049. }
  51050. $self._assert_equals_($7,"alternative block");
  51051. $ctx1.sendIdx["assert:equals:"]=7;
  51052. if($core.assert(true)){
  51053. $8="alternative block2";
  51054. } else {
  51055. $8="alternative block";
  51056. }
  51057. $self._assert_equals_($8,"alternative block2");
  51058. return self;
  51059. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51060. },
  51061. args: [],
  51062. 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'.",
  51063. referencedClasses: [],
  51064. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51065. }),
  51066. $globals.BooleanTest);
  51067. $core.addMethod(
  51068. $core.method({
  51069. selector: "testIfTrueIfFalseWithBoxing",
  51070. protocol: "tests",
  51071. fn: function (){
  51072. var self=this,$self=this;
  51073. return $core.withContext(function($ctx1) {
  51074. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51075. $2=true._yourself();
  51076. $ctx1.sendIdx["yourself"]=1;
  51077. if($core.assert($2)){
  51078. $1="alternative block";
  51079. }
  51080. $self._assert_equals_($1,"alternative block");
  51081. $ctx1.sendIdx["assert:equals:"]=1;
  51082. $4=true._yourself();
  51083. $ctx1.sendIdx["yourself"]=2;
  51084. if(!$core.assert($4)){
  51085. $3="alternative block";
  51086. }
  51087. $self._assert_equals_($3,nil);
  51088. $ctx1.sendIdx["assert:equals:"]=2;
  51089. $6=false._yourself();
  51090. $ctx1.sendIdx["yourself"]=3;
  51091. if($core.assert($6)){
  51092. $5="alternative block";
  51093. }
  51094. $self._assert_equals_($5,nil);
  51095. $ctx1.sendIdx["assert:equals:"]=3;
  51096. $8=false._yourself();
  51097. $ctx1.sendIdx["yourself"]=4;
  51098. if(!$core.assert($8)){
  51099. $7="alternative block";
  51100. }
  51101. $self._assert_equals_($7,"alternative block");
  51102. $ctx1.sendIdx["assert:equals:"]=4;
  51103. $10=false._yourself();
  51104. $ctx1.sendIdx["yourself"]=5;
  51105. if($core.assert($10)){
  51106. $9="alternative block";
  51107. } else {
  51108. $9="alternative block2";
  51109. }
  51110. $self._assert_equals_($9,"alternative block2");
  51111. $ctx1.sendIdx["assert:equals:"]=5;
  51112. $12=false._yourself();
  51113. $ctx1.sendIdx["yourself"]=6;
  51114. if($core.assert($12)){
  51115. $11="alternative block2";
  51116. } else {
  51117. $11="alternative block";
  51118. }
  51119. $self._assert_equals_($11,"alternative block");
  51120. $ctx1.sendIdx["assert:equals:"]=6;
  51121. $14=true._yourself();
  51122. $ctx1.sendIdx["yourself"]=7;
  51123. if($core.assert($14)){
  51124. $13="alternative block";
  51125. } else {
  51126. $13="alternative block2";
  51127. }
  51128. $self._assert_equals_($13,"alternative block");
  51129. $ctx1.sendIdx["assert:equals:"]=7;
  51130. $16=true._yourself();
  51131. if($core.assert($16)){
  51132. $15="alternative block2";
  51133. } else {
  51134. $15="alternative block";
  51135. }
  51136. $self._assert_equals_($15,"alternative block2");
  51137. return self;
  51138. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51139. },
  51140. args: [],
  51141. 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'.",
  51142. referencedClasses: [],
  51143. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51144. }),
  51145. $globals.BooleanTest);
  51146. $core.addMethod(
  51147. $core.method({
  51148. selector: "testLogic",
  51149. protocol: "tests",
  51150. fn: function (){
  51151. var self=this,$self=this;
  51152. return $core.withContext(function($ctx1) {
  51153. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51154. $1=true.__and(true);
  51155. $ctx1.sendIdx["&"]=1;
  51156. $self._assert_($1);
  51157. $ctx1.sendIdx["assert:"]=1;
  51158. $2=true.__and(false);
  51159. $ctx1.sendIdx["&"]=2;
  51160. $self._deny_($2);
  51161. $ctx1.sendIdx["deny:"]=1;
  51162. $3=false.__and(true);
  51163. $ctx1.sendIdx["&"]=3;
  51164. $self._deny_($3);
  51165. $ctx1.sendIdx["deny:"]=2;
  51166. $5=false.__and(false);
  51167. $ctx1.sendIdx["&"]=4;
  51168. $4=$self._deny_($5);
  51169. $ctx1.sendIdx["deny:"]=3;
  51170. $6=true.__or(true);
  51171. $ctx1.sendIdx["|"]=1;
  51172. $self._assert_($6);
  51173. $ctx1.sendIdx["assert:"]=2;
  51174. $7=true.__or(false);
  51175. $ctx1.sendIdx["|"]=2;
  51176. $self._assert_($7);
  51177. $ctx1.sendIdx["assert:"]=3;
  51178. $8=false.__or(true);
  51179. $ctx1.sendIdx["|"]=3;
  51180. $self._assert_($8);
  51181. $ctx1.sendIdx["assert:"]=4;
  51182. $10=false.__or(false);
  51183. $ctx1.sendIdx["|"]=4;
  51184. $9=$self._deny_($10);
  51185. $ctx1.sendIdx["deny:"]=4;
  51186. $12=(1).__gt((0));
  51187. $ctx1.sendIdx[">"]=1;
  51188. $11=true.__and($12);
  51189. $ctx1.sendIdx["&"]=5;
  51190. $self._assert_($11);
  51191. $ctx1.sendIdx["assert:"]=5;
  51192. $14=(1).__gt((0));
  51193. $ctx1.sendIdx[">"]=2;
  51194. $13=$recv($14).__and(false);
  51195. $ctx1.sendIdx["&"]=6;
  51196. $self._deny_($13);
  51197. $ctx1.sendIdx["deny:"]=5;
  51198. $16=(1).__gt((0));
  51199. $ctx1.sendIdx[">"]=3;
  51200. $17=(1).__gt((2));
  51201. $ctx1.sendIdx[">"]=4;
  51202. $15=$recv($16).__and($17);
  51203. $self._deny_($15);
  51204. $19=(1).__gt((0));
  51205. $ctx1.sendIdx[">"]=5;
  51206. $18=false.__or($19);
  51207. $ctx1.sendIdx["|"]=5;
  51208. $self._assert_($18);
  51209. $ctx1.sendIdx["assert:"]=6;
  51210. $21=(1).__gt((0));
  51211. $ctx1.sendIdx[">"]=6;
  51212. $20=$recv($21).__or(false);
  51213. $ctx1.sendIdx["|"]=6;
  51214. $self._assert_($20);
  51215. $ctx1.sendIdx["assert:"]=7;
  51216. $23=(1).__gt((0));
  51217. $ctx1.sendIdx[">"]=7;
  51218. $22=$recv($23).__or((1).__gt((2)));
  51219. $self._assert_($22);
  51220. return self;
  51221. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51222. },
  51223. args: [],
  51224. 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))",
  51225. referencedClasses: [],
  51226. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51227. }),
  51228. $globals.BooleanTest);
  51229. $core.addMethod(
  51230. $core.method({
  51231. selector: "testLogicKeywords",
  51232. protocol: "tests",
  51233. fn: function (){
  51234. var self=this,$self=this;
  51235. return $core.withContext(function($ctx1) {
  51236. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51237. $1=true._and_((function(){
  51238. return true;
  51239. }));
  51240. $ctx1.sendIdx["and:"]=1;
  51241. $self._assert_($1);
  51242. $ctx1.sendIdx["assert:"]=1;
  51243. $2=true._and_((function(){
  51244. return false;
  51245. }));
  51246. $ctx1.sendIdx["and:"]=2;
  51247. $self._deny_($2);
  51248. $ctx1.sendIdx["deny:"]=1;
  51249. $3=false._and_((function(){
  51250. return true;
  51251. }));
  51252. $ctx1.sendIdx["and:"]=3;
  51253. $self._deny_($3);
  51254. $ctx1.sendIdx["deny:"]=2;
  51255. $5=false._and_((function(){
  51256. return false;
  51257. }));
  51258. $ctx1.sendIdx["and:"]=4;
  51259. $4=$self._deny_($5);
  51260. $ctx1.sendIdx["deny:"]=3;
  51261. $6=true._or_((function(){
  51262. return true;
  51263. }));
  51264. $ctx1.sendIdx["or:"]=1;
  51265. $self._assert_($6);
  51266. $ctx1.sendIdx["assert:"]=2;
  51267. $7=true._or_((function(){
  51268. return false;
  51269. }));
  51270. $ctx1.sendIdx["or:"]=2;
  51271. $self._assert_($7);
  51272. $ctx1.sendIdx["assert:"]=3;
  51273. $8=false._or_((function(){
  51274. return true;
  51275. }));
  51276. $ctx1.sendIdx["or:"]=3;
  51277. $self._assert_($8);
  51278. $ctx1.sendIdx["assert:"]=4;
  51279. $10=false._or_((function(){
  51280. return false;
  51281. }));
  51282. $ctx1.sendIdx["or:"]=4;
  51283. $9=$self._deny_($10);
  51284. $ctx1.sendIdx["deny:"]=4;
  51285. $11=true._and_((function(){
  51286. return $core.withContext(function($ctx2) {
  51287. return (1).__gt((0));
  51288. $ctx2.sendIdx[">"]=1;
  51289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51290. }));
  51291. $ctx1.sendIdx["and:"]=5;
  51292. $self._assert_($11);
  51293. $ctx1.sendIdx["assert:"]=5;
  51294. $13=(1).__gt((0));
  51295. $ctx1.sendIdx[">"]=2;
  51296. $12=$recv($13)._and_((function(){
  51297. return false;
  51298. }));
  51299. $ctx1.sendIdx["and:"]=6;
  51300. $self._deny_($12);
  51301. $ctx1.sendIdx["deny:"]=5;
  51302. $15=(1).__gt((0));
  51303. $ctx1.sendIdx[">"]=3;
  51304. $14=$recv($15)._and_((function(){
  51305. return $core.withContext(function($ctx2) {
  51306. return (1).__gt((2));
  51307. $ctx2.sendIdx[">"]=4;
  51308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51309. }));
  51310. $self._deny_($14);
  51311. $16=false._or_((function(){
  51312. return $core.withContext(function($ctx2) {
  51313. return (1).__gt((0));
  51314. $ctx2.sendIdx[">"]=5;
  51315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51316. }));
  51317. $ctx1.sendIdx["or:"]=5;
  51318. $self._assert_($16);
  51319. $ctx1.sendIdx["assert:"]=6;
  51320. $18=(1).__gt((0));
  51321. $ctx1.sendIdx[">"]=6;
  51322. $17=$recv($18)._or_((function(){
  51323. return false;
  51324. }));
  51325. $ctx1.sendIdx["or:"]=6;
  51326. $self._assert_($17);
  51327. $ctx1.sendIdx["assert:"]=7;
  51328. $20=(1).__gt((0));
  51329. $ctx1.sendIdx[">"]=7;
  51330. $19=$recv($20)._or_((function(){
  51331. return $core.withContext(function($ctx2) {
  51332. return (1).__gt((2));
  51333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51334. }));
  51335. $self._assert_($19);
  51336. return self;
  51337. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51338. },
  51339. args: [],
  51340. 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 ])",
  51341. referencedClasses: [],
  51342. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51343. }),
  51344. $globals.BooleanTest);
  51345. $core.addMethod(
  51346. $core.method({
  51347. selector: "testNonBooleanError",
  51348. protocol: "tests",
  51349. fn: function (){
  51350. var self=this,$self=this;
  51351. return $core.withContext(function($ctx1) {
  51352. $self._should_raise_((function(){
  51353. return $core.withContext(function($ctx2) {
  51354. if($core.assert("")){
  51355. } else {
  51356. }
  51357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51358. }),$globals.NonBooleanReceiver);
  51359. return self;
  51360. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51361. },
  51362. args: [],
  51363. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51364. referencedClasses: ["NonBooleanReceiver"],
  51365. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51366. }),
  51367. $globals.BooleanTest);
  51368. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51369. $core.addMethod(
  51370. $core.method({
  51371. selector: "setUp",
  51372. protocol: "running",
  51373. fn: function (){
  51374. var self=this,$self=this;
  51375. return $core.withContext(function($ctx1) {
  51376. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51377. return self;
  51378. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51379. },
  51380. args: [],
  51381. source: "setUp\x0a\x09builder := ClassBuilder new",
  51382. referencedClasses: ["ClassBuilder"],
  51383. messageSends: ["new"]
  51384. }),
  51385. $globals.ClassBuilderTest);
  51386. $core.addMethod(
  51387. $core.method({
  51388. selector: "tearDown",
  51389. protocol: "running",
  51390. fn: function (){
  51391. var self=this,$self=this;
  51392. return $core.withContext(function($ctx1) {
  51393. var $1,$receiver;
  51394. $1=$self["@theClass"];
  51395. if(($receiver = $1) == null || $receiver.a$nil){
  51396. $1;
  51397. } else {
  51398. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51399. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51400. $self["@theClass"]=nil;
  51401. $self["@theClass"];
  51402. }
  51403. return self;
  51404. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51405. },
  51406. args: [],
  51407. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51408. referencedClasses: ["Smalltalk"],
  51409. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51410. }),
  51411. $globals.ClassBuilderTest);
  51412. $core.addMethod(
  51413. $core.method({
  51414. selector: "testAddTrait",
  51415. protocol: "tests",
  51416. fn: function (){
  51417. var self=this,$self=this;
  51418. return $core.withContext(function($ctx1) {
  51419. var $3,$2,$1,$4;
  51420. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51421. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51422. $ctx1.sendIdx["assert:equals:"]=1;
  51423. $3=$recv($self["@theClass"])._package();
  51424. $ctx1.sendIdx["package"]=1;
  51425. $2=$recv($3)._classes();
  51426. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51427. $self._assert_equals_($1,(1));
  51428. $ctx1.sendIdx["assert:equals:"]=2;
  51429. $4=$recv($self["@theClass"])._package();
  51430. $ctx1.sendIdx["package"]=2;
  51431. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51432. return self;
  51433. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51434. },
  51435. args: [],
  51436. 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",
  51437. referencedClasses: ["ObjectMock"],
  51438. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51439. }),
  51440. $globals.ClassBuilderTest);
  51441. $core.addMethod(
  51442. $core.method({
  51443. selector: "testClassCopy",
  51444. protocol: "tests",
  51445. fn: function (){
  51446. var self=this,$self=this;
  51447. return $core.withContext(function($ctx1) {
  51448. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51449. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51450. $2=$recv($self["@theClass"])._superclass();
  51451. $ctx1.sendIdx["superclass"]=1;
  51452. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51453. $ctx1.sendIdx["=="]=1;
  51454. $self._assert_($1);
  51455. $ctx1.sendIdx["assert:"]=1;
  51456. $4=$recv($self["@theClass"])._instanceVariableNames();
  51457. $ctx1.sendIdx["instanceVariableNames"]=1;
  51458. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51459. $ctx1.sendIdx["=="]=2;
  51460. $self._assert_($3);
  51461. $ctx1.sendIdx["assert:"]=2;
  51462. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51463. $ctx1.sendIdx["assert:equals:"]=1;
  51464. $6=$recv($self["@theClass"])._package();
  51465. $ctx1.sendIdx["package"]=1;
  51466. $7=$recv($globals.ObjectMock)._package();
  51467. $ctx1.sendIdx["package"]=2;
  51468. $5=$recv($6).__eq_eq($7);
  51469. $self._assert_($5);
  51470. $ctx1.sendIdx["assert:"]=3;
  51471. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51472. $9=$recv($self["@theClass"])._methodDictionary();
  51473. $ctx1.sendIdx["methodDictionary"]=1;
  51474. $8=$recv($9)._keys();
  51475. $ctx1.sendIdx["keys"]=1;
  51476. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51477. return self;
  51478. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51479. },
  51480. args: [],
  51481. 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",
  51482. referencedClasses: ["ObjectMock"],
  51483. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51484. }),
  51485. $globals.ClassBuilderTest);
  51486. $core.addMethod(
  51487. $core.method({
  51488. selector: "testClassMigration",
  51489. protocol: "tests",
  51490. fn: function (){
  51491. var self=this,$self=this;
  51492. var instance,oldClass;
  51493. return $core.withContext(function($ctx1) {
  51494. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51495. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51496. $2=$recv($globals.Smalltalk)._globals();
  51497. $ctx1.sendIdx["globals"]=1;
  51498. $1=$recv($2)._at_("ObjectMock2");
  51499. $ctx1.sendIdx["at:"]=1;
  51500. instance=$recv($1)._new();
  51501. $4=$recv($globals.Smalltalk)._globals();
  51502. $ctx1.sendIdx["globals"]=2;
  51503. $3=$recv($4)._at_("ObjectMock2");
  51504. $ctx1.sendIdx["at:"]=2;
  51505. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51506. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51507. $ctx1.sendIdx["=="]=1;
  51508. $self._deny_($5);
  51509. $ctx1.sendIdx["deny:"]=1;
  51510. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51511. $ctx1.sendIdx["=="]=2;
  51512. $self._assert_($6);
  51513. $ctx1.sendIdx["assert:"]=1;
  51514. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51515. $ctx1.sendIdx["assert:"]=2;
  51516. $7=$recv($globals.ObjectMock2)._selectors();
  51517. $ctx1.sendIdx["selectors"]=1;
  51518. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51519. $ctx1.sendIdx["assert:equals:"]=1;
  51520. $8=$recv($globals.ObjectMock2)._comment();
  51521. $ctx1.sendIdx["comment"]=1;
  51522. $self._assert_equals_($8,$recv(oldClass)._comment());
  51523. $ctx1.sendIdx["assert:equals:"]=2;
  51524. $10=$recv($globals.ObjectMock2)._package();
  51525. $ctx1.sendIdx["package"]=1;
  51526. $9=$recv($10)._name();
  51527. $ctx1.sendIdx["name"]=1;
  51528. $self._assert_equals_($9,"Kernel-Tests");
  51529. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51530. $ctx1.sendIdx["assert:"]=3;
  51531. $12=$recv(instance)._class();
  51532. $ctx1.sendIdx["class"]=1;
  51533. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51534. $self._deny_($11);
  51535. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51536. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51537. return self;
  51538. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51539. },
  51540. args: [],
  51541. 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",
  51542. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51543. 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:"]
  51544. }),
  51545. $globals.ClassBuilderTest);
  51546. $core.addMethod(
  51547. $core.method({
  51548. selector: "testClassMigrationWithClassInstanceVariables",
  51549. protocol: "tests",
  51550. fn: function (){
  51551. var self=this,$self=this;
  51552. return $core.withContext(function($ctx1) {
  51553. var $1;
  51554. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51555. $1=$recv($globals.ObjectMock2)._class();
  51556. $ctx1.sendIdx["class"]=1;
  51557. $recv($1)._instanceVariableNames_("foo bar");
  51558. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51559. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51560. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51561. return self;
  51562. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51563. },
  51564. args: [],
  51565. 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",
  51566. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  51567. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  51568. }),
  51569. $globals.ClassBuilderTest);
  51570. $core.addMethod(
  51571. $core.method({
  51572. selector: "testClassMigrationWithSubclasses",
  51573. protocol: "tests",
  51574. fn: function (){
  51575. var self=this,$self=this;
  51576. return $core.withContext(function($ctx1) {
  51577. var $2,$1,$4,$3;
  51578. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51579. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  51580. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  51581. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  51582. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  51583. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51584. $2=$recv($globals.ObjectMock)._subclasses();
  51585. $ctx1.sendIdx["subclasses"]=1;
  51586. $1=$recv($2)._includes_($globals.ObjectMock2);
  51587. $ctx1.sendIdx["includes:"]=1;
  51588. $self._assert_($1);
  51589. $ctx1.sendIdx["assert:"]=1;
  51590. $4=$recv($globals.ObjectMock2)._subclasses();
  51591. $ctx1.sendIdx["subclasses"]=2;
  51592. $3=$recv($4)._includes_($globals.ObjectMock3);
  51593. $ctx1.sendIdx["includes:"]=2;
  51594. $self._assert_($3);
  51595. $ctx1.sendIdx["assert:"]=2;
  51596. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  51597. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  51598. return $core.withContext(function($ctx2) {
  51599. return $recv($globals.Smalltalk)._removeClass_(each);
  51600. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51601. }));
  51602. return self;
  51603. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  51604. },
  51605. args: [],
  51606. 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 ]",
  51607. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  51608. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  51609. }),
  51610. $globals.ClassBuilderTest);
  51611. $core.addMethod(
  51612. $core.method({
  51613. selector: "testInstanceVariableNames",
  51614. protocol: "tests",
  51615. fn: function (){
  51616. var self=this,$self=this;
  51617. return $core.withContext(function($ctx1) {
  51618. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  51619. return self;
  51620. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  51621. },
  51622. args: [],
  51623. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  51624. referencedClasses: [],
  51625. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  51626. }),
  51627. $globals.ClassBuilderTest);
  51628. $core.addMethod(
  51629. $core.method({
  51630. selector: "testSubclass",
  51631. protocol: "tests",
  51632. fn: function (){
  51633. var self=this,$self=this;
  51634. return $core.withContext(function($ctx1) {
  51635. var $3,$2,$1,$4;
  51636. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  51637. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  51638. $ctx1.sendIdx["assert:equals:"]=1;
  51639. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  51640. $ctx1.sendIdx["assert:equals:"]=2;
  51641. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51642. $ctx1.sendIdx["assert:equals:"]=3;
  51643. $3=$recv($self["@theClass"])._package();
  51644. $ctx1.sendIdx["package"]=1;
  51645. $2=$recv($3)._classes();
  51646. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51647. $self._assert_equals_($1,(1));
  51648. $ctx1.sendIdx["assert:equals:"]=4;
  51649. $4=$recv($self["@theClass"])._package();
  51650. $ctx1.sendIdx["package"]=2;
  51651. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51652. $ctx1.sendIdx["assert:equals:"]=5;
  51653. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  51654. return self;
  51655. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  51656. },
  51657. args: [],
  51658. 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",
  51659. referencedClasses: ["ObjectMock"],
  51660. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  51661. }),
  51662. $globals.ClassBuilderTest);
  51663. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51664. $core.addMethod(
  51665. $core.method({
  51666. selector: "jsConstructor",
  51667. protocol: "running",
  51668. fn: function (){
  51669. var self=this,$self=this;
  51670. return $core.withContext(function($ctx1) {
  51671. function Foo(){}
  51672. Foo.prototype.valueOf = function () {return 4;};
  51673. return Foo;
  51674. ;
  51675. return self;
  51676. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  51677. },
  51678. args: [],
  51679. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  51680. referencedClasses: [],
  51681. messageSends: []
  51682. }),
  51683. $globals.ClassTest);
  51684. $core.addMethod(
  51685. $core.method({
  51686. selector: "setUp",
  51687. protocol: "running",
  51688. fn: function (){
  51689. var self=this,$self=this;
  51690. return $core.withContext(function($ctx1) {
  51691. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51692. return self;
  51693. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  51694. },
  51695. args: [],
  51696. source: "setUp\x0a\x09builder := ClassBuilder new",
  51697. referencedClasses: ["ClassBuilder"],
  51698. messageSends: ["new"]
  51699. }),
  51700. $globals.ClassTest);
  51701. $core.addMethod(
  51702. $core.method({
  51703. selector: "tearDown",
  51704. protocol: "running",
  51705. fn: function (){
  51706. var self=this,$self=this;
  51707. return $core.withContext(function($ctx1) {
  51708. var $1,$receiver;
  51709. $1=$self["@theClass"];
  51710. if(($receiver = $1) == null || $receiver.a$nil){
  51711. $1;
  51712. } else {
  51713. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  51714. return $core.withContext(function($ctx2) {
  51715. return $recv($globals.Smalltalk)._removeClass_(each);
  51716. $ctx2.sendIdx["removeClass:"]=1;
  51717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51718. }));
  51719. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51720. $self["@theClass"]=nil;
  51721. $self["@theClass"];
  51722. }
  51723. return self;
  51724. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  51725. },
  51726. args: [],
  51727. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  51728. referencedClasses: ["Smalltalk"],
  51729. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  51730. }),
  51731. $globals.ClassTest);
  51732. $core.addMethod(
  51733. $core.method({
  51734. selector: "testAllSubclasses",
  51735. protocol: "tests",
  51736. fn: function (){
  51737. var self=this,$self=this;
  51738. var subclasses,index;
  51739. return $core.withContext(function($ctx1) {
  51740. subclasses=$recv($globals.Object)._subclasses();
  51741. $ctx1.sendIdx["subclasses"]=1;
  51742. index=(1);
  51743. $recv((function(){
  51744. return $core.withContext(function($ctx2) {
  51745. return $recv(index).__gt($recv(subclasses)._size());
  51746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51747. }))._whileFalse_((function(){
  51748. return $core.withContext(function($ctx2) {
  51749. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  51750. index=$recv(index).__plus((1));
  51751. return index;
  51752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51753. }));
  51754. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  51755. return self;
  51756. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  51757. },
  51758. args: [],
  51759. 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",
  51760. referencedClasses: ["Object"],
  51761. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  51762. }),
  51763. $globals.ClassTest);
  51764. $core.addMethod(
  51765. $core.method({
  51766. selector: "testMetaclassSubclasses",
  51767. protocol: "tests",
  51768. fn: function (){
  51769. var self=this,$self=this;
  51770. var subclasses;
  51771. return $core.withContext(function($ctx1) {
  51772. var $4,$3,$2,$1;
  51773. $4=$recv($globals.Object)._class();
  51774. $ctx1.sendIdx["class"]=1;
  51775. $3=$recv($4)._instanceClass();
  51776. $2=$recv($3)._subclasses();
  51777. $ctx1.sendIdx["subclasses"]=1;
  51778. $1=$recv($2)._select_((function(each){
  51779. return $core.withContext(function($ctx2) {
  51780. return $recv($recv(each)._isMetaclass())._not();
  51781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51782. }));
  51783. subclasses=$recv($1)._collect_((function(each){
  51784. return $core.withContext(function($ctx2) {
  51785. return $recv(each)._theMetaClass();
  51786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51787. }));
  51788. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  51789. return self;
  51790. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  51791. },
  51792. args: [],
  51793. 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",
  51794. referencedClasses: ["Object"],
  51795. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  51796. }),
  51797. $globals.ClassTest);
  51798. $core.addMethod(
  51799. $core.method({
  51800. selector: "testSetJavaScriptConstructor",
  51801. protocol: "tests",
  51802. fn: function (){
  51803. var self=this,$self=this;
  51804. var instance;
  51805. return $core.withContext(function($ctx1) {
  51806. var $2,$1,$4,$3,$6,$5,$8,$7;
  51807. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51808. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  51809. $2=$recv($self["@theClass"])._superclass();
  51810. $ctx1.sendIdx["superclass"]=1;
  51811. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51812. $ctx1.sendIdx["=="]=1;
  51813. $self._assert_($1);
  51814. $ctx1.sendIdx["assert:"]=1;
  51815. $4=$recv($self["@theClass"])._instanceVariableNames();
  51816. $ctx1.sendIdx["instanceVariableNames"]=1;
  51817. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51818. $ctx1.sendIdx["=="]=2;
  51819. $self._assert_($3);
  51820. $ctx1.sendIdx["assert:"]=2;
  51821. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51822. $ctx1.sendIdx["assert:equals:"]=1;
  51823. $6=$recv($self["@theClass"])._package();
  51824. $ctx1.sendIdx["package"]=1;
  51825. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  51826. $ctx1.sendIdx["=="]=3;
  51827. $self._assert_($5);
  51828. $ctx1.sendIdx["assert:"]=3;
  51829. $8=$recv($self["@theClass"])._methodDictionary();
  51830. $ctx1.sendIdx["methodDictionary"]=1;
  51831. $7=$recv($8)._keys();
  51832. $ctx1.sendIdx["keys"]=1;
  51833. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51834. $ctx1.sendIdx["assert:equals:"]=2;
  51835. instance=$recv($self["@theClass"])._new();
  51836. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  51837. $self._assert_equals_($recv(instance)._value(),(4));
  51838. $ctx1.sendIdx["assert:equals:"]=3;
  51839. $self._shouldnt_raise_((function(){
  51840. return $core.withContext(function($ctx2) {
  51841. return $recv(instance)._foo_((9));
  51842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51843. }),$globals.Error);
  51844. $self._assert_equals_($recv(instance)._foo(),(9));
  51845. return self;
  51846. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  51847. },
  51848. args: [],
  51849. 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",
  51850. referencedClasses: ["ObjectMock", "Error"],
  51851. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  51852. }),
  51853. $globals.ClassTest);
  51854. $core.addMethod(
  51855. $core.method({
  51856. selector: "testTrickySetJavaScriptConstructor",
  51857. protocol: "tests",
  51858. fn: function (){
  51859. var self=this,$self=this;
  51860. var instance;
  51861. return $core.withContext(function($ctx1) {
  51862. var $2,$1,$4,$3,$6,$5,$8,$7;
  51863. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51864. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  51865. $2=$recv($self["@theClass"])._superclass();
  51866. $ctx1.sendIdx["superclass"]=1;
  51867. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51868. $ctx1.sendIdx["=="]=1;
  51869. $self._assert_($1);
  51870. $ctx1.sendIdx["assert:"]=1;
  51871. $4=$recv($self["@theClass"])._instanceVariableNames();
  51872. $ctx1.sendIdx["instanceVariableNames"]=1;
  51873. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51874. $ctx1.sendIdx["=="]=2;
  51875. $self._assert_($3);
  51876. $ctx1.sendIdx["assert:"]=2;
  51877. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51878. $ctx1.sendIdx["assert:equals:"]=1;
  51879. $6=$recv($self["@theClass"])._package();
  51880. $ctx1.sendIdx["package"]=1;
  51881. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  51882. $ctx1.sendIdx["=="]=3;
  51883. $self._assert_($5);
  51884. $ctx1.sendIdx["assert:"]=3;
  51885. $8=$recv($self["@theClass"])._methodDictionary();
  51886. $ctx1.sendIdx["methodDictionary"]=1;
  51887. $7=$recv($8)._keys();
  51888. $ctx1.sendIdx["keys"]=1;
  51889. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51890. $ctx1.sendIdx["assert:equals:"]=2;
  51891. instance=$recv($self["@theClass"])._new();
  51892. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  51893. $self._assert_equals_($recv(instance)._value(),(4));
  51894. $ctx1.sendIdx["assert:equals:"]=3;
  51895. $self._shouldnt_raise_((function(){
  51896. return $core.withContext(function($ctx2) {
  51897. return $recv(instance)._foo_((9));
  51898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51899. }),$globals.Error);
  51900. $self._assert_equals_($recv(instance)._foo(),(9));
  51901. return self;
  51902. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  51903. },
  51904. args: [],
  51905. 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",
  51906. referencedClasses: ["ObjectMock", "Error"],
  51907. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  51908. }),
  51909. $globals.ClassTest);
  51910. $core.addMethod(
  51911. $core.method({
  51912. selector: "trickyJsConstructor",
  51913. protocol: "running",
  51914. fn: function (){
  51915. var self=this,$self=this;
  51916. return $core.withContext(function($ctx1) {
  51917. function Foo(){}
  51918. Foo.prototype.valueOf = function () {return 4;};
  51919. Foo.prototype._foo = function () {return "bar";};
  51920. return Foo;
  51921. ;
  51922. return self;
  51923. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  51924. },
  51925. args: [],
  51926. 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'>",
  51927. referencedClasses: [],
  51928. messageSends: []
  51929. }),
  51930. $globals.ClassTest);
  51931. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  51932. $core.addMethod(
  51933. $core.method({
  51934. selector: "assertSameContents:as:",
  51935. protocol: "convenience",
  51936. fn: function (aCollection,anotherCollection){
  51937. var self=this,$self=this;
  51938. return $core.withContext(function($ctx1) {
  51939. var $2,$1,$4,$3;
  51940. $2=$recv(aCollection)._size();
  51941. $ctx1.sendIdx["size"]=1;
  51942. $1=$recv($2).__eq($recv(anotherCollection)._size());
  51943. $ctx1.sendIdx["="]=1;
  51944. $self._assert_($1);
  51945. $ctx1.sendIdx["assert:"]=1;
  51946. $recv(aCollection)._do_((function(each){
  51947. return $core.withContext(function($ctx2) {
  51948. $4=$recv(aCollection)._occurrencesOf_(each);
  51949. $ctx2.sendIdx["occurrencesOf:"]=1;
  51950. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  51951. return $self._assert_($3);
  51952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51953. }));
  51954. return self;
  51955. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  51956. },
  51957. args: ["aCollection", "anotherCollection"],
  51958. 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)) ]",
  51959. referencedClasses: [],
  51960. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  51961. }),
  51962. $globals.CollectionTest);
  51963. $core.addMethod(
  51964. $core.method({
  51965. selector: "collection",
  51966. protocol: "fixture",
  51967. fn: function (){
  51968. var self=this,$self=this;
  51969. return $core.withContext(function($ctx1) {
  51970. $self._subclassResponsibility();
  51971. return self;
  51972. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  51973. },
  51974. args: [],
  51975. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  51976. referencedClasses: [],
  51977. messageSends: ["subclassResponsibility"]
  51978. }),
  51979. $globals.CollectionTest);
  51980. $core.addMethod(
  51981. $core.method({
  51982. selector: "collectionClass",
  51983. protocol: "fixture",
  51984. fn: function (){
  51985. var self=this,$self=this;
  51986. return $core.withContext(function($ctx1) {
  51987. return $recv($self._class())._collectionClass();
  51988. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  51989. },
  51990. args: [],
  51991. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  51992. referencedClasses: [],
  51993. messageSends: ["collectionClass", "class"]
  51994. }),
  51995. $globals.CollectionTest);
  51996. $core.addMethod(
  51997. $core.method({
  51998. selector: "collectionOfPrintStrings",
  51999. protocol: "fixture",
  52000. fn: function (){
  52001. var self=this,$self=this;
  52002. return $core.withContext(function($ctx1) {
  52003. $self._subclassResponsibility();
  52004. return self;
  52005. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52006. },
  52007. args: [],
  52008. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52009. referencedClasses: [],
  52010. messageSends: ["subclassResponsibility"]
  52011. }),
  52012. $globals.CollectionTest);
  52013. $core.addMethod(
  52014. $core.method({
  52015. selector: "collectionSize",
  52016. protocol: "fixture",
  52017. fn: function (){
  52018. var self=this,$self=this;
  52019. return $core.withContext(function($ctx1) {
  52020. $self._subclassResponsibility();
  52021. return self;
  52022. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52023. },
  52024. args: [],
  52025. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52026. referencedClasses: [],
  52027. messageSends: ["subclassResponsibility"]
  52028. }),
  52029. $globals.CollectionTest);
  52030. $core.addMethod(
  52031. $core.method({
  52032. selector: "collectionWithDuplicates",
  52033. protocol: "fixture",
  52034. fn: function (){
  52035. var self=this,$self=this;
  52036. return $core.withContext(function($ctx1) {
  52037. $self._subclassResponsibility();
  52038. return self;
  52039. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52040. },
  52041. args: [],
  52042. 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",
  52043. referencedClasses: [],
  52044. messageSends: ["subclassResponsibility"]
  52045. }),
  52046. $globals.CollectionTest);
  52047. $core.addMethod(
  52048. $core.method({
  52049. selector: "collectionWithNewValue",
  52050. protocol: "fixture",
  52051. fn: function (){
  52052. var self=this,$self=this;
  52053. return $core.withContext(function($ctx1) {
  52054. $self._subclassResponsibility();
  52055. return self;
  52056. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52057. },
  52058. args: [],
  52059. 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",
  52060. referencedClasses: [],
  52061. messageSends: ["subclassResponsibility"]
  52062. }),
  52063. $globals.CollectionTest);
  52064. $core.addMethod(
  52065. $core.method({
  52066. selector: "initialize",
  52067. protocol: "initialization",
  52068. fn: function (){
  52069. var self=this,$self=this;
  52070. return $core.withContext(function($ctx1) {
  52071. (
  52072. $ctx1.supercall = true,
  52073. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52074. $ctx1.supercall = false;
  52075. $self["@sampleBlock"]=(function(){
  52076. });
  52077. return self;
  52078. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52079. },
  52080. args: [],
  52081. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52082. referencedClasses: [],
  52083. messageSends: ["initialize"]
  52084. }),
  52085. $globals.CollectionTest);
  52086. $core.addMethod(
  52087. $core.method({
  52088. selector: "sampleNewValue",
  52089. protocol: "fixture",
  52090. fn: function (){
  52091. var self=this,$self=this;
  52092. return "N";
  52093. },
  52094. args: [],
  52095. 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'",
  52096. referencedClasses: [],
  52097. messageSends: []
  52098. }),
  52099. $globals.CollectionTest);
  52100. $core.addMethod(
  52101. $core.method({
  52102. selector: "sampleNewValueAsCollection",
  52103. protocol: "fixture",
  52104. fn: function (){
  52105. var self=this,$self=this;
  52106. return $core.withContext(function($ctx1) {
  52107. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52108. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52109. },
  52110. args: [],
  52111. 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",
  52112. referencedClasses: [],
  52113. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52114. }),
  52115. $globals.CollectionTest);
  52116. $core.addMethod(
  52117. $core.method({
  52118. selector: "testAddAll",
  52119. protocol: "tests",
  52120. fn: function (){
  52121. var self=this,$self=this;
  52122. return $core.withContext(function($ctx1) {
  52123. 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;
  52124. $2=$self._collection();
  52125. $ctx1.sendIdx["collection"]=1;
  52126. $4=$self._collectionClass();
  52127. $ctx1.sendIdx["collectionClass"]=1;
  52128. $3=$recv($4)._new();
  52129. $ctx1.sendIdx["new"]=1;
  52130. $recv($2)._addAll_($3);
  52131. $ctx1.sendIdx["addAll:"]=1;
  52132. $5=$recv($2)._yourself();
  52133. $ctx1.sendIdx["yourself"]=1;
  52134. $1=$5;
  52135. $6=$self._collection();
  52136. $ctx1.sendIdx["collection"]=2;
  52137. $self._assert_equals_($1,$6);
  52138. $ctx1.sendIdx["assert:equals:"]=1;
  52139. $9=$self._collectionClass();
  52140. $ctx1.sendIdx["collectionClass"]=2;
  52141. $8=$recv($9)._new();
  52142. $ctx1.sendIdx["new"]=2;
  52143. $10=$self._collection();
  52144. $ctx1.sendIdx["collection"]=3;
  52145. $recv($8)._addAll_($10);
  52146. $ctx1.sendIdx["addAll:"]=2;
  52147. $11=$recv($8)._yourself();
  52148. $ctx1.sendIdx["yourself"]=2;
  52149. $7=$11;
  52150. $12=$self._collection();
  52151. $ctx1.sendIdx["collection"]=4;
  52152. $self._assert_equals_($7,$12);
  52153. $ctx1.sendIdx["assert:equals:"]=2;
  52154. $15=$self._collectionClass();
  52155. $ctx1.sendIdx["collectionClass"]=3;
  52156. $14=$recv($15)._new();
  52157. $ctx1.sendIdx["new"]=3;
  52158. $17=$self._collectionClass();
  52159. $ctx1.sendIdx["collectionClass"]=4;
  52160. $16=$recv($17)._new();
  52161. $ctx1.sendIdx["new"]=4;
  52162. $recv($14)._addAll_($16);
  52163. $ctx1.sendIdx["addAll:"]=3;
  52164. $18=$recv($14)._yourself();
  52165. $ctx1.sendIdx["yourself"]=3;
  52166. $13=$18;
  52167. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52168. $ctx1.sendIdx["assert:equals:"]=3;
  52169. $20=$self._collection();
  52170. $ctx1.sendIdx["collection"]=5;
  52171. $21=$self._sampleNewValueAsCollection();
  52172. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52173. $recv($20)._addAll_($21);
  52174. $ctx1.sendIdx["addAll:"]=4;
  52175. $22=$recv($20)._yourself();
  52176. $ctx1.sendIdx["yourself"]=4;
  52177. $19=$22;
  52178. $23=$self._collectionWithNewValue();
  52179. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52180. $self._assert_equals_($19,$23);
  52181. $25=$self._sampleNewValueAsCollection();
  52182. $recv($25)._addAll_($self._collection());
  52183. $24=$recv($25)._yourself();
  52184. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52185. return self;
  52186. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52187. },
  52188. args: [],
  52189. 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",
  52190. referencedClasses: [],
  52191. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52192. }),
  52193. $globals.CollectionTest);
  52194. $core.addMethod(
  52195. $core.method({
  52196. selector: "testAllSatisfy",
  52197. protocol: "tests",
  52198. fn: function (){
  52199. var self=this,$self=this;
  52200. var collection,anyOne;
  52201. return $core.withContext(function($ctx1) {
  52202. var $1;
  52203. collection=$self._collection();
  52204. anyOne=$recv(collection)._anyOne();
  52205. $1=$recv(collection)._allSatisfy_((function(each){
  52206. return $core.withContext(function($ctx2) {
  52207. return $recv(collection)._includes_(each);
  52208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52209. }));
  52210. $ctx1.sendIdx["allSatisfy:"]=1;
  52211. $self._assert_($1);
  52212. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52213. return $core.withContext(function($ctx2) {
  52214. return $recv(each).__tild_eq(anyOne);
  52215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52216. })));
  52217. return self;
  52218. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52219. },
  52220. args: [],
  52221. 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 ])",
  52222. referencedClasses: [],
  52223. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52224. }),
  52225. $globals.CollectionTest);
  52226. $core.addMethod(
  52227. $core.method({
  52228. selector: "testAnyOne",
  52229. protocol: "tests",
  52230. fn: function (){
  52231. var self=this,$self=this;
  52232. return $core.withContext(function($ctx1) {
  52233. var $2,$1;
  52234. $self._should_raise_((function(){
  52235. return $core.withContext(function($ctx2) {
  52236. return $recv($recv($self._collectionClass())._new())._anyOne();
  52237. $ctx2.sendIdx["anyOne"]=1;
  52238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52239. }),$globals.Error);
  52240. $2=$self._collection();
  52241. $ctx1.sendIdx["collection"]=1;
  52242. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52243. $self._assert_($1);
  52244. return self;
  52245. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52246. },
  52247. args: [],
  52248. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52249. referencedClasses: ["Error"],
  52250. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52251. }),
  52252. $globals.CollectionTest);
  52253. $core.addMethod(
  52254. $core.method({
  52255. selector: "testAnySatisfy",
  52256. protocol: "tests",
  52257. fn: function (){
  52258. var self=this,$self=this;
  52259. var anyOne;
  52260. return $core.withContext(function($ctx1) {
  52261. var $1,$3,$2;
  52262. $1=$self._collection();
  52263. $ctx1.sendIdx["collection"]=1;
  52264. anyOne=$recv($1)._anyOne();
  52265. $3=$self._collection();
  52266. $ctx1.sendIdx["collection"]=2;
  52267. $2=$recv($3)._anySatisfy_((function(each){
  52268. return $core.withContext(function($ctx2) {
  52269. return $recv(each).__eq(anyOne);
  52270. $ctx2.sendIdx["="]=1;
  52271. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52272. }));
  52273. $ctx1.sendIdx["anySatisfy:"]=1;
  52274. $self._assert_($2);
  52275. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52276. return $core.withContext(function($ctx2) {
  52277. return $recv(each).__eq($recv($globals.Object)._new());
  52278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52279. })));
  52280. return self;
  52281. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52282. },
  52283. args: [],
  52284. 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 ])",
  52285. referencedClasses: ["Object"],
  52286. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52287. }),
  52288. $globals.CollectionTest);
  52289. $core.addMethod(
  52290. $core.method({
  52291. selector: "testAsArray",
  52292. protocol: "tests",
  52293. fn: function (){
  52294. var self=this,$self=this;
  52295. return $core.withContext(function($ctx1) {
  52296. var $1;
  52297. $1=$self._collection();
  52298. $ctx1.sendIdx["collection"]=1;
  52299. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52300. return self;
  52301. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52302. },
  52303. args: [],
  52304. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52305. referencedClasses: [],
  52306. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52307. }),
  52308. $globals.CollectionTest);
  52309. $core.addMethod(
  52310. $core.method({
  52311. selector: "testAsOrderedCollection",
  52312. protocol: "tests",
  52313. fn: function (){
  52314. var self=this,$self=this;
  52315. return $core.withContext(function($ctx1) {
  52316. var $1;
  52317. $1=$self._collection();
  52318. $ctx1.sendIdx["collection"]=1;
  52319. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52320. return self;
  52321. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52322. },
  52323. args: [],
  52324. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52325. referencedClasses: [],
  52326. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52327. }),
  52328. $globals.CollectionTest);
  52329. $core.addMethod(
  52330. $core.method({
  52331. selector: "testAsSet",
  52332. protocol: "tests",
  52333. fn: function (){
  52334. var self=this,$self=this;
  52335. var c,set;
  52336. return $core.withContext(function($ctx1) {
  52337. c=$self._collectionWithDuplicates();
  52338. set=$recv(c)._asSet();
  52339. $self._assert_equals_($recv(set)._size(),(6));
  52340. $recv(c)._do_((function(each){
  52341. return $core.withContext(function($ctx2) {
  52342. return $self._assert_($recv(set)._includes_(each));
  52343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52344. }));
  52345. return self;
  52346. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52347. },
  52348. args: [],
  52349. 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) ]",
  52350. referencedClasses: [],
  52351. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52352. }),
  52353. $globals.CollectionTest);
  52354. $core.addMethod(
  52355. $core.method({
  52356. selector: "testCollect",
  52357. protocol: "tests",
  52358. fn: function (){
  52359. var self=this,$self=this;
  52360. return $core.withContext(function($ctx1) {
  52361. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52362. $2=$self._collection();
  52363. $ctx1.sendIdx["collection"]=1;
  52364. $1=$recv($2)._collect_((function(each){
  52365. return each;
  52366. }));
  52367. $ctx1.sendIdx["collect:"]=1;
  52368. $3=$self._collection();
  52369. $ctx1.sendIdx["collection"]=2;
  52370. $self._assert_equals_($1,$3);
  52371. $ctx1.sendIdx["assert:equals:"]=1;
  52372. $5=$self._collectionWithNewValue();
  52373. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52374. $4=$recv($5)._collect_((function(each){
  52375. return each;
  52376. }));
  52377. $ctx1.sendIdx["collect:"]=2;
  52378. $self._assert_equals_($4,$self._collectionWithNewValue());
  52379. $ctx1.sendIdx["assert:equals:"]=2;
  52380. $8=$self._collectionClass();
  52381. $ctx1.sendIdx["collectionClass"]=1;
  52382. $7=$recv($8)._new();
  52383. $ctx1.sendIdx["new"]=1;
  52384. $6=$recv($7)._collect_((function(each){
  52385. return $core.withContext(function($ctx2) {
  52386. return $recv(each)._printString();
  52387. $ctx2.sendIdx["printString"]=1;
  52388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52389. }));
  52390. $ctx1.sendIdx["collect:"]=3;
  52391. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52392. $ctx1.sendIdx["assert:equals:"]=3;
  52393. $11=$self._collection();
  52394. $ctx1.sendIdx["collection"]=3;
  52395. $10=$recv($11)._collect_((function(){
  52396. return $core.withContext(function($ctx2) {
  52397. return $self._sampleNewValue();
  52398. $ctx2.sendIdx["sampleNewValue"]=1;
  52399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52400. }));
  52401. $ctx1.sendIdx["collect:"]=4;
  52402. $9=$recv($10)._detect_((function(){
  52403. return true;
  52404. }));
  52405. $self._assert_equals_($9,$self._sampleNewValue());
  52406. $ctx1.sendIdx["assert:equals:"]=4;
  52407. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52408. return $core.withContext(function($ctx2) {
  52409. return $recv(each)._printString();
  52410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52411. })),$self._collectionOfPrintStrings());
  52412. return self;
  52413. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52414. },
  52415. args: [],
  52416. 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",
  52417. referencedClasses: [],
  52418. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52419. }),
  52420. $globals.CollectionTest);
  52421. $core.addMethod(
  52422. $core.method({
  52423. selector: "testComma",
  52424. protocol: "tests",
  52425. fn: function (){
  52426. var self=this,$self=this;
  52427. return $core.withContext(function($ctx1) {
  52428. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52429. $2=$self._collection();
  52430. $ctx1.sendIdx["collection"]=1;
  52431. $4=$self._collectionClass();
  52432. $ctx1.sendIdx["collectionClass"]=1;
  52433. $3=$recv($4)._new();
  52434. $ctx1.sendIdx["new"]=1;
  52435. $1=$recv($2).__comma($3);
  52436. $ctx1.sendIdx[","]=1;
  52437. $5=$self._collection();
  52438. $ctx1.sendIdx["collection"]=2;
  52439. $self._assert_equals_($1,$5);
  52440. $ctx1.sendIdx["assert:equals:"]=1;
  52441. $8=$self._collectionClass();
  52442. $ctx1.sendIdx["collectionClass"]=2;
  52443. $7=$recv($8)._new();
  52444. $ctx1.sendIdx["new"]=2;
  52445. $9=$self._collection();
  52446. $ctx1.sendIdx["collection"]=3;
  52447. $6=$recv($7).__comma($9);
  52448. $ctx1.sendIdx[","]=2;
  52449. $10=$self._collection();
  52450. $ctx1.sendIdx["collection"]=4;
  52451. $self._assert_equals_($6,$10);
  52452. $ctx1.sendIdx["assert:equals:"]=2;
  52453. $13=$self._collectionClass();
  52454. $ctx1.sendIdx["collectionClass"]=3;
  52455. $12=$recv($13)._new();
  52456. $ctx1.sendIdx["new"]=3;
  52457. $15=$self._collectionClass();
  52458. $ctx1.sendIdx["collectionClass"]=4;
  52459. $14=$recv($15)._new();
  52460. $ctx1.sendIdx["new"]=4;
  52461. $11=$recv($12).__comma($14);
  52462. $ctx1.sendIdx[","]=3;
  52463. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52464. $ctx1.sendIdx["assert:equals:"]=3;
  52465. $17=$self._collection();
  52466. $ctx1.sendIdx["collection"]=5;
  52467. $18=$self._sampleNewValueAsCollection();
  52468. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52469. $16=$recv($17).__comma($18);
  52470. $ctx1.sendIdx[","]=4;
  52471. $19=$self._collectionWithNewValue();
  52472. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52473. $self._assert_equals_($16,$19);
  52474. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52475. return self;
  52476. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52477. },
  52478. args: [],
  52479. 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",
  52480. referencedClasses: [],
  52481. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52482. }),
  52483. $globals.CollectionTest);
  52484. $core.addMethod(
  52485. $core.method({
  52486. selector: "testCopy",
  52487. protocol: "tests",
  52488. fn: function (){
  52489. var self=this,$self=this;
  52490. return $core.withContext(function($ctx1) {
  52491. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52492. $3=$self._collectionClass();
  52493. $ctx1.sendIdx["collectionClass"]=1;
  52494. $2=$recv($3)._new();
  52495. $ctx1.sendIdx["new"]=1;
  52496. $1=$recv($2)._copy();
  52497. $ctx1.sendIdx["copy"]=1;
  52498. $5=$self._collectionClass();
  52499. $ctx1.sendIdx["collectionClass"]=2;
  52500. $4=$recv($5)._new();
  52501. $ctx1.sendIdx["new"]=2;
  52502. $self._assert_equals_($1,$4);
  52503. $ctx1.sendIdx["assert:equals:"]=1;
  52504. $7=$self._collection();
  52505. $ctx1.sendIdx["collection"]=1;
  52506. $6=$recv($7)._copy();
  52507. $ctx1.sendIdx["copy"]=2;
  52508. $8=$self._collection();
  52509. $ctx1.sendIdx["collection"]=2;
  52510. $self._assert_equals_($6,$8);
  52511. $ctx1.sendIdx["assert:equals:"]=2;
  52512. $10=$self._collectionWithNewValue();
  52513. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52514. $9=$recv($10)._copy();
  52515. $ctx1.sendIdx["copy"]=3;
  52516. $11=$self._collectionWithNewValue();
  52517. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52518. $self._assert_equals_($9,$11);
  52519. $15=$self._collectionClass();
  52520. $ctx1.sendIdx["collectionClass"]=3;
  52521. $14=$recv($15)._new();
  52522. $ctx1.sendIdx["new"]=3;
  52523. $13=$recv($14)._copy();
  52524. $ctx1.sendIdx["copy"]=4;
  52525. $16=$self._collection();
  52526. $ctx1.sendIdx["collection"]=3;
  52527. $12=$recv($13).__eq($16);
  52528. $ctx1.sendIdx["="]=1;
  52529. $self._deny_($12);
  52530. $ctx1.sendIdx["deny:"]=1;
  52531. $19=$self._collection();
  52532. $ctx1.sendIdx["collection"]=4;
  52533. $18=$recv($19)._copy();
  52534. $ctx1.sendIdx["copy"]=5;
  52535. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52536. $ctx1.sendIdx["="]=2;
  52537. $self._deny_($17);
  52538. $ctx1.sendIdx["deny:"]=2;
  52539. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52540. return self;
  52541. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52542. },
  52543. args: [],
  52544. 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",
  52545. referencedClasses: [],
  52546. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52547. }),
  52548. $globals.CollectionTest);
  52549. $core.addMethod(
  52550. $core.method({
  52551. selector: "testCopySeparates",
  52552. protocol: "tests",
  52553. fn: function (){
  52554. var self=this,$self=this;
  52555. var original,copy;
  52556. return $core.withContext(function($ctx1) {
  52557. original=$self._collection();
  52558. $ctx1.sendIdx["collection"]=1;
  52559. copy=$recv(original)._copy();
  52560. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52561. $self._assert_($recv(original).__eq($self._collection()));
  52562. return self;
  52563. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52564. },
  52565. args: [],
  52566. 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",
  52567. referencedClasses: [],
  52568. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52569. }),
  52570. $globals.CollectionTest);
  52571. $core.addMethod(
  52572. $core.method({
  52573. selector: "testDetect",
  52574. protocol: "tests",
  52575. fn: function (){
  52576. var self=this,$self=this;
  52577. return $core.withContext(function($ctx1) {
  52578. var $1,$2,$3,$4,$6,$5,$7;
  52579. $self._shouldnt_raise_((function(){
  52580. return $core.withContext(function($ctx2) {
  52581. $1=$self._collection();
  52582. $ctx2.sendIdx["collection"]=1;
  52583. return $recv($1)._detect_((function(){
  52584. return true;
  52585. }));
  52586. $ctx2.sendIdx["detect:"]=1;
  52587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52588. }),$globals.Error);
  52589. $self._should_raise_((function(){
  52590. return $core.withContext(function($ctx2) {
  52591. $2=$self._collection();
  52592. $ctx2.sendIdx["collection"]=2;
  52593. return $recv($2)._detect_((function(){
  52594. return false;
  52595. }));
  52596. $ctx2.sendIdx["detect:"]=2;
  52597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52598. }),$globals.Error);
  52599. $ctx1.sendIdx["should:raise:"]=1;
  52600. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  52601. return true;
  52602. }));
  52603. $ctx1.sendIdx["detect:"]=3;
  52604. $4=$self._sampleNewValue();
  52605. $ctx1.sendIdx["sampleNewValue"]=1;
  52606. $self._assert_equals_($3,$4);
  52607. $ctx1.sendIdx["assert:equals:"]=1;
  52608. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  52609. return $core.withContext(function($ctx2) {
  52610. $6=$self._sampleNewValue();
  52611. $ctx2.sendIdx["sampleNewValue"]=2;
  52612. return $recv(each).__eq($6);
  52613. $ctx2.sendIdx["="]=1;
  52614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52615. }));
  52616. $ctx1.sendIdx["detect:"]=4;
  52617. $7=$self._sampleNewValue();
  52618. $ctx1.sendIdx["sampleNewValue"]=3;
  52619. $self._assert_equals_($5,$7);
  52620. $self._should_raise_((function(){
  52621. return $core.withContext(function($ctx2) {
  52622. return $recv($self._collection())._detect_((function(each){
  52623. return $core.withContext(function($ctx3) {
  52624. return $recv(each).__eq($self._sampleNewValue());
  52625. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  52626. }));
  52627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  52628. }),$globals.Error);
  52629. return self;
  52630. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  52631. },
  52632. args: [],
  52633. 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",
  52634. referencedClasses: ["Error"],
  52635. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52636. }),
  52637. $globals.CollectionTest);
  52638. $core.addMethod(
  52639. $core.method({
  52640. selector: "testDetectIfNone",
  52641. protocol: "tests",
  52642. fn: function (){
  52643. var self=this,$self=this;
  52644. var sentinel;
  52645. return $core.withContext(function($ctx1) {
  52646. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  52647. sentinel=$recv($globals.Object)._new();
  52648. $3=$self._collection();
  52649. $ctx1.sendIdx["collection"]=1;
  52650. $2=$recv($3)._detect_ifNone_((function(){
  52651. return true;
  52652. }),(function(){
  52653. return sentinel;
  52654. }));
  52655. $ctx1.sendIdx["detect:ifNone:"]=1;
  52656. $1=$recv($2).__tild_eq(sentinel);
  52657. $self._assert_($1);
  52658. $5=$self._collection();
  52659. $ctx1.sendIdx["collection"]=2;
  52660. $4=$recv($5)._detect_ifNone_((function(){
  52661. return false;
  52662. }),(function(){
  52663. return sentinel;
  52664. }));
  52665. $ctx1.sendIdx["detect:ifNone:"]=2;
  52666. $self._assert_equals_($4,sentinel);
  52667. $ctx1.sendIdx["assert:equals:"]=1;
  52668. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  52669. return true;
  52670. }),(function(){
  52671. return sentinel;
  52672. }));
  52673. $ctx1.sendIdx["detect:ifNone:"]=3;
  52674. $7=$self._sampleNewValue();
  52675. $ctx1.sendIdx["sampleNewValue"]=1;
  52676. $self._assert_equals_($6,$7);
  52677. $ctx1.sendIdx["assert:equals:"]=2;
  52678. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  52679. return $core.withContext(function($ctx2) {
  52680. $9=$self._sampleNewValue();
  52681. $ctx2.sendIdx["sampleNewValue"]=2;
  52682. return $recv(each).__eq($9);
  52683. $ctx2.sendIdx["="]=1;
  52684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  52685. }),(function(){
  52686. return sentinel;
  52687. }));
  52688. $ctx1.sendIdx["detect:ifNone:"]=4;
  52689. $10=$self._sampleNewValue();
  52690. $ctx1.sendIdx["sampleNewValue"]=3;
  52691. $self._assert_equals_($8,$10);
  52692. $ctx1.sendIdx["assert:equals:"]=3;
  52693. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  52694. return $core.withContext(function($ctx2) {
  52695. return $recv(each).__eq($self._sampleNewValue());
  52696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  52697. }),(function(){
  52698. return sentinel;
  52699. })),sentinel);
  52700. return self;
  52701. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  52702. },
  52703. args: [],
  52704. 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",
  52705. referencedClasses: ["Object"],
  52706. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52707. }),
  52708. $globals.CollectionTest);
  52709. $core.addMethod(
  52710. $core.method({
  52711. selector: "testDo",
  52712. protocol: "tests",
  52713. fn: function (){
  52714. var self=this,$self=this;
  52715. var newCollection;
  52716. return $core.withContext(function($ctx1) {
  52717. var $1,$2;
  52718. newCollection=$recv($globals.OrderedCollection)._new();
  52719. $ctx1.sendIdx["new"]=1;
  52720. $1=$self._collection();
  52721. $ctx1.sendIdx["collection"]=1;
  52722. $recv($1)._do_((function(each){
  52723. return $core.withContext(function($ctx2) {
  52724. return $recv(newCollection)._add_(each);
  52725. $ctx2.sendIdx["add:"]=1;
  52726. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52727. }));
  52728. $ctx1.sendIdx["do:"]=1;
  52729. $self._assertSameContents_as_($self._collection(),newCollection);
  52730. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52731. newCollection=$recv($globals.OrderedCollection)._new();
  52732. $2=$self._collectionWithDuplicates();
  52733. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  52734. $recv($2)._do_((function(each){
  52735. return $core.withContext(function($ctx2) {
  52736. return $recv(newCollection)._add_(each);
  52737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52738. }));
  52739. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  52740. return self;
  52741. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  52742. },
  52743. args: [],
  52744. 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",
  52745. referencedClasses: ["OrderedCollection"],
  52746. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  52747. }),
  52748. $globals.CollectionTest);
  52749. $core.addMethod(
  52750. $core.method({
  52751. selector: "testEquality",
  52752. protocol: "tests",
  52753. fn: function (){
  52754. var self=this,$self=this;
  52755. return $core.withContext(function($ctx1) {
  52756. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  52757. $2=$self._collectionClass();
  52758. $ctx1.sendIdx["collectionClass"]=1;
  52759. $1=$recv($2)._new();
  52760. $ctx1.sendIdx["new"]=1;
  52761. $4=$self._collectionClass();
  52762. $ctx1.sendIdx["collectionClass"]=2;
  52763. $3=$recv($4)._new();
  52764. $ctx1.sendIdx["new"]=2;
  52765. $self._assert_equals_($1,$3);
  52766. $ctx1.sendIdx["assert:equals:"]=1;
  52767. $5=$self._collection();
  52768. $ctx1.sendIdx["collection"]=1;
  52769. $6=$self._collection();
  52770. $ctx1.sendIdx["collection"]=2;
  52771. $self._assert_equals_($5,$6);
  52772. $ctx1.sendIdx["assert:equals:"]=2;
  52773. $7=$self._collectionWithNewValue();
  52774. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52775. $8=$self._collectionWithNewValue();
  52776. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52777. $self._assert_equals_($7,$8);
  52778. $11=$self._collectionClass();
  52779. $ctx1.sendIdx["collectionClass"]=3;
  52780. $10=$recv($11)._new();
  52781. $ctx1.sendIdx["new"]=3;
  52782. $12=$self._collection();
  52783. $ctx1.sendIdx["collection"]=3;
  52784. $9=$recv($10).__eq($12);
  52785. $ctx1.sendIdx["="]=1;
  52786. $self._deny_($9);
  52787. $ctx1.sendIdx["deny:"]=1;
  52788. $14=$self._collection();
  52789. $ctx1.sendIdx["collection"]=4;
  52790. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  52791. $ctx1.sendIdx["="]=2;
  52792. $self._deny_($13);
  52793. $ctx1.sendIdx["deny:"]=2;
  52794. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  52795. return self;
  52796. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  52797. },
  52798. args: [],
  52799. 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",
  52800. referencedClasses: [],
  52801. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52802. }),
  52803. $globals.CollectionTest);
  52804. $core.addMethod(
  52805. $core.method({
  52806. selector: "testIfEmptyFamily",
  52807. protocol: "tests",
  52808. fn: function (){
  52809. var self=this,$self=this;
  52810. return $core.withContext(function($ctx1) {
  52811. 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;
  52812. $3=$self._collectionClass();
  52813. $ctx1.sendIdx["collectionClass"]=1;
  52814. $2=$recv($3)._new();
  52815. $ctx1.sendIdx["new"]=1;
  52816. $1=$recv($2)._ifEmpty_((function(){
  52817. return (42);
  52818. }));
  52819. $ctx1.sendIdx["ifEmpty:"]=1;
  52820. $self._assert_equals_($1,(42));
  52821. $ctx1.sendIdx["assert:equals:"]=1;
  52822. $5=$self._collection();
  52823. $ctx1.sendIdx["collection"]=1;
  52824. $4=$recv($5)._ifEmpty_((function(){
  52825. return (42);
  52826. }));
  52827. $6=$self._collection();
  52828. $ctx1.sendIdx["collection"]=2;
  52829. $self._assert_equals_($4,$6);
  52830. $ctx1.sendIdx["assert:equals:"]=2;
  52831. $9=$self._collectionClass();
  52832. $ctx1.sendIdx["collectionClass"]=2;
  52833. $8=$recv($9)._new();
  52834. $ctx1.sendIdx["new"]=2;
  52835. $7=$recv($8)._ifNotEmpty_((function(){
  52836. return (42);
  52837. }));
  52838. $ctx1.sendIdx["ifNotEmpty:"]=1;
  52839. $11=$self._collectionClass();
  52840. $ctx1.sendIdx["collectionClass"]=3;
  52841. $10=$recv($11)._new();
  52842. $ctx1.sendIdx["new"]=3;
  52843. $self._assert_equals_($7,$10);
  52844. $ctx1.sendIdx["assert:equals:"]=3;
  52845. $13=$self._collection();
  52846. $ctx1.sendIdx["collection"]=3;
  52847. $12=$recv($13)._ifNotEmpty_((function(){
  52848. return (42);
  52849. }));
  52850. $ctx1.sendIdx["ifNotEmpty:"]=2;
  52851. $self._assert_equals_($12,(42));
  52852. $ctx1.sendIdx["assert:equals:"]=4;
  52853. $15=$self._collection();
  52854. $ctx1.sendIdx["collection"]=4;
  52855. $14=$recv($15)._ifNotEmpty_((function(col){
  52856. return col;
  52857. }));
  52858. $16=$self._collection();
  52859. $ctx1.sendIdx["collection"]=5;
  52860. $self._assert_equals_($14,$16);
  52861. $ctx1.sendIdx["assert:equals:"]=5;
  52862. $19=$self._collectionClass();
  52863. $ctx1.sendIdx["collectionClass"]=4;
  52864. $18=$recv($19)._new();
  52865. $ctx1.sendIdx["new"]=4;
  52866. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  52867. return (42);
  52868. }),(function(){
  52869. return (999);
  52870. }));
  52871. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  52872. $self._assert_equals_($17,(42));
  52873. $ctx1.sendIdx["assert:equals:"]=6;
  52874. $21=$self._collection();
  52875. $ctx1.sendIdx["collection"]=6;
  52876. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  52877. return (42);
  52878. }),(function(){
  52879. return (999);
  52880. }));
  52881. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  52882. $self._assert_equals_($20,(999));
  52883. $ctx1.sendIdx["assert:equals:"]=7;
  52884. $23=$self._collection();
  52885. $ctx1.sendIdx["collection"]=7;
  52886. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  52887. return (42);
  52888. }),(function(col){
  52889. return col;
  52890. }));
  52891. $24=$self._collection();
  52892. $ctx1.sendIdx["collection"]=8;
  52893. $self._assert_equals_($22,$24);
  52894. $ctx1.sendIdx["assert:equals:"]=8;
  52895. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  52896. return (42);
  52897. }),(function(){
  52898. return (999);
  52899. }));
  52900. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  52901. $self._assert_equals_($25,(999));
  52902. $ctx1.sendIdx["assert:equals:"]=9;
  52903. $27=$self._collection();
  52904. $ctx1.sendIdx["collection"]=9;
  52905. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  52906. return (42);
  52907. }),(function(){
  52908. return (999);
  52909. }));
  52910. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  52911. $self._assert_equals_($26,(42));
  52912. $ctx1.sendIdx["assert:equals:"]=10;
  52913. $29=$self._collection();
  52914. $ctx1.sendIdx["collection"]=10;
  52915. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  52916. return col;
  52917. }),(function(){
  52918. return (999);
  52919. }));
  52920. $self._assert_equals_($28,$self._collection());
  52921. return self;
  52922. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  52923. },
  52924. args: [],
  52925. 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.",
  52926. referencedClasses: [],
  52927. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  52928. }),
  52929. $globals.CollectionTest);
  52930. $core.addMethod(
  52931. $core.method({
  52932. selector: "testIsEmpty",
  52933. protocol: "tests",
  52934. fn: function (){
  52935. var self=this,$self=this;
  52936. return $core.withContext(function($ctx1) {
  52937. var $1;
  52938. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  52939. $ctx1.sendIdx["isEmpty"]=1;
  52940. $self._assert_($1);
  52941. $self._deny_($recv($self._collection())._isEmpty());
  52942. return self;
  52943. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  52944. },
  52945. args: [],
  52946. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  52947. referencedClasses: [],
  52948. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  52949. }),
  52950. $globals.CollectionTest);
  52951. $core.addMethod(
  52952. $core.method({
  52953. selector: "testNoneSatisfy",
  52954. protocol: "tests",
  52955. fn: function (){
  52956. var self=this,$self=this;
  52957. var anyOne;
  52958. return $core.withContext(function($ctx1) {
  52959. var $1,$3,$2;
  52960. $1=$self._collection();
  52961. $ctx1.sendIdx["collection"]=1;
  52962. anyOne=$recv($1)._anyOne();
  52963. $3=$self._collection();
  52964. $ctx1.sendIdx["collection"]=2;
  52965. $2=$recv($3)._noneSatisfy_((function(each){
  52966. return $core.withContext(function($ctx2) {
  52967. return $recv(each).__eq(anyOne);
  52968. $ctx2.sendIdx["="]=1;
  52969. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52970. }));
  52971. $ctx1.sendIdx["noneSatisfy:"]=1;
  52972. $self._deny_($2);
  52973. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  52974. return $core.withContext(function($ctx2) {
  52975. return $recv(each).__eq($recv($globals.Object)._new());
  52976. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52977. })));
  52978. return self;
  52979. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52980. },
  52981. args: [],
  52982. 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 ])",
  52983. referencedClasses: ["Object"],
  52984. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  52985. }),
  52986. $globals.CollectionTest);
  52987. $core.addMethod(
  52988. $core.method({
  52989. selector: "testRegression1224",
  52990. protocol: "tests",
  52991. fn: function (){
  52992. var self=this,$self=this;
  52993. return $core.withContext(function($ctx1) {
  52994. var $3,$2,$1;
  52995. $3=$recv($self._collectionClass())._new();
  52996. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  52997. }));
  52998. $2=$recv($3)._yourself();
  52999. $1=$recv($2)._size();
  53000. $self._assert_equals_($1,(0));
  53001. return self;
  53002. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53003. },
  53004. args: [],
  53005. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53006. referencedClasses: [],
  53007. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53008. }),
  53009. $globals.CollectionTest);
  53010. $core.addMethod(
  53011. $core.method({
  53012. selector: "testRemoveAll",
  53013. protocol: "tests",
  53014. fn: function (){
  53015. var self=this,$self=this;
  53016. return $core.withContext(function($ctx1) {
  53017. var $2,$1;
  53018. $2=$self._collection();
  53019. $recv($2)._removeAll();
  53020. $1=$recv($2)._yourself();
  53021. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53022. return self;
  53023. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53024. },
  53025. args: [],
  53026. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53027. referencedClasses: [],
  53028. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53029. }),
  53030. $globals.CollectionTest);
  53031. $core.addMethod(
  53032. $core.method({
  53033. selector: "testSelect",
  53034. protocol: "tests",
  53035. fn: function (){
  53036. var self=this,$self=this;
  53037. return $core.withContext(function($ctx1) {
  53038. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53039. $2=$self._collection();
  53040. $ctx1.sendIdx["collection"]=1;
  53041. $1=$recv($2)._select_((function(){
  53042. return false;
  53043. }));
  53044. $ctx1.sendIdx["select:"]=1;
  53045. $4=$self._collectionClass();
  53046. $ctx1.sendIdx["collectionClass"]=1;
  53047. $3=$recv($4)._new();
  53048. $ctx1.sendIdx["new"]=1;
  53049. $self._assert_equals_($1,$3);
  53050. $ctx1.sendIdx["assert:equals:"]=1;
  53051. $6=$self._collection();
  53052. $ctx1.sendIdx["collection"]=2;
  53053. $5=$recv($6)._select_((function(){
  53054. return true;
  53055. }));
  53056. $ctx1.sendIdx["select:"]=2;
  53057. $7=$self._collection();
  53058. $ctx1.sendIdx["collection"]=3;
  53059. $self._assert_equals_($5,$7);
  53060. $ctx1.sendIdx["assert:equals:"]=2;
  53061. $9=$self._collectionWithNewValue();
  53062. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53063. $8=$recv($9)._select_((function(each){
  53064. return $core.withContext(function($ctx2) {
  53065. $10=$self._sampleNewValue();
  53066. $ctx2.sendIdx["sampleNewValue"]=1;
  53067. return $recv(each).__eq($10);
  53068. $ctx2.sendIdx["="]=1;
  53069. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53070. }));
  53071. $ctx1.sendIdx["select:"]=3;
  53072. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53073. $ctx1.sendIdx["assert:equals:"]=3;
  53074. $12=$self._collectionWithNewValue();
  53075. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53076. $11=$recv($12)._select_((function(each){
  53077. return $core.withContext(function($ctx2) {
  53078. $13=$self._sampleNewValue();
  53079. $ctx2.sendIdx["sampleNewValue"]=2;
  53080. return $recv(each).__tild_eq($13);
  53081. $ctx2.sendIdx["~="]=1;
  53082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53083. }));
  53084. $ctx1.sendIdx["select:"]=4;
  53085. $14=$self._collection();
  53086. $ctx1.sendIdx["collection"]=4;
  53087. $self._assert_equals_($11,$14);
  53088. $ctx1.sendIdx["assert:equals:"]=4;
  53089. $16=$self._collection();
  53090. $ctx1.sendIdx["collection"]=5;
  53091. $15=$recv($16)._select_((function(each){
  53092. return $core.withContext(function($ctx2) {
  53093. $17=$self._sampleNewValue();
  53094. $ctx2.sendIdx["sampleNewValue"]=3;
  53095. return $recv(each).__eq($17);
  53096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53097. }));
  53098. $ctx1.sendIdx["select:"]=5;
  53099. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53100. $ctx1.sendIdx["assert:equals:"]=5;
  53101. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53102. return $core.withContext(function($ctx2) {
  53103. return $recv(each).__tild_eq($self._sampleNewValue());
  53104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53105. })),$self._collection());
  53106. return self;
  53107. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53108. },
  53109. args: [],
  53110. 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",
  53111. referencedClasses: [],
  53112. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53113. }),
  53114. $globals.CollectionTest);
  53115. $core.addMethod(
  53116. $core.method({
  53117. selector: "testSelectThenCollect",
  53118. protocol: "tests",
  53119. fn: function (){
  53120. var self=this,$self=this;
  53121. return $core.withContext(function($ctx1) {
  53122. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53123. $2=$self._collection();
  53124. $ctx1.sendIdx["collection"]=1;
  53125. $1=$recv($2)._select_thenCollect_((function(){
  53126. return false;
  53127. }),"isString");
  53128. $ctx1.sendIdx["select:thenCollect:"]=1;
  53129. $4=$self._collectionClass();
  53130. $ctx1.sendIdx["collectionClass"]=1;
  53131. $3=$recv($4)._new();
  53132. $ctx1.sendIdx["new"]=1;
  53133. $self._assert_equals_($1,$3);
  53134. $ctx1.sendIdx["assert:equals:"]=1;
  53135. $6=$self._collection();
  53136. $ctx1.sendIdx["collection"]=2;
  53137. $5=$recv($6)._select_thenCollect_((function(){
  53138. return true;
  53139. }),(function(x){
  53140. return x;
  53141. }));
  53142. $ctx1.sendIdx["select:thenCollect:"]=2;
  53143. $7=$self._collection();
  53144. $ctx1.sendIdx["collection"]=3;
  53145. $self._assert_equals_($5,$7);
  53146. $ctx1.sendIdx["assert:equals:"]=2;
  53147. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53148. return $core.withContext(function($ctx2) {
  53149. $9=$self._sampleNewValue();
  53150. $ctx2.sendIdx["sampleNewValue"]=1;
  53151. return $recv(each).__eq($9);
  53152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53153. }),(function(x){
  53154. return x;
  53155. }));
  53156. $ctx1.sendIdx["select:thenCollect:"]=3;
  53157. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53158. $ctx1.sendIdx["assert:equals:"]=3;
  53159. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53160. return $core.withContext(function($ctx2) {
  53161. return $recv(each).__tild_eq($self._sampleNewValue());
  53162. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53163. }),"printString"),$self._collectionOfPrintStrings());
  53164. return self;
  53165. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53166. },
  53167. args: [],
  53168. 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",
  53169. referencedClasses: [],
  53170. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53171. }),
  53172. $globals.CollectionTest);
  53173. $core.addMethod(
  53174. $core.method({
  53175. selector: "testSingle",
  53176. protocol: "tests",
  53177. fn: function (){
  53178. var self=this,$self=this;
  53179. return $core.withContext(function($ctx1) {
  53180. $self._should_raise_((function(){
  53181. return $core.withContext(function($ctx2) {
  53182. return $recv($recv($self._collectionClass())._new())._single();
  53183. $ctx2.sendIdx["single"]=1;
  53184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53185. }),$globals.Error);
  53186. $ctx1.sendIdx["should:raise:"]=1;
  53187. $self._should_raise_((function(){
  53188. return $core.withContext(function($ctx2) {
  53189. return $recv($self._collection())._single();
  53190. $ctx2.sendIdx["single"]=2;
  53191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53192. }),$globals.Error);
  53193. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53194. return self;
  53195. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53196. },
  53197. args: [],
  53198. 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",
  53199. referencedClasses: ["Error"],
  53200. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53201. }),
  53202. $globals.CollectionTest);
  53203. $core.addMethod(
  53204. $core.method({
  53205. selector: "testSize",
  53206. protocol: "tests",
  53207. fn: function (){
  53208. var self=this,$self=this;
  53209. return $core.withContext(function($ctx1) {
  53210. var $1,$2;
  53211. $1=$recv($recv($self._collectionClass())._new())._size();
  53212. $ctx1.sendIdx["size"]=1;
  53213. $self._assert_equals_($1,(0));
  53214. $ctx1.sendIdx["assert:equals:"]=1;
  53215. $2=$recv($self._sampleNewValueAsCollection())._size();
  53216. $ctx1.sendIdx["size"]=2;
  53217. $self._assert_equals_($2,(1));
  53218. $ctx1.sendIdx["assert:equals:"]=2;
  53219. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53220. return self;
  53221. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53222. },
  53223. args: [],
  53224. 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",
  53225. referencedClasses: [],
  53226. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53227. }),
  53228. $globals.CollectionTest);
  53229. $core.addMethod(
  53230. $core.method({
  53231. selector: "collectionClass",
  53232. protocol: "fixture",
  53233. fn: function (){
  53234. var self=this,$self=this;
  53235. return nil;
  53236. },
  53237. args: [],
  53238. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53239. referencedClasses: [],
  53240. messageSends: []
  53241. }),
  53242. $globals.CollectionTest.a$cls);
  53243. $core.addMethod(
  53244. $core.method({
  53245. selector: "isAbstract",
  53246. protocol: "testing",
  53247. fn: function (){
  53248. var self=this,$self=this;
  53249. return $core.withContext(function($ctx1) {
  53250. return $recv($self._collectionClass())._isNil();
  53251. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53252. },
  53253. args: [],
  53254. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53255. referencedClasses: [],
  53256. messageSends: ["isNil", "collectionClass"]
  53257. }),
  53258. $globals.CollectionTest.a$cls);
  53259. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53260. $core.addMethod(
  53261. $core.method({
  53262. selector: "collectionWithNewValue",
  53263. protocol: "fixture",
  53264. fn: function (){
  53265. var self=this,$self=this;
  53266. return $core.withContext(function($ctx1) {
  53267. $self._subclassResponsibility();
  53268. return self;
  53269. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53270. },
  53271. args: [],
  53272. 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",
  53273. referencedClasses: [],
  53274. messageSends: ["subclassResponsibility"]
  53275. }),
  53276. $globals.IndexableCollectionTest);
  53277. $core.addMethod(
  53278. $core.method({
  53279. selector: "nonIndexesDo:",
  53280. protocol: "fixture",
  53281. fn: function (aBlock){
  53282. var self=this,$self=this;
  53283. return $core.withContext(function($ctx1) {
  53284. $self._subclassResponsibility();
  53285. return self;
  53286. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53287. },
  53288. args: ["aBlock"],
  53289. 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",
  53290. referencedClasses: [],
  53291. messageSends: ["subclassResponsibility"]
  53292. }),
  53293. $globals.IndexableCollectionTest);
  53294. $core.addMethod(
  53295. $core.method({
  53296. selector: "sampleNewIndex",
  53297. protocol: "fixture",
  53298. fn: function (){
  53299. var self=this,$self=this;
  53300. return $core.withContext(function($ctx1) {
  53301. $self._subclassResponsibility();
  53302. return self;
  53303. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53304. },
  53305. args: [],
  53306. 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",
  53307. referencedClasses: [],
  53308. messageSends: ["subclassResponsibility"]
  53309. }),
  53310. $globals.IndexableCollectionTest);
  53311. $core.addMethod(
  53312. $core.method({
  53313. selector: "samplesDo:",
  53314. protocol: "fixture",
  53315. fn: function (aBlock){
  53316. var self=this,$self=this;
  53317. return $core.withContext(function($ctx1) {
  53318. $self._subclassResponsibility();
  53319. return self;
  53320. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53321. },
  53322. args: ["aBlock"],
  53323. 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",
  53324. referencedClasses: [],
  53325. messageSends: ["subclassResponsibility"]
  53326. }),
  53327. $globals.IndexableCollectionTest);
  53328. $core.addMethod(
  53329. $core.method({
  53330. selector: "testAt",
  53331. protocol: "tests",
  53332. fn: function (){
  53333. var self=this,$self=this;
  53334. return $core.withContext(function($ctx1) {
  53335. var $1;
  53336. $self._nonIndexesDo_((function(each){
  53337. return $core.withContext(function($ctx2) {
  53338. return $self._should_raise_((function(){
  53339. return $core.withContext(function($ctx3) {
  53340. $1=$self._collection();
  53341. $ctx3.sendIdx["collection"]=1;
  53342. return $recv($1)._at_(each);
  53343. $ctx3.sendIdx["at:"]=1;
  53344. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53345. }),$globals.Error);
  53346. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53347. }));
  53348. $self._samplesDo_((function(index,value){
  53349. return $core.withContext(function($ctx2) {
  53350. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53351. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53352. }));
  53353. return self;
  53354. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53355. },
  53356. args: [],
  53357. 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 ]",
  53358. referencedClasses: ["Error"],
  53359. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53360. }),
  53361. $globals.IndexableCollectionTest);
  53362. $core.addMethod(
  53363. $core.method({
  53364. selector: "testAtIfAbsent",
  53365. protocol: "tests",
  53366. fn: function (){
  53367. var self=this,$self=this;
  53368. return $core.withContext(function($ctx1) {
  53369. var $2,$1,$3;
  53370. $self._nonIndexesDo_((function(each){
  53371. return $core.withContext(function($ctx2) {
  53372. $2=$self._collection();
  53373. $ctx2.sendIdx["collection"]=1;
  53374. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53375. return $core.withContext(function($ctx3) {
  53376. return $self._sampleNewValue();
  53377. $ctx3.sendIdx["sampleNewValue"]=1;
  53378. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53379. }));
  53380. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53381. $3=$self._sampleNewValue();
  53382. $ctx2.sendIdx["sampleNewValue"]=2;
  53383. return $self._assert_equals_($1,$3);
  53384. $ctx2.sendIdx["assert:equals:"]=1;
  53385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53386. }));
  53387. $self._samplesDo_((function(index,value){
  53388. return $core.withContext(function($ctx2) {
  53389. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53390. return $core.withContext(function($ctx3) {
  53391. return $self._sampleNewValue();
  53392. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53393. })),value);
  53394. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53395. }));
  53396. return self;
  53397. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53398. },
  53399. args: [],
  53400. 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 ].",
  53401. referencedClasses: [],
  53402. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53403. }),
  53404. $globals.IndexableCollectionTest);
  53405. $core.addMethod(
  53406. $core.method({
  53407. selector: "testAtIfAbsentPut",
  53408. protocol: "tests",
  53409. fn: function (){
  53410. var self=this,$self=this;
  53411. var newCollection;
  53412. return $core.withContext(function($ctx1) {
  53413. var $1;
  53414. newCollection=$self._collection();
  53415. $ctx1.sendIdx["collection"]=1;
  53416. $self._samplesDo_((function(index,value){
  53417. return $core.withContext(function($ctx2) {
  53418. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53419. return $core.withContext(function($ctx3) {
  53420. return $self._sampleNewValue();
  53421. $ctx3.sendIdx["sampleNewValue"]=1;
  53422. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53423. }));
  53424. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53425. return $self._assert_equals_($1,value);
  53426. $ctx2.sendIdx["assert:equals:"]=1;
  53427. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53428. }));
  53429. $self._assert_equals_(newCollection,$self._collection());
  53430. $ctx1.sendIdx["assert:equals:"]=2;
  53431. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53432. return $core.withContext(function($ctx2) {
  53433. return $self._sampleNewValue();
  53434. $ctx2.sendIdx["sampleNewValue"]=2;
  53435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53436. })),$self._sampleNewValue());
  53437. $ctx1.sendIdx["assert:equals:"]=3;
  53438. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53439. return self;
  53440. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53441. },
  53442. args: [],
  53443. 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",
  53444. referencedClasses: [],
  53445. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53446. }),
  53447. $globals.IndexableCollectionTest);
  53448. $core.addMethod(
  53449. $core.method({
  53450. selector: "testAtIfPresent",
  53451. protocol: "tests",
  53452. fn: function (){
  53453. var self=this,$self=this;
  53454. var visited,sentinel;
  53455. return $core.withContext(function($ctx1) {
  53456. var $2,$1,$4,$3;
  53457. sentinel=$recv($globals.Object)._new();
  53458. $self._nonIndexesDo_((function(each){
  53459. return $core.withContext(function($ctx2) {
  53460. visited=nil;
  53461. visited;
  53462. $2=$self._collection();
  53463. $ctx2.sendIdx["collection"]=1;
  53464. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53465. visited=value1;
  53466. visited;
  53467. return sentinel;
  53468. }));
  53469. $ctx2.sendIdx["at:ifPresent:"]=1;
  53470. $self._assert_equals_($1,nil);
  53471. $ctx2.sendIdx["assert:equals:"]=1;
  53472. return $self._assert_($recv(visited)._isNil());
  53473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53474. }));
  53475. $self._samplesDo_((function(index,value){
  53476. return $core.withContext(function($ctx2) {
  53477. visited=nil;
  53478. visited;
  53479. $4=$self._collection();
  53480. $ctx2.sendIdx["collection"]=2;
  53481. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53482. visited=value2;
  53483. visited;
  53484. return sentinel;
  53485. }));
  53486. $self._assert_equals_($3,sentinel);
  53487. $ctx2.sendIdx["assert:equals:"]=2;
  53488. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53489. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53490. }));
  53491. return self;
  53492. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53493. },
  53494. args: [],
  53495. 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) ]",
  53496. referencedClasses: ["Object"],
  53497. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53498. }),
  53499. $globals.IndexableCollectionTest);
  53500. $core.addMethod(
  53501. $core.method({
  53502. selector: "testAtIfPresentIfAbsent",
  53503. protocol: "tests",
  53504. fn: function (){
  53505. var self=this,$self=this;
  53506. var visited,sentinel;
  53507. return $core.withContext(function($ctx1) {
  53508. var $2,$1,$3,$5,$4;
  53509. sentinel=$recv($globals.Object)._new();
  53510. $self._nonIndexesDo_((function(each){
  53511. return $core.withContext(function($ctx2) {
  53512. visited=nil;
  53513. visited;
  53514. $2=$self._collection();
  53515. $ctx2.sendIdx["collection"]=1;
  53516. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53517. visited=value1;
  53518. visited;
  53519. return sentinel;
  53520. }),(function(){
  53521. return $core.withContext(function($ctx3) {
  53522. return $self._sampleNewValue();
  53523. $ctx3.sendIdx["sampleNewValue"]=1;
  53524. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53525. }));
  53526. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53527. $3=$self._sampleNewValue();
  53528. $ctx2.sendIdx["sampleNewValue"]=2;
  53529. $self._assert_equals_($1,$3);
  53530. $ctx2.sendIdx["assert:equals:"]=1;
  53531. return $self._assert_($recv(visited)._isNil());
  53532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53533. }));
  53534. $self._samplesDo_((function(index,value){
  53535. return $core.withContext(function($ctx2) {
  53536. visited=nil;
  53537. visited;
  53538. $5=$self._collection();
  53539. $ctx2.sendIdx["collection"]=2;
  53540. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53541. visited=value2;
  53542. visited;
  53543. return sentinel;
  53544. }),(function(){
  53545. return $core.withContext(function($ctx3) {
  53546. return $self._sampleNewValue();
  53547. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53548. }));
  53549. $self._assert_equals_($4,sentinel);
  53550. $ctx2.sendIdx["assert:equals:"]=2;
  53551. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53552. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53553. }));
  53554. return self;
  53555. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53556. },
  53557. args: [],
  53558. 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) ]",
  53559. referencedClasses: ["Object"],
  53560. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53561. }),
  53562. $globals.IndexableCollectionTest);
  53563. $core.addMethod(
  53564. $core.method({
  53565. selector: "testAtPut",
  53566. protocol: "tests",
  53567. fn: function (){
  53568. var self=this,$self=this;
  53569. var newCollection;
  53570. return $core.withContext(function($ctx1) {
  53571. newCollection=$self._collection();
  53572. $ctx1.sendIdx["collection"]=1;
  53573. $self._samplesDo_((function(index,value){
  53574. return $core.withContext(function($ctx2) {
  53575. return $recv(newCollection)._at_put_(index,value);
  53576. $ctx2.sendIdx["at:put:"]=1;
  53577. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53578. }));
  53579. $self._assert_equals_(newCollection,$self._collection());
  53580. $ctx1.sendIdx["assert:equals:"]=1;
  53581. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  53582. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53583. return self;
  53584. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53585. },
  53586. args: [],
  53587. 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",
  53588. referencedClasses: [],
  53589. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  53590. }),
  53591. $globals.IndexableCollectionTest);
  53592. $core.addMethod(
  53593. $core.method({
  53594. selector: "testIndexOf",
  53595. protocol: "tests",
  53596. fn: function (){
  53597. var self=this,$self=this;
  53598. return $core.withContext(function($ctx1) {
  53599. var $1;
  53600. $self._should_raise_((function(){
  53601. return $core.withContext(function($ctx2) {
  53602. $1=$self._collection();
  53603. $ctx2.sendIdx["collection"]=1;
  53604. return $recv($1)._indexOf_($self._sampleNewValue());
  53605. $ctx2.sendIdx["indexOf:"]=1;
  53606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53607. }),$globals.Error);
  53608. $self._samplesDo_((function(index,value){
  53609. return $core.withContext(function($ctx2) {
  53610. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  53611. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  53612. }));
  53613. return self;
  53614. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  53615. },
  53616. args: [],
  53617. 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 ]",
  53618. referencedClasses: ["Error"],
  53619. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  53620. }),
  53621. $globals.IndexableCollectionTest);
  53622. $core.addMethod(
  53623. $core.method({
  53624. selector: "testIndexOfWithNull",
  53625. protocol: "tests",
  53626. fn: function (){
  53627. var self=this,$self=this;
  53628. var jsNull;
  53629. return $core.withContext(function($ctx1) {
  53630. var $2,$1;
  53631. jsNull=$recv($globals.JSON)._parse_("null");
  53632. $self._samplesDo_((function(index,value){
  53633. return $core.withContext(function($ctx2) {
  53634. $2=$self._collection();
  53635. $recv($2)._at_put_(index,jsNull);
  53636. $1=$recv($2)._indexOf_(jsNull);
  53637. return $self._assert_equals_($1,index);
  53638. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53639. }));
  53640. return self;
  53641. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  53642. },
  53643. args: [],
  53644. 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 ]",
  53645. referencedClasses: ["JSON"],
  53646. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  53647. }),
  53648. $globals.IndexableCollectionTest);
  53649. $core.addMethod(
  53650. $core.method({
  53651. selector: "testWithIndexDo",
  53652. protocol: "tests",
  53653. fn: function (){
  53654. var self=this,$self=this;
  53655. var collection;
  53656. return $core.withContext(function($ctx1) {
  53657. collection=$self._collection();
  53658. $ctx1.sendIdx["collection"]=1;
  53659. $recv($self._collection())._withIndexDo_((function(each,index){
  53660. return $core.withContext(function($ctx2) {
  53661. return $self._assert_equals_($recv(collection)._at_(index),each);
  53662. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  53663. }));
  53664. return self;
  53665. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  53666. },
  53667. args: [],
  53668. 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 ]",
  53669. referencedClasses: [],
  53670. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  53671. }),
  53672. $globals.IndexableCollectionTest);
  53673. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  53674. $core.addMethod(
  53675. $core.method({
  53676. selector: "collectionKeys",
  53677. protocol: "fixture",
  53678. fn: function (){
  53679. var self=this,$self=this;
  53680. return $core.withContext(function($ctx1) {
  53681. $self._subclassResponsibility();
  53682. return self;
  53683. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  53684. },
  53685. args: [],
  53686. source: "collectionKeys\x0a\x09self subclassResponsibility",
  53687. referencedClasses: [],
  53688. messageSends: ["subclassResponsibility"]
  53689. }),
  53690. $globals.AssociativeCollectionTest);
  53691. $core.addMethod(
  53692. $core.method({
  53693. selector: "collectionValues",
  53694. protocol: "fixture",
  53695. fn: function (){
  53696. var self=this,$self=this;
  53697. return $core.withContext(function($ctx1) {
  53698. $self._subclassResponsibility();
  53699. return self;
  53700. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  53701. },
  53702. args: [],
  53703. source: "collectionValues\x0a\x09self subclassResponsibility",
  53704. referencedClasses: [],
  53705. messageSends: ["subclassResponsibility"]
  53706. }),
  53707. $globals.AssociativeCollectionTest);
  53708. $core.addMethod(
  53709. $core.method({
  53710. selector: "nonIndexesDo:",
  53711. protocol: "fixture",
  53712. fn: function (aBlock){
  53713. var self=this,$self=this;
  53714. return $core.withContext(function($ctx1) {
  53715. $recv(aBlock)._value_((5));
  53716. $ctx1.sendIdx["value:"]=1;
  53717. $recv(aBlock)._value_((function(){
  53718. }));
  53719. $ctx1.sendIdx["value:"]=2;
  53720. $recv(aBlock)._value_($recv($globals.Object)._new());
  53721. $ctx1.sendIdx["value:"]=3;
  53722. $recv(aBlock)._value_("z");
  53723. return self;
  53724. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53725. },
  53726. args: ["aBlock"],
  53727. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  53728. referencedClasses: ["Object"],
  53729. messageSends: ["value:", "new"]
  53730. }),
  53731. $globals.AssociativeCollectionTest);
  53732. $core.addMethod(
  53733. $core.method({
  53734. selector: "sampleNewIndex",
  53735. protocol: "fixture",
  53736. fn: function (){
  53737. var self=this,$self=this;
  53738. return "new";
  53739. },
  53740. args: [],
  53741. source: "sampleNewIndex\x0a\x09^ 'new'",
  53742. referencedClasses: [],
  53743. messageSends: []
  53744. }),
  53745. $globals.AssociativeCollectionTest);
  53746. $core.addMethod(
  53747. $core.method({
  53748. selector: "samplesDo:",
  53749. protocol: "fixture",
  53750. fn: function (aBlock){
  53751. var self=this,$self=this;
  53752. return $core.withContext(function($ctx1) {
  53753. $recv(aBlock)._value_value_("a",(2));
  53754. return self;
  53755. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53756. },
  53757. args: ["aBlock"],
  53758. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  53759. referencedClasses: [],
  53760. messageSends: ["value:value:"]
  53761. }),
  53762. $globals.AssociativeCollectionTest);
  53763. $core.addMethod(
  53764. $core.method({
  53765. selector: "testAddAll",
  53766. protocol: "tests",
  53767. fn: function (){
  53768. var self=this,$self=this;
  53769. return $core.withContext(function($ctx1) {
  53770. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  53771. (
  53772. $ctx1.supercall = true,
  53773. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  53774. $ctx1.supercall = false;
  53775. $2=$self._collection();
  53776. $ctx1.sendIdx["collection"]=1;
  53777. $3=$self._collection();
  53778. $ctx1.sendIdx["collection"]=2;
  53779. $recv($2)._addAll_($3);
  53780. $ctx1.sendIdx["addAll:"]=1;
  53781. $4=$recv($2)._yourself();
  53782. $ctx1.sendIdx["yourself"]=1;
  53783. $1=$4;
  53784. $5=$self._collection();
  53785. $ctx1.sendIdx["collection"]=3;
  53786. $self._assert_equals_($1,$5);
  53787. $ctx1.sendIdx["assert:equals:"]=1;
  53788. $7=$self._collection();
  53789. $ctx1.sendIdx["collection"]=4;
  53790. $8=$self._collectionWithNewValue();
  53791. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53792. $recv($7)._addAll_($8);
  53793. $ctx1.sendIdx["addAll:"]=2;
  53794. $9=$recv($7)._yourself();
  53795. $ctx1.sendIdx["yourself"]=2;
  53796. $6=$9;
  53797. $10=$self._collectionWithNewValue();
  53798. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53799. $self._assert_equals_($6,$10);
  53800. $ctx1.sendIdx["assert:equals:"]=2;
  53801. $12=$self._collectionWithNewValue();
  53802. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53803. $recv($12)._addAll_($self._collection());
  53804. $11=$recv($12)._yourself();
  53805. $self._assert_equals_($11,$self._collectionWithNewValue());
  53806. return self;
  53807. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  53808. },
  53809. args: [],
  53810. 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",
  53811. referencedClasses: [],
  53812. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53813. }),
  53814. $globals.AssociativeCollectionTest);
  53815. $core.addMethod(
  53816. $core.method({
  53817. selector: "testAsDictionary",
  53818. protocol: "tests",
  53819. fn: function (){
  53820. var self=this,$self=this;
  53821. return $core.withContext(function($ctx1) {
  53822. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  53823. return self;
  53824. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  53825. },
  53826. args: [],
  53827. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  53828. referencedClasses: ["Dictionary"],
  53829. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  53830. }),
  53831. $globals.AssociativeCollectionTest);
  53832. $core.addMethod(
  53833. $core.method({
  53834. selector: "testAsHashedCollection",
  53835. protocol: "tests",
  53836. fn: function (){
  53837. var self=this,$self=this;
  53838. return $core.withContext(function($ctx1) {
  53839. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  53840. return self;
  53841. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  53842. },
  53843. args: [],
  53844. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  53845. referencedClasses: ["HashedCollection"],
  53846. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  53847. }),
  53848. $globals.AssociativeCollectionTest);
  53849. $core.addMethod(
  53850. $core.method({
  53851. selector: "testComma",
  53852. protocol: "tests",
  53853. fn: function (){
  53854. var self=this,$self=this;
  53855. return $core.withContext(function($ctx1) {
  53856. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53857. (
  53858. $ctx1.supercall = true,
  53859. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  53860. $ctx1.supercall = false;
  53861. $2=$self._collection();
  53862. $ctx1.sendIdx["collection"]=1;
  53863. $3=$self._collection();
  53864. $ctx1.sendIdx["collection"]=2;
  53865. $1=$recv($2).__comma($3);
  53866. $ctx1.sendIdx[","]=1;
  53867. $4=$self._collection();
  53868. $ctx1.sendIdx["collection"]=3;
  53869. $self._assert_equals_($1,$4);
  53870. $ctx1.sendIdx["assert:equals:"]=1;
  53871. $6=$self._collection();
  53872. $ctx1.sendIdx["collection"]=4;
  53873. $7=$self._collectionWithNewValue();
  53874. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53875. $5=$recv($6).__comma($7);
  53876. $ctx1.sendIdx[","]=2;
  53877. $8=$self._collectionWithNewValue();
  53878. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53879. $self._assert_equals_($5,$8);
  53880. $ctx1.sendIdx["assert:equals:"]=2;
  53881. $10=$self._collectionWithNewValue();
  53882. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53883. $9=$recv($10).__comma($self._collection());
  53884. $self._assert_equals_($9,$self._collectionWithNewValue());
  53885. return self;
  53886. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  53887. },
  53888. args: [],
  53889. 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",
  53890. referencedClasses: [],
  53891. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53892. }),
  53893. $globals.AssociativeCollectionTest);
  53894. $core.addMethod(
  53895. $core.method({
  53896. selector: "testFrom",
  53897. protocol: "tests",
  53898. fn: function (){
  53899. var self=this,$self=this;
  53900. var associations;
  53901. return $core.withContext(function($ctx1) {
  53902. var $1;
  53903. $1="a".__minus_gt((1));
  53904. $ctx1.sendIdx["->"]=1;
  53905. associations=[$1,"b".__minus_gt((2))];
  53906. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  53907. return self;
  53908. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  53909. },
  53910. args: [],
  53911. 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 }.",
  53912. referencedClasses: [],
  53913. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  53914. }),
  53915. $globals.AssociativeCollectionTest);
  53916. $core.addMethod(
  53917. $core.method({
  53918. selector: "testKeys",
  53919. protocol: "tests",
  53920. fn: function (){
  53921. var self=this,$self=this;
  53922. return $core.withContext(function($ctx1) {
  53923. var $2,$1,$3,$4;
  53924. $2=$recv($recv($self._collectionClass())._new())._keys();
  53925. $ctx1.sendIdx["keys"]=1;
  53926. $1=$recv($2)._isEmpty();
  53927. $self._assert_($1);
  53928. $3=$recv($self._collection())._keys();
  53929. $ctx1.sendIdx["keys"]=2;
  53930. $4=$self._collectionKeys();
  53931. $ctx1.sendIdx["collectionKeys"]=1;
  53932. $self._assertSameContents_as_($3,$4);
  53933. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53934. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  53935. return self;
  53936. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  53937. },
  53938. args: [],
  53939. 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 }",
  53940. referencedClasses: [],
  53941. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  53942. }),
  53943. $globals.AssociativeCollectionTest);
  53944. $core.addMethod(
  53945. $core.method({
  53946. selector: "testNewFromPairs",
  53947. protocol: "tests",
  53948. fn: function (){
  53949. var self=this,$self=this;
  53950. var flattenedAssociations;
  53951. return $core.withContext(function($ctx1) {
  53952. flattenedAssociations=["a",(1),"b",(2)];
  53953. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  53954. return self;
  53955. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  53956. },
  53957. args: [],
  53958. 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 }.",
  53959. referencedClasses: [],
  53960. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  53961. }),
  53962. $globals.AssociativeCollectionTest);
  53963. $core.addMethod(
  53964. $core.method({
  53965. selector: "testPrintString",
  53966. protocol: "tests",
  53967. fn: function (){
  53968. var self=this,$self=this;
  53969. return $core.withContext(function($ctx1) {
  53970. var $3,$2,$1,$4;
  53971. $3=$self._collectionClass();
  53972. $ctx1.sendIdx["collectionClass"]=1;
  53973. $2=$recv($3)._new();
  53974. $recv($2)._at_put_("firstname","James");
  53975. $ctx1.sendIdx["at:put:"]=1;
  53976. $recv($2)._at_put_("lastname","Bond");
  53977. $1=$recv($2)._printString();
  53978. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  53979. $ctx1.sendIdx[","]=1;
  53980. $self._assert_equals_($1,$4);
  53981. return self;
  53982. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  53983. },
  53984. args: [],
  53985. 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'')'",
  53986. referencedClasses: [],
  53987. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  53988. }),
  53989. $globals.AssociativeCollectionTest);
  53990. $core.addMethod(
  53991. $core.method({
  53992. selector: "testRemoveKey",
  53993. protocol: "tests",
  53994. fn: function (){
  53995. var self=this,$self=this;
  53996. return $core.withContext(function($ctx1) {
  53997. var $1,$2,$3,$5,$6,$4,$8,$7;
  53998. $self._nonIndexesDo_((function(each){
  53999. var collection;
  54000. return $core.withContext(function($ctx2) {
  54001. collection=$self._collection();
  54002. $ctx2.sendIdx["collection"]=1;
  54003. collection;
  54004. $self._should_raise_((function(){
  54005. return $core.withContext(function($ctx3) {
  54006. return $recv(collection)._removeKey_(each);
  54007. $ctx3.sendIdx["removeKey:"]=1;
  54008. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54009. }),$globals.Error);
  54010. $1=collection;
  54011. $2=$self._collection();
  54012. $ctx2.sendIdx["collection"]=2;
  54013. return $self._assert_equals_($1,$2);
  54014. $ctx2.sendIdx["assert:equals:"]=1;
  54015. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54016. }));
  54017. $self._samplesDo_((function(index,value){
  54018. var collection;
  54019. return $core.withContext(function($ctx2) {
  54020. collection=$self._collection();
  54021. $ctx2.sendIdx["collection"]=3;
  54022. collection;
  54023. $3=$recv(collection)._removeKey_(index);
  54024. $ctx2.sendIdx["removeKey:"]=2;
  54025. $self._assert_equals_($3,value);
  54026. $ctx2.sendIdx["assert:equals:"]=2;
  54027. $5=collection;
  54028. $6=$self._collection();
  54029. $ctx2.sendIdx["collection"]=4;
  54030. $4=$recv($5).__eq($6);
  54031. return $self._deny_($4);
  54032. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54033. }));
  54034. $8=$self._collectionWithNewValue();
  54035. $recv($8)._removeKey_($self._sampleNewIndex());
  54036. $7=$recv($8)._yourself();
  54037. $self._assert_equals_($7,$self._collection());
  54038. return self;
  54039. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54040. },
  54041. args: [],
  54042. 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",
  54043. referencedClasses: ["Error"],
  54044. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54045. }),
  54046. $globals.AssociativeCollectionTest);
  54047. $core.addMethod(
  54048. $core.method({
  54049. selector: "testRemoveKeyIfAbsent",
  54050. protocol: "tests",
  54051. fn: function (){
  54052. var self=this,$self=this;
  54053. return $core.withContext(function($ctx1) {
  54054. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54055. $self._nonIndexesDo_((function(each){
  54056. var collection;
  54057. return $core.withContext(function($ctx2) {
  54058. collection=$self._collection();
  54059. $ctx2.sendIdx["collection"]=1;
  54060. collection;
  54061. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54062. return $core.withContext(function($ctx3) {
  54063. return $self._sampleNewValue();
  54064. $ctx3.sendIdx["sampleNewValue"]=1;
  54065. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54066. }));
  54067. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54068. $2=$self._sampleNewValue();
  54069. $ctx2.sendIdx["sampleNewValue"]=2;
  54070. $self._assert_equals_($1,$2);
  54071. $ctx2.sendIdx["assert:equals:"]=1;
  54072. $3=collection;
  54073. $4=$self._collection();
  54074. $ctx2.sendIdx["collection"]=2;
  54075. return $self._assert_equals_($3,$4);
  54076. $ctx2.sendIdx["assert:equals:"]=2;
  54077. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54078. }));
  54079. $self._samplesDo_((function(index,value){
  54080. var collection;
  54081. return $core.withContext(function($ctx2) {
  54082. collection=$self._collection();
  54083. $ctx2.sendIdx["collection"]=3;
  54084. collection;
  54085. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54086. return $core.withContext(function($ctx3) {
  54087. return $self._sampleNewValue();
  54088. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54089. }));
  54090. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54091. $self._assert_equals_($5,value);
  54092. $ctx2.sendIdx["assert:equals:"]=3;
  54093. $7=collection;
  54094. $8=$self._collection();
  54095. $ctx2.sendIdx["collection"]=4;
  54096. $6=$recv($7).__eq($8);
  54097. return $self._deny_($6);
  54098. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54099. }));
  54100. $10=$self._collectionWithNewValue();
  54101. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54102. return $core.withContext(function($ctx2) {
  54103. return $self._assert_(false);
  54104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54105. }));
  54106. $9=$recv($10)._yourself();
  54107. $self._assert_equals_($9,$self._collection());
  54108. return self;
  54109. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54110. },
  54111. args: [],
  54112. 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",
  54113. referencedClasses: [],
  54114. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54115. }),
  54116. $globals.AssociativeCollectionTest);
  54117. $core.addMethod(
  54118. $core.method({
  54119. selector: "testValues",
  54120. protocol: "tests",
  54121. fn: function (){
  54122. var self=this,$self=this;
  54123. return $core.withContext(function($ctx1) {
  54124. var $2,$1,$3,$4;
  54125. $2=$recv($recv($self._collectionClass())._new())._values();
  54126. $ctx1.sendIdx["values"]=1;
  54127. $1=$recv($2)._isEmpty();
  54128. $self._assert_($1);
  54129. $3=$recv($self._collection())._values();
  54130. $ctx1.sendIdx["values"]=2;
  54131. $4=$self._collectionValues();
  54132. $ctx1.sendIdx["collectionValues"]=1;
  54133. $self._assertSameContents_as_($3,$4);
  54134. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54135. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54136. return self;
  54137. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54138. },
  54139. args: [],
  54140. 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 }",
  54141. referencedClasses: [],
  54142. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54143. }),
  54144. $globals.AssociativeCollectionTest);
  54145. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54146. $core.addMethod(
  54147. $core.method({
  54148. selector: "collection",
  54149. protocol: "fixture",
  54150. fn: function (){
  54151. var self=this,$self=this;
  54152. return $core.withContext(function($ctx1) {
  54153. var $1;
  54154. $1=$recv($globals.Dictionary)._new();
  54155. $recv($1)._at_put_((1),(1));
  54156. $ctx1.sendIdx["at:put:"]=1;
  54157. $recv($1)._at_put_("a",(2));
  54158. $ctx1.sendIdx["at:put:"]=2;
  54159. $recv($1)._at_put_(true,(3));
  54160. $ctx1.sendIdx["at:put:"]=3;
  54161. $recv($1)._at_put_((1).__at((3)),(-4));
  54162. $ctx1.sendIdx["at:put:"]=4;
  54163. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54164. return $recv($1)._yourself();
  54165. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54166. },
  54167. args: [],
  54168. 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",
  54169. referencedClasses: ["Dictionary"],
  54170. messageSends: ["at:put:", "new", "@", "yourself"]
  54171. }),
  54172. $globals.DictionaryTest);
  54173. $core.addMethod(
  54174. $core.method({
  54175. selector: "collectionKeys",
  54176. protocol: "fixture",
  54177. fn: function (){
  54178. var self=this,$self=this;
  54179. return $core.withContext(function($ctx1) {
  54180. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54181. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54182. },
  54183. args: [],
  54184. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54185. referencedClasses: [],
  54186. messageSends: ["@"]
  54187. }),
  54188. $globals.DictionaryTest);
  54189. $core.addMethod(
  54190. $core.method({
  54191. selector: "collectionOfPrintStrings",
  54192. protocol: "fixture",
  54193. fn: function (){
  54194. var self=this,$self=this;
  54195. return $core.withContext(function($ctx1) {
  54196. var $1;
  54197. $1=$recv($globals.Dictionary)._new();
  54198. $recv($1)._at_put_((1),"1");
  54199. $ctx1.sendIdx["at:put:"]=1;
  54200. $recv($1)._at_put_("a","2");
  54201. $ctx1.sendIdx["at:put:"]=2;
  54202. $recv($1)._at_put_(true,"3");
  54203. $ctx1.sendIdx["at:put:"]=3;
  54204. $recv($1)._at_put_((1).__at((3)),"-4");
  54205. $ctx1.sendIdx["at:put:"]=4;
  54206. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54207. return $recv($1)._yourself();
  54208. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54209. },
  54210. args: [],
  54211. 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",
  54212. referencedClasses: ["Dictionary"],
  54213. messageSends: ["at:put:", "new", "@", "yourself"]
  54214. }),
  54215. $globals.DictionaryTest);
  54216. $core.addMethod(
  54217. $core.method({
  54218. selector: "collectionSize",
  54219. protocol: "fixture",
  54220. fn: function (){
  54221. var self=this,$self=this;
  54222. return (5);
  54223. },
  54224. args: [],
  54225. source: "collectionSize\x0a\x09^ 5",
  54226. referencedClasses: [],
  54227. messageSends: []
  54228. }),
  54229. $globals.DictionaryTest);
  54230. $core.addMethod(
  54231. $core.method({
  54232. selector: "collectionValues",
  54233. protocol: "fixture",
  54234. fn: function (){
  54235. var self=this,$self=this;
  54236. return [(1),(2),(3),(-4),(9)];
  54237. },
  54238. args: [],
  54239. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54240. referencedClasses: [],
  54241. messageSends: []
  54242. }),
  54243. $globals.DictionaryTest);
  54244. $core.addMethod(
  54245. $core.method({
  54246. selector: "collectionWithDuplicates",
  54247. protocol: "fixture",
  54248. fn: function (){
  54249. var self=this,$self=this;
  54250. return $core.withContext(function($ctx1) {
  54251. var $1;
  54252. $1=$recv($globals.Dictionary)._new();
  54253. $recv($1)._at_put_((1),(1));
  54254. $ctx1.sendIdx["at:put:"]=1;
  54255. $recv($1)._at_put_("a",(2));
  54256. $ctx1.sendIdx["at:put:"]=2;
  54257. $recv($1)._at_put_(true,(3));
  54258. $ctx1.sendIdx["at:put:"]=3;
  54259. $recv($1)._at_put_((4),(-4));
  54260. $ctx1.sendIdx["at:put:"]=4;
  54261. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54262. $ctx1.sendIdx["at:put:"]=5;
  54263. $recv($1)._at_put_("b",(1));
  54264. $ctx1.sendIdx["at:put:"]=6;
  54265. $recv($1)._at_put_((3),(3));
  54266. $ctx1.sendIdx["at:put:"]=7;
  54267. $recv($1)._at_put_(false,(12));
  54268. return $recv($1)._yourself();
  54269. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54270. },
  54271. args: [],
  54272. 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",
  54273. referencedClasses: ["Dictionary"],
  54274. messageSends: ["at:put:", "new", "yourself"]
  54275. }),
  54276. $globals.DictionaryTest);
  54277. $core.addMethod(
  54278. $core.method({
  54279. selector: "collectionWithNewValue",
  54280. protocol: "fixture",
  54281. fn: function (){
  54282. var self=this,$self=this;
  54283. return $core.withContext(function($ctx1) {
  54284. var $1;
  54285. $1=$recv($globals.Dictionary)._new();
  54286. $recv($1)._at_put_((1),(1));
  54287. $ctx1.sendIdx["at:put:"]=1;
  54288. $recv($1)._at_put_("a",(2));
  54289. $ctx1.sendIdx["at:put:"]=2;
  54290. $recv($1)._at_put_(true,(3));
  54291. $ctx1.sendIdx["at:put:"]=3;
  54292. $recv($1)._at_put_((1).__at((3)),(-4));
  54293. $ctx1.sendIdx["at:put:"]=4;
  54294. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54295. $ctx1.sendIdx["at:put:"]=5;
  54296. $recv($1)._at_put_("new","N");
  54297. return $recv($1)._yourself();
  54298. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54299. },
  54300. args: [],
  54301. 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",
  54302. referencedClasses: ["Dictionary"],
  54303. messageSends: ["at:put:", "new", "@", "yourself"]
  54304. }),
  54305. $globals.DictionaryTest);
  54306. $core.addMethod(
  54307. $core.method({
  54308. selector: "sampleNewValueAsCollection",
  54309. protocol: "fixture",
  54310. fn: function (){
  54311. var self=this,$self=this;
  54312. return $core.withContext(function($ctx1) {
  54313. var $1;
  54314. $1=$recv($globals.Dictionary)._new();
  54315. $recv($1)._at_put_("new","N");
  54316. return $recv($1)._yourself();
  54317. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54318. },
  54319. args: [],
  54320. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54321. referencedClasses: ["Dictionary"],
  54322. messageSends: ["at:put:", "new", "yourself"]
  54323. }),
  54324. $globals.DictionaryTest);
  54325. $core.addMethod(
  54326. $core.method({
  54327. selector: "samplesDo:",
  54328. protocol: "fixture",
  54329. fn: function (aBlock){
  54330. var self=this,$self=this;
  54331. return $core.withContext(function($ctx1) {
  54332. (
  54333. $ctx1.supercall = true,
  54334. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54335. $ctx1.supercall = false;
  54336. $recv(aBlock)._value_value_(true,(3));
  54337. $ctx1.sendIdx["value:value:"]=1;
  54338. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54339. $ctx1.sendIdx["value:value:"]=2;
  54340. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54341. return self;
  54342. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54343. },
  54344. args: ["aBlock"],
  54345. 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",
  54346. referencedClasses: [],
  54347. messageSends: ["samplesDo:", "value:value:", "@"]
  54348. }),
  54349. $globals.DictionaryTest);
  54350. $core.addMethod(
  54351. $core.method({
  54352. selector: "testAccessing",
  54353. protocol: "tests",
  54354. fn: function (){
  54355. var self=this,$self=this;
  54356. var d;
  54357. return $core.withContext(function($ctx1) {
  54358. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54359. d=$recv($globals.Dictionary)._new();
  54360. $recv(d)._at_put_("hello","world");
  54361. $ctx1.sendIdx["at:put:"]=1;
  54362. $1=$recv(d)._at_("hello");
  54363. $ctx1.sendIdx["at:"]=1;
  54364. $self._assert_equals_($1,"world");
  54365. $ctx1.sendIdx["assert:equals:"]=1;
  54366. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54367. return nil;
  54368. }));
  54369. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54370. $self._assert_equals_($2,"world");
  54371. $ctx1.sendIdx["assert:equals:"]=2;
  54372. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54373. return nil;
  54374. }))).__eq("world"));
  54375. $ctx1.sendIdx["deny:"]=1;
  54376. $3=$recv(d)._includesKey_("hello");
  54377. $ctx1.sendIdx["includesKey:"]=1;
  54378. $self._assert_($3);
  54379. $ctx1.sendIdx["assert:"]=1;
  54380. $4=$recv(d)._includesKey_("foo");
  54381. $ctx1.sendIdx["includesKey:"]=2;
  54382. $self._deny_($4);
  54383. $ctx1.sendIdx["deny:"]=2;
  54384. $recv(d)._at_put_((1),(2));
  54385. $ctx1.sendIdx["at:put:"]=2;
  54386. $5=$recv(d)._at_((1));
  54387. $ctx1.sendIdx["at:"]=2;
  54388. $self._assert_equals_($5,(2));
  54389. $ctx1.sendIdx["assert:equals:"]=3;
  54390. $6=d;
  54391. $7=(1).__at((3));
  54392. $ctx1.sendIdx["@"]=1;
  54393. $recv($6)._at_put_($7,(3));
  54394. $9=d;
  54395. $10=(1).__at((3));
  54396. $ctx1.sendIdx["@"]=2;
  54397. $8=$recv($9)._at_($10);
  54398. $self._assert_equals_($8,(3));
  54399. $12=d;
  54400. $13=(1).__at((3));
  54401. $ctx1.sendIdx["@"]=3;
  54402. $11=$recv($12)._includesKey_($13);
  54403. $ctx1.sendIdx["includesKey:"]=3;
  54404. $self._assert_($11);
  54405. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54406. return self;
  54407. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54408. },
  54409. args: [],
  54410. 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)",
  54411. referencedClasses: ["Dictionary"],
  54412. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54413. }),
  54414. $globals.DictionaryTest);
  54415. $core.addMethod(
  54416. $core.method({
  54417. selector: "testDynamicDictionaries",
  54418. protocol: "tests",
  54419. fn: function (){
  54420. var self=this,$self=this;
  54421. return $core.withContext(function($ctx1) {
  54422. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54423. return self;
  54424. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54425. },
  54426. args: [],
  54427. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54428. referencedClasses: ["Dictionary"],
  54429. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54430. }),
  54431. $globals.DictionaryTest);
  54432. $core.addMethod(
  54433. $core.method({
  54434. selector: "collectionClass",
  54435. protocol: "fixture",
  54436. fn: function (){
  54437. var self=this,$self=this;
  54438. return $globals.Dictionary;
  54439. },
  54440. args: [],
  54441. source: "collectionClass\x0a\x09^ Dictionary",
  54442. referencedClasses: ["Dictionary"],
  54443. messageSends: []
  54444. }),
  54445. $globals.DictionaryTest.a$cls);
  54446. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54447. $core.addMethod(
  54448. $core.method({
  54449. selector: "collection",
  54450. protocol: "fixture",
  54451. fn: function (){
  54452. var self=this,$self=this;
  54453. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54454. },
  54455. args: [],
  54456. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54457. referencedClasses: [],
  54458. messageSends: []
  54459. }),
  54460. $globals.HashedCollectionTest);
  54461. $core.addMethod(
  54462. $core.method({
  54463. selector: "collectionKeys",
  54464. protocol: "fixture",
  54465. fn: function (){
  54466. var self=this,$self=this;
  54467. return ["b","a","c","d"];
  54468. },
  54469. args: [],
  54470. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54471. referencedClasses: [],
  54472. messageSends: []
  54473. }),
  54474. $globals.HashedCollectionTest);
  54475. $core.addMethod(
  54476. $core.method({
  54477. selector: "collectionOfPrintStrings",
  54478. protocol: "fixture",
  54479. fn: function (){
  54480. var self=this,$self=this;
  54481. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54482. },
  54483. args: [],
  54484. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54485. referencedClasses: [],
  54486. messageSends: []
  54487. }),
  54488. $globals.HashedCollectionTest);
  54489. $core.addMethod(
  54490. $core.method({
  54491. selector: "collectionSize",
  54492. protocol: "fixture",
  54493. fn: function (){
  54494. var self=this,$self=this;
  54495. return (4);
  54496. },
  54497. args: [],
  54498. source: "collectionSize\x0a\x09^ 4",
  54499. referencedClasses: [],
  54500. messageSends: []
  54501. }),
  54502. $globals.HashedCollectionTest);
  54503. $core.addMethod(
  54504. $core.method({
  54505. selector: "collectionValues",
  54506. protocol: "fixture",
  54507. fn: function (){
  54508. var self=this,$self=this;
  54509. return [(1),(2),(3),(-4)];
  54510. },
  54511. args: [],
  54512. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54513. referencedClasses: [],
  54514. messageSends: []
  54515. }),
  54516. $globals.HashedCollectionTest);
  54517. $core.addMethod(
  54518. $core.method({
  54519. selector: "collectionWithDuplicates",
  54520. protocol: "fixture",
  54521. fn: function (){
  54522. var self=this,$self=this;
  54523. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54524. },
  54525. args: [],
  54526. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54527. referencedClasses: [],
  54528. messageSends: []
  54529. }),
  54530. $globals.HashedCollectionTest);
  54531. $core.addMethod(
  54532. $core.method({
  54533. selector: "collectionWithNewValue",
  54534. protocol: "fixture",
  54535. fn: function (){
  54536. var self=this,$self=this;
  54537. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54538. },
  54539. args: [],
  54540. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54541. referencedClasses: [],
  54542. messageSends: []
  54543. }),
  54544. $globals.HashedCollectionTest);
  54545. $core.addMethod(
  54546. $core.method({
  54547. selector: "sampleNewValueAsCollection",
  54548. protocol: "fixture",
  54549. fn: function (){
  54550. var self=this,$self=this;
  54551. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54552. },
  54553. args: [],
  54554. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54555. referencedClasses: [],
  54556. messageSends: []
  54557. }),
  54558. $globals.HashedCollectionTest);
  54559. $core.addMethod(
  54560. $core.method({
  54561. selector: "testDynamicDictionaries",
  54562. protocol: "tests",
  54563. fn: function (){
  54564. var self=this,$self=this;
  54565. return $core.withContext(function($ctx1) {
  54566. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54567. return self;
  54568. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54569. },
  54570. args: [],
  54571. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54572. referencedClasses: ["HashedCollection"],
  54573. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54574. }),
  54575. $globals.HashedCollectionTest);
  54576. $core.addMethod(
  54577. $core.method({
  54578. selector: "collectionClass",
  54579. protocol: "fixture",
  54580. fn: function (){
  54581. var self=this,$self=this;
  54582. return $globals.HashedCollection;
  54583. },
  54584. args: [],
  54585. source: "collectionClass\x0a\x09^ HashedCollection",
  54586. referencedClasses: ["HashedCollection"],
  54587. messageSends: []
  54588. }),
  54589. $globals.HashedCollectionTest.a$cls);
  54590. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54591. $core.addMethod(
  54592. $core.method({
  54593. selector: "collectionFirst",
  54594. protocol: "fixture",
  54595. fn: function (){
  54596. var self=this,$self=this;
  54597. return $core.withContext(function($ctx1) {
  54598. $self._subclassResponsibility();
  54599. return self;
  54600. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  54601. },
  54602. args: [],
  54603. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54604. referencedClasses: [],
  54605. messageSends: ["subclassResponsibility"]
  54606. }),
  54607. $globals.SequenceableCollectionTest);
  54608. $core.addMethod(
  54609. $core.method({
  54610. selector: "collectionFirstTwo",
  54611. protocol: "fixture",
  54612. fn: function (){
  54613. var self=this,$self=this;
  54614. return $core.withContext(function($ctx1) {
  54615. $self._subclassResponsibility();
  54616. return self;
  54617. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  54618. },
  54619. args: [],
  54620. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  54621. referencedClasses: [],
  54622. messageSends: ["subclassResponsibility"]
  54623. }),
  54624. $globals.SequenceableCollectionTest);
  54625. $core.addMethod(
  54626. $core.method({
  54627. selector: "collectionLast",
  54628. protocol: "fixture",
  54629. fn: function (){
  54630. var self=this,$self=this;
  54631. return $core.withContext(function($ctx1) {
  54632. $self._subclassResponsibility();
  54633. return self;
  54634. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  54635. },
  54636. args: [],
  54637. source: "collectionLast\x0a\x09self subclassResponsibility",
  54638. referencedClasses: [],
  54639. messageSends: ["subclassResponsibility"]
  54640. }),
  54641. $globals.SequenceableCollectionTest);
  54642. $core.addMethod(
  54643. $core.method({
  54644. selector: "collectionLastTwo",
  54645. protocol: "fixture",
  54646. fn: function (){
  54647. var self=this,$self=this;
  54648. return $core.withContext(function($ctx1) {
  54649. $self._subclassResponsibility();
  54650. return self;
  54651. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  54652. },
  54653. args: [],
  54654. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  54655. referencedClasses: [],
  54656. messageSends: ["subclassResponsibility"]
  54657. }),
  54658. $globals.SequenceableCollectionTest);
  54659. $core.addMethod(
  54660. $core.method({
  54661. selector: "nonIndexesDo:",
  54662. protocol: "fixture",
  54663. fn: function (aBlock){
  54664. var self=this,$self=this;
  54665. return $core.withContext(function($ctx1) {
  54666. $recv(aBlock)._value_((0));
  54667. $ctx1.sendIdx["value:"]=1;
  54668. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  54669. $ctx1.sendIdx["value:"]=2;
  54670. $recv(aBlock)._value_("z");
  54671. return self;
  54672. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54673. },
  54674. args: ["aBlock"],
  54675. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  54676. referencedClasses: [],
  54677. messageSends: ["value:", "+", "collectionSize"]
  54678. }),
  54679. $globals.SequenceableCollectionTest);
  54680. $core.addMethod(
  54681. $core.method({
  54682. selector: "samplesDo:",
  54683. protocol: "fixture",
  54684. fn: function (aBlock){
  54685. var self=this,$self=this;
  54686. return $core.withContext(function($ctx1) {
  54687. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  54688. $ctx1.sendIdx["value:value:"]=1;
  54689. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  54690. return self;
  54691. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54692. },
  54693. args: ["aBlock"],
  54694. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  54695. referencedClasses: [],
  54696. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  54697. }),
  54698. $globals.SequenceableCollectionTest);
  54699. $core.addMethod(
  54700. $core.method({
  54701. selector: "testBeginsWith",
  54702. protocol: "tests",
  54703. fn: function (){
  54704. var self=this,$self=this;
  54705. return $core.withContext(function($ctx1) {
  54706. var $2,$1,$4,$5,$3,$7,$6;
  54707. $2=$self._collection();
  54708. $ctx1.sendIdx["collection"]=1;
  54709. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  54710. $ctx1.sendIdx["beginsWith:"]=1;
  54711. $self._assert_($1);
  54712. $ctx1.sendIdx["assert:"]=1;
  54713. $4=$self._collection();
  54714. $ctx1.sendIdx["collection"]=2;
  54715. $5=$self._collection();
  54716. $ctx1.sendIdx["collection"]=3;
  54717. $3=$recv($4)._beginsWith_($5);
  54718. $ctx1.sendIdx["beginsWith:"]=2;
  54719. $self._assert_($3);
  54720. $ctx1.sendIdx["assert:"]=2;
  54721. $7=$self._collection();
  54722. $ctx1.sendIdx["collection"]=4;
  54723. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  54724. $ctx1.sendIdx["beginsWith:"]=3;
  54725. $self._assert_($6);
  54726. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  54727. return self;
  54728. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  54729. },
  54730. args: [],
  54731. 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)",
  54732. referencedClasses: [],
  54733. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  54734. }),
  54735. $globals.SequenceableCollectionTest);
  54736. $core.addMethod(
  54737. $core.method({
  54738. selector: "testEndsWith",
  54739. protocol: "tests",
  54740. fn: function (){
  54741. var self=this,$self=this;
  54742. return $core.withContext(function($ctx1) {
  54743. var $2,$1,$4,$5,$3,$7,$6;
  54744. $2=$self._collection();
  54745. $ctx1.sendIdx["collection"]=1;
  54746. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  54747. $ctx1.sendIdx["endsWith:"]=1;
  54748. $self._assert_($1);
  54749. $ctx1.sendIdx["assert:"]=1;
  54750. $4=$self._collection();
  54751. $ctx1.sendIdx["collection"]=2;
  54752. $5=$self._collection();
  54753. $ctx1.sendIdx["collection"]=3;
  54754. $3=$recv($4)._endsWith_($5);
  54755. $ctx1.sendIdx["endsWith:"]=2;
  54756. $self._assert_($3);
  54757. $ctx1.sendIdx["assert:"]=2;
  54758. $7=$self._collection();
  54759. $ctx1.sendIdx["collection"]=4;
  54760. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  54761. $ctx1.sendIdx["endsWith:"]=3;
  54762. $self._assert_($6);
  54763. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  54764. return self;
  54765. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  54766. },
  54767. args: [],
  54768. 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)",
  54769. referencedClasses: [],
  54770. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  54771. }),
  54772. $globals.SequenceableCollectionTest);
  54773. $core.addMethod(
  54774. $core.method({
  54775. selector: "testFirst",
  54776. protocol: "tests",
  54777. fn: function (){
  54778. var self=this,$self=this;
  54779. return $core.withContext(function($ctx1) {
  54780. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  54781. return self;
  54782. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  54783. },
  54784. args: [],
  54785. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  54786. referencedClasses: [],
  54787. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  54788. }),
  54789. $globals.SequenceableCollectionTest);
  54790. $core.addMethod(
  54791. $core.method({
  54792. selector: "testFirstN",
  54793. protocol: "tests",
  54794. fn: function (){
  54795. var self=this,$self=this;
  54796. return $core.withContext(function($ctx1) {
  54797. var $2,$1,$4,$3,$6,$5,$7;
  54798. $2=$self._collection();
  54799. $ctx1.sendIdx["collection"]=1;
  54800. $1=$recv($2)._first_((2));
  54801. $ctx1.sendIdx["first:"]=1;
  54802. $self._assert_equals_($1,$self._collectionFirstTwo());
  54803. $ctx1.sendIdx["assert:equals:"]=1;
  54804. $4=$self._collection();
  54805. $ctx1.sendIdx["collection"]=2;
  54806. $3=$recv($4)._first_((0));
  54807. $ctx1.sendIdx["first:"]=2;
  54808. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  54809. $ctx1.sendIdx["assert:equals:"]=2;
  54810. $6=$self._collection();
  54811. $ctx1.sendIdx["collection"]=3;
  54812. $5=$recv($6)._first_($self._collectionSize());
  54813. $ctx1.sendIdx["first:"]=3;
  54814. $7=$self._collection();
  54815. $ctx1.sendIdx["collection"]=4;
  54816. $self._assert_equals_($5,$7);
  54817. $self._should_raise_((function(){
  54818. return $core.withContext(function($ctx2) {
  54819. return $recv($self._collection())._first_((33));
  54820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54821. }),$globals.Error);
  54822. return self;
  54823. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  54824. },
  54825. args: [],
  54826. 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",
  54827. referencedClasses: ["Error"],
  54828. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  54829. }),
  54830. $globals.SequenceableCollectionTest);
  54831. $core.addMethod(
  54832. $core.method({
  54833. selector: "testFourth",
  54834. protocol: "tests",
  54835. fn: function (){
  54836. var self=this,$self=this;
  54837. return $core.withContext(function($ctx1) {
  54838. var $2,$1;
  54839. $2=$self._collection();
  54840. $ctx1.sendIdx["collection"]=1;
  54841. $1=$recv($2)._fourth();
  54842. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  54843. return self;
  54844. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  54845. },
  54846. args: [],
  54847. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  54848. referencedClasses: [],
  54849. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  54850. }),
  54851. $globals.SequenceableCollectionTest);
  54852. $core.addMethod(
  54853. $core.method({
  54854. selector: "testIndexOfStartingAt",
  54855. protocol: "tests",
  54856. fn: function (){
  54857. var self=this,$self=this;
  54858. var jsNull;
  54859. return $core.withContext(function($ctx1) {
  54860. var $2,$1,$4,$3;
  54861. jsNull=$recv($globals.JSON)._parse_("null");
  54862. $self._samplesDo_((function(index,value){
  54863. return $core.withContext(function($ctx2) {
  54864. $2=$self._collection();
  54865. $ctx2.sendIdx["collection"]=1;
  54866. $1=$recv($2)._indexOf_startingAt_(value,(1));
  54867. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  54868. $self._assert_equals_($1,index);
  54869. $ctx2.sendIdx["assert:equals:"]=1;
  54870. $4=$self._collection();
  54871. $ctx2.sendIdx["collection"]=2;
  54872. $3=$recv($4)._indexOf_startingAt_(value,index);
  54873. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  54874. $self._assert_equals_($3,index);
  54875. $ctx2.sendIdx["assert:equals:"]=2;
  54876. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  54877. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54878. }));
  54879. return self;
  54880. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  54881. },
  54882. args: [],
  54883. 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 ]",
  54884. referencedClasses: ["JSON"],
  54885. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  54886. }),
  54887. $globals.SequenceableCollectionTest);
  54888. $core.addMethod(
  54889. $core.method({
  54890. selector: "testIndexOfStartingAtWithNull",
  54891. protocol: "tests",
  54892. fn: function (){
  54893. var self=this,$self=this;
  54894. var jsNull;
  54895. return $core.withContext(function($ctx1) {
  54896. var $1,$2;
  54897. jsNull=$recv($globals.JSON)._parse_("null");
  54898. $self._samplesDo_((function(index,value){
  54899. var collection;
  54900. return $core.withContext(function($ctx2) {
  54901. collection=$self._collection();
  54902. collection;
  54903. $recv(collection)._at_put_(index,jsNull);
  54904. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  54905. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  54906. $self._assert_equals_($1,index);
  54907. $ctx2.sendIdx["assert:equals:"]=1;
  54908. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  54909. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  54910. $self._assert_equals_($2,index);
  54911. $ctx2.sendIdx["assert:equals:"]=2;
  54912. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  54913. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  54914. }));
  54915. return self;
  54916. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  54917. },
  54918. args: [],
  54919. 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 ]",
  54920. referencedClasses: ["JSON"],
  54921. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  54922. }),
  54923. $globals.SequenceableCollectionTest);
  54924. $core.addMethod(
  54925. $core.method({
  54926. selector: "testLast",
  54927. protocol: "tests",
  54928. fn: function (){
  54929. var self=this,$self=this;
  54930. return $core.withContext(function($ctx1) {
  54931. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  54932. return self;
  54933. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  54934. },
  54935. args: [],
  54936. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  54937. referencedClasses: [],
  54938. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  54939. }),
  54940. $globals.SequenceableCollectionTest);
  54941. $core.addMethod(
  54942. $core.method({
  54943. selector: "testLastN",
  54944. protocol: "tests",
  54945. fn: function (){
  54946. var self=this,$self=this;
  54947. return $core.withContext(function($ctx1) {
  54948. var $2,$1,$4,$3,$6,$5,$7;
  54949. $2=$self._collection();
  54950. $ctx1.sendIdx["collection"]=1;
  54951. $1=$recv($2)._last_((2));
  54952. $ctx1.sendIdx["last:"]=1;
  54953. $self._assert_equals_($1,$self._collectionLastTwo());
  54954. $ctx1.sendIdx["assert:equals:"]=1;
  54955. $4=$self._collection();
  54956. $ctx1.sendIdx["collection"]=2;
  54957. $3=$recv($4)._last_((0));
  54958. $ctx1.sendIdx["last:"]=2;
  54959. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  54960. $ctx1.sendIdx["assert:equals:"]=2;
  54961. $6=$self._collection();
  54962. $ctx1.sendIdx["collection"]=3;
  54963. $5=$recv($6)._last_($self._collectionSize());
  54964. $ctx1.sendIdx["last:"]=3;
  54965. $7=$self._collection();
  54966. $ctx1.sendIdx["collection"]=4;
  54967. $self._assert_equals_($5,$7);
  54968. $self._should_raise_((function(){
  54969. return $core.withContext(function($ctx2) {
  54970. return $recv($self._collection())._last_((33));
  54971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54972. }),$globals.Error);
  54973. return self;
  54974. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  54975. },
  54976. args: [],
  54977. 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",
  54978. referencedClasses: ["Error"],
  54979. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  54980. }),
  54981. $globals.SequenceableCollectionTest);
  54982. $core.addMethod(
  54983. $core.method({
  54984. selector: "testSecond",
  54985. protocol: "tests",
  54986. fn: function (){
  54987. var self=this,$self=this;
  54988. return $core.withContext(function($ctx1) {
  54989. var $2,$1;
  54990. $2=$self._collection();
  54991. $ctx1.sendIdx["collection"]=1;
  54992. $1=$recv($2)._second();
  54993. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  54994. return self;
  54995. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  54996. },
  54997. args: [],
  54998. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  54999. referencedClasses: [],
  55000. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55001. }),
  55002. $globals.SequenceableCollectionTest);
  55003. $core.addMethod(
  55004. $core.method({
  55005. selector: "testThird",
  55006. protocol: "tests",
  55007. fn: function (){
  55008. var self=this,$self=this;
  55009. return $core.withContext(function($ctx1) {
  55010. var $2,$1;
  55011. $2=$self._collection();
  55012. $ctx1.sendIdx["collection"]=1;
  55013. $1=$recv($2)._third();
  55014. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55015. return self;
  55016. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55017. },
  55018. args: [],
  55019. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55020. referencedClasses: [],
  55021. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55022. }),
  55023. $globals.SequenceableCollectionTest);
  55024. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55025. $core.addMethod(
  55026. $core.method({
  55027. selector: "collection",
  55028. protocol: "fixture",
  55029. fn: function (){
  55030. var self=this,$self=this;
  55031. return [(1), (2), (3), (-4)];
  55032. },
  55033. args: [],
  55034. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55035. referencedClasses: [],
  55036. messageSends: []
  55037. }),
  55038. $globals.ArrayTest);
  55039. $core.addMethod(
  55040. $core.method({
  55041. selector: "collectionFirst",
  55042. protocol: "fixture",
  55043. fn: function (){
  55044. var self=this,$self=this;
  55045. return (1);
  55046. },
  55047. args: [],
  55048. source: "collectionFirst\x0a\x09^ 1",
  55049. referencedClasses: [],
  55050. messageSends: []
  55051. }),
  55052. $globals.ArrayTest);
  55053. $core.addMethod(
  55054. $core.method({
  55055. selector: "collectionFirstTwo",
  55056. protocol: "fixture",
  55057. fn: function (){
  55058. var self=this,$self=this;
  55059. return [(1), (2)];
  55060. },
  55061. args: [],
  55062. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55063. referencedClasses: [],
  55064. messageSends: []
  55065. }),
  55066. $globals.ArrayTest);
  55067. $core.addMethod(
  55068. $core.method({
  55069. selector: "collectionLast",
  55070. protocol: "fixture",
  55071. fn: function (){
  55072. var self=this,$self=this;
  55073. return (-4);
  55074. },
  55075. args: [],
  55076. source: "collectionLast\x0a\x09^ -4",
  55077. referencedClasses: [],
  55078. messageSends: []
  55079. }),
  55080. $globals.ArrayTest);
  55081. $core.addMethod(
  55082. $core.method({
  55083. selector: "collectionLastTwo",
  55084. protocol: "fixture",
  55085. fn: function (){
  55086. var self=this,$self=this;
  55087. return [(3), (-4)];
  55088. },
  55089. args: [],
  55090. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55091. referencedClasses: [],
  55092. messageSends: []
  55093. }),
  55094. $globals.ArrayTest);
  55095. $core.addMethod(
  55096. $core.method({
  55097. selector: "collectionOfPrintStrings",
  55098. protocol: "fixture",
  55099. fn: function (){
  55100. var self=this,$self=this;
  55101. return ["1", "2", "3", "-4"];
  55102. },
  55103. args: [],
  55104. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55105. referencedClasses: [],
  55106. messageSends: []
  55107. }),
  55108. $globals.ArrayTest);
  55109. $core.addMethod(
  55110. $core.method({
  55111. selector: "collectionSize",
  55112. protocol: "fixture",
  55113. fn: function (){
  55114. var self=this,$self=this;
  55115. return (4);
  55116. },
  55117. args: [],
  55118. source: "collectionSize\x0a\x09^ 4",
  55119. referencedClasses: [],
  55120. messageSends: []
  55121. }),
  55122. $globals.ArrayTest);
  55123. $core.addMethod(
  55124. $core.method({
  55125. selector: "collectionWithDuplicates",
  55126. protocol: "fixture",
  55127. fn: function (){
  55128. var self=this,$self=this;
  55129. return ["a", "b", "c", (1), (2), (1), "a", []];
  55130. },
  55131. args: [],
  55132. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55133. referencedClasses: [],
  55134. messageSends: []
  55135. }),
  55136. $globals.ArrayTest);
  55137. $core.addMethod(
  55138. $core.method({
  55139. selector: "collectionWithNewValue",
  55140. protocol: "fixture",
  55141. fn: function (){
  55142. var self=this,$self=this;
  55143. return [(1), (2), (3), (-4), "N"];
  55144. },
  55145. args: [],
  55146. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55147. referencedClasses: [],
  55148. messageSends: []
  55149. }),
  55150. $globals.ArrayTest);
  55151. $core.addMethod(
  55152. $core.method({
  55153. selector: "sampleNewIndex",
  55154. protocol: "fixture",
  55155. fn: function (){
  55156. var self=this,$self=this;
  55157. return (5);
  55158. },
  55159. args: [],
  55160. source: "sampleNewIndex\x0a\x09^ 5",
  55161. referencedClasses: [],
  55162. messageSends: []
  55163. }),
  55164. $globals.ArrayTest);
  55165. $core.addMethod(
  55166. $core.method({
  55167. selector: "samplesDo:",
  55168. protocol: "fixture",
  55169. fn: function (aBlock){
  55170. var self=this,$self=this;
  55171. return $core.withContext(function($ctx1) {
  55172. (
  55173. $ctx1.supercall = true,
  55174. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55175. $ctx1.supercall = false;
  55176. $recv(aBlock)._value_value_((3),(3));
  55177. return self;
  55178. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55179. },
  55180. args: ["aBlock"],
  55181. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55182. referencedClasses: [],
  55183. messageSends: ["samplesDo:", "value:value:"]
  55184. }),
  55185. $globals.ArrayTest);
  55186. $core.addMethod(
  55187. $core.method({
  55188. selector: "testAdd",
  55189. protocol: "tests",
  55190. fn: function (){
  55191. var self=this,$self=this;
  55192. var array;
  55193. return $core.withContext(function($ctx1) {
  55194. array=$self._collection();
  55195. $recv(array)._add_((6));
  55196. $self._assert_equals_($recv(array)._last(),(6));
  55197. return self;
  55198. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55199. },
  55200. args: [],
  55201. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55202. referencedClasses: [],
  55203. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55204. }),
  55205. $globals.ArrayTest);
  55206. $core.addMethod(
  55207. $core.method({
  55208. selector: "testAddFirst",
  55209. protocol: "tests",
  55210. fn: function (){
  55211. var self=this,$self=this;
  55212. return $core.withContext(function($ctx1) {
  55213. var $3,$2,$1;
  55214. $3=$self._collection();
  55215. $recv($3)._addFirst_((0));
  55216. $2=$recv($3)._yourself();
  55217. $1=$recv($2)._first();
  55218. $self._assert_equals_($1,(0));
  55219. return self;
  55220. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55221. },
  55222. args: [],
  55223. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55224. referencedClasses: [],
  55225. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55226. }),
  55227. $globals.ArrayTest);
  55228. $core.addMethod(
  55229. $core.method({
  55230. selector: "testPrintString",
  55231. protocol: "tests",
  55232. fn: function (){
  55233. var self=this,$self=this;
  55234. var array;
  55235. return $core.withContext(function($ctx1) {
  55236. var $1,$2,$3,$4,$5,$6,$7,$8;
  55237. array=$recv($globals.Array)._new();
  55238. $1=$recv(array)._printString();
  55239. $ctx1.sendIdx["printString"]=1;
  55240. $self._assert_equals_($1,"an Array ()");
  55241. $ctx1.sendIdx["assert:equals:"]=1;
  55242. $2=array;
  55243. $recv($2)._add_((1));
  55244. $ctx1.sendIdx["add:"]=1;
  55245. $3=$recv($2)._add_((3));
  55246. $ctx1.sendIdx["add:"]=2;
  55247. $4=$recv(array)._printString();
  55248. $ctx1.sendIdx["printString"]=2;
  55249. $self._assert_equals_($4,"an Array (1 3)");
  55250. $ctx1.sendIdx["assert:equals:"]=2;
  55251. $recv(array)._add_("foo");
  55252. $5=$recv(array)._printString();
  55253. $ctx1.sendIdx["printString"]=3;
  55254. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55255. $ctx1.sendIdx["assert:equals:"]=3;
  55256. $6=array;
  55257. $recv($6)._remove_((1));
  55258. $ctx1.sendIdx["remove:"]=1;
  55259. $recv($6)._remove_((3));
  55260. $7=$recv(array)._printString();
  55261. $ctx1.sendIdx["printString"]=4;
  55262. $self._assert_equals_($7,"an Array ('foo')");
  55263. $ctx1.sendIdx["assert:equals:"]=4;
  55264. $recv(array)._addLast_((3));
  55265. $ctx1.sendIdx["addLast:"]=1;
  55266. $8=$recv(array)._printString();
  55267. $ctx1.sendIdx["printString"]=5;
  55268. $self._assert_equals_($8,"an Array ('foo' 3)");
  55269. $ctx1.sendIdx["assert:equals:"]=5;
  55270. $recv(array)._addLast_((3));
  55271. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55272. return self;
  55273. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55274. },
  55275. args: [],
  55276. 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)'.",
  55277. referencedClasses: ["Array"],
  55278. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55279. }),
  55280. $globals.ArrayTest);
  55281. $core.addMethod(
  55282. $core.method({
  55283. selector: "testRemove",
  55284. protocol: "tests",
  55285. fn: function (){
  55286. var self=this,$self=this;
  55287. var array;
  55288. return $core.withContext(function($ctx1) {
  55289. array=[(1), (2), (3), (4), (5)];
  55290. $recv(array)._remove_((3));
  55291. $ctx1.sendIdx["remove:"]=1;
  55292. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55293. $self._should_raise_((function(){
  55294. return $core.withContext(function($ctx2) {
  55295. return $recv(array)._remove_((3));
  55296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55297. }),$globals.Error);
  55298. return self;
  55299. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55300. },
  55301. args: [],
  55302. 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",
  55303. referencedClasses: ["Error"],
  55304. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55305. }),
  55306. $globals.ArrayTest);
  55307. $core.addMethod(
  55308. $core.method({
  55309. selector: "testRemoveFromTo",
  55310. protocol: "tests",
  55311. fn: function (){
  55312. var self=this,$self=this;
  55313. return $core.withContext(function($ctx1) {
  55314. var $1,$2;
  55315. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55316. $ctx1.sendIdx["removeFrom:to:"]=1;
  55317. $self._assert_equals_($1,[(4)]);
  55318. $ctx1.sendIdx["assert:equals:"]=1;
  55319. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55320. $ctx1.sendIdx["removeFrom:to:"]=2;
  55321. $self._assert_equals_($2,[(1), (4)]);
  55322. $ctx1.sendIdx["assert:equals:"]=2;
  55323. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55324. return self;
  55325. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55326. },
  55327. args: [],
  55328. 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)",
  55329. referencedClasses: [],
  55330. messageSends: ["assert:equals:", "removeFrom:to:"]
  55331. }),
  55332. $globals.ArrayTest);
  55333. $core.addMethod(
  55334. $core.method({
  55335. selector: "testRemoveIndex",
  55336. protocol: "tests",
  55337. fn: function (){
  55338. var self=this,$self=this;
  55339. return $core.withContext(function($ctx1) {
  55340. var $1,$2;
  55341. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55342. $ctx1.sendIdx["removeIndex:"]=1;
  55343. $self._assert_equals_($1,[(1), (3), (4)]);
  55344. $ctx1.sendIdx["assert:equals:"]=1;
  55345. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55346. $ctx1.sendIdx["removeIndex:"]=2;
  55347. $self._assert_equals_($2,[(2), (3), (4)]);
  55348. $ctx1.sendIdx["assert:equals:"]=2;
  55349. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55350. return self;
  55351. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55352. },
  55353. args: [],
  55354. 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: #()",
  55355. referencedClasses: [],
  55356. messageSends: ["assert:equals:", "removeIndex:"]
  55357. }),
  55358. $globals.ArrayTest);
  55359. $core.addMethod(
  55360. $core.method({
  55361. selector: "testRemoveLast",
  55362. protocol: "tests",
  55363. fn: function (){
  55364. var self=this,$self=this;
  55365. var array;
  55366. return $core.withContext(function($ctx1) {
  55367. array=[(1), (2)];
  55368. $recv(array)._removeLast();
  55369. $self._assert_equals_($recv(array)._last(),(1));
  55370. return self;
  55371. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55372. },
  55373. args: [],
  55374. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55375. referencedClasses: [],
  55376. messageSends: ["removeLast", "assert:equals:", "last"]
  55377. }),
  55378. $globals.ArrayTest);
  55379. $core.addMethod(
  55380. $core.method({
  55381. selector: "testReversed",
  55382. protocol: "tests",
  55383. fn: function (){
  55384. var self=this,$self=this;
  55385. var array;
  55386. return $core.withContext(function($ctx1) {
  55387. array=[(5), (4), (3), (2), (1)];
  55388. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55389. return self;
  55390. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55391. },
  55392. args: [],
  55393. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55394. referencedClasses: [],
  55395. messageSends: ["assert:equals:", "reversed"]
  55396. }),
  55397. $globals.ArrayTest);
  55398. $core.addMethod(
  55399. $core.method({
  55400. selector: "testSort",
  55401. protocol: "tests",
  55402. fn: function (){
  55403. var self=this,$self=this;
  55404. var array;
  55405. return $core.withContext(function($ctx1) {
  55406. array=[(10), (1), (5)];
  55407. $recv(array)._sort();
  55408. $self._assert_equals_(array,[(1), (5), (10)]);
  55409. return self;
  55410. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55411. },
  55412. args: [],
  55413. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55414. referencedClasses: [],
  55415. messageSends: ["sort", "assert:equals:"]
  55416. }),
  55417. $globals.ArrayTest);
  55418. $core.addMethod(
  55419. $core.method({
  55420. selector: "collectionClass",
  55421. protocol: "fixture",
  55422. fn: function (){
  55423. var self=this,$self=this;
  55424. return $globals.Array;
  55425. },
  55426. args: [],
  55427. source: "collectionClass\x0a\x09^ Array",
  55428. referencedClasses: ["Array"],
  55429. messageSends: []
  55430. }),
  55431. $globals.ArrayTest.a$cls);
  55432. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55433. $core.addMethod(
  55434. $core.method({
  55435. selector: "collection",
  55436. protocol: "fixture",
  55437. fn: function (){
  55438. var self=this,$self=this;
  55439. return "helLo";
  55440. },
  55441. args: [],
  55442. source: "collection\x0a\x09^ 'helLo'",
  55443. referencedClasses: [],
  55444. messageSends: []
  55445. }),
  55446. $globals.StringTest);
  55447. $core.addMethod(
  55448. $core.method({
  55449. selector: "collectionFirst",
  55450. protocol: "fixture",
  55451. fn: function (){
  55452. var self=this,$self=this;
  55453. return "h";
  55454. },
  55455. args: [],
  55456. source: "collectionFirst\x0a\x09^ 'h'",
  55457. referencedClasses: [],
  55458. messageSends: []
  55459. }),
  55460. $globals.StringTest);
  55461. $core.addMethod(
  55462. $core.method({
  55463. selector: "collectionFirstTwo",
  55464. protocol: "fixture",
  55465. fn: function (){
  55466. var self=this,$self=this;
  55467. return "he";
  55468. },
  55469. args: [],
  55470. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55471. referencedClasses: [],
  55472. messageSends: []
  55473. }),
  55474. $globals.StringTest);
  55475. $core.addMethod(
  55476. $core.method({
  55477. selector: "collectionLast",
  55478. protocol: "fixture",
  55479. fn: function (){
  55480. var self=this,$self=this;
  55481. return "o";
  55482. },
  55483. args: [],
  55484. source: "collectionLast\x0a\x09^ 'o'",
  55485. referencedClasses: [],
  55486. messageSends: []
  55487. }),
  55488. $globals.StringTest);
  55489. $core.addMethod(
  55490. $core.method({
  55491. selector: "collectionLastTwo",
  55492. protocol: "fixture",
  55493. fn: function (){
  55494. var self=this,$self=this;
  55495. return "Lo";
  55496. },
  55497. args: [],
  55498. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55499. referencedClasses: [],
  55500. messageSends: []
  55501. }),
  55502. $globals.StringTest);
  55503. $core.addMethod(
  55504. $core.method({
  55505. selector: "collectionOfPrintStrings",
  55506. protocol: "fixture",
  55507. fn: function (){
  55508. var self=this,$self=this;
  55509. return "'h''e''l''L''o'";
  55510. },
  55511. args: [],
  55512. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55513. referencedClasses: [],
  55514. messageSends: []
  55515. }),
  55516. $globals.StringTest);
  55517. $core.addMethod(
  55518. $core.method({
  55519. selector: "collectionSize",
  55520. protocol: "fixture",
  55521. fn: function (){
  55522. var self=this,$self=this;
  55523. return (5);
  55524. },
  55525. args: [],
  55526. source: "collectionSize\x0a\x09^ 5",
  55527. referencedClasses: [],
  55528. messageSends: []
  55529. }),
  55530. $globals.StringTest);
  55531. $core.addMethod(
  55532. $core.method({
  55533. selector: "collectionWithDuplicates",
  55534. protocol: "fixture",
  55535. fn: function (){
  55536. var self=this,$self=this;
  55537. return "abbaerten";
  55538. },
  55539. args: [],
  55540. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55541. referencedClasses: [],
  55542. messageSends: []
  55543. }),
  55544. $globals.StringTest);
  55545. $core.addMethod(
  55546. $core.method({
  55547. selector: "collectionWithNewValue",
  55548. protocol: "fixture",
  55549. fn: function (){
  55550. var self=this,$self=this;
  55551. return "helLoN";
  55552. },
  55553. args: [],
  55554. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55555. referencedClasses: [],
  55556. messageSends: []
  55557. }),
  55558. $globals.StringTest);
  55559. $core.addMethod(
  55560. $core.method({
  55561. selector: "sampleNewValueAsCollection",
  55562. protocol: "fixture",
  55563. fn: function (){
  55564. var self=this,$self=this;
  55565. return "N";
  55566. },
  55567. args: [],
  55568. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55569. referencedClasses: [],
  55570. messageSends: []
  55571. }),
  55572. $globals.StringTest);
  55573. $core.addMethod(
  55574. $core.method({
  55575. selector: "samplesDo:",
  55576. protocol: "fixture",
  55577. fn: function (aBlock){
  55578. var self=this,$self=this;
  55579. return $core.withContext(function($ctx1) {
  55580. (
  55581. $ctx1.supercall = true,
  55582. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55583. $ctx1.supercall = false;
  55584. $recv(aBlock)._value_value_((3),"l");
  55585. return self;
  55586. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  55587. },
  55588. args: ["aBlock"],
  55589. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55590. referencedClasses: [],
  55591. messageSends: ["samplesDo:", "value:value:"]
  55592. }),
  55593. $globals.StringTest);
  55594. $core.addMethod(
  55595. $core.method({
  55596. selector: "testAddAll",
  55597. protocol: "tests",
  55598. fn: function (){
  55599. var self=this,$self=this;
  55600. return $core.withContext(function($ctx1) {
  55601. var $1;
  55602. $self._should_raise_((function(){
  55603. return $core.withContext(function($ctx2) {
  55604. $1=$self._collection();
  55605. $ctx2.sendIdx["collection"]=1;
  55606. return $recv($1)._addAll_($self._collection());
  55607. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55608. }),$globals.Error);
  55609. return self;
  55610. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  55611. },
  55612. args: [],
  55613. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  55614. referencedClasses: ["Error"],
  55615. messageSends: ["should:raise:", "addAll:", "collection"]
  55616. }),
  55617. $globals.StringTest);
  55618. $core.addMethod(
  55619. $core.method({
  55620. selector: "testAddRemove",
  55621. protocol: "tests",
  55622. fn: function (){
  55623. var self=this,$self=this;
  55624. return $core.withContext(function($ctx1) {
  55625. $self._should_raise_((function(){
  55626. return $core.withContext(function($ctx2) {
  55627. return "hello"._add_("a");
  55628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55629. }),$globals.Error);
  55630. $ctx1.sendIdx["should:raise:"]=1;
  55631. $self._should_raise_((function(){
  55632. return $core.withContext(function($ctx2) {
  55633. return "hello"._remove_("h");
  55634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55635. }),$globals.Error);
  55636. return self;
  55637. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  55638. },
  55639. args: [],
  55640. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  55641. referencedClasses: ["Error"],
  55642. messageSends: ["should:raise:", "add:", "remove:"]
  55643. }),
  55644. $globals.StringTest);
  55645. $core.addMethod(
  55646. $core.method({
  55647. selector: "testAsArray",
  55648. protocol: "tests",
  55649. fn: function (){
  55650. var self=this,$self=this;
  55651. return $core.withContext(function($ctx1) {
  55652. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  55653. return self;
  55654. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  55655. },
  55656. args: [],
  55657. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  55658. referencedClasses: [],
  55659. messageSends: ["assert:equals:", "asArray"]
  55660. }),
  55661. $globals.StringTest);
  55662. $core.addMethod(
  55663. $core.method({
  55664. selector: "testAsLowerCase",
  55665. protocol: "tests",
  55666. fn: function (){
  55667. var self=this,$self=this;
  55668. return $core.withContext(function($ctx1) {
  55669. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  55670. return self;
  55671. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  55672. },
  55673. args: [],
  55674. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  55675. referencedClasses: [],
  55676. messageSends: ["assert:equals:", "asLowercase"]
  55677. }),
  55678. $globals.StringTest);
  55679. $core.addMethod(
  55680. $core.method({
  55681. selector: "testAsNumber",
  55682. protocol: "tests",
  55683. fn: function (){
  55684. var self=this,$self=this;
  55685. return $core.withContext(function($ctx1) {
  55686. var $1,$2;
  55687. $1="3"._asNumber();
  55688. $ctx1.sendIdx["asNumber"]=1;
  55689. $self._assert_equals_($1,(3));
  55690. $ctx1.sendIdx["assert:equals:"]=1;
  55691. $2="-3"._asNumber();
  55692. $ctx1.sendIdx["asNumber"]=2;
  55693. $self._assert_equals_($2,(-3));
  55694. $ctx1.sendIdx["assert:equals:"]=2;
  55695. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  55696. return self;
  55697. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  55698. },
  55699. args: [],
  55700. 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.",
  55701. referencedClasses: [],
  55702. messageSends: ["assert:equals:", "asNumber"]
  55703. }),
  55704. $globals.StringTest);
  55705. $core.addMethod(
  55706. $core.method({
  55707. selector: "testAsUpperCase",
  55708. protocol: "tests",
  55709. fn: function (){
  55710. var self=this,$self=this;
  55711. return $core.withContext(function($ctx1) {
  55712. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  55713. return self;
  55714. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  55715. },
  55716. args: [],
  55717. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  55718. referencedClasses: [],
  55719. messageSends: ["assert:equals:", "asUppercase"]
  55720. }),
  55721. $globals.StringTest);
  55722. $core.addMethod(
  55723. $core.method({
  55724. selector: "testAsciiValue",
  55725. protocol: "tests",
  55726. fn: function (){
  55727. var self=this,$self=this;
  55728. var characterA,characterU;
  55729. return $core.withContext(function($ctx1) {
  55730. var $1;
  55731. characterA="A";
  55732. characterU="U";
  55733. $1=$recv(characterA)._asciiValue();
  55734. $ctx1.sendIdx["asciiValue"]=1;
  55735. $self._assert_equals_($1,(65));
  55736. $ctx1.sendIdx["assert:equals:"]=1;
  55737. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  55738. return self;
  55739. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  55740. },
  55741. args: [],
  55742. 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",
  55743. referencedClasses: [],
  55744. messageSends: ["assert:equals:", "asciiValue"]
  55745. }),
  55746. $globals.StringTest);
  55747. $core.addMethod(
  55748. $core.method({
  55749. selector: "testAtIfAbsentPut",
  55750. protocol: "tests",
  55751. fn: function (){
  55752. var self=this,$self=this;
  55753. return $core.withContext(function($ctx1) {
  55754. $self._should_raise_((function(){
  55755. return $core.withContext(function($ctx2) {
  55756. return "hello"._at_ifAbsentPut_((6),(function(){
  55757. return "a";
  55758. }));
  55759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55760. }),$globals.Error);
  55761. return self;
  55762. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  55763. },
  55764. args: [],
  55765. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  55766. referencedClasses: ["Error"],
  55767. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  55768. }),
  55769. $globals.StringTest);
  55770. $core.addMethod(
  55771. $core.method({
  55772. selector: "testAtPut",
  55773. protocol: "tests",
  55774. fn: function (){
  55775. var self=this,$self=this;
  55776. return $core.withContext(function($ctx1) {
  55777. $self._should_raise_((function(){
  55778. return $core.withContext(function($ctx2) {
  55779. return "hello"._at_put_((1),"a");
  55780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55781. }),$globals.Error);
  55782. return self;
  55783. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  55784. },
  55785. args: [],
  55786. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  55787. referencedClasses: ["Error"],
  55788. messageSends: ["should:raise:", "at:put:"]
  55789. }),
  55790. $globals.StringTest);
  55791. $core.addMethod(
  55792. $core.method({
  55793. selector: "testCapitalized",
  55794. protocol: "tests",
  55795. fn: function (){
  55796. var self=this,$self=this;
  55797. return $core.withContext(function($ctx1) {
  55798. var $1,$2,$3;
  55799. $1="test"._capitalized();
  55800. $ctx1.sendIdx["capitalized"]=1;
  55801. $self._assert_equals_($1,"Test");
  55802. $ctx1.sendIdx["assert:equals:"]=1;
  55803. $2="Test"._capitalized();
  55804. $ctx1.sendIdx["capitalized"]=2;
  55805. $self._assert_equals_($2,"Test");
  55806. $ctx1.sendIdx["assert:equals:"]=2;
  55807. $self._assert_equals_(""._capitalized(),"");
  55808. $ctx1.sendIdx["assert:equals:"]=3;
  55809. $3="Test"._isCapitalized();
  55810. $ctx1.sendIdx["isCapitalized"]=1;
  55811. $self._assert_equals_($3,true);
  55812. $ctx1.sendIdx["assert:equals:"]=4;
  55813. $self._assert_equals_("test"._isCapitalized(),false);
  55814. return self;
  55815. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  55816. },
  55817. args: [],
  55818. 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.",
  55819. referencedClasses: [],
  55820. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  55821. }),
  55822. $globals.StringTest);
  55823. $core.addMethod(
  55824. $core.method({
  55825. selector: "testCharCodeAt",
  55826. protocol: "tests",
  55827. fn: function (){
  55828. var self=this,$self=this;
  55829. return $core.withContext(function($ctx1) {
  55830. var $1,$2,$3,$4,$5;
  55831. $1="jackie"._charCodeAt_((1));
  55832. $ctx1.sendIdx["charCodeAt:"]=1;
  55833. $self._assert_equals_($1,(106));
  55834. $ctx1.sendIdx["assert:equals:"]=1;
  55835. $2="jackie"._charCodeAt_((2));
  55836. $ctx1.sendIdx["charCodeAt:"]=2;
  55837. $self._assert_equals_($2,(97));
  55838. $ctx1.sendIdx["assert:equals:"]=2;
  55839. $3="jackie"._charCodeAt_((3));
  55840. $ctx1.sendIdx["charCodeAt:"]=3;
  55841. $self._assert_equals_($3,(99));
  55842. $ctx1.sendIdx["assert:equals:"]=3;
  55843. $4="jackie"._charCodeAt_((4));
  55844. $ctx1.sendIdx["charCodeAt:"]=4;
  55845. $self._assert_equals_($4,(107));
  55846. $ctx1.sendIdx["assert:equals:"]=4;
  55847. $5="jackie"._charCodeAt_((5));
  55848. $ctx1.sendIdx["charCodeAt:"]=5;
  55849. $self._assert_equals_($5,(105));
  55850. $ctx1.sendIdx["assert:equals:"]=5;
  55851. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  55852. return self;
  55853. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  55854. },
  55855. args: [],
  55856. 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",
  55857. referencedClasses: [],
  55858. messageSends: ["assert:equals:", "charCodeAt:"]
  55859. }),
  55860. $globals.StringTest);
  55861. $core.addMethod(
  55862. $core.method({
  55863. selector: "testCopyFromTo",
  55864. protocol: "tests",
  55865. fn: function (){
  55866. var self=this,$self=this;
  55867. return $core.withContext(function($ctx1) {
  55868. var $1;
  55869. $1="jackie"._copyFrom_to_((1),(3));
  55870. $ctx1.sendIdx["copyFrom:to:"]=1;
  55871. $self._assert_equals_($1,"jac");
  55872. $ctx1.sendIdx["assert:equals:"]=1;
  55873. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  55874. return self;
  55875. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  55876. },
  55877. args: [],
  55878. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  55879. referencedClasses: [],
  55880. messageSends: ["assert:equals:", "copyFrom:to:"]
  55881. }),
  55882. $globals.StringTest);
  55883. $core.addMethod(
  55884. $core.method({
  55885. selector: "testCopySeparates",
  55886. protocol: "tests",
  55887. fn: function (){
  55888. var self=this,$self=this;
  55889. return $core.withContext(function($ctx1) {
  55890. var $3,$2,$1;
  55891. $3=$self._collection();
  55892. $ctx1.sendIdx["collection"]=1;
  55893. $2=$recv($3)._copy();
  55894. $1=$recv($2).__eq_eq($self._collection());
  55895. $self._assert_($1);
  55896. return self;
  55897. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  55898. },
  55899. args: [],
  55900. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  55901. referencedClasses: [],
  55902. messageSends: ["assert:", "==", "copy", "collection"]
  55903. }),
  55904. $globals.StringTest);
  55905. $core.addMethod(
  55906. $core.method({
  55907. selector: "testCopyWithoutAll",
  55908. protocol: "tests",
  55909. fn: function (){
  55910. var self=this,$self=this;
  55911. return $core.withContext(function($ctx1) {
  55912. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  55913. return self;
  55914. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  55915. },
  55916. args: [],
  55917. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  55918. referencedClasses: [],
  55919. messageSends: ["assert:equals:", "copyWithoutAll:"]
  55920. }),
  55921. $globals.StringTest);
  55922. $core.addMethod(
  55923. $core.method({
  55924. selector: "testEquality",
  55925. protocol: "tests",
  55926. fn: function (){
  55927. var self=this,$self=this;
  55928. return $core.withContext(function($ctx1) {
  55929. var $1,$2,$3;
  55930. $self._assert_equals_("hello","hello");
  55931. $ctx1.sendIdx["assert:equals:"]=1;
  55932. $1="hello".__eq("world");
  55933. $ctx1.sendIdx["="]=1;
  55934. $self._deny_($1);
  55935. $ctx1.sendIdx["deny:"]=1;
  55936. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  55937. })));
  55938. $ctx1.sendIdx["="]=2;
  55939. $self._deny_($2);
  55940. $ctx1.sendIdx["deny:"]=2;
  55941. $3="hello"._yourself();
  55942. $ctx1.sendIdx["yourself"]=1;
  55943. $self._assert_equals_("hello",$3);
  55944. $ctx1.sendIdx["assert:equals:"]=2;
  55945. $self._assert_equals_("hello"._yourself(),"hello");
  55946. $self._deny_("".__eq((0)));
  55947. return self;
  55948. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  55949. },
  55950. args: [],
  55951. 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",
  55952. referencedClasses: [],
  55953. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  55954. }),
  55955. $globals.StringTest);
  55956. $core.addMethod(
  55957. $core.method({
  55958. selector: "testIdentity",
  55959. protocol: "tests",
  55960. fn: function (){
  55961. var self=this,$self=this;
  55962. return $core.withContext(function($ctx1) {
  55963. var $1,$2,$4,$3,$5;
  55964. $1="hello".__eq_eq("hello");
  55965. $ctx1.sendIdx["=="]=1;
  55966. $self._assert_($1);
  55967. $ctx1.sendIdx["assert:"]=1;
  55968. $2="hello".__eq_eq("world");
  55969. $ctx1.sendIdx["=="]=2;
  55970. $self._deny_($2);
  55971. $ctx1.sendIdx["deny:"]=1;
  55972. $4="hello"._yourself();
  55973. $ctx1.sendIdx["yourself"]=1;
  55974. $3="hello".__eq_eq($4);
  55975. $ctx1.sendIdx["=="]=3;
  55976. $self._assert_($3);
  55977. $ctx1.sendIdx["assert:"]=2;
  55978. $5=$recv("hello"._yourself()).__eq_eq("hello");
  55979. $ctx1.sendIdx["=="]=4;
  55980. $self._assert_($5);
  55981. $self._deny_("".__eq_eq((0)));
  55982. return self;
  55983. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  55984. },
  55985. args: [],
  55986. 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",
  55987. referencedClasses: [],
  55988. messageSends: ["assert:", "==", "deny:", "yourself"]
  55989. }),
  55990. $globals.StringTest);
  55991. $core.addMethod(
  55992. $core.method({
  55993. selector: "testIncludesSubString",
  55994. protocol: "tests",
  55995. fn: function (){
  55996. var self=this,$self=this;
  55997. return $core.withContext(function($ctx1) {
  55998. var $1;
  55999. $1="amber"._includesSubString_("ber");
  56000. $ctx1.sendIdx["includesSubString:"]=1;
  56001. $self._assert_($1);
  56002. $self._deny_("amber"._includesSubString_("zork"));
  56003. return self;
  56004. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56005. },
  56006. args: [],
  56007. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56008. referencedClasses: [],
  56009. messageSends: ["assert:", "includesSubString:", "deny:"]
  56010. }),
  56011. $globals.StringTest);
  56012. $core.addMethod(
  56013. $core.method({
  56014. selector: "testIndexOfStartingAtWithNull",
  56015. protocol: "tests",
  56016. fn: function (){
  56017. var self=this,$self=this;
  56018. return self;
  56019. },
  56020. args: [],
  56021. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56022. referencedClasses: [],
  56023. messageSends: []
  56024. }),
  56025. $globals.StringTest);
  56026. $core.addMethod(
  56027. $core.method({
  56028. selector: "testIndexOfWithNull",
  56029. protocol: "tests",
  56030. fn: function (){
  56031. var self=this,$self=this;
  56032. return self;
  56033. },
  56034. args: [],
  56035. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56036. referencedClasses: [],
  56037. messageSends: []
  56038. }),
  56039. $globals.StringTest);
  56040. $core.addMethod(
  56041. $core.method({
  56042. selector: "testIsVowel",
  56043. protocol: "tests",
  56044. fn: function (){
  56045. var self=this,$self=this;
  56046. var vowel,consonant;
  56047. return $core.withContext(function($ctx1) {
  56048. var $1;
  56049. vowel="u";
  56050. consonant="z";
  56051. $1=$recv(vowel)._isVowel();
  56052. $ctx1.sendIdx["isVowel"]=1;
  56053. $self._assert_equals_($1,true);
  56054. $ctx1.sendIdx["assert:equals:"]=1;
  56055. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56056. return self;
  56057. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56058. },
  56059. args: [],
  56060. 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",
  56061. referencedClasses: [],
  56062. messageSends: ["assert:equals:", "isVowel"]
  56063. }),
  56064. $globals.StringTest);
  56065. $core.addMethod(
  56066. $core.method({
  56067. selector: "testJoin",
  56068. protocol: "tests",
  56069. fn: function (){
  56070. var self=this,$self=this;
  56071. return $core.withContext(function($ctx1) {
  56072. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56073. return self;
  56074. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56075. },
  56076. args: [],
  56077. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56078. referencedClasses: [],
  56079. messageSends: ["assert:equals:", "join:"]
  56080. }),
  56081. $globals.StringTest);
  56082. $core.addMethod(
  56083. $core.method({
  56084. selector: "testRegression1224",
  56085. protocol: "tests",
  56086. fn: function (){
  56087. var self=this,$self=this;
  56088. return $core.withContext(function($ctx1) {
  56089. var $2,$1;
  56090. $self._should_raise_((function(){
  56091. return $core.withContext(function($ctx2) {
  56092. $2=$recv($self._collectionClass())._new();
  56093. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56094. }));
  56095. $1=$recv($2)._yourself();
  56096. return $recv($1)._size();
  56097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56098. }),$globals.Error);
  56099. return self;
  56100. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56101. },
  56102. args: [],
  56103. 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",
  56104. referencedClasses: ["Error"],
  56105. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56106. }),
  56107. $globals.StringTest);
  56108. $core.addMethod(
  56109. $core.method({
  56110. selector: "testRemoveAll",
  56111. protocol: "tests",
  56112. fn: function (){
  56113. var self=this,$self=this;
  56114. return $core.withContext(function($ctx1) {
  56115. $self._should_raise_((function(){
  56116. return $core.withContext(function($ctx2) {
  56117. return $recv($self._collection())._removeAll();
  56118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56119. }),$globals.Error);
  56120. return self;
  56121. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56122. },
  56123. args: [],
  56124. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56125. referencedClasses: ["Error"],
  56126. messageSends: ["should:raise:", "removeAll", "collection"]
  56127. }),
  56128. $globals.StringTest);
  56129. $core.addMethod(
  56130. $core.method({
  56131. selector: "testReversed",
  56132. protocol: "tests",
  56133. fn: function (){
  56134. var self=this,$self=this;
  56135. return $core.withContext(function($ctx1) {
  56136. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56137. return self;
  56138. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56139. },
  56140. args: [],
  56141. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56142. referencedClasses: [],
  56143. messageSends: ["assert:equals:", "reversed"]
  56144. }),
  56145. $globals.StringTest);
  56146. $core.addMethod(
  56147. $core.method({
  56148. selector: "testStreamContents",
  56149. protocol: "tests",
  56150. fn: function (){
  56151. var self=this,$self=this;
  56152. return $core.withContext(function($ctx1) {
  56153. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56154. return $core.withContext(function($ctx2) {
  56155. $recv(aStream)._nextPutAll_("hello");
  56156. $ctx2.sendIdx["nextPutAll:"]=1;
  56157. $recv(aStream)._space();
  56158. return $recv(aStream)._nextPutAll_("world");
  56159. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56160. })),"hello world");
  56161. return self;
  56162. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56163. },
  56164. args: [],
  56165. 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'",
  56166. referencedClasses: ["String"],
  56167. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56168. }),
  56169. $globals.StringTest);
  56170. $core.addMethod(
  56171. $core.method({
  56172. selector: "testSubStrings",
  56173. protocol: "tests",
  56174. fn: function (){
  56175. var self=this,$self=this;
  56176. return $core.withContext(function($ctx1) {
  56177. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56178. return self;
  56179. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56180. },
  56181. args: [],
  56182. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56183. referencedClasses: [],
  56184. messageSends: ["assert:equals:", "subStrings:"]
  56185. }),
  56186. $globals.StringTest);
  56187. $core.addMethod(
  56188. $core.method({
  56189. selector: "testTrim",
  56190. protocol: "tests",
  56191. fn: function (){
  56192. var self=this,$self=this;
  56193. return $core.withContext(function($ctx1) {
  56194. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56195. $ctx1.sendIdx["assert:equals:"]=1;
  56196. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56197. return self;
  56198. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56199. },
  56200. args: [],
  56201. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56202. referencedClasses: [],
  56203. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56204. }),
  56205. $globals.StringTest);
  56206. $core.addMethod(
  56207. $core.method({
  56208. selector: "testValue",
  56209. protocol: "tests",
  56210. fn: function (){
  56211. var self=this,$self=this;
  56212. return $core.withContext(function($ctx1) {
  56213. $self._assert_equals_("asString"._value_((1)),"1");
  56214. $ctx1.sendIdx["assert:equals:"]=1;
  56215. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56216. return self;
  56217. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56218. },
  56219. args: [],
  56220. 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')",
  56221. referencedClasses: [],
  56222. messageSends: ["assert:equals:", "value:", "collect:"]
  56223. }),
  56224. $globals.StringTest);
  56225. $core.addMethod(
  56226. $core.method({
  56227. selector: "collectionClass",
  56228. protocol: "fixture",
  56229. fn: function (){
  56230. var self=this,$self=this;
  56231. return $globals.String;
  56232. },
  56233. args: [],
  56234. source: "collectionClass\x0a\x09^ String",
  56235. referencedClasses: ["String"],
  56236. messageSends: []
  56237. }),
  56238. $globals.StringTest.a$cls);
  56239. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56240. $core.addMethod(
  56241. $core.method({
  56242. selector: "collection",
  56243. protocol: "fixture",
  56244. fn: function (){
  56245. var self=this,$self=this;
  56246. return $core.withContext(function($ctx1) {
  56247. var $1;
  56248. $1=$recv($globals.Set)._new();
  56249. $recv($1)._add_($globals.Smalltalk);
  56250. $ctx1.sendIdx["add:"]=1;
  56251. $recv($1)._add_(nil);
  56252. $ctx1.sendIdx["add:"]=2;
  56253. $recv($1)._add_((3).__at((3)));
  56254. $ctx1.sendIdx["add:"]=3;
  56255. $recv($1)._add_(false);
  56256. $ctx1.sendIdx["add:"]=4;
  56257. $recv($1)._add_($self["@sampleBlock"]);
  56258. return $recv($1)._yourself();
  56259. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56260. },
  56261. args: [],
  56262. 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",
  56263. referencedClasses: ["Set", "Smalltalk"],
  56264. messageSends: ["add:", "new", "@", "yourself"]
  56265. }),
  56266. $globals.SetTest);
  56267. $core.addMethod(
  56268. $core.method({
  56269. selector: "collectionOfPrintStrings",
  56270. protocol: "fixture",
  56271. fn: function (){
  56272. var self=this,$self=this;
  56273. return $core.withContext(function($ctx1) {
  56274. var $1;
  56275. $1=$recv($globals.Set)._new();
  56276. $recv($1)._add_("a SmalltalkImage");
  56277. $ctx1.sendIdx["add:"]=1;
  56278. $recv($1)._add_("nil");
  56279. $ctx1.sendIdx["add:"]=2;
  56280. $recv($1)._add_("3@3");
  56281. $ctx1.sendIdx["add:"]=3;
  56282. $recv($1)._add_("false");
  56283. $ctx1.sendIdx["add:"]=4;
  56284. $recv($1)._add_("a BlockClosure");
  56285. return $recv($1)._yourself();
  56286. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56287. },
  56288. args: [],
  56289. 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",
  56290. referencedClasses: ["Set"],
  56291. messageSends: ["add:", "new", "yourself"]
  56292. }),
  56293. $globals.SetTest);
  56294. $core.addMethod(
  56295. $core.method({
  56296. selector: "collectionSize",
  56297. protocol: "fixture",
  56298. fn: function (){
  56299. var self=this,$self=this;
  56300. return (5);
  56301. },
  56302. args: [],
  56303. source: "collectionSize\x0a\x09^ 5",
  56304. referencedClasses: [],
  56305. messageSends: []
  56306. }),
  56307. $globals.SetTest);
  56308. $core.addMethod(
  56309. $core.method({
  56310. selector: "collectionWithDuplicates",
  56311. protocol: "fixture",
  56312. fn: function (){
  56313. var self=this,$self=this;
  56314. return $core.withContext(function($ctx1) {
  56315. var $1;
  56316. $1=$self._collection();
  56317. $recv($1)._add_((0));
  56318. return $recv($1)._yourself();
  56319. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56320. },
  56321. args: [],
  56322. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56323. referencedClasses: [],
  56324. messageSends: ["add:", "collection", "yourself"]
  56325. }),
  56326. $globals.SetTest);
  56327. $core.addMethod(
  56328. $core.method({
  56329. selector: "collectionWithNewValue",
  56330. protocol: "fixture",
  56331. fn: function (){
  56332. var self=this,$self=this;
  56333. return $core.withContext(function($ctx1) {
  56334. var $1;
  56335. $1=$recv($globals.Set)._new();
  56336. $recv($1)._add_($globals.Smalltalk);
  56337. $ctx1.sendIdx["add:"]=1;
  56338. $recv($1)._add_(nil);
  56339. $ctx1.sendIdx["add:"]=2;
  56340. $recv($1)._add_((3).__at((3)));
  56341. $ctx1.sendIdx["add:"]=3;
  56342. $recv($1)._add_("N");
  56343. $ctx1.sendIdx["add:"]=4;
  56344. $recv($1)._add_(false);
  56345. $ctx1.sendIdx["add:"]=5;
  56346. $recv($1)._add_($self["@sampleBlock"]);
  56347. return $recv($1)._yourself();
  56348. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56349. },
  56350. args: [],
  56351. 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",
  56352. referencedClasses: ["Set", "Smalltalk"],
  56353. messageSends: ["add:", "new", "@", "yourself"]
  56354. }),
  56355. $globals.SetTest);
  56356. $core.addMethod(
  56357. $core.method({
  56358. selector: "testAddAll",
  56359. protocol: "tests",
  56360. fn: function (){
  56361. var self=this,$self=this;
  56362. return $core.withContext(function($ctx1) {
  56363. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56364. (
  56365. $ctx1.supercall = true,
  56366. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56367. $ctx1.supercall = false;
  56368. $2=$self._collection();
  56369. $ctx1.sendIdx["collection"]=1;
  56370. $3=$self._collection();
  56371. $ctx1.sendIdx["collection"]=2;
  56372. $recv($2)._addAll_($3);
  56373. $ctx1.sendIdx["addAll:"]=1;
  56374. $4=$recv($2)._yourself();
  56375. $ctx1.sendIdx["yourself"]=1;
  56376. $1=$4;
  56377. $5=$self._collection();
  56378. $ctx1.sendIdx["collection"]=3;
  56379. $self._assert_equals_($1,$5);
  56380. $ctx1.sendIdx["assert:equals:"]=1;
  56381. $7=$self._collection();
  56382. $ctx1.sendIdx["collection"]=4;
  56383. $8=$self._collectionWithNewValue();
  56384. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56385. $recv($7)._addAll_($8);
  56386. $ctx1.sendIdx["addAll:"]=2;
  56387. $9=$recv($7)._yourself();
  56388. $ctx1.sendIdx["yourself"]=2;
  56389. $6=$9;
  56390. $10=$self._collectionWithNewValue();
  56391. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56392. $self._assert_equals_($6,$10);
  56393. $ctx1.sendIdx["assert:equals:"]=2;
  56394. $12=$self._collectionWithNewValue();
  56395. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56396. $recv($12)._addAll_($self._collection());
  56397. $11=$recv($12)._yourself();
  56398. $self._assert_equals_($11,$self._collectionWithNewValue());
  56399. return self;
  56400. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56401. },
  56402. args: [],
  56403. 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",
  56404. referencedClasses: [],
  56405. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56406. }),
  56407. $globals.SetTest);
  56408. $core.addMethod(
  56409. $core.method({
  56410. selector: "testAddRemove",
  56411. protocol: "tests",
  56412. fn: function (){
  56413. var self=this,$self=this;
  56414. var set;
  56415. return $core.withContext(function($ctx1) {
  56416. var $1,$2;
  56417. set=$recv($globals.Set)._new();
  56418. $self._assert_($recv(set)._isEmpty());
  56419. $ctx1.sendIdx["assert:"]=1;
  56420. $recv(set)._add_((3));
  56421. $ctx1.sendIdx["add:"]=1;
  56422. $1=$recv(set)._includes_((3));
  56423. $ctx1.sendIdx["includes:"]=1;
  56424. $self._assert_($1);
  56425. $ctx1.sendIdx["assert:"]=2;
  56426. $recv(set)._add_((5));
  56427. $2=$recv(set)._includes_((5));
  56428. $ctx1.sendIdx["includes:"]=2;
  56429. $self._assert_($2);
  56430. $recv(set)._remove_((3));
  56431. $self._deny_($recv(set)._includes_((3)));
  56432. return self;
  56433. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56434. },
  56435. args: [],
  56436. 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)",
  56437. referencedClasses: ["Set"],
  56438. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56439. }),
  56440. $globals.SetTest);
  56441. $core.addMethod(
  56442. $core.method({
  56443. selector: "testAt",
  56444. protocol: "tests",
  56445. fn: function (){
  56446. var self=this,$self=this;
  56447. return $core.withContext(function($ctx1) {
  56448. $self._should_raise_((function(){
  56449. return $core.withContext(function($ctx2) {
  56450. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56452. }),$globals.Error);
  56453. return self;
  56454. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56455. },
  56456. args: [],
  56457. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56458. referencedClasses: ["Set", "Error"],
  56459. messageSends: ["should:raise:", "at:put:", "new"]
  56460. }),
  56461. $globals.SetTest);
  56462. $core.addMethod(
  56463. $core.method({
  56464. selector: "testCollect",
  56465. protocol: "tests",
  56466. fn: function (){
  56467. var self=this,$self=this;
  56468. return $core.withContext(function($ctx1) {
  56469. var $2,$1;
  56470. (
  56471. $ctx1.supercall = true,
  56472. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56473. $ctx1.supercall = false;
  56474. $2=[(5), (6), (8)]._asSet();
  56475. $ctx1.sendIdx["asSet"]=1;
  56476. $1=$recv($2)._collect_((function(x){
  56477. return $core.withContext(function($ctx2) {
  56478. return $recv(x).__backslash_backslash((3));
  56479. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56480. }));
  56481. $self._assert_equals_($1,[(0), (2)]._asSet());
  56482. return self;
  56483. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56484. },
  56485. args: [],
  56486. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56487. referencedClasses: [],
  56488. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56489. }),
  56490. $globals.SetTest);
  56491. $core.addMethod(
  56492. $core.method({
  56493. selector: "testComma",
  56494. protocol: "tests",
  56495. fn: function (){
  56496. var self=this,$self=this;
  56497. return $core.withContext(function($ctx1) {
  56498. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56499. (
  56500. $ctx1.supercall = true,
  56501. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56502. $ctx1.supercall = false;
  56503. $2=$self._collection();
  56504. $ctx1.sendIdx["collection"]=1;
  56505. $3=$self._collection();
  56506. $ctx1.sendIdx["collection"]=2;
  56507. $1=$recv($2).__comma($3);
  56508. $ctx1.sendIdx[","]=1;
  56509. $4=$self._collection();
  56510. $ctx1.sendIdx["collection"]=3;
  56511. $self._assert_equals_($1,$4);
  56512. $ctx1.sendIdx["assert:equals:"]=1;
  56513. $6=$self._collection();
  56514. $ctx1.sendIdx["collection"]=4;
  56515. $7=$self._collectionWithNewValue();
  56516. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56517. $5=$recv($6).__comma($7);
  56518. $ctx1.sendIdx[","]=2;
  56519. $8=$self._collectionWithNewValue();
  56520. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56521. $self._assert_equals_($5,$8);
  56522. $ctx1.sendIdx["assert:equals:"]=2;
  56523. $10=$self._collectionWithNewValue();
  56524. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56525. $9=$recv($10).__comma($self._collection());
  56526. $self._assert_equals_($9,$self._collectionWithNewValue());
  56527. return self;
  56528. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56529. },
  56530. args: [],
  56531. 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",
  56532. referencedClasses: [],
  56533. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56534. }),
  56535. $globals.SetTest);
  56536. $core.addMethod(
  56537. $core.method({
  56538. selector: "testComparing",
  56539. protocol: "tests",
  56540. fn: function (){
  56541. var self=this,$self=this;
  56542. return $core.withContext(function($ctx1) {
  56543. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56544. $1=[(0), (2)]._asSet();
  56545. $ctx1.sendIdx["asSet"]=1;
  56546. $2=[(0), (2)]._asSet();
  56547. $ctx1.sendIdx["asSet"]=2;
  56548. $self._assert_equals_($1,$2);
  56549. $ctx1.sendIdx["assert:equals:"]=1;
  56550. $3=[(2), (0)]._asSet();
  56551. $ctx1.sendIdx["asSet"]=3;
  56552. $4=[(0), (2)]._asSet();
  56553. $ctx1.sendIdx["asSet"]=4;
  56554. $self._assert_equals_($3,$4);
  56555. $6=[(0), (2), (3)]._asSet();
  56556. $ctx1.sendIdx["asSet"]=5;
  56557. $7=[(0), (2)]._asSet();
  56558. $ctx1.sendIdx["asSet"]=6;
  56559. $5=$recv($6).__eq($7);
  56560. $ctx1.sendIdx["="]=1;
  56561. $self._deny_($5);
  56562. $ctx1.sendIdx["deny:"]=1;
  56563. $9=[(1), (2)]._asSet();
  56564. $ctx1.sendIdx["asSet"]=7;
  56565. $8=$recv($9).__eq([(0), (2)]._asSet());
  56566. $self._deny_($8);
  56567. return self;
  56568. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56569. },
  56570. args: [],
  56571. 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",
  56572. referencedClasses: [],
  56573. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56574. }),
  56575. $globals.SetTest);
  56576. $core.addMethod(
  56577. $core.method({
  56578. selector: "testPrintString",
  56579. protocol: "tests",
  56580. fn: function (){
  56581. var self=this,$self=this;
  56582. var set;
  56583. return $core.withContext(function($ctx1) {
  56584. var $1,$2,$3,$4,$5,$6,$7,$8;
  56585. set=$recv($globals.Set)._new();
  56586. $1=$recv(set)._printString();
  56587. $ctx1.sendIdx["printString"]=1;
  56588. $self._assert_equals_($1,"a Set ()");
  56589. $ctx1.sendIdx["assert:equals:"]=1;
  56590. $2=set;
  56591. $recv($2)._add_((1));
  56592. $ctx1.sendIdx["add:"]=1;
  56593. $3=$recv($2)._add_((3));
  56594. $ctx1.sendIdx["add:"]=2;
  56595. $4=$recv(set)._printString();
  56596. $ctx1.sendIdx["printString"]=2;
  56597. $self._assert_equals_($4,"a Set (1 3)");
  56598. $ctx1.sendIdx["assert:equals:"]=2;
  56599. $recv(set)._add_("foo");
  56600. $ctx1.sendIdx["add:"]=3;
  56601. $5=$recv(set)._printString();
  56602. $ctx1.sendIdx["printString"]=3;
  56603. $self._assert_equals_($5,"a Set (1 3 'foo')");
  56604. $ctx1.sendIdx["assert:equals:"]=3;
  56605. $6=set;
  56606. $recv($6)._remove_((1));
  56607. $ctx1.sendIdx["remove:"]=1;
  56608. $recv($6)._remove_((3));
  56609. $7=$recv(set)._printString();
  56610. $ctx1.sendIdx["printString"]=4;
  56611. $self._assert_equals_($7,"a Set ('foo')");
  56612. $ctx1.sendIdx["assert:equals:"]=4;
  56613. $recv(set)._add_((3));
  56614. $ctx1.sendIdx["add:"]=4;
  56615. $8=$recv(set)._printString();
  56616. $ctx1.sendIdx["printString"]=5;
  56617. $self._assert_equals_($8,"a Set (3 'foo')");
  56618. $ctx1.sendIdx["assert:equals:"]=5;
  56619. $recv(set)._add_((3));
  56620. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  56621. return self;
  56622. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  56623. },
  56624. args: [],
  56625. 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'')'",
  56626. referencedClasses: ["Set"],
  56627. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  56628. }),
  56629. $globals.SetTest);
  56630. $core.addMethod(
  56631. $core.method({
  56632. selector: "testUnboxedObjects",
  56633. protocol: "tests",
  56634. fn: function (){
  56635. var self=this,$self=this;
  56636. return $core.withContext(function($ctx1) {
  56637. var $4,$3,$2,$1;
  56638. $4="foo"._yourself();
  56639. $ctx1.sendIdx["yourself"]=1;
  56640. $3=[$4,"foo"._yourself()];
  56641. $2=$recv($3)._asSet();
  56642. $1=$recv($2)._asArray();
  56643. $self._assert_equals_($1,["foo"]);
  56644. return self;
  56645. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  56646. },
  56647. args: [],
  56648. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  56649. referencedClasses: [],
  56650. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  56651. }),
  56652. $globals.SetTest);
  56653. $core.addMethod(
  56654. $core.method({
  56655. selector: "testUnicity",
  56656. protocol: "tests",
  56657. fn: function (){
  56658. var self=this,$self=this;
  56659. var set;
  56660. return $core.withContext(function($ctx1) {
  56661. var $1;
  56662. set=$recv($globals.Set)._new();
  56663. $recv(set)._add_((21));
  56664. $ctx1.sendIdx["add:"]=1;
  56665. $recv(set)._add_("hello");
  56666. $ctx1.sendIdx["add:"]=2;
  56667. $recv(set)._add_((21));
  56668. $ctx1.sendIdx["add:"]=3;
  56669. $1=$recv(set)._size();
  56670. $ctx1.sendIdx["size"]=1;
  56671. $self._assert_equals_($1,(2));
  56672. $ctx1.sendIdx["assert:equals:"]=1;
  56673. $recv(set)._add_("hello");
  56674. $self._assert_equals_($recv(set)._size(),(2));
  56675. $ctx1.sendIdx["assert:equals:"]=2;
  56676. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  56677. return self;
  56678. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  56679. },
  56680. args: [],
  56681. 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')",
  56682. referencedClasses: ["Set"],
  56683. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  56684. }),
  56685. $globals.SetTest);
  56686. $core.addMethod(
  56687. $core.method({
  56688. selector: "collectionClass",
  56689. protocol: "fixture",
  56690. fn: function (){
  56691. var self=this,$self=this;
  56692. return $globals.Set;
  56693. },
  56694. args: [],
  56695. source: "collectionClass\x0a\x09^ Set",
  56696. referencedClasses: ["Set"],
  56697. messageSends: []
  56698. }),
  56699. $globals.SetTest.a$cls);
  56700. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  56701. $core.addMethod(
  56702. $core.method({
  56703. selector: "testShow",
  56704. protocol: "tests",
  56705. fn: function (){
  56706. var self=this,$self=this;
  56707. var originalTranscript;
  56708. return $core.withContext(function($ctx1) {
  56709. originalTranscript=$recv($globals.Transcript)._current();
  56710. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  56711. $ctx1.sendIdx["register:"]=1;
  56712. $self._shouldnt_raise_((function(){
  56713. return $core.withContext(function($ctx2) {
  56714. return $recv($globals.Transcript)._show_("Hello console!");
  56715. $ctx2.sendIdx["show:"]=1;
  56716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56717. }),$globals.Error);
  56718. $ctx1.sendIdx["shouldnt:raise:"]=1;
  56719. $self._shouldnt_raise_((function(){
  56720. return $core.withContext(function($ctx2) {
  56721. return $recv($globals.Transcript)._show_(console);
  56722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56723. }),$globals.Error);
  56724. $recv($globals.Transcript)._register_(originalTranscript);
  56725. return self;
  56726. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  56727. },
  56728. args: [],
  56729. 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.",
  56730. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  56731. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  56732. }),
  56733. $globals.ConsoleTranscriptTest);
  56734. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  56735. $core.addMethod(
  56736. $core.method({
  56737. selector: "testEquality",
  56738. protocol: "tests",
  56739. fn: function (){
  56740. var self=this,$self=this;
  56741. var now;
  56742. return $core.withContext(function($ctx1) {
  56743. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56744. now=$recv($globals.Date)._new();
  56745. $1=$recv(now).__eq(now);
  56746. $ctx1.sendIdx["="]=1;
  56747. $self._assert_($1);
  56748. $ctx1.sendIdx["assert:"]=1;
  56749. $3=now;
  56750. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56751. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56752. $2=$recv($3).__eq($4);
  56753. $ctx1.sendIdx["="]=2;
  56754. $self._deny_($2);
  56755. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56756. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56757. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56758. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56759. $5=$recv($6).__eq($7);
  56760. $ctx1.sendIdx["="]=3;
  56761. $self._assert_($5);
  56762. $ctx1.sendIdx["assert:"]=2;
  56763. $9=now;
  56764. $11=$recv(now)._asMilliseconds();
  56765. $ctx1.sendIdx["asMilliseconds"]=1;
  56766. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56767. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56768. $8=$recv($9).__eq($10);
  56769. $ctx1.sendIdx["="]=4;
  56770. $self._assert_($8);
  56771. $ctx1.sendIdx["assert:"]=3;
  56772. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  56773. return self;
  56774. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  56775. },
  56776. args: [],
  56777. 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",
  56778. referencedClasses: ["Date"],
  56779. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56780. }),
  56781. $globals.DateTest);
  56782. $core.addMethod(
  56783. $core.method({
  56784. selector: "testIdentity",
  56785. protocol: "tests",
  56786. fn: function (){
  56787. var self=this,$self=this;
  56788. var now;
  56789. return $core.withContext(function($ctx1) {
  56790. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56791. now=$recv($globals.Date)._new();
  56792. $1=$recv(now).__eq_eq(now);
  56793. $ctx1.sendIdx["=="]=1;
  56794. $self._assert_($1);
  56795. $3=now;
  56796. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56797. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56798. $2=$recv($3).__eq_eq($4);
  56799. $ctx1.sendIdx["=="]=2;
  56800. $self._deny_($2);
  56801. $ctx1.sendIdx["deny:"]=1;
  56802. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56803. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56804. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56805. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56806. $5=$recv($6).__eq_eq($7);
  56807. $ctx1.sendIdx["=="]=3;
  56808. $self._deny_($5);
  56809. $ctx1.sendIdx["deny:"]=2;
  56810. $9=now;
  56811. $11=$recv(now)._asMilliseconds();
  56812. $ctx1.sendIdx["asMilliseconds"]=1;
  56813. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56814. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56815. $8=$recv($9).__eq_eq($10);
  56816. $ctx1.sendIdx["=="]=4;
  56817. $self._deny_($8);
  56818. $ctx1.sendIdx["deny:"]=3;
  56819. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  56820. return self;
  56821. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  56822. },
  56823. args: [],
  56824. 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",
  56825. referencedClasses: ["Date"],
  56826. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56827. }),
  56828. $globals.DateTest);
  56829. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  56830. $core.addMethod(
  56831. $core.method({
  56832. selector: "jsNull",
  56833. protocol: "accessing",
  56834. fn: function (){
  56835. var self=this,$self=this;
  56836. return $core.withContext(function($ctx1) {
  56837. return null;
  56838. return self;
  56839. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  56840. },
  56841. args: [],
  56842. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  56843. referencedClasses: [],
  56844. messageSends: []
  56845. }),
  56846. $globals.JSObjectProxyTest);
  56847. $core.addMethod(
  56848. $core.method({
  56849. selector: "jsObject",
  56850. protocol: "accessing",
  56851. fn: function (){
  56852. var self=this,$self=this;
  56853. return $core.withContext(function($ctx1) {
  56854. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  56855. return self;
  56856. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  56857. },
  56858. args: [],
  56859. 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}'>",
  56860. referencedClasses: [],
  56861. messageSends: []
  56862. }),
  56863. $globals.JSObjectProxyTest);
  56864. $core.addMethod(
  56865. $core.method({
  56866. selector: "jsUndefined",
  56867. protocol: "accessing",
  56868. fn: function (){
  56869. var self=this,$self=this;
  56870. return $core.withContext(function($ctx1) {
  56871. return;
  56872. return self;
  56873. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  56874. },
  56875. args: [],
  56876. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  56877. referencedClasses: [],
  56878. messageSends: []
  56879. }),
  56880. $globals.JSObjectProxyTest);
  56881. $core.addMethod(
  56882. $core.method({
  56883. selector: "testAtIfAbsent",
  56884. protocol: "tests",
  56885. fn: function (){
  56886. var self=this,$self=this;
  56887. var testObject;
  56888. return $core.withContext(function($ctx1) {
  56889. var $1,$2,$3;
  56890. testObject=$self._jsObject();
  56891. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  56892. return "Property does not exist";
  56893. }));
  56894. $ctx1.sendIdx["at:ifAbsent:"]=1;
  56895. $self._assert_equals_($1,"Property does not exist");
  56896. $ctx1.sendIdx["assert:equals:"]=1;
  56897. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  56898. return "Property does not exist";
  56899. }));
  56900. $ctx1.sendIdx["at:ifAbsent:"]=2;
  56901. $self._assert_equals_($2,nil);
  56902. $ctx1.sendIdx["assert:equals:"]=2;
  56903. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  56904. return "Property does not exist";
  56905. }));
  56906. $ctx1.sendIdx["at:ifAbsent:"]=3;
  56907. $self._assert_equals_($3,(1));
  56908. $ctx1.sendIdx["assert:equals:"]=3;
  56909. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  56910. return "Property does not exist";
  56911. })),nil);
  56912. return self;
  56913. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  56914. },
  56915. args: [],
  56916. 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.",
  56917. referencedClasses: [],
  56918. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  56919. }),
  56920. $globals.JSObjectProxyTest);
  56921. $core.addMethod(
  56922. $core.method({
  56923. selector: "testAtIfPresent",
  56924. protocol: "tests",
  56925. fn: function (){
  56926. var self=this,$self=this;
  56927. var testObject;
  56928. return $core.withContext(function($ctx1) {
  56929. var $2,$1,$4,$3,$6,$5;
  56930. testObject=$self._jsObject();
  56931. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  56932. return $core.withContext(function($ctx2) {
  56933. $2=$recv(x)._asString();
  56934. $ctx2.sendIdx["asString"]=1;
  56935. return "hello ".__comma($2);
  56936. $ctx2.sendIdx[","]=1;
  56937. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56938. }));
  56939. $ctx1.sendIdx["at:ifPresent:"]=1;
  56940. $self._assert_equals_($1,nil);
  56941. $ctx1.sendIdx["assert:equals:"]=1;
  56942. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  56943. return $core.withContext(function($ctx2) {
  56944. $4=$recv(x)._asString();
  56945. $ctx2.sendIdx["asString"]=2;
  56946. return "hello ".__comma($4);
  56947. $ctx2.sendIdx[","]=2;
  56948. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  56949. }));
  56950. $ctx1.sendIdx["at:ifPresent:"]=2;
  56951. $self._assert_equals_($3,"hello nil");
  56952. $ctx1.sendIdx["assert:equals:"]=2;
  56953. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  56954. return $core.withContext(function($ctx2) {
  56955. $6=$recv(x)._asString();
  56956. $ctx2.sendIdx["asString"]=3;
  56957. return "hello ".__comma($6);
  56958. $ctx2.sendIdx[","]=3;
  56959. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  56960. }));
  56961. $ctx1.sendIdx["at:ifPresent:"]=3;
  56962. $self._assert_equals_($5,"hello 1");
  56963. $ctx1.sendIdx["assert:equals:"]=3;
  56964. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  56965. return $core.withContext(function($ctx2) {
  56966. return "hello ".__comma($recv(x)._asString());
  56967. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  56968. })),"hello nil");
  56969. return self;
  56970. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  56971. },
  56972. args: [],
  56973. 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'.",
  56974. referencedClasses: [],
  56975. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  56976. }),
  56977. $globals.JSObjectProxyTest);
  56978. $core.addMethod(
  56979. $core.method({
  56980. selector: "testAtIfPresentIfAbsent",
  56981. protocol: "tests",
  56982. fn: function (){
  56983. var self=this,$self=this;
  56984. var testObject;
  56985. return $core.withContext(function($ctx1) {
  56986. var $2,$1,$4,$3,$6,$5;
  56987. testObject=$self._jsObject();
  56988. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  56989. return $core.withContext(function($ctx2) {
  56990. $2=$recv(x)._asString();
  56991. $ctx2.sendIdx["asString"]=1;
  56992. return "hello ".__comma($2);
  56993. $ctx2.sendIdx[","]=1;
  56994. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56995. }),(function(){
  56996. return "not present";
  56997. }));
  56998. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  56999. $self._assert_equals_($1,"not present");
  57000. $ctx1.sendIdx["assert:equals:"]=1;
  57001. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57002. return $core.withContext(function($ctx2) {
  57003. $4=$recv(x)._asString();
  57004. $ctx2.sendIdx["asString"]=2;
  57005. return "hello ".__comma($4);
  57006. $ctx2.sendIdx[","]=2;
  57007. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57008. }),(function(){
  57009. return "not present";
  57010. }));
  57011. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57012. $self._assert_equals_($3,"hello nil");
  57013. $ctx1.sendIdx["assert:equals:"]=2;
  57014. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57015. return $core.withContext(function($ctx2) {
  57016. $6=$recv(x)._asString();
  57017. $ctx2.sendIdx["asString"]=3;
  57018. return "hello ".__comma($6);
  57019. $ctx2.sendIdx[","]=3;
  57020. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57021. }),(function(){
  57022. return "not present";
  57023. }));
  57024. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57025. $self._assert_equals_($5,"hello 1");
  57026. $ctx1.sendIdx["assert:equals:"]=3;
  57027. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57028. return $core.withContext(function($ctx2) {
  57029. return "hello ".__comma($recv(x)._asString());
  57030. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57031. }),(function(){
  57032. return "not present";
  57033. })),"hello nil");
  57034. return self;
  57035. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57036. },
  57037. args: [],
  57038. 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'.",
  57039. referencedClasses: [],
  57040. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57041. }),
  57042. $globals.JSObjectProxyTest);
  57043. $core.addMethod(
  57044. $core.method({
  57045. selector: "testAtPut",
  57046. protocol: "tests",
  57047. fn: function (){
  57048. var self=this,$self=this;
  57049. var testObject;
  57050. return $core.withContext(function($ctx1) {
  57051. var $2,$1;
  57052. testObject=$self._jsObject();
  57053. $2=$recv(testObject)._at_("abc");
  57054. $ctx1.sendIdx["at:"]=1;
  57055. $1=$recv($2).__tild_eq("xyz");
  57056. $self._assert_($1);
  57057. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57058. $ctx1.sendIdx["assert:equals:"]=1;
  57059. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57060. return self;
  57061. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57062. },
  57063. args: [],
  57064. 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'",
  57065. referencedClasses: [],
  57066. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57067. }),
  57068. $globals.JSObjectProxyTest);
  57069. $core.addMethod(
  57070. $core.method({
  57071. selector: "testComparison",
  57072. protocol: "tests",
  57073. fn: function (){
  57074. var self=this,$self=this;
  57075. return $core.withContext(function($ctx1) {
  57076. var $1,$2;
  57077. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57078. $1=$recv(console).__eq(console);
  57079. $ctx1.sendIdx["="]=1;
  57080. $self._assert_($1);
  57081. $2=$recv(console).__eq($recv($globals.Object)._new());
  57082. $ctx1.sendIdx["="]=2;
  57083. $self._deny_($2);
  57084. $ctx1.sendIdx["deny:"]=1;
  57085. $self._deny_($recv(console).__eq($self._jsObject()));
  57086. return self;
  57087. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57088. },
  57089. args: [],
  57090. 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",
  57091. referencedClasses: ["Object"],
  57092. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57093. }),
  57094. $globals.JSObjectProxyTest);
  57095. $core.addMethod(
  57096. $core.method({
  57097. selector: "testDNU",
  57098. protocol: "tests",
  57099. fn: function (){
  57100. var self=this,$self=this;
  57101. return $core.withContext(function($ctx1) {
  57102. $self._should_raise_((function(){
  57103. return $core.withContext(function($ctx2) {
  57104. return $recv($self._jsObject())._foo();
  57105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57106. }),$globals.MessageNotUnderstood);
  57107. return self;
  57108. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57109. },
  57110. args: [],
  57111. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57112. referencedClasses: ["MessageNotUnderstood"],
  57113. messageSends: ["should:raise:", "foo", "jsObject"]
  57114. }),
  57115. $globals.JSObjectProxyTest);
  57116. $core.addMethod(
  57117. $core.method({
  57118. selector: "testDNUWithAllowJavaScriptCalls",
  57119. protocol: "tests",
  57120. fn: function (){
  57121. var self=this,$self=this;
  57122. var jsObject;
  57123. return $core.withContext(function($ctx1) {
  57124. jsObject=[];
  57125. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57126. $self._should_raise_((function(){
  57127. return $core.withContext(function($ctx2) {
  57128. return $recv(jsObject)._foo();
  57129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57130. }),$globals.MessageNotUnderstood);
  57131. return self;
  57132. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57133. },
  57134. args: [],
  57135. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57136. referencedClasses: ["MessageNotUnderstood"],
  57137. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57138. }),
  57139. $globals.JSObjectProxyTest);
  57140. $core.addMethod(
  57141. $core.method({
  57142. selector: "testMessageSend",
  57143. protocol: "tests",
  57144. fn: function (){
  57145. var self=this,$self=this;
  57146. return $core.withContext(function($ctx1) {
  57147. var $2,$1,$4,$3;
  57148. $2=$self._jsObject();
  57149. $ctx1.sendIdx["jsObject"]=1;
  57150. $1=$recv($2)._a();
  57151. $self._assert_equals_($1,(1));
  57152. $ctx1.sendIdx["assert:equals:"]=1;
  57153. $4=$self._jsObject();
  57154. $ctx1.sendIdx["jsObject"]=2;
  57155. $3=$recv($4)._b();
  57156. $self._assert_equals_($3,(2));
  57157. $ctx1.sendIdx["assert:equals:"]=2;
  57158. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57159. return self;
  57160. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57161. },
  57162. args: [],
  57163. 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",
  57164. referencedClasses: [],
  57165. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57166. }),
  57167. $globals.JSObjectProxyTest);
  57168. $core.addMethod(
  57169. $core.method({
  57170. selector: "testMethodWithArguments",
  57171. protocol: "tests",
  57172. fn: function (){
  57173. var self=this,$self=this;
  57174. return $core.withContext(function($ctx1) {
  57175. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57176. return self;
  57177. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57178. },
  57179. args: [],
  57180. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57181. referencedClasses: [],
  57182. messageSends: ["assert:equals:", "c:", "jsObject"]
  57183. }),
  57184. $globals.JSObjectProxyTest);
  57185. $core.addMethod(
  57186. $core.method({
  57187. selector: "testPrinting",
  57188. protocol: "tests",
  57189. fn: function (){
  57190. var self=this,$self=this;
  57191. return $core.withContext(function($ctx1) {
  57192. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57193. return self;
  57194. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57195. },
  57196. args: [],
  57197. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57198. referencedClasses: [],
  57199. messageSends: ["assert:equals:", "printString", "jsObject"]
  57200. }),
  57201. $globals.JSObjectProxyTest);
  57202. $core.addMethod(
  57203. $core.method({
  57204. selector: "testPropertyThatReturnsEmptyString",
  57205. protocol: "tests",
  57206. fn: function (){
  57207. var self=this,$self=this;
  57208. var object;
  57209. return $core.withContext(function($ctx1) {
  57210. var $1;
  57211. object=$self._jsObject();
  57212. $1=$recv(object)._d();
  57213. $ctx1.sendIdx["d"]=1;
  57214. $self._assert_equals_($1,"");
  57215. $ctx1.sendIdx["assert:equals:"]=1;
  57216. $recv(object)._d_("hello");
  57217. $self._assert_equals_($recv(object)._d(),"hello");
  57218. return self;
  57219. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57220. },
  57221. args: [],
  57222. 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'",
  57223. referencedClasses: [],
  57224. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57225. }),
  57226. $globals.JSObjectProxyTest);
  57227. $core.addMethod(
  57228. $core.method({
  57229. selector: "testPropertyThatReturnsUndefined",
  57230. protocol: "tests",
  57231. fn: function (){
  57232. var self=this,$self=this;
  57233. var object;
  57234. return $core.withContext(function($ctx1) {
  57235. object=$self._jsObject();
  57236. $self._shouldnt_raise_((function(){
  57237. return $core.withContext(function($ctx2) {
  57238. return $recv(object)._e();
  57239. $ctx2.sendIdx["e"]=1;
  57240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57241. }),$globals.MessageNotUnderstood);
  57242. $self._assert_($recv($recv(object)._e())._isNil());
  57243. return self;
  57244. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57245. },
  57246. args: [],
  57247. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57248. referencedClasses: ["MessageNotUnderstood"],
  57249. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57250. }),
  57251. $globals.JSObjectProxyTest);
  57252. $core.addMethod(
  57253. $core.method({
  57254. selector: "testSetPropertyWithFalsyValue",
  57255. protocol: "tests",
  57256. fn: function (){
  57257. var self=this,$self=this;
  57258. var jsObject;
  57259. return $core.withContext(function($ctx1) {
  57260. var $1,$2,$3,$4,$5;
  57261. jsObject=$self._jsObject();
  57262. $1=$recv(jsObject)._a();
  57263. $ctx1.sendIdx["a"]=1;
  57264. $self._assert_equals_($1,(1));
  57265. $ctx1.sendIdx["assert:equals:"]=1;
  57266. $recv(jsObject)._a_($self._jsNull());
  57267. $ctx1.sendIdx["a:"]=1;
  57268. $2=$recv(jsObject)._a();
  57269. $ctx1.sendIdx["a"]=2;
  57270. $self._assert_equals_($2,nil);
  57271. $ctx1.sendIdx["assert:equals:"]=2;
  57272. $recv(jsObject)._a_((0));
  57273. $ctx1.sendIdx["a:"]=2;
  57274. $3=$recv(jsObject)._a();
  57275. $ctx1.sendIdx["a"]=3;
  57276. $self._assert_equals_($3,(0));
  57277. $ctx1.sendIdx["assert:equals:"]=3;
  57278. $recv(jsObject)._a_($self._jsUndefined());
  57279. $ctx1.sendIdx["a:"]=3;
  57280. $4=$recv(jsObject)._a();
  57281. $ctx1.sendIdx["a"]=4;
  57282. $self._assert_equals_($4,nil);
  57283. $ctx1.sendIdx["assert:equals:"]=4;
  57284. $recv(jsObject)._a_("");
  57285. $ctx1.sendIdx["a:"]=4;
  57286. $5=$recv(jsObject)._a();
  57287. $ctx1.sendIdx["a"]=5;
  57288. $self._assert_equals_($5,"");
  57289. $ctx1.sendIdx["assert:equals:"]=5;
  57290. $recv(jsObject)._a_(false);
  57291. $self._assert_equals_($recv(jsObject)._a(),false);
  57292. return self;
  57293. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57294. },
  57295. args: [],
  57296. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  57297. referencedClasses: [],
  57298. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  57299. }),
  57300. $globals.JSObjectProxyTest);
  57301. $core.addMethod(
  57302. $core.method({
  57303. selector: "testValue",
  57304. protocol: "tests",
  57305. fn: function (){
  57306. var self=this,$self=this;
  57307. var testObject;
  57308. return $core.withContext(function($ctx1) {
  57309. testObject=$self._jsObject();
  57310. $recv(testObject)._at_put_("value","aValue");
  57311. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57312. return self;
  57313. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57314. },
  57315. args: [],
  57316. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57317. referencedClasses: [],
  57318. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57319. }),
  57320. $globals.JSObjectProxyTest);
  57321. $core.addMethod(
  57322. $core.method({
  57323. selector: "testYourself",
  57324. protocol: "tests",
  57325. fn: function (){
  57326. var self=this,$self=this;
  57327. var object;
  57328. return $core.withContext(function($ctx1) {
  57329. var $1;
  57330. $1=$self._jsObject();
  57331. $recv($1)._d_("test");
  57332. object=$recv($1)._yourself();
  57333. $self._assert_equals_($recv(object)._d(),"test");
  57334. return self;
  57335. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57336. },
  57337. args: [],
  57338. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57339. referencedClasses: [],
  57340. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57341. }),
  57342. $globals.JSObjectProxyTest);
  57343. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57344. $core.addMethod(
  57345. $core.method({
  57346. selector: "testCatchingException",
  57347. protocol: "tests",
  57348. fn: function (){
  57349. var self=this,$self=this;
  57350. return $core.withContext(function($ctx1) {
  57351. $recv((function(){
  57352. return $core.withContext(function($ctx2) {
  57353. return $self._throwException();
  57354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57355. }))._on_do_($globals.Error,(function(error){
  57356. return $core.withContext(function($ctx2) {
  57357. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57358. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57359. }));
  57360. return self;
  57361. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57362. },
  57363. args: [],
  57364. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57365. referencedClasses: ["Error"],
  57366. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57367. }),
  57368. $globals.JavaScriptExceptionTest);
  57369. $core.addMethod(
  57370. $core.method({
  57371. selector: "testRaisingException",
  57372. protocol: "tests",
  57373. fn: function (){
  57374. var self=this,$self=this;
  57375. return $core.withContext(function($ctx1) {
  57376. $self._should_raise_((function(){
  57377. return $core.withContext(function($ctx2) {
  57378. return $self._throwException();
  57379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57380. }),$globals.JavaScriptException);
  57381. return self;
  57382. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57383. },
  57384. args: [],
  57385. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57386. referencedClasses: ["JavaScriptException"],
  57387. messageSends: ["should:raise:", "throwException"]
  57388. }),
  57389. $globals.JavaScriptExceptionTest);
  57390. $core.addMethod(
  57391. $core.method({
  57392. selector: "throwException",
  57393. protocol: "helpers",
  57394. fn: function (){
  57395. var self=this,$self=this;
  57396. return $core.withContext(function($ctx1) {
  57397. throw "test";
  57398. return self;
  57399. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57400. },
  57401. args: [],
  57402. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57403. referencedClasses: [],
  57404. messageSends: []
  57405. }),
  57406. $globals.JavaScriptExceptionTest);
  57407. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57408. $core.addMethod(
  57409. $core.method({
  57410. selector: "testValue",
  57411. protocol: "tests",
  57412. fn: function (){
  57413. var self=this,$self=this;
  57414. var messageSend;
  57415. return $core.withContext(function($ctx1) {
  57416. var $1;
  57417. $1=$recv($globals.MessageSend)._new();
  57418. $ctx1.sendIdx["new"]=1;
  57419. $recv($1)._receiver_($recv($globals.Object)._new());
  57420. $recv($1)._selector_("asString");
  57421. messageSend=$recv($1)._yourself();
  57422. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57423. return self;
  57424. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57425. },
  57426. args: [],
  57427. 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'",
  57428. referencedClasses: ["MessageSend", "Object"],
  57429. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57430. }),
  57431. $globals.MessageSendTest);
  57432. $core.addMethod(
  57433. $core.method({
  57434. selector: "testValueWithArguments",
  57435. protocol: "tests",
  57436. fn: function (){
  57437. var self=this,$self=this;
  57438. var messageSend;
  57439. return $core.withContext(function($ctx1) {
  57440. var $1;
  57441. $1=$recv($globals.MessageSend)._new();
  57442. $recv($1)._receiver_((2));
  57443. $recv($1)._selector_("+");
  57444. messageSend=$recv($1)._yourself();
  57445. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57446. $ctx1.sendIdx["assert:equals:"]=1;
  57447. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57448. return self;
  57449. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57450. },
  57451. args: [],
  57452. 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",
  57453. referencedClasses: ["MessageSend"],
  57454. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57455. }),
  57456. $globals.MessageSendTest);
  57457. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57458. $core.addMethod(
  57459. $core.method({
  57460. selector: "codeGeneratorClass",
  57461. protocol: "accessing",
  57462. fn: function (){
  57463. var self=this,$self=this;
  57464. return $globals.CodeGenerator;
  57465. },
  57466. args: [],
  57467. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57468. referencedClasses: ["CodeGenerator"],
  57469. messageSends: []
  57470. }),
  57471. $globals.MethodInheritanceTest);
  57472. $core.addMethod(
  57473. $core.method({
  57474. selector: "compiler",
  57475. protocol: "factory",
  57476. fn: function (){
  57477. var self=this,$self=this;
  57478. return $core.withContext(function($ctx1) {
  57479. var $1;
  57480. $1=$recv($globals.Compiler)._new();
  57481. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57482. return $recv($1)._yourself();
  57483. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57484. },
  57485. args: [],
  57486. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57487. referencedClasses: ["Compiler"],
  57488. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57489. }),
  57490. $globals.MethodInheritanceTest);
  57491. $core.addMethod(
  57492. $core.method({
  57493. selector: "deinstallBottom",
  57494. protocol: "testing",
  57495. fn: function (){
  57496. var self=this,$self=this;
  57497. return $core.withContext(function($ctx1) {
  57498. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57499. return self;
  57500. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57501. },
  57502. args: [],
  57503. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57504. referencedClasses: [],
  57505. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57506. }),
  57507. $globals.MethodInheritanceTest);
  57508. $core.addMethod(
  57509. $core.method({
  57510. selector: "deinstallMiddle",
  57511. protocol: "testing",
  57512. fn: function (){
  57513. var self=this,$self=this;
  57514. return $core.withContext(function($ctx1) {
  57515. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  57516. return self;
  57517. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  57518. },
  57519. args: [],
  57520. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  57521. referencedClasses: [],
  57522. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  57523. }),
  57524. $globals.MethodInheritanceTest);
  57525. $core.addMethod(
  57526. $core.method({
  57527. selector: "deinstallTop",
  57528. protocol: "testing",
  57529. fn: function (){
  57530. var self=this,$self=this;
  57531. return $core.withContext(function($ctx1) {
  57532. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  57533. return self;
  57534. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  57535. },
  57536. args: [],
  57537. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  57538. referencedClasses: [],
  57539. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  57540. }),
  57541. $globals.MethodInheritanceTest);
  57542. $core.addMethod(
  57543. $core.method({
  57544. selector: "installBottom:",
  57545. protocol: "testing",
  57546. fn: function (aString){
  57547. var self=this,$self=this;
  57548. return $core.withContext(function($ctx1) {
  57549. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  57550. return self;
  57551. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  57552. },
  57553. args: ["aString"],
  57554. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  57555. referencedClasses: [],
  57556. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  57557. }),
  57558. $globals.MethodInheritanceTest);
  57559. $core.addMethod(
  57560. $core.method({
  57561. selector: "installMiddle:",
  57562. protocol: "testing",
  57563. fn: function (aString){
  57564. var self=this,$self=this;
  57565. return $core.withContext(function($ctx1) {
  57566. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  57567. return self;
  57568. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  57569. },
  57570. args: ["aString"],
  57571. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  57572. referencedClasses: [],
  57573. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  57574. }),
  57575. $globals.MethodInheritanceTest);
  57576. $core.addMethod(
  57577. $core.method({
  57578. selector: "installTop:",
  57579. protocol: "testing",
  57580. fn: function (aString){
  57581. var self=this,$self=this;
  57582. return $core.withContext(function($ctx1) {
  57583. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  57584. return self;
  57585. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  57586. },
  57587. args: ["aString"],
  57588. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  57589. referencedClasses: [],
  57590. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  57591. }),
  57592. $globals.MethodInheritanceTest);
  57593. $core.addMethod(
  57594. $core.method({
  57595. selector: "setUp",
  57596. protocol: "initialization",
  57597. fn: function (){
  57598. var self=this,$self=this;
  57599. return $core.withContext(function($ctx1) {
  57600. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  57601. $ctx1.sendIdx["new"]=1;
  57602. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  57603. $ctx1.sendIdx["new"]=2;
  57604. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  57605. $self["@method"]=nil;
  57606. $self["@performBlock"]=(function(){
  57607. return $core.withContext(function($ctx2) {
  57608. return $self._error_("performBlock not initialized");
  57609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57610. });
  57611. return self;
  57612. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  57613. },
  57614. args: [],
  57615. 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' ]",
  57616. referencedClasses: [],
  57617. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  57618. }),
  57619. $globals.MethodInheritanceTest);
  57620. $core.addMethod(
  57621. $core.method({
  57622. selector: "shouldMNU",
  57623. protocol: "testing",
  57624. fn: function (){
  57625. var self=this,$self=this;
  57626. return $core.withContext(function($ctx1) {
  57627. $self._shouldMNUTop();
  57628. $self._shouldMNUMiddle();
  57629. $self._shouldMNUBottom();
  57630. return self;
  57631. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  57632. },
  57633. args: [],
  57634. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  57635. referencedClasses: [],
  57636. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  57637. }),
  57638. $globals.MethodInheritanceTest);
  57639. $core.addMethod(
  57640. $core.method({
  57641. selector: "shouldMNUBottom",
  57642. protocol: "testing",
  57643. fn: function (){
  57644. var self=this,$self=this;
  57645. return $core.withContext(function($ctx1) {
  57646. $self._should_raise_((function(){
  57647. return $core.withContext(function($ctx2) {
  57648. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57650. }),$globals.MessageNotUnderstood);
  57651. return self;
  57652. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  57653. },
  57654. args: [],
  57655. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  57656. referencedClasses: ["MessageNotUnderstood"],
  57657. messageSends: ["should:raise:", "value:"]
  57658. }),
  57659. $globals.MethodInheritanceTest);
  57660. $core.addMethod(
  57661. $core.method({
  57662. selector: "shouldMNUMiddle",
  57663. protocol: "testing",
  57664. fn: function (){
  57665. var self=this,$self=this;
  57666. return $core.withContext(function($ctx1) {
  57667. $self._should_raise_((function(){
  57668. return $core.withContext(function($ctx2) {
  57669. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57671. }),$globals.MessageNotUnderstood);
  57672. return self;
  57673. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  57674. },
  57675. args: [],
  57676. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  57677. referencedClasses: ["MessageNotUnderstood"],
  57678. messageSends: ["should:raise:", "value:"]
  57679. }),
  57680. $globals.MethodInheritanceTest);
  57681. $core.addMethod(
  57682. $core.method({
  57683. selector: "shouldMNUTop",
  57684. protocol: "testing",
  57685. fn: function (){
  57686. var self=this,$self=this;
  57687. return $core.withContext(function($ctx1) {
  57688. $self._should_raise_((function(){
  57689. return $core.withContext(function($ctx2) {
  57690. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57691. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57692. }),$globals.MessageNotUnderstood);
  57693. return self;
  57694. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  57695. },
  57696. args: [],
  57697. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  57698. referencedClasses: ["MessageNotUnderstood"],
  57699. messageSends: ["should:raise:", "value:"]
  57700. }),
  57701. $globals.MethodInheritanceTest);
  57702. $core.addMethod(
  57703. $core.method({
  57704. selector: "shouldReturn:",
  57705. protocol: "testing",
  57706. fn: function (anObject){
  57707. var self=this,$self=this;
  57708. var result;
  57709. return $core.withContext(function($ctx1) {
  57710. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57711. $ctx1.sendIdx["value:"]=1;
  57712. $self._assert_equals_(["top",anObject],["top",result]);
  57713. $ctx1.sendIdx["assert:equals:"]=1;
  57714. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57715. $ctx1.sendIdx["value:"]=2;
  57716. $self._assert_equals_(["middle",anObject],["middle",result]);
  57717. $ctx1.sendIdx["assert:equals:"]=2;
  57718. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57719. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  57720. return self;
  57721. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  57722. },
  57723. args: ["anObject"],
  57724. 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 }",
  57725. referencedClasses: [],
  57726. messageSends: ["value:", "assert:equals:"]
  57727. }),
  57728. $globals.MethodInheritanceTest);
  57729. $core.addMethod(
  57730. $core.method({
  57731. selector: "shouldReturn:and:and:",
  57732. protocol: "testing",
  57733. fn: function (anObject,anObject2,anObject3){
  57734. var self=this,$self=this;
  57735. var result;
  57736. return $core.withContext(function($ctx1) {
  57737. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57738. $ctx1.sendIdx["value:"]=1;
  57739. $self._assert_equals_(["top",anObject],["top",result]);
  57740. $ctx1.sendIdx["assert:equals:"]=1;
  57741. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57742. $ctx1.sendIdx["value:"]=2;
  57743. $self._assert_equals_(["middle",anObject2],["middle",result]);
  57744. $ctx1.sendIdx["assert:equals:"]=2;
  57745. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57746. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  57747. return self;
  57748. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  57749. },
  57750. args: ["anObject", "anObject2", "anObject3"],
  57751. 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 }",
  57752. referencedClasses: [],
  57753. messageSends: ["value:", "assert:equals:"]
  57754. }),
  57755. $globals.MethodInheritanceTest);
  57756. $core.addMethod(
  57757. $core.method({
  57758. selector: "targetClassBottom",
  57759. protocol: "accessing",
  57760. fn: function (){
  57761. var self=this,$self=this;
  57762. return $globals.JavaScriptException;
  57763. },
  57764. args: [],
  57765. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  57766. referencedClasses: ["JavaScriptException"],
  57767. messageSends: []
  57768. }),
  57769. $globals.MethodInheritanceTest);
  57770. $core.addMethod(
  57771. $core.method({
  57772. selector: "targetClassMiddle",
  57773. protocol: "accessing",
  57774. fn: function (){
  57775. var self=this,$self=this;
  57776. return $globals.Error;
  57777. },
  57778. args: [],
  57779. source: "targetClassMiddle\x0a\x09^ Error",
  57780. referencedClasses: ["Error"],
  57781. messageSends: []
  57782. }),
  57783. $globals.MethodInheritanceTest);
  57784. $core.addMethod(
  57785. $core.method({
  57786. selector: "targetClassTop",
  57787. protocol: "accessing",
  57788. fn: function (){
  57789. var self=this,$self=this;
  57790. return $globals.Object;
  57791. },
  57792. args: [],
  57793. source: "targetClassTop\x0a\x09^ Object",
  57794. referencedClasses: ["Object"],
  57795. messageSends: []
  57796. }),
  57797. $globals.MethodInheritanceTest);
  57798. $core.addMethod(
  57799. $core.method({
  57800. selector: "tearDown",
  57801. protocol: "initialization",
  57802. fn: function (){
  57803. var self=this,$self=this;
  57804. return $core.withContext(function($ctx1) {
  57805. $recv((function(){
  57806. return $core.withContext(function($ctx2) {
  57807. return $self._deinstallTop();
  57808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57809. }))._on_do_($globals.Error,(function(){
  57810. }));
  57811. $ctx1.sendIdx["on:do:"]=1;
  57812. $recv((function(){
  57813. return $core.withContext(function($ctx2) {
  57814. return $self._deinstallMiddle();
  57815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57816. }))._on_do_($globals.Error,(function(){
  57817. }));
  57818. $ctx1.sendIdx["on:do:"]=2;
  57819. $recv((function(){
  57820. return $core.withContext(function($ctx2) {
  57821. return $self._deinstallBottom();
  57822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57823. }))._on_do_($globals.Error,(function(){
  57824. }));
  57825. return self;
  57826. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  57827. },
  57828. args: [],
  57829. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  57830. referencedClasses: ["Error"],
  57831. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  57832. }),
  57833. $globals.MethodInheritanceTest);
  57834. $core.addMethod(
  57835. $core.method({
  57836. selector: "testMNU11",
  57837. protocol: "tests",
  57838. fn: function (){
  57839. var self=this,$self=this;
  57840. return $core.withContext(function($ctx1) {
  57841. $self["@performBlock"]=(function(x){
  57842. return $core.withContext(function($ctx2) {
  57843. return $recv(x)._foo();
  57844. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57845. });
  57846. $self._shouldMNU();
  57847. $ctx1.sendIdx["shouldMNU"]=1;
  57848. $self._installTop_("foo ^ false");
  57849. $ctx1.sendIdx["installTop:"]=1;
  57850. $self._installTop_("foo ^ true");
  57851. $self._deinstallTop();
  57852. $self._shouldMNU();
  57853. return self;
  57854. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  57855. },
  57856. args: [],
  57857. 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",
  57858. referencedClasses: [],
  57859. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  57860. }),
  57861. $globals.MethodInheritanceTest);
  57862. $core.addMethod(
  57863. $core.method({
  57864. selector: "testMNU22",
  57865. protocol: "tests",
  57866. fn: function (){
  57867. var self=this,$self=this;
  57868. return $core.withContext(function($ctx1) {
  57869. $self["@performBlock"]=(function(x){
  57870. return $core.withContext(function($ctx2) {
  57871. return $recv(x)._foo();
  57872. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57873. });
  57874. $self._shouldMNU();
  57875. $ctx1.sendIdx["shouldMNU"]=1;
  57876. $self._installMiddle_("foo ^ false");
  57877. $ctx1.sendIdx["installMiddle:"]=1;
  57878. $self._installMiddle_("foo ^ true");
  57879. $self._deinstallMiddle();
  57880. $self._shouldMNU();
  57881. return self;
  57882. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  57883. },
  57884. args: [],
  57885. 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",
  57886. referencedClasses: [],
  57887. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  57888. }),
  57889. $globals.MethodInheritanceTest);
  57890. $core.addMethod(
  57891. $core.method({
  57892. selector: "testReturns1",
  57893. protocol: "tests",
  57894. fn: function (){
  57895. var self=this,$self=this;
  57896. return $core.withContext(function($ctx1) {
  57897. $self["@performBlock"]=(function(x){
  57898. return $core.withContext(function($ctx2) {
  57899. return $recv(x)._foo();
  57900. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57901. });
  57902. $self._installTop_("foo ^ false");
  57903. $ctx1.sendIdx["installTop:"]=1;
  57904. $self._shouldReturn_(false);
  57905. $ctx1.sendIdx["shouldReturn:"]=1;
  57906. $self._installTop_("foo ^ true");
  57907. $self._shouldReturn_(true);
  57908. return self;
  57909. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  57910. },
  57911. args: [],
  57912. 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",
  57913. referencedClasses: [],
  57914. messageSends: ["foo", "installTop:", "shouldReturn:"]
  57915. }),
  57916. $globals.MethodInheritanceTest);
  57917. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  57918. $core.addMethod(
  57919. $core.method({
  57920. selector: "testAbs",
  57921. protocol: "tests",
  57922. fn: function (){
  57923. var self=this,$self=this;
  57924. return $core.withContext(function($ctx1) {
  57925. var $1;
  57926. $1=(4)._abs();
  57927. $ctx1.sendIdx["abs"]=1;
  57928. $self._assert_equals_($1,(4));
  57929. $ctx1.sendIdx["assert:equals:"]=1;
  57930. $self._assert_equals_((-4)._abs(),(4));
  57931. return self;
  57932. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  57933. },
  57934. args: [],
  57935. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  57936. referencedClasses: [],
  57937. messageSends: ["assert:equals:", "abs"]
  57938. }),
  57939. $globals.NumberTest);
  57940. $core.addMethod(
  57941. $core.method({
  57942. selector: "testArithmetic",
  57943. protocol: "tests",
  57944. fn: function (){
  57945. var self=this,$self=this;
  57946. return $core.withContext(function($ctx1) {
  57947. var $1,$2,$3,$5,$4;
  57948. $1=(1.5).__plus((1));
  57949. $ctx1.sendIdx["+"]=1;
  57950. $self._assert_equals_($1,(2.5));
  57951. $ctx1.sendIdx["assert:equals:"]=1;
  57952. $2=(2).__minus((1));
  57953. $ctx1.sendIdx["-"]=1;
  57954. $self._assert_equals_($2,(1));
  57955. $ctx1.sendIdx["assert:equals:"]=2;
  57956. $self._assert_equals_((-2).__minus((1)),(-3));
  57957. $ctx1.sendIdx["assert:equals:"]=3;
  57958. $self._assert_equals_((12).__slash((2)),(6));
  57959. $ctx1.sendIdx["assert:equals:"]=4;
  57960. $3=(3).__star((4));
  57961. $ctx1.sendIdx["*"]=1;
  57962. $self._assert_equals_($3,(12));
  57963. $ctx1.sendIdx["assert:equals:"]=5;
  57964. $self._assert_equals_((7).__slash_slash((2)),(3));
  57965. $ctx1.sendIdx["assert:equals:"]=6;
  57966. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  57967. $ctx1.sendIdx["assert:equals:"]=7;
  57968. $5=(1).__plus((2));
  57969. $ctx1.sendIdx["+"]=2;
  57970. $4=$recv($5).__star((3));
  57971. $ctx1.sendIdx["*"]=2;
  57972. $self._assert_equals_($4,(9));
  57973. $ctx1.sendIdx["assert:equals:"]=8;
  57974. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  57975. return self;
  57976. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  57977. },
  57978. args: [],
  57979. 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",
  57980. referencedClasses: [],
  57981. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  57982. }),
  57983. $globals.NumberTest);
  57984. $core.addMethod(
  57985. $core.method({
  57986. selector: "testAsNumber",
  57987. protocol: "tests",
  57988. fn: function (){
  57989. var self=this,$self=this;
  57990. return $core.withContext(function($ctx1) {
  57991. $self._assert_equals_((3)._asNumber(),(3));
  57992. return self;
  57993. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  57994. },
  57995. args: [],
  57996. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  57997. referencedClasses: [],
  57998. messageSends: ["assert:equals:", "asNumber"]
  57999. }),
  58000. $globals.NumberTest);
  58001. $core.addMethod(
  58002. $core.method({
  58003. selector: "testBetweenAnd",
  58004. protocol: "tests",
  58005. fn: function (){
  58006. var self=this,$self=this;
  58007. return $core.withContext(function($ctx1) {
  58008. var $1,$3,$2,$5,$4;
  58009. $1=(4)._between_and_((3),(5));
  58010. $ctx1.sendIdx["between:and:"]=1;
  58011. $self._assert_($1);
  58012. $ctx1.sendIdx["assert:"]=1;
  58013. $3=(1)._between_and_((5),(6));
  58014. $ctx1.sendIdx["between:and:"]=2;
  58015. $2=$recv($3)._not();
  58016. $ctx1.sendIdx["not"]=1;
  58017. $self._assert_($2);
  58018. $ctx1.sendIdx["assert:"]=2;
  58019. $5=(90)._between_and_((67),(87));
  58020. $ctx1.sendIdx["between:and:"]=3;
  58021. $4=$recv($5)._not();
  58022. $self._assert_($4);
  58023. $ctx1.sendIdx["assert:"]=3;
  58024. $self._assert_((1)._between_and_((1),(1)));
  58025. return self;
  58026. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58027. },
  58028. args: [],
  58029. 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).",
  58030. referencedClasses: [],
  58031. messageSends: ["assert:", "between:and:", "not"]
  58032. }),
  58033. $globals.NumberTest);
  58034. $core.addMethod(
  58035. $core.method({
  58036. selector: "testCeiling",
  58037. protocol: "tests",
  58038. fn: function (){
  58039. var self=this,$self=this;
  58040. return $core.withContext(function($ctx1) {
  58041. var $1,$2;
  58042. $1=(1.2)._ceiling();
  58043. $ctx1.sendIdx["ceiling"]=1;
  58044. $self._assert_equals_($1,(2));
  58045. $ctx1.sendIdx["assert:equals:"]=1;
  58046. $2=(-1.2)._ceiling();
  58047. $ctx1.sendIdx["ceiling"]=2;
  58048. $self._assert_equals_($2,(-1));
  58049. $ctx1.sendIdx["assert:equals:"]=2;
  58050. $self._assert_equals_((1)._ceiling(),(1));
  58051. return self;
  58052. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58053. },
  58054. args: [],
  58055. 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.",
  58056. referencedClasses: [],
  58057. messageSends: ["assert:equals:", "ceiling"]
  58058. }),
  58059. $globals.NumberTest);
  58060. $core.addMethod(
  58061. $core.method({
  58062. selector: "testComparison",
  58063. protocol: "tests",
  58064. fn: function (){
  58065. var self=this,$self=this;
  58066. return $core.withContext(function($ctx1) {
  58067. var $1,$2,$3,$4;
  58068. $1=(3).__gt((2));
  58069. $ctx1.sendIdx[">"]=1;
  58070. $self._assert_($1);
  58071. $ctx1.sendIdx["assert:"]=1;
  58072. $2=(2).__lt((3));
  58073. $ctx1.sendIdx["<"]=1;
  58074. $self._assert_($2);
  58075. $ctx1.sendIdx["assert:"]=2;
  58076. $self._deny_((3).__lt((2)));
  58077. $ctx1.sendIdx["deny:"]=1;
  58078. $self._deny_((2).__gt((3)));
  58079. $3=(3).__gt_eq((3));
  58080. $ctx1.sendIdx[">="]=1;
  58081. $self._assert_($3);
  58082. $ctx1.sendIdx["assert:"]=3;
  58083. $self._assert_((3.1).__gt_eq((3)));
  58084. $ctx1.sendIdx["assert:"]=4;
  58085. $4=(3).__lt_eq((3));
  58086. $ctx1.sendIdx["<="]=1;
  58087. $self._assert_($4);
  58088. $ctx1.sendIdx["assert:"]=5;
  58089. $self._assert_((3).__lt_eq((3.1)));
  58090. return self;
  58091. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58092. },
  58093. args: [],
  58094. 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",
  58095. referencedClasses: [],
  58096. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58097. }),
  58098. $globals.NumberTest);
  58099. $core.addMethod(
  58100. $core.method({
  58101. selector: "testCopying",
  58102. protocol: "tests",
  58103. fn: function (){
  58104. var self=this,$self=this;
  58105. return $core.withContext(function($ctx1) {
  58106. var $1;
  58107. $1=$recv((1)._copy()).__eq_eq((1));
  58108. $ctx1.sendIdx["=="]=1;
  58109. $self._assert_($1);
  58110. $ctx1.sendIdx["assert:"]=1;
  58111. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58112. return self;
  58113. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58114. },
  58115. args: [],
  58116. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58117. referencedClasses: [],
  58118. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58119. }),
  58120. $globals.NumberTest);
  58121. $core.addMethod(
  58122. $core.method({
  58123. selector: "testDegreesToRadians",
  58124. protocol: "tests",
  58125. fn: function (){
  58126. var self=this,$self=this;
  58127. return $core.withContext(function($ctx1) {
  58128. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58129. return self;
  58130. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58131. },
  58132. args: [],
  58133. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58134. referencedClasses: ["Number"],
  58135. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58136. }),
  58137. $globals.NumberTest);
  58138. $core.addMethod(
  58139. $core.method({
  58140. selector: "testEquality",
  58141. protocol: "tests",
  58142. fn: function (){
  58143. var self=this,$self=this;
  58144. return $core.withContext(function($ctx1) {
  58145. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58146. $1=(1).__eq((1));
  58147. $ctx1.sendIdx["="]=1;
  58148. $self._assert_($1);
  58149. $ctx1.sendIdx["assert:"]=1;
  58150. $2=(0).__eq((0));
  58151. $ctx1.sendIdx["="]=2;
  58152. $self._assert_($2);
  58153. $ctx1.sendIdx["assert:"]=2;
  58154. $3=(1).__eq((0));
  58155. $ctx1.sendIdx["="]=3;
  58156. $self._deny_($3);
  58157. $ctx1.sendIdx["deny:"]=1;
  58158. $5=(1)._yourself();
  58159. $ctx1.sendIdx["yourself"]=1;
  58160. $4=$recv($5).__eq((1));
  58161. $ctx1.sendIdx["="]=4;
  58162. $self._assert_($4);
  58163. $ctx1.sendIdx["assert:"]=3;
  58164. $7=(1)._yourself();
  58165. $ctx1.sendIdx["yourself"]=2;
  58166. $6=(1).__eq($7);
  58167. $ctx1.sendIdx["="]=5;
  58168. $self._assert_($6);
  58169. $ctx1.sendIdx["assert:"]=4;
  58170. $9=(1)._yourself();
  58171. $ctx1.sendIdx["yourself"]=3;
  58172. $8=$recv($9).__eq((1)._yourself());
  58173. $ctx1.sendIdx["="]=6;
  58174. $self._assert_($8);
  58175. $10=(0).__eq(false);
  58176. $ctx1.sendIdx["="]=7;
  58177. $self._deny_($10);
  58178. $ctx1.sendIdx["deny:"]=2;
  58179. $11=false.__eq((0));
  58180. $ctx1.sendIdx["="]=8;
  58181. $self._deny_($11);
  58182. $ctx1.sendIdx["deny:"]=3;
  58183. $12="".__eq((0));
  58184. $ctx1.sendIdx["="]=9;
  58185. $self._deny_($12);
  58186. $ctx1.sendIdx["deny:"]=4;
  58187. $self._deny_((0).__eq(""));
  58188. return self;
  58189. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58190. },
  58191. args: [],
  58192. 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 = ''",
  58193. referencedClasses: [],
  58194. messageSends: ["assert:", "=", "deny:", "yourself"]
  58195. }),
  58196. $globals.NumberTest);
  58197. $core.addMethod(
  58198. $core.method({
  58199. selector: "testFloor",
  58200. protocol: "tests",
  58201. fn: function (){
  58202. var self=this,$self=this;
  58203. return $core.withContext(function($ctx1) {
  58204. var $1,$2;
  58205. $1=(1.2)._floor();
  58206. $ctx1.sendIdx["floor"]=1;
  58207. $self._assert_equals_($1,(1));
  58208. $ctx1.sendIdx["assert:equals:"]=1;
  58209. $2=(-1.2)._floor();
  58210. $ctx1.sendIdx["floor"]=2;
  58211. $self._assert_equals_($2,(-2));
  58212. $ctx1.sendIdx["assert:equals:"]=2;
  58213. $self._assert_equals_((1)._floor(),(1));
  58214. return self;
  58215. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58216. },
  58217. args: [],
  58218. 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.",
  58219. referencedClasses: [],
  58220. messageSends: ["assert:equals:", "floor"]
  58221. }),
  58222. $globals.NumberTest);
  58223. $core.addMethod(
  58224. $core.method({
  58225. selector: "testHexNumbers",
  58226. protocol: "tests",
  58227. fn: function (){
  58228. var self=this,$self=this;
  58229. return $core.withContext(function($ctx1) {
  58230. var $1,$2,$3,$4,$5;
  58231. $self._assert_equals_((9),(9));
  58232. $ctx1.sendIdx["assert:equals:"]=1;
  58233. $1=(10)._truncated();
  58234. $ctx1.sendIdx["truncated"]=1;
  58235. $self._assert_equals_($1,(10));
  58236. $ctx1.sendIdx["assert:equals:"]=2;
  58237. $2=(11)._truncated();
  58238. $ctx1.sendIdx["truncated"]=2;
  58239. $self._assert_equals_($2,(11));
  58240. $ctx1.sendIdx["assert:equals:"]=3;
  58241. $3=(12)._truncated();
  58242. $ctx1.sendIdx["truncated"]=3;
  58243. $self._assert_equals_($3,(12));
  58244. $ctx1.sendIdx["assert:equals:"]=4;
  58245. $4=(13)._truncated();
  58246. $ctx1.sendIdx["truncated"]=4;
  58247. $self._assert_equals_($4,(13));
  58248. $ctx1.sendIdx["assert:equals:"]=5;
  58249. $5=(14)._truncated();
  58250. $ctx1.sendIdx["truncated"]=5;
  58251. $self._assert_equals_($5,(14));
  58252. $ctx1.sendIdx["assert:equals:"]=6;
  58253. $self._assert_equals_((15)._truncated(),(15));
  58254. return self;
  58255. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58256. },
  58257. args: [],
  58258. 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",
  58259. referencedClasses: [],
  58260. messageSends: ["assert:equals:", "truncated"]
  58261. }),
  58262. $globals.NumberTest);
  58263. $core.addMethod(
  58264. $core.method({
  58265. selector: "testIdentity",
  58266. protocol: "tests",
  58267. fn: function (){
  58268. var self=this,$self=this;
  58269. return $core.withContext(function($ctx1) {
  58270. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58271. $1=(1).__eq_eq((1));
  58272. $ctx1.sendIdx["=="]=1;
  58273. $self._assert_($1);
  58274. $ctx1.sendIdx["assert:"]=1;
  58275. $2=(0).__eq_eq((0));
  58276. $ctx1.sendIdx["=="]=2;
  58277. $self._assert_($2);
  58278. $ctx1.sendIdx["assert:"]=2;
  58279. $3=(1).__eq_eq((0));
  58280. $ctx1.sendIdx["=="]=3;
  58281. $self._deny_($3);
  58282. $ctx1.sendIdx["deny:"]=1;
  58283. $5=(1)._yourself();
  58284. $ctx1.sendIdx["yourself"]=1;
  58285. $4=$recv($5).__eq_eq((1));
  58286. $ctx1.sendIdx["=="]=4;
  58287. $self._assert_($4);
  58288. $ctx1.sendIdx["assert:"]=3;
  58289. $7=(1)._yourself();
  58290. $ctx1.sendIdx["yourself"]=2;
  58291. $6=(1).__eq_eq($7);
  58292. $ctx1.sendIdx["=="]=5;
  58293. $self._assert_($6);
  58294. $ctx1.sendIdx["assert:"]=4;
  58295. $9=(1)._yourself();
  58296. $ctx1.sendIdx["yourself"]=3;
  58297. $8=$recv($9).__eq_eq((1)._yourself());
  58298. $ctx1.sendIdx["=="]=6;
  58299. $self._assert_($8);
  58300. $self._deny_((1).__eq_eq((2)));
  58301. return self;
  58302. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58303. },
  58304. args: [],
  58305. 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",
  58306. referencedClasses: [],
  58307. messageSends: ["assert:", "==", "deny:", "yourself"]
  58308. }),
  58309. $globals.NumberTest);
  58310. $core.addMethod(
  58311. $core.method({
  58312. selector: "testInvalidHexNumbers",
  58313. protocol: "tests",
  58314. fn: function (){
  58315. var self=this,$self=this;
  58316. return $core.withContext(function($ctx1) {
  58317. $self._should_raise_((function(){
  58318. return $core.withContext(function($ctx2) {
  58319. return (16)._rG();
  58320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58321. }),$globals.MessageNotUnderstood);
  58322. $ctx1.sendIdx["should:raise:"]=1;
  58323. $self._should_raise_((function(){
  58324. return $core.withContext(function($ctx2) {
  58325. return (16)._rg();
  58326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58327. }),$globals.MessageNotUnderstood);
  58328. $ctx1.sendIdx["should:raise:"]=2;
  58329. $self._should_raise_((function(){
  58330. return $core.withContext(function($ctx2) {
  58331. return (16)._rH();
  58332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58333. }),$globals.MessageNotUnderstood);
  58334. $ctx1.sendIdx["should:raise:"]=3;
  58335. $self._should_raise_((function(){
  58336. return $core.withContext(function($ctx2) {
  58337. return (16)._rh();
  58338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58339. }),$globals.MessageNotUnderstood);
  58340. $ctx1.sendIdx["should:raise:"]=4;
  58341. $self._should_raise_((function(){
  58342. return $core.withContext(function($ctx2) {
  58343. return (16)._rI();
  58344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58345. }),$globals.MessageNotUnderstood);
  58346. $ctx1.sendIdx["should:raise:"]=5;
  58347. $self._should_raise_((function(){
  58348. return $core.withContext(function($ctx2) {
  58349. return (16)._ri();
  58350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58351. }),$globals.MessageNotUnderstood);
  58352. $ctx1.sendIdx["should:raise:"]=6;
  58353. $self._should_raise_((function(){
  58354. return $core.withContext(function($ctx2) {
  58355. return (16)._rJ();
  58356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58357. }),$globals.MessageNotUnderstood);
  58358. $ctx1.sendIdx["should:raise:"]=7;
  58359. $self._should_raise_((function(){
  58360. return $core.withContext(function($ctx2) {
  58361. return (16)._rj();
  58362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58363. }),$globals.MessageNotUnderstood);
  58364. $ctx1.sendIdx["should:raise:"]=8;
  58365. $self._should_raise_((function(){
  58366. return $core.withContext(function($ctx2) {
  58367. return (16)._rK();
  58368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58369. }),$globals.MessageNotUnderstood);
  58370. $ctx1.sendIdx["should:raise:"]=9;
  58371. $self._should_raise_((function(){
  58372. return $core.withContext(function($ctx2) {
  58373. return (16)._rk();
  58374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58375. }),$globals.MessageNotUnderstood);
  58376. $ctx1.sendIdx["should:raise:"]=10;
  58377. $self._should_raise_((function(){
  58378. return $core.withContext(function($ctx2) {
  58379. return (16)._rL();
  58380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58381. }),$globals.MessageNotUnderstood);
  58382. $ctx1.sendIdx["should:raise:"]=11;
  58383. $self._should_raise_((function(){
  58384. return $core.withContext(function($ctx2) {
  58385. return (16)._rl();
  58386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58387. }),$globals.MessageNotUnderstood);
  58388. $ctx1.sendIdx["should:raise:"]=12;
  58389. $self._should_raise_((function(){
  58390. return $core.withContext(function($ctx2) {
  58391. return (16)._rM();
  58392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58393. }),$globals.MessageNotUnderstood);
  58394. $ctx1.sendIdx["should:raise:"]=13;
  58395. $self._should_raise_((function(){
  58396. return $core.withContext(function($ctx2) {
  58397. return (16)._rm();
  58398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58399. }),$globals.MessageNotUnderstood);
  58400. $ctx1.sendIdx["should:raise:"]=14;
  58401. $self._should_raise_((function(){
  58402. return $core.withContext(function($ctx2) {
  58403. return (16)._rN();
  58404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  58405. }),$globals.MessageNotUnderstood);
  58406. $ctx1.sendIdx["should:raise:"]=15;
  58407. $self._should_raise_((function(){
  58408. return $core.withContext(function($ctx2) {
  58409. return (16)._rn();
  58410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  58411. }),$globals.MessageNotUnderstood);
  58412. $ctx1.sendIdx["should:raise:"]=16;
  58413. $self._should_raise_((function(){
  58414. return $core.withContext(function($ctx2) {
  58415. return (16)._rO();
  58416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  58417. }),$globals.MessageNotUnderstood);
  58418. $ctx1.sendIdx["should:raise:"]=17;
  58419. $self._should_raise_((function(){
  58420. return $core.withContext(function($ctx2) {
  58421. return (16)._ro();
  58422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  58423. }),$globals.MessageNotUnderstood);
  58424. $ctx1.sendIdx["should:raise:"]=18;
  58425. $self._should_raise_((function(){
  58426. return $core.withContext(function($ctx2) {
  58427. return (16)._rP();
  58428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  58429. }),$globals.MessageNotUnderstood);
  58430. $ctx1.sendIdx["should:raise:"]=19;
  58431. $self._should_raise_((function(){
  58432. return $core.withContext(function($ctx2) {
  58433. return (16)._rp();
  58434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  58435. }),$globals.MessageNotUnderstood);
  58436. $ctx1.sendIdx["should:raise:"]=20;
  58437. $self._should_raise_((function(){
  58438. return $core.withContext(function($ctx2) {
  58439. return (16)._rQ();
  58440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  58441. }),$globals.MessageNotUnderstood);
  58442. $ctx1.sendIdx["should:raise:"]=21;
  58443. $self._should_raise_((function(){
  58444. return $core.withContext(function($ctx2) {
  58445. return (16)._rq();
  58446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  58447. }),$globals.MessageNotUnderstood);
  58448. $ctx1.sendIdx["should:raise:"]=22;
  58449. $self._should_raise_((function(){
  58450. return $core.withContext(function($ctx2) {
  58451. return (16)._rR();
  58452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  58453. }),$globals.MessageNotUnderstood);
  58454. $ctx1.sendIdx["should:raise:"]=23;
  58455. $self._should_raise_((function(){
  58456. return $core.withContext(function($ctx2) {
  58457. return (16)._rr();
  58458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  58459. }),$globals.MessageNotUnderstood);
  58460. $ctx1.sendIdx["should:raise:"]=24;
  58461. $self._should_raise_((function(){
  58462. return $core.withContext(function($ctx2) {
  58463. return (16)._rS();
  58464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  58465. }),$globals.MessageNotUnderstood);
  58466. $ctx1.sendIdx["should:raise:"]=25;
  58467. $self._should_raise_((function(){
  58468. return $core.withContext(function($ctx2) {
  58469. return (16)._rs();
  58470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  58471. }),$globals.MessageNotUnderstood);
  58472. $ctx1.sendIdx["should:raise:"]=26;
  58473. $self._should_raise_((function(){
  58474. return $core.withContext(function($ctx2) {
  58475. return (16)._rT();
  58476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  58477. }),$globals.MessageNotUnderstood);
  58478. $ctx1.sendIdx["should:raise:"]=27;
  58479. $self._should_raise_((function(){
  58480. return $core.withContext(function($ctx2) {
  58481. return (16)._rt();
  58482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  58483. }),$globals.MessageNotUnderstood);
  58484. $ctx1.sendIdx["should:raise:"]=28;
  58485. $self._should_raise_((function(){
  58486. return $core.withContext(function($ctx2) {
  58487. return (16)._rU();
  58488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  58489. }),$globals.MessageNotUnderstood);
  58490. $ctx1.sendIdx["should:raise:"]=29;
  58491. $self._should_raise_((function(){
  58492. return $core.withContext(function($ctx2) {
  58493. return (16)._ru();
  58494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  58495. }),$globals.MessageNotUnderstood);
  58496. $ctx1.sendIdx["should:raise:"]=30;
  58497. $self._should_raise_((function(){
  58498. return $core.withContext(function($ctx2) {
  58499. return (16)._rV();
  58500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  58501. }),$globals.MessageNotUnderstood);
  58502. $ctx1.sendIdx["should:raise:"]=31;
  58503. $self._should_raise_((function(){
  58504. return $core.withContext(function($ctx2) {
  58505. return (16)._rv();
  58506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  58507. }),$globals.MessageNotUnderstood);
  58508. $ctx1.sendIdx["should:raise:"]=32;
  58509. $self._should_raise_((function(){
  58510. return $core.withContext(function($ctx2) {
  58511. return (16)._rW();
  58512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  58513. }),$globals.MessageNotUnderstood);
  58514. $ctx1.sendIdx["should:raise:"]=33;
  58515. $self._should_raise_((function(){
  58516. return $core.withContext(function($ctx2) {
  58517. return (16)._rw();
  58518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  58519. }),$globals.MessageNotUnderstood);
  58520. $ctx1.sendIdx["should:raise:"]=34;
  58521. $self._should_raise_((function(){
  58522. return $core.withContext(function($ctx2) {
  58523. return (16)._rX();
  58524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  58525. }),$globals.MessageNotUnderstood);
  58526. $ctx1.sendIdx["should:raise:"]=35;
  58527. $self._should_raise_((function(){
  58528. return $core.withContext(function($ctx2) {
  58529. return (16)._rx();
  58530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  58531. }),$globals.MessageNotUnderstood);
  58532. $ctx1.sendIdx["should:raise:"]=36;
  58533. $self._should_raise_((function(){
  58534. return $core.withContext(function($ctx2) {
  58535. return (16)._rY();
  58536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  58537. }),$globals.MessageNotUnderstood);
  58538. $ctx1.sendIdx["should:raise:"]=37;
  58539. $self._should_raise_((function(){
  58540. return $core.withContext(function($ctx2) {
  58541. return (16)._ry();
  58542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  58543. }),$globals.MessageNotUnderstood);
  58544. $ctx1.sendIdx["should:raise:"]=38;
  58545. $self._should_raise_((function(){
  58546. return $core.withContext(function($ctx2) {
  58547. return (16)._rZ();
  58548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  58549. }),$globals.MessageNotUnderstood);
  58550. $ctx1.sendIdx["should:raise:"]=39;
  58551. $self._should_raise_((function(){
  58552. return $core.withContext(function($ctx2) {
  58553. return (16)._rz();
  58554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  58555. }),$globals.MessageNotUnderstood);
  58556. $ctx1.sendIdx["should:raise:"]=40;
  58557. $self._should_raise_((function(){
  58558. return $core.withContext(function($ctx2) {
  58559. return (11259375)._Z();
  58560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  58561. }),$globals.MessageNotUnderstood);
  58562. return self;
  58563. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  58564. },
  58565. args: [],
  58566. 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.",
  58567. referencedClasses: ["MessageNotUnderstood"],
  58568. 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"]
  58569. }),
  58570. $globals.NumberTest);
  58571. $core.addMethod(
  58572. $core.method({
  58573. selector: "testLog",
  58574. protocol: "tests",
  58575. fn: function (){
  58576. var self=this,$self=this;
  58577. return $core.withContext(function($ctx1) {
  58578. $self._assert_equals_((10000)._log(),(4));
  58579. $ctx1.sendIdx["assert:equals:"]=1;
  58580. $self._assert_equals_((512)._log_((2)),(9));
  58581. $ctx1.sendIdx["assert:equals:"]=2;
  58582. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  58583. return self;
  58584. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  58585. },
  58586. args: [],
  58587. 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.",
  58588. referencedClasses: ["Number"],
  58589. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  58590. }),
  58591. $globals.NumberTest);
  58592. $core.addMethod(
  58593. $core.method({
  58594. selector: "testMinMax",
  58595. protocol: "tests",
  58596. fn: function (){
  58597. var self=this,$self=this;
  58598. return $core.withContext(function($ctx1) {
  58599. var $1,$2;
  58600. $self._assert_equals_((2)._max_((5)),(5));
  58601. $ctx1.sendIdx["assert:equals:"]=1;
  58602. $self._assert_equals_((2)._min_((5)),(2));
  58603. $ctx1.sendIdx["assert:equals:"]=2;
  58604. $1=(2)._min_max_((5),(3));
  58605. $ctx1.sendIdx["min:max:"]=1;
  58606. $self._assert_equals_($1,(3));
  58607. $ctx1.sendIdx["assert:equals:"]=3;
  58608. $2=(7)._min_max_((5),(3));
  58609. $ctx1.sendIdx["min:max:"]=2;
  58610. $self._assert_equals_($2,(5));
  58611. $ctx1.sendIdx["assert:equals:"]=4;
  58612. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  58613. return self;
  58614. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  58615. },
  58616. args: [],
  58617. 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.",
  58618. referencedClasses: [],
  58619. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  58620. }),
  58621. $globals.NumberTest);
  58622. $core.addMethod(
  58623. $core.method({
  58624. selector: "testNegated",
  58625. protocol: "tests",
  58626. fn: function (){
  58627. var self=this,$self=this;
  58628. return $core.withContext(function($ctx1) {
  58629. var $1;
  58630. $1=(3)._negated();
  58631. $ctx1.sendIdx["negated"]=1;
  58632. $self._assert_equals_($1,(-3));
  58633. $ctx1.sendIdx["assert:equals:"]=1;
  58634. $self._assert_equals_((-3)._negated(),(3));
  58635. return self;
  58636. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  58637. },
  58638. args: [],
  58639. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  58640. referencedClasses: [],
  58641. messageSends: ["assert:equals:", "negated"]
  58642. }),
  58643. $globals.NumberTest);
  58644. $core.addMethod(
  58645. $core.method({
  58646. selector: "testPrintShowingDecimalPlaces",
  58647. protocol: "tests",
  58648. fn: function (){
  58649. var self=this,$self=this;
  58650. return $core.withContext(function($ctx1) {
  58651. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  58652. $1=(23)._printShowingDecimalPlaces_((2));
  58653. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  58654. $self._assert_equals_($1,"23.00");
  58655. $ctx1.sendIdx["assert:equals:"]=1;
  58656. $2=(23.5698)._printShowingDecimalPlaces_((2));
  58657. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  58658. $self._assert_equals_($2,"23.57");
  58659. $ctx1.sendIdx["assert:equals:"]=2;
  58660. $4=(234.567)._negated();
  58661. $ctx1.sendIdx["negated"]=1;
  58662. $3=$recv($4)._printShowingDecimalPlaces_((5));
  58663. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  58664. $self._assert_equals_($3,"-234.56700");
  58665. $ctx1.sendIdx["assert:equals:"]=3;
  58666. $5=(23.4567)._printShowingDecimalPlaces_((0));
  58667. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  58668. $self._assert_equals_($5,"23");
  58669. $ctx1.sendIdx["assert:equals:"]=4;
  58670. $6=(23.5567)._printShowingDecimalPlaces_((0));
  58671. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  58672. $self._assert_equals_($6,"24");
  58673. $ctx1.sendIdx["assert:equals:"]=5;
  58674. $8=(23.4567)._negated();
  58675. $ctx1.sendIdx["negated"]=2;
  58676. $7=$recv($8)._printShowingDecimalPlaces_((0));
  58677. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  58678. $self._assert_equals_($7,"-23");
  58679. $ctx1.sendIdx["assert:equals:"]=6;
  58680. $10=(23.5567)._negated();
  58681. $ctx1.sendIdx["negated"]=3;
  58682. $9=$recv($10)._printShowingDecimalPlaces_((0));
  58683. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  58684. $self._assert_equals_($9,"-24");
  58685. $ctx1.sendIdx["assert:equals:"]=7;
  58686. $11=(100000000)._printShowingDecimalPlaces_((1));
  58687. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  58688. $self._assert_equals_($11,"100000000.0");
  58689. $ctx1.sendIdx["assert:equals:"]=8;
  58690. $12=(0.98)._printShowingDecimalPlaces_((5));
  58691. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  58692. $self._assert_equals_($12,"0.98000");
  58693. $ctx1.sendIdx["assert:equals:"]=9;
  58694. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  58695. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  58696. $self._assert_equals_($13,"-0.98");
  58697. $ctx1.sendIdx["assert:equals:"]=10;
  58698. $14=(2.567)._printShowingDecimalPlaces_((2));
  58699. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  58700. $self._assert_equals_($14,"2.57");
  58701. $ctx1.sendIdx["assert:equals:"]=11;
  58702. $15=(-2.567)._printShowingDecimalPlaces_((2));
  58703. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  58704. $self._assert_equals_($15,"-2.57");
  58705. $ctx1.sendIdx["assert:equals:"]=12;
  58706. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  58707. return self;
  58708. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  58709. },
  58710. args: [],
  58711. 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'.",
  58712. referencedClasses: [],
  58713. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  58714. }),
  58715. $globals.NumberTest);
  58716. $core.addMethod(
  58717. $core.method({
  58718. selector: "testRadiansToDegrees",
  58719. protocol: "tests",
  58720. fn: function (){
  58721. var self=this,$self=this;
  58722. return $core.withContext(function($ctx1) {
  58723. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  58724. return self;
  58725. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  58726. },
  58727. args: [],
  58728. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  58729. referencedClasses: ["Number"],
  58730. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  58731. }),
  58732. $globals.NumberTest);
  58733. $core.addMethod(
  58734. $core.method({
  58735. selector: "testRaisedTo",
  58736. protocol: "tests",
  58737. fn: function (){
  58738. var self=this,$self=this;
  58739. return $core.withContext(function($ctx1) {
  58740. var $1,$2,$3;
  58741. $1=(2)._raisedTo_((4));
  58742. $ctx1.sendIdx["raisedTo:"]=1;
  58743. $self._assert_equals_($1,(16));
  58744. $ctx1.sendIdx["assert:equals:"]=1;
  58745. $2=(2)._raisedTo_((0));
  58746. $ctx1.sendIdx["raisedTo:"]=2;
  58747. $self._assert_equals_($2,(1));
  58748. $ctx1.sendIdx["assert:equals:"]=2;
  58749. $3=(2)._raisedTo_((-3));
  58750. $ctx1.sendIdx["raisedTo:"]=3;
  58751. $self._assert_equals_($3,(0.125));
  58752. $ctx1.sendIdx["assert:equals:"]=3;
  58753. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  58754. $ctx1.sendIdx["assert:equals:"]=4;
  58755. $self._assert_equals_((2).__star_star((4)),(16));
  58756. return self;
  58757. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  58758. },
  58759. args: [],
  58760. 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.",
  58761. referencedClasses: [],
  58762. messageSends: ["assert:equals:", "raisedTo:", "**"]
  58763. }),
  58764. $globals.NumberTest);
  58765. $core.addMethod(
  58766. $core.method({
  58767. selector: "testRounded",
  58768. protocol: "tests",
  58769. fn: function (){
  58770. var self=this,$self=this;
  58771. return $core.withContext(function($ctx1) {
  58772. var $1,$2;
  58773. $1=(3)._rounded();
  58774. $ctx1.sendIdx["rounded"]=1;
  58775. $self._assert_equals_($1,(3));
  58776. $ctx1.sendIdx["assert:equals:"]=1;
  58777. $2=(3.212)._rounded();
  58778. $ctx1.sendIdx["rounded"]=2;
  58779. $self._assert_equals_($2,(3));
  58780. $ctx1.sendIdx["assert:equals:"]=2;
  58781. $self._assert_equals_((3.51)._rounded(),(4));
  58782. return self;
  58783. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  58784. },
  58785. args: [],
  58786. 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",
  58787. referencedClasses: [],
  58788. messageSends: ["assert:equals:", "rounded"]
  58789. }),
  58790. $globals.NumberTest);
  58791. $core.addMethod(
  58792. $core.method({
  58793. selector: "testSign",
  58794. protocol: "tests",
  58795. fn: function (){
  58796. var self=this,$self=this;
  58797. return $core.withContext(function($ctx1) {
  58798. var $1,$2;
  58799. $1=(5)._sign();
  58800. $ctx1.sendIdx["sign"]=1;
  58801. $self._assert_equals_($1,(1));
  58802. $ctx1.sendIdx["assert:equals:"]=1;
  58803. $2=(0)._sign();
  58804. $ctx1.sendIdx["sign"]=2;
  58805. $self._assert_equals_($2,(0));
  58806. $ctx1.sendIdx["assert:equals:"]=2;
  58807. $self._assert_equals_((-1.4)._sign(),(-1));
  58808. return self;
  58809. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  58810. },
  58811. args: [],
  58812. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  58813. referencedClasses: [],
  58814. messageSends: ["assert:equals:", "sign"]
  58815. }),
  58816. $globals.NumberTest);
  58817. $core.addMethod(
  58818. $core.method({
  58819. selector: "testSqrt",
  58820. protocol: "tests",
  58821. fn: function (){
  58822. var self=this,$self=this;
  58823. return $core.withContext(function($ctx1) {
  58824. var $1;
  58825. $1=(4)._sqrt();
  58826. $ctx1.sendIdx["sqrt"]=1;
  58827. $self._assert_equals_($1,(2));
  58828. $ctx1.sendIdx["assert:equals:"]=1;
  58829. $self._assert_equals_((16)._sqrt(),(4));
  58830. return self;
  58831. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  58832. },
  58833. args: [],
  58834. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  58835. referencedClasses: [],
  58836. messageSends: ["assert:equals:", "sqrt"]
  58837. }),
  58838. $globals.NumberTest);
  58839. $core.addMethod(
  58840. $core.method({
  58841. selector: "testSquared",
  58842. protocol: "tests",
  58843. fn: function (){
  58844. var self=this,$self=this;
  58845. return $core.withContext(function($ctx1) {
  58846. $self._assert_equals_((4)._squared(),(16));
  58847. return self;
  58848. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  58849. },
  58850. args: [],
  58851. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  58852. referencedClasses: [],
  58853. messageSends: ["assert:equals:", "squared"]
  58854. }),
  58855. $globals.NumberTest);
  58856. $core.addMethod(
  58857. $core.method({
  58858. selector: "testTimesRepeat",
  58859. protocol: "tests",
  58860. fn: function (){
  58861. var self=this,$self=this;
  58862. var i;
  58863. return $core.withContext(function($ctx1) {
  58864. i=(0);
  58865. (0)._timesRepeat_((function(){
  58866. return $core.withContext(function($ctx2) {
  58867. i=$recv(i).__plus((1));
  58868. $ctx2.sendIdx["+"]=1;
  58869. return i;
  58870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58871. }));
  58872. $ctx1.sendIdx["timesRepeat:"]=1;
  58873. $self._assert_equals_(i,(0));
  58874. $ctx1.sendIdx["assert:equals:"]=1;
  58875. (5)._timesRepeat_((function(){
  58876. return $core.withContext(function($ctx2) {
  58877. i=$recv(i).__plus((1));
  58878. return i;
  58879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58880. }));
  58881. $self._assert_equals_(i,(5));
  58882. return self;
  58883. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  58884. },
  58885. args: [],
  58886. 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",
  58887. referencedClasses: [],
  58888. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  58889. }),
  58890. $globals.NumberTest);
  58891. $core.addMethod(
  58892. $core.method({
  58893. selector: "testTo",
  58894. protocol: "tests",
  58895. fn: function (){
  58896. var self=this,$self=this;
  58897. return $core.withContext(function($ctx1) {
  58898. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  58899. return self;
  58900. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  58901. },
  58902. args: [],
  58903. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  58904. referencedClasses: [],
  58905. messageSends: ["assert:equals:", "to:"]
  58906. }),
  58907. $globals.NumberTest);
  58908. $core.addMethod(
  58909. $core.method({
  58910. selector: "testToBy",
  58911. protocol: "tests",
  58912. fn: function (){
  58913. var self=this,$self=this;
  58914. return $core.withContext(function($ctx1) {
  58915. var $1;
  58916. $1=(0)._to_by_((6),(2));
  58917. $ctx1.sendIdx["to:by:"]=1;
  58918. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  58919. $self._should_raise_((function(){
  58920. return $core.withContext(function($ctx2) {
  58921. return (1)._to_by_((4),(0));
  58922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58923. }),$globals.Error);
  58924. return self;
  58925. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  58926. },
  58927. args: [],
  58928. 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",
  58929. referencedClasses: ["Error"],
  58930. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  58931. }),
  58932. $globals.NumberTest);
  58933. $core.addMethod(
  58934. $core.method({
  58935. selector: "testTrigonometry",
  58936. protocol: "tests",
  58937. fn: function (){
  58938. var self=this,$self=this;
  58939. return $core.withContext(function($ctx1) {
  58940. var $1;
  58941. $self._assert_equals_((0)._cos(),(1));
  58942. $ctx1.sendIdx["assert:equals:"]=1;
  58943. $self._assert_equals_((0)._sin(),(0));
  58944. $ctx1.sendIdx["assert:equals:"]=2;
  58945. $self._assert_equals_((0)._tan(),(0));
  58946. $ctx1.sendIdx["assert:equals:"]=3;
  58947. $self._assert_equals_((1)._arcCos(),(0));
  58948. $ctx1.sendIdx["assert:equals:"]=4;
  58949. $self._assert_equals_((0)._arcSin(),(0));
  58950. $ctx1.sendIdx["assert:equals:"]=5;
  58951. $self._assert_equals_((0)._arcTan(),(0));
  58952. $ctx1.sendIdx["assert:equals:"]=6;
  58953. $1=(0)._arcTan_((1));
  58954. $ctx1.sendIdx["arcTan:"]=1;
  58955. $self._assert_equals_($1,(0));
  58956. $ctx1.sendIdx["assert:equals:"]=7;
  58957. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  58958. return self;
  58959. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  58960. },
  58961. args: [],
  58962. 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)",
  58963. referencedClasses: ["Number"],
  58964. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  58965. }),
  58966. $globals.NumberTest);
  58967. $core.addMethod(
  58968. $core.method({
  58969. selector: "testTruncated",
  58970. protocol: "tests",
  58971. fn: function (){
  58972. var self=this,$self=this;
  58973. return $core.withContext(function($ctx1) {
  58974. var $1,$2;
  58975. $1=(3)._truncated();
  58976. $ctx1.sendIdx["truncated"]=1;
  58977. $self._assert_equals_($1,(3));
  58978. $ctx1.sendIdx["assert:equals:"]=1;
  58979. $2=(3.212)._truncated();
  58980. $ctx1.sendIdx["truncated"]=2;
  58981. $self._assert_equals_($2,(3));
  58982. $ctx1.sendIdx["assert:equals:"]=2;
  58983. $self._assert_equals_((3.51)._truncated(),(3));
  58984. return self;
  58985. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  58986. },
  58987. args: [],
  58988. 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",
  58989. referencedClasses: [],
  58990. messageSends: ["assert:equals:", "truncated"]
  58991. }),
  58992. $globals.NumberTest);
  58993. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  58994. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  58995. $core.addMethod(
  58996. $core.method({
  58997. selector: "foo",
  58998. protocol: "not yet classified",
  58999. fn: function (){
  59000. var self=this,$self=this;
  59001. return $self["@foo"];
  59002. },
  59003. args: [],
  59004. source: "foo\x0a\x09^ foo",
  59005. referencedClasses: [],
  59006. messageSends: []
  59007. }),
  59008. $globals.ObjectMock);
  59009. $core.addMethod(
  59010. $core.method({
  59011. selector: "foo:",
  59012. protocol: "not yet classified",
  59013. fn: function (anObject){
  59014. var self=this,$self=this;
  59015. $self["@foo"]=anObject;
  59016. return self;
  59017. },
  59018. args: ["anObject"],
  59019. source: "foo: anObject\x0a\x09foo := anObject",
  59020. referencedClasses: [],
  59021. messageSends: []
  59022. }),
  59023. $globals.ObjectMock);
  59024. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59025. $core.addMethod(
  59026. $core.method({
  59027. selector: "notDefined",
  59028. protocol: "tests",
  59029. fn: function (){
  59030. var self=this,$self=this;
  59031. return $core.withContext(function($ctx1) {
  59032. return void 0;;
  59033. return self;
  59034. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59035. },
  59036. args: [],
  59037. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59038. referencedClasses: [],
  59039. messageSends: []
  59040. }),
  59041. $globals.ObjectTest);
  59042. $core.addMethod(
  59043. $core.method({
  59044. selector: "testBasicAccess",
  59045. protocol: "tests",
  59046. fn: function (){
  59047. var self=this,$self=this;
  59048. var o;
  59049. return $core.withContext(function($ctx1) {
  59050. var $1;
  59051. o=$recv($globals.Object)._new();
  59052. $recv(o)._basicAt_put_("a",(1));
  59053. $1=$recv(o)._basicAt_("a");
  59054. $ctx1.sendIdx["basicAt:"]=1;
  59055. $self._assert_equals_($1,(1));
  59056. $ctx1.sendIdx["assert:equals:"]=1;
  59057. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59058. return self;
  59059. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59060. },
  59061. args: [],
  59062. 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",
  59063. referencedClasses: ["Object"],
  59064. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59065. }),
  59066. $globals.ObjectTest);
  59067. $core.addMethod(
  59068. $core.method({
  59069. selector: "testBasicPerform",
  59070. protocol: "tests",
  59071. fn: function (){
  59072. var self=this,$self=this;
  59073. var o;
  59074. return $core.withContext(function($ctx1) {
  59075. o=$recv($globals.Object)._new();
  59076. $recv(o)._basicAt_put_("func",(function(){
  59077. return "hello";
  59078. }));
  59079. $ctx1.sendIdx["basicAt:put:"]=1;
  59080. $recv(o)._basicAt_put_("func2",(function(a){
  59081. return $core.withContext(function($ctx2) {
  59082. return $recv(a).__plus((1));
  59083. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59084. }));
  59085. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59086. $ctx1.sendIdx["assert:equals:"]=1;
  59087. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59088. return self;
  59089. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59090. },
  59091. args: [],
  59092. 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",
  59093. referencedClasses: ["Object"],
  59094. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59095. }),
  59096. $globals.ObjectTest);
  59097. $core.addMethod(
  59098. $core.method({
  59099. selector: "testDNU",
  59100. protocol: "tests",
  59101. fn: function (){
  59102. var self=this,$self=this;
  59103. return $core.withContext(function($ctx1) {
  59104. $self._should_raise_((function(){
  59105. return $core.withContext(function($ctx2) {
  59106. return $recv($recv($globals.Object)._new())._foo();
  59107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59108. }),$globals.MessageNotUnderstood);
  59109. return self;
  59110. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59111. },
  59112. args: [],
  59113. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59114. referencedClasses: ["Object", "MessageNotUnderstood"],
  59115. messageSends: ["should:raise:", "foo", "new"]
  59116. }),
  59117. $globals.ObjectTest);
  59118. $core.addMethod(
  59119. $core.method({
  59120. selector: "testEquality",
  59121. protocol: "tests",
  59122. fn: function (){
  59123. var self=this,$self=this;
  59124. var o;
  59125. return $core.withContext(function($ctx1) {
  59126. var $1,$2,$4,$3;
  59127. o=$recv($globals.Object)._new();
  59128. $ctx1.sendIdx["new"]=1;
  59129. $1=$recv(o).__eq($recv($globals.Object)._new());
  59130. $ctx1.sendIdx["="]=1;
  59131. $self._deny_($1);
  59132. $2=$recv(o).__eq(o);
  59133. $ctx1.sendIdx["="]=2;
  59134. $self._assert_($2);
  59135. $ctx1.sendIdx["assert:"]=1;
  59136. $4=$recv(o)._yourself();
  59137. $ctx1.sendIdx["yourself"]=1;
  59138. $3=$recv($4).__eq(o);
  59139. $ctx1.sendIdx["="]=3;
  59140. $self._assert_($3);
  59141. $ctx1.sendIdx["assert:"]=2;
  59142. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59143. return self;
  59144. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59145. },
  59146. args: [],
  59147. 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)",
  59148. referencedClasses: ["Object"],
  59149. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59150. }),
  59151. $globals.ObjectTest);
  59152. $core.addMethod(
  59153. $core.method({
  59154. selector: "testHalt",
  59155. protocol: "tests",
  59156. fn: function (){
  59157. var self=this,$self=this;
  59158. return $core.withContext(function($ctx1) {
  59159. $self._should_raise_((function(){
  59160. return $core.withContext(function($ctx2) {
  59161. return $recv($recv($globals.Object)._new())._halt();
  59162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59163. }),$globals.Error);
  59164. return self;
  59165. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59166. },
  59167. args: [],
  59168. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59169. referencedClasses: ["Object", "Error"],
  59170. messageSends: ["should:raise:", "halt", "new"]
  59171. }),
  59172. $globals.ObjectTest);
  59173. $core.addMethod(
  59174. $core.method({
  59175. selector: "testIdentity",
  59176. protocol: "tests",
  59177. fn: function (){
  59178. var self=this,$self=this;
  59179. var o;
  59180. return $core.withContext(function($ctx1) {
  59181. var $1,$2,$4,$3;
  59182. o=$recv($globals.Object)._new();
  59183. $ctx1.sendIdx["new"]=1;
  59184. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59185. $ctx1.sendIdx["=="]=1;
  59186. $self._deny_($1);
  59187. $2=$recv(o).__eq_eq(o);
  59188. $ctx1.sendIdx["=="]=2;
  59189. $self._assert_($2);
  59190. $ctx1.sendIdx["assert:"]=1;
  59191. $4=$recv(o)._yourself();
  59192. $ctx1.sendIdx["yourself"]=1;
  59193. $3=$recv($4).__eq_eq(o);
  59194. $ctx1.sendIdx["=="]=3;
  59195. $self._assert_($3);
  59196. $ctx1.sendIdx["assert:"]=2;
  59197. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59198. return self;
  59199. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59200. },
  59201. args: [],
  59202. 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",
  59203. referencedClasses: ["Object"],
  59204. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59205. }),
  59206. $globals.ObjectTest);
  59207. $core.addMethod(
  59208. $core.method({
  59209. selector: "testIfNil",
  59210. protocol: "tests",
  59211. fn: function (){
  59212. var self=this,$self=this;
  59213. return $core.withContext(function($ctx1) {
  59214. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59215. $2=$recv($globals.Object)._new();
  59216. $ctx1.sendIdx["new"]=1;
  59217. $1=$recv($2)._isNil();
  59218. $self._deny_($1);
  59219. $ctx1.sendIdx["deny:"]=1;
  59220. $5=$recv($globals.Object)._new();
  59221. $ctx1.sendIdx["new"]=2;
  59222. if(($receiver = $5) == null || $receiver.a$nil){
  59223. $4=true;
  59224. } else {
  59225. $4=$5;
  59226. }
  59227. $3=$recv($4).__eq(true);
  59228. $self._deny_($3);
  59229. $7=$recv($globals.Object)._new();
  59230. $ctx1.sendIdx["new"]=3;
  59231. if(($receiver = $7) == null || $receiver.a$nil){
  59232. $6=$7;
  59233. } else {
  59234. $6=true;
  59235. }
  59236. $self._assert_equals_($6,true);
  59237. $ctx1.sendIdx["assert:equals:"]=1;
  59238. $9=$recv($globals.Object)._new();
  59239. $ctx1.sendIdx["new"]=4;
  59240. if(($receiver = $9) == null || $receiver.a$nil){
  59241. $8=false;
  59242. } else {
  59243. $8=true;
  59244. }
  59245. $self._assert_equals_($8,true);
  59246. $ctx1.sendIdx["assert:equals:"]=2;
  59247. $11=$recv($globals.Object)._new();
  59248. if(($receiver = $11) == null || $receiver.a$nil){
  59249. $10=false;
  59250. } else {
  59251. $10=true;
  59252. }
  59253. $self._assert_equals_($10,true);
  59254. return self;
  59255. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59256. },
  59257. args: [],
  59258. 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",
  59259. referencedClasses: ["Object"],
  59260. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59261. }),
  59262. $globals.ObjectTest);
  59263. $core.addMethod(
  59264. $core.method({
  59265. selector: "testInstVars",
  59266. protocol: "tests",
  59267. fn: function (){
  59268. var self=this,$self=this;
  59269. var o;
  59270. return $core.withContext(function($ctx1) {
  59271. var $1,$2;
  59272. o=$recv($globals.ObjectMock)._new();
  59273. $1=$recv(o)._instVarAt_("foo");
  59274. $ctx1.sendIdx["instVarAt:"]=1;
  59275. $self._assert_equals_($1,nil);
  59276. $ctx1.sendIdx["assert:equals:"]=1;
  59277. $recv(o)._instVarAt_put_("foo",(1));
  59278. $2=$recv(o)._instVarAt_("foo");
  59279. $ctx1.sendIdx["instVarAt:"]=2;
  59280. $self._assert_equals_($2,(1));
  59281. $ctx1.sendIdx["assert:equals:"]=2;
  59282. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59283. return self;
  59284. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59285. },
  59286. args: [],
  59287. 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",
  59288. referencedClasses: ["ObjectMock"],
  59289. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59290. }),
  59291. $globals.ObjectTest);
  59292. $core.addMethod(
  59293. $core.method({
  59294. selector: "testNilUndefined",
  59295. protocol: "tests",
  59296. fn: function (){
  59297. var self=this,$self=this;
  59298. return $core.withContext(function($ctx1) {
  59299. $self._assert_equals_($self._notDefined(),nil);
  59300. return self;
  59301. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59302. },
  59303. args: [],
  59304. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59305. referencedClasses: [],
  59306. messageSends: ["assert:equals:", "notDefined"]
  59307. }),
  59308. $globals.ObjectTest);
  59309. $core.addMethod(
  59310. $core.method({
  59311. selector: "testYourself",
  59312. protocol: "tests",
  59313. fn: function (){
  59314. var self=this,$self=this;
  59315. var o;
  59316. return $core.withContext(function($ctx1) {
  59317. o=$recv($globals.ObjectMock)._new();
  59318. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59319. return self;
  59320. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59321. },
  59322. args: [],
  59323. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59324. referencedClasses: ["ObjectMock"],
  59325. messageSends: ["new", "assert:", "==", "yourself"]
  59326. }),
  59327. $globals.ObjectTest);
  59328. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59329. $core.addMethod(
  59330. $core.method({
  59331. selector: "testAccessing",
  59332. protocol: "tests",
  59333. fn: function (){
  59334. var self=this,$self=this;
  59335. return $core.withContext(function($ctx1) {
  59336. var $2,$1,$3,$6,$5,$4;
  59337. $2=$recv($globals.Point)._x_y_((3),(4));
  59338. $ctx1.sendIdx["x:y:"]=1;
  59339. $1=$recv($2)._x();
  59340. $ctx1.sendIdx["x"]=1;
  59341. $self._assert_equals_($1,(3));
  59342. $ctx1.sendIdx["assert:equals:"]=1;
  59343. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59344. $ctx1.sendIdx["y"]=1;
  59345. $self._assert_equals_($3,(4));
  59346. $ctx1.sendIdx["assert:equals:"]=2;
  59347. $6=$recv($globals.Point)._new();
  59348. $ctx1.sendIdx["new"]=1;
  59349. $5=$recv($6)._x_((3));
  59350. $4=$recv($5)._x();
  59351. $self._assert_equals_($4,(3));
  59352. $ctx1.sendIdx["assert:equals:"]=3;
  59353. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59354. return self;
  59355. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59356. },
  59357. args: [],
  59358. 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",
  59359. referencedClasses: ["Point"],
  59360. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59361. }),
  59362. $globals.PointTest);
  59363. $core.addMethod(
  59364. $core.method({
  59365. selector: "testAngle",
  59366. protocol: "tests",
  59367. fn: function (){
  59368. var self=this,$self=this;
  59369. return $core.withContext(function($ctx1) {
  59370. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  59371. return self;
  59372. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  59373. },
  59374. args: [],
  59375. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  59376. referencedClasses: ["Number"],
  59377. messageSends: ["assert:equals:", "angle", "@", "pi"]
  59378. }),
  59379. $globals.PointTest);
  59380. $core.addMethod(
  59381. $core.method({
  59382. selector: "testArithmetic",
  59383. protocol: "tests",
  59384. fn: function (){
  59385. var self=this,$self=this;
  59386. return $core.withContext(function($ctx1) {
  59387. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  59388. $2=(3).__at((4));
  59389. $ctx1.sendIdx["@"]=1;
  59390. $3=(3).__at((4));
  59391. $ctx1.sendIdx["@"]=2;
  59392. $1=$recv($2).__star($3);
  59393. $4=$recv($globals.Point)._x_y_((9),(16));
  59394. $ctx1.sendIdx["x:y:"]=1;
  59395. $self._assert_equals_($1,$4);
  59396. $ctx1.sendIdx["assert:equals:"]=1;
  59397. $6=(3).__at((4));
  59398. $ctx1.sendIdx["@"]=3;
  59399. $7=(3).__at((4));
  59400. $ctx1.sendIdx["@"]=4;
  59401. $5=$recv($6).__plus($7);
  59402. $8=$recv($globals.Point)._x_y_((6),(8));
  59403. $ctx1.sendIdx["x:y:"]=2;
  59404. $self._assert_equals_($5,$8);
  59405. $ctx1.sendIdx["assert:equals:"]=2;
  59406. $10=(3).__at((4));
  59407. $ctx1.sendIdx["@"]=5;
  59408. $11=(3).__at((4));
  59409. $ctx1.sendIdx["@"]=6;
  59410. $9=$recv($10).__minus($11);
  59411. $12=$recv($globals.Point)._x_y_((0),(0));
  59412. $ctx1.sendIdx["x:y:"]=3;
  59413. $self._assert_equals_($9,$12);
  59414. $ctx1.sendIdx["assert:equals:"]=3;
  59415. $14=(6).__at((8));
  59416. $ctx1.sendIdx["@"]=7;
  59417. $13=$recv($14).__slash((3).__at((4)));
  59418. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  59419. return self;
  59420. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  59421. },
  59422. args: [],
  59423. 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)",
  59424. referencedClasses: ["Point"],
  59425. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  59426. }),
  59427. $globals.PointTest);
  59428. $core.addMethod(
  59429. $core.method({
  59430. selector: "testAt",
  59431. protocol: "tests",
  59432. fn: function (){
  59433. var self=this,$self=this;
  59434. return $core.withContext(function($ctx1) {
  59435. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  59436. return self;
  59437. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  59438. },
  59439. args: [],
  59440. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  59441. referencedClasses: ["Point"],
  59442. messageSends: ["assert:equals:", "@", "x:y:"]
  59443. }),
  59444. $globals.PointTest);
  59445. $core.addMethod(
  59446. $core.method({
  59447. selector: "testComparison",
  59448. protocol: "tests",
  59449. fn: function (){
  59450. var self=this,$self=this;
  59451. return $core.withContext(function($ctx1) {
  59452. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  59453. $2=(3).__at((4));
  59454. $ctx1.sendIdx["@"]=1;
  59455. $3=(4).__at((5));
  59456. $ctx1.sendIdx["@"]=2;
  59457. $1=$recv($2).__lt($3);
  59458. $ctx1.sendIdx["<"]=1;
  59459. $self._assert_($1);
  59460. $ctx1.sendIdx["assert:"]=1;
  59461. $5=(3).__at((4));
  59462. $ctx1.sendIdx["@"]=3;
  59463. $6=(4).__at((4));
  59464. $ctx1.sendIdx["@"]=4;
  59465. $4=$recv($5).__lt($6);
  59466. $self._deny_($4);
  59467. $ctx1.sendIdx["deny:"]=1;
  59468. $8=(4).__at((5));
  59469. $ctx1.sendIdx["@"]=5;
  59470. $9=(4).__at((5));
  59471. $ctx1.sendIdx["@"]=6;
  59472. $7=$recv($8).__lt_eq($9);
  59473. $ctx1.sendIdx["<="]=1;
  59474. $self._assert_($7);
  59475. $ctx1.sendIdx["assert:"]=2;
  59476. $11=(4).__at((5));
  59477. $ctx1.sendIdx["@"]=7;
  59478. $12=(3).__at((5));
  59479. $ctx1.sendIdx["@"]=8;
  59480. $10=$recv($11).__lt_eq($12);
  59481. $self._deny_($10);
  59482. $ctx1.sendIdx["deny:"]=2;
  59483. $14=(5).__at((6));
  59484. $ctx1.sendIdx["@"]=9;
  59485. $15=(4).__at((5));
  59486. $ctx1.sendIdx["@"]=10;
  59487. $13=$recv($14).__gt($15);
  59488. $ctx1.sendIdx[">"]=1;
  59489. $self._assert_($13);
  59490. $ctx1.sendIdx["assert:"]=3;
  59491. $17=(5).__at((6));
  59492. $ctx1.sendIdx["@"]=11;
  59493. $18=(6).__at((6));
  59494. $ctx1.sendIdx["@"]=12;
  59495. $16=$recv($17).__gt($18);
  59496. $self._deny_($16);
  59497. $ctx1.sendIdx["deny:"]=3;
  59498. $20=(4).__at((5));
  59499. $ctx1.sendIdx["@"]=13;
  59500. $21=(4).__at((5));
  59501. $ctx1.sendIdx["@"]=14;
  59502. $19=$recv($20).__gt_eq($21);
  59503. $ctx1.sendIdx[">="]=1;
  59504. $self._assert_($19);
  59505. $23=(4).__at((5));
  59506. $ctx1.sendIdx["@"]=15;
  59507. $22=$recv($23).__gt_eq((5).__at((5)));
  59508. $self._deny_($22);
  59509. return self;
  59510. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  59511. },
  59512. args: [],
  59513. 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)",
  59514. referencedClasses: [],
  59515. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  59516. }),
  59517. $globals.PointTest);
  59518. $core.addMethod(
  59519. $core.method({
  59520. selector: "testDotProduct",
  59521. protocol: "tests",
  59522. fn: function (){
  59523. var self=this,$self=this;
  59524. return $core.withContext(function($ctx1) {
  59525. var $2,$1;
  59526. $2=(2).__at((3));
  59527. $ctx1.sendIdx["@"]=1;
  59528. $1=$recv($2)._dotProduct_((3).__at((7)));
  59529. $self._assert_equals_($1,(27));
  59530. return self;
  59531. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  59532. },
  59533. args: [],
  59534. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  59535. referencedClasses: [],
  59536. messageSends: ["assert:equals:", "dotProduct:", "@"]
  59537. }),
  59538. $globals.PointTest);
  59539. $core.addMethod(
  59540. $core.method({
  59541. selector: "testEgality",
  59542. protocol: "tests",
  59543. fn: function (){
  59544. var self=this,$self=this;
  59545. return $core.withContext(function($ctx1) {
  59546. var $2,$3,$1,$5,$4;
  59547. $2=(3).__at((4));
  59548. $ctx1.sendIdx["@"]=1;
  59549. $3=(3).__at((4));
  59550. $ctx1.sendIdx["@"]=2;
  59551. $1=$recv($2).__eq($3);
  59552. $ctx1.sendIdx["="]=1;
  59553. $self._assert_($1);
  59554. $5=(3).__at((5));
  59555. $ctx1.sendIdx["@"]=3;
  59556. $4=$recv($5).__eq((3).__at((6)));
  59557. $self._deny_($4);
  59558. return self;
  59559. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  59560. },
  59561. args: [],
  59562. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  59563. referencedClasses: [],
  59564. messageSends: ["assert:", "=", "@", "deny:"]
  59565. }),
  59566. $globals.PointTest);
  59567. $core.addMethod(
  59568. $core.method({
  59569. selector: "testNew",
  59570. protocol: "tests",
  59571. fn: function (){
  59572. var self=this,$self=this;
  59573. return $core.withContext(function($ctx1) {
  59574. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  59575. $3=$recv($globals.Point)._new();
  59576. $ctx1.sendIdx["new"]=1;
  59577. $2=$recv($3)._x_((3));
  59578. $ctx1.sendIdx["x:"]=1;
  59579. $1=$recv($2)._y();
  59580. $ctx1.sendIdx["y"]=1;
  59581. $self._assert_equals_($1,nil);
  59582. $ctx1.sendIdx["assert:equals:"]=1;
  59583. $7=$recv($globals.Point)._new();
  59584. $ctx1.sendIdx["new"]=2;
  59585. $6=$recv($7)._x_((3));
  59586. $5=$recv($6)._x();
  59587. $ctx1.sendIdx["x"]=1;
  59588. $4=$recv($5).__eq((0));
  59589. $ctx1.sendIdx["="]=1;
  59590. $self._deny_($4);
  59591. $ctx1.sendIdx["deny:"]=1;
  59592. $10=$recv($globals.Point)._new();
  59593. $ctx1.sendIdx["new"]=3;
  59594. $9=$recv($10)._y_((4));
  59595. $ctx1.sendIdx["y:"]=1;
  59596. $8=$recv($9)._x();
  59597. $self._assert_equals_($8,nil);
  59598. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  59599. return self;
  59600. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  59601. },
  59602. args: [],
  59603. 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",
  59604. referencedClasses: ["Point"],
  59605. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  59606. }),
  59607. $globals.PointTest);
  59608. $core.addMethod(
  59609. $core.method({
  59610. selector: "testNormal",
  59611. protocol: "tests",
  59612. fn: function (){
  59613. var self=this,$self=this;
  59614. return $core.withContext(function($ctx1) {
  59615. var $2,$1;
  59616. $2=(1).__at((0));
  59617. $ctx1.sendIdx["@"]=1;
  59618. $1=$recv($2)._normal();
  59619. $self._assert_equals_($1,(0).__at((1)));
  59620. return self;
  59621. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  59622. },
  59623. args: [],
  59624. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  59625. referencedClasses: [],
  59626. messageSends: ["assert:equals:", "normal", "@"]
  59627. }),
  59628. $globals.PointTest);
  59629. $core.addMethod(
  59630. $core.method({
  59631. selector: "testNormalized",
  59632. protocol: "tests",
  59633. fn: function (){
  59634. var self=this,$self=this;
  59635. return $core.withContext(function($ctx1) {
  59636. var $2,$1,$3,$5,$4;
  59637. $2=(0).__at((2));
  59638. $ctx1.sendIdx["@"]=1;
  59639. $1=$recv($2)._normalized();
  59640. $ctx1.sendIdx["normalized"]=1;
  59641. $3=(0).__at((1));
  59642. $ctx1.sendIdx["@"]=2;
  59643. $self._assert_equals_($1,$3);
  59644. $ctx1.sendIdx["assert:equals:"]=1;
  59645. $5=(0).__at((0));
  59646. $ctx1.sendIdx["@"]=3;
  59647. $4=$recv($5)._normalized();
  59648. $self._assert_equals_($4,(0).__at((0)));
  59649. return self;
  59650. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  59651. },
  59652. args: [],
  59653. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  59654. referencedClasses: [],
  59655. messageSends: ["assert:equals:", "normalized", "@"]
  59656. }),
  59657. $globals.PointTest);
  59658. $core.addMethod(
  59659. $core.method({
  59660. selector: "testPolarCoordinates",
  59661. protocol: "tests",
  59662. fn: function (){
  59663. var self=this,$self=this;
  59664. return $core.withContext(function($ctx1) {
  59665. var $2,$1;
  59666. $2=(1).__at((0));
  59667. $ctx1.sendIdx["@"]=1;
  59668. $1=$recv($2)._r();
  59669. $ctx1.sendIdx["r"]=1;
  59670. $self._assert_equals_($1,(1));
  59671. $ctx1.sendIdx["assert:equals:"]=1;
  59672. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  59673. return self;
  59674. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  59675. },
  59676. args: [],
  59677. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  59678. referencedClasses: [],
  59679. messageSends: ["assert:equals:", "r", "@"]
  59680. }),
  59681. $globals.PointTest);
  59682. $core.addMethod(
  59683. $core.method({
  59684. selector: "testRectangleCreation",
  59685. protocol: "tests",
  59686. fn: function (){
  59687. var self=this,$self=this;
  59688. return $core.withContext(function($ctx1) {
  59689. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  59690. $2=(1).__at((1));
  59691. $ctx1.sendIdx["@"]=1;
  59692. $3=(2).__at((2));
  59693. $ctx1.sendIdx["@"]=2;
  59694. $1=$recv($2)._corner_($3);
  59695. $5=(1).__at((1));
  59696. $ctx1.sendIdx["@"]=3;
  59697. $6=(2).__at((2));
  59698. $ctx1.sendIdx["@"]=4;
  59699. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  59700. $self._assert_equals_($1,$4);
  59701. $ctx1.sendIdx["assert:equals:"]=1;
  59702. $8=(1).__at((1));
  59703. $ctx1.sendIdx["@"]=5;
  59704. $9=(2).__at((2));
  59705. $ctx1.sendIdx["@"]=6;
  59706. $7=$recv($8)._rectangle_($9);
  59707. $11=(1).__at((1));
  59708. $ctx1.sendIdx["@"]=7;
  59709. $12=(2).__at((2));
  59710. $ctx1.sendIdx["@"]=8;
  59711. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  59712. $self._assert_equals_($7,$10);
  59713. $ctx1.sendIdx["assert:equals:"]=2;
  59714. $14=(1).__at((1));
  59715. $ctx1.sendIdx["@"]=9;
  59716. $15=(2).__at((2));
  59717. $ctx1.sendIdx["@"]=10;
  59718. $13=$recv($14)._extent_($15);
  59719. $17=(1).__at((1));
  59720. $ctx1.sendIdx["@"]=11;
  59721. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  59722. $self._assert_equals_($13,$16);
  59723. return self;
  59724. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  59725. },
  59726. args: [],
  59727. 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)",
  59728. referencedClasses: ["Rectangle"],
  59729. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  59730. }),
  59731. $globals.PointTest);
  59732. $core.addMethod(
  59733. $core.method({
  59734. selector: "testTranslateBy",
  59735. protocol: "tests",
  59736. fn: function (){
  59737. var self=this,$self=this;
  59738. return $core.withContext(function($ctx1) {
  59739. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  59740. $2=(3).__at((3));
  59741. $ctx1.sendIdx["@"]=1;
  59742. $3=(0).__at((1));
  59743. $ctx1.sendIdx["@"]=2;
  59744. $1=$recv($2)._translateBy_($3);
  59745. $ctx1.sendIdx["translateBy:"]=1;
  59746. $4=(3).__at((4));
  59747. $ctx1.sendIdx["@"]=3;
  59748. $self._assert_equals_($1,$4);
  59749. $ctx1.sendIdx["assert:equals:"]=1;
  59750. $6=(3).__at((3));
  59751. $ctx1.sendIdx["@"]=4;
  59752. $8=(1)._negated();
  59753. $ctx1.sendIdx["negated"]=1;
  59754. $7=(0).__at($8);
  59755. $ctx1.sendIdx["@"]=5;
  59756. $5=$recv($6)._translateBy_($7);
  59757. $ctx1.sendIdx["translateBy:"]=2;
  59758. $9=(3).__at((2));
  59759. $ctx1.sendIdx["@"]=6;
  59760. $self._assert_equals_($5,$9);
  59761. $ctx1.sendIdx["assert:equals:"]=2;
  59762. $11=(3).__at((3));
  59763. $ctx1.sendIdx["@"]=7;
  59764. $12=(2).__at((3));
  59765. $ctx1.sendIdx["@"]=8;
  59766. $10=$recv($11)._translateBy_($12);
  59767. $ctx1.sendIdx["translateBy:"]=3;
  59768. $13=(5).__at((6));
  59769. $ctx1.sendIdx["@"]=9;
  59770. $self._assert_equals_($10,$13);
  59771. $ctx1.sendIdx["assert:equals:"]=3;
  59772. $15=(3).__at((3));
  59773. $ctx1.sendIdx["@"]=10;
  59774. $16=$recv((3)._negated()).__at((0));
  59775. $ctx1.sendIdx["@"]=11;
  59776. $14=$recv($15)._translateBy_($16);
  59777. $self._assert_equals_($14,(0).__at((3)));
  59778. return self;
  59779. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  59780. },
  59781. args: [],
  59782. 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.",
  59783. referencedClasses: [],
  59784. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  59785. }),
  59786. $globals.PointTest);
  59787. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  59788. $core.addMethod(
  59789. $core.method({
  59790. selector: "testNextIfAbsent",
  59791. protocol: "tests",
  59792. fn: function (){
  59793. var self=this,$self=this;
  59794. var queue;
  59795. return $core.withContext(function($ctx1) {
  59796. var $2,$1;
  59797. queue=$recv($globals.Queue)._new();
  59798. $recv(queue)._nextPut_("index1");
  59799. $2=$recv(queue)._nextIfAbsent_("empty");
  59800. $ctx1.sendIdx["nextIfAbsent:"]=1;
  59801. $1=$recv($2).__eq("index1");
  59802. $ctx1.sendIdx["="]=1;
  59803. $self._assert_($1);
  59804. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  59805. return self;
  59806. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  59807. },
  59808. args: [],
  59809. 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'",
  59810. referencedClasses: ["Queue"],
  59811. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  59812. }),
  59813. $globals.QueueTest);
  59814. $core.addMethod(
  59815. $core.method({
  59816. selector: "testQueueNext",
  59817. protocol: "tests",
  59818. fn: function (){
  59819. var self=this,$self=this;
  59820. var queue;
  59821. return $core.withContext(function($ctx1) {
  59822. var $1,$3,$2,$5,$4;
  59823. queue=$recv($globals.Queue)._new();
  59824. $1=queue;
  59825. $recv($1)._nextPut_("index1");
  59826. $ctx1.sendIdx["nextPut:"]=1;
  59827. $recv($1)._nextPut_("index2");
  59828. $3=$recv(queue)._next();
  59829. $ctx1.sendIdx["next"]=1;
  59830. $2=$recv($3).__eq("index1");
  59831. $ctx1.sendIdx["="]=1;
  59832. $self._assert_($2);
  59833. $5=$recv(queue)._next();
  59834. $ctx1.sendIdx["next"]=2;
  59835. $4=$recv($5).__eq("index");
  59836. $self._deny_($4);
  59837. $self._should_raise_((function(){
  59838. return $core.withContext(function($ctx2) {
  59839. return $recv(queue)._next();
  59840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59841. }),$globals.Error);
  59842. return self;
  59843. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  59844. },
  59845. args: [],
  59846. 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",
  59847. referencedClasses: ["Queue", "Error"],
  59848. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  59849. }),
  59850. $globals.QueueTest);
  59851. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  59852. $core.addMethod(
  59853. $core.method({
  59854. selector: "testAtRandomNumber",
  59855. protocol: "tests",
  59856. fn: function (){
  59857. var self=this,$self=this;
  59858. var val;
  59859. return $core.withContext(function($ctx1) {
  59860. (100)._timesRepeat_((function(){
  59861. return $core.withContext(function($ctx2) {
  59862. val=(10)._atRandom();
  59863. val;
  59864. $self._assert_($recv(val).__gt((0)));
  59865. $ctx2.sendIdx["assert:"]=1;
  59866. return $self._assert_($recv(val).__lt((11)));
  59867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59868. }));
  59869. return self;
  59870. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  59871. },
  59872. args: [],
  59873. 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]",
  59874. referencedClasses: [],
  59875. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  59876. }),
  59877. $globals.RandomTest);
  59878. $core.addMethod(
  59879. $core.method({
  59880. selector: "testAtRandomSequenceableCollection",
  59881. protocol: "tests",
  59882. fn: function (){
  59883. var self=this,$self=this;
  59884. var val;
  59885. return $core.withContext(function($ctx1) {
  59886. var $3,$4,$2,$1;
  59887. (100)._timesRepeat_((function(){
  59888. return $core.withContext(function($ctx2) {
  59889. val="abc"._atRandom();
  59890. val;
  59891. $3=$recv(val).__eq("a");
  59892. $ctx2.sendIdx["="]=1;
  59893. $4=$recv(val).__eq("b");
  59894. $ctx2.sendIdx["="]=2;
  59895. $2=$recv($3).__or($4);
  59896. $1=$recv($2).__or($recv(val).__eq("c"));
  59897. $ctx2.sendIdx["|"]=1;
  59898. return $self._assert_($1);
  59899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59900. }));
  59901. return self;
  59902. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  59903. },
  59904. args: [],
  59905. 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].",
  59906. referencedClasses: [],
  59907. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  59908. }),
  59909. $globals.RandomTest);
  59910. $core.addMethod(
  59911. $core.method({
  59912. selector: "textNext",
  59913. protocol: "tests",
  59914. fn: function (){
  59915. var self=this,$self=this;
  59916. return $core.withContext(function($ctx1) {
  59917. var $1;
  59918. (10000)._timesRepeat_((function(){
  59919. var current,next;
  59920. return $core.withContext(function($ctx2) {
  59921. next=$recv($recv($globals.Random)._new())._next();
  59922. next;
  59923. $self._assert_($recv(next).__gt_eq((0)));
  59924. $ctx2.sendIdx["assert:"]=1;
  59925. $self._assert_($recv(next).__lt((1)));
  59926. $1=$recv(current).__eq(next);
  59927. $ctx2.sendIdx["="]=1;
  59928. $self._deny_($1);
  59929. return $recv(next).__eq(current);
  59930. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  59931. }));
  59932. return self;
  59933. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  59934. },
  59935. args: [],
  59936. 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 ]",
  59937. referencedClasses: ["Random"],
  59938. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  59939. }),
  59940. $globals.RandomTest);
  59941. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  59942. $core.addMethod(
  59943. $core.method({
  59944. selector: "testContainsPoint",
  59945. protocol: "tests",
  59946. fn: function (){
  59947. var self=this,$self=this;
  59948. var rect;
  59949. return $core.withContext(function($ctx1) {
  59950. var $1,$2,$4,$5,$3;
  59951. $1=(0).__at((0));
  59952. $ctx1.sendIdx["@"]=1;
  59953. $2=(4).__at((4));
  59954. $ctx1.sendIdx["@"]=2;
  59955. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  59956. $4=rect;
  59957. $5=(1).__at((2));
  59958. $ctx1.sendIdx["@"]=3;
  59959. $3=$recv($4)._containsPoint_($5);
  59960. $ctx1.sendIdx["containsPoint:"]=1;
  59961. $self._assert_($3);
  59962. $ctx1.sendIdx["assert:"]=1;
  59963. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  59964. return self;
  59965. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  59966. },
  59967. args: [],
  59968. 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.",
  59969. referencedClasses: ["Rectangle"],
  59970. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  59971. }),
  59972. $globals.RectangleTest);
  59973. $core.addMethod(
  59974. $core.method({
  59975. selector: "testContainsRect",
  59976. protocol: "tests",
  59977. fn: function (){
  59978. var self=this,$self=this;
  59979. return $core.withContext(function($ctx1) {
  59980. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  59981. $3=(0).__at((0));
  59982. $ctx1.sendIdx["@"]=1;
  59983. $4=(6).__at((6));
  59984. $ctx1.sendIdx["@"]=2;
  59985. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  59986. $ctx1.sendIdx["origin:corner:"]=1;
  59987. $6=(1).__at((1));
  59988. $ctx1.sendIdx["@"]=3;
  59989. $7=(5).__at((5));
  59990. $ctx1.sendIdx["@"]=4;
  59991. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  59992. $ctx1.sendIdx["origin:corner:"]=2;
  59993. $1=$recv($2)._containsRect_($5);
  59994. $ctx1.sendIdx["containsRect:"]=1;
  59995. $self._assert_($1);
  59996. $ctx1.sendIdx["assert:"]=1;
  59997. $11=(0).__at((0));
  59998. $ctx1.sendIdx["@"]=5;
  59999. $12=(6).__at((6));
  60000. $ctx1.sendIdx["@"]=6;
  60001. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60002. $ctx1.sendIdx["origin:corner:"]=3;
  60003. $14=(1).__at((-1));
  60004. $ctx1.sendIdx["@"]=7;
  60005. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60006. $9=$recv($10)._containsRect_($13);
  60007. $8=$recv($9)._not();
  60008. $self._assert_($8);
  60009. return self;
  60010. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60011. },
  60012. args: [],
  60013. 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.",
  60014. referencedClasses: ["Rectangle"],
  60015. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60016. }),
  60017. $globals.RectangleTest);
  60018. $core.addMethod(
  60019. $core.method({
  60020. selector: "testOriginExtent",
  60021. protocol: "tests",
  60022. fn: function (){
  60023. var self=this,$self=this;
  60024. var rectangle;
  60025. return $core.withContext(function($ctx1) {
  60026. var $1,$2,$3,$4;
  60027. $1=(3).__at((4));
  60028. $ctx1.sendIdx["@"]=1;
  60029. $2=(7).__at((8));
  60030. $ctx1.sendIdx["@"]=2;
  60031. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60032. $3=$recv(rectangle)._origin();
  60033. $4=(3).__at((4));
  60034. $ctx1.sendIdx["@"]=3;
  60035. $self._assert_equals_($3,$4);
  60036. $ctx1.sendIdx["assert:equals:"]=1;
  60037. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60038. return self;
  60039. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60040. },
  60041. args: [],
  60042. 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.",
  60043. referencedClasses: ["Rectangle"],
  60044. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60045. }),
  60046. $globals.RectangleTest);
  60047. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60048. $core.addMethod(
  60049. $core.method({
  60050. selector: "collectionClass",
  60051. protocol: "accessing",
  60052. fn: function (){
  60053. var self=this,$self=this;
  60054. return $core.withContext(function($ctx1) {
  60055. return $recv($self._class())._collectionClass();
  60056. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60057. },
  60058. args: [],
  60059. source: "collectionClass\x0a\x09^ self class collectionClass",
  60060. referencedClasses: [],
  60061. messageSends: ["collectionClass", "class"]
  60062. }),
  60063. $globals.StreamTest);
  60064. $core.addMethod(
  60065. $core.method({
  60066. selector: "newCollection",
  60067. protocol: "accessing",
  60068. fn: function (){
  60069. var self=this,$self=this;
  60070. return $core.withContext(function($ctx1) {
  60071. return $recv($self._collectionClass())._new();
  60072. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60073. },
  60074. args: [],
  60075. source: "newCollection\x0a\x09^ self collectionClass new",
  60076. referencedClasses: [],
  60077. messageSends: ["new", "collectionClass"]
  60078. }),
  60079. $globals.StreamTest);
  60080. $core.addMethod(
  60081. $core.method({
  60082. selector: "newStream",
  60083. protocol: "accessing",
  60084. fn: function (){
  60085. var self=this,$self=this;
  60086. return $core.withContext(function($ctx1) {
  60087. return $recv($recv($self._collectionClass())._new())._stream();
  60088. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60089. },
  60090. args: [],
  60091. source: "newStream\x0a\x09^ self collectionClass new stream",
  60092. referencedClasses: [],
  60093. messageSends: ["stream", "new", "collectionClass"]
  60094. }),
  60095. $globals.StreamTest);
  60096. $core.addMethod(
  60097. $core.method({
  60098. selector: "testAtStartAtEnd",
  60099. protocol: "tests",
  60100. fn: function (){
  60101. var self=this,$self=this;
  60102. var stream;
  60103. return $core.withContext(function($ctx1) {
  60104. var $1,$2,$3,$4;
  60105. stream=$self._newStream();
  60106. $1=$recv(stream)._atStart();
  60107. $ctx1.sendIdx["atStart"]=1;
  60108. $self._assert_($1);
  60109. $ctx1.sendIdx["assert:"]=1;
  60110. $2=$recv(stream)._atEnd();
  60111. $ctx1.sendIdx["atEnd"]=1;
  60112. $self._assert_($2);
  60113. $ctx1.sendIdx["assert:"]=2;
  60114. $recv(stream)._nextPutAll_($self._newCollection());
  60115. $3=$recv(stream)._atEnd();
  60116. $ctx1.sendIdx["atEnd"]=2;
  60117. $self._assert_($3);
  60118. $4=$recv(stream)._atStart();
  60119. $ctx1.sendIdx["atStart"]=2;
  60120. $self._deny_($4);
  60121. $ctx1.sendIdx["deny:"]=1;
  60122. $recv(stream)._position_((1));
  60123. $self._deny_($recv(stream)._atEnd());
  60124. $ctx1.sendIdx["deny:"]=2;
  60125. $self._deny_($recv(stream)._atStart());
  60126. return self;
  60127. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60128. },
  60129. args: [],
  60130. 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",
  60131. referencedClasses: [],
  60132. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60133. }),
  60134. $globals.StreamTest);
  60135. $core.addMethod(
  60136. $core.method({
  60137. selector: "testContents",
  60138. protocol: "tests",
  60139. fn: function (){
  60140. var self=this,$self=this;
  60141. var stream;
  60142. return $core.withContext(function($ctx1) {
  60143. var $1,$2;
  60144. stream=$self._newStream();
  60145. $1=stream;
  60146. $2=$self._newCollection();
  60147. $ctx1.sendIdx["newCollection"]=1;
  60148. $recv($1)._nextPutAll_($2);
  60149. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60150. return self;
  60151. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60152. },
  60153. args: [],
  60154. 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",
  60155. referencedClasses: [],
  60156. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60157. }),
  60158. $globals.StreamTest);
  60159. $core.addMethod(
  60160. $core.method({
  60161. selector: "testIsEmpty",
  60162. protocol: "tests",
  60163. fn: function (){
  60164. var self=this,$self=this;
  60165. var stream;
  60166. return $core.withContext(function($ctx1) {
  60167. var $1;
  60168. stream=$self._newStream();
  60169. $1=$recv(stream)._isEmpty();
  60170. $ctx1.sendIdx["isEmpty"]=1;
  60171. $self._assert_($1);
  60172. $recv(stream)._nextPutAll_($self._newCollection());
  60173. $self._deny_($recv(stream)._isEmpty());
  60174. return self;
  60175. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60176. },
  60177. args: [],
  60178. 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",
  60179. referencedClasses: [],
  60180. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60181. }),
  60182. $globals.StreamTest);
  60183. $core.addMethod(
  60184. $core.method({
  60185. selector: "testPosition",
  60186. protocol: "tests",
  60187. fn: function (){
  60188. var self=this,$self=this;
  60189. var collection,stream;
  60190. return $core.withContext(function($ctx1) {
  60191. var $1,$2,$3;
  60192. collection=$self._newCollection();
  60193. stream=$self._newStream();
  60194. $recv(stream)._nextPutAll_(collection);
  60195. $1=$recv(stream)._position();
  60196. $ctx1.sendIdx["position"]=1;
  60197. $self._assert_equals_($1,$recv(collection)._size());
  60198. $ctx1.sendIdx["assert:equals:"]=1;
  60199. $recv(stream)._position_((0));
  60200. $2=$recv(stream)._position();
  60201. $ctx1.sendIdx["position"]=2;
  60202. $self._assert_equals_($2,(0));
  60203. $ctx1.sendIdx["assert:equals:"]=2;
  60204. $recv(stream)._next();
  60205. $ctx1.sendIdx["next"]=1;
  60206. $3=$recv(stream)._position();
  60207. $ctx1.sendIdx["position"]=3;
  60208. $self._assert_equals_($3,(1));
  60209. $ctx1.sendIdx["assert:equals:"]=3;
  60210. $recv(stream)._next();
  60211. $self._assert_equals_($recv(stream)._position(),(2));
  60212. return self;
  60213. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60214. },
  60215. args: [],
  60216. 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",
  60217. referencedClasses: [],
  60218. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60219. }),
  60220. $globals.StreamTest);
  60221. $core.addMethod(
  60222. $core.method({
  60223. selector: "testReading",
  60224. protocol: "tests",
  60225. fn: function (){
  60226. var self=this,$self=this;
  60227. var stream,collection;
  60228. return $core.withContext(function($ctx1) {
  60229. var $1,$2;
  60230. collection=$self._newCollection();
  60231. stream=$self._newStream();
  60232. $1=stream;
  60233. $recv($1)._nextPutAll_(collection);
  60234. $recv($1)._position_((0));
  60235. $recv(collection)._do_((function(each){
  60236. return $core.withContext(function($ctx2) {
  60237. $2=$recv(stream)._next();
  60238. $ctx2.sendIdx["next"]=1;
  60239. return $self._assert_equals_($2,each);
  60240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60241. }));
  60242. $self._assert_($recv($recv(stream)._next())._isNil());
  60243. return self;
  60244. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60245. },
  60246. args: [],
  60247. 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",
  60248. referencedClasses: [],
  60249. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60250. }),
  60251. $globals.StreamTest);
  60252. $core.addMethod(
  60253. $core.method({
  60254. selector: "testStreamContents",
  60255. protocol: "tests",
  60256. fn: function (){
  60257. var self=this,$self=this;
  60258. return self;
  60259. },
  60260. args: [],
  60261. source: "testStreamContents",
  60262. referencedClasses: [],
  60263. messageSends: []
  60264. }),
  60265. $globals.StreamTest);
  60266. $core.addMethod(
  60267. $core.method({
  60268. selector: "testWrite",
  60269. protocol: "tests",
  60270. fn: function (){
  60271. var self=this,$self=this;
  60272. var stream,collection;
  60273. return $core.withContext(function($ctx1) {
  60274. collection=$self._newCollection();
  60275. stream=$self._newStream();
  60276. $recv(collection)._do_((function(each){
  60277. return $core.withContext(function($ctx2) {
  60278. return $recv(stream).__lt_lt(each);
  60279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60280. }));
  60281. $self._assert_equals_($recv(stream)._contents(),collection);
  60282. return self;
  60283. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60284. },
  60285. args: [],
  60286. 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",
  60287. referencedClasses: [],
  60288. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60289. }),
  60290. $globals.StreamTest);
  60291. $core.addMethod(
  60292. $core.method({
  60293. selector: "testWriting",
  60294. protocol: "tests",
  60295. fn: function (){
  60296. var self=this,$self=this;
  60297. var stream,collection;
  60298. return $core.withContext(function($ctx1) {
  60299. var $1;
  60300. collection=$self._newCollection();
  60301. stream=$self._newStream();
  60302. $ctx1.sendIdx["newStream"]=1;
  60303. $recv(collection)._do_((function(each){
  60304. return $core.withContext(function($ctx2) {
  60305. return $recv(stream)._nextPut_(each);
  60306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60307. }));
  60308. $1=$recv(stream)._contents();
  60309. $ctx1.sendIdx["contents"]=1;
  60310. $self._assert_equals_($1,collection);
  60311. $ctx1.sendIdx["assert:equals:"]=1;
  60312. stream=$self._newStream();
  60313. $recv(stream)._nextPutAll_(collection);
  60314. $self._assert_equals_($recv(stream)._contents(),collection);
  60315. return self;
  60316. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60317. },
  60318. args: [],
  60319. 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",
  60320. referencedClasses: [],
  60321. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60322. }),
  60323. $globals.StreamTest);
  60324. $core.addMethod(
  60325. $core.method({
  60326. selector: "collectionClass",
  60327. protocol: "accessing",
  60328. fn: function (){
  60329. var self=this,$self=this;
  60330. return nil;
  60331. },
  60332. args: [],
  60333. source: "collectionClass\x0a\x09^ nil",
  60334. referencedClasses: [],
  60335. messageSends: []
  60336. }),
  60337. $globals.StreamTest.a$cls);
  60338. $core.addMethod(
  60339. $core.method({
  60340. selector: "isAbstract",
  60341. protocol: "testing",
  60342. fn: function (){
  60343. var self=this,$self=this;
  60344. return $core.withContext(function($ctx1) {
  60345. return $recv($self._collectionClass())._isNil();
  60346. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60347. },
  60348. args: [],
  60349. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60350. referencedClasses: [],
  60351. messageSends: ["isNil", "collectionClass"]
  60352. }),
  60353. $globals.StreamTest.a$cls);
  60354. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60355. $core.addMethod(
  60356. $core.method({
  60357. selector: "newCollection",
  60358. protocol: "accessing",
  60359. fn: function (){
  60360. var self=this,$self=this;
  60361. return $core.withContext(function($ctx1) {
  60362. return [true,(1),(3).__at((4)),"foo"];
  60363. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60364. },
  60365. args: [],
  60366. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60367. referencedClasses: [],
  60368. messageSends: ["@"]
  60369. }),
  60370. $globals.ArrayStreamTest);
  60371. $core.addMethod(
  60372. $core.method({
  60373. selector: "collectionClass",
  60374. protocol: "accessing",
  60375. fn: function (){
  60376. var self=this,$self=this;
  60377. return $globals.Array;
  60378. },
  60379. args: [],
  60380. source: "collectionClass\x0a\x09^ Array",
  60381. referencedClasses: ["Array"],
  60382. messageSends: []
  60383. }),
  60384. $globals.ArrayStreamTest.a$cls);
  60385. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60386. $core.addMethod(
  60387. $core.method({
  60388. selector: "newCollection",
  60389. protocol: "accessing",
  60390. fn: function (){
  60391. var self=this,$self=this;
  60392. return "hello world";
  60393. },
  60394. args: [],
  60395. source: "newCollection\x0a\x09^ 'hello world'",
  60396. referencedClasses: [],
  60397. messageSends: []
  60398. }),
  60399. $globals.StringStreamTest);
  60400. $core.addMethod(
  60401. $core.method({
  60402. selector: "collectionClass",
  60403. protocol: "accessing",
  60404. fn: function (){
  60405. var self=this,$self=this;
  60406. return $globals.String;
  60407. },
  60408. args: [],
  60409. source: "collectionClass\x0a\x09^ String",
  60410. referencedClasses: ["String"],
  60411. messageSends: []
  60412. }),
  60413. $globals.StringStreamTest.a$cls);
  60414. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  60415. $core.addMethod(
  60416. $core.method({
  60417. selector: "testCopying",
  60418. protocol: "tests",
  60419. fn: function (){
  60420. var self=this,$self=this;
  60421. return $core.withContext(function($ctx1) {
  60422. $self._assert_equals_(nil._copy(),nil);
  60423. return self;
  60424. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  60425. },
  60426. args: [],
  60427. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  60428. referencedClasses: [],
  60429. messageSends: ["assert:equals:", "copy"]
  60430. }),
  60431. $globals.UndefinedTest);
  60432. $core.addMethod(
  60433. $core.method({
  60434. selector: "testDeepCopy",
  60435. protocol: "tests",
  60436. fn: function (){
  60437. var self=this,$self=this;
  60438. return $core.withContext(function($ctx1) {
  60439. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  60440. return self;
  60441. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  60442. },
  60443. args: [],
  60444. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  60445. referencedClasses: [],
  60446. messageSends: ["assert:", "=", "deepCopy"]
  60447. }),
  60448. $globals.UndefinedTest);
  60449. $core.addMethod(
  60450. $core.method({
  60451. selector: "testIfNil",
  60452. protocol: "tests",
  60453. fn: function (){
  60454. var self=this,$self=this;
  60455. return $core.withContext(function($ctx1) {
  60456. var $1,$3,$2,$4,$6,$5,$receiver;
  60457. if(($receiver = nil) == null || $receiver.a$nil){
  60458. $1=true;
  60459. } else {
  60460. $1=nil;
  60461. }
  60462. $self._assert_equals_($1,true);
  60463. $ctx1.sendIdx["assert:equals:"]=1;
  60464. if(($receiver = nil) == null || $receiver.a$nil){
  60465. $3=nil;
  60466. } else {
  60467. $3=true;
  60468. }
  60469. $2=$recv($3).__eq(true);
  60470. $ctx1.sendIdx["="]=1;
  60471. $self._deny_($2);
  60472. $ctx1.sendIdx["deny:"]=1;
  60473. if(($receiver = nil) == null || $receiver.a$nil){
  60474. $4=true;
  60475. } else {
  60476. $4=false;
  60477. }
  60478. $self._assert_equals_($4,true);
  60479. if(($receiver = nil) == null || $receiver.a$nil){
  60480. $6=false;
  60481. } else {
  60482. $6=true;
  60483. }
  60484. $5=$recv($6).__eq(true);
  60485. $self._deny_($5);
  60486. return self;
  60487. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  60488. },
  60489. args: [],
  60490. 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",
  60491. referencedClasses: [],
  60492. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  60493. }),
  60494. $globals.UndefinedTest);
  60495. $core.addMethod(
  60496. $core.method({
  60497. selector: "testIsNil",
  60498. protocol: "tests",
  60499. fn: function (){
  60500. var self=this,$self=this;
  60501. return $core.withContext(function($ctx1) {
  60502. $self._assert_(nil._isNil());
  60503. $self._deny_(nil._notNil());
  60504. return self;
  60505. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  60506. },
  60507. args: [],
  60508. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  60509. referencedClasses: [],
  60510. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  60511. }),
  60512. $globals.UndefinedTest);
  60513. });
  60514. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60515. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60516. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60517. $core.addPackage("Platform-DOM-Tests");
  60518. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  60519. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60520. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  60521. $core.addMethod(
  60522. $core.method({
  60523. selector: "testEntityConversion",
  60524. protocol: "testing",
  60525. fn: function (){
  60526. var self=this,$self=this;
  60527. return $core.withContext(function($ctx1) {
  60528. var $1;
  60529. $1=$recv($globals.PlatformDom)._isFeasible();
  60530. if($core.assert($1)){
  60531. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  60532. }
  60533. return self;
  60534. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  60535. },
  60536. args: [],
  60537. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  60538. referencedClasses: ["PlatformDom"],
  60539. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  60540. }),
  60541. $globals.PlatformDomTest);
  60542. $core.addMethod(
  60543. $core.method({
  60544. selector: "testTextContentDoesNotRunScript",
  60545. protocol: "testing",
  60546. fn: function (){
  60547. var self=this,$self=this;
  60548. return $core.withContext(function($ctx1) {
  60549. var $1;
  60550. $1=$recv($globals.PlatformDom)._isFeasible();
  60551. if($core.assert($1)){
  60552. $self._shouldnt_raise_((function(){
  60553. return $core.withContext(function($ctx2) {
  60554. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  60555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60556. }),$globals.Error);
  60557. }
  60558. return self;
  60559. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  60560. },
  60561. args: [],
  60562. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  60563. referencedClasses: ["PlatformDom", "Error"],
  60564. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  60565. }),
  60566. $globals.PlatformDomTest);
  60567. });
  60568. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60569. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60570. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60571. $core.addPackage("SUnit-Tests");
  60572. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  60573. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60574. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  60575. $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.";
  60576. $core.addMethod(
  60577. $core.method({
  60578. selector: "setUp",
  60579. protocol: "running",
  60580. fn: function (){
  60581. var self=this,$self=this;
  60582. return $core.withContext(function($ctx1) {
  60583. $self["@empty"]=$recv($globals.Set)._new();
  60584. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  60585. return self;
  60586. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  60587. },
  60588. args: [],
  60589. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  60590. referencedClasses: ["Set"],
  60591. messageSends: ["new", "with:with:"]
  60592. }),
  60593. $globals.ExampleSetTest);
  60594. $core.addMethod(
  60595. $core.method({
  60596. selector: "testAdd",
  60597. protocol: "tests",
  60598. fn: function (){
  60599. var self=this,$self=this;
  60600. return $core.withContext(function($ctx1) {
  60601. $recv($self["@empty"])._add_((5));
  60602. $self._assert_($recv($self["@empty"])._includes_((5)));
  60603. return self;
  60604. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  60605. },
  60606. args: [],
  60607. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  60608. referencedClasses: [],
  60609. messageSends: ["add:", "assert:", "includes:"]
  60610. }),
  60611. $globals.ExampleSetTest);
  60612. $core.addMethod(
  60613. $core.method({
  60614. selector: "testGrow",
  60615. protocol: "tests",
  60616. fn: function (){
  60617. var self=this,$self=this;
  60618. return $core.withContext(function($ctx1) {
  60619. $recv($self["@empty"])._addAll_((1)._to_((100)));
  60620. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  60621. return self;
  60622. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  60623. },
  60624. args: [],
  60625. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  60626. referencedClasses: [],
  60627. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  60628. }),
  60629. $globals.ExampleSetTest);
  60630. $core.addMethod(
  60631. $core.method({
  60632. selector: "testIllegal",
  60633. protocol: "tests",
  60634. fn: function (){
  60635. var self=this,$self=this;
  60636. return $core.withContext(function($ctx1) {
  60637. $self._should_raise_((function(){
  60638. return $core.withContext(function($ctx2) {
  60639. return $recv($self["@empty"])._at_((5));
  60640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60641. }),$globals.Error);
  60642. $ctx1.sendIdx["should:raise:"]=1;
  60643. $self._should_raise_((function(){
  60644. return $core.withContext(function($ctx2) {
  60645. return $recv($self["@empty"])._at_put_((5),"abc");
  60646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60647. }),$globals.Error);
  60648. return self;
  60649. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  60650. },
  60651. args: [],
  60652. 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",
  60653. referencedClasses: ["Error"],
  60654. messageSends: ["should:raise:", "at:", "at:put:"]
  60655. }),
  60656. $globals.ExampleSetTest);
  60657. $core.addMethod(
  60658. $core.method({
  60659. selector: "testIncludes",
  60660. protocol: "tests",
  60661. fn: function (){
  60662. var self=this,$self=this;
  60663. return $core.withContext(function($ctx1) {
  60664. var $1;
  60665. $1=$recv($self["@full"])._includes_((5));
  60666. $ctx1.sendIdx["includes:"]=1;
  60667. $self._assert_($1);
  60668. $ctx1.sendIdx["assert:"]=1;
  60669. $self._assert_($recv($self["@full"])._includes_("abc"));
  60670. return self;
  60671. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  60672. },
  60673. args: [],
  60674. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  60675. referencedClasses: [],
  60676. messageSends: ["assert:", "includes:"]
  60677. }),
  60678. $globals.ExampleSetTest);
  60679. $core.addMethod(
  60680. $core.method({
  60681. selector: "testOccurrences",
  60682. protocol: "tests",
  60683. fn: function (){
  60684. var self=this,$self=this;
  60685. return $core.withContext(function($ctx1) {
  60686. var $1,$2;
  60687. $1=$recv($self["@empty"])._occurrencesOf_((0));
  60688. $ctx1.sendIdx["occurrencesOf:"]=1;
  60689. $self._assert_equals_($1,(0));
  60690. $ctx1.sendIdx["assert:equals:"]=1;
  60691. $2=$recv($self["@full"])._occurrencesOf_((5));
  60692. $ctx1.sendIdx["occurrencesOf:"]=2;
  60693. $self._assert_equals_($2,(1));
  60694. $ctx1.sendIdx["assert:equals:"]=2;
  60695. $recv($self["@full"])._add_((5));
  60696. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  60697. return self;
  60698. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  60699. },
  60700. args: [],
  60701. 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",
  60702. referencedClasses: [],
  60703. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  60704. }),
  60705. $globals.ExampleSetTest);
  60706. $core.addMethod(
  60707. $core.method({
  60708. selector: "testRemove",
  60709. protocol: "tests",
  60710. fn: function (){
  60711. var self=this,$self=this;
  60712. return $core.withContext(function($ctx1) {
  60713. var $1;
  60714. $recv($self["@full"])._remove_((5));
  60715. $1=$recv($self["@full"])._includes_("abc");
  60716. $ctx1.sendIdx["includes:"]=1;
  60717. $self._assert_($1);
  60718. $self._deny_($recv($self["@full"])._includes_((5)));
  60719. return self;
  60720. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  60721. },
  60722. args: [],
  60723. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  60724. referencedClasses: [],
  60725. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  60726. }),
  60727. $globals.ExampleSetTest);
  60728. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  60729. $core.addMethod(
  60730. $core.method({
  60731. selector: "fakeError",
  60732. protocol: "helpers",
  60733. fn: function (){
  60734. var self=this,$self=this;
  60735. return $core.withContext(function($ctx1) {
  60736. $self["@flag"]="bad";
  60737. $self._timeout_((30));
  60738. $self["@flag"]=$recv($self._async_((function(){
  60739. return $core.withContext(function($ctx2) {
  60740. $self["@flag"]="ok";
  60741. $self["@flag"];
  60742. return $self._error_("Intentional");
  60743. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60744. })))._valueWithTimeout_((20));
  60745. return self;
  60746. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  60747. },
  60748. args: [],
  60749. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  60750. referencedClasses: [],
  60751. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  60752. }),
  60753. $globals.SUnitAsyncTest);
  60754. $core.addMethod(
  60755. $core.method({
  60756. selector: "fakeErrorFailingInTearDown",
  60757. protocol: "helpers",
  60758. fn: function (){
  60759. var self=this,$self=this;
  60760. return $core.withContext(function($ctx1) {
  60761. $self["@flag"]="bad";
  60762. $self._timeout_((30));
  60763. $self["@flag"]=$recv($self._async_((function(){
  60764. return $core.withContext(function($ctx2) {
  60765. return $self._error_("Intentional");
  60766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60767. })))._valueWithTimeout_((20));
  60768. return self;
  60769. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  60770. },
  60771. args: [],
  60772. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  60773. referencedClasses: [],
  60774. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  60775. }),
  60776. $globals.SUnitAsyncTest);
  60777. $core.addMethod(
  60778. $core.method({
  60779. selector: "fakeFailure",
  60780. protocol: "helpers",
  60781. fn: function (){
  60782. var self=this,$self=this;
  60783. return $core.withContext(function($ctx1) {
  60784. $self["@flag"]="bad";
  60785. $self._timeout_((30));
  60786. $self["@flag"]=$recv($self._async_((function(){
  60787. return $core.withContext(function($ctx2) {
  60788. $self["@flag"]="ok";
  60789. $self["@flag"];
  60790. return $self._assert_(false);
  60791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60792. })))._valueWithTimeout_((20));
  60793. return self;
  60794. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  60795. },
  60796. args: [],
  60797. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  60798. referencedClasses: [],
  60799. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  60800. }),
  60801. $globals.SUnitAsyncTest);
  60802. $core.addMethod(
  60803. $core.method({
  60804. selector: "fakeMultipleTimeoutFailing",
  60805. protocol: "helpers",
  60806. fn: function (){
  60807. var self=this,$self=this;
  60808. return $core.withContext(function($ctx1) {
  60809. var $1;
  60810. $self._timeout_((100));
  60811. $ctx1.sendIdx["timeout:"]=1;
  60812. $1=$self._async_((function(){
  60813. return $core.withContext(function($ctx2) {
  60814. $self._timeout_((20));
  60815. return $recv($self._async_((function(){
  60816. return $core.withContext(function($ctx3) {
  60817. return $self._finished();
  60818. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  60819. })))._valueWithTimeout_((30));
  60820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60821. }));
  60822. $ctx1.sendIdx["async:"]=1;
  60823. $recv($1)._valueWithTimeout_((20));
  60824. $ctx1.sendIdx["valueWithTimeout:"]=1;
  60825. return self;
  60826. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  60827. },
  60828. args: [],
  60829. 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",
  60830. referencedClasses: [],
  60831. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  60832. }),
  60833. $globals.SUnitAsyncTest);
  60834. $core.addMethod(
  60835. $core.method({
  60836. selector: "fakeMultipleTimeoutPassing",
  60837. protocol: "helpers",
  60838. fn: function (){
  60839. var self=this,$self=this;
  60840. return $core.withContext(function($ctx1) {
  60841. var $1;
  60842. $self._timeout_((20));
  60843. $ctx1.sendIdx["timeout:"]=1;
  60844. $1=$self._async_((function(){
  60845. return $core.withContext(function($ctx2) {
  60846. $self._timeout_((40));
  60847. return $recv($self._async_((function(){
  60848. return $core.withContext(function($ctx3) {
  60849. return $self._finished();
  60850. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  60851. })))._valueWithTimeout_((20));
  60852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60853. }));
  60854. $ctx1.sendIdx["async:"]=1;
  60855. $recv($1)._valueWithTimeout_((10));
  60856. $ctx1.sendIdx["valueWithTimeout:"]=1;
  60857. return self;
  60858. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  60859. },
  60860. args: [],
  60861. 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",
  60862. referencedClasses: [],
  60863. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  60864. }),
  60865. $globals.SUnitAsyncTest);
  60866. $core.addMethod(
  60867. $core.method({
  60868. selector: "fakeTimeout",
  60869. protocol: "helpers",
  60870. fn: function (){
  60871. var self=this,$self=this;
  60872. return $core.withContext(function($ctx1) {
  60873. $self._timeout_((10));
  60874. $recv($self._async_((function(){
  60875. return $core.withContext(function($ctx2) {
  60876. return $self._finished();
  60877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60878. })))._valueWithTimeout_((20));
  60879. return self;
  60880. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  60881. },
  60882. args: [],
  60883. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  60884. referencedClasses: [],
  60885. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  60886. }),
  60887. $globals.SUnitAsyncTest);
  60888. $core.addMethod(
  60889. $core.method({
  60890. selector: "selectorSetOf:",
  60891. protocol: "private",
  60892. fn: function (aCollection){
  60893. var self=this,$self=this;
  60894. return $core.withContext(function($ctx1) {
  60895. return $recv($recv(aCollection)._collect_((function(each){
  60896. return $core.withContext(function($ctx2) {
  60897. return $recv(each)._selector();
  60898. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60899. })))._asSet();
  60900. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  60901. },
  60902. args: ["aCollection"],
  60903. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  60904. referencedClasses: [],
  60905. messageSends: ["asSet", "collect:", "selector"]
  60906. }),
  60907. $globals.SUnitAsyncTest);
  60908. $core.addMethod(
  60909. $core.method({
  60910. selector: "setUp",
  60911. protocol: "running",
  60912. fn: function (){
  60913. var self=this,$self=this;
  60914. $self["@flag"]="ok";
  60915. return self;
  60916. },
  60917. args: [],
  60918. source: "setUp\x0a\x09flag := 'ok'",
  60919. referencedClasses: [],
  60920. messageSends: []
  60921. }),
  60922. $globals.SUnitAsyncTest);
  60923. $core.addMethod(
  60924. $core.method({
  60925. selector: "tearDown",
  60926. protocol: "running",
  60927. fn: function (){
  60928. var self=this,$self=this;
  60929. return $core.withContext(function($ctx1) {
  60930. $self._assert_equals_("ok",$self["@flag"]);
  60931. return self;
  60932. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  60933. },
  60934. args: [],
  60935. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  60936. referencedClasses: [],
  60937. messageSends: ["assert:equals:"]
  60938. }),
  60939. $globals.SUnitAsyncTest);
  60940. $core.addMethod(
  60941. $core.method({
  60942. selector: "testAsyncErrorsAndFailures",
  60943. protocol: "tests",
  60944. fn: function (){
  60945. var self=this,$self=this;
  60946. var suite,runner,result,assertBlock;
  60947. return $core.withContext(function($ctx1) {
  60948. var $1,$2,$3,$4;
  60949. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  60950. return $core.withContext(function($ctx2) {
  60951. return $recv($self._class())._selector_(each);
  60952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60953. }));
  60954. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  60955. $self._timeout_((200));
  60956. result=$recv(runner)._result();
  60957. $ctx1.sendIdx["result"]=1;
  60958. assertBlock=$self._async_((function(){
  60959. return $core.withContext(function($ctx2) {
  60960. $1=$self._selectorSetOf_($recv(result)._errors());
  60961. $ctx2.sendIdx["selectorSetOf:"]=1;
  60962. $2=["fakeError"]._asSet();
  60963. $ctx2.sendIdx["asSet"]=1;
  60964. $self._assert_equals_($1,$2);
  60965. $ctx2.sendIdx["assert:equals:"]=1;
  60966. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  60967. return $self._finished();
  60968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60969. }));
  60970. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  60971. return $core.withContext(function($ctx2) {
  60972. $3=$recv($recv(ann)._result()).__eq_eq(result);
  60973. if($core.assert($3)){
  60974. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  60975. return $recv($4)._ifTrue_(assertBlock);
  60976. }
  60977. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  60978. }));
  60979. $recv(runner)._run();
  60980. return self;
  60981. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  60982. },
  60983. args: [],
  60984. 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",
  60985. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  60986. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  60987. }),
  60988. $globals.SUnitAsyncTest);
  60989. $core.addMethod(
  60990. $core.method({
  60991. selector: "testAsyncNeedsTimeout",
  60992. protocol: "tests",
  60993. fn: function (){
  60994. var self=this,$self=this;
  60995. return $core.withContext(function($ctx1) {
  60996. $self._should_raise_((function(){
  60997. return $core.withContext(function($ctx2) {
  60998. return $self._async_((function(){
  60999. }));
  61000. $ctx2.sendIdx["async:"]=1;
  61001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61002. }),$globals.Error);
  61003. $self._timeout_((0));
  61004. $self._shouldnt_raise_((function(){
  61005. return $core.withContext(function($ctx2) {
  61006. return $self._async_((function(){
  61007. }));
  61008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61009. }),$globals.Error);
  61010. $self._finished();
  61011. return self;
  61012. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61013. },
  61014. args: [],
  61015. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61016. referencedClasses: ["Error"],
  61017. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61018. }),
  61019. $globals.SUnitAsyncTest);
  61020. $core.addMethod(
  61021. $core.method({
  61022. selector: "testFinishedNeedsTimeout",
  61023. protocol: "tests",
  61024. fn: function (){
  61025. var self=this,$self=this;
  61026. return $core.withContext(function($ctx1) {
  61027. $self._should_raise_((function(){
  61028. return $core.withContext(function($ctx2) {
  61029. return $self._finished();
  61030. $ctx2.sendIdx["finished"]=1;
  61031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61032. }),$globals.Error);
  61033. $self._timeout_((0));
  61034. $self._shouldnt_raise_((function(){
  61035. return $core.withContext(function($ctx2) {
  61036. return $self._finished();
  61037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61038. }),$globals.Error);
  61039. return self;
  61040. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61041. },
  61042. args: [],
  61043. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61044. referencedClasses: ["Error"],
  61045. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61046. }),
  61047. $globals.SUnitAsyncTest);
  61048. $core.addMethod(
  61049. $core.method({
  61050. selector: "testIsAsyncReturnsCorrectValues",
  61051. protocol: "tests",
  61052. fn: function (){
  61053. var self=this,$self=this;
  61054. return $core.withContext(function($ctx1) {
  61055. var $1,$2;
  61056. $1=$self._isAsync();
  61057. $ctx1.sendIdx["isAsync"]=1;
  61058. $self._deny_($1);
  61059. $ctx1.sendIdx["deny:"]=1;
  61060. $self._timeout_((0));
  61061. $2=$self._isAsync();
  61062. $ctx1.sendIdx["isAsync"]=2;
  61063. $self._assert_($2);
  61064. $self._finished();
  61065. $self._deny_($self._isAsync());
  61066. return self;
  61067. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61068. },
  61069. args: [],
  61070. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61071. referencedClasses: [],
  61072. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61073. }),
  61074. $globals.SUnitAsyncTest);
  61075. $core.addMethod(
  61076. $core.method({
  61077. selector: "testPass",
  61078. protocol: "tests",
  61079. fn: function (){
  61080. var self=this,$self=this;
  61081. return $core.withContext(function($ctx1) {
  61082. $self["@flag"]="bad";
  61083. $self._timeout_((10));
  61084. $self["@flag"]=$recv($self._async_((function(){
  61085. return $core.withContext(function($ctx2) {
  61086. $self._assert_(true);
  61087. $self._finished();
  61088. $self["@flag"]="ok";
  61089. return $self["@flag"];
  61090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61091. })))._valueWithTimeout_((5));
  61092. return self;
  61093. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61094. },
  61095. args: [],
  61096. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61097. referencedClasses: [],
  61098. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61099. }),
  61100. $globals.SUnitAsyncTest);
  61101. $core.addMethod(
  61102. $core.method({
  61103. selector: "testTimeouts",
  61104. protocol: "tests",
  61105. fn: function (){
  61106. var self=this,$self=this;
  61107. var suite,runner,result,assertBlock;
  61108. return $core.withContext(function($ctx1) {
  61109. var $1,$2,$3;
  61110. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61111. return $core.withContext(function($ctx2) {
  61112. return $recv($self._class())._selector_(each);
  61113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61114. }));
  61115. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61116. $self._timeout_((200));
  61117. result=$recv(runner)._result();
  61118. $ctx1.sendIdx["result"]=1;
  61119. assertBlock=$self._async_((function(){
  61120. return $core.withContext(function($ctx2) {
  61121. $1=$self._selectorSetOf_($recv(result)._errors());
  61122. $ctx2.sendIdx["selectorSetOf:"]=1;
  61123. $self._assert_equals_($1,$recv($globals.Set)._new());
  61124. $ctx2.sendIdx["assert:equals:"]=1;
  61125. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61126. return $self._finished();
  61127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61128. }));
  61129. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61130. return $core.withContext(function($ctx2) {
  61131. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61132. if($core.assert($2)){
  61133. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61134. return $recv($3)._ifTrue_(assertBlock);
  61135. }
  61136. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61137. }));
  61138. $recv(runner)._run();
  61139. return self;
  61140. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61141. },
  61142. args: [],
  61143. 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",
  61144. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61145. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61146. }),
  61147. $globals.SUnitAsyncTest);
  61148. $core.addMethod(
  61149. $core.method({
  61150. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61151. protocol: "tests",
  61152. fn: function (){
  61153. var self=this,$self=this;
  61154. var x;
  61155. return $core.withContext(function($ctx1) {
  61156. var $1;
  61157. $self["@flag"]="bad";
  61158. $self._timeout_((10));
  61159. x=(0);
  61160. $1=$self._async_((function(){
  61161. return $core.withContext(function($ctx2) {
  61162. $self._finished();
  61163. $ctx2.sendIdx["finished"]=1;
  61164. $self["@flag"]="ok";
  61165. $self["@flag"];
  61166. x=$recv(x).__plus((1));
  61167. $ctx2.sendIdx["+"]=1;
  61168. x;
  61169. return $self._assert_equals_(x,(1));
  61170. $ctx2.sendIdx["assert:equals:"]=1;
  61171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61172. }));
  61173. $ctx1.sendIdx["async:"]=1;
  61174. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61175. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61176. $self["@flag"]=$recv($self._async_((function(){
  61177. return $core.withContext(function($ctx2) {
  61178. $self._finished();
  61179. $self["@flag"]="ok";
  61180. $self["@flag"];
  61181. x=$recv(x).__plus((1));
  61182. x;
  61183. return $self._assert_equals_(x,(1));
  61184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61185. })))._valueWithTimeout_((0));
  61186. return self;
  61187. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61188. },
  61189. args: [],
  61190. 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.",
  61191. referencedClasses: [],
  61192. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61193. }),
  61194. $globals.SUnitAsyncTest);
  61195. });
  61196. define('amber/devel',[
  61197. './lang',
  61198. './brikz', // pre-fetch, dep of ./boot
  61199. './kernel-checks', // pre-fetch, dep of ./boot
  61200. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61201. './kernel-language', // pre-fetch, dep of ./boot
  61202. './boot', // pre-fetch, class loader
  61203. './deploy', // pre-fetch, dep of ./lang
  61204. // --- packages of the development only Amber begin here ---
  61205. 'amber_core/Platform-DOM',
  61206. 'amber_core/SUnit',
  61207. 'amber_core/Compiler-Tests',
  61208. 'amber_core/Kernel-Tests',
  61209. 'amber_core/Platform-DOM-Tests',
  61210. 'amber_core/SUnit-Tests'
  61211. // --- packages of the development only Amber end here ---
  61212. ], function (amber) {
  61213. return amber;
  61214. });
  61215. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61216. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61217. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61218. $core.addPackage("Platform-Node");
  61219. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61220. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61221. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61222. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61223. $core.addMethod(
  61224. $core.method({
  61225. selector: "globals",
  61226. protocol: "accessing",
  61227. fn: function (){
  61228. var self=this,$self=this;
  61229. return global;
  61230. },
  61231. args: [],
  61232. source: "globals\x0a\x09^ global",
  61233. referencedClasses: [],
  61234. messageSends: []
  61235. }),
  61236. $globals.NodePlatform);
  61237. $core.addMethod(
  61238. $core.method({
  61239. selector: "newXhr",
  61240. protocol: "accessing",
  61241. fn: function (){
  61242. var self=this,$self=this;
  61243. return $core.withContext(function($ctx1) {
  61244. var $receiver;
  61245. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61246. $self._error_("XMLHttpRequest not available.");
  61247. } else {
  61248. return $recv($globals.XMLHttpRequest)._new();
  61249. }
  61250. return self;
  61251. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61252. },
  61253. args: [],
  61254. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61255. referencedClasses: ["XMLHttpRequest"],
  61256. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61257. }),
  61258. $globals.NodePlatform);
  61259. $core.addMethod(
  61260. $core.method({
  61261. selector: "initialize",
  61262. protocol: "testing",
  61263. fn: function (){
  61264. var self=this,$self=this;
  61265. return $core.withContext(function($ctx1) {
  61266. var $1;
  61267. $1=$self._isFeasible();
  61268. if($core.assert($1)){
  61269. $recv($globals.Platform)._registerIfNone_($self._new());
  61270. }
  61271. return self;
  61272. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61273. },
  61274. args: [],
  61275. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61276. referencedClasses: ["Platform"],
  61277. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61278. }),
  61279. $globals.NodePlatform.a$cls);
  61280. $core.addMethod(
  61281. $core.method({
  61282. selector: "isFeasible",
  61283. protocol: "testing",
  61284. fn: function (){
  61285. var self=this,$self=this;
  61286. return $core.withContext(function($ctx1) {
  61287. return typeof global !== "undefined";
  61288. return self;
  61289. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61290. },
  61291. args: [],
  61292. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61293. referencedClasses: [],
  61294. messageSends: []
  61295. }),
  61296. $globals.NodePlatform.a$cls);
  61297. });
  61298. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61299. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61300. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61301. $core.addPackage("AmberCli");
  61302. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61303. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61304. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61305. $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.";
  61306. $core.addMethod(
  61307. $core.method({
  61308. selector: "commandLineSwitches",
  61309. protocol: "commandline",
  61310. fn: function (){
  61311. var self=this,$self=this;
  61312. var switches;
  61313. return $core.withContext(function($ctx1) {
  61314. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61315. return $core.withContext(function($ctx2) {
  61316. return $recv(each)._selector();
  61317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61318. }));
  61319. $ctx1.sendIdx["collect:"]=1;
  61320. switches=$recv(switches)._select_((function(each){
  61321. return $core.withContext(function($ctx2) {
  61322. return $recv(each)._match_("^[^:]*:$");
  61323. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61324. }));
  61325. switches=$recv(switches)._collect_((function(each){
  61326. return $core.withContext(function($ctx2) {
  61327. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61329. }));
  61330. return switches;
  61331. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61332. },
  61333. args: [],
  61334. 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",
  61335. referencedClasses: [],
  61336. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61337. }),
  61338. $globals.AmberCli.a$cls);
  61339. $core.addMethod(
  61340. $core.method({
  61341. selector: "config:",
  61342. protocol: "commands",
  61343. fn: function (args){
  61344. var self=this,$self=this;
  61345. return $core.withContext(function($ctx1) {
  61346. $recv($recv($globals.Configurator)._new())._start();
  61347. return self;
  61348. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61349. },
  61350. args: ["args"],
  61351. source: "config: args\x0a\x09Configurator new start",
  61352. referencedClasses: ["Configurator"],
  61353. messageSends: ["start", "new"]
  61354. }),
  61355. $globals.AmberCli.a$cls);
  61356. $core.addMethod(
  61357. $core.method({
  61358. selector: "handleArguments:",
  61359. protocol: "commandline",
  61360. fn: function (args){
  61361. var self=this,$self=this;
  61362. var selector;
  61363. return $core.withContext(function($ctx1) {
  61364. var $1;
  61365. $1=$recv(args)._first();
  61366. $ctx1.sendIdx["first"]=1;
  61367. selector=$self._selectorForCommandLineSwitch_($1);
  61368. $recv(args)._remove_($recv(args)._first());
  61369. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61370. return self;
  61371. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61372. },
  61373. args: ["args"],
  61374. 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)",
  61375. referencedClasses: ["Array"],
  61376. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  61377. }),
  61378. $globals.AmberCli.a$cls);
  61379. $core.addMethod(
  61380. $core.method({
  61381. selector: "help:",
  61382. protocol: "commands",
  61383. fn: function (args){
  61384. var self=this,$self=this;
  61385. return $core.withContext(function($ctx1) {
  61386. $recv($globals.Transcript)._show_("Available commands");
  61387. $recv($self._commandLineSwitches())._do_((function(each){
  61388. return $core.withContext(function($ctx2) {
  61389. return $recv(console)._log_(each);
  61390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61391. }));
  61392. return self;
  61393. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  61394. },
  61395. args: ["args"],
  61396. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  61397. referencedClasses: ["Transcript"],
  61398. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  61399. }),
  61400. $globals.AmberCli.a$cls);
  61401. $core.addMethod(
  61402. $core.method({
  61403. selector: "init:",
  61404. protocol: "commands",
  61405. fn: function (args){
  61406. var self=this,$self=this;
  61407. return $core.withContext(function($ctx1) {
  61408. $recv($recv($globals.Initer)._new())._start();
  61409. return self;
  61410. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  61411. },
  61412. args: ["args"],
  61413. source: "init: args\x0a\x09Initer new start",
  61414. referencedClasses: ["Initer"],
  61415. messageSends: ["start", "new"]
  61416. }),
  61417. $globals.AmberCli.a$cls);
  61418. $core.addMethod(
  61419. $core.method({
  61420. selector: "main",
  61421. protocol: "startup",
  61422. fn: function (){
  61423. var self=this,$self=this;
  61424. var args,packageJSON;
  61425. return $core.withContext(function($ctx1) {
  61426. var $7,$6,$5,$4,$3,$2,$1;
  61427. var $early={};
  61428. try {
  61429. packageJSON=$recv(require)._value_("../package.json");
  61430. $7=$recv(packageJSON)._version();
  61431. $ctx1.sendIdx["version"]=1;
  61432. $6="Welcome to Amber CLI version ".__comma($7);
  61433. $5=$recv($6).__comma(" (Amber ");
  61434. $ctx1.sendIdx[","]=5;
  61435. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  61436. $ctx1.sendIdx[","]=4;
  61437. $3=$recv($4).__comma(", NodeJS ");
  61438. $ctx1.sendIdx[","]=3;
  61439. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  61440. $ctx1.sendIdx[","]=2;
  61441. $1=$recv($2).__comma(").");
  61442. $ctx1.sendIdx[","]=1;
  61443. $recv($globals.Transcript)._show_($1);
  61444. args=$recv(process)._argv();
  61445. $recv(args)._removeFrom_to_((1),(2));
  61446. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  61447. return $core.withContext(function($ctx2) {
  61448. return $self._help_(nil);
  61449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61450. }),(function(){
  61451. return $core.withContext(function($ctx2) {
  61452. throw $early=[$self._handleArguments_(args)];
  61453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61454. }));
  61455. return self;
  61456. }
  61457. catch(e) {if(e===$early)return e[0]; throw e}
  61458. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  61459. },
  61460. args: [],
  61461. 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]",
  61462. referencedClasses: ["Transcript", "Smalltalk"],
  61463. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  61464. }),
  61465. $globals.AmberCli.a$cls);
  61466. $core.addMethod(
  61467. $core.method({
  61468. selector: "repl:",
  61469. protocol: "commands",
  61470. fn: function (args){
  61471. var self=this,$self=this;
  61472. return $core.withContext(function($ctx1) {
  61473. return $recv($recv($globals.Repl)._new())._createInterface();
  61474. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  61475. },
  61476. args: ["args"],
  61477. source: "repl: args\x0a\x09^ Repl new createInterface",
  61478. referencedClasses: ["Repl"],
  61479. messageSends: ["createInterface", "new"]
  61480. }),
  61481. $globals.AmberCli.a$cls);
  61482. $core.addMethod(
  61483. $core.method({
  61484. selector: "selectorForCommandLineSwitch:",
  61485. protocol: "commandline",
  61486. fn: function (aSwitch){
  61487. var self=this,$self=this;
  61488. var command,selector;
  61489. return $core.withContext(function($ctx1) {
  61490. var $1;
  61491. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  61492. if($core.assert($1)){
  61493. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  61494. return $core.withContext(function($ctx2) {
  61495. return $recv($recv(each)._second())._asUppercase();
  61496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61497. }))).__comma(":");
  61498. selector;
  61499. } else {
  61500. selector="help:";
  61501. selector;
  61502. }
  61503. return selector;
  61504. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  61505. },
  61506. args: ["aSwitch"],
  61507. 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",
  61508. referencedClasses: [],
  61509. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  61510. }),
  61511. $globals.AmberCli.a$cls);
  61512. $core.addMethod(
  61513. $core.method({
  61514. selector: "serve:",
  61515. protocol: "commands",
  61516. fn: function (args){
  61517. var self=this,$self=this;
  61518. return $core.withContext(function($ctx1) {
  61519. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  61520. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  61521. },
  61522. args: ["args"],
  61523. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  61524. referencedClasses: ["FileServer"],
  61525. messageSends: ["start", "createServerWithArguments:"]
  61526. }),
  61527. $globals.AmberCli.a$cls);
  61528. $core.addMethod(
  61529. $core.method({
  61530. selector: "version:",
  61531. protocol: "commands",
  61532. fn: function (arguments_){
  61533. var self=this,$self=this;
  61534. return self;
  61535. },
  61536. args: ["arguments"],
  61537. source: "version: arguments",
  61538. referencedClasses: [],
  61539. messageSends: []
  61540. }),
  61541. $globals.AmberCli.a$cls);
  61542. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  61543. $core.addMethod(
  61544. $core.method({
  61545. selector: "dirname",
  61546. protocol: "private",
  61547. fn: function (){
  61548. var self=this,$self=this;
  61549. return $core.withContext(function($ctx1) {
  61550. return __dirname;
  61551. return self;
  61552. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  61553. },
  61554. args: [],
  61555. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  61556. referencedClasses: [],
  61557. messageSends: []
  61558. }),
  61559. $globals.BaseFileManipulator);
  61560. $core.addMethod(
  61561. $core.method({
  61562. selector: "initialize",
  61563. protocol: "initialization",
  61564. fn: function (){
  61565. var self=this,$self=this;
  61566. return $core.withContext(function($ctx1) {
  61567. (
  61568. $ctx1.supercall = true,
  61569. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61570. $ctx1.supercall = false;
  61571. $self["@path"]=$recv(require)._value_("path");
  61572. $ctx1.sendIdx["value:"]=1;
  61573. $self["@fs"]=$recv(require)._value_("fs");
  61574. return self;
  61575. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  61576. },
  61577. args: [],
  61578. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  61579. referencedClasses: [],
  61580. messageSends: ["initialize", "value:"]
  61581. }),
  61582. $globals.BaseFileManipulator);
  61583. $core.addMethod(
  61584. $core.method({
  61585. selector: "rootDirname",
  61586. protocol: "private",
  61587. fn: function (){
  61588. var self=this,$self=this;
  61589. return $core.withContext(function($ctx1) {
  61590. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  61591. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  61592. },
  61593. args: [],
  61594. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  61595. referencedClasses: [],
  61596. messageSends: ["join:with:", "dirname"]
  61597. }),
  61598. $globals.BaseFileManipulator);
  61599. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  61600. $core.addMethod(
  61601. $core.method({
  61602. selector: "initialize",
  61603. protocol: "initialization",
  61604. fn: function (){
  61605. var self=this,$self=this;
  61606. return $core.withContext(function($ctx1) {
  61607. (
  61608. $ctx1.supercall = true,
  61609. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61610. $ctx1.supercall = false;
  61611. return self;
  61612. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  61613. },
  61614. args: [],
  61615. source: "initialize\x0a\x09super initialize",
  61616. referencedClasses: [],
  61617. messageSends: ["initialize"]
  61618. }),
  61619. $globals.Configurator);
  61620. $core.addMethod(
  61621. $core.method({
  61622. selector: "start",
  61623. protocol: "action",
  61624. fn: function (){
  61625. var self=this,$self=this;
  61626. return $core.withContext(function($ctx1) {
  61627. var $receiver;
  61628. $self._writeConfigThenDo_((function(err){
  61629. return $core.withContext(function($ctx2) {
  61630. if(($receiver = err) == null || $receiver.a$nil){
  61631. return $recv(process)._exit();
  61632. } else {
  61633. return $recv(process)._exit_((111));
  61634. }
  61635. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  61636. }));
  61637. return self;
  61638. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  61639. },
  61640. args: [],
  61641. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  61642. referencedClasses: [],
  61643. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  61644. }),
  61645. $globals.Configurator);
  61646. $core.addMethod(
  61647. $core.method({
  61648. selector: "writeConfigThenDo:",
  61649. protocol: "action",
  61650. fn: function (aBlock){
  61651. var self=this,$self=this;
  61652. return $core.withContext(function($ctx1) {
  61653. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  61654. return self;
  61655. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  61656. },
  61657. args: ["aBlock"],
  61658. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  61659. referencedClasses: [],
  61660. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  61661. }),
  61662. $globals.Configurator);
  61663. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  61664. $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.";
  61665. $core.addMethod(
  61666. $core.method({
  61667. selector: "base64Decode:",
  61668. protocol: "private",
  61669. fn: function (aString){
  61670. var self=this,$self=this;
  61671. return $core.withContext(function($ctx1) {
  61672. return (new Buffer(aString, "base64").toString());
  61673. return self;
  61674. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  61675. },
  61676. args: ["aString"],
  61677. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  61678. referencedClasses: [],
  61679. messageSends: []
  61680. }),
  61681. $globals.FileServer);
  61682. $core.addMethod(
  61683. $core.method({
  61684. selector: "basePath",
  61685. protocol: "accessing",
  61686. fn: function (){
  61687. var self=this,$self=this;
  61688. return $core.withContext(function($ctx1) {
  61689. var $1,$receiver;
  61690. $1=$self["@basePath"];
  61691. if(($receiver = $1) == null || $receiver.a$nil){
  61692. return $recv($self._class())._defaultBasePath();
  61693. } else {
  61694. return $1;
  61695. }
  61696. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  61697. },
  61698. args: [],
  61699. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  61700. referencedClasses: [],
  61701. messageSends: ["ifNil:", "defaultBasePath", "class"]
  61702. }),
  61703. $globals.FileServer);
  61704. $core.addMethod(
  61705. $core.method({
  61706. selector: "basePath:",
  61707. protocol: "accessing",
  61708. fn: function (aString){
  61709. var self=this,$self=this;
  61710. return $core.withContext(function($ctx1) {
  61711. $self["@basePath"]=aString;
  61712. $self._validateBasePath();
  61713. return self;
  61714. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  61715. },
  61716. args: ["aString"],
  61717. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  61718. referencedClasses: [],
  61719. messageSends: ["validateBasePath"]
  61720. }),
  61721. $globals.FileServer);
  61722. $core.addMethod(
  61723. $core.method({
  61724. selector: "checkDirectoryLayout",
  61725. protocol: "initialization",
  61726. fn: function (){
  61727. var self=this,$self=this;
  61728. return $core.withContext(function($ctx1) {
  61729. var $1;
  61730. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  61731. if(!$core.assert($1)){
  61732. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  61733. $ctx1.sendIdx["warn:"]=1;
  61734. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  61735. $ctx1.sendIdx["warn:"]=2;
  61736. $recv(console)._warn_(" You can also specify a page to be served by default,");
  61737. $ctx1.sendIdx["warn:"]=3;
  61738. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  61739. }
  61740. return self;
  61741. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  61742. },
  61743. args: [],
  61744. 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.'].",
  61745. referencedClasses: [],
  61746. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  61747. }),
  61748. $globals.FileServer);
  61749. $core.addMethod(
  61750. $core.method({
  61751. selector: "fallbackPage",
  61752. protocol: "accessing",
  61753. fn: function (){
  61754. var self=this,$self=this;
  61755. return $self["@fallbackPage"];
  61756. },
  61757. args: [],
  61758. source: "fallbackPage\x0a\x09^ fallbackPage",
  61759. referencedClasses: [],
  61760. messageSends: []
  61761. }),
  61762. $globals.FileServer);
  61763. $core.addMethod(
  61764. $core.method({
  61765. selector: "fallbackPage:",
  61766. protocol: "accessing",
  61767. fn: function (aString){
  61768. var self=this,$self=this;
  61769. $self["@fallbackPage"]=aString;
  61770. return self;
  61771. },
  61772. args: ["aString"],
  61773. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  61774. referencedClasses: [],
  61775. messageSends: []
  61776. }),
  61777. $globals.FileServer);
  61778. $core.addMethod(
  61779. $core.method({
  61780. selector: "handleGETRequest:respondTo:",
  61781. protocol: "request handling",
  61782. fn: function (aRequest,aResponse){
  61783. var self=this,$self=this;
  61784. var uri,filename;
  61785. return $core.withContext(function($ctx1) {
  61786. var $1;
  61787. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  61788. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  61789. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  61790. return $core.withContext(function($ctx2) {
  61791. if($core.assert(aBoolean)){
  61792. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  61793. if($core.assert($1)){
  61794. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  61795. } else {
  61796. return $self._respondFileNamed_to_(filename,aResponse);
  61797. }
  61798. } else {
  61799. return $self._respondNotFoundTo_(aResponse);
  61800. }
  61801. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  61802. }));
  61803. return self;
  61804. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  61805. },
  61806. args: ["aRequest", "aResponse"],
  61807. 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]]]",
  61808. referencedClasses: [],
  61809. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  61810. }),
  61811. $globals.FileServer);
  61812. $core.addMethod(
  61813. $core.method({
  61814. selector: "handleOPTIONSRequest:respondTo:",
  61815. protocol: "request handling",
  61816. fn: function (aRequest,aResponse){
  61817. var self=this,$self=this;
  61818. return $core.withContext(function($ctx1) {
  61819. $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)]));
  61820. $recv(aResponse)._end();
  61821. return self;
  61822. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  61823. },
  61824. args: ["aRequest", "aResponse"],
  61825. 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",
  61826. referencedClasses: [],
  61827. messageSends: ["writeHead:options:", "end"]
  61828. }),
  61829. $globals.FileServer);
  61830. $core.addMethod(
  61831. $core.method({
  61832. selector: "handlePUTRequest:respondTo:",
  61833. protocol: "request handling",
  61834. fn: function (aRequest,aResponse){
  61835. var self=this,$self=this;
  61836. var file,stream;
  61837. return $core.withContext(function($ctx1) {
  61838. var $1,$2,$3,$4;
  61839. $1=$self._isAuthenticated_(aRequest);
  61840. if(!$core.assert($1)){
  61841. $self._respondAuthenticationRequiredTo_(aResponse);
  61842. return nil;
  61843. }
  61844. file=".".__comma($recv(aRequest)._url());
  61845. $ctx1.sendIdx[","]=1;
  61846. stream=$recv($self["@fs"])._createWriteStream_(file);
  61847. $recv(stream)._on_do_("error",(function(error){
  61848. return $core.withContext(function($ctx2) {
  61849. $2=console;
  61850. $3="Error creating WriteStream for file ".__comma(file);
  61851. $ctx2.sendIdx[","]=2;
  61852. $recv($2)._warn_($3);
  61853. $ctx2.sendIdx["warn:"]=1;
  61854. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  61855. $ctx2.sendIdx["warn:"]=2;
  61856. $recv(console)._warn_(" The exact error is: ".__comma(error));
  61857. return $self._respondNotCreatedTo_(aResponse);
  61858. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  61859. }));
  61860. $ctx1.sendIdx["on:do:"]=1;
  61861. $recv(stream)._on_do_("close",(function(){
  61862. return $core.withContext(function($ctx2) {
  61863. return $self._respondCreatedTo_(aResponse);
  61864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61865. }));
  61866. $ctx1.sendIdx["on:do:"]=2;
  61867. $recv(aRequest)._setEncoding_("utf8");
  61868. $recv(aRequest)._on_do_("data",(function(data){
  61869. return $core.withContext(function($ctx2) {
  61870. return $recv(stream)._write_(data);
  61871. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  61872. }));
  61873. $ctx1.sendIdx["on:do:"]=3;
  61874. $recv(aRequest)._on_do_("end",(function(){
  61875. return $core.withContext(function($ctx2) {
  61876. $4=$recv(stream)._writable();
  61877. if($core.assert($4)){
  61878. return $recv(stream)._end();
  61879. }
  61880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  61881. }));
  61882. return self;
  61883. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  61884. },
  61885. args: ["aRequest", "aResponse"],
  61886. 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]]",
  61887. referencedClasses: [],
  61888. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  61889. }),
  61890. $globals.FileServer);
  61891. $core.addMethod(
  61892. $core.method({
  61893. selector: "handleRequest:respondTo:",
  61894. protocol: "request handling",
  61895. fn: function (aRequest,aResponse){
  61896. var self=this,$self=this;
  61897. return $core.withContext(function($ctx1) {
  61898. var $2,$1,$4,$3,$5;
  61899. $2=$recv(aRequest)._method();
  61900. $ctx1.sendIdx["method"]=1;
  61901. $1=$recv($2).__eq("PUT");
  61902. $ctx1.sendIdx["="]=1;
  61903. if($core.assert($1)){
  61904. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  61905. }
  61906. $4=$recv(aRequest)._method();
  61907. $ctx1.sendIdx["method"]=2;
  61908. $3=$recv($4).__eq("GET");
  61909. $ctx1.sendIdx["="]=2;
  61910. if($core.assert($3)){
  61911. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  61912. }
  61913. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  61914. if($core.assert($5)){
  61915. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  61916. }
  61917. return self;
  61918. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  61919. },
  61920. args: ["aRequest", "aResponse"],
  61921. 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]",
  61922. referencedClasses: [],
  61923. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  61924. }),
  61925. $globals.FileServer);
  61926. $core.addMethod(
  61927. $core.method({
  61928. selector: "host",
  61929. protocol: "accessing",
  61930. fn: function (){
  61931. var self=this,$self=this;
  61932. return $self["@host"];
  61933. },
  61934. args: [],
  61935. source: "host\x0a\x09^ host",
  61936. referencedClasses: [],
  61937. messageSends: []
  61938. }),
  61939. $globals.FileServer);
  61940. $core.addMethod(
  61941. $core.method({
  61942. selector: "host:",
  61943. protocol: "accessing",
  61944. fn: function (hostname){
  61945. var self=this,$self=this;
  61946. $self["@host"]=hostname;
  61947. return self;
  61948. },
  61949. args: ["hostname"],
  61950. source: "host: hostname\x0a\x09host := hostname",
  61951. referencedClasses: [],
  61952. messageSends: []
  61953. }),
  61954. $globals.FileServer);
  61955. $core.addMethod(
  61956. $core.method({
  61957. selector: "initialize",
  61958. protocol: "initialization",
  61959. fn: function (){
  61960. var self=this,$self=this;
  61961. return $core.withContext(function($ctx1) {
  61962. var $1;
  61963. (
  61964. $ctx1.supercall = true,
  61965. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61966. $ctx1.supercall = false;
  61967. $self["@http"]=$self._require_("http");
  61968. $ctx1.sendIdx["require:"]=1;
  61969. $self["@util"]=$self._require_("util");
  61970. $ctx1.sendIdx["require:"]=2;
  61971. $self["@url"]=$self._require_("url");
  61972. $1=$self._class();
  61973. $ctx1.sendIdx["class"]=1;
  61974. $self["@host"]=$recv($1)._defaultHost();
  61975. $self["@port"]=$recv($self._class())._defaultPort();
  61976. $self["@username"]=nil;
  61977. $self["@password"]=nil;
  61978. $self["@fallbackPage"]=nil;
  61979. return self;
  61980. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  61981. },
  61982. args: [],
  61983. 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.",
  61984. referencedClasses: [],
  61985. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  61986. }),
  61987. $globals.FileServer);
  61988. $core.addMethod(
  61989. $core.method({
  61990. selector: "isAuthenticated:",
  61991. protocol: "private",
  61992. fn: function (aRequest){
  61993. var self=this,$self=this;
  61994. var header,token,auth,parts;
  61995. return $core.withContext(function($ctx1) {
  61996. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  61997. var $early={};
  61998. try {
  61999. $2=$recv($self["@username"])._isNil();
  62000. $ctx1.sendIdx["isNil"]=1;
  62001. $1=$recv($2)._and_((function(){
  62002. return $core.withContext(function($ctx2) {
  62003. return $recv($self["@password"])._isNil();
  62004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62005. }));
  62006. $ctx1.sendIdx["and:"]=1;
  62007. if($core.assert($1)){
  62008. return true;
  62009. }
  62010. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62011. $ctx1.sendIdx["at:"]=1;
  62012. if(($receiver = $3) == null || $receiver.a$nil){
  62013. header="";
  62014. } else {
  62015. header=$3;
  62016. }
  62017. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62018. throw $early=[false];
  62019. }),(function(){
  62020. return $core.withContext(function($ctx2) {
  62021. $4=$recv(header)._tokenize_(" ");
  62022. $ctx2.sendIdx["tokenize:"]=1;
  62023. if(($receiver = $4) == null || $receiver.a$nil){
  62024. token="";
  62025. } else {
  62026. token=$4;
  62027. }
  62028. token;
  62029. $5=$recv(token)._at_((2));
  62030. $ctx2.sendIdx["at:"]=2;
  62031. auth=$self._base64Decode_($5);
  62032. auth;
  62033. parts=$recv(auth)._tokenize_(":");
  62034. parts;
  62035. $8=$self["@username"];
  62036. $9=$recv(parts)._at_((1));
  62037. $ctx2.sendIdx["at:"]=3;
  62038. $7=$recv($8).__eq($9);
  62039. $ctx2.sendIdx["="]=1;
  62040. $6=$recv($7)._and_((function(){
  62041. return $core.withContext(function($ctx3) {
  62042. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62043. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62044. }));
  62045. if($core.assert($6)){
  62046. throw $early=[true];
  62047. } else {
  62048. throw $early=[false];
  62049. }
  62050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62051. }));
  62052. return self;
  62053. }
  62054. catch(e) {if(e===$early)return e[0]; throw e}
  62055. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62056. },
  62057. args: ["aRequest"],
  62058. 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].",
  62059. referencedClasses: [],
  62060. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62061. }),
  62062. $globals.FileServer);
  62063. $core.addMethod(
  62064. $core.method({
  62065. selector: "password:",
  62066. protocol: "accessing",
  62067. fn: function (aPassword){
  62068. var self=this,$self=this;
  62069. $self["@password"]=aPassword;
  62070. return self;
  62071. },
  62072. args: ["aPassword"],
  62073. source: "password: aPassword\x0a\x09password := aPassword.",
  62074. referencedClasses: [],
  62075. messageSends: []
  62076. }),
  62077. $globals.FileServer);
  62078. $core.addMethod(
  62079. $core.method({
  62080. selector: "port",
  62081. protocol: "accessing",
  62082. fn: function (){
  62083. var self=this,$self=this;
  62084. return $self["@port"];
  62085. },
  62086. args: [],
  62087. source: "port\x0a\x09^ port",
  62088. referencedClasses: [],
  62089. messageSends: []
  62090. }),
  62091. $globals.FileServer);
  62092. $core.addMethod(
  62093. $core.method({
  62094. selector: "port:",
  62095. protocol: "accessing",
  62096. fn: function (aNumber){
  62097. var self=this,$self=this;
  62098. $self["@port"]=aNumber;
  62099. return self;
  62100. },
  62101. args: ["aNumber"],
  62102. source: "port: aNumber\x0a\x09port := aNumber",
  62103. referencedClasses: [],
  62104. messageSends: []
  62105. }),
  62106. $globals.FileServer);
  62107. $core.addMethod(
  62108. $core.method({
  62109. selector: "require:",
  62110. protocol: "private",
  62111. fn: function (aModuleString){
  62112. var self=this,$self=this;
  62113. return $core.withContext(function($ctx1) {
  62114. return $recv(require)._value_(aModuleString);
  62115. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62116. },
  62117. args: ["aModuleString"],
  62118. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62119. referencedClasses: [],
  62120. messageSends: ["value:"]
  62121. }),
  62122. $globals.FileServer);
  62123. $core.addMethod(
  62124. $core.method({
  62125. selector: "respondAuthenticationRequiredTo:",
  62126. protocol: "request handling",
  62127. fn: function (aResponse){
  62128. var self=this,$self=this;
  62129. return $core.withContext(function($ctx1) {
  62130. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62131. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62132. $recv(aResponse)._end();
  62133. return self;
  62134. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62135. },
  62136. args: ["aResponse"],
  62137. 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.",
  62138. referencedClasses: [],
  62139. messageSends: ["writeHead:options:", "write:", "end"]
  62140. }),
  62141. $globals.FileServer);
  62142. $core.addMethod(
  62143. $core.method({
  62144. selector: "respondCreatedTo:",
  62145. protocol: "request handling",
  62146. fn: function (aResponse){
  62147. var self=this,$self=this;
  62148. return $core.withContext(function($ctx1) {
  62149. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62150. $recv(aResponse)._end();
  62151. return self;
  62152. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62153. },
  62154. args: ["aResponse"],
  62155. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62156. referencedClasses: [],
  62157. messageSends: ["writeHead:options:", "end"]
  62158. }),
  62159. $globals.FileServer);
  62160. $core.addMethod(
  62161. $core.method({
  62162. selector: "respondDirectoryNamed:from:to:",
  62163. protocol: "request handling",
  62164. fn: function (aDirname,aUrl,aResponse){
  62165. var self=this,$self=this;
  62166. return $core.withContext(function($ctx1) {
  62167. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62168. $2=$recv(aUrl)._pathname();
  62169. $ctx1.sendIdx["pathname"]=1;
  62170. $1=$recv($2)._endsWith_("/");
  62171. if($core.assert($1)){
  62172. $3=$recv(aDirname).__comma("index.html");
  62173. $ctx1.sendIdx[","]=1;
  62174. $self._respondFileNamed_to_($3,aResponse);
  62175. } else {
  62176. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62177. $7=$recv(aUrl)._search();
  62178. if(($receiver = $7) == null || $receiver.a$nil){
  62179. $6="";
  62180. } else {
  62181. $6=$7;
  62182. }
  62183. $4=$recv($5).__comma($6);
  62184. $ctx1.sendIdx[","]=2;
  62185. $self._respondRedirect_to_($4,aResponse);
  62186. }
  62187. return self;
  62188. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62189. },
  62190. args: ["aDirname", "aUrl", "aResponse"],
  62191. 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]",
  62192. referencedClasses: [],
  62193. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62194. }),
  62195. $globals.FileServer);
  62196. $core.addMethod(
  62197. $core.method({
  62198. selector: "respondFileNamed:to:",
  62199. protocol: "request handling",
  62200. fn: function (aFilename,aResponse){
  62201. var self=this,$self=this;
  62202. var type,filename;
  62203. return $core.withContext(function($ctx1) {
  62204. var $1,$2,$3,$4;
  62205. filename=aFilename;
  62206. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62207. return $core.withContext(function($ctx2) {
  62208. $1=$recv(ex)._notNil();
  62209. if($core.assert($1)){
  62210. $2=console;
  62211. $3=$recv(filename).__comma(" does not exist");
  62212. $ctx2.sendIdx[","]=1;
  62213. $recv($2)._log_($3);
  62214. return $self._respondNotFoundTo_(aResponse);
  62215. } else {
  62216. type=$recv($self._class())._mimeTypeFor_(filename);
  62217. type;
  62218. $4=$recv(type).__eq("application/javascript");
  62219. if($core.assert($4)){
  62220. type=$recv(type).__comma(";charset=utf-8");
  62221. type;
  62222. }
  62223. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62224. $recv(aResponse)._write_encoding_(file,"binary");
  62225. return $recv(aResponse)._end();
  62226. }
  62227. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62228. }));
  62229. return self;
  62230. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62231. },
  62232. args: ["aFilename", "aResponse"],
  62233. 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]]",
  62234. referencedClasses: [],
  62235. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62236. }),
  62237. $globals.FileServer);
  62238. $core.addMethod(
  62239. $core.method({
  62240. selector: "respondInternalErrorTo:",
  62241. protocol: "request handling",
  62242. fn: function (aResponse){
  62243. var self=this,$self=this;
  62244. return $core.withContext(function($ctx1) {
  62245. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62246. $recv(aResponse)._write_("500 Internal server error");
  62247. $recv(aResponse)._end();
  62248. return self;
  62249. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62250. },
  62251. args: ["aResponse"],
  62252. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62253. referencedClasses: [],
  62254. messageSends: ["writeHead:options:", "write:", "end"]
  62255. }),
  62256. $globals.FileServer);
  62257. $core.addMethod(
  62258. $core.method({
  62259. selector: "respondNotCreatedTo:",
  62260. protocol: "request handling",
  62261. fn: function (aResponse){
  62262. var self=this,$self=this;
  62263. return $core.withContext(function($ctx1) {
  62264. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62265. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62266. $recv(aResponse)._end();
  62267. return self;
  62268. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62269. },
  62270. args: ["aResponse"],
  62271. 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.",
  62272. referencedClasses: [],
  62273. messageSends: ["writeHead:options:", "write:", "end"]
  62274. }),
  62275. $globals.FileServer);
  62276. $core.addMethod(
  62277. $core.method({
  62278. selector: "respondNotFoundTo:",
  62279. protocol: "request handling",
  62280. fn: function (aResponse){
  62281. var self=this,$self=this;
  62282. return $core.withContext(function($ctx1) {
  62283. var $2,$1;
  62284. $2=$self._fallbackPage();
  62285. $ctx1.sendIdx["fallbackPage"]=1;
  62286. $1=$recv($2)._isNil();
  62287. if(!$core.assert($1)){
  62288. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62289. }
  62290. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62291. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62292. $ctx1.sendIdx["write:"]=1;
  62293. $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>");
  62294. $ctx1.sendIdx["write:"]=2;
  62295. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62296. $ctx1.sendIdx["write:"]=3;
  62297. $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>");
  62298. $ctx1.sendIdx["write:"]=4;
  62299. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62300. $ctx1.sendIdx["write:"]=5;
  62301. $recv(aResponse)._write_("</ul></p></body></html>");
  62302. $recv(aResponse)._end();
  62303. return self;
  62304. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62305. },
  62306. args: ["aResponse"],
  62307. 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",
  62308. referencedClasses: [],
  62309. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62310. }),
  62311. $globals.FileServer);
  62312. $core.addMethod(
  62313. $core.method({
  62314. selector: "respondOKTo:",
  62315. protocol: "request handling",
  62316. fn: function (aResponse){
  62317. var self=this,$self=this;
  62318. return $core.withContext(function($ctx1) {
  62319. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62320. $recv(aResponse)._end();
  62321. return self;
  62322. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62323. },
  62324. args: ["aResponse"],
  62325. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62326. referencedClasses: [],
  62327. messageSends: ["writeHead:options:", "end"]
  62328. }),
  62329. $globals.FileServer);
  62330. $core.addMethod(
  62331. $core.method({
  62332. selector: "respondRedirect:to:",
  62333. protocol: "request handling",
  62334. fn: function (aString,aResponse){
  62335. var self=this,$self=this;
  62336. return $core.withContext(function($ctx1) {
  62337. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62338. $recv(aResponse)._end();
  62339. return self;
  62340. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62341. },
  62342. args: ["aString", "aResponse"],
  62343. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62344. referencedClasses: [],
  62345. messageSends: ["writeHead:options:", "end"]
  62346. }),
  62347. $globals.FileServer);
  62348. $core.addMethod(
  62349. $core.method({
  62350. selector: "start",
  62351. protocol: "starting",
  62352. fn: function (){
  62353. var self=this,$self=this;
  62354. return $core.withContext(function($ctx1) {
  62355. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62356. $self._checkDirectoryLayout();
  62357. $1=$recv($self["@http"])._createServer_((function(request,response){
  62358. return $core.withContext(function($ctx2) {
  62359. return $self._handleRequest_respondTo_(request,response);
  62360. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62361. }));
  62362. $recv($1)._on_do_("error",(function(error){
  62363. return $core.withContext(function($ctx2) {
  62364. $2=console;
  62365. $3="Error starting server: ".__comma(error);
  62366. $ctx2.sendIdx[","]=1;
  62367. return $recv($2)._log_($3);
  62368. $ctx2.sendIdx["log:"]=1;
  62369. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62370. }));
  62371. $ctx1.sendIdx["on:do:"]=1;
  62372. $recv($1)._on_do_("listening",(function(){
  62373. return $core.withContext(function($ctx2) {
  62374. $4=console;
  62375. $8=$self._host();
  62376. $ctx2.sendIdx["host"]=1;
  62377. $7="Starting file server on http://".__comma($8);
  62378. $6=$recv($7).__comma(":");
  62379. $ctx2.sendIdx[","]=3;
  62380. $10=$self._port();
  62381. $ctx2.sendIdx["port"]=1;
  62382. $9=$recv($10)._asString();
  62383. $5=$recv($6).__comma($9);
  62384. $ctx2.sendIdx[","]=2;
  62385. return $recv($4)._log_($5);
  62386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62387. }));
  62388. $recv($1)._listen_host_($self._port(),$self._host());
  62389. return self;
  62390. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  62391. },
  62392. args: [],
  62393. 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.",
  62394. referencedClasses: [],
  62395. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  62396. }),
  62397. $globals.FileServer);
  62398. $core.addMethod(
  62399. $core.method({
  62400. selector: "startOn:",
  62401. protocol: "starting",
  62402. fn: function (aPort){
  62403. var self=this,$self=this;
  62404. return $core.withContext(function($ctx1) {
  62405. $self._port_(aPort);
  62406. $self._start();
  62407. return self;
  62408. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  62409. },
  62410. args: ["aPort"],
  62411. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  62412. referencedClasses: [],
  62413. messageSends: ["port:", "start"]
  62414. }),
  62415. $globals.FileServer);
  62416. $core.addMethod(
  62417. $core.method({
  62418. selector: "username:",
  62419. protocol: "accessing",
  62420. fn: function (aUsername){
  62421. var self=this,$self=this;
  62422. $self["@username"]=aUsername;
  62423. return self;
  62424. },
  62425. args: ["aUsername"],
  62426. source: "username: aUsername\x0a\x09username := aUsername.",
  62427. referencedClasses: [],
  62428. messageSends: []
  62429. }),
  62430. $globals.FileServer);
  62431. $core.addMethod(
  62432. $core.method({
  62433. selector: "validateBasePath",
  62434. protocol: "private",
  62435. fn: function (){
  62436. var self=this,$self=this;
  62437. return $core.withContext(function($ctx1) {
  62438. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  62439. $1=$self["@fs"];
  62440. $2=$self._basePath();
  62441. $ctx1.sendIdx["basePath"]=1;
  62442. $recv($1)._stat_then_($2,(function(err,stat){
  62443. return $core.withContext(function($ctx2) {
  62444. if(($receiver = err) == null || $receiver.a$nil){
  62445. $3=$recv(stat)._isDirectory();
  62446. if(!$core.assert($3)){
  62447. $4=console;
  62448. $7=$self._basePath();
  62449. $ctx2.sendIdx["basePath"]=2;
  62450. $6="Warning: --base-path parameter ".__comma($7);
  62451. $ctx2.sendIdx[","]=2;
  62452. $5=$recv($6).__comma(" is not a directory.");
  62453. $ctx2.sendIdx[","]=1;
  62454. return $recv($4)._warn_($5);
  62455. $ctx2.sendIdx["warn:"]=1;
  62456. }
  62457. } else {
  62458. $8=console;
  62459. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  62460. $ctx2.sendIdx[","]=3;
  62461. return $recv($8)._warn_($9);
  62462. }
  62463. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  62464. }));
  62465. return self;
  62466. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  62467. },
  62468. args: [],
  62469. 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.' ]].",
  62470. referencedClasses: [],
  62471. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  62472. }),
  62473. $globals.FileServer);
  62474. $core.addMethod(
  62475. $core.method({
  62476. selector: "withBasePath:",
  62477. protocol: "private",
  62478. fn: function (aBaseRelativePath){
  62479. var self=this,$self=this;
  62480. return $core.withContext(function($ctx1) {
  62481. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  62482. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  62483. },
  62484. args: ["aBaseRelativePath"],
  62485. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  62486. referencedClasses: [],
  62487. messageSends: ["join:with:", "basePath"]
  62488. }),
  62489. $globals.FileServer);
  62490. $core.addMethod(
  62491. $core.method({
  62492. selector: "writeData:toFileNamed:",
  62493. protocol: "private",
  62494. fn: function (data,aFilename){
  62495. var self=this,$self=this;
  62496. return $core.withContext(function($ctx1) {
  62497. $recv(console)._log_(aFilename);
  62498. return self;
  62499. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  62500. },
  62501. args: ["data", "aFilename"],
  62502. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  62503. referencedClasses: [],
  62504. messageSends: ["log:"]
  62505. }),
  62506. $globals.FileServer);
  62507. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  62508. $core.addMethod(
  62509. $core.method({
  62510. selector: "commandLineSwitches",
  62511. protocol: "accessing",
  62512. fn: function (){
  62513. var self=this,$self=this;
  62514. var switches;
  62515. return $core.withContext(function($ctx1) {
  62516. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  62517. return $core.withContext(function($ctx2) {
  62518. return $recv(each)._selector();
  62519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62520. }));
  62521. $ctx1.sendIdx["collect:"]=1;
  62522. switches=$recv(switches)._select_((function(each){
  62523. return $core.withContext(function($ctx2) {
  62524. return $recv(each)._match_("^[^:]*:$");
  62525. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62526. }));
  62527. switches=$recv(switches)._collect_((function(each){
  62528. return $core.withContext(function($ctx2) {
  62529. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  62530. $ctx2.sendIdx["replace:with:"]=1;
  62531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62532. }));
  62533. return switches;
  62534. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  62535. },
  62536. args: [],
  62537. 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",
  62538. referencedClasses: [],
  62539. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  62540. }),
  62541. $globals.FileServer.a$cls);
  62542. $core.addMethod(
  62543. $core.method({
  62544. selector: "createServerWithArguments:",
  62545. protocol: "initialization",
  62546. fn: function (options){
  62547. var self=this,$self=this;
  62548. var server,popFront,front,optionName,optionValue,switches;
  62549. return $core.withContext(function($ctx1) {
  62550. var $1,$2,$3,$4,$5,$6,$7,$8;
  62551. var $early={};
  62552. try {
  62553. switches=$self._commandLineSwitches();
  62554. server=$self._new();
  62555. $recv(options)._ifEmpty_((function(){
  62556. throw $early=[server];
  62557. }));
  62558. $1=$recv($recv(options)._size())._even();
  62559. if(!$core.assert($1)){
  62560. $recv(console)._log_("Using default parameters.");
  62561. $ctx1.sendIdx["log:"]=1;
  62562. $2=console;
  62563. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  62564. $ctx1.sendIdx[","]=1;
  62565. $recv($2)._log_($3);
  62566. $ctx1.sendIdx["log:"]=2;
  62567. $4=console;
  62568. $5="Use any of the following ones: ".__comma(switches);
  62569. $ctx1.sendIdx[","]=2;
  62570. $recv($4)._log_($5);
  62571. $ctx1.sendIdx["log:"]=3;
  62572. return server;
  62573. }
  62574. popFront=(function(args){
  62575. return $core.withContext(function($ctx2) {
  62576. front=$recv(args)._first();
  62577. front;
  62578. $recv(args)._remove_(front);
  62579. return front;
  62580. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  62581. });
  62582. $recv((function(){
  62583. return $core.withContext(function($ctx2) {
  62584. return $recv(options)._notEmpty();
  62585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  62586. }))._whileTrue_((function(){
  62587. return $core.withContext(function($ctx2) {
  62588. optionName=$recv(popFront)._value_(options);
  62589. $ctx2.sendIdx["value:"]=1;
  62590. optionName;
  62591. optionValue=$recv(popFront)._value_(options);
  62592. optionValue;
  62593. $6=$recv(switches)._includes_(optionName);
  62594. if($core.assert($6)){
  62595. optionName=$self._selectorForCommandLineSwitch_(optionName);
  62596. optionName;
  62597. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  62598. } else {
  62599. $7=console;
  62600. $8=$recv(optionName).__comma(" is not a valid commandline option");
  62601. $ctx2.sendIdx[","]=3;
  62602. $recv($7)._log_($8);
  62603. $ctx2.sendIdx["log:"]=4;
  62604. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  62605. }
  62606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62607. }));
  62608. return server;
  62609. }
  62610. catch(e) {if(e===$early)return e[0]; throw e}
  62611. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  62612. },
  62613. args: ["options"],
  62614. 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.",
  62615. referencedClasses: ["Array"],
  62616. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  62617. }),
  62618. $globals.FileServer.a$cls);
  62619. $core.addMethod(
  62620. $core.method({
  62621. selector: "defaultBasePath",
  62622. protocol: "accessing",
  62623. fn: function (){
  62624. var self=this,$self=this;
  62625. return "./";
  62626. },
  62627. args: [],
  62628. source: "defaultBasePath\x0a\x09^ './'",
  62629. referencedClasses: [],
  62630. messageSends: []
  62631. }),
  62632. $globals.FileServer.a$cls);
  62633. $core.addMethod(
  62634. $core.method({
  62635. selector: "defaultHost",
  62636. protocol: "accessing",
  62637. fn: function (){
  62638. var self=this,$self=this;
  62639. return "127.0.0.1";
  62640. },
  62641. args: [],
  62642. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  62643. referencedClasses: [],
  62644. messageSends: []
  62645. }),
  62646. $globals.FileServer.a$cls);
  62647. $core.addMethod(
  62648. $core.method({
  62649. selector: "defaultMimeTypes",
  62650. protocol: "accessing",
  62651. fn: function (){
  62652. var self=this,$self=this;
  62653. 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"]);
  62654. },
  62655. args: [],
  62656. 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}",
  62657. referencedClasses: [],
  62658. messageSends: []
  62659. }),
  62660. $globals.FileServer.a$cls);
  62661. $core.addMethod(
  62662. $core.method({
  62663. selector: "defaultPort",
  62664. protocol: "accessing",
  62665. fn: function (){
  62666. var self=this,$self=this;
  62667. return (4000);
  62668. },
  62669. args: [],
  62670. source: "defaultPort\x0a\x09^ 4000",
  62671. referencedClasses: [],
  62672. messageSends: []
  62673. }),
  62674. $globals.FileServer.a$cls);
  62675. $core.addMethod(
  62676. $core.method({
  62677. selector: "main",
  62678. protocol: "initialization",
  62679. fn: function (){
  62680. var self=this,$self=this;
  62681. var fileServer,args;
  62682. return $core.withContext(function($ctx1) {
  62683. var $1;
  62684. var $early={};
  62685. try {
  62686. args=$recv(process)._argv();
  62687. $recv(args)._removeFrom_to_((1),(3));
  62688. $recv(args)._detect_ifNone_((function(each){
  62689. return $core.withContext(function($ctx2) {
  62690. $1=$recv(each).__eq("--help");
  62691. if($core.assert($1)){
  62692. return $recv($globals.FileServer)._printHelp();
  62693. }
  62694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62695. }),(function(){
  62696. return $core.withContext(function($ctx2) {
  62697. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  62698. fileServer;
  62699. throw $early=[$recv(fileServer)._start()];
  62700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62701. }));
  62702. return self;
  62703. }
  62704. catch(e) {if(e===$early)return e[0]; throw e}
  62705. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  62706. },
  62707. args: [],
  62708. 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]",
  62709. referencedClasses: ["FileServer"],
  62710. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  62711. }),
  62712. $globals.FileServer.a$cls);
  62713. $core.addMethod(
  62714. $core.method({
  62715. selector: "mimeTypeFor:",
  62716. protocol: "accessing",
  62717. fn: function (aString){
  62718. var self=this,$self=this;
  62719. return $core.withContext(function($ctx1) {
  62720. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  62721. return "text/plain";
  62722. }));
  62723. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  62724. },
  62725. args: ["aString"],
  62726. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  62727. referencedClasses: [],
  62728. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  62729. }),
  62730. $globals.FileServer.a$cls);
  62731. $core.addMethod(
  62732. $core.method({
  62733. selector: "mimeTypes",
  62734. protocol: "accessing",
  62735. fn: function (){
  62736. var self=this,$self=this;
  62737. return $core.withContext(function($ctx1) {
  62738. var $1,$receiver;
  62739. $1=$self["@mimeTypes"];
  62740. if(($receiver = $1) == null || $receiver.a$nil){
  62741. $self["@mimeTypes"]=$self._defaultMimeTypes();
  62742. return $self["@mimeTypes"];
  62743. } else {
  62744. return $1;
  62745. }
  62746. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  62747. },
  62748. args: [],
  62749. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  62750. referencedClasses: [],
  62751. messageSends: ["ifNil:", "defaultMimeTypes"]
  62752. }),
  62753. $globals.FileServer.a$cls);
  62754. $core.addMethod(
  62755. $core.method({
  62756. selector: "printHelp",
  62757. protocol: "accessing",
  62758. fn: function (){
  62759. var self=this,$self=this;
  62760. return $core.withContext(function($ctx1) {
  62761. $recv(console)._log_("Available commandline options are:");
  62762. $ctx1.sendIdx["log:"]=1;
  62763. $recv(console)._log_("--help");
  62764. $ctx1.sendIdx["log:"]=2;
  62765. $recv($self._commandLineSwitches())._do_((function(each){
  62766. return $core.withContext(function($ctx2) {
  62767. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  62768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62769. }));
  62770. return self;
  62771. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  62772. },
  62773. args: [],
  62774. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  62775. referencedClasses: [],
  62776. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  62777. }),
  62778. $globals.FileServer.a$cls);
  62779. $core.addMethod(
  62780. $core.method({
  62781. selector: "selectorForCommandLineSwitch:",
  62782. protocol: "accessing",
  62783. fn: function (aSwitch){
  62784. var self=this,$self=this;
  62785. return $core.withContext(function($ctx1) {
  62786. var $1;
  62787. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  62788. return $core.withContext(function($ctx2) {
  62789. return $recv($recv(each)._second())._asUppercase();
  62790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62791. }));
  62792. $ctx1.sendIdx["replace:with:"]=1;
  62793. return $recv($1).__comma(":");
  62794. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  62795. },
  62796. args: ["aSwitch"],
  62797. 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 ]), ':'",
  62798. referencedClasses: [],
  62799. messageSends: [",", "replace:with:", "asUppercase", "second"]
  62800. }),
  62801. $globals.FileServer.a$cls);
  62802. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  62803. $core.addMethod(
  62804. $core.method({
  62805. selector: "bowerInstallThenDo:",
  62806. protocol: "action",
  62807. fn: function (aBlock){
  62808. var self=this,$self=this;
  62809. var child;
  62810. return $core.withContext(function($ctx1) {
  62811. var $1,$3,$2;
  62812. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  62813. $1=child;
  62814. $recv($1)._on_do_("error",aBlock);
  62815. $ctx1.sendIdx["on:do:"]=1;
  62816. $recv($1)._on_do_("close",(function(code){
  62817. return $core.withContext(function($ctx2) {
  62818. $3=$recv(code).__eq((0));
  62819. if($core.assert($3)){
  62820. $2=nil;
  62821. } else {
  62822. $2=code;
  62823. }
  62824. return $recv(aBlock)._value_($2);
  62825. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  62826. }));
  62827. return self;
  62828. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  62829. },
  62830. args: ["aBlock"],
  62831. 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 ]) ]",
  62832. referencedClasses: [],
  62833. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  62834. }),
  62835. $globals.Initer);
  62836. $core.addMethod(
  62837. $core.method({
  62838. selector: "finishMessage",
  62839. protocol: "action",
  62840. fn: function (){
  62841. var self=this,$self=this;
  62842. return $core.withContext(function($ctx1) {
  62843. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  62844. $recv((function(){
  62845. }))._valueWithTimeout_((600));
  62846. return self;
  62847. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  62848. },
  62849. args: [],
  62850. 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",
  62851. referencedClasses: ["String"],
  62852. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  62853. }),
  62854. $globals.Initer);
  62855. $core.addMethod(
  62856. $core.method({
  62857. selector: "gruntInitThenDo:",
  62858. protocol: "action",
  62859. fn: function (aBlock){
  62860. var self=this,$self=this;
  62861. var child,sanitizedTemplatePath;
  62862. return $core.withContext(function($ctx1) {
  62863. var $1,$3,$2;
  62864. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  62865. $ctx1.sendIdx["replace:with:"]=1;
  62866. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  62867. $1=child;
  62868. $recv($1)._on_do_("error",aBlock);
  62869. $ctx1.sendIdx["on:do:"]=1;
  62870. $recv($1)._on_do_("close",(function(code){
  62871. return $core.withContext(function($ctx2) {
  62872. $3=$recv(code).__eq((0));
  62873. if($core.assert($3)){
  62874. $2=nil;
  62875. } else {
  62876. $2=code;
  62877. }
  62878. return $recv(aBlock)._value_($2);
  62879. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  62880. }));
  62881. return self;
  62882. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  62883. },
  62884. args: ["aBlock"],
  62885. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  62886. referencedClasses: [],
  62887. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  62888. }),
  62889. $globals.Initer);
  62890. $core.addMethod(
  62891. $core.method({
  62892. selector: "gruntThenDo:",
  62893. protocol: "action",
  62894. fn: function (aBlock){
  62895. var self=this,$self=this;
  62896. var child;
  62897. return $core.withContext(function($ctx1) {
  62898. var $1,$3,$2;
  62899. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  62900. $1=child;
  62901. $recv($1)._on_do_("error",aBlock);
  62902. $ctx1.sendIdx["on:do:"]=1;
  62903. $recv($1)._on_do_("close",(function(code){
  62904. return $core.withContext(function($ctx2) {
  62905. $3=$recv(code).__eq((0));
  62906. if($core.assert($3)){
  62907. $2=nil;
  62908. } else {
  62909. $2=code;
  62910. }
  62911. return $recv(aBlock)._value_($2);
  62912. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  62913. }));
  62914. return self;
  62915. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  62916. },
  62917. args: ["aBlock"],
  62918. 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 ]) ]",
  62919. referencedClasses: [],
  62920. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  62921. }),
  62922. $globals.Initer);
  62923. $core.addMethod(
  62924. $core.method({
  62925. selector: "initialize",
  62926. protocol: "initialization",
  62927. fn: function (){
  62928. var self=this,$self=this;
  62929. return $core.withContext(function($ctx1) {
  62930. (
  62931. $ctx1.supercall = true,
  62932. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62933. $ctx1.supercall = false;
  62934. $self["@childProcess"]=$recv(require)._value_("child_process");
  62935. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  62936. return self;
  62937. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  62938. },
  62939. args: [],
  62940. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  62941. referencedClasses: [],
  62942. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  62943. }),
  62944. $globals.Initer);
  62945. $core.addMethod(
  62946. $core.method({
  62947. selector: "npmInstallThenDo:",
  62948. protocol: "action",
  62949. fn: function (aBlock){
  62950. var self=this,$self=this;
  62951. var child;
  62952. return $core.withContext(function($ctx1) {
  62953. var $1;
  62954. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  62955. $1=$recv(child)._stdout();
  62956. $ctx1.sendIdx["stdout"]=1;
  62957. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  62958. return self;
  62959. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  62960. },
  62961. args: ["aBlock"],
  62962. 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 }",
  62963. referencedClasses: [],
  62964. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  62965. }),
  62966. $globals.Initer);
  62967. $core.addMethod(
  62968. $core.method({
  62969. selector: "npmScriptForModule:named:",
  62970. protocol: "npm",
  62971. fn: function (aString,anotherString){
  62972. var self=this,$self=this;
  62973. var modulePath,packageJson,binSection,scriptPath;
  62974. return $core.withContext(function($ctx1) {
  62975. var $1,$3,$4,$2,$5;
  62976. $1=$self["@path"];
  62977. $3=$recv($globals.JSObjectProxy)._on_(require);
  62978. $4=$recv(aString).__comma("/package.json");
  62979. $ctx1.sendIdx[","]=1;
  62980. $2=$recv($3)._resolve_($4);
  62981. modulePath=$recv($1)._dirname_($2);
  62982. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  62983. binSection=$recv(packageJson)._at_("bin");
  62984. $ctx1.sendIdx["at:"]=1;
  62985. $5=$recv(binSection)._isString();
  62986. if($core.assert($5)){
  62987. scriptPath=binSection;
  62988. } else {
  62989. scriptPath=$recv(binSection)._at_(anotherString);
  62990. }
  62991. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  62992. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  62993. },
  62994. args: ["aString", "anotherString"],
  62995. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  62996. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  62997. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  62998. }),
  62999. $globals.Initer);
  63000. $core.addMethod(
  63001. $core.method({
  63002. selector: "start",
  63003. protocol: "action",
  63004. fn: function (){
  63005. var self=this,$self=this;
  63006. return $core.withContext(function($ctx1) {
  63007. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63008. $self._gruntInitThenDo_((function(error){
  63009. return $core.withContext(function($ctx2) {
  63010. if(($receiver = error) == null || $receiver.a$nil){
  63011. return $self._bowerInstallThenDo_((function(error2){
  63012. return $core.withContext(function($ctx3) {
  63013. if(($receiver = error2) == null || $receiver.a$nil){
  63014. return $self._npmInstallThenDo_((function(error3){
  63015. return $core.withContext(function($ctx4) {
  63016. if(($receiver = error3) == null || $receiver.a$nil){
  63017. return $self._gruntThenDo_((function(error4){
  63018. return $core.withContext(function($ctx5) {
  63019. if(($receiver = error4) == null || $receiver.a$nil){
  63020. $self._finishMessage();
  63021. return $recv(process)._exit();
  63022. } else {
  63023. $7=console;
  63024. $recv($7)._log_("grunt exec error:");
  63025. $ctx5.sendIdx["log:"]=7;
  63026. $recv($7)._log_(error4);
  63027. return $recv(process)._exit_((104));
  63028. }
  63029. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63030. }));
  63031. } else {
  63032. $5=console;
  63033. $recv($5)._log_("npm install exec error:");
  63034. $ctx4.sendIdx["log:"]=5;
  63035. $6=$recv($5)._log_(error3);
  63036. $ctx4.sendIdx["log:"]=6;
  63037. $6;
  63038. return $recv(process)._exit_((103));
  63039. $ctx4.sendIdx["exit:"]=3;
  63040. }
  63041. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63042. }));
  63043. } else {
  63044. $3=console;
  63045. $recv($3)._log_("bower install exec error:");
  63046. $ctx3.sendIdx["log:"]=3;
  63047. $4=$recv($3)._log_(error2);
  63048. $ctx3.sendIdx["log:"]=4;
  63049. $4;
  63050. return $recv(process)._exit_((102));
  63051. $ctx3.sendIdx["exit:"]=2;
  63052. }
  63053. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63054. }));
  63055. } else {
  63056. $1=console;
  63057. $recv($1)._log_("grunt-init exec error:");
  63058. $ctx2.sendIdx["log:"]=1;
  63059. $2=$recv($1)._log_(error);
  63060. $ctx2.sendIdx["log:"]=2;
  63061. $2;
  63062. return $recv(process)._exit_((101));
  63063. $ctx2.sendIdx["exit:"]=1;
  63064. }
  63065. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63066. }));
  63067. return self;
  63068. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63069. },
  63070. args: [],
  63071. 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 ]]]]]]]]",
  63072. referencedClasses: [],
  63073. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63074. }),
  63075. $globals.Initer);
  63076. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63077. $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.";
  63078. $core.addMethod(
  63079. $core.method({
  63080. selector: "addVariableNamed:to:",
  63081. protocol: "private",
  63082. fn: function (aString,anObject){
  63083. var self=this,$self=this;
  63084. var newClass,newObject;
  63085. return $core.withContext(function($ctx1) {
  63086. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63087. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63088. newObject=$recv(newClass)._new();
  63089. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63090. return newObject;
  63091. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63092. },
  63093. args: ["aString", "anObject"],
  63094. 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",
  63095. referencedClasses: [],
  63096. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63097. }),
  63098. $globals.Repl);
  63099. $core.addMethod(
  63100. $core.method({
  63101. selector: "assignNewVariable:do:",
  63102. protocol: "private",
  63103. fn: function (buffer,aBlock){
  63104. var self=this,$self=this;
  63105. return $core.withContext(function($ctx1) {
  63106. var $2,$3,$1,$receiver;
  63107. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63108. var varName,value;
  63109. return $core.withContext(function($ctx2) {
  63110. if(($receiver = name) == null || $receiver.a$nil){
  63111. varName=$self._nextResultName();
  63112. } else {
  63113. varName=name;
  63114. }
  63115. varName;
  63116. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63117. $self["@session"];
  63118. $recv((function(){
  63119. return $core.withContext(function($ctx3) {
  63120. $2=$recv(varName).__comma(" := ");
  63121. if(($receiver = expr) == null || $receiver.a$nil){
  63122. $3=buffer;
  63123. } else {
  63124. $3=expr;
  63125. }
  63126. $1=$recv($2).__comma($3);
  63127. $ctx3.sendIdx[","]=1;
  63128. value=$self._eval_on_($1,$self["@session"]);
  63129. return value;
  63130. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63131. }))._on_do_($globals.Error,(function(e){
  63132. return $core.withContext(function($ctx3) {
  63133. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63134. value=nil;
  63135. return value;
  63136. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63137. }));
  63138. return $recv(aBlock)._value_value_(varName,value);
  63139. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63140. }));
  63141. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63142. },
  63143. args: ["buffer", "aBlock"],
  63144. 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]",
  63145. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63146. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63147. }),
  63148. $globals.Repl);
  63149. $core.addMethod(
  63150. $core.method({
  63151. selector: "clearScreen",
  63152. protocol: "actions",
  63153. fn: function (){
  63154. var self=this,$self=this;
  63155. var esc,cls;
  63156. return $core.withContext(function($ctx1) {
  63157. var $1;
  63158. esc=$recv($globals.String)._fromCharCode_((27));
  63159. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63160. $ctx1.sendIdx[","]=2;
  63161. cls=$recv($1).__comma("[0;0f");
  63162. $ctx1.sendIdx[","]=1;
  63163. $recv($recv(process)._stdout())._write_(cls);
  63164. $recv($self["@interface"])._prompt();
  63165. return self;
  63166. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63167. },
  63168. args: [],
  63169. 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",
  63170. referencedClasses: ["String"],
  63171. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63172. }),
  63173. $globals.Repl);
  63174. $core.addMethod(
  63175. $core.method({
  63176. selector: "close",
  63177. protocol: "actions",
  63178. fn: function (){
  63179. var self=this,$self=this;
  63180. return $core.withContext(function($ctx1) {
  63181. $recv($recv(process)._stdin())._destroy();
  63182. return self;
  63183. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63184. },
  63185. args: [],
  63186. source: "close\x0a\x09process stdin destroy",
  63187. referencedClasses: [],
  63188. messageSends: ["destroy", "stdin"]
  63189. }),
  63190. $globals.Repl);
  63191. $core.addMethod(
  63192. $core.method({
  63193. selector: "commands",
  63194. protocol: "accessing",
  63195. fn: function (){
  63196. var self=this,$self=this;
  63197. return $self["@commands"];
  63198. },
  63199. args: [],
  63200. source: "commands\x0a\x09^ commands",
  63201. referencedClasses: [],
  63202. messageSends: []
  63203. }),
  63204. $globals.Repl);
  63205. $core.addMethod(
  63206. $core.method({
  63207. selector: "createInterface",
  63208. protocol: "actions",
  63209. fn: function (){
  63210. var self=this,$self=this;
  63211. return $core.withContext(function($ctx1) {
  63212. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63213. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63214. return $core.withContext(function($ctx2) {
  63215. return $self._processLine_(buffer);
  63216. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63217. }));
  63218. $ctx1.sendIdx["on:do:"]=1;
  63219. $recv($self["@interface"])._on_do_("close",(function(){
  63220. return $core.withContext(function($ctx2) {
  63221. return $self._close();
  63222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63223. }));
  63224. $self._printWelcome();
  63225. $self._setupHotkeys();
  63226. $self._setPrompt();
  63227. $recv($self["@interface"])._prompt();
  63228. return self;
  63229. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63230. },
  63231. args: [],
  63232. 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",
  63233. referencedClasses: [],
  63234. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63235. }),
  63236. $globals.Repl);
  63237. $core.addMethod(
  63238. $core.method({
  63239. selector: "encapsulateVariable:withValue:in:",
  63240. protocol: "private",
  63241. fn: function (aString,anObject,aClass){
  63242. var self=this,$self=this;
  63243. var compiler;
  63244. return $core.withContext(function($ctx1) {
  63245. var $1,$4,$3,$2,$5,$6;
  63246. compiler=$recv($globals.Compiler)._new();
  63247. $1=compiler;
  63248. $4=$recv(aString).__comma(": anObject ^ ");
  63249. $ctx1.sendIdx[","]=3;
  63250. $3=$recv($4).__comma(aString);
  63251. $ctx1.sendIdx[","]=2;
  63252. $2=$recv($3).__comma(" := anObject");
  63253. $ctx1.sendIdx[","]=1;
  63254. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63255. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63256. $5=compiler;
  63257. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63258. $ctx1.sendIdx[","]=4;
  63259. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63260. return self;
  63261. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63262. },
  63263. args: ["aString", "anObject", "aClass"],
  63264. 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'.",
  63265. referencedClasses: ["Compiler"],
  63266. messageSends: ["new", "install:forClass:protocol:", ","]
  63267. }),
  63268. $globals.Repl);
  63269. $core.addMethod(
  63270. $core.method({
  63271. selector: "eval:",
  63272. protocol: "actions",
  63273. fn: function (buffer){
  63274. var self=this,$self=this;
  63275. return $core.withContext(function($ctx1) {
  63276. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63277. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63278. },
  63279. args: ["buffer"],
  63280. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63281. referencedClasses: ["DoIt"],
  63282. messageSends: ["eval:on:", "new"]
  63283. }),
  63284. $globals.Repl);
  63285. $core.addMethod(
  63286. $core.method({
  63287. selector: "eval:on:",
  63288. protocol: "actions",
  63289. fn: function (buffer,anObject){
  63290. var self=this,$self=this;
  63291. var result;
  63292. return $core.withContext(function($ctx1) {
  63293. var $1;
  63294. $recv(buffer)._ifNotEmpty_((function(){
  63295. return $core.withContext(function($ctx2) {
  63296. return $recv((function(){
  63297. return $core.withContext(function($ctx3) {
  63298. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63299. return result;
  63300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63301. }))._tryCatch_((function(e){
  63302. return $core.withContext(function($ctx3) {
  63303. $1=$recv(e)._isSmalltalkError();
  63304. if($core.assert($1)){
  63305. return $recv(e)._resignal();
  63306. } else {
  63307. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63308. }
  63309. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63310. }));
  63311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63312. }));
  63313. return result;
  63314. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63315. },
  63316. args: ["buffer", "anObject"],
  63317. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63318. referencedClasses: ["Compiler"],
  63319. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  63320. }),
  63321. $globals.Repl);
  63322. $core.addMethod(
  63323. $core.method({
  63324. selector: "executeCommand:",
  63325. protocol: "private",
  63326. fn: function (aString){
  63327. var self=this,$self=this;
  63328. return $core.withContext(function($ctx1) {
  63329. var $1;
  63330. var $early={};
  63331. try {
  63332. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63333. return $core.withContext(function($ctx2) {
  63334. $1=$recv(names)._includes_(aString);
  63335. if($core.assert($1)){
  63336. $recv(cmd)._value();
  63337. throw $early=[true];
  63338. }
  63339. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63340. }));
  63341. return false;
  63342. }
  63343. catch(e) {if(e===$early)return e[0]; throw e}
  63344. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63345. },
  63346. args: ["aString"],
  63347. 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",
  63348. referencedClasses: [],
  63349. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63350. }),
  63351. $globals.Repl);
  63352. $core.addMethod(
  63353. $core.method({
  63354. selector: "initialize",
  63355. protocol: "initialization",
  63356. fn: function (){
  63357. var self=this,$self=this;
  63358. return $core.withContext(function($ctx1) {
  63359. (
  63360. $ctx1.supercall = true,
  63361. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63362. $ctx1.supercall = false;
  63363. $self["@session"]=$recv($globals.DoIt)._new();
  63364. $self["@readline"]=$recv(require)._value_("readline");
  63365. $ctx1.sendIdx["value:"]=1;
  63366. $self["@util"]=$recv(require)._value_("util");
  63367. $self._setupCommands();
  63368. return self;
  63369. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63370. },
  63371. args: [],
  63372. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63373. referencedClasses: ["DoIt"],
  63374. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63375. }),
  63376. $globals.Repl);
  63377. $core.addMethod(
  63378. $core.method({
  63379. selector: "instanceVariableNamesFor:",
  63380. protocol: "private",
  63381. fn: function (aClass){
  63382. var self=this,$self=this;
  63383. return $core.withContext(function($ctx1) {
  63384. var $1,$2,$receiver;
  63385. $1=$recv(aClass)._superclass();
  63386. $ctx1.sendIdx["superclass"]=1;
  63387. if(($receiver = $1) == null || $receiver.a$nil){
  63388. return $recv(aClass)._instanceVariableNames();
  63389. } else {
  63390. $2=$recv(aClass)._instanceVariableNames();
  63391. $ctx1.sendIdx["instanceVariableNames"]=1;
  63392. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63393. }
  63394. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63395. },
  63396. args: ["aClass"],
  63397. 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]",
  63398. referencedClasses: [],
  63399. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63400. }),
  63401. $globals.Repl);
  63402. $core.addMethod(
  63403. $core.method({
  63404. selector: "isIdentifier:",
  63405. protocol: "private",
  63406. fn: function (aString){
  63407. var self=this,$self=this;
  63408. return $core.withContext(function($ctx1) {
  63409. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63410. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63411. },
  63412. args: ["aString"],
  63413. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63414. referencedClasses: [],
  63415. messageSends: ["match:", "asRegexp"]
  63416. }),
  63417. $globals.Repl);
  63418. $core.addMethod(
  63419. $core.method({
  63420. selector: "isVariableDefined:",
  63421. protocol: "private",
  63422. fn: function (aString){
  63423. var self=this,$self=this;
  63424. return $core.withContext(function($ctx1) {
  63425. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63426. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63427. },
  63428. args: ["aString"],
  63429. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63430. referencedClasses: [],
  63431. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63432. }),
  63433. $globals.Repl);
  63434. $core.addMethod(
  63435. $core.method({
  63436. selector: "nextResultName",
  63437. protocol: "private",
  63438. fn: function (){
  63439. var self=this,$self=this;
  63440. return $core.withContext(function($ctx1) {
  63441. var $1,$receiver;
  63442. $1=$self["@resultCount"];
  63443. if(($receiver = $1) == null || $receiver.a$nil){
  63444. $self["@resultCount"]=(1);
  63445. } else {
  63446. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63447. }
  63448. return "res".__comma($recv($self["@resultCount"])._asString());
  63449. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63450. },
  63451. args: [],
  63452. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  63453. referencedClasses: [],
  63454. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  63455. }),
  63456. $globals.Repl);
  63457. $core.addMethod(
  63458. $core.method({
  63459. selector: "onKeyPress:",
  63460. protocol: "private",
  63461. fn: function (key){
  63462. var self=this,$self=this;
  63463. return $core.withContext(function($ctx1) {
  63464. var $1;
  63465. $1=$recv($recv(key)._ctrl())._and_((function(){
  63466. return $core.withContext(function($ctx2) {
  63467. return $recv($recv(key)._name()).__eq("l");
  63468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63469. }));
  63470. if($core.assert($1)){
  63471. $self._clearScreen();
  63472. }
  63473. return self;
  63474. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  63475. },
  63476. args: ["key"],
  63477. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  63478. referencedClasses: [],
  63479. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  63480. }),
  63481. $globals.Repl);
  63482. $core.addMethod(
  63483. $core.method({
  63484. selector: "parseAssignment:do:",
  63485. protocol: "private",
  63486. fn: function (aString,aBlock){
  63487. var self=this,$self=this;
  63488. var assignment;
  63489. return $core.withContext(function($ctx1) {
  63490. var $2,$1;
  63491. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  63492. return $core.withContext(function($ctx2) {
  63493. return $recv(s)._trimBoth();
  63494. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  63495. }));
  63496. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  63497. return $core.withContext(function($ctx2) {
  63498. $2=$recv(assignment)._first();
  63499. $ctx2.sendIdx["first"]=1;
  63500. return $self._isIdentifier_($2);
  63501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63502. }));
  63503. if($core.assert($1)){
  63504. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  63505. $ctx1.sendIdx["value:value:"]=1;
  63506. } else {
  63507. return $recv(aBlock)._value_value_(nil,nil);
  63508. }
  63509. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  63510. },
  63511. args: ["aString", "aBlock"],
  63512. 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 ]",
  63513. referencedClasses: [],
  63514. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  63515. }),
  63516. $globals.Repl);
  63517. $core.addMethod(
  63518. $core.method({
  63519. selector: "presentResultNamed:withValue:",
  63520. protocol: "private",
  63521. fn: function (varName,value){
  63522. var self=this,$self=this;
  63523. return $core.withContext(function($ctx1) {
  63524. var $3,$2,$1;
  63525. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  63526. $ctx1.sendIdx[","]=3;
  63527. $2=$recv($3).__comma(" = ");
  63528. $ctx1.sendIdx[","]=2;
  63529. $1=$recv($2).__comma($recv(value)._asString());
  63530. $ctx1.sendIdx[","]=1;
  63531. $recv($globals.Transcript)._show_($1);
  63532. $recv($globals.Transcript)._cr();
  63533. $recv($self["@interface"])._prompt();
  63534. return self;
  63535. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  63536. },
  63537. args: ["varName", "value"],
  63538. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  63539. referencedClasses: ["Transcript"],
  63540. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  63541. }),
  63542. $globals.Repl);
  63543. $core.addMethod(
  63544. $core.method({
  63545. selector: "printWelcome",
  63546. protocol: "actions",
  63547. fn: function (){
  63548. var self=this,$self=this;
  63549. return $core.withContext(function($ctx1) {
  63550. $recv($globals.Transcript)._show_("Type :q to exit.");
  63551. $recv($globals.Transcript)._cr();
  63552. return self;
  63553. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  63554. },
  63555. args: [],
  63556. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  63557. referencedClasses: ["Transcript"],
  63558. messageSends: ["show:", "cr"]
  63559. }),
  63560. $globals.Repl);
  63561. $core.addMethod(
  63562. $core.method({
  63563. selector: "processLine:",
  63564. protocol: "private",
  63565. fn: function (buffer){
  63566. var self=this,$self=this;
  63567. var show;
  63568. return $core.withContext(function($ctx1) {
  63569. var $1,$2;
  63570. show=(function(varName,value){
  63571. return $core.withContext(function($ctx2) {
  63572. return $self._presentResultNamed_withValue_(varName,value);
  63573. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  63574. });
  63575. $1=$self._executeCommand_(buffer);
  63576. if(!$core.assert($1)){
  63577. $2=$self._isVariableDefined_(buffer);
  63578. if($core.assert($2)){
  63579. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  63580. } else {
  63581. $self._assignNewVariable_do_(buffer,show);
  63582. }
  63583. }
  63584. return self;
  63585. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  63586. },
  63587. args: ["buffer"],
  63588. 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]]",
  63589. referencedClasses: [],
  63590. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  63591. }),
  63592. $globals.Repl);
  63593. $core.addMethod(
  63594. $core.method({
  63595. selector: "prompt",
  63596. protocol: "accessing",
  63597. fn: function (){
  63598. var self=this,$self=this;
  63599. return "amber >> ";
  63600. },
  63601. args: [],
  63602. source: "prompt\x0a\x09^ 'amber >> '",
  63603. referencedClasses: [],
  63604. messageSends: []
  63605. }),
  63606. $globals.Repl);
  63607. $core.addMethod(
  63608. $core.method({
  63609. selector: "setPreviousVariablesFor:from:",
  63610. protocol: "private",
  63611. fn: function (newObject,oldObject){
  63612. var self=this,$self=this;
  63613. return $core.withContext(function($ctx1) {
  63614. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  63615. return $core.withContext(function($ctx2) {
  63616. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  63617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63618. }));
  63619. return self;
  63620. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  63621. },
  63622. args: ["newObject", "oldObject"],
  63623. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  63624. referencedClasses: [],
  63625. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  63626. }),
  63627. $globals.Repl);
  63628. $core.addMethod(
  63629. $core.method({
  63630. selector: "setPrompt",
  63631. protocol: "actions",
  63632. fn: function (){
  63633. var self=this,$self=this;
  63634. return $core.withContext(function($ctx1) {
  63635. $recv($self["@interface"])._setPrompt_($self._prompt());
  63636. return self;
  63637. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  63638. },
  63639. args: [],
  63640. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  63641. referencedClasses: [],
  63642. messageSends: ["setPrompt:", "prompt"]
  63643. }),
  63644. $globals.Repl);
  63645. $core.addMethod(
  63646. $core.method({
  63647. selector: "setupCommands",
  63648. protocol: "initialization",
  63649. fn: function (){
  63650. var self=this,$self=this;
  63651. return $core.withContext(function($ctx1) {
  63652. var $2,$1;
  63653. $2=$recv([":q"]).__minus_gt((function(){
  63654. return $core.withContext(function($ctx2) {
  63655. return $recv(process)._exit();
  63656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63657. }));
  63658. $ctx1.sendIdx["->"]=1;
  63659. $1=[$2,$recv([""]).__minus_gt((function(){
  63660. return $core.withContext(function($ctx2) {
  63661. return $recv($self["@interface"])._prompt();
  63662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63663. }))];
  63664. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  63665. return self;
  63666. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  63667. },
  63668. args: [],
  63669. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  63670. referencedClasses: ["Dictionary"],
  63671. messageSends: ["from:", "->", "exit", "prompt"]
  63672. }),
  63673. $globals.Repl);
  63674. $core.addMethod(
  63675. $core.method({
  63676. selector: "setupHotkeys",
  63677. protocol: "initialization",
  63678. fn: function (){
  63679. var self=this,$self=this;
  63680. return $core.withContext(function($ctx1) {
  63681. var $receiver;
  63682. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  63683. return $core.withContext(function($ctx2) {
  63684. if(($receiver = key) == null || $receiver.a$nil){
  63685. return key;
  63686. } else {
  63687. return $self._onKeyPress_(key);
  63688. }
  63689. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  63690. }));
  63691. return self;
  63692. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  63693. },
  63694. args: [],
  63695. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  63696. referencedClasses: [],
  63697. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  63698. }),
  63699. $globals.Repl);
  63700. $core.addMethod(
  63701. $core.method({
  63702. selector: "subclass:withVariable:",
  63703. protocol: "private",
  63704. fn: function (aClass,varName){
  63705. var self=this,$self=this;
  63706. return $core.withContext(function($ctx1) {
  63707. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  63708. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  63709. },
  63710. args: ["aClass", "varName"],
  63711. 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'",
  63712. referencedClasses: ["ClassBuilder"],
  63713. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  63714. }),
  63715. $globals.Repl);
  63716. $core.addMethod(
  63717. $core.method({
  63718. selector: "subclassNameFor:",
  63719. protocol: "private",
  63720. fn: function (aClass){
  63721. var self=this,$self=this;
  63722. return $core.withContext(function($ctx1) {
  63723. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  63724. $2=$recv(aClass)._name();
  63725. $ctx1.sendIdx["name"]=1;
  63726. $1=$recv($2)._matchesOf_("\x5cd+$");
  63727. $ctx1.sendIdx["matchesOf:"]=1;
  63728. if(($receiver = $1) == null || $receiver.a$nil){
  63729. return $recv($recv(aClass)._name()).__comma("2");
  63730. } else {
  63731. var counter;
  63732. $6=$recv(aClass)._name();
  63733. $ctx1.sendIdx["name"]=2;
  63734. $5=$recv($6)._matchesOf_("\x5cd+$");
  63735. $4=$recv($5)._first();
  63736. $3=$recv($4)._asNumber();
  63737. counter=$recv($3).__plus((1));
  63738. counter;
  63739. $7=$recv(aClass)._name();
  63740. $ctx1.sendIdx["name"]=3;
  63741. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  63742. }
  63743. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  63744. },
  63745. args: ["aClass"],
  63746. 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'].",
  63747. referencedClasses: [],
  63748. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  63749. }),
  63750. $globals.Repl);
  63751. $core.addMethod(
  63752. $core.method({
  63753. selector: "main",
  63754. protocol: "initialization",
  63755. fn: function (){
  63756. var self=this,$self=this;
  63757. return $core.withContext(function($ctx1) {
  63758. $recv($self._new())._createInterface();
  63759. return self;
  63760. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  63761. },
  63762. args: [],
  63763. source: "main\x0a\x09self new createInterface",
  63764. referencedClasses: [],
  63765. messageSends: ["createInterface", "new"]
  63766. }),
  63767. $globals.Repl.a$cls);
  63768. });
  63769. (function () {
  63770. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  63771. amber.initialize().then(function () {
  63772. amber.globals.AmberCli._main();
  63773. });
  63774. });
  63775. }());
  63776. require(["app"]);
  63777. });
  63778. define.require('__wrap__');
  63779. }((function amdefine(module, requireFn) {
  63780. 'use strict';
  63781. var defineCache = {},
  63782. loaderCache = {},
  63783. alreadyCalled = false,
  63784. path = require('path'),
  63785. makeRequire, stringRequire;
  63786. /**
  63787. * Trims the . and .. from an array of path segments.
  63788. * It will keep a leading path segment if a .. will become
  63789. * the first path segment, to help with module name lookups,
  63790. * which act like paths, but can be remapped. But the end result,
  63791. * all paths that use this function should look normalized.
  63792. * NOTE: this method MODIFIES the input array.
  63793. * @param {Array} ary the array of path segments.
  63794. */
  63795. function trimDots(ary) {
  63796. var i, part;
  63797. for (i = 0; ary[i]; i+= 1) {
  63798. part = ary[i];
  63799. if (part === '.') {
  63800. ary.splice(i, 1);
  63801. i -= 1;
  63802. } else if (part === '..') {
  63803. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  63804. //End of the line. Keep at least one non-dot
  63805. //path segment at the front so it can be mapped
  63806. //correctly to disk. Otherwise, there is likely
  63807. //no path mapping for a path starting with '..'.
  63808. //This can still fail, but catches the most reasonable
  63809. //uses of ..
  63810. break;
  63811. } else if (i > 0) {
  63812. ary.splice(i - 1, 2);
  63813. i -= 2;
  63814. }
  63815. }
  63816. }
  63817. }
  63818. function normalize(name, baseName) {
  63819. var baseParts;
  63820. //Adjust any relative paths.
  63821. if (name && name.charAt(0) === '.') {
  63822. //If have a base name, try to normalize against it,
  63823. //otherwise, assume it is a top-level require that will
  63824. //be relative to baseUrl in the end.
  63825. if (baseName) {
  63826. baseParts = baseName.split('/');
  63827. baseParts = baseParts.slice(0, baseParts.length - 1);
  63828. baseParts = baseParts.concat(name.split('/'));
  63829. trimDots(baseParts);
  63830. name = baseParts.join('/');
  63831. }
  63832. }
  63833. return name;
  63834. }
  63835. /**
  63836. * Create the normalize() function passed to a loader plugin's
  63837. * normalize method.
  63838. */
  63839. function makeNormalize(relName) {
  63840. return function (name) {
  63841. return normalize(name, relName);
  63842. };
  63843. }
  63844. function makeLoad(id) {
  63845. function load(value) {
  63846. loaderCache[id] = value;
  63847. }
  63848. load.fromText = function (id, text) {
  63849. //This one is difficult because the text can/probably uses
  63850. //define, and any relative paths and requires should be relative
  63851. //to that id was it would be found on disk. But this would require
  63852. //bootstrapping a module/require fairly deeply from node core.
  63853. //Not sure how best to go about that yet.
  63854. throw new Error('amdefine does not implement load.fromText');
  63855. };
  63856. return load;
  63857. }
  63858. makeRequire = function (systemRequire, exports, module, relId) {
  63859. function amdRequire(deps, callback) {
  63860. if (typeof deps === 'string') {
  63861. //Synchronous, single module require('')
  63862. return stringRequire(systemRequire, exports, module, deps, relId);
  63863. } else {
  63864. //Array of dependencies with a callback.
  63865. //Convert the dependencies to modules.
  63866. deps = deps.map(function (depName) {
  63867. return stringRequire(systemRequire, exports, module, depName, relId);
  63868. });
  63869. //Wait for next tick to call back the require call.
  63870. if (callback) {
  63871. process.nextTick(function () {
  63872. callback.apply(null, deps);
  63873. });
  63874. }
  63875. }
  63876. }
  63877. amdRequire.toUrl = function (filePath) {
  63878. if (filePath.indexOf('.') === 0) {
  63879. return normalize(filePath, path.dirname(module.filename));
  63880. } else {
  63881. return filePath;
  63882. }
  63883. };
  63884. return amdRequire;
  63885. };
  63886. //Favor explicit value, passed in if the module wants to support Node 0.4.
  63887. requireFn = requireFn || function req() {
  63888. return module.require.apply(module, arguments);
  63889. };
  63890. function runFactory(id, deps, factory) {
  63891. var r, e, m, result;
  63892. if (id) {
  63893. e = loaderCache[id] = {};
  63894. m = {
  63895. id: id,
  63896. uri: __filename,
  63897. exports: e
  63898. };
  63899. r = makeRequire(requireFn, e, m, id);
  63900. } else {
  63901. //Only support one define call per file
  63902. if (alreadyCalled) {
  63903. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  63904. }
  63905. alreadyCalled = true;
  63906. //Use the real variables from node
  63907. //Use module.exports for exports, since
  63908. //the exports in here is amdefine exports.
  63909. e = module.exports;
  63910. m = module;
  63911. r = makeRequire(requireFn, e, m, module.id);
  63912. }
  63913. //If there are dependencies, they are strings, so need
  63914. //to convert them to dependency values.
  63915. if (deps) {
  63916. deps = deps.map(function (depName) {
  63917. return r(depName);
  63918. });
  63919. }
  63920. //Call the factory with the right dependencies.
  63921. if (typeof factory === 'function') {
  63922. result = factory.apply(m.exports, deps);
  63923. } else {
  63924. result = factory;
  63925. }
  63926. if (result !== undefined) {
  63927. m.exports = result;
  63928. if (id) {
  63929. loaderCache[id] = m.exports;
  63930. }
  63931. }
  63932. }
  63933. stringRequire = function (systemRequire, exports, module, id, relId) {
  63934. //Split the ID by a ! so that
  63935. var index = id.indexOf('!'),
  63936. originalId = id,
  63937. prefix, plugin;
  63938. if (index === -1) {
  63939. id = normalize(id, relId);
  63940. //Straight module lookup. If it is one of the special dependencies,
  63941. //deal with it, otherwise, delegate to node.
  63942. if (id === 'require') {
  63943. return makeRequire(systemRequire, exports, module, relId);
  63944. } else if (id === 'exports') {
  63945. return exports;
  63946. } else if (id === 'module') {
  63947. return module;
  63948. } else if (loaderCache.hasOwnProperty(id)) {
  63949. return loaderCache[id];
  63950. } else if (defineCache[id]) {
  63951. runFactory.apply(null, defineCache[id]);
  63952. return loaderCache[id];
  63953. } else {
  63954. if(systemRequire) {
  63955. return systemRequire(originalId);
  63956. } else {
  63957. throw new Error('No module with ID: ' + id);
  63958. }
  63959. }
  63960. } else {
  63961. //There is a plugin in play.
  63962. prefix = id.substring(0, index);
  63963. id = id.substring(index + 1, id.length);
  63964. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  63965. if (plugin.normalize) {
  63966. id = plugin.normalize(id, makeNormalize(relId));
  63967. } else {
  63968. //Normalize the ID normally.
  63969. id = normalize(id, relId);
  63970. }
  63971. if (loaderCache[id]) {
  63972. return loaderCache[id];
  63973. } else {
  63974. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  63975. return loaderCache[id];
  63976. }
  63977. }
  63978. };
  63979. //Create a define function specific to the module asking for amdefine.
  63980. function define(id, deps, factory) {
  63981. if (Array.isArray(id)) {
  63982. factory = deps;
  63983. deps = id;
  63984. id = undefined;
  63985. } else if (typeof id !== 'string') {
  63986. factory = id;
  63987. id = deps = undefined;
  63988. }
  63989. if (deps && !Array.isArray(deps)) {
  63990. factory = deps;
  63991. deps = undefined;
  63992. }
  63993. if (!deps) {
  63994. deps = ['require', 'exports', 'module'];
  63995. }
  63996. //Set up properties for this module. If an ID, then use
  63997. //internal cache. If no ID, then use the external variables
  63998. //for this node module.
  63999. if (id) {
  64000. //Put the module in deep freeze until there is a
  64001. //require call for it.
  64002. defineCache[id] = [id, deps, factory];
  64003. } else {
  64004. runFactory(id, deps, factory);
  64005. }
  64006. }
  64007. //define.require, which has access to all the values in the
  64008. //cache. Useful for AMD modules that all have IDs in the file,
  64009. //but need to finally export a value to node based on one of those
  64010. //IDs.
  64011. define.require = function (id) {
  64012. if (loaderCache[id]) {
  64013. return loaderCache[id];
  64014. }
  64015. if (defineCache[id]) {
  64016. runFactory.apply(null, defineCache[id]);
  64017. return loaderCache[id];
  64018. }
  64019. };
  64020. define.amd = {};
  64021. return define;
  64022. }(module)), require));